@spexcode/spec-dashboard 0.6.7 → 0.7.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/assets/App-CDnq7CoJ.js +2 -0
  2. package/dist/assets/EmptyView-9otc0raU.js +1 -0
  3. package/dist/assets/EvalsPage-CvJFW7Xx.js +2 -0
  4. package/dist/assets/FileView-CiopSqO_.js +2 -0
  5. package/dist/assets/GraphStats-CxHsXNy-.js +1 -0
  6. package/dist/assets/GraphView-CpSd8In8.js +26 -0
  7. package/dist/assets/IssuesPage-B0Lgqyjr.js +1 -0
  8. package/dist/assets/MobileApp-BWgx12mU.js +2 -0
  9. package/dist/assets/Modal-DbaOKtG9.js +1 -0
  10. package/dist/assets/NodeView-CVaIUdMO.js +3 -0
  11. package/dist/assets/ProjectsPage-B8i6SOxZ.js +1 -0
  12. package/dist/assets/ProseActions-CFA-z4t3.js +8 -0
  13. package/dist/assets/Settings-DCI7WK4U.js +1 -0
  14. package/dist/assets/SpecView-Cz828zhT.js +1 -0
  15. package/dist/assets/Thread-BD6H7vPk.js +9 -0
  16. package/dist/assets/WorkspaceSurface-CTZ5UUgv.js +2 -0
  17. package/dist/assets/index-BuOQYAQK.css +1 -0
  18. package/dist/assets/index-C6l-jpX4.js +40 -0
  19. package/dist/assets/index-DqfNBCzh.js +13 -0
  20. package/dist/assets/tabs-B7_g8HG7.js +334 -0
  21. package/dist/assets/tabs-Brk4lg7l.css +32 -0
  22. package/dist/index.html +3 -3
  23. package/dist-public/assets/App-5COraOZF.js +2 -0
  24. package/dist-public/assets/EmptyView-Dil8vYWz.js +1 -0
  25. package/dist-public/assets/EvalsPage-DnIhSuCK.js +2 -0
  26. package/dist-public/assets/FileView-BubZCad5.js +2 -0
  27. package/dist-public/assets/GraphStats-CxHsXNy-.js +1 -0
  28. package/dist-public/assets/GraphView-gPGwYpUk.js +26 -0
  29. package/dist-public/assets/IssuesPage-gbqBOftY.js +1 -0
  30. package/dist-public/assets/MobileApp-CAqNJ_Bh.js +2 -0
  31. package/dist-public/assets/Modal-B_Q59vv6.js +1 -0
  32. package/dist-public/assets/NodeView-B3WRY-q0.js +3 -0
  33. package/dist-public/assets/ProjectsPage-Z0t0yxxh.js +1 -0
  34. package/dist-public/assets/ProseActions-DPypFjCH.js +8 -0
  35. package/dist-public/assets/Settings-d9DTofmL.js +1 -0
  36. package/dist-public/assets/SpecView-CNGt9F1G.js +1 -0
  37. package/dist-public/assets/Thread-DIfN4RS4.js +9 -0
  38. package/dist-public/assets/WorkspaceSurface-BEDKMlRs.js +2 -0
  39. package/dist-public/assets/index-BJDLZCaX.js +13 -0
  40. package/dist-public/assets/index-BuOQYAQK.css +1 -0
  41. package/dist-public/assets/index-r6NCWBwM.js +40 -0
  42. package/dist-public/assets/tabs-BSpGhf1t.js +334 -0
  43. package/dist-public/assets/tabs-PFmT6UqQ.css +32 -0
  44. package/dist-public/index.html +3 -3
  45. package/package.json +10 -3
  46. package/dist/assets/App-CyvuxJYw.js +0 -2
  47. package/dist/assets/Dashboard-DUitEyrD.js +0 -27
  48. package/dist/assets/EvalsPage-PLgW05y7.js +0 -2
  49. package/dist/assets/IssuesPage-BcFWiFjF.js +0 -1
  50. package/dist/assets/MobileApp-Dky_U9DL.js +0 -2
  51. package/dist/assets/Modal-8cCCnDgy.js +0 -1
  52. package/dist/assets/PageScroll-GBlw382O.js +0 -1
  53. package/dist/assets/ProjectsPage-CdKKLnBH.js +0 -1
  54. package/dist/assets/SessionInterface-6GBZ9nXN.css +0 -32
  55. package/dist/assets/SessionInterface-Dp-rUO1H.js +0 -40
  56. package/dist/assets/SessionWindow-D2zgUVTT.js +0 -1
  57. package/dist/assets/Settings-7cKD-jHj.js +0 -1
  58. package/dist/assets/Thread-BkaL_dog.js +0 -13
  59. package/dist/assets/TimelineChat-Cp579UoJ.css +0 -1
  60. package/dist/assets/TimelineChat-DOKwQ3Sd.js +0 -276
  61. package/dist/assets/bindings-BC9vqpYU.js +0 -1
  62. package/dist/assets/data-CHkRTrsm.js +0 -1
  63. package/dist/assets/index-Ba-oHmxn.css +0 -1
  64. package/dist/assets/index-Di9gWPc6.js +0 -41
  65. package/dist/assets/sessionSurface-H34ExWBA.js +0 -1
  66. package/dist-public/assets/App-DebAWelc.js +0 -2
  67. package/dist-public/assets/Dashboard-DhuzsOUh.js +0 -27
  68. package/dist-public/assets/EvalsPage-CHc1tT-0.js +0 -2
  69. package/dist-public/assets/IssuesPage-BqojZnnr.js +0 -1
  70. package/dist-public/assets/MobileApp-DevENU8x.js +0 -2
  71. package/dist-public/assets/Modal-DAUYhrDn.js +0 -1
  72. package/dist-public/assets/PageScroll-Bxaqks4c.js +0 -1
  73. package/dist-public/assets/ProjectsPage-GHR6vTck.js +0 -1
  74. package/dist-public/assets/SessionInterface-6GBZ9nXN.css +0 -32
  75. package/dist-public/assets/SessionInterface-C0Fy_tWd.js +0 -40
  76. package/dist-public/assets/SessionWindow-CkdNpele.js +0 -1
  77. package/dist-public/assets/Settings-1XN_EQnW.js +0 -1
  78. package/dist-public/assets/Thread-BHCpsJIa.js +0 -13
  79. package/dist-public/assets/TimelineChat-N9RZ6v95.js +0 -276
  80. package/dist-public/assets/TimelineChat-dIRGbAJA.css +0 -1
  81. package/dist-public/assets/bindings-BC9vqpYU.js +0 -1
  82. package/dist-public/assets/data-BmO9k_xP.js +0 -1
  83. package/dist-public/assets/index-Ba-oHmxn.css +0 -1
  84. package/dist-public/assets/index-oM1cUuGR.js +0 -41
  85. package/dist-public/assets/sessionSurface-BNwc7E-I.js +0 -1
  86. /package/dist/assets/{Dashboard-BnuhLJ6X.css → GraphView-BnuhLJ6X.css} +0 -0
  87. /package/dist-public/assets/{Dashboard-BnuhLJ6X.css → GraphView-BnuhLJ6X.css} +0 -0
@@ -0,0 +1,334 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DqfNBCzh.js","assets/index-C6l-jpX4.js","assets/index-BuOQYAQK.css","assets/App-CDnq7CoJ.js","assets/Modal-DbaOKtG9.js","assets/GraphView-CpSd8In8.js","assets/NodeView-CVaIUdMO.js","assets/Thread-BD6H7vPk.js","assets/ProseActions-CFA-z4t3.js","assets/GraphStats-CxHsXNy-.js","assets/GraphView-BnuhLJ6X.css","assets/SpecView-Cz828zhT.js","assets/FileView-CiopSqO_.js","assets/EvalsPage-CvJFW7Xx.js","assets/IssuesPage-B0Lgqyjr.js","assets/Settings-DCI7WK4U.js","assets/EmptyView-9otc0raU.js"])))=>i.map(i=>d[i]);
2
+ import{v as M5,u as Ie,r as k,m as Di,j as m,I as ze,C as qa,w as T5,x as B5,a as Zt,y as a4,z as R5,A as N5,B as L5,D as O5,E as P5,F as F5,G as l4,H as I5,J as u4,k as Hi,K as Go,_ as Gs,L as z5,M as j5,O as H5,N as $5,Q as q5,e as W5,n as K5,R as V5,T as t0,i as U5,o as Y1,U as G5,W as Y5,X as X5}from"./index-C6l-jpX4.js";import{b as ni,r as Vt,i as J5,n as yn,p as mf,s as X1,f as Z5,d as gf,j as Q5,k as e_,u as vf,a as c4,l as h4,m as t_,e as bf,c as d4,h as i_}from"./App-CDnq7CoJ.js";import{i as ya,P as ru,M as la}from"./Modal-DbaOKtG9.js";const Hr=t=>{var e;return(t==null?void 0:t.title)||(t==null?void 0:t.headline)||(t==null?void 0:t.name)||(t==null?void 0:t.activity)||(t==null?void 0:t.note)||(t==null?void 0:t.promptPreview)||(t==null?void 0:t.node)||((e=t==null?void 0:t.raw)==null?void 0:e.title)||(t==null?void 0:t.branch)||(t==null?void 0:t.id)},f4=t=>(t==null?void 0:t.label)||(t==null?void 0:t.name)||(t==null?void 0:t.node)||(t==null?void 0:t.title)||(t==null?void 0:t.branch)||(t==null?void 0:t.id);/**
3
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
4
+ * @license MIT
5
+ *
6
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
7
+ * @license MIT
8
+ *
9
+ * Originally forked from (with the author's permission):
10
+ * Fabrice Bellard's javascript vt100 for jslinux:
11
+ * http://bellard.org/jslinux/
12
+ * Copyright (c) 2011 Fabrice Bellard
13
+ */var p4=Object.defineProperty,r_=Object.getOwnPropertyDescriptor,s_=(t,e)=>{for(var i in e)p4(t,i,{get:e[i],enumerable:!0})},wt=(t,e,i,r)=>{for(var s=r>1?void 0:r?r_(e,i):e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(s=(r?o(e,i,s):o(s))||s);return r&&s&&p4(e,i,s),s},fe=(t,e)=>(i,r)=>e(i,r,t),J1="Terminal input",nh={get:()=>J1,set:t=>J1=t},Z1="Too much output to announce, navigate to rows manually to read",oh={get:()=>Z1,set:t=>Z1=t};function n_(t){return t.replace(/\r?\n/g,"\r")}function o_(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function a_(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function l_(t,e,i,r){if(t.stopPropagation(),t.clipboardData){let s=t.clipboardData.getData("text/plain");m4(s,e,i,r)}}function m4(t,e,i,r){t=n_(t),t=o_(t,i.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(t,!0),e.value=""}function g4(t,e,i){let r=i.getBoundingClientRect(),s=t.clientX-r.left-10,n=t.clientY-r.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${s}px`,e.style.top=`${n}px`,e.style.zIndex="1000",e.focus()}function Q1(t,e,i,r,s){g4(t,e,i),s&&r.rightClickSelect(t),e.value=r.selectionText,e.select()}function Es(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function i0(t,e=0,i=t.length){let r="";for(let s=e;s<i;++s){let n=t[s];n>65535?(n-=65536,r+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):r+=String.fromCharCode(n)}return r}var u_=class{constructor(){this._interim=0}clear(){this._interim=0}decode(t,e){let i=t.length;if(!i)return 0;let r=0,s=0;if(this._interim){let n=t.charCodeAt(s++);56320<=n&&n<=57343?e[r++]=(this._interim-55296)*1024+n-56320+65536:(e[r++]=this._interim,e[r++]=n),this._interim=0}for(let n=s;n<i;++n){let o=t.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=i)return this._interim=o,r;let a=t.charCodeAt(n);56320<=a&&a<=57343?e[r++]=(o-55296)*1024+a-56320+65536:(e[r++]=o,e[r++]=a);continue}o!==65279&&(e[r++]=o)}return r}},c_=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(t,e){let i=t.length;if(!i)return 0;let r=0,s,n,o,a,l=0,u=0;if(this.interim[0]){let d=!1,f=this.interim[0];f&=(f&224)===192?31:(f&240)===224?15:7;let p=0,v;for(;(v=this.interim[++p]&63)&&p<4;)f<<=6,f|=v;let _=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,w=_-p;for(;u<w;){if(u>=i)return 0;if(v=t[u++],(v&192)!==128){u--,d=!0;break}else this.interim[p++]=v,f<<=6,f|=v&63}d||(_===2?f<128?u--:e[r++]=f:_===3?f<2048||f>=55296&&f<=57343||f===65279||(e[r++]=f):f<65536||f>1114111||(e[r++]=f)),this.interim.fill(0)}let c=i-4,h=u;for(;h<i;){for(;h<c&&!((s=t[h])&128)&&!((n=t[h+1])&128)&&!((o=t[h+2])&128)&&!((a=t[h+3])&128);)e[r++]=s,e[r++]=n,e[r++]=o,e[r++]=a,h+=4;if(s=t[h++],s<128)e[r++]=s;else if((s&224)===192){if(h>=i)return this.interim[0]=s,r;if(n=t[h++],(n&192)!==128){h--;continue}if(l=(s&31)<<6|n&63,l<128){h--;continue}e[r++]=l}else if((s&240)===224){if(h>=i)return this.interim[0]=s,r;if(n=t[h++],(n&192)!==128){h--;continue}if(h>=i)return this.interim[0]=s,this.interim[1]=n,r;if(o=t[h++],(o&192)!==128){h--;continue}if(l=(s&15)<<12|(n&63)<<6|o&63,l<2048||l>=55296&&l<=57343||l===65279)continue;e[r++]=l}else if((s&248)===240){if(h>=i)return this.interim[0]=s,r;if(n=t[h++],(n&192)!==128){h--;continue}if(h>=i)return this.interim[0]=s,this.interim[1]=n,r;if(o=t[h++],(o&192)!==128){h--;continue}if(h>=i)return this.interim[0]=s,this.interim[1]=n,this.interim[2]=o,r;if(a=t[h++],(a&192)!==128){h--;continue}if(l=(s&7)<<18|(n&63)<<12|(o&63)<<6|a&63,l<65536||l>1114111)continue;e[r++]=l}}return r}},v4="",Os=" ",Wa=class b4{constructor(){this.fg=0,this.bg=0,this.extended=new wu}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new b4;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},wu=class _4{constructor(e=0,i=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new _4(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},rr=class y4 extends Wa{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new wu,this.combinedData=""}static fromCharData(e){let i=new y4;return i.setFromCharData(e),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Es(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let i=!1;if(e[1].length>2)i=!0;else if(e[1].length===2){let r=e[1].charCodeAt(0);if(55296<=r&&r<=56319){let s=e[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(r-55296)*1024+s-56320+65536|e[2]<<22:i=!0}else i=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;i&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ep="di$target",ah="di$dependencies",W0=new Map;function h_(t){return t[ah]||[]}function Qt(t){if(W0.has(t))return W0.get(t);let e=function(i,r,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");d_(e,i,s)};return e._id=t,W0.set(t,e),e}function d_(t,e,i){e[ep]===e?e[ah].push({id:t,index:i}):(e[ah]=[{id:t,index:i}],e[ep]=e)}var yi=Qt("BufferService"),w4=Qt("CoreMouseService"),Ln=Qt("CoreService"),f_=Qt("CharsetService"),_f=Qt("InstantiationService"),x4=Qt("LogService"),wi=Qt("OptionsService"),S4=Qt("OscLinkService"),p_=Qt("UnicodeService"),Ka=Qt("DecorationService"),lh=class{constructor(t,e,i){this._bufferService=t,this._optionsService=e,this._oscLinkService=i}provideLinks(t,e){var c;let i=this._bufferService.buffer.lines.get(t-1);if(!i){e(void 0);return}let r=[],s=this._optionsService.rawOptions.linkHandler,n=new rr,o=i.getTrimmedLength(),a=-1,l=-1,u=!1;for(let h=0;h<o;h++)if(!(l===-1&&!i.hasContent(h))){if(i.loadCell(h,n),n.hasExtendedAttrs()&&n.extended.urlId)if(l===-1){l=h,a=n.extended.urlId;continue}else u=n.extended.urlId!==a;else l!==-1&&(u=!0);if(u||l!==-1&&h===o-1){let d=(c=this._oscLinkService.getLinkData(a))==null?void 0:c.uri;if(d){let f={start:{x:l+1,y:t},end:{x:h+(!u&&h===o-1?1:0),y:t}},p=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{let v=new URL(d);["http:","https:"].includes(v.protocol)||(p=!0)}catch{p=!0}p||r.push({text:d,range:f,activate:(v,_)=>s?s.activate(v,_,f):m_(v,_),hover:(v,_)=>{var w;return(w=s==null?void 0:s.hover)==null?void 0:w.call(s,v,_,f)},leave:(v,_)=>{var w;return(w=s==null?void 0:s.leave)==null?void 0:w.call(s,v,_,f)}})}u=!1,n.hasExtendedAttrs()&&n.extended.urlId?(l=h,a=n.extended.urlId):(l=-1,a=-1)}}e(r)}};lh=wt([fe(0,yi),fe(1,wi),fe(2,S4)],lh);function m_(t,e){if(confirm(`Do you want to navigate to ${e}?
14
+
15
+ WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}var r0=Qt("CharSizeService"),hs=Qt("CoreBrowserService"),yf=Qt("MouseService"),ds=Qt("RenderService"),g_=Qt("SelectionService"),k4=Qt("CharacterJoinerService"),Co=Qt("ThemeService"),C4=Qt("LinkProviderService"),v_=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?tp.isErrorNoTelemetry(t)?new tp(t.message+`
16
+
17
+ `+t.stack):new Error(t.message+`
18
+
19
+ `+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(e=>{e(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},b_=new v_;function su(t){__(t)||b_.onUnexpectedError(t)}var uh="Canceled";function __(t){return t instanceof y_?!0:t instanceof Error&&t.name===uh&&t.message===uh}var y_=class extends Error{constructor(){super(uh),this.name=this.message}};function w_(t){return new Error(`Illegal argument: ${t}`)}var tp=class ch extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof ch)return e;let i=new ch;return i.message=e.message,i.stack=e.stack,i}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},hh=class A4 extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,A4.prototype)}};function Pi(t,e=0){return t[t.length-(1+e)]}var x_;(t=>{function e(n){return n<0}t.isLessThan=e;function i(n){return n<=0}t.isLessThanOrEqual=i;function r(n){return n>0}t.isGreaterThan=r;function s(n){return n===0}t.isNeitherLessOrGreaterThan=s,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(x_||(x_={}));function S_(t,e){let i=this,r=!1,s;return function(){return r||(r=!0,e||(s=t.apply(i,arguments))),s}}var E4;(t=>{function e(D){return D&&typeof D=="object"&&typeof D[Symbol.iterator]=="function"}t.is=e;let i=Object.freeze([]);function r(){return i}t.empty=r;function*s(D){yield D}t.single=s;function n(D){return e(D)?D:s(D)}t.wrap=n;function o(D){return D||i}t.from=o;function*a(D){for(let R=D.length-1;R>=0;R--)yield D[R]}t.reverse=a;function l(D){return!D||D[Symbol.iterator]().next().done===!0}t.isEmpty=l;function u(D){return D[Symbol.iterator]().next().value}t.first=u;function c(D,R){let E=0;for(let L of D)if(R(L,E++))return!0;return!1}t.some=c;function h(D,R){for(let E of D)if(R(E))return E}t.find=h;function*d(D,R){for(let E of D)R(E)&&(yield E)}t.filter=d;function*f(D,R){let E=0;for(let L of D)yield R(L,E++)}t.map=f;function*p(D,R){let E=0;for(let L of D)yield*R(L,E++)}t.flatMap=p;function*v(...D){for(let R of D)yield*R}t.concat=v;function _(D,R,E){let L=E;for(let q of D)L=R(L,q);return L}t.reduce=_;function*w(D,R,E=D.length){for(R<0&&(R+=D.length),E<0?E+=D.length:E>D.length&&(E=D.length);R<E;R++)yield D[R]}t.slice=w;function x(D,R=Number.POSITIVE_INFINITY){let E=[];if(R===0)return[E,D];let L=D[Symbol.iterator]();for(let q=0;q<R;q++){let F=L.next();if(F.done)return[E,t.empty()];E.push(F.value)}return[E,{[Symbol.iterator](){return L}}]}t.consume=x;async function C(D){let R=[];for await(let E of D)R.push(E);return Promise.resolve(R)}t.asyncToArray=C})(E4||(E4={}));function Cn(t){if(E4.is(t)){let e=[];for(let i of t)if(i)try{i.dispose()}catch(r){e.push(r)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function k_(...t){return ut(()=>Cn(t))}function ut(t){return{dispose:S_(()=>{t()})}}var D4=class M4{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Cn(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?M4.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};D4.DISABLE_DISPOSED_WARNING=!1;var zs=D4,Fe=class{constructor(){this._store=new zs,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Fe.None=Object.freeze({dispose(){}});var co=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){var e;this._isDisposed||t===this._value||((e=this._value)==null||e.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){var t;this._isDisposed=!0,(t=this._value)==null||t.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},is=typeof window=="object"?window:globalThis,dh=class fh{constructor(e){this.element=e,this.next=fh.Undefined,this.prev=fh.Undefined}};dh.Undefined=new dh(void 0);var ft=dh,ip=class{constructor(){this._first=ft.Undefined,this._last=ft.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ft.Undefined}clear(){let t=this._first;for(;t!==ft.Undefined;){let e=t.next;t.prev=ft.Undefined,t.next=ft.Undefined,t=e}this._first=ft.Undefined,this._last=ft.Undefined,this._size=0}unshift(t){return this._insert(t,!1)}push(t){return this._insert(t,!0)}_insert(t,e){let i=new ft(t);if(this._first===ft.Undefined)this._first=i,this._last=i;else if(e){let s=this._last;this._last=i,i.prev=s,s.next=i}else{let s=this._first;this._first=i,i.next=s,s.prev=i}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(i))}}shift(){if(this._first!==ft.Undefined){let t=this._first.element;return this._remove(this._first),t}}pop(){if(this._last!==ft.Undefined){let t=this._last.element;return this._remove(this._last),t}}_remove(t){if(t.prev!==ft.Undefined&&t.next!==ft.Undefined){let e=t.prev;e.next=t.next,t.next.prev=e}else t.prev===ft.Undefined&&t.next===ft.Undefined?(this._first=ft.Undefined,this._last=ft.Undefined):t.next===ft.Undefined?(this._last=this._last.prev,this._last.next=ft.Undefined):t.prev===ft.Undefined&&(this._first=this._first.next,this._first.prev=ft.Undefined);this._size-=1}*[Symbol.iterator](){let t=this._first;for(;t!==ft.Undefined;)yield t.element,t=t.next}},C_=globalThis.performance&&typeof globalThis.performance.now=="function",A_=class T4{static create(e){return new T4(e)}constructor(e){this._now=C_&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},si;(t=>{t.None=()=>Fe.None;function e(z,j){return h(z,()=>{},0,void 0,!0,void 0,j)}t.defer=e;function i(z){return(j,A=null,O)=>{let T=!1,U;return U=z(H=>{if(!T)return U?U.dispose():T=!0,j.call(A,H)},null,O),T&&U.dispose(),U}}t.once=i;function r(z,j,A){return u((O,T=null,U)=>z(H=>O.call(T,j(H)),null,U),A)}t.map=r;function s(z,j,A){return u((O,T=null,U)=>z(H=>{j(H),O.call(T,H)},null,U),A)}t.forEach=s;function n(z,j,A){return u((O,T=null,U)=>z(H=>j(H)&&O.call(T,H),null,U),A)}t.filter=n;function o(z){return z}t.signal=o;function a(...z){return(j,A=null,O)=>{let T=k_(...z.map(U=>U(H=>j.call(A,H))));return c(T,O)}}t.any=a;function l(z,j,A,O){let T=A;return r(z,U=>(T=j(T,U),T),O)}t.reduce=l;function u(z,j){let A,O={onWillAddFirstListener(){A=z(T.fire,T)},onDidRemoveLastListener(){A==null||A.dispose()}},T=new ue(O);return j==null||j.add(T),T.event}function c(z,j){return j instanceof Array?j.push(z):j&&j.add(z),z}function h(z,j,A=100,O=!1,T=!1,U,H){let re,G,X,oe=0,I,Y={leakWarningThreshold:U,onWillAddFirstListener(){re=z(te=>{oe++,G=j(G,te),O&&!X&&(le.fire(G),G=void 0),I=()=>{let de=G;G=void 0,X=void 0,(!O||oe>1)&&le.fire(de),oe=0},typeof A=="number"?(clearTimeout(X),X=setTimeout(I,A)):X===void 0&&(X=0,queueMicrotask(I))})},onWillRemoveListener(){T&&oe>0&&(I==null||I())},onDidRemoveLastListener(){I=void 0,re.dispose()}},le=new ue(Y);return H==null||H.add(le),le.event}t.debounce=h;function d(z,j=0,A){return t.debounce(z,(O,T)=>O?(O.push(T),O):[T],j,void 0,!0,void 0,A)}t.accumulate=d;function f(z,j=(O,T)=>O===T,A){let O=!0,T;return n(z,U=>{let H=O||!j(U,T);return O=!1,T=U,H},A)}t.latch=f;function p(z,j,A){return[t.filter(z,j,A),t.filter(z,O=>!j(O),A)]}t.split=p;function v(z,j=!1,A=[],O){let T=A.slice(),U=z(G=>{T?T.push(G):re.fire(G)});O&&O.add(U);let H=()=>{T==null||T.forEach(G=>re.fire(G)),T=null},re=new ue({onWillAddFirstListener(){U||(U=z(G=>re.fire(G)),O&&O.add(U))},onDidAddFirstListener(){T&&(j?setTimeout(H):H())},onDidRemoveLastListener(){U&&U.dispose(),U=null}});return O&&O.add(re),re.event}t.buffer=v;function _(z,j){return(A,O,T)=>{let U=j(new x);return z(function(H){let re=U.evaluate(H);re!==w&&A.call(O,re)},void 0,T)}}t.chain=_;let w=Symbol("HaltChainable");class x{constructor(){this.steps=[]}map(j){return this.steps.push(j),this}forEach(j){return this.steps.push(A=>(j(A),A)),this}filter(j){return this.steps.push(A=>j(A)?A:w),this}reduce(j,A){let O=A;return this.steps.push(T=>(O=j(O,T),O)),this}latch(j=(A,O)=>A===O){let A=!0,O;return this.steps.push(T=>{let U=A||!j(T,O);return A=!1,O=T,U?T:w}),this}evaluate(j){for(let A of this.steps)if(j=A(j),j===w)break;return j}}function C(z,j,A=O=>O){let O=(...re)=>H.fire(A(...re)),T=()=>z.on(j,O),U=()=>z.removeListener(j,O),H=new ue({onWillAddFirstListener:T,onDidRemoveLastListener:U});return H.event}t.fromNodeEventEmitter=C;function D(z,j,A=O=>O){let O=(...re)=>H.fire(A(...re)),T=()=>z.addEventListener(j,O),U=()=>z.removeEventListener(j,O),H=new ue({onWillAddFirstListener:T,onDidRemoveLastListener:U});return H.event}t.fromDOMEventEmitter=D;function R(z){return new Promise(j=>i(z)(j))}t.toPromise=R;function E(z){let j=new ue;return z.then(A=>{j.fire(A)},()=>{j.fire(void 0)}).finally(()=>{j.dispose()}),j.event}t.fromPromise=E;function L(z,j){return z(A=>j.fire(A))}t.forward=L;function q(z,j,A){return j(A),z(O=>j(O))}t.runAndSubscribe=q;class F{constructor(j,A){this._observable=j,this._counter=0,this._hasChanged=!1;let O={onWillAddFirstListener:()=>{j.addObserver(this)},onDidRemoveLastListener:()=>{j.removeObserver(this)}};this.emitter=new ue(O),A&&A.add(this.emitter)}beginUpdate(j){this._counter++}handlePossibleChange(j){}handleChange(j,A){this._hasChanged=!0}endUpdate(j){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function $(z,j){return new F(z,j).emitter.event}t.fromObservable=$;function W(z){return(j,A,O)=>{let T=0,U=!1,H={beginUpdate(){T++},endUpdate(){T--,T===0&&(z.reportChanges(),U&&(U=!1,j.call(A)))},handlePossibleChange(){},handleChange(){U=!0}};z.addObserver(H),z.reportChanges();let re={dispose(){z.removeObserver(H)}};return O instanceof zs?O.add(re):Array.isArray(O)&&O.push(re),re}}t.fromObservableLight=W})(si||(si={}));var ph=class mh{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${mh._idPool++}`,mh.all.add(this)}start(e){this._stopWatch=new A_,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};ph.all=new Set,ph._idPool=0;var E_=ph,D_=-1,B4=class R4{constructor(e,i,r=(R4._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=i,this.name=r,this._warnCountdown=0}dispose(){var e;(e=this._stacks)==null||e.clear()}check(e,i){let r=this.threshold;if(r<=0||i<r)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[n,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(n);let l=new B_(a,n);this._errorHandler(l)}return()=>{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[r,s]of this._stacks)(!e||i<s)&&(e=[r,s],i=s);return e}};B4._idPool=1;var M_=B4,T_=class N4{constructor(e){this.value=e}static create(){let e=new Error;return new N4(e.stack??"")}print(){console.warn(this.value.split(`
20
+ `).slice(2).join(`
21
+ `))}},B_=class extends Error{constructor(t,e){super(t),this.name="ListenerLeakError",this.stack=e}},R_=class extends Error{constructor(t,e){super(t),this.name="ListenerRefusalError",this.stack=e}},N_=0,K0=class{constructor(t){this.value=t,this.id=N_++}},L_=2,O_,ue=class{constructor(t){var e,i,r,s;this._size=0,this._options=t,this._leakageMon=(e=this._options)!=null&&e.leakWarningThreshold?new M_((t==null?void 0:t.onListenerError)??su,((i=this._options)==null?void 0:i.leakWarningThreshold)??D_):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new E_(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var t,e,i,r;this._disposed||(this._disposed=!0,((t=this._deliveryQueue)==null?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(i=(e=this._options)==null?void 0:e.onDidRemoveLastListener)==null||i.call(e),(r=this._leakageMon)==null||r.dispose())}get event(){return this._event??(this._event=(t,e,i)=>{var o,a,l,u,c;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let h=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(h);let d=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],f=new R_(`${h}. HINT: Stack shows most frequent listener (${d[1]}-times)`,d[0]);return(((o=this._options)==null?void 0:o.onListenerError)||su)(f),Fe.None}if(this._disposed)return Fe.None;e&&(t=t.bind(e));let r=new K0(t),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=T_.create(),s=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof K0?(this._deliveryQueue??(this._deliveryQueue=new P_),this._listeners=[this._listeners,r]):this._listeners.push(r):((l=(a=this._options)==null?void 0:a.onWillAddFirstListener)==null||l.call(a,this),this._listeners=r,(c=(u=this._options)==null?void 0:u.onDidAddFirstListener)==null||c.call(u,this)),this._size++;let n=ut(()=>{s==null||s(),this._removeListener(r)});return i instanceof zs?i.add(n):Array.isArray(i)&&i.push(n),n}),this._event}_removeListener(t){var s,n,o,a;if((n=(s=this._options)==null?void 0:s.onWillRemoveListener)==null||n.call(s,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(a=(o=this._options)==null?void 0:o.onDidRemoveLastListener)==null||a.call(o,this),this._size=0;return}let e=this._listeners,i=e.indexOf(t);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,e[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*L_<=e.length){let l=0;for(let u=0;u<e.length;u++)e[u]?e[l++]=e[u]:r&&(this._deliveryQueue.end--,l<this._deliveryQueue.i&&this._deliveryQueue.i--);e.length=l}}_deliver(t,e){var r;if(!t)return;let i=((r=this._options)==null?void 0:r.onListenerError)||su;if(!i){t.value(e);return}try{t.value(e)}catch(s){i(s)}}_deliverQueue(t){let e=t.current._listeners;for(;t.i<t.end;)this._deliver(e[t.i++],t.value);t.reset()}fire(t){var e,i,r,s;if((e=this._deliveryQueue)!=null&&e.current&&(this._deliverQueue(this._deliveryQueue),(i=this._perfMon)==null||i.stop()),(r=this._perfMon)==null||r.start(this._size),this._listeners)if(this._listeners instanceof K0)this._deliver(this._listeners,t);else{let n=this._deliveryQueue;n.enqueue(this,t,this._listeners.length),this._deliverQueue(n)}(s=this._perfMon)==null||s.stop()}hasListeners(){return this._size>0}},P_=class{constructor(){this.i=-1,this.end=0}enqueue(t,e,i){this.i=0,this.end=i,this.current=t,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},gh=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ue,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ue,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,i){if(this.getZoomLevel(i)===e)return;let r=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(r,e),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),e)}setFullscreen(e,i){if(this.isFullscreen(i)===e)return;let r=this.getWindowId(i);this.mapWindowIdToFullScreen.set(r,e),this._onDidChangeFullscreen.fire(r)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};gh.INSTANCE=new gh;var wf=gh;function F_(t,e,i){typeof e=="string"&&(e=t.matchMedia(e)),e.addEventListener("change",i)}wf.INSTANCE.onDidChangeZoomLevel;function I_(t){return wf.INSTANCE.getZoomFactor(t)}wf.INSTANCE.onDidChangeFullscreen;var Ao=typeof navigator=="object"?navigator.userAgent:"",vh=Ao.indexOf("Firefox")>=0,z_=Ao.indexOf("AppleWebKit")>=0,xf=Ao.indexOf("Chrome")>=0,j_=!xf&&Ao.indexOf("Safari")>=0;Ao.indexOf("Electron/")>=0;Ao.indexOf("Android")>=0;var V0=!1;if(typeof is.matchMedia=="function"){let t=is.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=is.matchMedia("(display-mode: fullscreen)");V0=t.matches,F_(is,t,({matches:i})=>{V0&&e.matches||(V0=i)})}var Jn="en",bh=!1,_h=!1,nu=!1,L4=!1,hl,ou=Jn,rp=Jn,H_,ar,wn=globalThis,ii,s4;typeof wn.vscode<"u"&&typeof wn.vscode.process<"u"?ii=wn.vscode.process:typeof process<"u"&&typeof((s4=process==null?void 0:process.versions)==null?void 0:s4.node)=="string"&&(ii=process);var n4,$_=typeof((n4=ii==null?void 0:ii.versions)==null?void 0:n4.electron)=="string",q_=$_&&(ii==null?void 0:ii.type)==="renderer",o4;if(typeof ii=="object"){bh=ii.platform==="win32",_h=ii.platform==="darwin",nu=ii.platform==="linux",nu&&ii.env.SNAP&&ii.env.SNAP_REVISION,ii.env.CI||ii.env.BUILD_ARTIFACTSTAGINGDIRECTORY,hl=Jn,ou=Jn;let t=ii.env.VSCODE_NLS_CONFIG;if(t)try{let e=JSON.parse(t);hl=e.userLocale,rp=e.osLocale,ou=e.resolvedLanguage||Jn,H_=(o4=e.languagePack)==null?void 0:o4.translationsConfigFile}catch{}L4=!0}else typeof navigator=="object"&&!q_?(ar=navigator.userAgent,bh=ar.indexOf("Windows")>=0,_h=ar.indexOf("Macintosh")>=0,(ar.indexOf("Macintosh")>=0||ar.indexOf("iPad")>=0||ar.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,nu=ar.indexOf("Linux")>=0,(ar==null?void 0:ar.indexOf("Mobi"))>=0,ou=globalThis._VSCODE_NLS_LANGUAGE||Jn,hl=navigator.language.toLowerCase(),rp=hl):console.error("Unable to resolve platform.");var O4=bh,jr=_h,W_=nu,sp=L4,$r=ar,xs=ou,K_;(t=>{function e(){return xs}t.value=e;function i(){return xs.length===2?xs==="en":xs.length>=3?xs[0]==="e"&&xs[1]==="n"&&xs[2]==="-":!1}t.isDefaultVariant=i;function r(){return xs==="en"}t.isDefault=r})(K_||(K_={}));var V_=typeof wn.postMessage=="function"&&!wn.importScripts;(()=>{if(V_){let t=[];wn.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let r=0,s=t.length;r<s;r++){let n=t[r];if(n.id===i.data.vscodeScheduleAsyncWork){t.splice(r,1),n.callback();return}}});let e=0;return i=>{let r=++e;t.push({id:r,callback:i}),wn.postMessage({vscodeScheduleAsyncWork:r},"*")}}return t=>setTimeout(t)})();var U_=!!($r&&$r.indexOf("Chrome")>=0);$r&&$r.indexOf("Firefox")>=0;!U_&&$r&&$r.indexOf("Safari")>=0;$r&&$r.indexOf("Edg/")>=0;$r&&$r.indexOf("Android")>=0;var Wn=typeof navigator=="object"?navigator:{};sp||document.queryCommandSupported&&document.queryCommandSupported("copy")||Wn&&Wn.clipboard&&Wn.clipboard.writeText,sp||Wn&&Wn.clipboard&&Wn.clipboard.readText;var Sf=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(t,e){this._keyCodeToStr[t]=e,this._strToKeyCode[e.toLowerCase()]=t}keyCodeToStr(t){return this._keyCodeToStr[t]}strToKeyCode(t){return this._strToKeyCode[t.toLowerCase()]||0}},U0=new Sf,np=new Sf,op=new Sf,G_=new Array(230),P4;(t=>{function e(a){return U0.keyCodeToStr(a)}t.toString=e;function i(a){return U0.strToKeyCode(a)}t.fromString=i;function r(a){return np.keyCodeToStr(a)}t.toUserSettingsUS=r;function s(a){return op.keyCodeToStr(a)}t.toUserSettingsGeneral=s;function n(a){return np.strToKeyCode(a)||op.strToKeyCode(a)}t.fromUserSettings=n;function o(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return U0.keyCodeToStr(a)}t.toElectronAccelerator=o})(P4||(P4={}));var Y_=class F4{constructor(e,i,r,s,n){this.ctrlKey=e,this.shiftKey=i,this.altKey=r,this.metaKey=s,this.keyCode=n}equals(e){return e instanceof F4&&this.ctrlKey===e.ctrlKey&&this.shiftKey===e.shiftKey&&this.altKey===e.altKey&&this.metaKey===e.metaKey&&this.keyCode===e.keyCode}getHashCode(){let e=this.ctrlKey?"1":"0",i=this.shiftKey?"1":"0",r=this.altKey?"1":"0",s=this.metaKey?"1":"0";return`K${e}${i}${r}${s}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new X_([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},X_=class{constructor(t){if(t.length===0)throw w_("chords");this.chords=t}getHashCode(){let t="";for(let e=0,i=this.chords.length;e<i;e++)e!==0&&(t+=";"),t+=this.chords[e].getHashCode();return t}equals(t){if(t===null||this.chords.length!==t.chords.length)return!1;for(let e=0;e<this.chords.length;e++)if(!this.chords[e].equals(t.chords[e]))return!1;return!0}};function J_(t){if(t.charCode){let i=String.fromCharCode(t.charCode).toUpperCase();return P4.fromString(i)}let e=t.keyCode;if(e===3)return 7;if(vh)switch(e){case 59:return 85;case 60:if(W_)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(jr)return 57;break}else if(z_&&(jr&&e===93||!jr&&e===92))return 57;return G_[e]||0}var Z_=jr?256:2048,Q_=512,e8=1024,t8=jr?2048:256,ap=class{constructor(t){var i;this._standardKeyboardEventBrand=!0;let e=t;this.browserEvent=e,this.target=e.target,this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey,this.altGraphKey=(i=e.getModifierState)==null?void 0:i.call(e,"AltGraph"),this.keyCode=J_(e),this.code=e.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(t){return this._asKeybinding===t}_computeKeybinding(){let t=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(t=this.keyCode);let e=0;return this.ctrlKey&&(e|=Z_),this.altKey&&(e|=Q_),this.shiftKey&&(e|=e8),this.metaKey&&(e|=t8),e|=t,e}_computeKeyCodeChord(){let t=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(t=this.keyCode),new Y_(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,t)}},lp=new WeakMap;function i8(t){if(!t.parent||t.parent===t)return null;try{let e=t.location,i=t.parent.location;if(e.origin!=="null"&&i.origin!=="null"&&e.origin!==i.origin)return null}catch{return null}return t.parent}var r8=class{static getSameOriginWindowChain(t){let e=lp.get(t);if(!e){e=[],lp.set(t,e);let i=t,r;do r=i8(i),r?e.push({window:new WeakRef(i),iframeElement:i.frameElement||null}):e.push({window:new WeakRef(i),iframeElement:null}),i=r;while(i)}return e.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(t,e){if(!e||t===e)return{top:0,left:0};let i=0,r=0,s=this.getSameOriginWindowChain(t);for(let n of s){let o=n.window.deref();if(i+=(o==null?void 0:o.scrollY)??0,r+=(o==null?void 0:o.scrollX)??0,o===e||!n.iframeElement)break;let a=n.iframeElement.getBoundingClientRect();i+=a.top,r+=a.left}return{top:i,left:r}}},dl=class{constructor(t,e){this.timestamp=Date.now(),this.browserEvent=e,this.leftButton=e.button===0,this.middleButton=e.button===1,this.rightButton=e.button===2,this.buttons=e.buttons,this.target=e.target,this.detail=e.detail||1,e.type==="dblclick"&&(this.detail=2),this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey,typeof e.pageX=="number"?(this.posx=e.pageX,this.posy=e.pageY):(this.posx=e.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=e.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let i=r8.getPositionOfChildWindowRelativeToAncestorWindow(t,e.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},up=class{constructor(t,e=0,i=0){var s;this.browserEvent=t||null,this.target=t?t.target||t.targetNode||t.srcElement:null,this.deltaY=i,this.deltaX=e;let r=!1;if(xf){let n=navigator.userAgent.match(/Chrome\/(\d+)/);r=(n?parseInt(n[1]):123)<=122}if(t){let n=t,o=t,a=((s=t.view)==null?void 0:s.devicePixelRatio)||1;if(typeof n.wheelDeltaY<"u")r?this.deltaY=n.wheelDeltaY/(120*a):this.deltaY=n.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(t.type==="wheel"){let l=t;l.deltaMode===l.DOM_DELTA_LINE?vh&&!jr?this.deltaY=-t.deltaY/3:this.deltaY=-t.deltaY:this.deltaY=-t.deltaY/40}if(typeof n.wheelDeltaX<"u")j_&&O4?this.deltaX=-(n.wheelDeltaX/120):r?this.deltaX=n.wheelDeltaX/(120*a):this.deltaX=n.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-t.detail/3;else if(t.type==="wheel"){let l=t;l.deltaMode===l.DOM_DELTA_LINE?vh&&!jr?this.deltaX=-t.deltaX/3:this.deltaX=-t.deltaX:this.deltaX=-t.deltaX/40}this.deltaY===0&&this.deltaX===0&&t.wheelDelta&&(r?this.deltaY=t.wheelDelta/(120*a):this.deltaY=t.wheelDelta/120)}}preventDefault(){var t;(t=this.browserEvent)==null||t.preventDefault()}stopPropagation(){var t;(t=this.browserEvent)==null||t.stopPropagation()}},I4=Object.freeze(function(t,e){let i=setTimeout(t.bind(e),0);return{dispose(){clearTimeout(i)}}}),s8;(t=>{function e(i){return i===t.None||i===t.Cancelled||i instanceof n8?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}t.isCancellationToken=e,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:si.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:I4})})(s8||(s8={}));var n8=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?I4:(this._emitter||(this._emitter=new ue),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},kf=class{constructor(t,e){this._isDisposed=!1,this._token=-1,typeof t=="function"&&typeof e=="number"&&this.setIfNotSet(t,e)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(t,e){if(this._isDisposed)throw new hh("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,t()},e)}setIfNotSet(t,e){if(this._isDisposed)throw new hh("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,t()},e))}},o8=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var t;(t=this.disposable)==null||t.dispose(),this.disposable=void 0}cancelAndSet(t,e,i=globalThis){if(this.isDisposed)throw new hh("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=i.setInterval(()=>{t()},e);this.disposable=ut(()=>{i.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},a8;(t=>{async function e(r){let s,n=await Promise.all(r.map(o=>o.then(a=>a,a=>{s||(s=a)})));if(typeof s<"u")throw s;return n}t.settled=e;function i(r){return new Promise(async(s,n)=>{try{await r(s,n)}catch(o){n(o)}})}t.withAsyncBody=i})(a8||(a8={}));var cp=class Zi{static fromArray(e){return new Zi(i=>{i.emitMany(e)})}static fromPromise(e){return new Zi(async i=>{i.emitMany(await e)})}static fromPromises(e){return new Zi(async i=>{await Promise.all(e.map(async r=>i.emitOne(await r)))})}static merge(e){return new Zi(async i=>{await Promise.all(e.map(async r=>{for await(let s of r)i.emitOne(s)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new ue,queueMicrotask(async()=>{let r={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(e(r)),this.resolve()}catch(s){this.reject(s)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await si.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var i;return(i=this._onReturn)==null||i.call(this),{done:!0,value:void 0}}}}static map(e,i){return new Zi(async r=>{for await(let s of e)r.emitOne(i(s))})}map(e){return Zi.map(this,e)}static filter(e,i){return new Zi(async r=>{for await(let s of e)i(s)&&r.emitOne(s)})}filter(e){return Zi.filter(this,e)}static coalesce(e){return Zi.filter(e,i=>!!i)}coalesce(){return Zi.coalesce(this)}static async toPromise(e){let i=[];for await(let r of e)i.push(r);return i}toPromise(){return Zi.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};cp.EMPTY=cp.fromArray([]);var{getWindow:Rr,getWindowId:l8,onDidRegisterWindow:u8}=function(){let t=new Map,e={window:is,disposables:new zs};t.set(is.vscodeWindowId,e);let i=new ue,r=new ue,s=new ue;function n(o,a){return(typeof o=="number"?t.get(o):void 0)??(a?e:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:r.event,registerWindow(o){if(t.has(o.vscodeWindowId))return Fe.None;let a=new zs,l={window:o,disposables:a.add(new zs)};return t.set(o.vscodeWindowId,l),a.add(ut(()=>{t.delete(o.vscodeWindowId),r.fire(o)})),a.add(Te(o,Ut.BEFORE_UNLOAD,()=>{s.fire(o)})),i.fire(l),a},getWindows(){return t.values()},getWindowsCount(){return t.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return t.has(o)},getWindowById:n,getWindow(o){var u;let a=o;if((u=a==null?void 0:a.ownerDocument)!=null&&u.defaultView)return a.ownerDocument.defaultView.window;let l=o;return l!=null&&l.view?l.view.window:is},getDocument(o){return Rr(o).document}}}(),c8=class{constructor(t,e,i,r){this._node=t,this._type=e,this._handler=i,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Te(t,e,i,r){return new c8(t,e,i,r)}var hp=function(t,e,i,r){return Te(t,e,i,r)},Cf,h8=class extends o8{constructor(t){super(),this.defaultTarget=t&&Rr(t)}cancelAndSet(t,e,i){return super.cancelAndSet(t,e,i??this.defaultTarget)}},dp=class{constructor(t,e=0){this._runner=t,this.priority=e,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(t){su(t)}}static sort(t,e){return e.priority-t.priority}};(function(){let t=new Map,e=new Map,i=new Map,r=new Map,s=n=>{i.set(n,!1);let o=t.get(n)??[];for(e.set(n,o),t.set(n,[]),r.set(n,!0);o.length>0;)o.sort(dp.sort),o.shift().execute();r.set(n,!1)};Cf=(n,o,a=0)=>{let l=l8(n),u=new dp(o,a),c=t.get(l);return c||(c=[],t.set(l,c)),c.push(u),i.get(l)||(i.set(l,!0),n.requestAnimationFrame(()=>s(l))),u}})();function d8(t){let e=t.getBoundingClientRect(),i=Rr(t);return{left:e.left+i.scrollX,top:e.top+i.scrollY,width:e.width,height:e.height}}var Ut={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},f8=class{constructor(t){this.domNode=t,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(t){let e=ki(t);this._maxWidth!==e&&(this._maxWidth=e,this.domNode.style.maxWidth=this._maxWidth)}setWidth(t){let e=ki(t);this._width!==e&&(this._width=e,this.domNode.style.width=this._width)}setHeight(t){let e=ki(t);this._height!==e&&(this._height=e,this.domNode.style.height=this._height)}setTop(t){let e=ki(t);this._top!==e&&(this._top=e,this.domNode.style.top=this._top)}setLeft(t){let e=ki(t);this._left!==e&&(this._left=e,this.domNode.style.left=this._left)}setBottom(t){let e=ki(t);this._bottom!==e&&(this._bottom=e,this.domNode.style.bottom=this._bottom)}setRight(t){let e=ki(t);this._right!==e&&(this._right=e,this.domNode.style.right=this._right)}setPaddingTop(t){let e=ki(t);this._paddingTop!==e&&(this._paddingTop=e,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(t){let e=ki(t);this._paddingLeft!==e&&(this._paddingLeft=e,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(t){let e=ki(t);this._paddingBottom!==e&&(this._paddingBottom=e,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(t){let e=ki(t);this._paddingRight!==e&&(this._paddingRight=e,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(t){let e=ki(t);this._fontSize!==e&&(this._fontSize=e,this.domNode.style.fontSize=this._fontSize)}setFontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(t){this._fontFeatureSettings!==t&&(this._fontFeatureSettings=t,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(t){this._fontVariationSettings!==t&&(this._fontVariationSettings=t,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(t){this._textDecoration!==t&&(this._textDecoration=t,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(t){let e=ki(t);this._lineHeight!==e&&(this._lineHeight=e,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(t){let e=ki(t);this._letterSpacing!==e&&(this._letterSpacing=e,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(t){this._className!==t&&(this._className=t,this.domNode.className=this._className)}toggleClassName(t,e){this.domNode.classList.toggle(t,e),this._className=this.domNode.className}setDisplay(t){this._display!==t&&(this._display=t,this.domNode.style.display=this._display)}setPosition(t){this._position!==t&&(this._position=t,this.domNode.style.position=this._position)}setVisibility(t){this._visibility!==t&&(this._visibility=t,this.domNode.style.visibility=this._visibility)}setColor(t){this._color!==t&&(this._color=t,this.domNode.style.color=this._color)}setBackgroundColor(t){this._backgroundColor!==t&&(this._backgroundColor=t,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(t){this._layerHint!==t&&(this._layerHint=t,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(t){this._boxShadow!==t&&(this._boxShadow=t,this.domNode.style.boxShadow=t)}setContain(t){this._contain!==t&&(this._contain=t,this.domNode.style.contain=this._contain)}setAttribute(t,e){this.domNode.setAttribute(t,e)}removeAttribute(t){this.domNode.removeAttribute(t)}appendChild(t){this.domNode.appendChild(t.domNode)}removeChild(t){this.domNode.removeChild(t.domNode)}};function ki(t){return typeof t=="number"?`${t}px`:t}function ua(t){return new f8(t)}var z4=class{constructor(){this._hooks=new zs,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(t,e){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let i=this._onStopCallback;this._onStopCallback=null,t&&i&&i(e)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(t,e,i,r,s){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=s;let n=t;try{t.setPointerCapture(e),this._hooks.add(ut(()=>{try{t.releasePointerCapture(e)}catch{}}))}catch{n=Rr(t)}this._hooks.add(Te(n,Ut.POINTER_MOVE,o=>{if(o.buttons!==i){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(Te(n,Ut.POINTER_UP,o=>this.stopMonitoring(!0)))}};function p8(t,e,i){let r=null,s=null;if(typeof i.value=="function"?(r="value",s=i.value,s.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof i.get=="function"&&(r="get",s=i.get),!s)throw new Error("not supported");let n=`$memoize$${e}`;i[r]=function(...o){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,o)}),this[n]}}var Cr;(t=>(t.Tap="-xterm-gesturetap",t.Change="-xterm-gesturechange",t.Start="-xterm-gesturestart",t.End="-xterm-gesturesend",t.Contextmenu="-xterm-gesturecontextmenu"))(Cr||(Cr={}));var Yo=class ai extends Fe{constructor(){super(),this.dispatched=!1,this.targets=new ip,this.ignoreTargets=new ip,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(si.runAndSubscribe(u8,({window:e,disposables:i})=>{i.add(Te(e.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),i.add(Te(e.document,"touchend",r=>this.onTouchEnd(e,r))),i.add(Te(e.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:is,disposables:this._store}))}static addTarget(e){if(!ai.isTouchDevice())return Fe.None;ai.INSTANCE||(ai.INSTANCE=new ai);let i=ai.INSTANCE.targets.push(e);return ut(i)}static ignoreTarget(e){if(!ai.isTouchDevice())return Fe.None;ai.INSTANCE||(ai.INSTANCE=new ai);let i=ai.INSTANCE.ignoreTargets.push(e);return ut(i)}static isTouchDevice(){return"ontouchstart"in is||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,s=e.targetTouches.length;r<s;r++){let n=e.targetTouches.item(r);this.activeTouches[n.identifier]={id:n.identifier,initialTarget:n.target,initialTimeStamp:i,initialPageX:n.pageX,initialPageY:n.pageY,rollingTimestamps:[i],rollingPageX:[n.pageX],rollingPageY:[n.pageY]};let o=this.newGestureEvent(Cr.Start,n.target);o.pageX=n.pageX,o.pageY=n.pageY,this.dispatchEvent(o)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}onTouchEnd(e,i){let r=Date.now(),s=Object.keys(this.activeTouches).length;for(let n=0,o=i.changedTouches.length;n<o;n++){let a=i.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("move of an UNKNOWN touch",a);continue}let l=this.activeTouches[a.identifier],u=Date.now()-l.initialTimeStamp;if(u<ai.HOLD_DELAY&&Math.abs(l.initialPageX-Pi(l.rollingPageX))<30&&Math.abs(l.initialPageY-Pi(l.rollingPageY))<30){let c=this.newGestureEvent(Cr.Tap,l.initialTarget);c.pageX=Pi(l.rollingPageX),c.pageY=Pi(l.rollingPageY),this.dispatchEvent(c)}else if(u>=ai.HOLD_DELAY&&Math.abs(l.initialPageX-Pi(l.rollingPageX))<30&&Math.abs(l.initialPageY-Pi(l.rollingPageY))<30){let c=this.newGestureEvent(Cr.Contextmenu,l.initialTarget);c.pageX=Pi(l.rollingPageX),c.pageY=Pi(l.rollingPageY),this.dispatchEvent(c)}else if(s===1){let c=Pi(l.rollingPageX),h=Pi(l.rollingPageY),d=Pi(l.rollingTimestamps)-l.rollingTimestamps[0],f=c-l.rollingPageX[0],p=h-l.rollingPageY[0],v=[...this.targets].filter(_=>l.initialTarget instanceof Node&&_.contains(l.initialTarget));this.inertia(e,v,r,Math.abs(f)/d,f>0?1:-1,c,Math.abs(p)/d,p>0?1:-1,h)}this.dispatchEvent(this.newGestureEvent(Cr.End,l.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,i){let r=document.createEvent("CustomEvent");return r.initEvent(e,!1,!0),r.initialTarget=i,r.tapCount=0,r}dispatchEvent(e){if(e.type===Cr.Tap){let i=new Date().getTime(),r=0;i-this._lastSetTapCountTime>ai.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=i,e.tapCount=r}else(e.type===Cr.Change||e.type===Cr.Contextmenu)&&(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(e.initialTarget))return;let i=[];for(let r of this.targets)if(r.contains(e.initialTarget)){let s=0,n=e.initialTarget;for(;n&&n!==r;)s++,n=n.parentElement;i.push([s,r])}i.sort((r,s)=>r[0]-s[0]);for(let[r,s]of i)s.dispatchEvent(e),this.dispatched=!0}}inertia(e,i,r,s,n,o,a,l,u){this.handle=Cf(e,()=>{let c=Date.now(),h=c-r,d=0,f=0,p=!0;s+=ai.SCROLL_FRICTION*h,a+=ai.SCROLL_FRICTION*h,s>0&&(p=!1,d=n*s*h),a>0&&(p=!1,f=l*a*h);let v=this.newGestureEvent(Cr.Change);v.translationX=d,v.translationY=f,i.forEach(_=>_.dispatchEvent(v)),p||this.inertia(e,i,c,s,n,o+d,a,l,u+f)})}onTouchMove(e){let i=Date.now();for(let r=0,s=e.changedTouches.length;r<s;r++){let n=e.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(n.identifier))){console.warn("end of an UNKNOWN touch",n);continue}let o=this.activeTouches[n.identifier],a=this.newGestureEvent(Cr.Change,o.initialTarget);a.translationX=n.pageX-Pi(o.rollingPageX),a.translationY=n.pageY-Pi(o.rollingPageY),a.pageX=n.pageX,a.pageY=n.pageY,this.dispatchEvent(a),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(n.pageX),o.rollingPageY.push(n.pageY),o.rollingTimestamps.push(i)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};Yo.SCROLL_FRICTION=-.005,Yo.HOLD_DELAY=700,Yo.CLEAR_TAP_COUNT_TIME=400,wt([p8],Yo,"isTouchDevice",1);var m8=Yo,Af=class extends Fe{onclick(t,e){this._register(Te(t,Ut.CLICK,i=>e(new dl(Rr(t),i))))}onmousedown(t,e){this._register(Te(t,Ut.MOUSE_DOWN,i=>e(new dl(Rr(t),i))))}onmouseover(t,e){this._register(Te(t,Ut.MOUSE_OVER,i=>e(new dl(Rr(t),i))))}onmouseleave(t,e){this._register(Te(t,Ut.MOUSE_LEAVE,i=>e(new dl(Rr(t),i))))}onkeydown(t,e){this._register(Te(t,Ut.KEY_DOWN,i=>e(new ap(i))))}onkeyup(t,e){this._register(Te(t,Ut.KEY_UP,i=>e(new ap(i))))}oninput(t,e){this._register(Te(t,Ut.INPUT,e))}onblur(t,e){this._register(Te(t,Ut.BLUR,e))}onfocus(t,e){this._register(Te(t,Ut.FOCUS,e))}onchange(t,e){this._register(Te(t,Ut.CHANGE,e))}ignoreGesture(t){return m8.ignoreTarget(t)}},fp=11,g8=class extends Af{constructor(t){super(),this._onActivate=t.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=t.bgWidth+"px",this.bgDomNode.style.height=t.bgHeight+"px",typeof t.top<"u"&&(this.bgDomNode.style.top="0px"),typeof t.left<"u"&&(this.bgDomNode.style.left="0px"),typeof t.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof t.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=t.className,this.domNode.style.position="absolute",this.domNode.style.width=fp+"px",this.domNode.style.height=fp+"px",typeof t.top<"u"&&(this.domNode.style.top=t.top+"px"),typeof t.left<"u"&&(this.domNode.style.left=t.left+"px"),typeof t.bottom<"u"&&(this.domNode.style.bottom=t.bottom+"px"),typeof t.right<"u"&&(this.domNode.style.right=t.right+"px"),this._pointerMoveMonitor=this._register(new z4),this._register(hp(this.bgDomNode,Ut.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(hp(this.domNode,Ut.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new h8),this._pointerdownScheduleRepeatTimer=this._register(new kf)}_arrowPointerDown(t){if(!t.target||!(t.target instanceof Element))return;let e=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Rr(t))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(e,200),this._pointerMoveMonitor.startMonitoring(t.target,t.pointerId,t.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),t.preventDefault()}},v8=class yh{constructor(e,i,r,s,n,o,a){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,r=r|0,s=s|0,n=n|0,o=o|0,a=a|0),this.rawScrollLeft=s,this.rawScrollTop=a,i<0&&(i=0),s+i>r&&(s=r-i),s<0&&(s=0),n<0&&(n=0),a+n>o&&(a=o-n),a<0&&(a=0),this.width=i,this.scrollWidth=r,this.scrollLeft=s,this.height=n,this.scrollHeight=o,this.scrollTop=a}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(e,i){return new yh(this._forceIntegerValues,typeof e.width<"u"?e.width:this.width,typeof e.scrollWidth<"u"?e.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof e.height<"u"?e.height:this.height,typeof e.scrollHeight<"u"?e.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(e){return new yh(this._forceIntegerValues,this.width,this.scrollWidth,typeof e.scrollLeft<"u"?e.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof e.scrollTop<"u"?e.scrollTop:this.rawScrollTop)}createScrollEvent(e,i){let r=this.width!==e.width,s=this.scrollWidth!==e.scrollWidth,n=this.scrollLeft!==e.scrollLeft,o=this.height!==e.height,a=this.scrollHeight!==e.scrollHeight,l=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:i,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:s,scrollLeftChanged:n,heightChanged:o,scrollHeightChanged:a,scrollTopChanged:l}}},b8=class extends Fe{constructor(t){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this._smoothScrollDuration=t.smoothScrollDuration,this._scheduleAtNextAnimationFrame=t.scheduleAtNextAnimationFrame,this._state=new v8(t.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(t){this._smoothScrollDuration=t}validateScrollPosition(t){return this._state.withScrollPosition(t)}getScrollDimensions(){return this._state}setScrollDimensions(t,e){var r;let i=this._state.withScrollDimensions(t,e);this._setState(i,!!this._smoothScrolling),(r=this._smoothScrolling)==null||r.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(t){let e=this._state.withScrollPosition(t);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(e,!1)}setScrollPositionSmooth(t,e){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(t);if(this._smoothScrolling){t={scrollLeft:typeof t.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:t.scrollLeft,scrollTop:typeof t.scrollTop>"u"?this._smoothScrolling.to.scrollTop:t.scrollTop};let i=this._state.withScrollPosition(t);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let r;e?r=new mp(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let i=this._state.withScrollPosition(t);this._smoothScrolling=mp.start(this._state,i,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let t=this._smoothScrolling.tick(),e=this._state.withScrollPosition(t);if(this._setState(e,!0),!!this._smoothScrolling){if(t.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(t,e){let i=this._state;i.equals(t)||(this._state=t,this._onScroll.fire(this._state.createScrollEvent(i,e)))}},pp=class{constructor(t,e,i){this.scrollLeft=t,this.scrollTop=e,this.isDone=i}};function G0(t,e){let i=e-t;return function(r){return t+i*w8(r)}}function _8(t,e,i){return function(r){return r<i?t(r/i):e((r-i)/(1-i))}}var mp=class wh{constructor(e,i,r,s){this.from=e,this.to=i,this.duration=s,this.startTime=r,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,i,r){if(Math.abs(e-i)>2.5*r){let s,n;return e<i?(s=e+.75*r,n=i-.75*r):(s=e-.75*r,n=i+.75*r),_8(G0(e,s),G0(n,i),.33)}return G0(e,i)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let i=(e-this.startTime)/this.duration;if(i<1){let r=this.scrollLeft(i),s=this.scrollTop(i);return new pp(r,s,!1)}return new pp(this.to.scrollLeft,this.to.scrollTop,!0)}combine(e,i,r){return wh.start(e,i,r)}static start(e,i,r){r=r+10;let s=Date.now()-10;return new wh(e,i,s,r)}};function y8(t){return Math.pow(t,3)}function w8(t){return 1-y8(1-t)}var x8=class extends Fe{constructor(t,e,i){super(),this._visibility=t,this._visibleClassName=e,this._invisibleClassName=i,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new kf)}setVisibility(t){this._visibility!==t&&(this._visibility=t,this._updateShouldBeVisible())}setShouldBeVisible(t){this._rawShouldBeVisible=t,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let t=this._applyVisibilitySetting();this._shouldBeVisible!==t&&(this._shouldBeVisible=t,this.ensureVisibility())}setIsNeeded(t){this._isNeeded!==t&&(this._isNeeded=t,this.ensureVisibility())}setDomNode(t){this._domNode=t,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var t;(t=this._domNode)==null||t.setClassName(this._visibleClassName)},0))}_hide(t){var e;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(e=this._domNode)==null||e.setClassName(this._invisibleClassName+(t?" fade":"")))}},S8=140,j4=class extends Af{constructor(t){super(),this._lazyRender=t.lazyRender,this._host=t.host,this._scrollable=t.scrollable,this._scrollByPage=t.scrollByPage,this._scrollbarState=t.scrollbarState,this._visibilityController=this._register(new x8(t.visibility,"visible scrollbar "+t.extraScrollbarClassName,"invisible scrollbar "+t.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new z4),this._shouldRender=!0,this.domNode=ua(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(Te(this.domNode.domNode,Ut.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(t){let e=this._register(new g8(t));this.domNode.domNode.appendChild(e.bgDomNode),this.domNode.domNode.appendChild(e.domNode)}_createSlider(t,e,i,r){this.slider=ua(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(t),this.slider.setLeft(e),typeof i=="number"&&this.slider.setWidth(i),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Te(this.slider.domNode,Ut.POINTER_DOWN,s=>{s.button===0&&(s.preventDefault(),this._sliderPointerDown(s))})),this.onclick(this.slider.domNode,s=>{s.leftButton&&s.stopPropagation()})}_onElementSize(t){return this._scrollbarState.setVisibleSize(t)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(t){return this._scrollbarState.setScrollSize(t)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(t){return this._scrollbarState.setScrollPosition(t)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(t){t.target===this.domNode.domNode&&this._onPointerDown(t)}delegatePointerDown(t){let e=this.domNode.domNode.getClientRects()[0].top,i=e+this._scrollbarState.getSliderPosition(),r=e+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),s=this._sliderPointerPosition(t);i<=s&&s<=r?t.button===0&&(t.preventDefault(),this._sliderPointerDown(t)):this._onPointerDown(t)}_onPointerDown(t){let e,i;if(t.target===this.domNode.domNode&&typeof t.offsetX=="number"&&typeof t.offsetY=="number")e=t.offsetX,i=t.offsetY;else{let s=d8(this.domNode.domNode);e=t.pageX-s.left,i=t.pageY-s.top}let r=this._pointerDownRelativePosition(e,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),t.button===0&&(t.preventDefault(),this._sliderPointerDown(t))}_sliderPointerDown(t){if(!t.target||!(t.target instanceof Element))return;let e=this._sliderPointerPosition(t),i=this._sliderOrthogonalPointerPosition(t),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(t.target,t.pointerId,t.buttons,s=>{let n=this._sliderOrthogonalPointerPosition(s),o=Math.abs(n-i);if(O4&&o>S8){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let a=this._sliderPointerPosition(s)-e;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(a))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(t){let e={};this.writeScrollPosition(e,t),this._scrollable.setScrollPositionNow(e)}updateScrollbarSize(t){this._updateScrollbarSize(t),this._scrollbarState.setScrollbarSize(t),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},H4=class xh{constructor(e,i,r,s,n,o){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(e),this._visibleSize=s,this._scrollSize=n,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new xh(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let i=Math.round(e);return this._visibleSize!==i?(this._visibleSize=i,this._refreshComputedValues(),!0):!1}setScrollSize(e){let i=Math.round(e);return this._scrollSize!==i?(this._scrollSize=i,this._refreshComputedValues(),!0):!1}setScrollPosition(e){let i=Math.round(e);return this._scrollPosition!==i?(this._scrollPosition=i,this._refreshComputedValues(),!0):!1}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,i,r,s,n){let o=Math.max(0,r-e),a=Math.max(0,o-2*i),l=s>0&&s>r;if(!l)return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};let u=Math.round(Math.max(20,Math.floor(r*a/s))),c=(a-u)/(s-r),h=n*c;return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(u),computedSliderRatio:c,computedSliderPosition:Math.round(h)}}_refreshComputedValues(){let e=xh._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=e.computedAvailableSize,this._computedIsNeeded=e.computedIsNeeded,this._computedSliderSize=e.computedSliderSize,this._computedSliderRatio=e.computedSliderRatio,this._computedSliderPosition=e.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let i=e-this._arrowSize-this._computedSliderSize/2;return Math.round(i/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let i=e-this._arrowSize,r=this._scrollPosition;return i<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let i=this._computedSliderPosition+e;return Math.round(i/this._computedSliderRatio)}},k8=class extends j4{constructor(t,e,i){let r=t.getScrollDimensions(),s=t.getCurrentScrollPosition();if(super({lazyRender:e.lazyRender,host:i,scrollbarState:new H4(e.horizontalHasArrows?e.arrowSize:0,e.horizontal===2?0:e.horizontalScrollbarSize,e.vertical===2?0:e.verticalScrollbarSize,r.width,r.scrollWidth,s.scrollLeft),visibility:e.horizontal,extraScrollbarClassName:"horizontal",scrollable:t,scrollByPage:e.scrollByPage}),e.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((e.horizontalScrollbarSize-e.horizontalSliderSize)/2),0,void 0,e.horizontalSliderSize)}_updateSlider(t,e){this.slider.setWidth(t),this.slider.setLeft(e)}_renderDomNode(t,e){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(t){return this._shouldRender=this._onElementScrollSize(t.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(t.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(t.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(t,e){return t}_sliderPointerPosition(t){return t.pageX}_sliderOrthogonalPointerPosition(t){return t.pageY}_updateScrollbarSize(t){this.slider.setHeight(t)}writeScrollPosition(t,e){t.scrollLeft=e}updateOptions(t){this.updateScrollbarSize(t.horizontal===2?0:t.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(t.vertical===2?0:t.verticalScrollbarSize),this._visibilityController.setVisibility(t.horizontal),this._scrollByPage=t.scrollByPage}},C8=class extends j4{constructor(t,e,i){let r=t.getScrollDimensions(),s=t.getCurrentScrollPosition();if(super({lazyRender:e.lazyRender,host:i,scrollbarState:new H4(e.verticalHasArrows?e.arrowSize:0,e.vertical===2?0:e.verticalScrollbarSize,0,r.height,r.scrollHeight,s.scrollTop),visibility:e.vertical,extraScrollbarClassName:"vertical",scrollable:t,scrollByPage:e.scrollByPage}),e.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((e.verticalScrollbarSize-e.verticalSliderSize)/2),e.verticalSliderSize,void 0)}_updateSlider(t,e){this.slider.setHeight(t),this.slider.setTop(e)}_renderDomNode(t,e){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(t){return this._shouldRender=this._onElementScrollSize(t.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(t.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(t.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(t,e){return e}_sliderPointerPosition(t){return t.pageY}_sliderOrthogonalPointerPosition(t){return t.pageX}_updateScrollbarSize(t){this.slider.setWidth(t)}writeScrollPosition(t,e){t.scrollTop=e}updateOptions(t){this.updateScrollbarSize(t.vertical===2?0:t.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(t.vertical),this._scrollByPage=t.scrollByPage}},A8=500,gp=50,E8=class{constructor(t,e,i){this.timestamp=t,this.deltaX=e,this.deltaY=i,this.score=0}},Sh=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,i=0,r=1,s=this._rear;do{let n=s===this._front?e:Math.pow(2,-r);if(e-=n,i+=this._memory[s].score*n,s===this._front)break;s=(this._capacity+s-1)%this._capacity,r++}while(!0);return i<=.5}acceptStandardWheelEvent(e){if(xf){let i=Rr(e.browserEvent),r=I_(i);this.accept(Date.now(),e.deltaX*r,e.deltaY*r)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,i,r){let s=null,n=new E8(e,i,r);this._front===-1&&this._rear===-1?(this._memory[0]=n,this._front=0,this._rear=0):(s=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=n),n.score=this._computeScore(n,s)}_computeScore(e,i){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(r+=.25),i){let s=Math.abs(e.deltaX),n=Math.abs(e.deltaY),o=Math.abs(i.deltaX),a=Math.abs(i.deltaY),l=Math.max(Math.min(s,o),1),u=Math.max(Math.min(n,a),1),c=Math.max(s,o),h=Math.max(n,a);c%l===0&&h%u===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};Sh.INSTANCE=new Sh;var D8=Sh,M8=class extends Af{constructor(t,e,i){super(),this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ue),this.onWillScroll=this._onWillScroll.event,this._options=B8(e),this._scrollable=i,this._register(this._scrollable.onScroll(s=>{this._onWillScroll.fire(s),this._onDidScroll(s),this._onScroll.fire(s)}));let r={onMouseWheel:s=>this._onMouseWheel(s),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new C8(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new k8(this._scrollable,this._options,r)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(t),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=ua(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=ua(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=ua(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,s=>this._onMouseOver(s)),this.onmouseleave(this._listenOnDomNode,s=>this._onMouseLeave(s)),this._hideTimeout=this._register(new kf),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Cn(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(t){this._verticalScrollbar.delegatePointerDown(t)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(t){this._scrollable.setScrollDimensions(t,!1)}updateClassName(t){this._options.className=t,jr&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(t){typeof t.handleMouseWheel<"u"&&(this._options.handleMouseWheel=t.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof t.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=t.mouseWheelScrollSensitivity),typeof t.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=t.fastScrollSensitivity),typeof t.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=t.scrollPredominantAxis),typeof t.horizontal<"u"&&(this._options.horizontal=t.horizontal),typeof t.vertical<"u"&&(this._options.vertical=t.vertical),typeof t.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=t.horizontalScrollbarSize),typeof t.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=t.verticalScrollbarSize),typeof t.scrollByPage<"u"&&(this._options.scrollByPage=t.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(t){this._revealOnScroll=t}delegateScrollFromMouseWheelEvent(t){this._onMouseWheel(new up(t))}_setListeningToMouseWheel(t){if(this._mouseWheelToDispose.length>0!==t&&(this._mouseWheelToDispose=Cn(this._mouseWheelToDispose),t)){let e=i=>{this._onMouseWheel(new up(i))};this._mouseWheelToDispose.push(Te(this._listenOnDomNode,Ut.MOUSE_WHEEL,e,{passive:!1}))}}_onMouseWheel(t){var s;if((s=t.browserEvent)!=null&&s.defaultPrevented)return;let e=D8.INSTANCE;e.acceptStandardWheelEvent(t);let i=!1;if(t.deltaY||t.deltaX){let n=t.deltaY*this._options.mouseWheelScrollSensitivity,o=t.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+n===0?o=n=0:Math.abs(n)>=Math.abs(o)?o=0:n=0),this._options.flipAxes&&([n,o]=[o,n]);let a=!jr&&t.browserEvent&&t.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!o&&(o=n,n=0),t.browserEvent&&t.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,n=n*this._options.fastScrollSensitivity);let l=this._scrollable.getFutureScrollPosition(),u={};if(n){let c=gp*n,h=l.scrollTop-(c<0?Math.floor(c):Math.ceil(c));this._verticalScrollbar.writeScrollPosition(u,h)}if(o){let c=gp*o,h=l.scrollLeft-(c<0?Math.floor(c):Math.ceil(c));this._horizontalScrollbar.writeScrollPosition(u,h)}u=this._scrollable.validateScrollPosition(u),(l.scrollLeft!==u.scrollLeft||l.scrollTop!==u.scrollTop)&&(this._options.mouseWheelSmoothScroll&&e.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(u):this._scrollable.setScrollPositionNow(u),i=!0)}let r=i;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(t.preventDefault(),t.stopPropagation())}_onDidScroll(t){this._shouldRender=this._horizontalScrollbar.onDidScroll(t)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(t)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let t=this._scrollable.getCurrentScrollPosition(),e=t.scrollTop>0,i=t.scrollLeft>0,r=i?" left":"",s=e?" top":"",n=i||e?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${n}${s}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(t){this._mouseIsOver=!1,this._hide()}_onMouseOver(t){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),A8)}},T8=class extends M8{constructor(t,e,i){super(t,e,i)}setScrollPosition(t){t.reuseAnimation?this._scrollable.setScrollPositionSmooth(t,t.reuseAnimation):this._scrollable.setScrollPositionNow(t)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function B8(t){let e={lazyRender:typeof t.lazyRender<"u"?t.lazyRender:!1,className:typeof t.className<"u"?t.className:"",useShadows:typeof t.useShadows<"u"?t.useShadows:!0,handleMouseWheel:typeof t.handleMouseWheel<"u"?t.handleMouseWheel:!0,flipAxes:typeof t.flipAxes<"u"?t.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof t.consumeMouseWheelIfScrollbarIsNeeded<"u"?t.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof t.alwaysConsumeMouseWheel<"u"?t.alwaysConsumeMouseWheel:!1,scrollYToX:typeof t.scrollYToX<"u"?t.scrollYToX:!1,mouseWheelScrollSensitivity:typeof t.mouseWheelScrollSensitivity<"u"?t.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof t.fastScrollSensitivity<"u"?t.fastScrollSensitivity:5,scrollPredominantAxis:typeof t.scrollPredominantAxis<"u"?t.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof t.mouseWheelSmoothScroll<"u"?t.mouseWheelSmoothScroll:!0,arrowSize:typeof t.arrowSize<"u"?t.arrowSize:11,listenOnDomNode:typeof t.listenOnDomNode<"u"?t.listenOnDomNode:null,horizontal:typeof t.horizontal<"u"?t.horizontal:1,horizontalScrollbarSize:typeof t.horizontalScrollbarSize<"u"?t.horizontalScrollbarSize:10,horizontalSliderSize:typeof t.horizontalSliderSize<"u"?t.horizontalSliderSize:0,horizontalHasArrows:typeof t.horizontalHasArrows<"u"?t.horizontalHasArrows:!1,vertical:typeof t.vertical<"u"?t.vertical:1,verticalScrollbarSize:typeof t.verticalScrollbarSize<"u"?t.verticalScrollbarSize:10,verticalHasArrows:typeof t.verticalHasArrows<"u"?t.verticalHasArrows:!1,verticalSliderSize:typeof t.verticalSliderSize<"u"?t.verticalSliderSize:0,scrollByPage:typeof t.scrollByPage<"u"?t.scrollByPage:!1};return e.horizontalSliderSize=typeof t.horizontalSliderSize<"u"?t.horizontalSliderSize:e.horizontalScrollbarSize,e.verticalSliderSize=typeof t.verticalSliderSize<"u"?t.verticalSliderSize:e.verticalScrollbarSize,jr&&(e.className+=" mac"),e}var kh=class extends Fe{constructor(t,e,i,r,s,n,o,a){super(),this._bufferService=i,this._optionsService=o,this._renderService=a,this._onRequestScrollLines=this._register(new ue),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let l=this._register(new b8({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:u=>Cf(r.window,u)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{l.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new T8(e,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},l)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(s.onProtocolChange(u=>{this._scrollableElement.updateOptions({handleMouseWheel:!(u&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(si.runAndSubscribe(n.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=n.colors.background.css})),t.appendChild(this._scrollableElement.getDomNode()),this._register(ut(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),e.appendChild(this._styleElement),this._register(ut(()=>this._styleElement.remove())),this._register(si.runAndSubscribe(n.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${n.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${n.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${n.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
22
+ `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(u=>this._handleScroll(u)))}scrollLines(t){let e=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:e.scrollTop+t*this._renderService.dimensions.css.cell.height})}scrollToLine(t,e){e&&(this._latestYDisp=t),this._scrollableElement.setScrollPosition({reuseAnimation:!e,scrollTop:t*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var t;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((t=this._optionsService.rawOptions.overviewRuler)==null?void 0:t.width)||14}}queueSync(t){t!==void 0&&(this._latestYDisp=t),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(t=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,t!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:t*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(t){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let e=Math.round(t.scrollTop/this._renderService.dimensions.css.cell.height),i=e-this._bufferService.buffer.ydisp;i!==0&&(this._latestYDisp=e,this._onRequestScrollLines.fire(i)),this._isHandlingScroll=!1}};kh=wt([fe(2,yi),fe(3,hs),fe(4,w4),fe(5,Co),fe(6,wi),fe(7,ds)],kh);var Ch=class extends Fe{constructor(t,e,i,r,s){super(),this._screenElement=t,this._bufferService=e,this._coreBrowserService=i,this._decorationService=r,this._renderService=s,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(n=>this._removeDecoration(n))),this._register(ut(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let t of this._decorationService.decorations)this._renderDecoration(t);this._dimensionsChanged=!1}_renderDecoration(t){this._refreshStyle(t),this._dimensionsChanged&&this._refreshXPosition(t)}_createElement(t){var r;let e=this._coreBrowserService.mainDocument.createElement("div");e.classList.add("xterm-decoration"),e.classList.toggle("xterm-decoration-top-layer",((r=t==null?void 0:t.options)==null?void 0:r.layer)==="top"),e.style.width=`${Math.round((t.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,e.style.height=`${(t.options.height||1)*this._renderService.dimensions.css.cell.height}px`,e.style.top=`${(t.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,e.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let i=t.options.x??0;return i&&i>this._bufferService.cols&&(e.style.display="none"),this._refreshXPosition(t,e),e}_refreshStyle(t){let e=t.marker.line-this._bufferService.buffers.active.ydisp;if(e<0||e>=this._bufferService.rows)t.element&&(t.element.style.display="none",t.onRenderEmitter.fire(t.element));else{let i=this._decorationElements.get(t);i||(i=this._createElement(t),t.element=i,this._decorationElements.set(t,i),this._container.appendChild(i),t.onDispose(()=>{this._decorationElements.delete(t),i.remove()})),i.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(i.style.width=`${Math.round((t.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(t.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${e*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),t.onRenderEmitter.fire(i)}}_refreshXPosition(t,e=t.element){if(!e)return;let i=t.options.x??0;(t.options.anchor||"left")==="right"?e.style.right=i?`${i*this._renderService.dimensions.css.cell.width}px`:"":e.style.left=i?`${i*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(t){var e;(e=this._decorationElements.get(t))==null||e.remove(),this._decorationElements.delete(t),t.dispose()}};Ch=wt([fe(1,yi),fe(2,hs),fe(3,Ka),fe(4,ds)],Ch);var R8=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(t){if(t.options.overviewRulerOptions){for(let e of this._zones)if(e.color===t.options.overviewRulerOptions.color&&e.position===t.options.overviewRulerOptions.position){if(this._lineIntersectsZone(e,t.marker.line))return;if(this._lineAdjacentToZone(e,t.marker.line,t.options.overviewRulerOptions.position)){this._addLineToZone(e,t.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=t.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=t.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=t.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=t.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:t.options.overviewRulerOptions.color,position:t.options.overviewRulerOptions.position,startBufferLine:t.marker.line,endBufferLine:t.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(t){this._linePadding=t}_lineIntersectsZone(t,e){return e>=t.startBufferLine&&e<=t.endBufferLine}_lineAdjacentToZone(t,e,i){return e>=t.startBufferLine-this._linePadding[i||"full"]&&e<=t.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(t,e){t.startBufferLine=Math.min(t.startBufferLine,e),t.endBufferLine=Math.max(t.endBufferLine,e)}},yr={full:0,left:0,center:0,right:0},Ss={full:0,left:0,center:0,right:0},Po={full:0,left:0,center:0,right:0},xu=class extends Fe{constructor(t,e,i,r,s,n,o,a){var u;super(),this._viewportElement=t,this._screenElement=e,this._bufferService=i,this._decorationService=r,this._renderService=s,this._optionsService=n,this._themeService=o,this._coreBrowserService=a,this._colorZoneStore=new R8,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(u=this._viewportElement.parentElement)==null||u.insertBefore(this._canvas,this._viewportElement),this._register(ut(()=>{var c;return(c=this._canvas)==null?void 0:c.remove()}));let l=this._canvas.getContext("2d");if(l)this._ctx=l;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var t;return((t=this._optionsService.options.overviewRuler)==null?void 0:t.width)||0}_refreshDrawConstants(){let t=Math.floor((this._canvas.width-1)/3),e=Math.ceil((this._canvas.width-1)/3);Ss.full=this._canvas.width,Ss.left=t,Ss.center=e,Ss.right=t,this._refreshDrawHeightConstants(),Po.full=1,Po.left=1,Po.center=1+Ss.left,Po.right=1+Ss.left+Ss.center}_refreshDrawHeightConstants(){yr.full=Math.round(2*this._coreBrowserService.dpr);let t=this._canvas.height/this._bufferService.buffer.lines.length,e=Math.round(Math.max(Math.min(t,12),6)*this._coreBrowserService.dpr);yr.left=e,yr.center=e,yr.right=e}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*yr.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*yr.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*yr.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*yr.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let t=this._colorZoneStore.zones;for(let e of t)e.position!=="full"&&this._renderColorZone(e);for(let e of t)e.position==="full"&&this._renderColorZone(e);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(t){this._ctx.fillStyle=t.color,this._ctx.fillRect(Po[t.position||"full"],Math.round((this._canvas.height-1)*(t.startBufferLine/this._bufferService.buffers.active.lines.length)-yr[t.position||"full"]/2),Ss[t.position||"full"],Math.round((this._canvas.height-1)*((t.endBufferLine-t.startBufferLine)/this._bufferService.buffers.active.lines.length)+yr[t.position||"full"]))}_queueRefresh(t,e){this._shouldUpdateDimensions=t||this._shouldUpdateDimensions,this._shouldUpdateAnchor=e||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};xu=wt([fe(2,yi),fe(3,Ka),fe(4,ds),fe(5,wi),fe(6,Co),fe(7,hs)],xu);var Z;(t=>(t.NUL="\0",t.SOH="",t.STX="",t.ETX="",t.EOT="",t.ENQ="",t.ACK="",t.BEL="\x07",t.BS="\b",t.HT=" ",t.LF=`
23
+ `,t.VT="\v",t.FF="\f",t.CR="\r",t.SO="",t.SI="",t.DLE="",t.DC1="",t.DC2="",t.DC3="",t.DC4="",t.NAK="",t.SYN="",t.ETB="",t.CAN="",t.EM="",t.SUB="",t.ESC="\x1B",t.FS="",t.GS="",t.RS="",t.US="",t.SP=" ",t.DEL=""))(Z||(Z={}));var au;(t=>(t.PAD="€",t.HOP="",t.BPH="‚",t.NBH="ƒ",t.IND="„",t.NEL="…",t.SSA="†",t.ESA="‡",t.HTS="ˆ",t.HTJ="‰",t.VTS="Š",t.PLD="‹",t.PLU="Œ",t.RI="",t.SS2="Ž",t.SS3="",t.DCS="",t.PU1="‘",t.PU2="’",t.STS="“",t.CCH="”",t.MW="•",t.SPA="–",t.EPA="—",t.SOS="˜",t.SGCI="™",t.SCI="š",t.CSI="›",t.ST="œ",t.OSC="",t.PM="ž",t.APC="Ÿ"))(au||(au={}));var $4;(t=>t.ST=`${Z.ESC}\\`)($4||($4={}));var Ah=class{constructor(t,e,i,r,s,n){this._textarea=t,this._compositionView=e,this._bufferService=i,this._optionsService=r,this._coreService=s,this._renderService=n,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(t){this._compositionView.textContent=t.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(t){if(this._isComposing||this._isSendingComposition){if(t.keyCode===20||t.keyCode===229||t.keyCode===16||t.keyCode===17||t.keyCode===18)return!1;this._finalizeComposition(!1)}return t.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(t){if(this._compositionView.classList.remove("active"),this._isComposing=!1,t){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let i;e.start+=this._dataAlreadySent.length,this._isComposing?i=this._textarea.value.substring(e.start,this._compositionPosition.start):i=this._textarea.value.substring(e.start),i.length>0&&this._coreService.triggerDataEvent(i,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let t=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let e=this._textarea.value,i=e.replace(t,"");this._dataAlreadySent=i,e.length>t.length?this._coreService.triggerDataEvent(i,!0):e.length<t.length?this._coreService.triggerDataEvent(`${Z.DEL}`,!0):e.length===t.length&&e!==t&&this._coreService.triggerDataEvent(e,!0)}},0)}updateCompositionElements(t){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),i=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let n=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(n.width,1)+"px",this._textarea.style.height=Math.max(n.height,1)+"px",this._textarea.style.lineHeight=n.height+"px"}t||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Ah=wt([fe(2,yi),fe(3,wi),fe(4,Ln),fe(5,ds)],Ah);var Gt=0,Yt=0,Xt=0,_t=0,vp={css:"#00000000",rgba:0},Tt;(t=>{function e(s,n,o,a){return a!==void 0?`#${nn(s)}${nn(n)}${nn(o)}${nn(a)}`:`#${nn(s)}${nn(n)}${nn(o)}`}t.toCss=e;function i(s,n,o,a=255){return(s<<24|n<<16|o<<8|a)>>>0}t.toRgba=i;function r(s,n,o,a){return{css:t.toCss(s,n,o,a),rgba:t.toRgba(s,n,o,a)}}t.toColor=r})(Tt||(Tt={}));var ot;(t=>{function e(l,u){if(_t=(u.rgba&255)/255,_t===1)return{css:u.css,rgba:u.rgba};let c=u.rgba>>24&255,h=u.rgba>>16&255,d=u.rgba>>8&255,f=l.rgba>>24&255,p=l.rgba>>16&255,v=l.rgba>>8&255;Gt=f+Math.round((c-f)*_t),Yt=p+Math.round((h-p)*_t),Xt=v+Math.round((d-v)*_t);let _=Tt.toCss(Gt,Yt,Xt),w=Tt.toRgba(Gt,Yt,Xt);return{css:_,rgba:w}}t.blend=e;function i(l){return(l.rgba&255)===255}t.isOpaque=i;function r(l,u,c){let h=lu.ensureContrastRatio(l.rgba,u.rgba,c);if(h)return Tt.toColor(h>>24&255,h>>16&255,h>>8&255)}t.ensureContrastRatio=r;function s(l){let u=(l.rgba|255)>>>0;return[Gt,Yt,Xt]=lu.toChannels(u),{css:Tt.toCss(Gt,Yt,Xt),rgba:u}}t.opaque=s;function n(l,u){return _t=Math.round(u*255),[Gt,Yt,Xt]=lu.toChannels(l.rgba),{css:Tt.toCss(Gt,Yt,Xt,_t),rgba:Tt.toRgba(Gt,Yt,Xt,_t)}}t.opacity=n;function o(l,u){return _t=l.rgba&255,n(l,_t*u/255)}t.multiplyOpacity=o;function a(l){return[l.rgba>>24&255,l.rgba>>16&255,l.rgba>>8&255]}t.toColorRGB=a})(ot||(ot={}));var mt;(t=>{let e,i;try{let s=document.createElement("canvas");s.width=1,s.height=1;let n=s.getContext("2d",{willReadFrequently:!0});n&&(e=n,e.globalCompositeOperation="copy",i=e.createLinearGradient(0,0,1,1))}catch{}function r(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return Gt=parseInt(s.slice(1,2).repeat(2),16),Yt=parseInt(s.slice(2,3).repeat(2),16),Xt=parseInt(s.slice(3,4).repeat(2),16),Tt.toColor(Gt,Yt,Xt);case 5:return Gt=parseInt(s.slice(1,2).repeat(2),16),Yt=parseInt(s.slice(2,3).repeat(2),16),Xt=parseInt(s.slice(3,4).repeat(2),16),_t=parseInt(s.slice(4,5).repeat(2),16),Tt.toColor(Gt,Yt,Xt,_t);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let n=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return Gt=parseInt(n[1]),Yt=parseInt(n[2]),Xt=parseInt(n[3]),_t=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Tt.toColor(Gt,Yt,Xt,_t);if(!e||!i)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=i,e.fillStyle=s,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[Gt,Yt,Xt,_t]=e.getImageData(0,0,1,1).data,_t!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Tt.toRgba(Gt,Yt,Xt,_t),css:s}}t.toColor=r})(mt||(mt={}));var fi;(t=>{function e(r){return i(r>>16&255,r>>8&255,r&255)}t.relativeLuminance=e;function i(r,s,n){let o=r/255,a=s/255,l=n/255,u=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),c=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),h=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4);return u*.2126+c*.7152+h*.0722}t.relativeLuminance2=i})(fi||(fi={}));var lu;(t=>{function e(o,a){if(_t=(a&255)/255,_t===1)return a;let l=a>>24&255,u=a>>16&255,c=a>>8&255,h=o>>24&255,d=o>>16&255,f=o>>8&255;return Gt=h+Math.round((l-h)*_t),Yt=d+Math.round((u-d)*_t),Xt=f+Math.round((c-f)*_t),Tt.toRgba(Gt,Yt,Xt)}t.blend=e;function i(o,a,l){let u=fi.relativeLuminance(o>>8),c=fi.relativeLuminance(a>>8);if(Jr(u,c)<l){if(c<u){let f=r(o,a,l),p=Jr(u,fi.relativeLuminance(f>>8));if(p<l){let v=s(o,a,l),_=Jr(u,fi.relativeLuminance(v>>8));return p>_?f:v}return f}let h=s(o,a,l),d=Jr(u,fi.relativeLuminance(h>>8));if(d<l){let f=r(o,a,l),p=Jr(u,fi.relativeLuminance(f>>8));return d>p?h:f}return h}}t.ensureContrastRatio=i;function r(o,a,l){let u=o>>24&255,c=o>>16&255,h=o>>8&255,d=a>>24&255,f=a>>16&255,p=a>>8&255,v=Jr(fi.relativeLuminance2(d,f,p),fi.relativeLuminance2(u,c,h));for(;v<l&&(d>0||f>0||p>0);)d-=Math.max(0,Math.ceil(d*.1)),f-=Math.max(0,Math.ceil(f*.1)),p-=Math.max(0,Math.ceil(p*.1)),v=Jr(fi.relativeLuminance2(d,f,p),fi.relativeLuminance2(u,c,h));return(d<<24|f<<16|p<<8|255)>>>0}t.reduceLuminance=r;function s(o,a,l){let u=o>>24&255,c=o>>16&255,h=o>>8&255,d=a>>24&255,f=a>>16&255,p=a>>8&255,v=Jr(fi.relativeLuminance2(d,f,p),fi.relativeLuminance2(u,c,h));for(;v<l&&(d<255||f<255||p<255);)d=Math.min(255,d+Math.ceil((255-d)*.1)),f=Math.min(255,f+Math.ceil((255-f)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),v=Jr(fi.relativeLuminance2(d,f,p),fi.relativeLuminance2(u,c,h));return(d<<24|f<<16|p<<8|255)>>>0}t.increaseLuminance=s;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}t.toChannels=n})(lu||(lu={}));function nn(t){let e=t.toString(16);return e.length<2?"0"+e:e}function Jr(t,e){return t<e?(e+.05)/(t+.05):(t+.05)/(e+.05)}var N8=class extends Wa{constructor(t,e,i){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=e,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Su=class{constructor(t){this._bufferService=t,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new rr}register(t){let e={id:this._nextCharacterJoinerId++,handler:t};return this._characterJoiners.push(e),e.id}deregister(t){for(let e=0;e<this._characterJoiners.length;e++)if(this._characterJoiners[e].id===t)return this._characterJoiners.splice(e,1),!0;return!1}getJoinedCharacters(t){if(this._characterJoiners.length===0)return[];let e=this._bufferService.buffer.lines.get(t);if(!e||e.length===0)return[];let i=[],r=e.translateToString(!0),s=0,n=0,o=0,a=e.getFg(0),l=e.getBg(0);for(let u=0;u<e.getTrimmedLength();u++)if(e.loadCell(u,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==a||this._workCell.bg!==l){if(u-s>1){let c=this._getJoinedRanges(r,o,n,e,s);for(let h=0;h<c.length;h++)i.push(c[h])}s=u,o=n,a=this._workCell.fg,l=this._workCell.bg}n+=this._workCell.getChars().length||Os.length}if(this._bufferService.cols-s>1){let u=this._getJoinedRanges(r,o,n,e,s);for(let c=0;c<u.length;c++)i.push(u[c])}return i}_getJoinedRanges(t,e,i,r,s){let n=t.substring(e,i),o=[];try{o=this._characterJoiners[0].handler(n)}catch(a){console.error(a)}for(let a=1;a<this._characterJoiners.length;a++)try{let l=this._characterJoiners[a].handler(n);for(let u=0;u<l.length;u++)Su._mergeRanges(o,l[u])}catch(l){console.error(l)}return this._stringRangesToCellRanges(o,r,s),o}_stringRangesToCellRanges(t,e,i){let r=0,s=!1,n=0,o=t[r];if(o){for(let a=i;a<this._bufferService.cols;a++){let l=e.getWidth(a),u=e.getString(a).length||Os.length;if(l!==0){if(!s&&o[0]<=n&&(o[0]=a,s=!0),o[1]<=n){if(o[1]=a,o=t[++r],!o)break;o[0]<=n?(o[0]=a,s=!0):s=!1}n+=u}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(t,e){let i=!1;for(let r=0;r<t.length;r++){let s=t[r];if(i){if(e[1]<=s[0])return t[r-1][1]=e[1],t;if(e[1]<=s[1])return t[r-1][1]=Math.max(e[1],s[1]),t.splice(r,1),t;t.splice(r,1),r--}else{if(e[1]<=s[0])return t.splice(r,0,e),t;if(e[1]<=s[1])return s[0]=Math.min(e[0],s[0]),t;e[0]<s[1]&&(s[0]=Math.min(e[0],s[0]),i=!0);continue}}return i?t[t.length-1][1]=e[1]:t.push(e),t}};Su=wt([fe(0,yi)],Su);function L8(t){return 57508<=t&&t<=57558}function O8(t){return 9472<=t&&t<=9631}function P8(t){return L8(t)||O8(t)}function F8(){return{css:{canvas:fl(),cell:fl()},device:{canvas:fl(),cell:fl(),char:{width:0,height:0,left:0,top:0}}}}function fl(){return{width:0,height:0}}var Eh=class{constructor(t,e,i,r,s,n,o){this._document=t,this._characterJoinerService=e,this._optionsService=i,this._coreBrowserService=r,this._coreService=s,this._decorationService=n,this._themeService=o,this._workCell=new rr,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(t,e,i){this._selectionStart=t,this._selectionEnd=e,this._columnSelectMode=i}createRow(t,e,i,r,s,n,o,a,l,u,c){let h=[],d=this._characterJoinerService.getJoinedCharacters(e),f=this._themeService.colors,p=t.getNoBgTrimmedLength();i&&p<n+1&&(p=n+1);let v,_=0,w="",x=0,C=0,D=0,R=0,E=!1,L=0,q=!1,F=0,$=0,W=[],z=u!==-1&&c!==-1;for(let j=0;j<p;j++){t.loadCell(j,this._workCell);let A=this._workCell.getWidth();if(A===0)continue;let O=!1,T=j>=$,U=j,H=this._workCell;if(d.length>0&&j===d[0][0]&&T){let Be=d.shift(),vt=this._isCellInSelection(Be[0],e);for(x=Be[0]+1;x<Be[1];x++)T&&(T=vt===this._isCellInSelection(x,e));T&&(T=!i||n<Be[0]||n>=Be[1]),T?(O=!0,H=new N8(this._workCell,t.translateToString(!0,Be[0],Be[1]),Be[1]-Be[0]),U=Be[1]-1,A=H.getWidth()):$=Be[1]}let re=this._isCellInSelection(j,e),G=i&&j===n,X=z&&j>=u&&j<=c,oe=!1;this._decorationService.forEachDecorationAtCell(j,e,void 0,Be=>{oe=!0});let I=H.getChars()||Os;if(I===" "&&(H.isUnderline()||H.isOverline())&&(I=" "),F=A*a-l.get(I,H.isBold(),H.isItalic()),!v)v=this._document.createElement("span");else if(_&&(re&&q||!re&&!q&&H.bg===C)&&(re&&q&&f.selectionForeground||H.fg===D)&&H.extended.ext===R&&X===E&&F===L&&!G&&!O&&!oe&&T){H.isInvisible()?w+=Os:w+=I,v.style.width=`${parseFloat(v.style.width)+A*a}px`,_++;continue}else _&&(v.textContent=w),v=this._document.createElement("span"),_=0,w="";if(C=H.bg,D=H.fg,R=H.extended.ext,E=X,L=F,q=re,O&&n>=j&&n<=U&&(n=j),!this._coreService.isCursorHidden&&G&&this._coreService.isCursorInitialized){if(W.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&W.push("xterm-cursor-blink"),W.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":W.push("xterm-cursor-outline");break;case"block":W.push("xterm-cursor-block");break;case"bar":W.push("xterm-cursor-bar");break;case"underline":W.push("xterm-cursor-underline");break}}if(H.isBold()&&W.push("xterm-bold"),H.isItalic()&&W.push("xterm-italic"),H.isDim()&&W.push("xterm-dim"),H.isInvisible()?w=Os:w=H.getChars()||Os,H.isUnderline()&&(W.push(`xterm-underline-${H.extended.underlineStyle}`),w===" "&&(w=" "),!H.isUnderlineColorDefault()))if(H.isUnderlineColorRGB())v.style.textDecorationColor=`rgb(${Wa.toColorRGB(H.getUnderlineColor()).join(",")})`;else{let Be=H.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&H.isBold()&&Be<8&&(Be+=8),v.style.textDecorationColor=f.ansi[Be].css}H.isOverline()&&(W.push("xterm-overline"),w===" "&&(w=" ")),H.isStrikethrough()&&W.push("xterm-strikethrough"),X&&(v.style.textDecoration="underline");let Y=H.getFgColor(),le=H.getFgColorMode(),te=H.getBgColor(),de=H.getBgColorMode(),ke=!!H.isInverse();if(ke){let Be=Y;Y=te,te=Be;let vt=le;le=de,de=vt}let Ye,Ct,At=!1;this._decorationService.forEachDecorationAtCell(j,e,void 0,Be=>{Be.options.layer!=="top"&&At||(Be.backgroundColorRGB&&(de=50331648,te=Be.backgroundColorRGB.rgba>>8&16777215,Ye=Be.backgroundColorRGB),Be.foregroundColorRGB&&(le=50331648,Y=Be.foregroundColorRGB.rgba>>8&16777215,Ct=Be.foregroundColorRGB),At=Be.options.layer==="top")}),!At&&re&&(Ye=this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque,te=Ye.rgba>>8&16777215,de=50331648,At=!0,f.selectionForeground&&(le=50331648,Y=f.selectionForeground.rgba>>8&16777215,Ct=f.selectionForeground)),At&&W.push("xterm-decoration-top");let st;switch(de){case 16777216:case 33554432:st=f.ansi[te],W.push(`xterm-bg-${te}`);break;case 50331648:st=Tt.toColor(te>>16,te>>8&255,te&255),this._addStyle(v,`background-color:#${bp((te>>>0).toString(16),"0",6)}`);break;case 0:default:ke?(st=f.foreground,W.push("xterm-bg-257")):st=f.background}switch(Ye||H.isDim()&&(Ye=ot.multiplyOpacity(st,.5)),le){case 16777216:case 33554432:H.isBold()&&Y<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Y+=8),this._applyMinimumContrast(v,st,f.ansi[Y],H,Ye,void 0)||W.push(`xterm-fg-${Y}`);break;case 50331648:let Be=Tt.toColor(Y>>16&255,Y>>8&255,Y&255);this._applyMinimumContrast(v,st,Be,H,Ye,Ct)||this._addStyle(v,`color:#${bp(Y.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(v,st,f.foreground,H,Ye,Ct)||ke&&W.push("xterm-fg-257")}W.length&&(v.className=W.join(" "),W.length=0),!G&&!O&&!oe&&T?_++:v.textContent=w,F!==this.defaultSpacing&&(v.style.letterSpacing=`${F}px`),v.style.display="inline-block",v.style.width=`${A*a}px`,v.style.overflow="hidden",v.style.verticalAlign="top",h.push(v),j=U}return v&&_&&(v.textContent=w),h}_applyMinimumContrast(t,e,i,r,s,n){if(this._optionsService.rawOptions.minimumContrastRatio===1||P8(r.getCode()))return!1;let o=this._getContrastCache(r),a;if(!s&&!n&&(a=o.getColor(e.rgba,i.rgba)),a===void 0){let l=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);a=ot.ensureContrastRatio(s||e,n||i,l),o.setColor((s||e).rgba,(n||i).rgba,a??null)}return a?(this._addStyle(t,`color:${a.css}`),!0):!1}_getContrastCache(t){return t.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(t,e){t.setAttribute("style",`${t.getAttribute("style")||""}${e};`)}_isCellInSelection(t,e){let i=this._selectionStart,r=this._selectionEnd;return!i||!r?!1:this._columnSelectMode?i[0]<=r[0]?t>=i[0]&&e>=i[1]&&t<r[0]&&e<=r[1]:t<i[0]&&e>=i[1]&&t>=r[0]&&e<=r[1]:e>i[1]&&e<r[1]||i[1]===r[1]&&e===i[1]&&t>=i[0]&&t<r[0]||i[1]<r[1]&&e===r[1]&&t<r[0]||i[1]<r[1]&&e===i[1]&&t>=i[0]}};Eh=wt([fe(1,k4),fe(2,wi),fe(3,hs),fe(4,Ln),fe(5,Ka),fe(6,Co)],Eh);function bp(t,e,i){for(;t.length<i;)t=e+t;return t}var I8=class{constructor(t,e){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=t.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let i=t.createElement("span");i.classList.add("xterm-char-measure-element");let r=t.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let s=t.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontStyle="italic";let n=t.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold",n.style.fontStyle="italic",this._measureElements=[i,r,s,n],this._container.appendChild(i),this._container.appendChild(r),this._container.appendChild(s),this._container.appendChild(n),e.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(t,e,i,r){t===this._font&&e===this._fontSize&&i===this._weight&&r===this._weightBold||(this._font=t,this._fontSize=e,this._weight=i,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${i}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${i}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(t,e,i){let r=0;if(!e&&!i&&t.length===1&&(r=t.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let o=this._measure(t,0);return o>0&&(this._flat[r]=o),o}let s=t;e&&(s+="B"),i&&(s+="I");let n=this._holey.get(s);if(n===void 0){let o=0;e&&(o|=1),i&&(o|=2),n=this._measure(t,o),n>0&&this._holey.set(s,n)}return n}_measure(t,e){let i=this._measureElements[e];return i.textContent=t.repeat(32),i.offsetWidth/32}},z8=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(t,e,i,r=!1){if(this.selectionStart=e,this.selectionEnd=i,!e||!i||e[0]===i[0]&&e[1]===i[1]){this.clear();return}let s=t.buffers.active.ydisp,n=e[1]-s,o=i[1]-s,a=Math.max(n,0),l=Math.min(o,t.rows-1);if(a>=t.rows||l<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=l,this.startCol=e[0],this.endCol=i[0]}isCellSelected(t,e,i){return this.hasSelection?(i-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?e>=this.startCol&&i>=this.viewportCappedStartRow&&e<this.endCol&&i<=this.viewportCappedEndRow:e<this.startCol&&i>=this.viewportCappedStartRow&&e>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&e>=this.startCol&&e<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&e<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&e>=this.startCol):!1}};function j8(){return new z8}var Y0="xterm-dom-renderer-owner-",Ji="xterm-rows",pl="xterm-fg-",_p="xterm-bg-",Fo="xterm-focus",ml="xterm-selection",H8=1,Dh=class extends Fe{constructor(t,e,i,r,s,n,o,a,l,u,c,h,d,f){super(),this._terminal=t,this._document=e,this._element=i,this._screenElement=r,this._viewportElement=s,this._helperContainer=n,this._linkifier2=o,this._charSizeService=l,this._optionsService=u,this._bufferService=c,this._coreService=h,this._coreBrowserService=d,this._themeService=f,this._terminalClass=H8++,this._rowElements=[],this._selectionRenderModel=j8(),this.onRequestRedraw=this._register(new ue).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Ji),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(ml),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=F8(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(p=>this._injectCss(p))),this._injectCss(this._themeService.colors),this._rowFactory=a.createInstance(Eh,document),this._element.classList.add(Y0+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(p=>this._handleLinkHover(p))),this._register(this._linkifier2.onHideLinkUnderline(p=>this._handleLinkLeave(p))),this._register(ut(()=>{this._element.classList.remove(Y0+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new I8(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let t=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*t,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*t),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/t),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/t),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let i of this._rowElements)i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let e=`${this._terminalSelector} .${Ji} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=e,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(t){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let e=`${this._terminalSelector} .${Ji} { pointer-events: none; color: ${t.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;e+=`${this._terminalSelector} .${Ji} .xterm-dim { color: ${ot.multiplyOpacity(t.foreground,.5).css};}`,e+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let i=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,s=`blink_block_${this._terminalClass}`;e+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,e+=`@keyframes ${r} { 50% { box-shadow: none; }}`,e+=`@keyframes ${s} { 0% { background-color: ${t.cursor.css}; color: ${t.cursorAccent.css}; } 50% { background-color: inherit; color: ${t.cursor.css}; }}`,e+=`${this._terminalSelector} .${Ji}.${Fo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Ji}.${Fo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Ji}.${Fo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Ji} .xterm-cursor.xterm-cursor-block { background-color: ${t.cursor.css}; color: ${t.cursorAccent.css};}${this._terminalSelector} .${Ji} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${t.cursor.css} !important; color: ${t.cursorAccent.css} !important;}${this._terminalSelector} .${Ji} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${t.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Ji} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${t.cursor.css} inset;}${this._terminalSelector} .${Ji} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${t.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,e+=`${this._terminalSelector} .${ml} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${ml} div { position: absolute; background-color: ${t.selectionBackgroundOpaque.css};}${this._terminalSelector} .${ml} div { position: absolute; background-color: ${t.selectionInactiveBackgroundOpaque.css};}`;for(let[n,o]of t.ansi.entries())e+=`${this._terminalSelector} .${pl}${n} { color: ${o.css}; }${this._terminalSelector} .${pl}${n}.xterm-dim { color: ${ot.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${_p}${n} { background-color: ${o.css}; }`;e+=`${this._terminalSelector} .${pl}257 { color: ${ot.opaque(t.background).css}; }${this._terminalSelector} .${pl}257.xterm-dim { color: ${ot.multiplyOpacity(ot.opaque(t.background),.5).css}; }${this._terminalSelector} .${_p}257 { background-color: ${t.foreground.css}; }`,this._themeStyleElement.textContent=e}_setDefaultSpacing(){let t=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${t}px`,this._rowFactory.defaultSpacing=t}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(t,e){for(let i=this._rowElements.length;i<=e;i++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(t,e){this._refreshRowElements(t,e),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Fo),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Fo),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(t,e,i){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(t,e,i),this.renderRows(0,this._bufferService.rows-1),!t||!e||(this._selectionRenderModel.update(this._terminal,t,e,i),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,s=this._selectionRenderModel.viewportEndRow,n=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,a=this._document.createDocumentFragment();if(i){let l=t[0]>e[0];a.appendChild(this._createSelectionElement(n,l?e[0]:t[0],l?t[0]:e[0],o-n+1))}else{let l=r===n?t[0]:0,u=n===s?e[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(n,l,u));let c=o-n-1;if(a.appendChild(this._createSelectionElement(n+1,0,this._bufferService.cols,c)),n!==o){let h=s===o?e[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,0,h))}}this._selectionContainer.appendChild(a)}_createSelectionElement(t,e,i,r=1){let s=this._document.createElement("div"),n=e*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(i-e);return n+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-n),s.style.height=`${r*this.dimensions.css.cell.height}px`,s.style.top=`${t*this.dimensions.css.cell.height}px`,s.style.left=`${n}px`,s.style.width=`${o}px`,s}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let t of this._rowElements)t.replaceChildren()}renderRows(t,e){let i=this._bufferService.buffer,r=i.ybase+i.y,s=Math.min(i.x,this._bufferService.cols-1),n=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle;for(let l=t;l<=e;l++){let u=l+i.ydisp,c=this._rowElements[l],h=i.lines.get(u);if(!c||!h)break;c.replaceChildren(...this._rowFactory.createRow(h,u,u===r,o,a,s,n,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Y0}${this._terminalClass}`}_handleLinkHover(t){this._setCellUnderline(t.x1,t.x2,t.y1,t.y2,t.cols,!0)}_handleLinkLeave(t){this._setCellUnderline(t.x1,t.x2,t.y1,t.y2,t.cols,!1)}_setCellUnderline(t,e,i,r,s,n){i<0&&(t=0),r<0&&(e=0);let o=this._bufferService.rows-1;i=Math.max(Math.min(i,o),0),r=Math.max(Math.min(r,o),0),s=Math.min(s,this._bufferService.cols);let a=this._bufferService.buffer,l=a.ybase+a.y,u=Math.min(a.x,s-1),c=this._optionsService.rawOptions.cursorBlink,h=this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=i;f<=r;++f){let p=f+a.ydisp,v=this._rowElements[f],_=a.lines.get(p);if(!v||!_)break;v.replaceChildren(...this._rowFactory.createRow(_,p,p===l,h,d,u,c,this.dimensions.css.cell.width,this._widthCache,n?f===i?t:0:-1,n?(f===r?e:s)-1:-1))}}};Dh=wt([fe(7,_f),fe(8,r0),fe(9,wi),fe(10,yi),fe(11,Ln),fe(12,hs),fe(13,Co)],Dh);var Mh=class extends Fe{constructor(t,e,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ue),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new q8(this._optionsService))}catch{this._measureStrategy=this._register(new $8(t,e,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let t=this._measureStrategy.measure();(t.width!==this.width||t.height!==this.height)&&(this.width=t.width,this.height=t.height,this._onCharSizeChange.fire())}};Mh=wt([fe(2,wi)],Mh);var q4=class extends Fe{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(t,e){t!==void 0&&t>0&&e!==void 0&&e>0&&(this._result.width=t,this._result.height=e)}},$8=class extends q4{constructor(t,e,i){super(),this._document=t,this._parentElement=e,this._optionsService=i,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},q8=class extends q4{constructor(t){super(),this._optionsService=t,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let e=this._ctx.measureText("W");if(!("width"in e&&"fontBoundingBoxAscent"in e&&"fontBoundingBoxDescent"in e))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let t=this._ctx.measureText("W");return this._validateAndSet(t.width,t.fontBoundingBoxAscent+t.fontBoundingBoxDescent),this._result}},W8=class extends Fe{constructor(t,e,i){super(),this._textarea=t,this._window=e,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new K8(this._window)),this._onDprChange=this._register(new ue),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ue),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(si.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Te(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Te(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(t){this._window!==t&&(this._window=t,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},K8=class extends Fe{constructor(t){super(),this._parentWindow=t,this._windowResizeListener=this._register(new co),this._onDprChange=this._register(new ue),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(ut(()=>this.clearListener()))}setWindow(t){this._parentWindow=t,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Te(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var t;this._outerListener&&((t=this._resolutionMediaMatchList)==null||t.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},V8=class extends Fe{constructor(){super(),this.linkProviders=[],this._register(ut(()=>this.linkProviders.length=0))}registerLinkProvider(t){return this.linkProviders.push(t),{dispose:()=>{let e=this.linkProviders.indexOf(t);e!==-1&&this.linkProviders.splice(e,1)}}}};function Ef(t,e,i){let r=i.getBoundingClientRect(),s=t.getComputedStyle(i),n=parseInt(s.getPropertyValue("padding-left")),o=parseInt(s.getPropertyValue("padding-top"));return[e.clientX-r.left-n,e.clientY-r.top-o]}function U8(t,e,i,r,s,n,o,a,l){if(!n)return;let u=Ef(t,e,i);if(u)return u[0]=Math.ceil((u[0]+(l?o/2:0))/o),u[1]=Math.ceil(u[1]/a),u[0]=Math.min(Math.max(u[0],1),r+(l?1:0)),u[1]=Math.min(Math.max(u[1],1),s),u}var Th=class{constructor(t,e){this._renderService=t,this._charSizeService=e}getCoords(t,e,i,r,s){return U8(window,t,e,i,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(t,e){let i=Ef(window,t,e);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};Th=wt([fe(0,ds),fe(1,r0)],Th);var G8=class{constructor(t,e){this._renderCallback=t,this._coreBrowserService=e,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(t){return this._refreshCallbacks.push(t),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(t,e,i){this._rowCount=i,t=t!==void 0?t:0,e=e!==void 0?e:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,t):t,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,e):e,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let t=Math.max(this._rowStart,0),e=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(t,e),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let t of this._refreshCallbacks)t(0);this._refreshCallbacks=[]}},W4={};s_(W4,{getSafariVersion:()=>X8,isChromeOS:()=>G4,isFirefox:()=>K4,isIpad:()=>J8,isIphone:()=>Z8,isLegacyEdge:()=>Y8,isLinux:()=>Mf,isMac:()=>Df,isNode:()=>s0,isSafari:()=>V4,isWindows:()=>U4});var s0=typeof process<"u"&&"title"in process,Va=s0?"node":navigator.userAgent,Ua=s0?"node":navigator.platform,K4=Va.includes("Firefox"),Y8=Va.includes("Edge"),V4=/^((?!chrome|android).)*safari/i.test(Va);function X8(){if(!V4)return 0;let t=Va.match(/Version\/(\d+)/);return t===null||t.length<2?0:parseInt(t[1])}var Df=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Ua),J8=Ua==="iPad",Z8=Ua==="iPhone",U4=["Windows","Win16","Win32","WinCE"].includes(Ua),Mf=Ua.indexOf("Linux")>=0,G4=/\bCrOS\b/.test(Va),Y4=class{constructor(){this._tasks=[],this._i=0}enqueue(t){this._tasks.push(t),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(t){this._idleCallback=void 0;let e=0,i=0,r=t.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(e=performance.now(),this._tasks[this._i]()||this._i++,e=Math.max(1,performance.now()-e),i=Math.max(e,i),s=t.timeRemaining(),i*1.5>s){r-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-e))}ms`),this._start();return}r=s}this.clear()}},Q8=class extends Y4{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let e=performance.now()+t;return{timeRemaining:()=>Math.max(0,e-performance.now())}}},ey=class extends Y4{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},ku=!s0&&"requestIdleCallback"in window?ey:Q8,ty=class{constructor(){this._queue=new ku}set(t){this._queue.clear(),this._queue.enqueue(t)}flush(){this._queue.flush()}},Bh=class extends Fe{constructor(t,e,i,r,s,n,o,a,l){super(),this._rowCount=t,this._optionsService=i,this._charSizeService=r,this._coreService=s,this._coreBrowserService=a,this._renderer=this._register(new co),this._pausedResizeTask=new ty,this._observerDisposable=this._register(new co),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new ue),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ue),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ue),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ue),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new G8((u,c)=>this._renderRows(u,c),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new iy(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(ut(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>{var u;return(u=this._renderer.value)==null?void 0:u.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(n.onDecorationRegistered(()=>this._fullRefresh())),this._register(n.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(l.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,e),this._register(this._coreBrowserService.onWindowChange(u=>this._registerIntersectionObserver(u,e)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(t,e){if("IntersectionObserver"in t){let i=new t.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});i.observe(e),this._observerDisposable.value=ut(()=>i.disconnect())}}_handleIntersectionChange(t){this._isPaused=t.isIntersecting===void 0?t.intersectionRatio===0:!t.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(t,e,i=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(t,e);return}this._pausedResizeTask.flush();let r=this._syncOutputHandler.flush();r&&(t=Math.min(t,r.start),e=Math.max(e,r.end)),i||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(t,e,this._rowCount)}_renderRows(t,e){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(t,e);return}t=Math.min(t,this._rowCount-1),e=Math.min(e,this._rowCount-1),this._renderer.value.renderRows(t,e),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:t,end:e}),this._onRender.fire({start:t,end:e}),this._isNextRenderRedrawOnly=!0}}resize(t,e){this._rowCount=e,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(t){this._renderer.value=t,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(t){return this._renderDebouncer.addRefreshCallback(t)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var t,e;this._renderer.value&&((e=(t=this._renderer.value).clearTextureAtlas)==null||e.call(t),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(t,e){this._renderer.value&&(this._isPaused||this._coreService.decPrivateModes.synchronizedOutput?this._pausedResizeTask.set(()=>{var i;return(i=this._renderer.value)==null?void 0:i.handleResize(t,e)}):this._renderer.value.handleResize(t,e),this._fullRefresh())}handleCharSizeChanged(){var t;(t=this._renderer.value)==null||t.handleCharSizeChanged()}handleBlur(){var t;(t=this._renderer.value)==null||t.handleBlur()}handleFocus(){var t;(t=this._renderer.value)==null||t.handleFocus()}handleSelectionChanged(t,e,i){var r;this._selectionState.start=t,this._selectionState.end=e,this._selectionState.columnSelectMode=i,(r=this._renderer.value)==null||r.handleSelectionChanged(t,e,i)}handleCursorMove(){var t;(t=this._renderer.value)==null||t.handleCursorMove()}clear(){var t;(t=this._renderer.value)==null||t.clear()}};Bh=wt([fe(2,wi),fe(3,r0),fe(4,Ln),fe(5,Ka),fe(6,yi),fe(7,hs),fe(8,Co)],Bh);var iy=class{constructor(t,e,i){this._coreBrowserService=t,this._coreService=e,this._onTimeout=i,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(t,e){this._isBuffering?(this._start=Math.min(this._start,t),this._end=Math.max(this._end,e)):(this._start=t,this._end=e,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let t={start:this._start,end:this._end};return this._isBuffering=!1,t}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function ry(t,e,i,r){let s=i.buffer.x,n=i.buffer.y;if(!i.buffer.hasScrollback)return oy(s,n,t,e,i,r)+n0(n,e,i,r)+ay(s,n,t,e,i,r);let o;if(n===e)return o=s>t?"D":"C",xa(Math.abs(s-t),wa(o,r));o=n>e?"D":"C";let a=Math.abs(n-e),l=ny(n>e?t:s,i)+(a-1)*i.cols+1+sy(n>e?s:t);return xa(l,wa(o,r))}function sy(t,e){return t-1}function ny(t,e){return e.cols-t}function oy(t,e,i,r,s,n){return n0(e,r,s,n).length===0?"":xa(J4(t,e,t,e-An(e,s),!1,s).length,wa("D",n))}function n0(t,e,i,r){let s=t-An(t,i),n=e-An(e,i),o=Math.abs(s-n)-ly(t,e,i);return xa(o,wa(X4(t,e),r))}function ay(t,e,i,r,s,n){let o;n0(e,r,s,n).length>0?o=r-An(r,s):o=e;let a=r,l=uy(t,e,i,r,s,n);return xa(J4(t,o,i,a,l==="C",s).length,wa(l,n))}function ly(t,e,i){var o;let r=0,s=t-An(t,i),n=e-An(e,i);for(let a=0;a<Math.abs(s-n);a++){let l=X4(t,e)==="A"?-1:1;(o=i.buffer.lines.get(s+l*a))!=null&&o.isWrapped&&r++}return r}function An(t,e){let i=0,r=e.buffer.lines.get(t),s=r==null?void 0:r.isWrapped;for(;s&&t>=0&&t<e.rows;)i++,r=e.buffer.lines.get(--t),s=r==null?void 0:r.isWrapped;return i}function uy(t,e,i,r,s,n){let o;return n0(i,r,s,n).length>0?o=r-An(r,s):o=e,t<i&&o<=r||t>=i&&o<r?"C":"D"}function X4(t,e){return t>e?"A":"B"}function J4(t,e,i,r,s,n){let o=t,a=e,l="";for(;(o!==i||a!==r)&&a>=0&&a<n.buffer.lines.length;)o+=s?1:-1,s&&o>n.cols-1?(l+=n.buffer.translateBufferLineToString(a,!1,t,o),o=0,t=0,a++):!s&&o<0&&(l+=n.buffer.translateBufferLineToString(a,!1,0,t+1),o=n.cols-1,t=o,a--);return l+n.buffer.translateBufferLineToString(a,!1,t,o)}function wa(t,e){let i=e?"O":"[";return Z.ESC+i+t}function xa(t,e){t=Math.floor(t);let i="";for(let r=0;r<t;r++)i+=e;return i}var cy=class{constructor(t){this._bufferService=t,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?t%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)-1]:[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[t,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[Math.max(t,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let t=this.selectionStart,e=this.selectionEnd;return!t||!e?!1:t[1]>e[1]||t[1]===e[1]&&t[0]>e[0]}handleTrim(t){return this.selectionStart&&(this.selectionStart[1]-=t),this.selectionEnd&&(this.selectionEnd[1]-=t),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function yp(t,e){if(t.start.y>t.end.y)throw new Error(`Buffer range end (${t.end.x}, ${t.end.y}) cannot be before start (${t.start.x}, ${t.start.y})`);return e*(t.end.y-t.start.y)+(t.end.x-t.start.x+1)}var X0=50,hy=15,dy=50,fy=500,py=" ",my=new RegExp(py,"g"),Rh=class extends Fe{constructor(t,e,i,r,s,n,o,a,l){super(),this._element=t,this._screenElement=e,this._linkifier=i,this._bufferService=r,this._coreService=s,this._mouseService=n,this._optionsService=o,this._renderService=a,this._coreBrowserService=l,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new rr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ue),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ue),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ue),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ue),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=u=>this._handleMouseMove(u),this._mouseUpListener=u=>this._handleMouseUp(u),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(u=>this._handleTrim(u)),this._register(this._bufferService.buffers.onBufferActivate(u=>this._handleBufferActivate(u))),this.enable(),this._model=new cy(this._bufferService),this._activeSelectionMode=0,this._register(ut(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(u=>{u.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let t=this._model.finalSelectionStart,e=this._model.finalSelectionEnd;return!t||!e?!1:t[0]!==e[0]||t[1]!==e[1]}get selectionText(){let t=this._model.finalSelectionStart,e=this._model.finalSelectionEnd;if(!t||!e)return"";let i=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(t[0]===e[0])return"";let s=t[0]<e[0]?t[0]:e[0],n=t[0]<e[0]?e[0]:t[0];for(let o=t[1];o<=e[1];o++){let a=i.translateBufferLineToString(o,!0,s,n);r.push(a)}}else{let s=t[1]===e[1]?e[0]:void 0;r.push(i.translateBufferLineToString(t[1],!0,t[0],s));for(let n=t[1]+1;n<=e[1]-1;n++){let o=i.lines.get(n),a=i.translateBufferLineToString(n,!0);o!=null&&o.isWrapped?r[r.length-1]+=a:r.push(a)}if(t[1]!==e[1]){let n=i.lines.get(e[1]),o=i.translateBufferLineToString(e[1],!0,0,e[0]);n&&n.isWrapped?r[r.length-1]+=o:r.push(o)}}return r.map(s=>s.replace(my," ")).join(U4?`\r
24
+ `:`
25
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(t){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Mf&&t&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(t){let e=this._getMouseBufferCoords(t),i=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!i||!r||!e?!1:this._areCoordsInSelection(e,i,r)}isCellInSelection(t,e){let i=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!i||!r?!1:this._areCoordsInSelection([t,e],i,r)}_areCoordsInSelection(t,e,i){return t[1]>e[1]&&t[1]<i[1]||e[1]===i[1]&&t[1]===e[1]&&t[0]>=e[0]&&t[0]<i[0]||e[1]<i[1]&&t[1]===i[1]&&t[0]<i[0]||e[1]<i[1]&&t[1]===e[1]&&t[0]>=e[0]}_selectWordAtCursor(t,e){var s,n;let i=(n=(s=this._linkifier.currentLink)==null?void 0:s.link)==null?void 0:n.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=yp(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(t);return r?(this._selectWordAt(r,e),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(t,e){this._model.clearSelection(),t=Math.max(t,0),e=Math.min(e,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,t],this._model.selectionEnd=[this._bufferService.cols,e],this.refresh(),this._onSelectionChange.fire()}_handleTrim(t){this._model.handleTrim(t)&&this.refresh()}_getMouseBufferCoords(t){let e=this._mouseService.getCoords(t,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(e)return e[0]--,e[1]--,e[1]+=this._bufferService.buffer.ydisp,e}_getMouseEventScrollAmount(t){let e=Ef(this._coreBrowserService.window,t,this._screenElement)[1],i=this._renderService.dimensions.css.canvas.height;return e>=0&&e<=i?0:(e>i&&(e-=i),e=Math.min(Math.max(e,-X0),X0),e/=X0,e/Math.abs(e)+Math.round(e*(hy-1)))}shouldForceSelection(t){return!0}handleMouseDown(t){if(this._mouseDownTimeStamp=t.timeStamp,!(t.button===2&&this.hasSelection)&&t.button===0){if(!this._enabled){if(!this.shouldForceSelection(t))return;t.stopPropagation()}t.preventDefault(),this._dragScrollAmount=0,this._enabled&&t.shiftKey?this._handleIncrementalClick(t):t.detail===1?this._handleSingleClick(t):t.detail===2?this._handleDoubleClick(t):t.detail===3&&this._handleTripleClick(t),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),dy)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(t){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(t))}_handleSingleClick(t){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(t)?3:0,this._model.selectionStart=this._getMouseBufferCoords(t),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let e=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);e&&e.length!==this._model.selectionStart[0]&&e.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(t){this._selectWordAtCursor(t,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(t){let e=this._getMouseBufferCoords(t);e&&(this._activeSelectionMode=2,this._selectLineAt(e[1]))}shouldColumnSelect(t){return t.altKey&&!(Df&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(t){if(t.stopImmediatePropagation(),!this._model.selectionStart)return;let e=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(t),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(t),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let i=this._bufferService.buffer;if(this._model.selectionEnd[1]<i.lines.length){let r=i.lines.get(this._model.selectionEnd[1]);r&&r.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!e||e[0]!==this._model.selectionEnd[0]||e[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let t=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(t.ydisp+this._bufferService.rows,t.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=t.ydisp),this.refresh()}}_handleMouseUp(t){let e=t.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&e<fy&&t.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let i=this._mouseService.getCoords(t,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&i[0]!==void 0&&i[1]!==void 0){let r=ry(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let t=this._model.finalSelectionStart,e=this._model.finalSelectionEnd,i=!!t&&!!e&&(t[0]!==e[0]||t[1]!==e[1]);if(!i){this._oldHasSelection&&this._fireOnSelectionChange(t,e,i);return}!t||!e||(!this._oldSelectionStart||!this._oldSelectionEnd||t[0]!==this._oldSelectionStart[0]||t[1]!==this._oldSelectionStart[1]||e[0]!==this._oldSelectionEnd[0]||e[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(t,e,i)}_fireOnSelectionChange(t,e,i){this._oldSelectionStart=t,this._oldSelectionEnd=e,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(t){this.clearSelection(),this._trimListener.dispose(),this._trimListener=t.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(t,e){let i=e;for(let r=0;e>=r;r++){let s=t.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?i--:s>1&&e!==r&&(i+=s-1)}return i}setSelection(t,e,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[t,e],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(t){this._isClickInSelection(t)||(this._selectWordAtCursor(t,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(t,e,i=!0,r=!0){if(t[0]>=this._bufferService.cols)return;let s=this._bufferService.buffer,n=s.lines.get(t[1]);if(!n)return;let o=s.translateBufferLineToString(t[1],!1),a=this._convertViewportColToCharacterIndex(n,t[0]),l=a,u=t[0]-a,c=0,h=0,d=0,f=0;if(o.charAt(a)===" "){for(;a>0&&o.charAt(a-1)===" ";)a--;for(;l<o.length&&o.charAt(l+1)===" ";)l++}else{let _=t[0],w=t[0];n.getWidth(_)===0&&(c++,_--),n.getWidth(w)===2&&(h++,w++);let x=n.getString(w).length;for(x>1&&(f+=x-1,l+=x-1);_>0&&a>0&&!this._isCharWordSeparator(n.loadCell(_-1,this._workCell));){n.loadCell(_-1,this._workCell);let C=this._workCell.getChars().length;this._workCell.getWidth()===0?(c++,_--):C>1&&(d+=C-1,a-=C-1),a--,_--}for(;w<n.length&&l+1<o.length&&!this._isCharWordSeparator(n.loadCell(w+1,this._workCell));){n.loadCell(w+1,this._workCell);let C=this._workCell.getChars().length;this._workCell.getWidth()===2?(h++,w++):C>1&&(f+=C-1,l+=C-1),l++,w++}}l++;let p=a+u-c+d,v=Math.min(this._bufferService.cols,l-a+c+h-d-f);if(!(!e&&o.slice(a,l).trim()==="")){if(i&&p===0&&n.getCodePoint(0)!==32){let _=s.lines.get(t[1]-1);if(_&&n.isWrapped&&_.getCodePoint(this._bufferService.cols-1)!==32){let w=this._getWordAt([this._bufferService.cols-1,t[1]-1],!1,!0,!1);if(w){let x=this._bufferService.cols-w.start;p-=x,v+=x}}}if(r&&p+v===this._bufferService.cols&&n.getCodePoint(this._bufferService.cols-1)!==32){let _=s.lines.get(t[1]+1);if(_!=null&&_.isWrapped&&_.getCodePoint(0)!==32){let w=this._getWordAt([0,t[1]+1],!1,!1,!0);w&&(v+=w.length)}}return{start:p,length:v}}}_selectWordAt(t,e){let i=this._getWordAt(t,e);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,t[1]--;this._model.selectionStart=[i.start,t[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(t){let e=this._getWordAt(t,!0);if(e){let i=t[1];for(;e.start<0;)e.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;e.start+e.length>this._bufferService.cols;)e.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?e.start:e.start+e.length,i]}}_isCharWordSeparator(t){return t.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(t.getChars())>=0}_selectLineAt(t){let e=this._bufferService.buffer.getWrappedRangeForLine(t),i={start:{x:0,y:e.first},end:{x:this._bufferService.cols-1,y:e.last}};this._model.selectionStart=[0,e.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=yp(i,this._bufferService.cols)}};Rh=wt([fe(3,yi),fe(4,Ln),fe(5,yf),fe(6,wi),fe(7,ds),fe(8,hs)],Rh);var wp=class{constructor(){this._data={}}set(t,e,i){this._data[t]||(this._data[t]={}),this._data[t][e]=i}get(t,e){return this._data[t]?this._data[t][e]:void 0}clear(){this._data={}}},xp=class{constructor(){this._color=new wp,this._css=new wp}setCss(t,e,i){this._css.set(t,e,i)}getCss(t,e){return this._css.get(t,e)}setColor(t,e,i){this._color.set(t,e,i)}getColor(t,e){return this._color.get(t,e)}clear(){this._color.clear(),this._css.clear()}},It=Object.freeze((()=>{let t=[mt.toColor("#2e3436"),mt.toColor("#cc0000"),mt.toColor("#4e9a06"),mt.toColor("#c4a000"),mt.toColor("#3465a4"),mt.toColor("#75507b"),mt.toColor("#06989a"),mt.toColor("#d3d7cf"),mt.toColor("#555753"),mt.toColor("#ef2929"),mt.toColor("#8ae234"),mt.toColor("#fce94f"),mt.toColor("#729fcf"),mt.toColor("#ad7fa8"),mt.toColor("#34e2e2"),mt.toColor("#eeeeec")],e=[0,95,135,175,215,255];for(let i=0;i<216;i++){let r=e[i/36%6|0],s=e[i/6%6|0],n=e[i%6];t.push({css:Tt.toCss(r,s,n),rgba:Tt.toRgba(r,s,n)})}for(let i=0;i<24;i++){let r=8+i*10;t.push({css:Tt.toCss(r,r,r),rgba:Tt.toRgba(r,r,r)})}return t})()),hn=mt.toColor("#ffffff"),Xo=mt.toColor("#000000"),Sp=mt.toColor("#ffffff"),kp=Xo,Io={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},gy=hn,Nh=class extends Fe{constructor(t){super(),this._optionsService=t,this._contrastCache=new xp,this._halfContrastCache=new xp,this._onChangeColors=this._register(new ue),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:hn,background:Xo,cursor:Sp,cursorAccent:kp,selectionForeground:void 0,selectionBackgroundTransparent:Io,selectionBackgroundOpaque:ot.blend(Xo,Io),selectionInactiveBackgroundTransparent:Io,selectionInactiveBackgroundOpaque:ot.blend(Xo,Io),scrollbarSliderBackground:ot.opacity(hn,.2),scrollbarSliderHoverBackground:ot.opacity(hn,.4),scrollbarSliderActiveBackground:ot.opacity(hn,.5),overviewRulerBorder:hn,ansi:It.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(t={}){let e=this._colors;if(e.foreground=Je(t.foreground,hn),e.background=Je(t.background,Xo),e.cursor=ot.blend(e.background,Je(t.cursor,Sp)),e.cursorAccent=ot.blend(e.background,Je(t.cursorAccent,kp)),e.selectionBackgroundTransparent=Je(t.selectionBackground,Io),e.selectionBackgroundOpaque=ot.blend(e.background,e.selectionBackgroundTransparent),e.selectionInactiveBackgroundTransparent=Je(t.selectionInactiveBackground,e.selectionBackgroundTransparent),e.selectionInactiveBackgroundOpaque=ot.blend(e.background,e.selectionInactiveBackgroundTransparent),e.selectionForeground=t.selectionForeground?Je(t.selectionForeground,vp):void 0,e.selectionForeground===vp&&(e.selectionForeground=void 0),ot.isOpaque(e.selectionBackgroundTransparent)&&(e.selectionBackgroundTransparent=ot.opacity(e.selectionBackgroundTransparent,.3)),ot.isOpaque(e.selectionInactiveBackgroundTransparent)&&(e.selectionInactiveBackgroundTransparent=ot.opacity(e.selectionInactiveBackgroundTransparent,.3)),e.scrollbarSliderBackground=Je(t.scrollbarSliderBackground,ot.opacity(e.foreground,.2)),e.scrollbarSliderHoverBackground=Je(t.scrollbarSliderHoverBackground,ot.opacity(e.foreground,.4)),e.scrollbarSliderActiveBackground=Je(t.scrollbarSliderActiveBackground,ot.opacity(e.foreground,.5)),e.overviewRulerBorder=Je(t.overviewRulerBorder,gy),e.ansi=It.slice(),e.ansi[0]=Je(t.black,It[0]),e.ansi[1]=Je(t.red,It[1]),e.ansi[2]=Je(t.green,It[2]),e.ansi[3]=Je(t.yellow,It[3]),e.ansi[4]=Je(t.blue,It[4]),e.ansi[5]=Je(t.magenta,It[5]),e.ansi[6]=Je(t.cyan,It[6]),e.ansi[7]=Je(t.white,It[7]),e.ansi[8]=Je(t.brightBlack,It[8]),e.ansi[9]=Je(t.brightRed,It[9]),e.ansi[10]=Je(t.brightGreen,It[10]),e.ansi[11]=Je(t.brightYellow,It[11]),e.ansi[12]=Je(t.brightBlue,It[12]),e.ansi[13]=Je(t.brightMagenta,It[13]),e.ansi[14]=Je(t.brightCyan,It[14]),e.ansi[15]=Je(t.brightWhite,It[15]),t.extendedAnsi){let i=Math.min(e.ansi.length-16,t.extendedAnsi.length);for(let r=0;r<i;r++)e.ansi[r+16]=Je(t.extendedAnsi[r],It[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(t){this._restoreColor(t),this._onChangeColors.fire(this.colors)}_restoreColor(t){if(t===void 0){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}switch(t){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[t]=this._restoreColors.ansi[t]}}modifyColors(t){t(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};Nh=wt([fe(0,wi)],Nh);function Je(t,e){if(t!==void 0)try{return mt.toColor(t)}catch{}return e}var vy=class{constructor(...t){this._entries=new Map;for(let[e,i]of t)this.set(e,i)}set(t,e){let i=this._entries.get(t);return this._entries.set(t,e),i}forEach(t){for(let[e,i]of this._entries.entries())t(e,i)}has(t){return this._entries.has(t)}get(t){return this._entries.get(t)}},by=class{constructor(){this._services=new vy,this._services.set(_f,this)}setService(t,e){this._services.set(t,e)}getService(t){return this._services.get(t)}createInstance(t,...e){let i=h_(t).sort((n,o)=>n.index-o.index),r=[];for(let n of i){let o=this._services.get(n.id);if(!o)throw new Error(`[createInstance] ${t.name} depends on UNKNOWN service ${n.id._id}.`);r.push(o)}let s=i.length>0?i[0].index:e.length;if(e.length!==s)throw new Error(`[createInstance] First service dependency of ${t.name} at position ${s+1} conflicts with ${e.length} static arguments`);return new t(...e,...r)}},_y={trace:0,debug:1,info:2,warn:3,error:4,off:5},yy="xterm.js: ",Lh=class extends Fe{constructor(t){super(),this._optionsService=t,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=_y[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let e=0;e<t.length;e++)typeof t[e]=="function"&&(t[e]=t[e]())}_log(t,e,i){this._evalLazyOptionalParams(i),t.call(console,(this._optionsService.options.logger?"":yy)+e,...i)}trace(t,...e){var i;this._logLevel<=0&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,t,e)}debug(t,...e){var i;this._logLevel<=1&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,t,e)}info(t,...e){var i;this._logLevel<=2&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,t,e)}warn(t,...e){var i;this._logLevel<=3&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,t,e)}error(t,...e){var i;this._logLevel<=4&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,t,e)}};Lh=wt([fe(0,wi)],Lh);var Cp=class extends Fe{constructor(t){super(),this._maxLength=t,this.onDeleteEmitter=this._register(new ue),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ue),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ue),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(t){if(this._maxLength===t)return;let e=new Array(t);for(let i=0;i<Math.min(t,this.length);i++)e[i]=this._array[this._getCyclicIndex(i)];this._array=e,this._maxLength=t,this._startIndex=0}get length(){return this._length}set length(t){if(t>this._length)for(let e=this._length;e<t;e++)this._array[e]=void 0;this._length=t}get(t){return this._array[this._getCyclicIndex(t)]}set(t,e){this._array[this._getCyclicIndex(t)]=e}push(t){this._array[this._getCyclicIndex(this._length)]=t,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(t,e,...i){if(e){for(let r=t;r<this._length-e;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+e)];this._length-=e,this.onDeleteEmitter.fire({index:t,amount:e})}for(let r=this._length-1;r>=t;r--)this._array[this._getCyclicIndex(r+i.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<i.length;r++)this._array[this._getCyclicIndex(t+r)]=i[r];if(i.length&&this.onInsertEmitter.fire({index:t,amount:i.length}),this._length+i.length>this._maxLength){let r=this._length+i.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=i.length}trimStart(t){t>this._length&&(t=this._length),this._startIndex+=t,this._length-=t,this.onTrimEmitter.fire(t)}shiftElements(t,e,i){if(!(e<=0)){if(t<0||t>=this._length)throw new Error("start argument out of range");if(t+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let s=e-1;s>=0;s--)this.set(t+s+i,this.get(t+s));let r=t+e+i-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<e;r++)this.set(t+r+i,this.get(t+r))}}_getCyclicIndex(t){return(this._startIndex+t)%this._maxLength}},Pe=3,Dt=Object.freeze(new Wa),gl=0,J0=2,Jo=class Z4{constructor(e,i,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*Pe);let s=i||rr.fromCharData([0,v4,1,0]);for(let n=0;n<e;++n)this.setCell(n,s);this.length=e}get(e){let i=this._data[e*Pe+0],r=i&2097151;return[this._data[e*Pe+1],i&2097152?this._combined[e]:r?Es(r):"",i>>22,i&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):r]}set(e,i){this._data[e*Pe+1]=i[0],i[1].length>1?(this._combined[e]=i[1],this._data[e*Pe+0]=e|2097152|i[2]<<22):this._data[e*Pe+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(e){return this._data[e*Pe+0]>>22}hasWidth(e){return this._data[e*Pe+0]&12582912}getFg(e){return this._data[e*Pe+1]}getBg(e){return this._data[e*Pe+2]}hasContent(e){return this._data[e*Pe+0]&4194303}getCodePoint(e){let i=this._data[e*Pe+0];return i&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):i&2097151}isCombined(e){return this._data[e*Pe+0]&2097152}getString(e){let i=this._data[e*Pe+0];return i&2097152?this._combined[e]:i&2097151?Es(i&2097151):""}isProtected(e){return this._data[e*Pe+2]&536870912}loadCell(e,i){return gl=e*Pe,i.content=this._data[gl+0],i.fg=this._data[gl+1],i.bg=this._data[gl+2],i.content&2097152&&(i.combinedData=this._combined[e]),i.bg&268435456&&(i.extended=this._extendedAttrs[e]),i}setCell(e,i){i.content&2097152&&(this._combined[e]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[e]=i.extended),this._data[e*Pe+0]=i.content,this._data[e*Pe+1]=i.fg,this._data[e*Pe+2]=i.bg}setCellFromCodepoint(e,i,r,s){s.bg&268435456&&(this._extendedAttrs[e]=s.extended),this._data[e*Pe+0]=i|r<<22,this._data[e*Pe+1]=s.fg,this._data[e*Pe+2]=s.bg}addCodepointToCell(e,i,r){let s=this._data[e*Pe+0];s&2097152?this._combined[e]+=Es(i):s&2097151?(this._combined[e]=Es(s&2097151)+Es(i),s&=-2097152,s|=2097152):s=i|1<<22,r&&(s&=-12582913,s|=r<<22),this._data[e*Pe+0]=s}insertCells(e,i,r){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,r),i<this.length-e){let s=new rr;for(let n=this.length-e-i-1;n>=0;--n)this.setCell(e+i+n,this.loadCell(e+n,s));for(let n=0;n<i;++n)this.setCell(e+n,r)}else for(let s=e;s<this.length;++s)this.setCell(s,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(e,i,r){if(e%=this.length,i<this.length-e){let s=new rr;for(let n=0;n<this.length-e-i;++n)this.setCell(e+n,this.loadCell(e+i+n,s));for(let n=this.length-i;n<this.length;++n)this.setCell(n,r)}else for(let s=e;s<this.length;++s)this.setCell(s,r);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,r),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,r)}replaceCells(e,i,r,s=!1){if(s){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,r),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,r);e<i&&e<this.length;)this.isProtected(e)||this.setCell(e,r),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,r),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,r);e<i&&e<this.length;)this.setCell(e++,r)}resize(e,i){if(e===this.length)return this._data.length*4*J0<this._data.buffer.byteLength;let r=e*Pe;if(e>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let s=new Uint32Array(r);s.set(this._data),this._data=s}for(let s=this.length;s<e;++s)this.setCell(s,i)}else{this._data=this._data.subarray(0,r);let s=Object.keys(this._combined);for(let o=0;o<s.length;o++){let a=parseInt(s[o],10);a>=e&&delete this._combined[a]}let n=Object.keys(this._extendedAttrs);for(let o=0;o<n.length;o++){let a=parseInt(n[o],10);a>=e&&delete this._extendedAttrs[a]}}return this.length=e,r*4*J0<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*J0<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,i=!1){if(i){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,e);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,e)}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(let i in e._combined)this._combined[i]=e._combined[i];this._extendedAttrs={};for(let i in e._extendedAttrs)this._extendedAttrs[i]=e._extendedAttrs[i];this.isWrapped=e.isWrapped}clone(){let e=new Z4(0);e._data=new Uint32Array(this._data),e.length=this.length;for(let i in this._combined)e._combined[i]=this._combined[i];for(let i in this._extendedAttrs)e._extendedAttrs[i]=this._extendedAttrs[i];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*Pe+0]&4194303)return e+(this._data[e*Pe+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*Pe+0]&4194303||this._data[e*Pe+2]&50331648)return e+(this._data[e*Pe+0]>>22);return 0}copyCellsFrom(e,i,r,s,n){let o=e._data;if(n)for(let l=s-1;l>=0;l--){for(let u=0;u<Pe;u++)this._data[(r+l)*Pe+u]=o[(i+l)*Pe+u];o[(i+l)*Pe+2]&268435456&&(this._extendedAttrs[r+l]=e._extendedAttrs[i+l])}else for(let l=0;l<s;l++){for(let u=0;u<Pe;u++)this._data[(r+l)*Pe+u]=o[(i+l)*Pe+u];o[(i+l)*Pe+2]&268435456&&(this._extendedAttrs[r+l]=e._extendedAttrs[i+l])}let a=Object.keys(e._combined);for(let l=0;l<a.length;l++){let u=parseInt(a[l],10);u>=i&&(this._combined[u-i+r]=e._combined[u])}}translateToString(e,i,r,s){i=i??0,r=r??this.length,e&&(r=Math.min(r,this.getTrimmedLength())),s&&(s.length=0);let n="";for(;i<r;){let o=this._data[i*Pe+0],a=o&2097151,l=o&2097152?this._combined[i]:a?Es(a):Os;if(n+=l,s)for(let u=0;u<l.length;++u)s.push(i);i+=o>>22||1}return s&&s.push(i),n}};function wy(t,e,i,r,s,n){let o=[];for(let a=0;a<t.length-1;a++){let l=a,u=t.get(++l);if(!u.isWrapped)continue;let c=[t.get(a)];for(;l<t.length&&u.isWrapped;)c.push(u),u=t.get(++l);if(!n&&r>=a&&r<l){a+=c.length-1;continue}let h=0,d=Sa(c,h,e),f=1,p=0;for(;f<c.length;){let _=Sa(c,f,e),w=_-p,x=i-d,C=Math.min(w,x);c[h].copyCellsFrom(c[f],p,d,C,!1),d+=C,d===i&&(h++,d=0),p+=C,p===_&&(f++,p=0),d===0&&h!==0&&c[h-1].getWidth(i-1)===2&&(c[h].copyCellsFrom(c[h-1],i-1,d++,1,!1),c[h-1].setCell(i-1,s))}c[h].replaceCells(d,i,s);let v=0;for(let _=c.length-1;_>0&&(_>h||c[_].getTrimmedLength()===0);_--)v++;v>0&&(o.push(a+c.length-v),o.push(v)),a+=c.length-1}return o}function xy(t,e){let i=[],r=0,s=e[r],n=0;for(let o=0;o<t.length;o++)if(s===o){let a=e[++r];t.onDeleteEmitter.fire({index:o-n,amount:a}),o+=a-1,n+=a,s=e[++r]}else i.push(o);return{layout:i,countRemoved:n}}function Sy(t,e){let i=[];for(let r=0;r<e.length;r++)i.push(t.get(e[r]));for(let r=0;r<i.length;r++)t.set(r,i[r]);t.length=e.length}function ky(t,e,i){let r=[],s=t.map((l,u)=>Sa(t,u,e)).reduce((l,u)=>l+u),n=0,o=0,a=0;for(;a<s;){if(s-a<i){r.push(s-a);break}n+=i;let l=Sa(t,o,e);n>l&&(n-=l,o++);let u=t[o].getWidth(n-1)===2;u&&n--;let c=u?i-1:i;r.push(c),a+=c}return r}function Sa(t,e,i){if(e===t.length-1)return t[e].getTrimmedLength();let r=!t[e].hasContent(i-1)&&t[e].getWidth(i-1)===1,s=t[e+1].getWidth(0)===2;return r&&s?i-1:i}var Q4=class ev{constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=ev._nextId++,this._onDispose=this.register(new ue),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Cn(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};Q4._nextId=1;var Cy=Q4,Ht={},dn=Ht.B;Ht[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};Ht.A={"#":"£"};Ht.B=void 0;Ht[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Ht.C=Ht[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ht.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Ht.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Ht.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Ht.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Ht.E=Ht[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Ht.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Ht.H=Ht[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ht["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Ap=4294967295,Ep=class{constructor(t,e,i){this._hasScrollback=t,this._optionsService=e,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Dt.clone(),this.savedCharset=dn,this.markers=[],this._nullCell=rr.fromCharData([0,v4,1,0]),this._whitespaceCell=rr.fromCharData([0,Os,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new ku,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Cp(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(t){return t?(this._nullCell.fg=t.fg,this._nullCell.bg=t.bg,this._nullCell.extended=t.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new wu),this._nullCell}getWhitespaceCell(t){return t?(this._whitespaceCell.fg=t.fg,this._whitespaceCell.bg=t.bg,this._whitespaceCell.extended=t.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new wu),this._whitespaceCell}getBlankLine(t,e){return new Jo(this._bufferService.cols,this.getNullCell(t),e)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let t=this.ybase+this.y-this.ydisp;return t>=0&&t<this._rows}_getCorrectBufferLength(t){if(!this._hasScrollback)return t;let e=t+this._optionsService.rawOptions.scrollback;return e>Ap?Ap:e}fillViewportRows(t){if(this.lines.length===0){t===void 0&&(t=Dt);let e=this._rows;for(;e--;)this.lines.push(this.getBlankLine(t))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new Cp(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(t,e){let i=this.getNullCell(Dt),r=0,s=this._getCorrectBufferLength(e);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<t)for(let o=0;o<this.lines.length;o++)r+=+this.lines.get(o).resize(t,i);let n=0;if(this._rows<e)for(let o=this._rows;o<e;o++)this.lines.length<e+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Jo(t,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new Jo(t,i)));else for(let o=this._rows;o>e;o--)this.lines.length>e+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(s<this.lines.maxLength){let o=this.lines.length-s;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=s}this.x=Math.min(this.x,t-1),this.y=Math.min(this.y,e-1),n&&(this.y+=n),this.savedX=Math.min(this.savedX,t-1),this.scrollTop=0}if(this.scrollBottom=e-1,this._isReflowEnabled&&(this._reflow(t,e),this._cols>t))for(let n=0;n<this.lines.length;n++)r+=+this.lines.get(n).resize(t,i);this._cols=t,this._rows=e,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let t=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,t=!1);let e=0;for(;this._memoryCleanupPosition<this.lines.length;)if(e+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),e>100)return!0;return t}get _isReflowEnabled(){let t=this._optionsService.rawOptions.windowsPty;return t&&t.buildNumber?this._hasScrollback&&t.backend==="conpty"&&t.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(t,e){this._cols!==t&&(t>this._cols?this._reflowLarger(t,e):this._reflowSmaller(t,e))}_reflowLarger(t,e){let i=this._optionsService.rawOptions.reflowCursorLine,r=wy(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell(Dt),i);if(r.length>0){let s=xy(this.lines,r);Sy(this.lines,s.layout),this._reflowLargerAdjustViewport(t,e,s.countRemoved)}}_reflowLargerAdjustViewport(t,e,i){let r=this.getNullCell(Dt),s=i;for(;s-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<e&&this.lines.push(new Jo(t,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(t,e){let i=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(Dt),s=[],n=0;for(let o=this.lines.length-1;o>=0;o--){let a=this.lines.get(o);if(!a||!a.isWrapped&&a.getTrimmedLength()<=t)continue;let l=[a];for(;a.isWrapped&&o>0;)a=this.lines.get(--o),l.unshift(a);if(!i){let C=this.ybase+this.y;if(C>=o&&C<o+l.length)continue}let u=l[l.length-1].getTrimmedLength(),c=ky(l,this._cols,t),h=c.length-l.length,d;this.ybase===0&&this.y!==this.lines.length-1?d=Math.max(0,this.y-this.lines.maxLength+h):d=Math.max(0,this.lines.length-this.lines.maxLength+h);let f=[];for(let C=0;C<h;C++){let D=this.getBlankLine(Dt,!0);f.push(D)}f.length>0&&(s.push({start:o+l.length+n,newLines:f}),n+=f.length),l.push(...f);let p=c.length-1,v=c[p];v===0&&(p--,v=c[p]);let _=l.length-h-1,w=u;for(;_>=0;){let C=Math.min(w,v);if(l[p]===void 0)break;if(l[p].copyCellsFrom(l[_],w-C,v-C,C,!0),v-=C,v===0&&(p--,v=c[p]),w-=C,w===0){_--;let D=Math.max(_,0);w=Sa(l,D,this._cols)}}for(let C=0;C<l.length;C++)c[C]<t&&l[C].setCell(c[C],r);let x=h-d;for(;x-- >0;)this.ybase===0?this.y<e-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+n)-e&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+h,this.ybase+e-1)}if(s.length>0){let o=[],a=[];for(let v=0;v<this.lines.length;v++)a.push(this.lines.get(v));let l=this.lines.length,u=l-1,c=0,h=s[c];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+n);let d=0;for(let v=Math.min(this.lines.maxLength-1,l+n-1);v>=0;v--)if(h&&h.start>u+d){for(let _=h.newLines.length-1;_>=0;_--)this.lines.set(v--,h.newLines[_]);v++,o.push({index:u+1,amount:h.newLines.length}),d+=h.newLines.length,h=s[++c]}else this.lines.set(v,a[u--]);let f=0;for(let v=o.length-1;v>=0;v--)o[v].index+=f,this.lines.onInsertEmitter.fire(o[v]),f+=o[v].amount;let p=Math.max(0,l+n-this.lines.maxLength);p>0&&this.lines.onTrimEmitter.fire(p)}}translateBufferLineToString(t,e,i=0,r){let s=this.lines.get(t);return s?s.translateToString(e,i,r):""}getWrappedRangeForLine(t){let e=t,i=t;for(;e>0&&this.lines.get(e).isWrapped;)e--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:e,last:i}}setupTabStops(t){for(t!=null?this.tabs[t]||(t=this.prevStop(t)):(this.tabs={},t=0);t<this._cols;t+=this._optionsService.rawOptions.tabStopWidth)this.tabs[t]=!0}prevStop(t){for(t==null&&(t=this.x);!this.tabs[--t]&&t>0;);return t>=this._cols?this._cols-1:t<0?0:t}nextStop(t){for(t==null&&(t=this.x);!this.tabs[++t]&&t<this._cols;);return t>=this._cols?this._cols-1:t<0?0:t}clearMarkers(t){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].line===t&&(this.markers[e].dispose(),this.markers.splice(e--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].dispose();this.markers.length=0,this._isClearing=!1}addMarker(t){let e=new Cy(t);return this.markers.push(e),e.register(this.lines.onTrim(i=>{e.line-=i,e.line<0&&e.dispose()})),e.register(this.lines.onInsert(i=>{e.line>=i.index&&(e.line+=i.amount)})),e.register(this.lines.onDelete(i=>{e.line>=i.index&&e.line<i.index+i.amount&&e.dispose(),e.line>i.index&&(e.line-=i.amount)})),e.register(e.onDispose(()=>this._removeMarker(e))),e}_removeMarker(t){this._isClearing||this.markers.splice(this.markers.indexOf(t),1)}},Ay=class extends Fe{constructor(t,e){super(),this._optionsService=t,this._bufferService=e,this._onBufferActivate=this._register(new ue),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new Ep(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Ep(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(t){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(t),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(t,e){this._normal.resize(t,e),this._alt.resize(t,e),this.setupTabStops(t)}setupTabStops(t){this._normal.setupTabStops(t),this._alt.setupTabStops(t)}},tv=2,iv=1,Oh=class extends Fe{constructor(t){super(),this.isUserScrolling=!1,this._onResize=this._register(new ue),this.onResize=this._onResize.event,this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this.cols=Math.max(t.rawOptions.cols||0,tv),this.rows=Math.max(t.rawOptions.rows||0,iv),this.buffers=this._register(new Ay(t,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(t,e){let i=this.cols!==t,r=this.rows!==e;this.cols=t,this.rows=e,this.buffers.resize(t,e),this._onResize.fire({cols:t,rows:e,colsChanged:i,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(t,e=!1){let i=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==t.fg||r.getBg(0)!==t.bg)&&(r=i.getBlankLine(t,e),this._cachedBlankLine=r),r.isWrapped=e;let s=i.ybase+i.scrollTop,n=i.ybase+i.scrollBottom;if(i.scrollTop===0){let o=i.lines.isFull;n===i.lines.length-1?o?i.lines.recycle().copyFrom(r):i.lines.push(r.clone()):i.lines.splice(n+1,0,r.clone()),o?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let o=n-s+1;i.lines.shiftElements(s+1,o-1,-1),i.lines.set(n,r.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(t,e){let i=this.buffer;if(t<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else t+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let r=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+t,i.ybase),0),r!==i.ydisp&&(e||this._onScroll.fire(i.ydisp))}};Oh=wt([fe(0,wi)],Oh);var Kn={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Df,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},Ey=["normal","bold","100","200","300","400","500","600","700","800","900"],Dy=class extends Fe{constructor(t){super(),this._onOptionChange=this._register(new ue),this.onOptionChange=this._onOptionChange.event;let e={...Kn};for(let i in t)if(i in e)try{let r=t[i];e[i]=this._sanitizeAndValidateOption(i,r)}catch(r){console.error(r)}this.rawOptions=e,this.options={...e},this._setupOptions(),this._register(ut(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(t,e){return this.onOptionChange(i=>{i===t&&e(this.rawOptions[t])})}onMultipleOptionChange(t,e){return this.onOptionChange(i=>{t.indexOf(i)!==-1&&e()})}_setupOptions(){let t=i=>{if(!(i in Kn))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},e=(i,r)=>{if(!(i in Kn))throw new Error(`No option with key "${i}"`);r=this._sanitizeAndValidateOption(i,r),this.rawOptions[i]!==r&&(this.rawOptions[i]=r,this._onOptionChange.fire(i))};for(let i in this.rawOptions){let r={get:t.bind(this,i),set:e.bind(this,i)};Object.defineProperty(this.options,i,r)}}_sanitizeAndValidateOption(t,e){switch(t){case"cursorStyle":if(e||(e=Kn[t]),!My(e))throw new Error(`"${e}" is not a valid value for ${t}`);break;case"wordSeparator":e||(e=Kn[t]);break;case"fontWeight":case"fontWeightBold":if(typeof e=="number"&&1<=e&&e<=1e3)break;e=Ey.includes(e)?e:Kn[t];break;case"cursorWidth":e=Math.floor(e);case"lineHeight":case"tabStopWidth":if(e<1)throw new Error(`${t} cannot be less than 1, value: ${e}`);break;case"minimumContrastRatio":e=Math.max(1,Math.min(21,Math.round(e*10)/10));break;case"scrollback":if(e=Math.min(e,4294967295),e<0)throw new Error(`${t} cannot be less than 0, value: ${e}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(e<=0)throw new Error(`${t} cannot be less than or equal to 0, value: ${e}`);break;case"rows":case"cols":if(!e&&e!==0)throw new Error(`${t} must be numeric, value: ${e}`);break;case"windowsPty":e=e??{};break}return e}};function My(t){return t==="block"||t==="underline"||t==="bar"}function Zo(t,e=5){if(typeof t!="object")return t;let i=Array.isArray(t)?[]:{};for(let r in t)i[r]=e<=1?t[r]:t[r]&&Zo(t[r],e-1);return i}var Dp=Object.freeze({insertMode:!1}),Mp=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Ph=class extends Fe{constructor(t,e,i){super(),this._bufferService=t,this._logService=e,this._optionsService=i,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new ue),this.onData=this._onData.event,this._onUserInput=this._register(new ue),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ue),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ue),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Zo(Dp),this.decPrivateModes=Zo(Mp)}reset(){this.modes=Zo(Dp),this.decPrivateModes=Zo(Mp)}triggerDataEvent(t,e=!1){if(this._optionsService.rawOptions.disableStdin)return;let i=this._bufferService.buffer;e&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),e&&this._onUserInput.fire(),this._logService.debug(`sending data "${t}"`),this._logService.trace("sending data (codes)",()=>t.split("").map(r=>r.charCodeAt(0))),this._onData.fire(t)}triggerBinaryEvent(t){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${t}"`),this._logService.trace("sending binary (codes)",()=>t.split("").map(e=>e.charCodeAt(0))),this._onBinary.fire(t))}};Ph=wt([fe(0,yi),fe(1,x4),fe(2,wi)],Ph);var Tp={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:t=>t.button===4||t.action!==1?!1:(t.ctrl=!1,t.alt=!1,t.shift=!1,!0)},VT200:{events:19,restrict:t=>t.action!==32},DRAG:{events:23,restrict:t=>!(t.action===32&&t.button===3)},ANY:{events:31,restrict:t=>!0}};function Z0(t,e){let i=(t.ctrl?16:0)|(t.shift?4:0)|(t.alt?8:0);return t.button===4?(i|=64,i|=t.action):(i|=t.button&3,t.button&4&&(i|=64),t.button&8&&(i|=128),t.action===32?i|=32:t.action===0&&!e&&(i|=3)),i}var Q0=String.fromCharCode,Bp={DEFAULT:t=>{let e=[Z0(t,!1)+32,t.col+32,t.row+32];return e[0]>255||e[1]>255||e[2]>255?"":`\x1B[M${Q0(e[0])}${Q0(e[1])}${Q0(e[2])}`},SGR:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${Z0(t,!0)};${t.col};${t.row}${e}`},SGR_PIXELS:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${Z0(t,!0)};${t.x};${t.y}${e}`}},Fh=class extends Fe{constructor(t,e,i){super(),this._bufferService=t,this._coreService=e,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new ue),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(Tp))this.addProtocol(r,Tp[r]);for(let r of Object.keys(Bp))this.addEncoding(r,Bp[r]);this.reset()}addProtocol(t,e){this._protocols[t]=e}addEncoding(t,e){this._encodings[t]=e}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(t){if(!this._protocols[t])throw new Error(`unknown protocol "${t}"`);this._activeProtocol=t,this._onProtocolChange.fire(this._protocols[t].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(t){if(!this._encodings[t])throw new Error(`unknown encoding "${t}"`);this._activeEncoding=t}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(t,e,i){if(t.deltaY===0||t.shiftKey||e===void 0||i===void 0)return 0;let r=e/i,s=this._applyScrollModifier(t.deltaY,t);return t.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=r+0,Math.abs(t.deltaY)<50&&(s*=.3),this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(t,e){return e.altKey||e.ctrlKey||e.shiftKey?t*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:t*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(t){if(t.col<0||t.col>=this._bufferService.cols||t.row<0||t.row>=this._bufferService.rows||t.button===4&&t.action===32||t.button===3&&t.action!==32||t.button!==4&&(t.action===2||t.action===3)||(t.col++,t.row++,t.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,t,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(t))return!1;let e=this._encodings[this._activeEncoding](t);return e&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(e):this._coreService.triggerDataEvent(e,!0)),this._lastEvent=t,!0}explainEvents(t){return{down:!!(t&1),up:!!(t&2),drag:!!(t&4),move:!!(t&8),wheel:!!(t&16)}}_equalEvents(t,e,i){if(i){if(t.x!==e.x||t.y!==e.y)return!1}else if(t.col!==e.col||t.row!==e.row)return!1;return!(t.button!==e.button||t.action!==e.action||t.ctrl!==e.ctrl||t.alt!==e.alt||t.shift!==e.shift)}};Fh=wt([fe(0,yi),fe(1,Ln),fe(2,wi)],Fh);var ec=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],Ty=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],zt;function By(t,e){let i=0,r=e.length-1,s;if(t<e[0][0]||t>e[r][1])return!1;for(;r>=i;)if(s=i+r>>1,t>e[s][1])i=s+1;else if(t<e[s][0])r=s-1;else return!0;return!1}var Ry=class{constructor(){if(this.version="6",!zt){zt=new Uint8Array(65536),zt.fill(1),zt[0]=0,zt.fill(0,1,32),zt.fill(0,127,160),zt.fill(2,4352,4448),zt[9001]=2,zt[9002]=2,zt.fill(2,11904,42192),zt[12351]=1,zt.fill(2,44032,55204),zt.fill(2,63744,64256),zt.fill(2,65040,65050),zt.fill(2,65072,65136),zt.fill(2,65280,65377),zt.fill(2,65504,65511);for(let t=0;t<ec.length;++t)zt.fill(0,ec[t][0],ec[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?zt[t]:By(t,Ty)?0:t>=131072&&t<=196605||t>=196608&&t<=262141?2:1}charProperties(t,e){let i=this.wcwidth(t),r=i===0&&e!==0;if(r){let s=gn.extractWidth(e);s===0?r=!1:s>i&&(i=s)}return gn.createPropertyValue(0,i,r)}},gn=class uu{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ue,this.onChange=this._onChange.event;let e=new Ry;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!==0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,i,r=!1){return(e&16777215)<<3|(i&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let i=0,r=0,s=e.length;for(let n=0;n<s;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=s)return i+this.wcwidth(o);let u=e.charCodeAt(n);56320<=u&&u<=57343?o=(o-55296)*1024+u-56320+65536:i+=this.wcwidth(u)}let a=this.charProperties(o,r),l=uu.extractWidth(a);uu.extractShouldJoin(a)&&(l-=uu.extractWidth(r)),i+=l,r=a}return i}charProperties(e,i){return this._activeProvider.charProperties(e,i)}},Ny=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(t){this.glevel=t,this.charset=this._charsets[t]}setgCharset(t,e){this._charsets[t]=e,this.glevel===t&&(this.charset=e)}};function Rp(t){var r;let e=(r=t.buffer.lines.get(t.buffer.ybase+t.buffer.y-1))==null?void 0:r.get(t.cols-1),i=t.buffer.lines.get(t.buffer.ybase+t.buffer.y);i&&e&&(i.isWrapped=e[3]!==0&&e[3]!==32)}var zo=2147483647,Ly=256,rv=class Ih{constructor(e=32,i=32){if(this.maxLength=e,this.maxSubParamsLength=i,i>Ly)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(e){let i=new Ih;if(!e.length)return i;for(let r=Array.isArray(e[0])?1:0;r<e.length;++r){let s=e[r];if(Array.isArray(s))for(let n=0;n<s.length;++n)i.addSubParam(s[n]);else i.addParam(s)}return i}clone(){let e=new Ih(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){let e=[];for(let i=0;i<this.length;++i){e.push(this.params[i]);let r=this._subParamsIdx[i]>>8,s=this._subParamsIdx[i]&255;s-r>0&&e.push(Array.prototype.slice.call(this._subParams,r,s))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>zo?zo:e}addSubParam(e){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>zo?zo:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let i=this._subParamsIdx[e]>>8,r=this._subParamsIdx[e]&255;return r-i>0?this._subParams.subarray(i,r):null}getSubParamsAll(){let e={};for(let i=0;i<this.length;++i){let r=this._subParamsIdx[i]>>8,s=this._subParamsIdx[i]&255;s-r>0&&(e[i]=this._subParams.slice(r,s))}return e}addDigit(e){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,s=r[i-1];r[i-1]=~s?Math.min(s*10+e,zo):e}},jo=[],Oy=class{constructor(){this._state=0,this._active=jo,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(t,e){this._handlers[t]===void 0&&(this._handlers[t]=[]);let i=this._handlers[t];return i.push(e),{dispose:()=>{let r=i.indexOf(e);r!==-1&&i.splice(r,1)}}}clearHandler(t){this._handlers[t]&&delete this._handlers[t]}setHandlerFallback(t){this._handlerFb=t}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=jo}reset(){if(this._state===2)for(let t=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;t>=0;--t)this._active[t].end(!1);this._stack.paused=!1,this._active=jo,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||jo,!this._active.length)this._handlerFb(this._id,"START");else for(let t=this._active.length-1;t>=0;t--)this._active[t].start()}_put(t,e,i){if(!this._active.length)this._handlerFb(this._id,"PUT",i0(t,e,i));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(t,e,i)}start(){this.reset(),this._state=1}put(t,e,i){if(this._state!==3){if(this._state===1)for(;e<i;){let r=t[e++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&i-e>0&&this._put(t,e,i)}}end(t,e=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",t);else{let i=!1,r=this._active.length-1,s=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,i=e,s=this._stack.fallThrough,this._stack.paused=!1),!s&&i===!1){for(;r>=0&&(i=this._active[r].end(t),i!==!0);r--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,i;r--}for(;r>=0;r--)if(i=this._active[r].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,i}this._active=jo,this._id=-1,this._state=0}}},Fi=class{constructor(t){this._handler=t,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(t,e,i){this._hitLimit||(this._data+=i0(t,e,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(t){let e=!1;if(this._hitLimit)e=!1;else if(t&&(e=this._handler(this._data),e instanceof Promise))return e.then(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,e}},Ho=[],Py=class{constructor(){this._handlers=Object.create(null),this._active=Ho,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Ho}registerHandler(t,e){this._handlers[t]===void 0&&(this._handlers[t]=[]);let i=this._handlers[t];return i.push(e),{dispose:()=>{let r=i.indexOf(e);r!==-1&&i.splice(r,1)}}}clearHandler(t){this._handlers[t]&&delete this._handlers[t]}setHandlerFallback(t){this._handlerFb=t}reset(){if(this._active.length)for(let t=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;t>=0;--t)this._active[t].unhook(!1);this._stack.paused=!1,this._active=Ho,this._ident=0}hook(t,e){if(this.reset(),this._ident=t,this._active=this._handlers[t]||Ho,!this._active.length)this._handlerFb(this._ident,"HOOK",e);else for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(e)}put(t,e,i){if(!this._active.length)this._handlerFb(this._ident,"PUT",i0(t,e,i));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(t,e,i)}unhook(t,e=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",t);else{let i=!1,r=this._active.length-1,s=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,i=e,s=this._stack.fallThrough,this._stack.paused=!1),!s&&i===!1){for(;r>=0&&(i=this._active[r].unhook(t),i!==!0);r--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,i;r--}for(;r>=0;r--)if(i=this._active[r].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,i}this._active=Ho,this._ident=0}},Qo=new rv;Qo.addParam(0);var Np=class{constructor(t){this._handler=t,this._data="",this._params=Qo,this._hitLimit=!1}hook(t){this._params=t.length>1||t.params[0]?t.clone():Qo,this._data="",this._hitLimit=!1}put(t,e,i){this._hitLimit||(this._data+=i0(t,e,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(t){let e=!1;if(this._hitLimit)e=!1;else if(t&&(e=this._handler(this._data,this._params),e instanceof Promise))return e.then(i=>(this._params=Qo,this._data="",this._hitLimit=!1,i));return this._params=Qo,this._data="",this._hitLimit=!1,e}},Fy=class{constructor(t){this.table=new Uint8Array(t)}setDefault(t,e){this.table.fill(t<<4|e)}add(t,e,i,r){this.table[e<<8|t]=i<<4|r}addMany(t,e,i,r){for(let s=0;s<t.length;s++)this.table[e<<8|t[s]]=i<<4|r}},Qi=160,Iy=function(){let t=new Fy(4095),e=Array.apply(null,Array(256)).map((a,l)=>l),i=(a,l)=>e.slice(a,l),r=i(32,127),s=i(0,24);s.push(25),s.push.apply(s,i(28,32));let n=i(0,14),o;t.setDefault(1,0),t.addMany(r,0,2,0);for(o in n)t.addMany([24,26,153,154],o,3,0),t.addMany(i(128,144),o,3,0),t.addMany(i(144,152),o,3,0),t.add(156,o,0,0),t.add(27,o,11,1),t.add(157,o,4,8),t.addMany([152,158,159],o,0,7),t.add(155,o,11,3),t.add(144,o,11,9);return t.addMany(s,0,3,0),t.addMany(s,1,3,1),t.add(127,1,0,1),t.addMany(s,8,0,8),t.addMany(s,3,3,3),t.add(127,3,0,3),t.addMany(s,4,3,4),t.add(127,4,0,4),t.addMany(s,6,3,6),t.addMany(s,5,3,5),t.add(127,5,0,5),t.addMany(s,2,3,2),t.add(127,2,0,2),t.add(93,1,4,8),t.addMany(r,8,5,8),t.add(127,8,5,8),t.addMany([156,27,24,26,7],8,6,0),t.addMany(i(28,32),8,0,8),t.addMany([88,94,95],1,0,7),t.addMany(r,7,0,7),t.addMany(s,7,0,7),t.add(156,7,0,0),t.add(127,7,0,7),t.add(91,1,11,3),t.addMany(i(64,127),3,7,0),t.addMany(i(48,60),3,8,4),t.addMany([60,61,62,63],3,9,4),t.addMany(i(48,60),4,8,4),t.addMany(i(64,127),4,7,0),t.addMany([60,61,62,63],4,0,6),t.addMany(i(32,64),6,0,6),t.add(127,6,0,6),t.addMany(i(64,127),6,0,0),t.addMany(i(32,48),3,9,5),t.addMany(i(32,48),5,9,5),t.addMany(i(48,64),5,0,6),t.addMany(i(64,127),5,7,0),t.addMany(i(32,48),4,9,5),t.addMany(i(32,48),1,9,2),t.addMany(i(32,48),2,9,2),t.addMany(i(48,127),2,10,0),t.addMany(i(48,80),1,10,0),t.addMany(i(81,88),1,10,0),t.addMany([89,90,92],1,10,0),t.addMany(i(96,127),1,10,0),t.add(80,1,11,9),t.addMany(s,9,0,9),t.add(127,9,0,9),t.addMany(i(28,32),9,0,9),t.addMany(i(32,48),9,9,12),t.addMany(i(48,60),9,8,10),t.addMany([60,61,62,63],9,9,10),t.addMany(s,11,0,11),t.addMany(i(32,128),11,0,11),t.addMany(i(28,32),11,0,11),t.addMany(s,10,0,10),t.add(127,10,0,10),t.addMany(i(28,32),10,0,10),t.addMany(i(48,60),10,8,10),t.addMany([60,61,62,63],10,0,11),t.addMany(i(32,48),10,9,12),t.addMany(s,12,0,12),t.add(127,12,0,12),t.addMany(i(28,32),12,0,12),t.addMany(i(32,48),12,9,12),t.addMany(i(48,64),12,0,11),t.addMany(i(64,127),12,12,13),t.addMany(i(64,127),10,12,13),t.addMany(i(64,127),9,12,13),t.addMany(s,13,13,13),t.addMany(r,13,13,13),t.add(127,13,0,13),t.addMany([27,156,24,26],13,14,0),t.add(Qi,0,2,0),t.add(Qi,8,5,8),t.add(Qi,6,0,6),t.add(Qi,11,0,11),t.add(Qi,13,13,13),t}(),zy=class extends Fe{constructor(t=Iy){super(),this._transitions=t,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new rv,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,i,r)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,i)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(ut(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new Oy),this._dcsParser=this._register(new Py),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(t,e=[64,126]){let i=0;if(t.prefix){if(t.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=t.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(t.intermediates){if(t.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let s=0;s<t.intermediates.length;++s){let n=t.intermediates.charCodeAt(s);if(32>n||n>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=n}}if(t.final.length!==1)throw new Error("final must be a single byte");let r=t.final.charCodeAt(0);if(e[0]>r||r>e[1])throw new Error(`final must be in range ${e[0]} .. ${e[1]}`);return i<<=8,i|=r,i}identToString(t){let e=[];for(;t;)e.push(String.fromCharCode(t&255)),t>>=8;return e.reverse().join("")}setPrintHandler(t){this._printHandler=t}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(t,e){let i=this._identifier(t,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);let r=this._escHandlers[i];return r.push(e),{dispose:()=>{let s=r.indexOf(e);s!==-1&&r.splice(s,1)}}}clearEscHandler(t){this._escHandlers[this._identifier(t,[48,126])]&&delete this._escHandlers[this._identifier(t,[48,126])]}setEscHandlerFallback(t){this._escHandlerFb=t}setExecuteHandler(t,e){this._executeHandlers[t.charCodeAt(0)]=e}clearExecuteHandler(t){this._executeHandlers[t.charCodeAt(0)]&&delete this._executeHandlers[t.charCodeAt(0)]}setExecuteHandlerFallback(t){this._executeHandlerFb=t}registerCsiHandler(t,e){let i=this._identifier(t);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);let r=this._csiHandlers[i];return r.push(e),{dispose:()=>{let s=r.indexOf(e);s!==-1&&r.splice(s,1)}}}clearCsiHandler(t){this._csiHandlers[this._identifier(t)]&&delete this._csiHandlers[this._identifier(t)]}setCsiHandlerFallback(t){this._csiHandlerFb=t}registerDcsHandler(t,e){return this._dcsParser.registerHandler(this._identifier(t),e)}clearDcsHandler(t){this._dcsParser.clearHandler(this._identifier(t))}setDcsHandlerFallback(t){this._dcsParser.setHandlerFallback(t)}registerOscHandler(t,e){return this._oscParser.registerHandler(t,e)}clearOscHandler(t){this._oscParser.clearHandler(t)}setOscHandlerFallback(t){this._oscParser.setHandlerFallback(t)}setErrorHandler(t){this._errorHandler=t}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(t,e,i,r,s){this._parseStack.state=t,this._parseStack.handlers=e,this._parseStack.handlerPos=i,this._parseStack.transition=r,this._parseStack.chunkPos=s}parse(t,e,i){let r=0,s=0,n=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,n=this._parseStack.chunkPos+1;else{if(i===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let a=this._parseStack.handlers,l=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&l>-1){for(;l>=0&&(o=a[l](this._params),o!==!0);l--)if(o instanceof Promise)return this._parseStack.handlerPos=l,o}this._parseStack.handlers=[];break;case 4:if(i===!1&&l>-1){for(;l>=0&&(o=a[l](),o!==!0);l--)if(o instanceof Promise)return this._parseStack.handlerPos=l,o}this._parseStack.handlers=[];break;case 6:if(r=t[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,i),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=t[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,i),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,n=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let a=n;a<e;++a){switch(r=t[a],s=this._transitions.table[this.currentState<<8|(r<160?r:Qi)],s>>4){case 2:for(let d=a+1;;++d){if(d>=e||(r=t[d])<32||r>126&&r<Qi){this._printHandler(t,a,d),a=d-1;break}if(++d>=e||(r=t[d])<32||r>126&&r<Qi){this._printHandler(t,a,d),a=d-1;break}if(++d>=e||(r=t[d])<32||r>126&&r<Qi){this._printHandler(t,a,d),a=d-1;break}if(++d>=e||(r=t[d])<32||r>126&&r<Qi){this._printHandler(t,a,d),a=d-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:a,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let l=this._csiHandlers[this._collect<<8|r],u=l?l.length-1:-1;for(;u>=0&&(o=l[u](this._params),o!==!0);u--)if(o instanceof Promise)return this._preserveStack(3,l,u,s,a),o;u<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++a<e&&(r=t[a])>47&&r<60);a--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],h=c?c.length-1:-1;for(;h>=0&&(o=c[h](),o!==!0);h--)if(o instanceof Promise)return this._preserveStack(4,c,h,s,a),o;h<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let d=a+1;;++d)if(d>=e||(r=t[d])===24||r===26||r===27||r>127&&r<Qi){this._dcsParser.put(t,a,d),a=d-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,s,a),o;r===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let d=a+1;;d++)if(d>=e||(r=t[d])<32||r>127&&r<Qi){this._oscParser.put(t,a,d),a=d-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,s,a),o;r===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=s&15}}},jy=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,Hy=/^[\da-f]+$/;function Lp(t){if(!t)return;let e=t.toLowerCase();if(e.indexOf("rgb:")===0){e=e.slice(4);let i=jy.exec(e);if(i){let r=i[1]?15:i[4]?255:i[7]?4095:65535;return[Math.round(parseInt(i[1]||i[4]||i[7]||i[10],16)/r*255),Math.round(parseInt(i[2]||i[5]||i[8]||i[11],16)/r*255),Math.round(parseInt(i[3]||i[6]||i[9]||i[12],16)/r*255)]}}else if(e.indexOf("#")===0&&(e=e.slice(1),Hy.exec(e)&&[3,6,9,12].includes(e.length))){let i=e.length/3,r=[0,0,0];for(let s=0;s<3;++s){let n=parseInt(e.slice(i*s,i*s+i),16);r[s]=i===1?n<<4:i===2?n:i===3?n>>4:n>>8}return r}}function tc(t,e){let i=t.toString(16),r=i.length<2?"0"+i:i;switch(e){case 4:return i[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function $y(t,e=16){let[i,r,s]=t;return`rgb:${tc(i,e)}/${tc(r,e)}/${tc(s,e)}`}var qy={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ks=131072,Op=10;function Pp(t,e){if(t>24)return e.setWinLines||!1;switch(t){case 1:return!!e.restoreWin;case 2:return!!e.minimizeWin;case 3:return!!e.setWinPosition;case 4:return!!e.setWinSizePixels;case 5:return!!e.raiseWin;case 6:return!!e.lowerWin;case 7:return!!e.refreshWin;case 8:return!!e.setWinSizeChars;case 9:return!!e.maximizeWin;case 10:return!!e.fullscreenWin;case 11:return!!e.getWinState;case 13:return!!e.getWinPosition;case 14:return!!e.getWinSizePixels;case 15:return!!e.getScreenSizePixels;case 16:return!!e.getCellSizePixels;case 18:return!!e.getWinSizeChars;case 19:return!!e.getScreenSizeChars;case 20:return!!e.getIconTitle;case 21:return!!e.getWinTitle;case 22:return!!e.pushTitle;case 23:return!!e.popTitle;case 24:return!!e.setWinLines}return!1}var Fp=5e3,Ip=0,Wy=class extends Fe{constructor(t,e,i,r,s,n,o,a,l=new zy){super(),this._bufferService=t,this._charsetService=e,this._coreService=i,this._logService=r,this._optionsService=s,this._oscLinkService=n,this._coreMouseService=o,this._unicodeService=a,this._parser=l,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new u_,this._utf8Decoder=new c_,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Dt.clone(),this._eraseAttrDataInternal=Dt.clone(),this._onRequestBell=this._register(new ue),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ue),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ue),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ue),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ue),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ue),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ue),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ue),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ue),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ue),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ue),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ue),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ue),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new zh(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(u=>this._activeBuffer=u.activeBuffer)),this._parser.setCsiHandlerFallback((u,c)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(u),params:c.toArray()})}),this._parser.setEscHandlerFallback(u=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(u)})}),this._parser.setExecuteHandlerFallback(u=>{this._logService.debug("Unknown EXECUTE code: ",{code:u})}),this._parser.setOscHandlerFallback((u,c,h)=>{this._logService.debug("Unknown OSC code: ",{identifier:u,action:c,data:h})}),this._parser.setDcsHandlerFallback((u,c,h)=>{c==="HOOK"&&(h=h.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(u),action:c,payload:h})}),this._parser.setPrintHandler((u,c,h)=>this.print(u,c,h)),this._parser.registerCsiHandler({final:"@"},u=>this.insertChars(u)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},u=>this.scrollLeft(u)),this._parser.registerCsiHandler({final:"A"},u=>this.cursorUp(u)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},u=>this.scrollRight(u)),this._parser.registerCsiHandler({final:"B"},u=>this.cursorDown(u)),this._parser.registerCsiHandler({final:"C"},u=>this.cursorForward(u)),this._parser.registerCsiHandler({final:"D"},u=>this.cursorBackward(u)),this._parser.registerCsiHandler({final:"E"},u=>this.cursorNextLine(u)),this._parser.registerCsiHandler({final:"F"},u=>this.cursorPrecedingLine(u)),this._parser.registerCsiHandler({final:"G"},u=>this.cursorCharAbsolute(u)),this._parser.registerCsiHandler({final:"H"},u=>this.cursorPosition(u)),this._parser.registerCsiHandler({final:"I"},u=>this.cursorForwardTab(u)),this._parser.registerCsiHandler({final:"J"},u=>this.eraseInDisplay(u,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},u=>this.eraseInDisplay(u,!0)),this._parser.registerCsiHandler({final:"K"},u=>this.eraseInLine(u,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},u=>this.eraseInLine(u,!0)),this._parser.registerCsiHandler({final:"L"},u=>this.insertLines(u)),this._parser.registerCsiHandler({final:"M"},u=>this.deleteLines(u)),this._parser.registerCsiHandler({final:"P"},u=>this.deleteChars(u)),this._parser.registerCsiHandler({final:"S"},u=>this.scrollUp(u)),this._parser.registerCsiHandler({final:"T"},u=>this.scrollDown(u)),this._parser.registerCsiHandler({final:"X"},u=>this.eraseChars(u)),this._parser.registerCsiHandler({final:"Z"},u=>this.cursorBackwardTab(u)),this._parser.registerCsiHandler({final:"`"},u=>this.charPosAbsolute(u)),this._parser.registerCsiHandler({final:"a"},u=>this.hPositionRelative(u)),this._parser.registerCsiHandler({final:"b"},u=>this.repeatPrecedingCharacter(u)),this._parser.registerCsiHandler({final:"c"},u=>this.sendDeviceAttributesPrimary(u)),this._parser.registerCsiHandler({prefix:">",final:"c"},u=>this.sendDeviceAttributesSecondary(u)),this._parser.registerCsiHandler({final:"d"},u=>this.linePosAbsolute(u)),this._parser.registerCsiHandler({final:"e"},u=>this.vPositionRelative(u)),this._parser.registerCsiHandler({final:"f"},u=>this.hVPosition(u)),this._parser.registerCsiHandler({final:"g"},u=>this.tabClear(u)),this._parser.registerCsiHandler({final:"h"},u=>this.setMode(u)),this._parser.registerCsiHandler({prefix:"?",final:"h"},u=>this.setModePrivate(u)),this._parser.registerCsiHandler({final:"l"},u=>this.resetMode(u)),this._parser.registerCsiHandler({prefix:"?",final:"l"},u=>this.resetModePrivate(u)),this._parser.registerCsiHandler({final:"m"},u=>this.charAttributes(u)),this._parser.registerCsiHandler({final:"n"},u=>this.deviceStatus(u)),this._parser.registerCsiHandler({prefix:"?",final:"n"},u=>this.deviceStatusPrivate(u)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},u=>this.softReset(u)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},u=>this.setCursorStyle(u)),this._parser.registerCsiHandler({final:"r"},u=>this.setScrollRegion(u)),this._parser.registerCsiHandler({final:"s"},u=>this.saveCursor(u)),this._parser.registerCsiHandler({final:"t"},u=>this.windowOptions(u)),this._parser.registerCsiHandler({final:"u"},u=>this.restoreCursor(u)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},u=>this.insertColumns(u)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},u=>this.deleteColumns(u)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},u=>this.selectProtected(u)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},u=>this.requestMode(u,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},u=>this.requestMode(u,!1)),this._parser.setExecuteHandler(Z.BEL,()=>this.bell()),this._parser.setExecuteHandler(Z.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Z.BS,()=>this.backspace()),this._parser.setExecuteHandler(Z.HT,()=>this.tab()),this._parser.setExecuteHandler(Z.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Z.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(au.IND,()=>this.index()),this._parser.setExecuteHandler(au.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(au.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Fi(u=>(this.setTitle(u),this.setIconName(u),!0))),this._parser.registerOscHandler(1,new Fi(u=>this.setIconName(u))),this._parser.registerOscHandler(2,new Fi(u=>this.setTitle(u))),this._parser.registerOscHandler(4,new Fi(u=>this.setOrReportIndexedColor(u))),this._parser.registerOscHandler(8,new Fi(u=>this.setHyperlink(u))),this._parser.registerOscHandler(10,new Fi(u=>this.setOrReportFgColor(u))),this._parser.registerOscHandler(11,new Fi(u=>this.setOrReportBgColor(u))),this._parser.registerOscHandler(12,new Fi(u=>this.setOrReportCursorColor(u))),this._parser.registerOscHandler(104,new Fi(u=>this.restoreIndexedColor(u))),this._parser.registerOscHandler(110,new Fi(u=>this.restoreFgColor(u))),this._parser.registerOscHandler(111,new Fi(u=>this.restoreBgColor(u))),this._parser.registerOscHandler(112,new Fi(u=>this.restoreCursorColor(u))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let u in Ht)this._parser.registerEscHandler({intermediates:"(",final:u},()=>this.selectCharset("("+u)),this._parser.registerEscHandler({intermediates:")",final:u},()=>this.selectCharset(")"+u)),this._parser.registerEscHandler({intermediates:"*",final:u},()=>this.selectCharset("*"+u)),this._parser.registerEscHandler({intermediates:"+",final:u},()=>this.selectCharset("+"+u)),this._parser.registerEscHandler({intermediates:"-",final:u},()=>this.selectCharset("-"+u)),this._parser.registerEscHandler({intermediates:".",final:u},()=>this.selectCharset("."+u)),this._parser.registerEscHandler({intermediates:"/",final:u},()=>this.selectCharset("/"+u));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(u=>(this._logService.error("Parsing error: ",u),u)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Np((u,c)=>this.requestStatusString(u,c)))}getAttrData(){return this._curAttrData}_preserveStack(t,e,i,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=t,this._parseStack.cursorStartY=e,this._parseStack.decodedLength=i,this._parseStack.position=r}_logSlowResolvingAsync(t){this._logService.logLevel<=3&&Promise.race([t,new Promise((e,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),Fp))]).catch(e=>{if(e!=="#SLOW_TIMEOUT")throw e;console.warn(`async parser handler taking longer than ${Fp} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(t,e){let i,r=this._activeBuffer.x,s=this._activeBuffer.y,n=0,o=this._parseStack.paused;if(o){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,e))return this._logSlowResolvingAsync(i),i;r=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,t.length>ks&&(n=this._parseStack.position+ks)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof t=="string"?` "${t}"`:` "${Array.prototype.map.call(t,u=>String.fromCharCode(u)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof t=="string"?t.split("").map(u=>u.charCodeAt(0)):t),this._parseBuffer.length<t.length&&this._parseBuffer.length<ks&&(this._parseBuffer=new Uint32Array(Math.min(t.length,ks))),o||this._dirtyRowTracker.clearRange(),t.length>ks)for(let u=n;u<t.length;u+=ks){let c=u+ks<t.length?u+ks:t.length,h=typeof t=="string"?this._stringDecoder.decode(t.substring(u,c),this._parseBuffer):this._utf8Decoder.decode(t.subarray(u,c),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,h))return this._preserveStack(r,s,h,u),this._logSlowResolvingAsync(i),i}else if(!o){let u=typeof t=="string"?this._stringDecoder.decode(t,this._parseBuffer):this._utf8Decoder.decode(t,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,u))return this._preserveStack(r,s,u,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==r||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),l=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);l<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(l,this._bufferService.rows-1),end:Math.min(a,this._bufferService.rows-1)})}print(t,e,i){let r,s,n=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,l=this._coreService.decPrivateModes.wraparound,u=this._coreService.modes.insertMode,c=this._curAttrData,h=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-e>0&&h.getWidth(this._activeBuffer.x-1)===2&&h.setCellFromCodepoint(this._activeBuffer.x-1,0,1,c);let d=this._parser.precedingJoinState;for(let f=e;f<i;++f){if(r=t[f],r<127&&n){let w=n[String.fromCharCode(r)];w&&(r=w.charCodeAt(0))}let p=this._unicodeService.charProperties(r,d);s=gn.extractWidth(p);let v=gn.extractShouldJoin(p),_=v?gn.extractWidth(d):0;if(d=p,o&&this._onA11yChar.fire(Es(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-_>a){if(l){let w=h,x=this._activeBuffer.x-_;for(this._activeBuffer.x=_,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),h=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),_>0&&h instanceof Jo&&h.copyCellsFrom(w,x,0,_,!1);x<a;)w.setCellFromCodepoint(x++,0,1,c)}else if(this._activeBuffer.x=a-1,s===2)continue}if(v&&this._activeBuffer.x){let w=h.getWidth(this._activeBuffer.x-1)?1:2;h.addCodepointToCell(this._activeBuffer.x-w,r,s);for(let x=s-_;--x>=0;)h.setCellFromCodepoint(this._activeBuffer.x++,0,0,c);continue}if(u&&(h.insertCells(this._activeBuffer.x,s-_,this._activeBuffer.getNullCell(c)),h.getWidth(a-1)===2&&h.setCellFromCodepoint(a-1,0,1,c)),h.setCellFromCodepoint(this._activeBuffer.x++,r,s,c),s>0)for(;--s;)h.setCellFromCodepoint(this._activeBuffer.x++,0,0,c)}this._parser.precedingJoinState=d,this._activeBuffer.x<a&&i-e>0&&h.getWidth(this._activeBuffer.x)===0&&!h.hasContent(this._activeBuffer.x)&&h.setCellFromCodepoint(this._activeBuffer.x,0,1,c),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(t,e){return t.final==="t"&&!t.prefix&&!t.intermediates?this._parser.registerCsiHandler(t,i=>Pp(i.params[0],this._optionsService.rawOptions.windowOptions)?e(i):!0):this._parser.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._parser.registerDcsHandler(t,new Np(e))}registerEscHandler(t,e){return this._parser.registerEscHandler(t,e)}registerOscHandler(t,e){return this._parser.registerOscHandler(t,new Fi(e))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var t;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&t.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-t),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(t=this._bufferService.cols-1){this._activeBuffer.x=Math.min(t,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(t,e){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=t,this._activeBuffer.y=this._activeBuffer.scrollTop+e):(this._activeBuffer.x=t,this._activeBuffer.y=e),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(t,e){this._restrictCursor(),this._setCursor(this._activeBuffer.x+t,this._activeBuffer.y+e)}cursorUp(t){let e=this._activeBuffer.y-this._activeBuffer.scrollTop;return e>=0?this._moveCursor(0,-Math.min(e,t.params[0]||1)):this._moveCursor(0,-(t.params[0]||1)),!0}cursorDown(t){let e=this._activeBuffer.scrollBottom-this._activeBuffer.y;return e>=0?this._moveCursor(0,Math.min(e,t.params[0]||1)):this._moveCursor(0,t.params[0]||1),!0}cursorForward(t){return this._moveCursor(t.params[0]||1,0),!0}cursorBackward(t){return this._moveCursor(-(t.params[0]||1),0),!0}cursorNextLine(t){return this.cursorDown(t),this._activeBuffer.x=0,!0}cursorPrecedingLine(t){return this.cursorUp(t),this._activeBuffer.x=0,!0}cursorCharAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(t){return this._setCursor(t.length>=2?(t.params[1]||1)-1:0,(t.params[0]||1)-1),!0}charPosAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(t){return this._moveCursor(t.params[0]||1,0),!0}linePosAbsolute(t){return this._setCursor(this._activeBuffer.x,(t.params[0]||1)-1),!0}vPositionRelative(t){return this._moveCursor(0,t.params[0]||1),!0}hVPosition(t){return this.cursorPosition(t),!0}tabClear(t){let e=t.params[0];return e===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:e===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=t.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=t.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(t){let e=t.params[0];return e===1&&(this._curAttrData.bg|=536870912),(e===2||e===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(t,e,i,r=!1,s=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);n.replaceCells(e,i,this._activeBuffer.getNullCell(this._eraseAttrData()),s),r&&(n.isWrapped=!1)}_resetBufferLine(t,e=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),e),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+t),i.isWrapped=!1)}eraseInDisplay(t,e=!1){var r;this._restrictCursor(this._bufferService.cols);let i;switch(t.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);i<this._bufferService.rows;i++)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,e),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!((r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i))!=null&&r.getTrimmedLength()););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(0)}break;case 3:let s=this._activeBuffer.lines.length-this._bufferService.rows;s>0&&(this._activeBuffer.lines.trimStart(s),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-s,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-s,0),this._onScroll.fire(0));break}return!0}eraseInLine(t,e=!1){switch(this._restrictCursor(this._bufferService.cols),t.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,e);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,e);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(t){this._restrictCursor();let e=t.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;e--;)this._activeBuffer.lines.splice(s-1,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(t){this._restrictCursor();let e=t.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;e--;)this._activeBuffer.lines.splice(i,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.insertCells(this._activeBuffer.x,t.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.deleteCells(this._activeBuffer.x,t.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(t){let e=t.params[0]||1;for(;e--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(t){let e=t.params[0]||1;for(;e--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Dt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.deleteCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.insertCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.insertCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.deleteCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(t.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(t){let e=this._parser.precedingJoinState;if(!e)return!0;let i=t.params[0]||1,r=gn.extractWidth(e),s=this._activeBuffer.x-r,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),o=new Uint32Array(n.length*i),a=0;for(let u=0;u<n.length;){let c=n.codePointAt(u)||0;o[a++]=c,u+=c>65535?2:1}let l=a;for(let u=1;u<i;++u)o.copyWithin(l,0,a),l+=a;return this.print(o,0,l),!0}sendDeviceAttributesPrimary(t){return t.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(Z.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(Z.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(t){return t.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(Z.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(Z.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(t.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(Z.ESC+"[>83;40003;0c")),!0}_is(t){return(this._optionsService.rawOptions.termName+"").indexOf(t)===0}setMode(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,dn),this._charsetService.setgCharset(1,dn),this._charsetService.setgCharset(2,dn),this._charsetService.setgCharset(3,dn);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),t.params[e]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(t,e){(v=>(v[v.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",v[v.SET=1]="SET",v[v.RESET=2]="RESET",v[v.PERMANENTLY_SET=3]="PERMANENTLY_SET",v[v.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(i={}));let r=this._coreService.decPrivateModes,{activeProtocol:s,activeEncoding:n}=this._coreMouseService,o=this._coreService,{buffers:a,cols:l}=this._bufferService,{active:u,alt:c}=a,h=this._optionsService.rawOptions,d=(v,_)=>(o.triggerDataEvent(`${Z.ESC}[${e?"":"?"}${v};${_}$y`),!0),f=v=>v?1:2,p=t.params[0];return e?p===2?d(p,4):p===4?d(p,f(o.modes.insertMode)):p===12?d(p,3):p===20?d(p,f(h.convertEol)):d(p,0):p===1?d(p,f(r.applicationCursorKeys)):p===3?d(p,h.windowOptions.setWinLines?l===80?2:l===132?1:0:0):p===6?d(p,f(r.origin)):p===7?d(p,f(r.wraparound)):p===8?d(p,3):p===9?d(p,f(s==="X10")):p===12?d(p,f(h.cursorBlink)):p===25?d(p,f(!o.isCursorHidden)):p===45?d(p,f(r.reverseWraparound)):p===66?d(p,f(r.applicationKeypad)):p===67?d(p,4):p===1e3?d(p,f(s==="VT200")):p===1002?d(p,f(s==="DRAG")):p===1003?d(p,f(s==="ANY")):p===1004?d(p,f(r.sendFocus)):p===1005?d(p,4):p===1006?d(p,f(n==="SGR")):p===1015?d(p,4):p===1016?d(p,f(n==="SGR_PIXELS")):p===1048?d(p,1):p===47||p===1047||p===1049?d(p,f(u===c)):p===2004?d(p,f(r.bracketedPasteMode)):p===2026?d(p,f(r.synchronizedOutput)):d(p,0)}_updateAttrColor(t,e,i,r,s){return e===2?(t|=50331648,t&=-16777216,t|=Wa.fromColorRGB([i,r,s])):e===5&&(t&=-50331904,t|=33554432|i&255),t}_extractColor(t,e,i){let r=[0,0,-1,0,0,0],s=0,n=0;do{if(r[n+s]=t.params[e+n],t.hasSubParams(e+n)){let o=t.getSubParams(e+n),a=0;do r[1]===5&&(s=1),r[n+a+1+s]=o[a];while(++a<o.length&&a+n+1+s<r.length);break}if(r[1]===5&&n+s>=2||r[1]===2&&n+s>=5)break;r[1]&&(s=1)}while(++n+e<t.length&&n+s<r.length);for(let o=2;o<r.length;++o)r[o]===-1&&(r[o]=0);switch(r[0]){case 38:i.fg=this._updateAttrColor(i.fg,r[1],r[3],r[4],r[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,r[1],r[3],r[4],r[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,r[1],r[3],r[4],r[5])}return n}_processUnderline(t,e){e.extended=e.extended.clone(),(!~t||t>5)&&(t=1),e.extended.underlineStyle=t,e.fg|=268435456,t===0&&(e.fg&=-268435457),e.updateExtended()}_processSGR0(t){t.fg=Dt.fg,t.bg=Dt.bg,t.extended=t.extended.clone(),t.extended.underlineStyle=0,t.extended.underlineColor&=-67108864,t.updateExtended()}charAttributes(t){if(t.length===1&&t.params[0]===0)return this._processSGR0(this._curAttrData),!0;let e=t.length,i,r=this._curAttrData;for(let s=0;s<e;s++)i=t.params[s],i>=30&&i<=37?(r.fg&=-50331904,r.fg|=16777216|i-30):i>=40&&i<=47?(r.bg&=-50331904,r.bg|=16777216|i-40):i>=90&&i<=97?(r.fg&=-50331904,r.fg|=16777216|i-90|8):i>=100&&i<=107?(r.bg&=-50331904,r.bg|=16777216|i-100|8):i===0?this._processSGR0(r):i===1?r.fg|=134217728:i===3?r.bg|=67108864:i===4?(r.fg|=268435456,this._processUnderline(t.hasSubParams(s)?t.getSubParams(s)[0]:1,r)):i===5?r.fg|=536870912:i===7?r.fg|=67108864:i===8?r.fg|=1073741824:i===9?r.fg|=2147483648:i===2?r.bg|=134217728:i===21?this._processUnderline(2,r):i===22?(r.fg&=-134217729,r.bg&=-134217729):i===23?r.bg&=-67108865:i===24?(r.fg&=-268435457,this._processUnderline(0,r)):i===25?r.fg&=-536870913:i===27?r.fg&=-67108865:i===28?r.fg&=-1073741825:i===29?r.fg&=2147483647:i===39?(r.fg&=-67108864,r.fg|=Dt.fg&16777215):i===49?(r.bg&=-67108864,r.bg|=Dt.bg&16777215):i===38||i===48||i===58?s+=this._extractColor(t,s,r):i===53?r.bg|=1073741824:i===55?r.bg&=-1073741825:i===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):i===100?(r.fg&=-67108864,r.fg|=Dt.fg&16777215,r.bg&=-67108864,r.bg|=Dt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(t){switch(t.params[0]){case 5:this._coreService.triggerDataEvent(`${Z.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Z.ESC}[${e};${i}R`);break}return!0}deviceStatusPrivate(t){switch(t.params[0]){case 6:let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Z.ESC}[?${e};${i}R`);break}return!0}softReset(t){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Dt.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(t){let e=t.length===0?1:t.params[0];if(e===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(e){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let i=e%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(t){let e=t.params[0]||1,i;return(t.length<2||(i=t.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>e&&(this._activeBuffer.scrollTop=e-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(t){if(!Pp(t.params[0],this._optionsService.rawOptions.windowOptions))return!0;let e=t.length>1?t.params[1]:0;switch(t.params[0]){case 14:e!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${Z.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(e===0||e===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Op&&this._windowTitleStack.shift()),(e===0||e===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Op&&this._iconNameStack.shift());break;case 23:(e===0||e===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(e===0||e===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(t){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(t){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(t){return this._windowTitle=t,this._onTitleChange.fire(t),!0}setIconName(t){return this._iconName=t,!0}setOrReportIndexedColor(t){let e=[],i=t.split(";");for(;i.length>1;){let r=i.shift(),s=i.shift();if(/^\d+$/.exec(r)){let n=parseInt(r);if(zp(n))if(s==="?")e.push({type:0,index:n});else{let o=Lp(s);o&&e.push({type:1,index:n,color:o})}}}return e.length&&this._onColor.fire(e),!0}setHyperlink(t){let e=t.indexOf(";");if(e===-1)return!0;let i=t.slice(0,e).trim(),r=t.slice(e+1);return r?this._createHyperlink(i,r):i.trim()?!1:this._finishHyperlink()}_createHyperlink(t,e){this._getCurrentLinkId()&&this._finishHyperlink();let i=t.split(":"),r,s=i.findIndex(n=>n.startsWith("id="));return s!==-1&&(r=i[s].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:e}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(t,e){let i=t.split(";");for(let r=0;r<i.length&&!(e>=this._specialColors.length);++r,++e)if(i[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[e]}]);else{let s=Lp(i[r]);s&&this._onColor.fire([{type:1,index:this._specialColors[e],color:s}])}return!0}setOrReportFgColor(t){return this._setOrReportSpecialColor(t,0)}setOrReportBgColor(t){return this._setOrReportSpecialColor(t,1)}setOrReportCursorColor(t){return this._setOrReportSpecialColor(t,2)}restoreIndexedColor(t){if(!t)return this._onColor.fire([{type:2}]),!0;let e=[],i=t.split(";");for(let r=0;r<i.length;++r)if(/^\d+$/.exec(i[r])){let s=parseInt(i[r]);zp(s)&&e.push({type:2,index:s})}return e.length&&this._onColor.fire(e),!0}restoreFgColor(t){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(t){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(t){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,dn),!0}selectCharset(t){return t.length!==2?(this.selectDefaultCharset(),!0):(t[0]==="/"||this._charsetService.setgCharset(qy[t[0]],Ht[t[1]]||dn),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let t=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,t,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=Dt.clone(),this._eraseAttrDataInternal=Dt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(t){return this._charsetService.setgLevel(t),!0}screenAlignmentPattern(){let t=new rr;t.content=1<<22|69,t.fg=this._curAttrData.fg,t.bg=this._curAttrData.bg,this._setCursor(0,0);for(let e=0;e<this._bufferService.rows;++e){let i=this._activeBuffer.ybase+this._activeBuffer.y+e,r=this._activeBuffer.lines.get(i);r&&(r.fill(t),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(t,e){let i=o=>(this._coreService.triggerDataEvent(`${Z.ESC}${o}${Z.ESC}\\`),!0),r=this._bufferService.buffer,s=this._optionsService.rawOptions;return i(t==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:t==='"p'?'P1$r61;1"p':t==="r"?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:t==="m"?"P1$r0m":t===" q"?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(t,e){this._dirtyRowTracker.markRangeDirty(t,e)}},zh=class{constructor(t){this._bufferService=t,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(t){t<this.start?this.start=t:t>this.end&&(this.end=t)}markRangeDirty(t,e){t>e&&(Ip=t,t=e,e=Ip),t<this.start&&(this.start=t),e>this.end&&(this.end=e)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};zh=wt([fe(0,yi)],zh);function zp(t){return 0<=t&&t<256}var Ky=5e7,jp=12,Vy=50,Uy=class extends Fe{constructor(t){super(),this._action=t,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new ue),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(t,e){if(e!==void 0&&this._syncCalls>e){this._syncCalls=0;return}if(this._pendingData+=t.length,this._writeBuffer.push(t),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let i;for(;i=this._writeBuffer.shift();){this._action(i);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(t,e){if(this._pendingData>Ky)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=t.length,this._writeBuffer.push(t),this._callbacks.push(e),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=t.length,this._writeBuffer.push(t),this._callbacks.push(e)}_innerWrite(t=0,e=!0){let i=t||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],s=this._action(r,e);if(s){let o=a=>performance.now()-i>=jp?setTimeout(()=>this._innerWrite(0,a)):this._innerWrite(i,a);s.catch(a=>(queueMicrotask(()=>{throw a}),Promise.resolve(!1))).then(o);return}let n=this._callbacks[this._bufferOffset];if(n&&n(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-i>=jp)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>Vy&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},jh=class{constructor(t){this._bufferService=t,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(t){let e=this._bufferService.buffer;if(t.id===void 0){let a=e.addMarker(e.ybase+e.y),l={data:t,id:this._nextId++,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(l,a)),this._dataByLinkId.set(l.id,l),l.id}let i=t,r=this._getEntryIdKey(i),s=this._entriesWithId.get(r);if(s)return this.addLineToLink(s.id,e.ybase+e.y),s.id;let n=e.addMarker(e.ybase+e.y),o={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(o,n)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(t,e){let i=this._dataByLinkId.get(t);if(i&&i.lines.every(r=>r.line!==e)){let r=this._bufferService.buffer.addMarker(e);i.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(i,r))}}getLinkData(t){var e;return(e=this._dataByLinkId.get(t))==null?void 0:e.data}_getEntryIdKey(t){return`${t.id};;${t.uri}`}_removeMarkerFromLink(t,e){let i=t.lines.indexOf(e);i!==-1&&(t.lines.splice(i,1),t.lines.length===0&&(t.data.id!==void 0&&this._entriesWithId.delete(t.key),this._dataByLinkId.delete(t.id)))}};jh=wt([fe(0,yi)],jh);var Hp=!1,Gy=class extends Fe{constructor(t){super(),this._windowsWrappingHeuristics=this._register(new co),this._onBinary=this._register(new ue),this.onBinary=this._onBinary.event,this._onData=this._register(new ue),this.onData=this._onData.event,this._onLineFeed=this._register(new ue),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ue),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ue),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ue),this._instantiationService=new by,this.optionsService=this._register(new Dy(t)),this._instantiationService.setService(wi,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Oh)),this._instantiationService.setService(yi,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Lh)),this._instantiationService.setService(x4,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Ph)),this._instantiationService.setService(Ln,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Fh)),this._instantiationService.setService(w4,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(gn)),this._instantiationService.setService(p_,this.unicodeService),this._charsetService=this._instantiationService.createInstance(Ny),this._instantiationService.setService(f_,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(jh),this._instantiationService.setService(S4,this._oscLinkService),this._inputHandler=this._register(new Wy(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(si.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(si.forward(this._bufferService.onResize,this._onResize)),this._register(si.forward(this.coreService.onData,this._onData)),this._register(si.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new Uy((e,i)=>this._inputHandler.parse(e,i))),this._register(si.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ue),this._onScroll.event(t=>{var e;(e=this._onScrollApi)==null||e.fire(t.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(t){for(let e in t)this.optionsService.options[e]=t[e]}write(t,e){this._writeBuffer.write(t,e)}writeSync(t,e){this._logService.logLevel<=3&&!Hp&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Hp=!0),this._writeBuffer.writeSync(t,e)}input(t,e=!0){this.coreService.triggerDataEvent(t,e)}resize(t,e){isNaN(t)||isNaN(e)||(t=Math.max(t,tv),e=Math.max(e,iv),this._bufferService.resize(t,e))}scroll(t,e=!1){this._bufferService.scroll(t,e)}scrollLines(t,e){this._bufferService.scrollLines(t,e)}scrollPages(t){this.scrollLines(t*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(t){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(t){let e=t-this._bufferService.buffer.ydisp;e!==0&&this.scrollLines(e)}registerEscHandler(t,e){return this._inputHandler.registerEscHandler(t,e)}registerDcsHandler(t,e){return this._inputHandler.registerDcsHandler(t,e)}registerCsiHandler(t,e){return this._inputHandler.registerCsiHandler(t,e)}registerOscHandler(t,e){return this._inputHandler.registerOscHandler(t,e)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let t=!1,e=this.optionsService.rawOptions.windowsPty;e&&e.buildNumber!==void 0&&e.buildNumber!==void 0?t=e.backend==="conpty"&&e.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(t=!0),t?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let t=[];t.push(this.onLineFeed(Rp.bind(null,this._bufferService))),t.push(this.registerCsiHandler({final:"H"},()=>(Rp(this._bufferService),!1))),this._windowsWrappingHeuristics.value=ut(()=>{for(let e of t)e.dispose()})}}},Yy={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function Xy(t,e,i,r){var o;let s={type:0,cancel:!1,key:void 0},n=(t.shiftKey?1:0)|(t.altKey?2:0)|(t.ctrlKey?4:0)|(t.metaKey?8:0);switch(t.keyCode){case 0:t.key==="UIKeyInputUpArrow"?e?s.key=Z.ESC+"OA":s.key=Z.ESC+"[A":t.key==="UIKeyInputLeftArrow"?e?s.key=Z.ESC+"OD":s.key=Z.ESC+"[D":t.key==="UIKeyInputRightArrow"?e?s.key=Z.ESC+"OC":s.key=Z.ESC+"[C":t.key==="UIKeyInputDownArrow"&&(e?s.key=Z.ESC+"OB":s.key=Z.ESC+"[B");break;case 8:s.key=t.ctrlKey?"\b":Z.DEL,t.altKey&&(s.key=Z.ESC+s.key);break;case 9:if(t.shiftKey){s.key=Z.ESC+"[Z";break}s.key=Z.HT,s.cancel=!0;break;case 13:s.key=t.altKey?Z.ESC+Z.CR:Z.CR,s.cancel=!0;break;case 27:s.key=Z.ESC,t.altKey&&(s.key=Z.ESC+Z.ESC),s.cancel=!0;break;case 37:if(t.metaKey)break;n?s.key=Z.ESC+"[1;"+(n+1)+"D":e?s.key=Z.ESC+"OD":s.key=Z.ESC+"[D";break;case 39:if(t.metaKey)break;n?s.key=Z.ESC+"[1;"+(n+1)+"C":e?s.key=Z.ESC+"OC":s.key=Z.ESC+"[C";break;case 38:if(t.metaKey)break;n?s.key=Z.ESC+"[1;"+(n+1)+"A":e?s.key=Z.ESC+"OA":s.key=Z.ESC+"[A";break;case 40:if(t.metaKey)break;n?s.key=Z.ESC+"[1;"+(n+1)+"B":e?s.key=Z.ESC+"OB":s.key=Z.ESC+"[B";break;case 45:!t.shiftKey&&!t.ctrlKey&&(s.key=Z.ESC+"[2~");break;case 46:n?s.key=Z.ESC+"[3;"+(n+1)+"~":s.key=Z.ESC+"[3~";break;case 36:n?s.key=Z.ESC+"[1;"+(n+1)+"H":e?s.key=Z.ESC+"OH":s.key=Z.ESC+"[H";break;case 35:n?s.key=Z.ESC+"[1;"+(n+1)+"F":e?s.key=Z.ESC+"OF":s.key=Z.ESC+"[F";break;case 33:t.shiftKey?s.type=2:t.ctrlKey?s.key=Z.ESC+"[5;"+(n+1)+"~":s.key=Z.ESC+"[5~";break;case 34:t.shiftKey?s.type=3:t.ctrlKey?s.key=Z.ESC+"[6;"+(n+1)+"~":s.key=Z.ESC+"[6~";break;case 112:n?s.key=Z.ESC+"[1;"+(n+1)+"P":s.key=Z.ESC+"OP";break;case 113:n?s.key=Z.ESC+"[1;"+(n+1)+"Q":s.key=Z.ESC+"OQ";break;case 114:n?s.key=Z.ESC+"[1;"+(n+1)+"R":s.key=Z.ESC+"OR";break;case 115:n?s.key=Z.ESC+"[1;"+(n+1)+"S":s.key=Z.ESC+"OS";break;case 116:n?s.key=Z.ESC+"[15;"+(n+1)+"~":s.key=Z.ESC+"[15~";break;case 117:n?s.key=Z.ESC+"[17;"+(n+1)+"~":s.key=Z.ESC+"[17~";break;case 118:n?s.key=Z.ESC+"[18;"+(n+1)+"~":s.key=Z.ESC+"[18~";break;case 119:n?s.key=Z.ESC+"[19;"+(n+1)+"~":s.key=Z.ESC+"[19~";break;case 120:n?s.key=Z.ESC+"[20;"+(n+1)+"~":s.key=Z.ESC+"[20~";break;case 121:n?s.key=Z.ESC+"[21;"+(n+1)+"~":s.key=Z.ESC+"[21~";break;case 122:n?s.key=Z.ESC+"[23;"+(n+1)+"~":s.key=Z.ESC+"[23~";break;case 123:n?s.key=Z.ESC+"[24;"+(n+1)+"~":s.key=Z.ESC+"[24~";break;default:if(t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.metaKey)t.keyCode>=65&&t.keyCode<=90?s.key=String.fromCharCode(t.keyCode-64):t.keyCode===32?s.key=Z.NUL:t.keyCode>=51&&t.keyCode<=55?s.key=String.fromCharCode(t.keyCode-51+27):t.keyCode===56?s.key=Z.DEL:t.keyCode===219?s.key=Z.ESC:t.keyCode===220?s.key=Z.FS:t.keyCode===221&&(s.key=Z.GS);else if((!i||r)&&t.altKey&&!t.metaKey){let a=(o=Yy[t.keyCode])==null?void 0:o[t.shiftKey?1:0];if(a)s.key=Z.ESC+a;else if(t.keyCode>=65&&t.keyCode<=90){let l=t.ctrlKey?t.keyCode-64:t.keyCode+32,u=String.fromCharCode(l);t.shiftKey&&(u=u.toUpperCase()),s.key=Z.ESC+u}else if(t.keyCode===32)s.key=Z.ESC+(t.ctrlKey?Z.NUL:" ");else if(t.key==="Dead"&&t.code.startsWith("Key")){let l=t.code.slice(3,4);t.shiftKey||(l=l.toLowerCase()),s.key=Z.ESC+l,s.cancel=!0}}else i&&!t.altKey&&!t.ctrlKey&&!t.shiftKey&&t.metaKey?t.keyCode===65&&(s.type=1):t.key&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&t.keyCode>=48&&t.key.length===1?s.key=t.key:t.key&&t.ctrlKey&&(t.key==="_"&&(s.key=Z.US),t.key==="@"&&(s.key=Z.NUL));break}return s}var xt=0,Jy=class{constructor(t){this._getKey=t,this._array=[],this._insertedValues=[],this._flushInsertedTask=new ku,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new ku,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(t){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(t)}_flushInserted(){let t=this._insertedValues.sort((s,n)=>this._getKey(s)-this._getKey(n)),e=0,i=0,r=new Array(this._array.length+this._insertedValues.length);for(let s=0;s<r.length;s++)i>=this._array.length||this._getKey(t[e])<=this._getKey(this._array[i])?(r[s]=t[e],e++):r[s]=this._array[i++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(t){if(this._flushCleanupInserted(),this._array.length===0)return!1;let e=this._getKey(t);if(e===void 0||(xt=this._search(e),xt===-1)||this._getKey(this._array[xt])!==e)return!1;do if(this._array[xt]===t)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(xt),!0;while(++xt<this._array.length&&this._getKey(this._array[xt])===e);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let t=this._deletedIndices.sort((s,n)=>s-n),e=0,i=new Array(this._array.length-t.length),r=0;for(let s=0;s<this._array.length;s++)t[e]===s?e++:i[r++]=this._array[s];this._array=i,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(xt=this._search(t),!(xt<0||xt>=this._array.length)&&this._getKey(this._array[xt])===t))do yield this._array[xt];while(++xt<this._array.length&&this._getKey(this._array[xt])===t)}forEachByKey(t,e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(xt=this._search(t),!(xt<0||xt>=this._array.length)&&this._getKey(this._array[xt])===t))do e(this._array[xt]);while(++xt<this._array.length&&this._getKey(this._array[xt])===t)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(t){let e=0,i=this._array.length-1;for(;i>=e;){let r=e+i>>1,s=this._getKey(this._array[r]);if(s>t)i=r-1;else if(s<t)e=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===t;)r--;return r}}return e}},ic=0,$p=0,Zy=class extends Fe{constructor(){super(),this._decorations=new Jy(t=>t==null?void 0:t.marker.line),this._onDecorationRegistered=this._register(new ue),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ue),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(ut(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(t){if(t.marker.isDisposed)return;let e=new Qy(t);if(e){let i=e.marker.onDispose(()=>e.dispose()),r=e.onDispose(()=>{r.dispose(),e&&(this._decorations.delete(e)&&this._onDecorationRemoved.fire(e),i.dispose())});this._decorations.insert(e),this._onDecorationRegistered.fire(e)}return e}reset(){for(let t of this._decorations.values())t.dispose();this._decorations.clear()}*getDecorationsAtCell(t,e,i){let r=0,s=0;for(let n of this._decorations.getKeyIterator(e))r=n.options.x??0,s=r+(n.options.width??1),t>=r&&t<s&&(!i||(n.options.layer??"bottom")===i)&&(yield n)}forEachDecorationAtCell(t,e,i,r){this._decorations.forEachByKey(e,s=>{ic=s.options.x??0,$p=ic+(s.options.width??1),t>=ic&&t<$p&&(!i||(s.options.layer??"bottom")===i)&&r(s)})}},Qy=class extends zs{constructor(t){super(),this.options=t,this.onRenderEmitter=this.add(new ue),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ue),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=t.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=mt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=mt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},e7=1e3,t7=class{constructor(t,e=e7){this._renderCallback=t,this._debounceThresholdMS=e,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(t,e,i){this._rowCount=i,t=t!==void 0?t:0,e=e!==void 0?e:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,t):t,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,e):e;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let s=r-this._lastRefreshMs,n=this._debounceThresholdMS-s;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},n)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let t=Math.max(this._rowStart,0),e=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(t,e)}},qp=20,Cu=class extends Fe{constructor(t,e,i,r){super(),this._terminal=t,this._coreBrowserService=i,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let s=this._coreBrowserService.mainDocument;this._accessibilityContainer=s.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=s.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let n=0;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);if(this._topBoundaryFocusListener=n=>this._handleBoundaryFocus(n,0),this._bottomBoundaryFocusListener=n=>this._handleBoundaryFocus(n,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=s.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new t7(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(n=>this._handleResize(n.rows))),this._register(this._terminal.onRender(n=>this._refreshRows(n.start,n.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(n=>this._handleChar(n))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
26
+ `))),this._register(this._terminal.onA11yTab(n=>this._handleTab(n))),this._register(this._terminal.onKey(n=>this._handleKey(n.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Te(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(ut(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(t){for(let e=0;e<t;e++)this._handleChar(" ")}_handleChar(t){this._liveRegionLineCount<qp+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==t&&(this._charsToAnnounce+=t):this._charsToAnnounce+=t,t===`
27
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===qp+1&&(this._liveRegion.textContent+=oh.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(t){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(t)||this._charsToConsume.push(t)}_refreshRows(t,e){this._liveRegionDebouncer.refresh(t,e,this._terminal.rows)}_renderRows(t,e){let i=this._terminal.buffer,r=i.lines.length.toString();for(let s=t;s<=e;s++){let n=i.lines.get(i.ydisp+s),o=[],a=(n==null?void 0:n.translateToString(!0,void 0,void 0,o))||"",l=(i.ydisp+s+1).toString(),u=this._rowElements[s];u&&(a.length===0?(u.textContent=" ",this._rowColumns.set(u,[0,1])):(u.textContent=a,this._rowColumns.set(u,o)),u.setAttribute("aria-posinset",l),u.setAttribute("aria-setsize",r),this._alignRowWidth(u))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(t,e){let i=t.target,r=this._rowElements[e===0?1:this._rowElements.length-2],s=i.getAttribute("aria-posinset"),n=e===0?"1":`${this._terminal.buffer.lines.length}`;if(s===n||t.relatedTarget!==r)return;let o,a;if(e===0?(o=i,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(o=this._rowElements.shift(),a=i,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),a.removeEventListener("focus",this._bottomBoundaryFocusListener),e===0){let l=this._createAccessibilityTreeNode();this._rowElements.unshift(l),this._rowContainer.insertAdjacentElement("afterbegin",l)}else{let l=this._createAccessibilityTreeNode();this._rowElements.push(l),this._rowContainer.appendChild(l)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(e===0?-1:1),this._rowElements[e===0?1:this._rowElements.length-2].focus(),t.preventDefault(),t.stopImmediatePropagation()}_handleSelectionChange(){var a;if(this._rowElements.length===0)return;let t=this._coreBrowserService.mainDocument.getSelection();if(!t)return;if(t.isCollapsed){this._rowContainer.contains(t.anchorNode)&&this._terminal.clearSelection();return}if(!t.anchorNode||!t.focusNode){console.error("anchorNode and/or focusNode are null");return}let e={node:t.anchorNode,offset:t.anchorOffset},i={node:t.focusNode,offset:t.focusOffset};if((e.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||e.node===i.node&&e.offset>i.offset)&&([e,i]=[i,e]),e.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(e={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(e.node))return;let r=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:r,offset:((a=r.textContent)==null?void 0:a.length)??0}),!this._rowContainer.contains(i.node))return;let s=({node:l,offset:u})=>{let c=l instanceof Text?l.parentNode:l,h=parseInt(c==null?void 0:c.getAttribute("aria-posinset"),10)-1;if(isNaN(h))return console.warn("row is invalid. Race condition?"),null;let d=this._rowColumns.get(c);if(!d)return console.warn("columns is null. Race condition?"),null;let f=u<d.length?d[u]:d.slice(-1)[0]+1;return f>=this._terminal.cols&&(++h,f=0),{row:h,column:f}},n=s(e),o=s(i);if(!(!n||!o)){if(n.row>o.row||n.row===o.row&&n.column>=o.column)throw new Error("invalid range");this._terminal.select(n.column,n.row,(o.row-n.row)*this._terminal.cols-n.column+o.column)}}_handleResize(t){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let t=this._coreBrowserService.mainDocument.createElement("div");return t.setAttribute("role","listitem"),t.tabIndex=-1,this._refreshRowDimensions(t),t}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let t=0;t<this._terminal.rows;t++)this._refreshRowDimensions(this._rowElements[t]),this._alignRowWidth(this._rowElements[t])}}_refreshRowDimensions(t){t.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(t){var s,n;t.style.transform="";let e=t.getBoundingClientRect().width,i=(n=(s=this._rowColumns.get(t))==null?void 0:s.slice(-1))==null?void 0:n[0];if(!i)return;let r=i*this._renderService.dimensions.css.cell.width;t.style.transform=`scaleX(${r/e})`}};Cu=wt([fe(1,_f),fe(2,hs),fe(3,ds)],Cu);var Hh=class extends Fe{constructor(t,e,i,r,s){super(),this._element=t,this._mouseService=e,this._renderService=i,this._bufferService=r,this._linkProviderService=s,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new ue),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ue),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(ut(()=>{var n;Cn(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(n=this._activeProviderReplies)==null||n.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Te(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Te(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Te(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Te(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(t){this._lastMouseEvent=t;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;let i=t.composedPath();for(let r=0;r<i.length;r++){let s=i[r];if(s.classList.contains("xterm"))break;if(s.classList.contains("xterm-hover"))return}(!this._lastBufferCell||e.x!==this._lastBufferCell.x||e.y!==this._lastBufferCell.y)&&(this._handleHover(e),this._lastBufferCell=e)}_handleHover(t){if(this._activeLine!==t.y||this._wasResized){this._clearCurrentLink(),this._askForLink(t,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,t)||(this._clearCurrentLink(),this._askForLink(t,!0))}_askForLink(t,e){var r,s;(!this._activeProviderReplies||!e)&&((r=this._activeProviderReplies)==null||r.forEach(n=>{n==null||n.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=t.y);let i=!1;for(let[n,o]of this._linkProviderService.linkProviders.entries())e?(s=this._activeProviderReplies)!=null&&s.get(n)&&(i=this._checkLinkProviderResult(n,t,i)):o.provideLinks(t.y,a=>{var u,c;if(this._isMouseOut)return;let l=a==null?void 0:a.map(h=>({link:h}));(u=this._activeProviderReplies)==null||u.set(n,l),i=this._checkLinkProviderResult(n,t,i),((c=this._activeProviderReplies)==null?void 0:c.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(t.y,this._activeProviderReplies)})}_removeIntersectingLinks(t,e){let i=new Set;for(let r=0;r<e.size;r++){let s=e.get(r);if(s)for(let n=0;n<s.length;n++){let o=s[n],a=o.link.range.start.y<t?0:o.link.range.start.x,l=o.link.range.end.y>t?this._bufferService.cols:o.link.range.end.x;for(let u=a;u<=l;u++){if(i.has(u)){s.splice(n--,1);break}i.add(u)}}}}_checkLinkProviderResult(t,e,i){var n;if(!this._activeProviderReplies)return i;let r=this._activeProviderReplies.get(t),s=!1;for(let o=0;o<t;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(s=!0);if(!s&&r){let o=r.find(a=>this._linkAtPosition(a.link,e));o&&(i=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let o=0;o<this._activeProviderReplies.size;o++){let a=(n=this._activeProviderReplies.get(o))==null?void 0:n.find(l=>this._linkAtPosition(l.link,e));if(a){i=!0,this._handleNewLink(a);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(t){if(!this._currentLink)return;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);e&&this._mouseDownLink&&i7(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(t,this._currentLink.link.text)}_clearCurrentLink(t,e){!this._currentLink||!this._lastMouseEvent||(!t||!e||this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Cn(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(t){if(!this._lastMouseEvent)return;let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(t.link,e)&&(this._currentLink=t,this._currentLink.state={decorations:{underline:t.link.decorations===void 0?!0:t.link.decorations.underline,pointerCursor:t.link.decorations===void 0?!0:t.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,t.link,this._lastMouseEvent),t.link.decorations={},Object.defineProperties(t.link.decorations,{pointerCursor:{get:()=>{var i,r;return(r=(i=this._currentLink)==null?void 0:i.state)==null?void 0:r.decorations.pointerCursor},set:i=>{var r;(r=this._currentLink)!=null&&r.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>{var i,r;return(r=(i=this._currentLink)==null?void 0:i.state)==null?void 0:r.decorations.underline},set:i=>{var r,s,n;(r=this._currentLink)!=null&&r.state&&((n=(s=this._currentLink)==null?void 0:s.state)==null?void 0:n.decorations.underline)!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(t.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let r=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,s=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=s&&(this._clearCurrentLink(r,s),this._lastMouseEvent)){let n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._askForLink(n,!1)}})))}_linkHover(t,e,i){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&t.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(i,e.text)}_fireUnderlineEvent(t,e){let i=t.range,r=this._bufferService.buffer.ydisp,s=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-r-1,i.end.x,i.end.y-r-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(s)}_linkLeave(t,e,i){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&t.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(i,e.text)}_linkAtPosition(t,e){let i=t.range.start.y*this._bufferService.cols+t.range.start.x,r=t.range.end.y*this._bufferService.cols+t.range.end.x,s=e.y*this._bufferService.cols+e.x;return i<=s&&s<=r}_positionFromMouseEvent(t,e,i){let r=i.getCoords(t,e,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(t,e,i,r,s){return{x1:t,y1:e,x2:i,y2:r,cols:this._bufferService.cols,fg:s}}};Hh=wt([fe(1,yf),fe(2,ds),fe(3,yi),fe(4,C4)],Hh);function i7(t,e){return t.text===e.text&&t.range.start.x===e.range.start.x&&t.range.start.y===e.range.start.y&&t.range.end.x===e.range.end.x&&t.range.end.y===e.range.end.y}var r7=class extends Gy{constructor(t={}){super(t),this._linkifier=this._register(new co),this.browser=W4,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new co),this._onCursorMove=this._register(new ue),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ue),this.onKey=this._onKey.event,this._onRender=this._register(new ue),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ue),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ue),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ue),this.onBell=this._onBell.event,this._onFocus=this._register(new ue),this._onBlur=this._register(new ue),this._onA11yCharEmitter=this._register(new ue),this._onA11yTabEmitter=this._register(new ue),this._onWillOpen=this._register(new ue),this._setup(),this._decorationService=this._instantiationService.createInstance(Zy),this._instantiationService.setService(Ka,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(V8),this._instantiationService.setService(C4,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(lh)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh((e==null?void 0:e.start)??0,(e==null?void 0:e.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(si.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(si.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(si.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(si.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(ut(()=>{var e,i;this._customKeyEventHandler=void 0,(i=(e=this.element)==null?void 0:e.parentNode)==null||i.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(t){if(this._themeService)for(let e of t){let i,r="";switch(e.index){case 256:i="foreground",r="10";break;case 257:i="background",r="11";break;case 258:i="cursor",r="12";break;default:i="ansi",r="4;"+e.index}switch(e.type){case 0:let s=ot.toColorRGB(i==="ansi"?this._themeService.colors.ansi[e.index]:this._themeService.colors[i]);this.coreService.triggerDataEvent(`${Z.ESC}]${r};${$y(s)}${$4.ST}`);break;case 1:if(i==="ansi")this._themeService.modifyColors(n=>n.ansi[e.index]=Tt.toColor(...e.color));else{let n=i;this._themeService.modifyColors(o=>o[n]=Tt.toColor(...e.color))}break;case 2:this._themeService.restoreColor(e.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(t){t?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Cu,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(t){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Z.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var t;return(t=this.textarea)==null?void 0:t.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Z.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let t=this.buffer.ybase+this.buffer.y,e=this.buffer.lines.get(t);if(!e)return;let i=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,s=e.getWidth(i),n=this._renderService.dimensions.css.cell.width*s,o=this.buffer.y*this._renderService.dimensions.css.cell.height,a=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=o+"px",this.textarea.style.width=n+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Te(this.element,"copy",e=>{this.hasSelection()&&a_(e,this._selectionService)}));let t=e=>l_(e,this.textarea,this.coreService,this.optionsService);this._register(Te(this.textarea,"paste",t)),this._register(Te(this.element,"paste",t)),K4?this._register(Te(this.element,"mousedown",e=>{e.button===2&&Q1(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Te(this.element,"contextmenu",e=>{Q1(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Mf&&this._register(Te(this.element,"auxclick",e=>{e.button===1&&g4(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Te(this.textarea,"keyup",t=>this._keyUp(t),!0)),this._register(Te(this.textarea,"keydown",t=>this._keyDown(t),!0)),this._register(Te(this.textarea,"keypress",t=>this._keyPress(t),!0)),this._register(Te(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Te(this.textarea,"compositionupdate",t=>this._compositionHelper.compositionupdate(t))),this._register(Te(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Te(this.textarea,"input",t=>this._inputEvent(t),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(t){var s;if(!t)throw new Error("Terminal requires a parent element.");if(t.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((s=this.element)==null?void 0:s.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=t.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),t.appendChild(this.element);let e=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),e.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Te(this.screenElement,"mousemove",n=>this.updateCursorStyle(n))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),e.appendChild(this.screenElement);let i=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",nh.get()),G4||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>i.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(W8,this.textarea,t.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(hs,this._coreBrowserService),this._register(Te(this.textarea,"focus",n=>this._handleTextAreaFocus(n))),this._register(Te(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Mh,this._document,this._helperContainer),this._instantiationService.setService(r0,this._charSizeService),this._themeService=this._instantiationService.createInstance(Nh),this._instantiationService.setService(Co,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Su),this._instantiationService.setService(k4,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Bh,this.rows,this.screenElement)),this._instantiationService.setService(ds,this._renderService),this._register(this._renderService.onRenderedViewportChange(n=>this._onRender.fire(n))),this.onResize(n=>this._renderService.resize(n.cols,n.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Ah,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Th),this._instantiationService.setService(yf,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Hh,this.screenElement));this.element.appendChild(e);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(kh,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(n=>{super.scrollLines(n,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Rh,this.element,this.screenElement,r)),this._instantiationService.setService(g_,this._selectionService),this._register(this._selectionService.onRequestScrollLines(n=>this.scrollLines(n.amount,n.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(n=>this._renderService.handleSelectionChanged(n.start,n.end,n.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(n=>{this.textarea.value=n,this.textarea.focus(),this.textarea.select()})),this._register(si.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var n;this._selectionService.refresh(),(n=this._viewport)==null||n.queueSync()})),this._register(this._instantiationService.createInstance(Ch,this.screenElement)),this._register(Te(this.element,"mousedown",n=>this._selectionService.handleMouseDown(n))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Cu,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",n=>this._handleScreenReaderModeOptionChange(n))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(xu,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",n=>{!this._overviewRulerRenderer&&n&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(xu,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Dh,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let t=this,e=this.element;function i(n){var u,c,h,d,f;let o=t._mouseService.getMouseReportCoords(n,t.screenElement);if(!o)return!1;let a,l;switch(n.overrideType||n.type){case"mousemove":l=32,n.buttons===void 0?(a=3,n.button!==void 0&&(a=n.button<3?n.button:3)):a=n.buttons&1?0:n.buttons&4?1:n.buttons&2?2:3;break;case"mouseup":l=0,a=n.button<3?n.button:3;break;case"mousedown":l=1,a=n.button<3?n.button:3;break;case"wheel":if(t._customWheelEventHandler&&t._customWheelEventHandler(n)===!1)return!1;let p=n.deltaY;if(p===0||t.coreMouseService.consumeWheelEvent(n,(d=(h=(c=(u=t._renderService)==null?void 0:u.dimensions)==null?void 0:c.device)==null?void 0:h.cell)==null?void 0:d.height,(f=t._coreBrowserService)==null?void 0:f.dpr)===0)return!1;l=p<0?0:1,a=4;break;default:return!1}return l===void 0||a===void 0||a>4?!1:t.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:a,action:l,ctrl:n.ctrlKey,alt:n.altKey,shift:n.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s={mouseup:n=>(i(n),n.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(n)),wheel:n=>(i(n),this.cancel(n,!0)),mousedrag:n=>{n.buttons&&i(n)},mousemove:n=>{n.buttons||i(n)}};this._register(this.coreMouseService.onProtocolChange(n=>{n?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(n)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),n&8?r.mousemove||(e.addEventListener("mousemove",s.mousemove),r.mousemove=s.mousemove):(e.removeEventListener("mousemove",r.mousemove),r.mousemove=null),n&16?r.wheel||(e.addEventListener("wheel",s.wheel,{passive:!1}),r.wheel=s.wheel):(e.removeEventListener("wheel",r.wheel),r.wheel=null),n&2?r.mouseup||(r.mouseup=s.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),n&4?r.mousedrag||(r.mousedrag=s.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Te(e,"mousedown",n=>{if(n.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(n)))return i(n),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(n)})),this._register(Te(e,"wheel",n=>{var o,a,l,u,c;if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(n)===!1)return!1;if(!this.buffer.hasScrollback){if(n.deltaY===0)return!1;if(t.coreMouseService.consumeWheelEvent(n,(u=(l=(a=(o=t._renderService)==null?void 0:o.dimensions)==null?void 0:a.device)==null?void 0:l.cell)==null?void 0:u.height,(c=t._coreBrowserService)==null?void 0:c.dpr)===0)return this.cancel(n,!0);let h=Z.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(n.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(h,!0),this.cancel(n,!0)}}},{passive:!1}))}refresh(t,e){var i;(i=this._renderService)==null||i.refreshRows(t,e)}updateCursorStyle(t){var e;(e=this._selectionService)!=null&&e.shouldColumnSelect(t)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(t,e){this._viewport?this._viewport.scrollLines(t):super.scrollLines(t,e),this.refresh(0,this.rows-1)}scrollPages(t){this.scrollLines(t*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(t){t&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(t){let e=t-this._bufferService.buffer.ydisp;e!==0&&this.scrollLines(e)}paste(t){m4(t,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(t){this._customKeyEventHandler=t}attachCustomWheelEventHandler(t){this._customWheelEventHandler=t}registerLinkProvider(t){return this._linkProviderService.registerLinkProvider(t)}registerCharacterJoiner(t){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let e=this._characterJoinerService.register(t);return this.refresh(0,this.rows-1),e}deregisterCharacterJoiner(t){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(t)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(t){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+t)}registerDecoration(t){return this._decorationService.registerDecoration(t)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(t,e,i){this._selectionService.setSelection(t,e,i)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var t;(t=this._selectionService)==null||t.clearSelection()}selectAll(){var t;(t=this._selectionService)==null||t.selectAll()}selectLines(t,e){var i;(i=this._selectionService)==null||i.selectLines(t,e)}_keyDown(t){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(t)===!1)return!1;let e=this.browser.isMac&&this.options.macOptionIsMeta&&t.altKey;if(!e&&!this._compositionHelper.keydown(t))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!e&&(t.key==="Dead"||t.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let i=Xy(t,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(t),i.type===3||i.type===2){let r=this.rows-1;return this.scrollLines(i.type===2?-r:r),this.cancel(t,!0)}if(i.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,t)||(i.cancel&&this.cancel(t,!0),!i.key)||t.key&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&t.key.length===1&&t.key.charCodeAt(0)>=65&&t.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((i.key===Z.ETX||i.key===Z.CR)&&(this.textarea.value=""),this._onKey.fire({key:i.key,domEvent:t}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!0),!this.optionsService.rawOptions.screenReaderMode||t.altKey||t.ctrlKey)return this.cancel(t,!0);this._keyDownHandled=!0}_isThirdLevelShift(t,e){let i=t.isMac&&!this.options.macOptionIsMeta&&e.altKey&&!e.ctrlKey&&!e.metaKey||t.isWindows&&e.altKey&&e.ctrlKey&&!e.metaKey||t.isWindows&&e.getModifierState("AltGraph");return e.type==="keypress"?i:i&&(!e.keyCode||e.keyCode>47)}_keyUp(t){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(t)===!1)&&(s7(t)||this.focus(),this.updateCursorStyle(t),this._keyPressHandled=!1)}_keyPress(t){let e;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(t)===!1)return!1;if(this.cancel(t),t.charCode)e=t.charCode;else if(t.which===null||t.which===void 0)e=t.keyCode;else if(t.which!==0&&t.charCode!==0)e=t.which;else return!1;return!e||(t.altKey||t.ctrlKey||t.metaKey)&&!this._isThirdLevelShift(this.browser,t)?!1:(e=String.fromCharCode(e),this._onKey.fire({key:e,domEvent:t}),this._showCursor(),this.coreService.triggerDataEvent(e,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(t){if(t.data&&t.inputType==="insertText"&&(!t.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let e=t.data;return this.coreService.triggerDataEvent(e,!0),this.cancel(t),!0}return!1}resize(t,e){if(t===this.cols&&e===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(t,e)}_afterResize(t,e){var i;(i=this._charSizeService)==null||i.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let t=1;t<this.rows;t++)this.buffer.lines.push(this.buffer.getBlankLine(Dt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var e;this.options.rows=this.rows,this.options.cols=this.cols;let t=this._customKeyEventHandler;this._setup(),super.reset(),(e=this._selectionService)==null||e.reset(),this._decorationService.reset(),this._customKeyEventHandler=t,this.refresh(0,this.rows-1)}clearTextureAtlas(){var t;(t=this._renderService)==null||t.clearTextureAtlas()}_reportFocus(){var t;(t=this.element)!=null&&t.classList.contains("focus")?this.coreService.triggerDataEvent(Z.ESC+"[I"):this.coreService.triggerDataEvent(Z.ESC+"[O")}_reportWindowsOptions(t){if(this._renderService)switch(t){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),i=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Z.ESC}[4;${i};${e}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Z.ESC}[6;${s};${r}t`);break}}cancel(t,e){if(!(!this.options.cancelEvents&&!e))return t.preventDefault(),t.stopPropagation(),!1}};function s7(t){return t.keyCode===16||t.keyCode===17||t.keyCode===18}var n7=class{constructor(){this._addons=[]}dispose(){for(let t=this._addons.length-1;t>=0;t--)this._addons[t].instance.dispose()}loadAddon(t,e){let i={instance:e,dispose:e.dispose,isDisposed:!1};this._addons.push(i),e.dispose=()=>this._wrappedAddonDispose(i),e.activate(t)}_wrappedAddonDispose(t){if(t.isDisposed)return;let e=-1;for(let i=0;i<this._addons.length;i++)if(this._addons[i]===t){e=i;break}if(e===-1)throw new Error("Could not dispose an addon that has not been loaded");t.isDisposed=!0,t.dispose.apply(t.instance),this._addons.splice(e,1)}},o7=class{constructor(t){this._line=t}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(t,e){if(!(t<0||t>=this._line.length))return e?(this._line.loadCell(t,e),e):this._line.loadCell(t,new rr)}translateToString(t,e,i){return this._line.translateToString(t,e,i)}},Wp=class{constructor(t,e){this._buffer=t,this.type=e}init(t){return this._buffer=t,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(t){let e=this._buffer.lines.get(t);if(e)return new o7(e)}getNullCell(){return new rr}},a7=class extends Fe{constructor(t){super(),this._core=t,this._onBufferChange=this._register(new ue),this.onBufferChange=this._onBufferChange.event,this._normal=new Wp(this._core.buffers.normal,"normal"),this._alternate=new Wp(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},l7=class{constructor(t){this._core=t}registerCsiHandler(t,e){return this._core.registerCsiHandler(t,i=>e(i.toArray()))}addCsiHandler(t,e){return this.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._core.registerDcsHandler(t,(i,r)=>e(i,r.toArray()))}addDcsHandler(t,e){return this.registerDcsHandler(t,e)}registerEscHandler(t,e){return this._core.registerEscHandler(t,e)}addEscHandler(t,e){return this.registerEscHandler(t,e)}registerOscHandler(t,e){return this._core.registerOscHandler(t,e)}addOscHandler(t,e){return this.registerOscHandler(t,e)}},u7=class{constructor(t){this._core=t}register(t){this._core.unicodeService.register(t)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(t){this._core.unicodeService.activeVersion=t}},c7=["cols","rows"],wr=0,h7=class extends Fe{constructor(t){super(),this._core=this._register(new r7(t)),this._addonManager=this._register(new n7),this._publicOptions={...this._core.options};let e=r=>this._core.options[r],i=(r,s)=>{this._checkReadonlyOptions(r),this._core.options[r]=s};for(let r in this._core.options){let s={get:e.bind(this,r),set:i.bind(this,r)};Object.defineProperty(this._publicOptions,r,s)}}_checkReadonlyOptions(t){if(c7.includes(t))throw new Error(`Option "${t}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new l7(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new u7(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new a7(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let t=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any";break}return{applicationCursorKeysMode:t.applicationCursorKeys,applicationKeypadMode:t.applicationKeypad,bracketedPasteMode:t.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:t.origin,reverseWraparoundMode:t.reverseWraparound,sendFocusMode:t.sendFocus,synchronizedOutputMode:t.synchronizedOutput,wraparoundMode:t.wraparound}}get options(){return this._publicOptions}set options(t){for(let e in t)this._publicOptions[e]=t[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(t,e=!0){this._core.input(t,e)}resize(t,e){this._verifyIntegers(t,e),this._core.resize(t,e)}open(t){this._core.open(t)}attachCustomKeyEventHandler(t){this._core.attachCustomKeyEventHandler(t)}attachCustomWheelEventHandler(t){this._core.attachCustomWheelEventHandler(t)}registerLinkProvider(t){return this._core.registerLinkProvider(t)}registerCharacterJoiner(t){return this._checkProposedApi(),this._core.registerCharacterJoiner(t)}deregisterCharacterJoiner(t){this._checkProposedApi(),this._core.deregisterCharacterJoiner(t)}registerMarker(t=0){return this._verifyIntegers(t),this._core.registerMarker(t)}registerDecoration(t){return this._checkProposedApi(),this._verifyPositiveIntegers(t.x??0,t.width??0,t.height??0),this._core.registerDecoration(t)}hasSelection(){return this._core.hasSelection()}select(t,e,i){this._verifyIntegers(t,e,i),this._core.select(t,e,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(t,e){this._verifyIntegers(t,e),this._core.selectLines(t,e)}dispose(){super.dispose()}scrollLines(t){this._verifyIntegers(t),this._core.scrollLines(t)}scrollPages(t){this._verifyIntegers(t),this._core.scrollPages(t)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(t){this._verifyIntegers(t),this._core.scrollToLine(t)}clear(){this._core.clear()}write(t,e){this._core.write(t,e)}writeln(t,e){this._core.write(t),this._core.write(`\r
28
+ `,e)}paste(t){this._core.paste(t)}refresh(t,e){this._verifyIntegers(t,e),this._core.refresh(t,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(t){this._addonManager.loadAddon(this,t)}static get strings(){return{get promptLabel(){return nh.get()},set promptLabel(t){nh.set(t)},get tooMuchOutput(){return oh.get()},set tooMuchOutput(t){oh.set(t)}}}_verifyIntegers(...t){for(wr of t)if(wr===1/0||isNaN(wr)||wr%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...t){for(wr of t)if(wr&&(wr===1/0||isNaN(wr)||wr%1!==0||wr<0))throw new Error("This API only accepts positive integers")}};/**
29
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
30
+ * @license MIT
31
+ *
32
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
33
+ * @license MIT
34
+ *
35
+ * Originally forked from (with the author's permission):
36
+ * Fabrice Bellard's javascript vt100 for jslinux:
37
+ * http://bellard.org/jslinux/
38
+ * Copyright (c) 2011 Fabrice Bellard
39
+ */var d7=2,f7=1,p7=class{activate(t){this._terminal=t}dispose(){}fit(){let t=this.proposeDimensions();if(!t||!this._terminal||isNaN(t.cols)||isNaN(t.rows))return;let e=this._terminal._core;(this._terminal.rows!==t.rows||this._terminal.cols!==t.cols)&&(e._renderService.clear(),this._terminal.resize(t.cols,t.rows))}proposeDimensions(){var h;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let t=this._terminal._core._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let e=this._terminal.options.scrollback===0?0:((h=this._terminal.options.overviewRuler)==null?void 0:h.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(i.getPropertyValue("height")),s=Math.max(0,parseInt(i.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),o={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},a=o.top+o.bottom,l=o.right+o.left,u=r-a,c=s-l-e;return{cols:Math.max(d7,Math.floor(c/t.css.cell.width)),rows:Math.max(f7,Math.floor(u/t.css.cell.height))}}};const Kp=1,m7=[500,1e3,2e3,4e3,8e3],g7=3e3;function v7({url:t,binaryType:e="arraybuffer",WebSocketImpl:i=typeof WebSocket<"u"?WebSocket:void 0,setTimeoutImpl:r=setTimeout,clearTimeoutImpl:s=clearTimeout,backoff:n=m7,stableMs:o=g7,onOpen:a=()=>{},onMessage:l=()=>{},onState:u=()=>{}}){let c=null,h=0,d=!1,f=0,p=0;const v=M5(()=>{if(d||!c)return;const E=c;c=null,w();try{E.close()}catch{}D()},{setTimeoutImpl:r,clearTimeoutImpl:s}),_=typeof t=="function"?t:()=>t,w=()=>{p&&(s(p),p=0)},x=()=>{u(h===0?"connecting":"reconnecting");let E;try{E=new i(_())}catch{D();return}c=E,v.arm();try{E.binaryType=e}catch{}E.onopen=()=>{E===c&&(v.arm(),u("open"),p=r(()=>{h=0,p=0},o),a(R))},E.onmessage=L=>{if(E===c){if(v.arm(),L.data==="ping")try{E.send("pong")}catch{}l(L)}},E.onclose=()=>{E===c&&C()},E.onerror=()=>{}},C=()=>{w(),v.disarm(),!d&&D()},D=()=>{u("reconnecting");const E=n[Math.min(h,n.length-1)];h++,f=r(()=>{f=0,x()},E)},R={send(E){return c&&c.readyState===Kp?(c.send(E),!0):!1},isOpen(){return!!c&&c.readyState===Kp},close(){if(d=!0,v.disarm(),f&&(s(f),f=0),w(),c)try{c.close()}catch{}c=null},get raw(){return c}};return x(),R}const sv="spexcode.terminal-font-size",b7=9,_7=18,Vp=1,$h=new Set;function y7(){const t=Number.parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--type-terminal"));if(!Number.isFinite(t))throw new Error("Terminal font-size token is missing or invalid");return t}function nv(t){const e=Number(t);return Number.isFinite(e)&&e>=b7&&e<=_7?Math.round(e/Vp)*Vp:null}function w7(){let t=null;try{t=nv(localStorage.getItem(sv))}catch{}return t??y7()}function aR(t){const e=nv(t);if(e===null)throw new Error(`Invalid terminal font size: ${t}`);try{localStorage.setItem(sv,String(e))}catch{}for(const i of $h)i(e);return e}function x7(t){return $h.add(t),()=>$h.delete(t)}const S7="\x1B[?2026h",k7="\x1B[?2026l",C7=new Set([9,1002,1003,1005,1015]);function Up(t){return t.replace(/\x1b\[(?:I|O)/g,"")}function A7(t){return t.replace(/\x1b\[<([0-9]+);[0-9]+;[0-9]+[Mm]/g,(e,i)=>Number(i)&64?e:"").replace(/\x1b\[M([\x20-\x3f]{3})/g,(e,i)=>i.charCodeAt(0)&64?e:"").replace(/\x1b\[([0-9]+);[0-9]+;[0-9]+[Mm]/g,(e,i)=>Number(i)&64?e:"")}function E7(t){return t.replace(/\x1b\[<([0-9]+);[0-9]+;[0-9]+[Mm]/g,"").replace(/\x1b\[M[\x20-\x3f]{3}/g,"").replace(/\x1b\[([0-9]+);[0-9]+;[0-9]+[Mm]/g,"")}function D7(t){return t.length>0&&t.every(e=>typeof e=="number"&&C7.has(e))}function M7(t){return t.length>0&&t.every(e=>e===2026)}function T7(){const e=getComputedStyle(document.documentElement).getPropertyValue("--mono").trim();if(!e)throw new Error("Terminal typography tokens are missing or invalid");return{fontSize:w7(),fontFamily:e}}function B7(t){var e;return(e=navigator.clipboard)!=null&&e.writeText?navigator.clipboard.writeText(t).then(()=>!0).catch(()=>Gp(t)):Promise.resolve(Gp(t))}function Gp(t){var s;const e=document.activeElement,i=document.createElement("textarea");i.value=t,i.setAttribute("readonly",""),i.style.cssText="position:fixed;top:0;left:0;width:1px;height:1px;opacity:0;pointer-events:none",document.body.appendChild(i);let r=!1;try{i.select(),i.setSelectionRange(0,t.length),r=document.execCommand("copy")}catch{r=!1}i.remove();try{(s=e==null?void 0:e.focus)==null||s.call(e)}catch{}return r||console.warn("[SessionTerm] clipboard copy failed — selection left intact for manual copy"),r}function R7({sessionId:t,active:e=!0,focused:i=e,writable:r=!0,resumeRequired:s=!1,focusRequest:n=0}){const o=Ie(),a=k.useRef(null),l=k.useRef(null),u=k.useRef({cols:0,rows:0}),c=k.useRef(null),h=k.useRef(e),d=k.useRef(i),f=k.useRef(r),p=k.useRef(s),v=k.useRef(!s),_=k.useRef(null),w=k.useRef(null);h.current=e,d.current=i,f.current=r,p.current=s;const[x,C]=k.useState(!1),[D,R]=k.useState(!1),[E,L]=k.useState(""),[q,F]=k.useState(!s);v.current=q;const[$,W]=k.useState("connecting");k.useEffect(()=>{var Yi;const A=new h7({...T7(),cursorBlink:!0,disableStdin:!r,scrollback:0,macOptionClickForcesSelection:!0,theme:{background:"#0d1117",foreground:"#c9d1d9",cursor:"#c9d1d9",selectionBackground:"#264f78",selectionForeground:"#f0f6fc",selectionInactiveBackground:"#264f78",black:"#484f58",red:"#ff7b72",green:"#3fb950",yellow:"#d29922",blue:"#58a6ff",magenta:"#bc8cff",cyan:"#39c5cf",white:"#b1bac4",brightBlack:"#6e7681",brightRed:"#ffa198",brightGreen:"#56d364",brightYellow:"#e3b341",brightBlue:"#79c0ff",brightMagenta:"#d2a8ff",brightCyan:"#56d4dd",brightWhite:"#f0f6fc"}});l.current=A;const O=new p7;A.loadAddon(O),A.open(a.current);try{O.fit()}catch{}const T=(Yi=a.current)==null?void 0:Yi.querySelector(".xterm-helper-textarea"),U=ce=>{ce.inputType==="insertText"&&!ce.isComposing&&(T.value="")};T==null||T.addEventListener("input",U),A.attachCustomKeyEventHandler(ce=>ce.type==="keydown"&&ce.key.length===1&&!ce.ctrlKey&&!ce.altKey&&!ce.metaKey?!1:!(ce.key==="Enter"&&ce.shiftKey&&!ce.ctrlKey&&!ce.altKey&&!ce.metaKey)||ce.isComposing||ce.keyCode===229?!0:(ce.preventDefault(),ce.stopPropagation(),ce.type==="keydown"&&A.input("\x1B\r",!0),!1));const H=()=>h.current&&document.visibilityState!=="hidden",re=requestAnimationFrame(()=>{var Ae;const ce=(Ae=a.current)==null?void 0:Ae.querySelector(".xterm-helper-textarea");f.current&&d.current&&H()&&(ce==null||ce.setAttribute("data-focus-sink",""),document.activeElement!==ce&&A.focus())}),G=["h","l"].map(ce=>A.parser.registerCsiHandler({prefix:"?",final:ce},Ae=>D7(Ae)));let X=!1;const oe=["h","l"].map(ce=>A.parser.registerCsiHandler({prefix:"?",final:ce},Ae=>X&&M7(Ae))),Y=`${location.protocol==="https:"?"wss":"ws"}://${location.host}${Di(`/api/sessions/${t}/socket`)}`;let le=null,te=!1;const de=()=>{const ce=a.current;if(!ce||ce.clientWidth<40||ce.clientHeight<40)return;let Ae;try{Ae=O.proposeDimensions()}catch{return}const Re=Ae==null?void 0:Ae.cols,$e=Ae==null?void 0:Ae.rows;if(!Re||!$e||Re<20&&ce.clientWidth>200)return;const In=u.current;if(!(Re===In.cols&&$e===In.rows)){if(u.current={cols:Re,rows:$e},!H()){if(!te)try{A.resize(Re,$e)}catch{}return}le!=null&&le.isOpen()&&le.send(JSON.stringify({t:"resize",cols:Re,rows:$e}))}};c.current=de,w.current=()=>{te=!1,le!=null&&le.isOpen()&&le.send(JSON.stringify({t:"visible",visible:!1}))};let ke=0;const Ye=x7(ce=>{A.options.fontSize=ce,u.current={cols:0,rows:0},cancelAnimationFrame(ke),ke=requestAnimationFrame(()=>{var Ae;return(Ae=c.current)==null?void 0:Ae.call(c)})});let Ct=null;const At=[];let st=!1;const Be=()=>{if(st||!At.length)return;st=!0;const{frame:ce,size:Ae}=At.shift(),Re=()=>{st=!1,Be()};if(!Ae){A.write(ce,Re);return}A.write(S7,()=>{X=!0;try{A.resize(Ae.cols,Ae.rows)}catch{}A.write(ce,()=>{X=!1,A.write(k7,Re)})})},vt=(ce,Ae)=>{At.push({frame:ce,size:Ae}),Be()};le=v7({url:Y,onState:W,onOpen:()=>{var ce;Ct=null,te=!1,At.length=0,A.reset(),u.current={cols:0,rows:0},H()?de():(ce=w.current)==null||ce.call(w)},onMessage:ce=>{if(typeof ce.data=="string"){try{const $e=JSON.parse(ce.data);($e==null?void 0:$e.t)==="resize-commit"&&$e.cols>0&&$e.rows>0&&(Ct={cols:Math.floor($e.cols),rows:Math.floor($e.rows)})}catch{}return}if(!(ce.data instanceof ArrayBuffer))return;H()||(te=!0);const Ae=new Uint8Array(ce.data),Re=Ct;Ct=null,vt(Ae,Re)}});const vr=()=>le==null?void 0:le.close();window.addEventListener("pagehide",vr);const ht=ce=>!ce||!f.current||!d.current||!H()||!(le!=null&&le.isOpen())?!1:(le.send(JSON.stringify({t:"input",data:ce})),!0);_.current=ht;const Yr=A.onData(ce=>{if(!f.current||!d.current||!H()||!(le!=null&&le.isOpen()))return;const Ae=A7(Up(ce));if(!Ae)return;const Re=E7(Up(ce));if(p.current&&!v.current&&Re){L(Re),R(!0),A.blur();return}ht(Ae)});let Pt;const br=a.current,qt=ce=>{if(!(ce.metaKey||ce.ctrlKey)||ce.key!=="c"&&ce.key!=="C"||!br||!h.current)return;const Ae=A.getSelection();if(!Ae)return;const Re=document.activeElement;Re&&!Re.classList.contains("xterm-helper-textarea")&&(Re.tagName==="TEXTAREA"||Re.tagName==="INPUT")&&Re.selectionStart!==Re.selectionEnd||(ce.preventDefault(),ce.stopPropagation(),B7(Ae).then($e=>{$e&&(C(!0),clearTimeout(Pt),Pt=setTimeout(()=>C(!1),1200))}))};document.addEventListener("keydown",qt,!0);const Ni=requestAnimationFrame(de),Si=new ResizeObserver(de);Si.observe(a.current),window.addEventListener("resize",de);let Wt=0;const Gi=()=>{var ce;if(!H()){(ce=w.current)==null||ce.call(w);return}u.current={cols:0,rows:0},de();try{A.refresh(0,A.rows-1)}catch{}cancelAnimationFrame(Wt),f.current&&d.current&&(Wt=requestAnimationFrame(()=>{var Re;const Ae=(Re=a.current)==null?void 0:Re.querySelector(".xterm-helper-textarea");f.current&&d.current&&H()&&document.activeElement!==Ae&&A.focus()}))};return document.addEventListener("visibilitychange",Gi),()=>{cancelAnimationFrame(Ni),cancelAnimationFrame(ke),cancelAnimationFrame(re),cancelAnimationFrame(Wt),clearTimeout(Pt),document.removeEventListener("keydown",qt,!0),document.removeEventListener("visibilitychange",Gi),window.removeEventListener("pagehide",vr),Si.disconnect(),window.removeEventListener("resize",de);for(const ce of G)ce.dispose();for(const ce of oe)ce.dispose();T==null||T.removeEventListener("input",U),Yr.dispose(),Ye(),le.close(),A.dispose(),l.current=null,_.current=null,c.current=null,w.current=null}},[t]),k.useEffect(()=>{const A=!s;F(A),v.current=A,L(""),R(!1)},[t,s]);const z=()=>{var O;const A=E;R(!1),L(""),F(!0),v.current=!0,(O=_.current)==null||O.call(_,A),requestAnimationFrame(()=>{var T;f.current&&d.current&&h.current&&document.visibilityState!=="hidden"&&((T=l.current)==null||T.focus())})},j=()=>{R(!1),L("")};return k.useLayoutEffect(()=>{var U,H,re;const A=l.current;if(!A)return;A.options.disableStdin=!r;let O=0;const T=(U=a.current)==null?void 0:U.querySelector(".xterm-helper-textarea");if(r&&i?T==null||T.setAttribute("data-focus-sink",""):T==null||T.removeAttribute("data-focus-sink"),e&&document.visibilityState!=="hidden"){u.current={cols:0,rows:0},(H=c.current)==null||H.call(c);try{A.refresh(0,A.rows-1)}catch{}f.current&&i?O=requestAnimationFrame(()=>{var X,oe;const G=(X=a.current)==null?void 0:X.querySelector(".xterm-helper-textarea");f.current&&d.current&&h.current&&document.visibilityState!=="hidden"&&document.activeElement!==G&&((oe=l.current)==null||oe.focus())}):A.blur()}else A.blur(),(re=w.current)==null||re.call(w);return()=>{cancelAnimationFrame(O),T==null||T.removeAttribute("data-focus-sink")}},[t,e,i]),k.useLayoutEffect(()=>{var T;const A=l.current;if(!A)return;A.options.disableStdin=!r;const O=(T=a.current)==null?void 0:T.querySelector(".xterm-helper-textarea");r||(O==null||O.removeAttribute("data-focus-sink"),A.blur())},[r]),k.useLayoutEffect(()=>{if(!n||!e||!i||!r||document.visibilityState==="hidden")return;const A=requestAnimationFrame(()=>{var T,U;const O=(T=a.current)==null?void 0:T.querySelector(".xterm-helper-textarea");h.current&&d.current&&f.current&&document.activeElement!==O&&((U=l.current)==null||U.focus())});return()=>cancelAnimationFrame(A)},[t,e,i,n]),m.jsxs("div",{className:"st-wrap",children:[m.jsx("div",{className:"st-host",ref:a}),D&&m.jsx("div",{className:"st-input-confirm-backdrop",role:"presentation",children:m.jsxs("div",{className:"st-input-confirm",role:"dialog","aria-modal":"true","aria-labelledby":"st-input-confirm-title",children:[m.jsx("h2",{id:"st-input-confirm-title",children:o("session.resumeInputTitle")}),m.jsx("p",{children:o("session.resumeInputMessage")}),m.jsxs("div",{className:"st-input-confirm-actions",children:[m.jsx("button",{type:"button",onClick:j,children:o("common.cancel")}),m.jsx("button",{type:"button",onClick:z,children:o("session.resumeInputConfirm")})]})]})}),x&&m.jsx("div",{className:"st-copyhint copied",children:"copied ✓"}),!x&&$==="reconnecting"&&m.jsx("div",{className:"st-copyhint reconnecting",children:"reconnecting…"})]})}const N7={Read:"Read",NotebookRead:"Read",Grep:"Searched",Glob:"Searched",WebSearch:"Searched the web",Bash:"Ran",BashOutput:"Read output",Edit:"Edited",MultiEdit:"Edited",NotebookEdit:"Edited",Write:"Wrote",WebFetch:"Fetched",Task:"Delegated to",TodoWrite:"Updated the plan"},ov=t=>N7[t]||t||"tool",L7=["file_path","filePath","path","notebook_path","pattern","query","command","cmd","url","description"];function O7(t){if(typeof t!="string"||!t)return null;let e=null;try{e=JSON.parse(t)}catch{return t.length<=80?t:null}if(!e||typeof e!="object")return typeof e=="string"?e:null;for(const i of L7){const r=e[i];if(typeof r=="string"&&r.trim())return r.trim()}return null}function P7(t){if(!t||!t.includes("/")||/\s/.test(t))return{lead:t,trail:null};const e=t.lastIndexOf("/");return{lead:t.slice(e+1)||t,trail:t.slice(0,e)}}const av=3;function lv(t){const e=new Map;for(const r of t){const s=ov(r.name);e.set(s,(e.get(s)||0)+1)}const i=[...e.entries()];return i.length===1?i[0][0].toLowerCase():i.slice(0,3).map(([r,s])=>`${s} ${r.toLowerCase()}`).join(", ")}function Yp(t){if(!Number.isFinite(t)||t<0)return null;const e=Math.round(t/1e3);if(e<60)return`${e}s`;const i=Math.floor(e/60),r=Math.floor(i/60);return r>0?i%60?`${r}h ${i%60}m`:`${r}h`:e%60?`${i}m ${e%60}s`:`${i}m`}const lr={working:"var(--green)",parked:"var(--green)",asking:"var(--yellow)",review:"var(--yellow)",done:"var(--yellow)",error:"var(--red)",idle:"var(--muted)",starting:"var(--muted)",queued:"var(--muted)","close-pending":"var(--muted)",offline:"var(--muted)",unknown:"var(--yellow)",corrupt:"var(--red)",retired:"var(--muted)"},Au={working:"●",parked:"‖",asking:"?",review:"◑",done:"✓",error:"✕",idle:"·",starting:"◌",queued:"⋯","close-pending":"⊘",offline:"○",unknown:"⁇",corrupt:"⚠",retired:"⚑"},uv=new Set(["asking","review","done","close-pending","error","corrupt"]),o0=t=>{const e=(t==null?void 0:t.status)||"idle";return{zone:t!=null&&t.archived?"archive":uv.has(e)?"need":e==="offline"||e==="retired"?"offline":"run",status:e,color:lr[e]||lr.idle,glyph:Au[e]||Au.idle}},qh=t=>o0(t).zone,cv=t=>!!(t!=null&&t.archived),Xp=t=>cv(t)?"archived":(t==null?void 0:t.status)!=="queued"&&((t==null?void 0:t.status)==="offline"||(t==null?void 0:t.liveness)==="offline")?"offline":"live",lR=(t,e)=>{const i=e?(t||[]).find(r=>r.id===e):null;return i&&i.status!=="offline"&&i.liveness!=="offline"&&!cv(i)?i:null},Jp=t=>(t==null?void 0:t.sortKey)!=null?t.sortKey:(t==null?void 0:t.created)??0,Zp=t=>{const e={need:0,run:1,offline:2,archive:3};return[...t].sort((i,r)=>e[qh(i)]-e[qh(r)]||Jp(r)-Jp(i))};function F7(t){const e=new Map(t.map(a=>[a==null?void 0:a.id,a])),i=new Map,r=new Set,s=(a,l,u)=>{if(i.get(a)==="done")return;if(i.get(a)==="visiting"){const d=u.get(a);if(d!=null)for(const f of l.slice(d))r.add(f);return}const c=e.get(a);if(!c)return;i.set(a,"visiting");const h=c.parent&&c.parent!==a?c.parent:null;if(h&&e.has(h)){const d=[...l,a],f=new Map(u);f.set(a,l.length),s(h,d,f)}i.set(a,"done")};for(const a of t)a!=null&&a.id&&s(a.id,[],new Map);const n=new Map,o=[];for(const a of t){const l=r.has(a==null?void 0:a.id)?null:a!=null&&a.parent&&a.parent!==a.id?a.parent:null,u=l?e.get(l):null,c=u?u.id:null;if(c){const h=n.get(c)||[];h.push(a),n.set(c,h)}else o.push(a)}return{roots:o,childrenOf:n}}function I7(t,e){const i=new Map(t.map(o=>[o==null?void 0:o.id,o])),r=[],s=new Set([e]);let n=i.get(e);for(;n!=null&&n.parent&&!s.has(n.parent);){const o=i.get(n.parent);if(!o)break;r.push(o.id),s.add(o.id),n=o}return r}function z7(t,e){let i=!1,r=!1,s=0;const n=(o,a)=>{for(const l of e.get(o)||[]){if(a.has(l.id))continue;a.add(l.id),s++;const u=o0(l);uv.has(u.status)?i=!0:lr[u.status]===lr.working&&(r=!0),n(l.id,a)}};return n(t,new Set([t])),{color:i?lr.asking:r?lr.working:lr.idle,count:s}}function Tf(t,e,{zoneFolded:i=()=>!1,keepVisible:r=()=>!1}={}){const{roots:s,childrenOf:n}=F7(t),o=[],a=(d,f,p,v)=>{const _=n.get(d.id)||[],w=_.length>0,x=w&&!!e(d.id),C=w?z7(d.id,n):null;if(o.push({type:"row",s:d,depth:f,expandable:w,expanded:x,rollup:(C==null?void 0:C.color)??null,kin:(C==null?void 0:C.count)??0,guides:v}),x){const D=Zp(_).filter(R=>!p.has(R.id));D.forEach((R,E)=>{p.add(R.id),a(R,f+1,p,[...v,E<D.length-1])})}},l=(d,f)=>{let p=1;for(const v of n.get(d.id)||[])f.has(v.id)||(f.add(v.id),p+=l(v,f));return p},u=new Set;let c=null,h=null;for(const d of Zp(s)){if(u.has(d.id))continue;const f=qh(d);if(f!==c&&(h={type:"zone",zone:f,count:0,folded:!!i(f)},o.push(h),c=f),h.count+=l(d,new Set([...u,d.id])),h.folded){const p=[],v=(_,w)=>{r(_)&&!u.has(_.id)&&p.push(_);for(const x of n.get(_.id)||[])w.has(x.id)||(w.add(x.id),v(x,w))};v(d,new Set([d.id]));for(const _ of p)u.add(_.id),o.push({type:"row",s:_,depth:0,expandable:!1,expanded:!1,rollup:null,kin:0,guides:[]});u.add(d.id);continue}u.add(d.id),a(d,0,u,[])}return o}const uR=t=>Tf(t,()=>!0).filter(e=>e.type==="row").map(e=>e.s),Qp={};function j7(t){let e=Qp[t];if(e)return e;e=Qp[t]=[];for(let i=0;i<128;i++){const r=String.fromCharCode(i);e.push(r)}for(let i=0;i<t.length;i++){const r=t.charCodeAt(i);e[r]="%"+("0"+r.toString(16).toUpperCase()).slice(-2)}return e}function ho(t,e){typeof e!="string"&&(e=ho.defaultChars);const i=j7(e);return t.replace(/(%[a-f0-9]{2})+/gi,function(r){let s="";for(let n=0,o=r.length;n<o;n+=3){const a=parseInt(r.slice(n+1,n+3),16);if(a<128){s+=i[a];continue}if((a&224)===192&&n+3<o){const l=parseInt(r.slice(n+4,n+6),16);if((l&192)===128){const u=a<<6&1984|l&63;u<128?s+="��":s+=String.fromCharCode(u),n+=3;continue}}if((a&240)===224&&n+6<o){const l=parseInt(r.slice(n+4,n+6),16),u=parseInt(r.slice(n+7,n+9),16);if((l&192)===128&&(u&192)===128){const c=a<<12&61440|l<<6&4032|u&63;c<2048||c>=55296&&c<=57343?s+="���":s+=String.fromCharCode(c),n+=6;continue}}if((a&248)===240&&n+9<o){const l=parseInt(r.slice(n+4,n+6),16),u=parseInt(r.slice(n+7,n+9),16),c=parseInt(r.slice(n+10,n+12),16);if((l&192)===128&&(u&192)===128&&(c&192)===128){let h=a<<18&1835008|l<<12&258048|u<<6&4032|c&63;h<65536||h>1114111?s+="����":(h-=65536,s+=String.fromCharCode(55296+(h>>10),56320+(h&1023))),n+=9;continue}}s+="�"}return s})}ho.defaultChars=";/?:@&=+$,#";ho.componentChars="";const em={};function H7(t){let e=em[t];if(e)return e;e=em[t]=[];for(let i=0;i<128;i++){const r=String.fromCharCode(i);/^[0-9a-z]$/i.test(r)?e.push(r):e.push("%"+("0"+i.toString(16).toUpperCase()).slice(-2))}for(let i=0;i<t.length;i++)e[t.charCodeAt(i)]=t[i];return e}function Ga(t,e,i){typeof e!="string"&&(i=e,e=Ga.defaultChars),typeof i>"u"&&(i=!0);const r=H7(e);let s="";for(let n=0,o=t.length;n<o;n++){const a=t.charCodeAt(n);if(i&&a===37&&n+2<o&&/^[0-9a-f]{2}$/i.test(t.slice(n+1,n+3))){s+=t.slice(n,n+3),n+=2;continue}if(a<128){s+=r[a];continue}if(a>=55296&&a<=57343){if(a>=55296&&a<=56319&&n+1<o){const l=t.charCodeAt(n+1);if(l>=56320&&l<=57343){s+=encodeURIComponent(t[n]+t[n+1]),n++;continue}}s+="%EF%BF%BD";continue}s+=encodeURIComponent(t[n])}return s}Ga.defaultChars=";/?:@&=+$,-_.!~*'()#";Ga.componentChars="-_.!~*'()";function Bf(t){let e="";return e+=t.protocol||"",e+=t.slashes?"//":"",e+=t.auth?t.auth+"@":"",t.hostname&&t.hostname.indexOf(":")!==-1?e+="["+t.hostname+"]":e+=t.hostname||"",e+=t.port?":"+t.port:"",e+=t.pathname||"",e+=t.search||"",e+=t.hash||"",e}function Eu(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}const $7=/^([a-z0-9.+-]+:)/i,q7=/:[0-9]*$/,W7=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,K7=["<",">",'"',"`"," ","\r",`
40
+ `," "],V7=["{","}","|","\\","^","`"].concat(K7),U7=["'"].concat(V7),tm=["%","/","?",";","#"].concat(U7),im=["/","?","#"],G7=255,rm=/^[+a-z0-9A-Z_-]{0,63}$/,Y7=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,sm={javascript:!0,"javascript:":!0},nm={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Rf(t,e){if(t&&t instanceof Eu)return t;const i=new Eu;return i.parse(t,e),i}Eu.prototype.parse=function(t,e){let i,r,s,n=t;if(n=n.trim(),!e&&t.split("#").length===1){const u=W7.exec(n);if(u)return this.pathname=u[1],u[2]&&(this.search=u[2]),this}let o=$7.exec(n);if(o&&(o=o[0],i=o.toLowerCase(),this.protocol=o,n=n.substr(o.length)),(e||o||n.match(/^\/\/[^@\/]+@[^@\/]+/))&&(s=n.substr(0,2)==="//",s&&!(o&&sm[o])&&(n=n.substr(2),this.slashes=!0)),!sm[o]&&(s||o&&!nm[o])){let u=-1;for(let p=0;p<im.length;p++)r=n.indexOf(im[p]),r!==-1&&(u===-1||r<u)&&(u=r);let c,h;u===-1?h=n.lastIndexOf("@"):h=n.lastIndexOf("@",u),h!==-1&&(c=n.slice(0,h),n=n.slice(h+1),this.auth=c),u=-1;for(let p=0;p<tm.length;p++)r=n.indexOf(tm[p]),r!==-1&&(u===-1||r<u)&&(u=r);u===-1&&(u=n.length),n[u-1]===":"&&u--;const d=n.slice(0,u);n=n.slice(u),this.parseHost(d),this.hostname=this.hostname||"";const f=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!f){const p=this.hostname.split(/\./);for(let v=0,_=p.length;v<_;v++){const w=p[v];if(w&&!w.match(rm)){let x="";for(let C=0,D=w.length;C<D;C++)w.charCodeAt(C)>127?x+="x":x+=w[C];if(!x.match(rm)){const C=p.slice(0,v),D=p.slice(v+1),R=w.match(Y7);R&&(C.push(R[1]),D.unshift(R[2])),D.length&&(n=D.join(".")+n),this.hostname=C.join(".");break}}}}this.hostname.length>G7&&(this.hostname=""),f&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}const a=n.indexOf("#");a!==-1&&(this.hash=n.substr(a),n=n.slice(0,a));const l=n.indexOf("?");return l!==-1&&(this.search=n.substr(l),n=n.slice(0,l)),n&&(this.pathname=n),nm[i]&&this.hostname&&!this.pathname&&(this.pathname=""),this};Eu.prototype.parseHost=function(t){let e=q7.exec(t);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};const X7=Object.freeze(Object.defineProperty({__proto__:null,decode:ho,encode:Ga,format:Bf,parse:Rf},Symbol.toStringTag,{value:"Module"})),hv=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,dv=/[\0-\x1F\x7F-\x9F]/,J7=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,Nf=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,fv=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/,pv=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,Z7=Object.freeze(Object.defineProperty({__proto__:null,Any:hv,Cc:dv,Cf:J7,P:Nf,S:fv,Z:pv},Symbol.toStringTag,{value:"Module"})),Q7=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(t=>t.charCodeAt(0))),ew=new Uint16Array("Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢".split("").map(t=>t.charCodeAt(0)));var rc;const tw=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),iw=(rc=String.fromCodePoint)!==null&&rc!==void 0?rc:function(t){let e="";return t>65535&&(t-=65536,e+=String.fromCharCode(t>>>10&1023|55296),t=56320|t&1023),e+=String.fromCharCode(t),e};function rw(t){var e;return t>=55296&&t<=57343||t>1114111?65533:(e=tw.get(t))!==null&&e!==void 0?e:t}var Jt;(function(t){t[t.NUM=35]="NUM",t[t.SEMI=59]="SEMI",t[t.EQUALS=61]="EQUALS",t[t.ZERO=48]="ZERO",t[t.NINE=57]="NINE",t[t.LOWER_A=97]="LOWER_A",t[t.LOWER_F=102]="LOWER_F",t[t.LOWER_X=120]="LOWER_X",t[t.LOWER_Z=122]="LOWER_Z",t[t.UPPER_A=65]="UPPER_A",t[t.UPPER_F=70]="UPPER_F",t[t.UPPER_Z=90]="UPPER_Z"})(Jt||(Jt={}));const sw=32;var Ps;(function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"})(Ps||(Ps={}));function Wh(t){return t>=Jt.ZERO&&t<=Jt.NINE}function nw(t){return t>=Jt.UPPER_A&&t<=Jt.UPPER_F||t>=Jt.LOWER_A&&t<=Jt.LOWER_F}function ow(t){return t>=Jt.UPPER_A&&t<=Jt.UPPER_Z||t>=Jt.LOWER_A&&t<=Jt.LOWER_Z||Wh(t)}function aw(t){return t===Jt.EQUALS||ow(t)}var Kt;(function(t){t[t.EntityStart=0]="EntityStart",t[t.NumericStart=1]="NumericStart",t[t.NumericDecimal=2]="NumericDecimal",t[t.NumericHex=3]="NumericHex",t[t.NamedEntity=4]="NamedEntity"})(Kt||(Kt={}));var es;(function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict",t[t.Attribute=2]="Attribute"})(es||(es={}));class lw{constructor(e,i,r){this.decodeTree=e,this.emitCodePoint=i,this.errors=r,this.state=Kt.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=es.Strict}startEntity(e){this.decodeMode=e,this.state=Kt.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,i){switch(this.state){case Kt.EntityStart:return e.charCodeAt(i)===Jt.NUM?(this.state=Kt.NumericStart,this.consumed+=1,this.stateNumericStart(e,i+1)):(this.state=Kt.NamedEntity,this.stateNamedEntity(e,i));case Kt.NumericStart:return this.stateNumericStart(e,i);case Kt.NumericDecimal:return this.stateNumericDecimal(e,i);case Kt.NumericHex:return this.stateNumericHex(e,i);case Kt.NamedEntity:return this.stateNamedEntity(e,i)}}stateNumericStart(e,i){return i>=e.length?-1:(e.charCodeAt(i)|sw)===Jt.LOWER_X?(this.state=Kt.NumericHex,this.consumed+=1,this.stateNumericHex(e,i+1)):(this.state=Kt.NumericDecimal,this.stateNumericDecimal(e,i))}addToNumericResult(e,i,r,s){if(i!==r){const n=r-i;this.result=this.result*Math.pow(s,n)+parseInt(e.substr(i,n),s),this.consumed+=n}}stateNumericHex(e,i){const r=i;for(;i<e.length;){const s=e.charCodeAt(i);if(Wh(s)||nw(s))i+=1;else return this.addToNumericResult(e,r,i,16),this.emitNumericEntity(s,3)}return this.addToNumericResult(e,r,i,16),-1}stateNumericDecimal(e,i){const r=i;for(;i<e.length;){const s=e.charCodeAt(i);if(Wh(s))i+=1;else return this.addToNumericResult(e,r,i,10),this.emitNumericEntity(s,2)}return this.addToNumericResult(e,r,i,10),-1}emitNumericEntity(e,i){var r;if(this.consumed<=i)return(r=this.errors)===null||r===void 0||r.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===Jt.SEMI)this.consumed+=1;else if(this.decodeMode===es.Strict)return 0;return this.emitCodePoint(rw(this.result),this.consumed),this.errors&&(e!==Jt.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,i){const{decodeTree:r}=this;let s=r[this.treeIndex],n=(s&Ps.VALUE_LENGTH)>>14;for(;i<e.length;i++,this.excess++){const o=e.charCodeAt(i);if(this.treeIndex=uw(r,s,this.treeIndex+Math.max(1,n),o),this.treeIndex<0)return this.result===0||this.decodeMode===es.Attribute&&(n===0||aw(o))?0:this.emitNotTerminatedNamedEntity();if(s=r[this.treeIndex],n=(s&Ps.VALUE_LENGTH)>>14,n!==0){if(o===Jt.SEMI)return this.emitNamedEntityData(this.treeIndex,n,this.consumed+this.excess);this.decodeMode!==es.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;const{result:i,decodeTree:r}=this,s=(r[i]&Ps.VALUE_LENGTH)>>14;return this.emitNamedEntityData(i,s,this.consumed),(e=this.errors)===null||e===void 0||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,i,r){const{decodeTree:s}=this;return this.emitCodePoint(i===1?s[e]&~Ps.VALUE_LENGTH:s[e+1],r),i===3&&this.emitCodePoint(s[e+2],r),r}end(){var e;switch(this.state){case Kt.NamedEntity:return this.result!==0&&(this.decodeMode!==es.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Kt.NumericDecimal:return this.emitNumericEntity(0,2);case Kt.NumericHex:return this.emitNumericEntity(0,3);case Kt.NumericStart:return(e=this.errors)===null||e===void 0||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Kt.EntityStart:return 0}}}function mv(t){let e="";const i=new lw(t,r=>e+=iw(r));return function(s,n){let o=0,a=0;for(;(a=s.indexOf("&",a))>=0;){e+=s.slice(o,a),i.startEntity(n);const u=i.write(s,a+1);if(u<0){o=a+i.end();break}o=a+u,a=u===0?o+1:o}const l=e+s.slice(o);return e="",l}}function uw(t,e,i,r){const s=(e&Ps.BRANCH_LENGTH)>>7,n=e&Ps.JUMP_TABLE;if(s===0)return n!==0&&r===n?i:-1;if(n){const l=r-n;return l<0||l>=s?-1:t[i+l]-1}let o=i,a=o+s-1;for(;o<=a;){const l=o+a>>>1,u=t[l];if(u<r)o=l+1;else if(u>r)a=l-1;else return t[l+s]}return-1}const gv=mv(Q7);mv(ew);function cw(t,e=es.Legacy){return gv(t,e)}function hw(t){return gv(t,es.Strict)}function dw(t){return Object.prototype.toString.call(t)}function Lf(t){return dw(t)==="[object String]"}const fw=Object.prototype.hasOwnProperty;function pw(t,e){return fw.call(t,e)}function a0(t){return Array.prototype.slice.call(arguments,1).forEach(function(i){if(i){if(typeof i!="object")throw new TypeError(i+"must be object");Object.keys(i).forEach(function(r){t[r]=i[r]})}}),t}function vv(t,e,i){return[].concat(t.slice(0,e),i,t.slice(e+1))}function Of(t){return!(t>=55296&&t<=57343||t>=64976&&t<=65007||(t&65535)===65535||(t&65535)===65534||t>=0&&t<=8||t===11||t>=14&&t<=31||t>=127&&t<=159||t>1114111)}function ka(t){if(t>65535){t-=65536;const e=55296+(t>>10),i=56320+(t&1023);return String.fromCharCode(e,i)}return String.fromCharCode(t)}const bv=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,mw=/&([a-z#][a-z0-9]{1,31});/gi,gw=new RegExp(bv.source+"|"+mw.source,"gi"),vw=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function bw(t,e){if(e.charCodeAt(0)===35&&vw.test(e)){const r=e[1].toLowerCase()==="x"?parseInt(e.slice(2),16):parseInt(e.slice(1),10);return Of(r)?ka(r):t}const i=cw(t);return i!==t?i:t}function _w(t){return t.indexOf("\\")<0?t:t.replace(bv,"$1")}function fo(t){return t.indexOf("\\")<0&&t.indexOf("&")<0?t:t.replace(gw,function(e,i,r){return i||bw(e,r)})}const yw=/[&<>"]/,ww=/[&<>"]/g,xw={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};function Sw(t){return xw[t]}function js(t){return yw.test(t)?t.replace(ww,Sw):t}const kw=/[.?*+^$[\]\\(){}|-]/g;function Cw(t){return t.replace(kw,"\\$&")}function rt(t){switch(t){case 9:case 32:return!0}return!1}function Ca(t){if(t>=8192&&t<=8202)return!0;switch(t){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function _v(t){return Nf.test(t)||fv.test(t)}function Aa(t){return _v(ka(t))}function Ea(t){switch(t){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function l0(t){return t=t.trim().replace(/\s+/g," "),"ẞ".toLowerCase()==="Ṿ"&&(t=t.replace(/ẞ/g,"ß")),t.toLowerCase().toUpperCase()}function om(t){return t===32||t===9||t===10||t===13}function u0(t){let e=0;for(;e<t.length&&om(t.charCodeAt(e));e++);let i=t.length-1;for(;i>=e&&om(t.charCodeAt(i));i--);return t.slice(e,i+1)}const Aw={mdurl:X7,ucmicro:Z7},Ew=Object.freeze(Object.defineProperty({__proto__:null,arrayReplaceAt:vv,asciiTrim:u0,assign:a0,escapeHtml:js,escapeRE:Cw,fromCodePoint:ka,has:pw,isMdAsciiPunct:Ea,isPunctChar:_v,isPunctCharCode:Aa,isSpace:rt,isString:Lf,isValidEntityCode:Of,isWhiteSpace:Ca,lib:Aw,normalizeReference:l0,unescapeAll:fo,unescapeMd:_w},Symbol.toStringTag,{value:"Module"}));function Dw(t,e,i){let r,s,n,o;const a=t.posMax,l=t.pos;for(t.pos=e+1,r=1;t.pos<a;){if(n=t.src.charCodeAt(t.pos),n===93&&(r--,r===0)){s=!0;break}if(o=t.pos,t.md.inline.skipToken(t),n===91){if(o===t.pos-1)r++;else if(i)return t.pos=l,-1}}let u=-1;return s&&(u=t.pos),t.pos=l,u}function Mw(t,e,i){let r,s=e;const n={ok:!1,pos:0,str:""};if(t.charCodeAt(s)===60){for(s++;s<i;){if(r=t.charCodeAt(s),r===10||r===60)return n;if(r===62)return n.pos=s+1,n.str=fo(t.slice(e+1,s)),n.ok=!0,n;if(r===92&&s+1<i){s+=2;continue}s++}return n}let o=0;for(;s<i&&(r=t.charCodeAt(s),!(r===32||r<32||r===127));){if(r===92&&s+1<i){if(t.charCodeAt(s+1)===32)break;s+=2;continue}if(r===40&&(o++,o>32))return n;if(r===41){if(o===0)break;o--}s++}return e===s||o!==0||(n.str=fo(t.slice(e,s)),n.pos=s,n.ok=!0),n}function Tw(t,e,i,r){let s,n=e;const o={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(r)o.str=r.str,o.marker=r.marker;else{if(n>=i)return o;let a=t.charCodeAt(n);if(a!==34&&a!==39&&a!==40)return o;e++,n++,a===40&&(a=41),o.marker=a}for(;n<i;){if(s=t.charCodeAt(n),s===o.marker)return o.pos=n+1,o.str+=fo(t.slice(e,n)),o.ok=!0,o;if(s===40&&o.marker===41)return o;s===92&&n+1<i&&n++,n++}return o.can_continue=!0,o.str+=fo(t.slice(e,n)),o}const Bw=Object.freeze(Object.defineProperty({__proto__:null,parseLinkDestination:Mw,parseLinkLabel:Dw,parseLinkTitle:Tw},Symbol.toStringTag,{value:"Module"})),Wr={};Wr.code_inline=function(t,e,i,r,s){const n=t[e];return"<code"+s.renderAttrs(n)+">"+js(n.content)+"</code>"};Wr.code_block=function(t,e,i,r,s){const n=t[e];return"<pre"+s.renderAttrs(n)+"><code>"+js(t[e].content)+`</code></pre>
41
+ `};Wr.fence=function(t,e,i,r,s){const n=t[e],o=n.info?fo(n.info).trim():"";let a="",l="";if(o){const c=o.split(/(\s+)/g);a=c[0],l=c.slice(2).join("")}let u;if(i.highlight?u=i.highlight(n.content,a,l)||js(n.content):u=js(n.content),u.indexOf("<pre")===0)return u+`
42
+ `;if(o){const c=n.attrIndex("class"),h=n.attrs?n.attrs.slice():[];c<0?h.push(["class",i.langPrefix+a]):(h[c]=h[c].slice(),h[c][1]+=" "+i.langPrefix+a);const d={attrs:h};return`<pre><code${s.renderAttrs(d)}>${u}</code></pre>
43
+ `}return`<pre><code${s.renderAttrs(n)}>${u}</code></pre>
44
+ `};Wr.image=function(t,e,i,r,s){const n=t[e];return n.attrs[n.attrIndex("alt")][1]=s.renderInlineAsText(n.children,i,r),s.renderToken(t,e,i)};Wr.hardbreak=function(t,e,i){return i.xhtmlOut?`<br />
45
+ `:`<br>
46
+ `};Wr.softbreak=function(t,e,i){return i.breaks?i.xhtmlOut?`<br />
47
+ `:`<br>
48
+ `:`
49
+ `};Wr.text=function(t,e){return js(t[e].content)};Wr.html_block=function(t,e){return t[e].content};Wr.html_inline=function(t,e){return t[e].content};function Eo(){this.rules=a0({},Wr)}Eo.prototype.renderAttrs=function(e){let i,r,s;if(!e.attrs)return"";for(s="",i=0,r=e.attrs.length;i<r;i++)s+=" "+js(e.attrs[i][0])+'="'+js(e.attrs[i][1])+'"';return s};Eo.prototype.renderToken=function(e,i,r){const s=e[i];let n="";if(s.hidden)return"";s.block&&s.nesting!==-1&&i&&e[i-1].hidden&&(n+=`
50
+ `),n+=(s.nesting===-1?"</":"<")+s.tag,n+=this.renderAttrs(s),s.nesting===0&&r.xhtmlOut&&(n+=" /");let o=!1;if(s.block&&(o=!0,s.nesting===1&&i+1<e.length)){const a=e[i+1];(a.type==="inline"||a.hidden||a.nesting===-1&&a.tag===s.tag)&&(o=!1)}return n+=o?`>
51
+ `:">",n};Eo.prototype.renderInline=function(t,e,i){let r="";const s=this.rules;for(let n=0,o=t.length;n<o;n++){const a=t[n].type;typeof s[a]<"u"?r+=s[a](t,n,e,i,this):r+=this.renderToken(t,n,e)}return r};Eo.prototype.renderInlineAsText=function(t,e,i){let r="";for(let s=0,n=t.length;s<n;s++)switch(t[s].type){case"text":r+=t[s].content;break;case"image":r+=this.renderInlineAsText(t[s].children,e,i);break;case"html_inline":case"html_block":r+=t[s].content;break;case"softbreak":case"hardbreak":r+=`
52
+ `;break}return r};Eo.prototype.render=function(t,e,i){let r="";const s=this.rules;for(let n=0,o=t.length;n<o;n++){const a=t[n].type;a==="inline"?r+=this.renderInline(t[n].children,e,i):typeof s[a]<"u"?r+=s[a](t,n,e,i,this):r+=this.renderToken(t,n,e,i)}return r};function Ri(){this.__rules__=[],this.__cache__=null}Ri.prototype.__find__=function(t){for(let e=0;e<this.__rules__.length;e++)if(this.__rules__[e].name===t)return e;return-1};Ri.prototype.__compile__=function(){const t=this,e=[""];t.__rules__.forEach(function(i){i.enabled&&i.alt.forEach(function(r){e.indexOf(r)<0&&e.push(r)})}),t.__cache__={},e.forEach(function(i){t.__cache__[i]=[],t.__rules__.forEach(function(r){r.enabled&&(i&&r.alt.indexOf(i)<0||t.__cache__[i].push(r.fn))})})};Ri.prototype.at=function(t,e,i){const r=this.__find__(t),s=i||{};if(r===-1)throw new Error("Parser rule not found: "+t);this.__rules__[r].fn=e,this.__rules__[r].alt=s.alt||[],this.__cache__=null};Ri.prototype.before=function(t,e,i,r){const s=this.__find__(t),n=r||{};if(s===-1)throw new Error("Parser rule not found: "+t);this.__rules__.splice(s,0,{name:e,enabled:!0,fn:i,alt:n.alt||[]}),this.__cache__=null};Ri.prototype.after=function(t,e,i,r){const s=this.__find__(t),n=r||{};if(s===-1)throw new Error("Parser rule not found: "+t);this.__rules__.splice(s+1,0,{name:e,enabled:!0,fn:i,alt:n.alt||[]}),this.__cache__=null};Ri.prototype.push=function(t,e,i){const r=i||{};this.__rules__.push({name:t,enabled:!0,fn:e,alt:r.alt||[]}),this.__cache__=null};Ri.prototype.enable=function(t,e){Array.isArray(t)||(t=[t]);const i=[];return t.forEach(function(r){const s=this.__find__(r);if(s<0){if(e)return;throw new Error("Rules manager: invalid rule name "+r)}this.__rules__[s].enabled=!0,i.push(r)},this),this.__cache__=null,i};Ri.prototype.enableOnly=function(t,e){Array.isArray(t)||(t=[t]),this.__rules__.forEach(function(i){i.enabled=!1}),this.enable(t,e)};Ri.prototype.disable=function(t,e){Array.isArray(t)||(t=[t]);const i=[];return t.forEach(function(r){const s=this.__find__(r);if(s<0){if(e)return;throw new Error("Rules manager: invalid rule name "+r)}this.__rules__[s].enabled=!1,i.push(r)},this),this.__cache__=null,i};Ri.prototype.getRules=function(t){return this.__cache__===null&&this.__compile__(),this.__cache__[t]||[]};function gr(t,e,i){this.type=t,this.tag=e,this.attrs=null,this.map=null,this.nesting=i,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}gr.prototype.attrIndex=function(e){if(!this.attrs)return-1;const i=this.attrs;for(let r=0,s=i.length;r<s;r++)if(i[r][0]===e)return r;return-1};gr.prototype.attrPush=function(e){this.attrs?this.attrs.push(e):this.attrs=[e]};gr.prototype.attrSet=function(e,i){const r=this.attrIndex(e),s=[e,i];r<0?this.attrPush(s):this.attrs[r]=s};gr.prototype.attrGet=function(e){const i=this.attrIndex(e);let r=null;return i>=0&&(r=this.attrs[i][1]),r};gr.prototype.attrJoin=function(e,i){const r=this.attrIndex(e);r<0?this.attrPush([e,i]):this.attrs[r][1]=this.attrs[r][1]+" "+i};function yv(t,e,i){this.src=t,this.env=i,this.tokens=[],this.inlineMode=!1,this.md=e}yv.prototype.Token=gr;const Rw=/\r\n?|\n/g,Nw=/\0/g;function Lw(t){let e;e=t.src.replace(Rw,`
53
+ `),e=e.replace(Nw,"�"),t.src=e}function Ow(t){let e;t.inlineMode?(e=new t.Token("inline","",0),e.content=t.src,e.map=[0,1],e.children=[],t.tokens.push(e)):t.md.block.parse(t.src,t.md,t.env,t.tokens)}function Pw(t){const e=t.tokens;for(let i=0,r=e.length;i<r;i++){const s=e[i];s.type==="inline"&&t.md.inline.parse(s.content,t.md,t.env,s.children)}}function Fw(t){return/^<a[>\s]/i.test(t)}function Iw(t){return/^<\/a\s*>/i.test(t)}function zw(t){const e=t.tokens;if(t.md.options.linkify)for(let i=0,r=e.length;i<r;i++){if(e[i].type!=="inline"||!t.md.linkify.pretest(e[i].content))continue;let s=e[i].children,n=0;for(let o=s.length-1;o>=0;o--){const a=s[o];if(a.type==="link_close"){for(o--;s[o].level!==a.level&&s[o].type!=="link_open";)o--;continue}if(a.type==="html_inline"&&(Fw(a.content)&&n>0&&n--,Iw(a.content)&&n++),!(n>0)&&a.type==="text"&&t.md.linkify.test(a.content)){const l=a.content;let u=t.md.linkify.match(l);const c=[];let h=a.level,d=0;u.length>0&&u[0].index===0&&o>0&&s[o-1].type==="text_special"&&(u=u.slice(1));for(let f=0;f<u.length;f++){const p=u[f].url,v=t.md.normalizeLink(p);if(!t.md.validateLink(v))continue;let _=u[f].text;u[f].schema?u[f].schema==="mailto:"&&!/^mailto:/i.test(_)?_=t.md.normalizeLinkText("mailto:"+_).replace(/^mailto:/,""):_=t.md.normalizeLinkText(_):_=t.md.normalizeLinkText("http://"+_).replace(/^http:\/\//,"");const w=u[f].index;if(w>d){const R=new t.Token("text","",0);R.content=l.slice(d,w),R.level=h,c.push(R)}const x=new t.Token("link_open","a",1);x.attrs=[["href",v]],x.level=h++,x.markup="linkify",x.info="auto",c.push(x);const C=new t.Token("text","",0);C.content=_,C.level=h,c.push(C);const D=new t.Token("link_close","a",-1);D.level=--h,D.markup="linkify",D.info="auto",c.push(D),d=u[f].lastIndex}if(d<l.length){const f=new t.Token("text","",0);f.content=l.slice(d),f.level=h,c.push(f)}e[i].children=s=vv(s,o,c)}}}}const wv=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,jw=/\((c|tm|r)\)/i,Hw=/\((c|tm|r)\)/ig,$w={c:"©",r:"®",tm:"™"};function qw(t,e){return $w[e.toLowerCase()]}function Ww(t){let e=0;for(let i=t.length-1;i>=0;i--){const r=t[i];r.type==="text"&&!e&&(r.content=r.content.replace(Hw,qw)),r.type==="link_open"&&r.info==="auto"&&e--,r.type==="link_close"&&r.info==="auto"&&e++}}function Kw(t){let e=0;for(let i=t.length-1;i>=0;i--){const r=t[i];r.type==="text"&&!e&&wv.test(r.content)&&(r.content=r.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1—").replace(/(^|\s)--(?=\s|$)/mg,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1–")),r.type==="link_open"&&r.info==="auto"&&e--,r.type==="link_close"&&r.info==="auto"&&e++}}function Vw(t){let e;if(t.md.options.typographer)for(e=t.tokens.length-1;e>=0;e--)t.tokens[e].type==="inline"&&(jw.test(t.tokens[e].content)&&Ww(t.tokens[e].children),wv.test(t.tokens[e].content)&&Kw(t.tokens[e].children))}const Uw=/['"]/,am=/['"]/g,lm="’";function vl(t,e,i,r){t[e]||(t[e]=[]),t[e].push({pos:i,ch:r})}function Gw(t,e){let i="",r=0;e.sort((s,n)=>s.pos-n.pos);for(let s=0;s<e.length;s++){const n=e[s];i+=t.slice(r,n.pos)+n.ch,r=n.pos+1}return i+t.slice(r)}function Yw(t,e){let i;const r=[],s={};for(let n=0;n<t.length;n++){const o=t[n],a=t[n].level;for(i=r.length-1;i>=0&&!(r[i].level<=a);i--);if(r.length=i+1,o.type!=="text")continue;const l=o.content;let u=0;const c=l.length;e:for(;u<c;){am.lastIndex=u;const h=am.exec(l);if(!h)break;let d=!0,f=!0;u=h.index+1;const p=h[0]==="'";let v=32;if(h.index-1>=0)v=l.charCodeAt(h.index-1);else for(i=n-1;i>=0&&!(t[i].type==="softbreak"||t[i].type==="hardbreak");i--)if(t[i].content){v=t[i].content.charCodeAt(t[i].content.length-1);break}let _=32;if(u<c)_=l.charCodeAt(u);else for(i=n+1;i<t.length&&!(t[i].type==="softbreak"||t[i].type==="hardbreak");i++)if(t[i].content){_=t[i].content.charCodeAt(0);break}const w=Ea(v)||Aa(v),x=Ea(_)||Aa(_),C=Ca(v),D=Ca(_);if(D?d=!1:x&&(C||w||(d=!1)),C?f=!1:w&&(D||x||(f=!1)),_===34&&h[0]==='"'&&v>=48&&v<=57&&(f=d=!1),d&&f&&(d=w,f=x),!d&&!f){p&&vl(s,n,h.index,lm);continue}if(f)for(i=r.length-1;i>=0;i--){let R=r[i];if(r[i].level<a)break;if(R.single===p&&r[i].level===a){R=r[i];let E,L;p?(E=e.md.options.quotes[2],L=e.md.options.quotes[3]):(E=e.md.options.quotes[0],L=e.md.options.quotes[1]),vl(s,n,h.index,L),vl(s,R.token,R.pos,E),r.length=i;continue e}}d?r.push({token:n,pos:h.index,single:p,level:a}):f&&p&&vl(s,n,h.index,lm)}}Object.keys(s).forEach(function(n){t[n].content=Gw(t[n].content,s[n])})}function Xw(t){if(t.md.options.typographer)for(let e=t.tokens.length-1;e>=0;e--)t.tokens[e].type!=="inline"||!Uw.test(t.tokens[e].content)||Yw(t.tokens[e].children,t)}function Jw(t){let e,i;const r=t.tokens,s=r.length;for(let n=0;n<s;n++){if(r[n].type!=="inline")continue;const o=r[n].children,a=o.length;for(e=0;e<a;e++)o[e].type==="text_special"&&(o[e].type="text");for(e=i=0;e<a;e++)o[e].type==="text"&&e+1<a&&o[e+1].type==="text"?o[e+1].content=o[e].content+o[e+1].content:(e!==i&&(o[i]=o[e]),i++);e!==i&&(o.length=i)}}const sc=[["normalize",Lw],["block",Ow],["inline",Pw],["linkify",zw],["replacements",Vw],["smartquotes",Xw],["text_join",Jw]];function Pf(){this.ruler=new Ri;for(let t=0;t<sc.length;t++)this.ruler.push(sc[t][0],sc[t][1])}Pf.prototype.process=function(t){const e=this.ruler.getRules("");for(let i=0,r=e.length;i<r;i++)e[i](t)};Pf.prototype.State=yv;function Kr(t,e,i,r){this.src=t,this.md=e,this.env=i,this.tokens=r,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType="root",this.level=0;const s=this.src;for(let n=0,o=0,a=0,l=0,u=s.length,c=!1;o<u;o++){const h=s.charCodeAt(o);if(!c)if(rt(h)){a++,h===9?l+=4-l%4:l++;continue}else c=!0;(h===10||o===u-1)&&(h!==10&&o++,this.bMarks.push(n),this.eMarks.push(o),this.tShift.push(a),this.sCount.push(l),this.bsCount.push(0),c=!1,a=0,l=0,n=o+1)}this.bMarks.push(s.length),this.eMarks.push(s.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}Kr.prototype.push=function(t,e,i){const r=new gr(t,e,i);return r.block=!0,i<0&&this.level--,r.level=this.level,i>0&&this.level++,this.tokens.push(r),r};Kr.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]};Kr.prototype.skipEmptyLines=function(e){for(let i=this.lineMax;e<i&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e};Kr.prototype.skipSpaces=function(e){for(let i=this.src.length;e<i;e++){const r=this.src.charCodeAt(e);if(!rt(r))break}return e};Kr.prototype.skipSpacesBack=function(e,i){if(e<=i)return e;for(;e>i;)if(!rt(this.src.charCodeAt(--e)))return e+1;return e};Kr.prototype.skipChars=function(e,i){for(let r=this.src.length;e<r&&this.src.charCodeAt(e)===i;e++);return e};Kr.prototype.skipCharsBack=function(e,i,r){if(e<=r)return e;for(;e>r;)if(i!==this.src.charCodeAt(--e))return e+1;return e};Kr.prototype.getLines=function(e,i,r,s){if(e>=i)return"";const n=new Array(i-e);for(let o=0,a=e;a<i;a++,o++){let l=0;const u=this.bMarks[a];let c=u,h;for(a+1<i||s?h=this.eMarks[a]+1:h=this.eMarks[a];c<h&&l<r;){const d=this.src.charCodeAt(c);if(rt(d))d===9?l+=4-(l+this.bsCount[a])%4:l++;else if(c-u<this.tShift[a])l++;else break;c++}l>r?n[o]=new Array(l-r+1).join(" ")+this.src.slice(c,h):n[o]=this.src.slice(c,h)}return n.join("")};Kr.prototype.Token=gr;const Zw=65536;function nc(t,e){const i=t.bMarks[e]+t.tShift[e],r=t.eMarks[e];return t.src.slice(i,r)}function um(t){const e=[],i=t.length;let r=0,s=t.charCodeAt(r),n=!1,o=0,a="";for(;r<i;)s===124&&(n?(a+=t.substring(o,r-1),o=r):(e.push(a+t.substring(o,r)),a="",o=r+1)),n=s===92,r++,s=t.charCodeAt(r);return e.push(a+t.substring(o)),e}function Qw(t,e,i,r){if(e+2>i)return!1;let s=e+1;if(t.sCount[s]<t.blkIndent||t.sCount[s]-t.blkIndent>=4)return!1;let n=t.bMarks[s]+t.tShift[s];if(n>=t.eMarks[s])return!1;const o=t.src.charCodeAt(n++);if(o!==124&&o!==45&&o!==58||n>=t.eMarks[s])return!1;const a=t.src.charCodeAt(n++);if(a!==124&&a!==45&&a!==58&&!rt(a)||o===45&&rt(a))return!1;for(;n<t.eMarks[s];){const D=t.src.charCodeAt(n);if(D!==124&&D!==45&&D!==58&&!rt(D))return!1;n++}let l=nc(t,e+1),u=l.split("|");const c=[];for(let D=0;D<u.length;D++){const R=u[D].trim();if(!R){if(D===0||D===u.length-1)continue;return!1}if(!/^:?-+:?$/.test(R))return!1;R.charCodeAt(R.length-1)===58?c.push(R.charCodeAt(0)===58?"center":"right"):R.charCodeAt(0)===58?c.push("left"):c.push("")}if(l=nc(t,e).trim(),l.indexOf("|")===-1||t.sCount[e]-t.blkIndent>=4)return!1;u=um(l),u.length&&u[0]===""&&u.shift(),u.length&&u[u.length-1]===""&&u.pop();const h=u.length;if(h===0||h!==c.length)return!1;if(r)return!0;const d=t.parentType;t.parentType="table";const f=t.md.block.ruler.getRules("blockquote"),p=t.push("table_open","table",1),v=[e,0];p.map=v;const _=t.push("thead_open","thead",1);_.map=[e,e+1];const w=t.push("tr_open","tr",1);w.map=[e,e+1];for(let D=0;D<u.length;D++){const R=t.push("th_open","th",1);c[D]&&(R.attrs=[["style","text-align:"+c[D]]]);const E=t.push("inline","",0);E.content=u[D].trim(),E.children=[],t.push("th_close","th",-1)}t.push("tr_close","tr",-1),t.push("thead_close","thead",-1);let x,C=0;for(s=e+2;s<i&&!(t.sCount[s]<t.blkIndent);s++){let D=!1;for(let E=0,L=f.length;E<L;E++)if(f[E](t,s,i,!0)){D=!0;break}if(D||(l=nc(t,s).trim(),!l)||t.sCount[s]-t.blkIndent>=4||(u=um(l),u.length&&u[0]===""&&u.shift(),u.length&&u[u.length-1]===""&&u.pop(),C+=h-u.length,C>Zw))break;if(s===e+2){const E=t.push("tbody_open","tbody",1);E.map=x=[e+2,0]}const R=t.push("tr_open","tr",1);R.map=[s,s+1];for(let E=0;E<h;E++){const L=t.push("td_open","td",1);c[E]&&(L.attrs=[["style","text-align:"+c[E]]]);const q=t.push("inline","",0);q.content=u[E]?u[E].trim():"",q.children=[],t.push("td_close","td",-1)}t.push("tr_close","tr",-1)}return x&&(t.push("tbody_close","tbody",-1),x[1]=s),t.push("table_close","table",-1),v[1]=s,t.parentType=d,t.line=s,!0}function ex(t,e,i){if(t.sCount[e]-t.blkIndent<4)return!1;let r=e+1,s=r;for(;r<i;){if(t.isEmpty(r)){r++;continue}if(t.sCount[r]-t.blkIndent>=4){r++,s=r;continue}break}t.line=s;const n=t.push("code_block","code",0);return n.content=t.getLines(e,s,4+t.blkIndent,!1)+`
54
+ `,n.map=[e,t.line],!0}function tx(t,e,i,r){let s=t.bMarks[e]+t.tShift[e],n=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||s+3>n)return!1;const o=t.src.charCodeAt(s);if(o!==126&&o!==96)return!1;let a=s;s=t.skipChars(s,o);let l=s-a;if(l<3)return!1;const u=t.src.slice(a,s),c=t.src.slice(s,n);if(o===96&&c.indexOf(String.fromCharCode(o))>=0)return!1;if(r)return!0;let h=e,d=!1;for(;h++,!(h>=i||(s=a=t.bMarks[h]+t.tShift[h],n=t.eMarks[h],s<n&&t.sCount[h]<t.blkIndent));)if(t.src.charCodeAt(s)===o&&!(t.sCount[h]-t.blkIndent>=4)&&(s=t.skipChars(s,o),!(s-a<l)&&(s=t.skipSpaces(s),!(s<n)))){d=!0;break}l=t.sCount[e],t.line=h+(d?1:0);const f=t.push("fence","code",0);return f.info=c,f.content=t.getLines(e+1,h,l,!0),f.markup=u,f.map=[e,t.line],!0}function ix(t,e,i,r){let s=t.bMarks[e]+t.tShift[e],n=t.eMarks[e];const o=t.lineMax;if(t.sCount[e]-t.blkIndent>=4||t.src.charCodeAt(s)!==62)return!1;if(r)return!0;const a=[],l=[],u=[],c=[],h=t.md.block.ruler.getRules("blockquote"),d=t.parentType;t.parentType="blockquote";let f=!1,p;for(p=e;p<i;p++){const C=t.sCount[p]<t.blkIndent;if(s=t.bMarks[p]+t.tShift[p],n=t.eMarks[p],s>=n)break;if(t.src.charCodeAt(s++)===62&&!C){let R=t.sCount[p]+1,E,L;t.src.charCodeAt(s)===32?(s++,R++,L=!1,E=!0):t.src.charCodeAt(s)===9?(E=!0,(t.bsCount[p]+R)%4===3?(s++,R++,L=!1):L=!0):E=!1;let q=R;for(a.push(t.bMarks[p]),t.bMarks[p]=s;s<n;){const F=t.src.charCodeAt(s);if(rt(F))F===9?q+=4-(q+t.bsCount[p]+(L?1:0))%4:q++;else break;s++}f=s>=n,l.push(t.bsCount[p]),t.bsCount[p]=t.sCount[p]+1+(E?1:0),u.push(t.sCount[p]),t.sCount[p]=q-R,c.push(t.tShift[p]),t.tShift[p]=s-t.bMarks[p];continue}if(f)break;let D=!1;for(let R=0,E=h.length;R<E;R++)if(h[R](t,p,i,!0)){D=!0;break}if(D){t.lineMax=p,t.blkIndent!==0&&(a.push(t.bMarks[p]),l.push(t.bsCount[p]),c.push(t.tShift[p]),u.push(t.sCount[p]),t.sCount[p]-=t.blkIndent);break}a.push(t.bMarks[p]),l.push(t.bsCount[p]),c.push(t.tShift[p]),u.push(t.sCount[p]),t.sCount[p]=-1}const v=t.blkIndent;t.blkIndent=0;const _=t.push("blockquote_open","blockquote",1);_.markup=">";const w=[e,0];_.map=w,t.md.block.tokenize(t,e,p);const x=t.push("blockquote_close","blockquote",-1);x.markup=">",t.lineMax=o,t.parentType=d,w[1]=t.line;for(let C=0;C<c.length;C++)t.bMarks[C+e]=a[C],t.tShift[C+e]=c[C],t.sCount[C+e]=u[C],t.bsCount[C+e]=l[C];return t.blkIndent=v,!0}function rx(t,e,i,r){const s=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;let n=t.bMarks[e]+t.tShift[e];const o=t.src.charCodeAt(n++);if(o!==42&&o!==45&&o!==95)return!1;let a=1;for(;n<s;){const u=t.src.charCodeAt(n++);if(u!==o&&!rt(u))return!1;u===o&&a++}if(a<3)return!1;if(r)return!0;t.line=e+1;const l=t.push("hr","hr",0);return l.map=[e,t.line],l.markup=Array(a+1).join(String.fromCharCode(o)),!0}function cm(t,e){const i=t.eMarks[e];let r=t.bMarks[e]+t.tShift[e];const s=t.src.charCodeAt(r++);if(s!==42&&s!==45&&s!==43)return-1;if(r<i){const n=t.src.charCodeAt(r);if(!rt(n))return-1}return r}function hm(t,e){const i=t.bMarks[e]+t.tShift[e],r=t.eMarks[e];let s=i;if(s+1>=r)return-1;let n=t.src.charCodeAt(s++);if(n<48||n>57)return-1;for(;;){if(s>=r)return-1;if(n=t.src.charCodeAt(s++),n>=48&&n<=57){if(s-i>=10)return-1;continue}if(n===41||n===46)break;return-1}return s<r&&(n=t.src.charCodeAt(s),!rt(n))?-1:s}function sx(t,e){const i=t.level+2;for(let r=e+2,s=t.tokens.length-2;r<s;r++)t.tokens[r].level===i&&t.tokens[r].type==="paragraph_open"&&(t.tokens[r+2].hidden=!0,t.tokens[r].hidden=!0,r+=2)}function nx(t,e,i,r){let s,n,o,a,l=e,u=!0;if(t.sCount[l]-t.blkIndent>=4||t.listIndent>=0&&t.sCount[l]-t.listIndent>=4&&t.sCount[l]<t.blkIndent)return!1;let c=!1;r&&t.parentType==="paragraph"&&t.sCount[l]>=t.blkIndent&&(c=!0);let h,d,f;if((f=hm(t,l))>=0){if(h=!0,o=t.bMarks[l]+t.tShift[l],d=Number(t.src.slice(o,f-1)),c&&d!==1)return!1}else if((f=cm(t,l))>=0)h=!1;else return!1;if(c&&t.skipSpaces(f)>=t.eMarks[l])return!1;if(r)return!0;const p=t.src.charCodeAt(f-1),v=t.tokens.length;h?(a=t.push("ordered_list_open","ol",1),d!==1&&(a.attrs=[["start",d]])):a=t.push("bullet_list_open","ul",1);const _=[l,0];a.map=_,a.markup=String.fromCharCode(p);let w=!1;const x=t.md.block.ruler.getRules("list"),C=t.parentType;for(t.parentType="list";l<i;){n=f,s=t.eMarks[l];const D=t.sCount[l]+f-(t.bMarks[l]+t.tShift[l]);let R=D;for(;n<s;){const O=t.src.charCodeAt(n);if(O===9)R+=4-(R+t.bsCount[l])%4;else if(O===32)R++;else break;n++}const E=n;let L;E>=s?L=1:L=R-D,L>4&&(L=1);const q=D+L;a=t.push("list_item_open","li",1),a.markup=String.fromCharCode(p);const F=[l,0];a.map=F,h&&(a.info=t.src.slice(o,f-1));const $=t.tight,W=t.tShift[l],z=t.sCount[l],j=t.listIndent;if(t.listIndent=t.blkIndent,t.blkIndent=q,t.tight=!0,t.tShift[l]=E-t.bMarks[l],t.sCount[l]=R,E>=s&&t.isEmpty(l+1)?t.line=Math.min(t.line+2,i):t.md.block.tokenize(t,l,i,!0),(!t.tight||w)&&(u=!1),w=t.line-l>1&&t.isEmpty(t.line-1),t.blkIndent=t.listIndent,t.listIndent=j,t.tShift[l]=W,t.sCount[l]=z,t.tight=$,a=t.push("list_item_close","li",-1),a.markup=String.fromCharCode(p),l=t.line,F[1]=l,l>=i||t.sCount[l]<t.blkIndent||t.sCount[l]-t.blkIndent>=4)break;let A=!1;for(let O=0,T=x.length;O<T;O++)if(x[O](t,l,i,!0)){A=!0;break}if(A)break;if(h){if(f=hm(t,l),f<0)break;o=t.bMarks[l]+t.tShift[l]}else if(f=cm(t,l),f<0)break;if(p!==t.src.charCodeAt(f-1))break}return h?a=t.push("ordered_list_close","ol",-1):a=t.push("bullet_list_close","ul",-1),a.markup=String.fromCharCode(p),_[1]=l,t.line=l,t.parentType=C,u&&sx(t,v),!0}function ox(t,e,i,r){let s=t.bMarks[e]+t.tShift[e],n=t.eMarks[e],o=e+1;if(t.sCount[e]-t.blkIndent>=4||t.src.charCodeAt(s)!==91)return!1;function a(x){const C=t.lineMax;if(x>=C||t.isEmpty(x))return null;let D=!1;if(t.sCount[x]-t.blkIndent>3&&(D=!0),t.sCount[x]<0&&(D=!0),!D){const L=t.md.block.ruler.getRules("reference"),q=t.parentType;t.parentType="reference";let F=!1;for(let $=0,W=L.length;$<W;$++)if(L[$](t,x,C,!0)){F=!0;break}if(t.parentType=q,F)return null}const R=t.bMarks[x]+t.tShift[x],E=t.eMarks[x];return t.src.slice(R,E+1)}let l=t.src.slice(s,n+1);n=l.length;let u=-1;for(s=1;s<n;s++){const x=l.charCodeAt(s);if(x===91)return!1;if(x===93){u=s;break}else if(x===10){const C=a(o);C!==null&&(l+=C,n=l.length,o++)}else if(x===92&&(s++,s<n&&l.charCodeAt(s)===10)){const C=a(o);C!==null&&(l+=C,n=l.length,o++)}}if(u<0||l.charCodeAt(u+1)!==58)return!1;for(s=u+2;s<n;s++){const x=l.charCodeAt(s);if(x===10){const C=a(o);C!==null&&(l+=C,n=l.length,o++)}else if(!rt(x))break}const c=t.md.helpers.parseLinkDestination(l,s,n);if(!c.ok)return!1;const h=t.md.normalizeLink(c.str);if(!t.md.validateLink(h))return!1;s=c.pos;const d=s,f=o,p=s;for(;s<n;s++){const x=l.charCodeAt(s);if(x===10){const C=a(o);C!==null&&(l+=C,n=l.length,o++)}else if(!rt(x))break}let v=t.md.helpers.parseLinkTitle(l,s,n);for(;v.can_continue;){const x=a(o);if(x===null)break;l+=x,s=n,n=l.length,o++,v=t.md.helpers.parseLinkTitle(l,s,n,v)}let _;for(s<n&&p!==s&&v.ok?(_=v.str,s=v.pos):(_="",s=d,o=f);s<n;){const x=l.charCodeAt(s);if(!rt(x))break;s++}if(s<n&&l.charCodeAt(s)!==10&&_)for(_="",s=d,o=f;s<n;){const x=l.charCodeAt(s);if(!rt(x))break;s++}if(s<n&&l.charCodeAt(s)!==10)return!1;const w=l0(l.slice(1,u));return w?(r||(typeof t.env.references>"u"&&(t.env.references={}),typeof t.env.references[w]>"u"&&(t.env.references[w]={title:_,href:h}),t.line=o),!0):!1}const ax=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],lx="[a-zA-Z_:][a-zA-Z0-9:._-]*",ux="[^\"'=<>`\\x00-\\x20]+",cx="'[^']*'",hx='"[^"]*"',dx="(?:"+ux+"|"+cx+"|"+hx+")",fx="(?:\\s+"+lx+"(?:\\s*=\\s*"+dx+")?)",xv="<[A-Za-z][A-Za-z0-9\\-]*"+fx+"*\\s*\\/?>",Sv="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",px="<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->",mx="<[?][\\s\\S]*?[?]>",gx="<![A-Za-z][^>]*>",vx="<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",bx=new RegExp("^(?:"+xv+"|"+Sv+"|"+px+"|"+mx+"|"+gx+"|"+vx+")"),_x=new RegExp("^(?:"+xv+"|"+Sv+")"),on=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+ax.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(_x.source+"\\s*$"),/^$/,!1]];function yx(t,e,i,r){let s=t.bMarks[e]+t.tShift[e],n=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||!t.md.options.html||t.src.charCodeAt(s)!==60)return!1;let o=t.src.slice(s,n),a=0;for(;a<on.length&&!on[a][0].test(o);a++);if(a===on.length)return!1;if(r)return on[a][2];let l=e+1;const u=on[a][1].test("");if(!on[a][1].test(o)){for(;l<i&&!(t.sCount[l]<t.blkIndent&&(u||!t.isEmpty(l)));l++)if(s=t.bMarks[l]+t.tShift[l],n=t.eMarks[l],o=t.src.slice(s,n),on[a][1].test(o)){o.length!==0&&l++;break}}t.line=l;const c=t.push("html_block","",0);return c.map=[e,l],c.content=t.getLines(e,l,t.blkIndent,!0),!0}function wx(t,e,i,r){let s=t.bMarks[e]+t.tShift[e],n=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;let o=t.src.charCodeAt(s);if(o!==35||s>=n)return!1;let a=1;for(o=t.src.charCodeAt(++s);o===35&&s<n&&a<=6;)a++,o=t.src.charCodeAt(++s);if(a>6||s<n&&!rt(o))return!1;if(r)return!0;n=t.skipSpacesBack(n,s);const l=t.skipCharsBack(n,35,s);l>s&&rt(t.src.charCodeAt(l-1))&&(n=l),t.line=e+1;const u=t.push("heading_open","h"+String(a),1);u.markup="########".slice(0,a),u.map=[e,t.line];const c=t.push("inline","",0);c.content=u0(t.src.slice(s,n)),c.map=[e,t.line],c.children=[];const h=t.push("heading_close","h"+String(a),-1);return h.markup="########".slice(0,a),!0}function xx(t,e,i){const r=t.md.block.ruler.getRules("paragraph");if(t.sCount[e]-t.blkIndent>=4)return!1;const s=t.parentType;t.parentType="paragraph";let n=0,o,a=e+1;for(;a<i&&!t.isEmpty(a);a++){if(t.sCount[a]-t.blkIndent>3)continue;if(t.sCount[a]>=t.blkIndent){let f=t.bMarks[a]+t.tShift[a];const p=t.eMarks[a];if(f<p&&(o=t.src.charCodeAt(f),(o===45||o===61)&&(f=t.skipChars(f,o),f=t.skipSpaces(f),f>=p))){n=o===61?1:2;break}}if(t.sCount[a]<0)continue;let d=!1;for(let f=0,p=r.length;f<p;f++)if(r[f](t,a,i,!0)){d=!0;break}if(d)break}if(!n)return t.parentType=s,!1;const l=u0(t.getLines(e,a,t.blkIndent,!1));t.line=a+1;const u=t.push("heading_open","h"+String(n),1);u.markup=String.fromCharCode(o),u.map=[e,t.line];const c=t.push("inline","",0);c.content=l,c.map=[e,t.line-1],c.children=[];const h=t.push("heading_close","h"+String(n),-1);return h.markup=String.fromCharCode(o),t.parentType=s,!0}function Sx(t,e,i){const r=t.md.block.ruler.getRules("paragraph"),s=t.parentType;let n=e+1;for(t.parentType="paragraph";n<i&&!t.isEmpty(n);n++){if(t.sCount[n]-t.blkIndent>3||t.sCount[n]<0)continue;let u=!1;for(let c=0,h=r.length;c<h;c++)if(r[c](t,n,i,!0)){u=!0;break}if(u)break}const o=u0(t.getLines(e,n,t.blkIndent,!1));t.line=n;const a=t.push("paragraph_open","p",1);a.map=[e,t.line];const l=t.push("inline","",0);return l.content=o,l.map=[e,t.line],l.children=[],t.push("paragraph_close","p",-1),t.parentType=s,!0}const bl=[["table",Qw,["paragraph","reference"]],["code",ex],["fence",tx,["paragraph","reference","blockquote","list"]],["blockquote",ix,["paragraph","reference","blockquote","list"]],["hr",rx,["paragraph","reference","blockquote","list"]],["list",nx,["paragraph","reference","blockquote"]],["reference",ox],["html_block",yx,["paragraph","reference","blockquote"]],["heading",wx,["paragraph","reference","blockquote"]],["lheading",xx],["paragraph",Sx]];function c0(){this.ruler=new Ri;for(let t=0;t<bl.length;t++)this.ruler.push(bl[t][0],bl[t][1],{alt:(bl[t][2]||[]).slice()})}c0.prototype.tokenize=function(t,e,i){const r=this.ruler.getRules(""),s=r.length,n=t.md.options.maxNesting;let o=e,a=!1;for(;o<i&&(t.line=o=t.skipEmptyLines(o),!(o>=i||t.sCount[o]<t.blkIndent));){if(t.level>=n){t.line=i;break}const l=t.line;let u=!1;for(let c=0;c<s;c++)if(u=r[c](t,o,i,!1),u){if(l>=t.line)throw new Error("block rule didn't increment state.line");break}if(!u)throw new Error("none of the block rules matched");t.tight=!a,t.isEmpty(t.line-1)&&(a=!0),o=t.line,o<i&&t.isEmpty(o)&&(a=!0,o++,t.line=o)}};c0.prototype.parse=function(t,e,i,r){if(!t)return;const s=new this.State(t,e,i,r);this.tokenize(s,s.line,s.lineMax)};c0.prototype.State=Kr;function Ya(t,e,i,r){this.src=t,this.env=i,this.md=e,this.tokens=r,this.tokens_meta=Array(r.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0}Ya.prototype.pushPending=function(){const t=new gr("text","",0);return t.content=this.pending,t.level=this.pendingLevel,this.tokens.push(t),this.pending="",t};Ya.prototype.push=function(t,e,i){this.pending&&this.pushPending();const r=new gr(t,e,i);let s=null;return i<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,i>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],s={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(s),r};Ya.prototype.scanDelims=function(t,e){const i=this.posMax,r=this.src.charCodeAt(t);let s;if(t===0)s=32;else if(t===1)s=this.src.charCodeAt(0),(s&63488)===55296&&(s=65533);else if(s=this.src.charCodeAt(t-1),(s&64512)===56320){const _=this.src.charCodeAt(t-2);s=(_&64512)===55296?65536+(_-55296<<10)+(s-56320):65533}else(s&64512)===55296&&(s=65533);let n=t;for(;n<i&&this.src.charCodeAt(n)===r;)n++;const o=n-t;let a=n<i?this.src.charCodeAt(n):32;if((a&64512)===55296){const _=this.src.charCodeAt(n+1);a=(_&64512)===56320?65536+(a-55296<<10)+(_-56320):65533}else(a&64512)===56320&&(a=65533);const l=Ea(s)||Aa(s),u=Ea(a)||Aa(a),c=Ca(s),h=Ca(a),d=!h&&(!u||c||l),f=!c&&(!l||h||u);return{can_open:d&&(e||!f||l),can_close:f&&(e||!d||u),length:o}};Ya.prototype.Token=gr;function kx(t){switch(t){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function Cx(t,e){let i=t.pos;for(;i<t.posMax&&!kx(t.src.charCodeAt(i));)i++;return i===t.pos?!1:(e||(t.pending+=t.src.slice(t.pos,i)),t.pos=i,!0)}const Ax=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function Ex(t,e){if(!t.md.options.linkify||t.linkLevel>0)return!1;const i=t.pos,r=t.posMax;if(i+3>r||t.src.charCodeAt(i)!==58||t.src.charCodeAt(i+1)!==47||t.src.charCodeAt(i+2)!==47)return!1;const s=t.pending.match(Ax);if(!s)return!1;const n=s[1],o=t.md.linkify.matchAtStart(t.src.slice(i-n.length));if(!o)return!1;let a=o.url;if(a.length<=n.length)return!1;let l=a.length;for(;l>0&&a.charCodeAt(l-1)===42;)l--;l!==a.length&&(a=a.slice(0,l));const u=t.md.normalizeLink(a);if(!t.md.validateLink(u))return!1;if(!e){t.pending=t.pending.slice(0,-n.length);const c=t.push("link_open","a",1);c.attrs=[["href",u]],c.markup="linkify",c.info="auto";const h=t.push("text","",0);h.content=t.md.normalizeLinkText(a);const d=t.push("link_close","a",-1);d.markup="linkify",d.info="auto"}return t.pos+=a.length-n.length,!0}function Dx(t,e){let i=t.pos;if(t.src.charCodeAt(i)!==10)return!1;const r=t.pending.length-1,s=t.posMax;if(!e)if(r>=0&&t.pending.charCodeAt(r)===32)if(r>=1&&t.pending.charCodeAt(r-1)===32){let n=r-1;for(;n>=1&&t.pending.charCodeAt(n-1)===32;)n--;t.pending=t.pending.slice(0,n),t.push("hardbreak","br",0)}else t.pending=t.pending.slice(0,-1),t.push("softbreak","br",0);else t.push("softbreak","br",0);for(i++;i<s&&rt(t.src.charCodeAt(i));)i++;return t.pos=i,!0}const Ff=[];for(let t=0;t<256;t++)Ff.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(t){Ff[t.charCodeAt(0)]=1});function Mx(t,e){let i=t.pos;const r=t.posMax;if(t.src.charCodeAt(i)!==92||(i++,i>=r))return!1;let s=t.src.charCodeAt(i);if(s===10){for(e||t.push("hardbreak","br",0),i++;i<r&&(s=t.src.charCodeAt(i),!!rt(s));)i++;return t.pos=i,!0}if(s===32){if(!e){const a=t.push("text_special","",0);a.content="\\",a.markup="\\",a.info="escape"}return t.pos=i,!0}let n=t.src[i];if(s>=55296&&s<=56319&&i+1<r){const a=t.src.charCodeAt(i+1);a>=56320&&a<=57343&&(n+=t.src[i+1],i++)}const o="\\"+n;if(!e){const a=t.push("text_special","",0);s<256&&Ff[s]!==0?a.content=n:a.content=o,a.markup=o,a.info="escape"}return t.pos=i+1,!0}function Tx(t,e){let i=t.pos;if(t.src.charCodeAt(i)!==96)return!1;const s=i;i++;const n=t.posMax;for(;i<n&&t.src.charCodeAt(i)===96;)i++;const o=t.src.slice(s,i),a=o.length;if(t.backticksScanned&&(t.backticks[a]||0)<=s)return e||(t.pending+=o),t.pos+=a,!0;let l=i,u;for(;(u=t.src.indexOf("`",l))!==-1;){for(l=u+1;l<n&&t.src.charCodeAt(l)===96;)l++;const c=l-u;if(c===a){if(!e){const h=t.push("code_inline","code",0);h.markup=o,h.content=t.src.slice(i,u).replace(/\n/g," ").replace(/^ (.+) $/,"$1")}return t.pos=l,!0}t.backticks[c]=u}return t.backticksScanned=!0,e||(t.pending+=o),t.pos+=a,!0}function Bx(t,e){const i=t.pos,r=t.src.charCodeAt(i);if(e||r!==126)return!1;const s=t.scanDelims(t.pos,!0);let n=s.length;const o=String.fromCharCode(r);if(n<2)return!1;let a;n%2&&(a=t.push("text","",0),a.content=o,n--);for(let l=0;l<n;l+=2)a=t.push("text","",0),a.content=o+o,t.delimiters.push({marker:r,length:0,token:t.tokens.length-1,end:-1,open:s.can_open,close:s.can_close});return t.pos+=s.length,!0}function dm(t,e){let i;const r=[],s=e.length;for(let n=0;n<s;n++){const o=e[n];if(o.marker!==126||o.end===-1)continue;const a=e[o.end];i=t.tokens[o.token],i.type="s_open",i.tag="s",i.nesting=1,i.markup="~~",i.content="",i=t.tokens[a.token],i.type="s_close",i.tag="s",i.nesting=-1,i.markup="~~",i.content="",t.tokens[a.token-1].type==="text"&&t.tokens[a.token-1].content==="~"&&r.push(a.token-1)}for(;r.length;){const n=r.pop();let o=n+1;for(;o<t.tokens.length&&t.tokens[o].type==="s_close";)o++;o--,n!==o&&(i=t.tokens[o],t.tokens[o]=t.tokens[n],t.tokens[n]=i)}}function Rx(t){const e=t.tokens_meta,i=t.tokens_meta.length;dm(t,t.delimiters);for(let r=0;r<i;r++)e[r]&&e[r].delimiters&&dm(t,e[r].delimiters)}const kv={tokenize:Bx,postProcess:Rx};function Nx(t,e){const i=t.pos,r=t.src.charCodeAt(i);if(e||r!==95&&r!==42)return!1;const s=t.scanDelims(t.pos,r===42);for(let n=0;n<s.length;n++){const o=t.push("text","",0);o.content=String.fromCharCode(r),t.delimiters.push({marker:r,length:s.length,token:t.tokens.length-1,end:-1,open:s.can_open,close:s.can_close})}return t.pos+=s.length,!0}function fm(t,e){const i=e.length;for(let r=i-1;r>=0;r--){const s=e[r];if(s.marker!==95&&s.marker!==42||s.end===-1)continue;const n=e[s.end],o=r>0&&e[r-1].end===s.end+1&&e[r-1].marker===s.marker&&e[r-1].token===s.token-1&&e[s.end+1].token===n.token+1,a=String.fromCharCode(s.marker),l=t.tokens[s.token];l.type=o?"strong_open":"em_open",l.tag=o?"strong":"em",l.nesting=1,l.markup=o?a+a:a,l.content="";const u=t.tokens[n.token];u.type=o?"strong_close":"em_close",u.tag=o?"strong":"em",u.nesting=-1,u.markup=o?a+a:a,u.content="",o&&(t.tokens[e[r-1].token].content="",t.tokens[e[s.end+1].token].content="",r--)}}function Lx(t){const e=t.tokens_meta,i=t.tokens_meta.length;fm(t,t.delimiters);for(let r=0;r<i;r++)e[r]&&e[r].delimiters&&fm(t,e[r].delimiters)}const Cv={tokenize:Nx,postProcess:Lx};function Ox(t,e){let i,r,s,n,o="",a="",l=t.pos,u=!0;if(t.src.charCodeAt(t.pos)!==91)return!1;const c=t.pos,h=t.posMax,d=t.pos+1,f=t.md.helpers.parseLinkLabel(t,t.pos,!0);if(f<0)return!1;let p=f+1;if(p<h&&t.src.charCodeAt(p)===40){for(u=!1,p++;p<h&&(i=t.src.charCodeAt(p),!(!rt(i)&&i!==10));p++);if(p>=h)return!1;if(l=p,s=t.md.helpers.parseLinkDestination(t.src,p,t.posMax),s.ok){for(o=t.md.normalizeLink(s.str),t.md.validateLink(o)?p=s.pos:o="",l=p;p<h&&(i=t.src.charCodeAt(p),!(!rt(i)&&i!==10));p++);if(s=t.md.helpers.parseLinkTitle(t.src,p,t.posMax),p<h&&l!==p&&s.ok)for(a=s.str,p=s.pos;p<h&&(i=t.src.charCodeAt(p),!(!rt(i)&&i!==10));p++);}(p>=h||t.src.charCodeAt(p)!==41)&&(u=!0),p++}if(u){if(typeof t.env.references>"u")return!1;if(p<h&&t.src.charCodeAt(p)===91?(l=p+1,p=t.md.helpers.parseLinkLabel(t,p),p>=0?r=t.src.slice(l,p++):p=f+1):p=f+1,r||(r=t.src.slice(d,f)),n=t.env.references[l0(r)],!n)return t.pos=c,!1;o=n.href,a=n.title}if(!e){t.pos=d,t.posMax=f;const v=t.push("link_open","a",1),_=[["href",o]];v.attrs=_,a&&_.push(["title",a]),t.linkLevel++,t.md.inline.tokenize(t),t.linkLevel--,t.push("link_close","a",-1)}return t.pos=p,t.posMax=h,!0}function Px(t,e){let i,r,s,n,o,a,l,u,c="";const h=t.pos,d=t.posMax;if(t.src.charCodeAt(t.pos)!==33||t.src.charCodeAt(t.pos+1)!==91)return!1;const f=t.pos+2,p=t.md.helpers.parseLinkLabel(t,t.pos+1,!1);if(p<0)return!1;if(n=p+1,n<d&&t.src.charCodeAt(n)===40){for(n++;n<d&&(i=t.src.charCodeAt(n),!(!rt(i)&&i!==10));n++);if(n>=d)return!1;for(u=n,a=t.md.helpers.parseLinkDestination(t.src,n,t.posMax),a.ok&&(c=t.md.normalizeLink(a.str),t.md.validateLink(c)?n=a.pos:c=""),u=n;n<d&&(i=t.src.charCodeAt(n),!(!rt(i)&&i!==10));n++);if(a=t.md.helpers.parseLinkTitle(t.src,n,t.posMax),n<d&&u!==n&&a.ok)for(l=a.str,n=a.pos;n<d&&(i=t.src.charCodeAt(n),!(!rt(i)&&i!==10));n++);else l="";if(n>=d||t.src.charCodeAt(n)!==41)return t.pos=h,!1;n++}else{if(typeof t.env.references>"u")return!1;if(n<d&&t.src.charCodeAt(n)===91?(u=n+1,n=t.md.helpers.parseLinkLabel(t,n),n>=0?s=t.src.slice(u,n++):n=p+1):n=p+1,s||(s=t.src.slice(f,p)),o=t.env.references[l0(s)],!o)return t.pos=h,!1;c=o.href,l=o.title}if(!e){r=t.src.slice(f,p);const v=[];t.md.inline.parse(r,t.md,t.env,v);const _=t.push("image","img",0),w=[["src",c],["alt",""]];_.attrs=w,_.children=v,_.content=r,l&&w.push(["title",l])}return t.pos=n,t.posMax=d,!0}const Fx=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,Ix=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function zx(t,e){let i=t.pos;if(t.src.charCodeAt(i)!==60)return!1;const r=t.pos,s=t.posMax;for(;;){if(++i>=s)return!1;const o=t.src.charCodeAt(i);if(o===60)return!1;if(o===62)break}const n=t.src.slice(r+1,i);if(Ix.test(n)){const o=t.md.normalizeLink(n);if(!t.md.validateLink(o))return!1;if(!e){const a=t.push("link_open","a",1);a.attrs=[["href",o]],a.markup="autolink",a.info="auto";const l=t.push("text","",0);l.content=t.md.normalizeLinkText(n);const u=t.push("link_close","a",-1);u.markup="autolink",u.info="auto"}return t.pos+=n.length+2,!0}if(Fx.test(n)){const o=t.md.normalizeLink("mailto:"+n);if(!t.md.validateLink(o))return!1;if(!e){const a=t.push("link_open","a",1);a.attrs=[["href",o]],a.markup="autolink",a.info="auto";const l=t.push("text","",0);l.content=t.md.normalizeLinkText(n);const u=t.push("link_close","a",-1);u.markup="autolink",u.info="auto"}return t.pos+=n.length+2,!0}return!1}function jx(t){return/^<a[>\s]/i.test(t)}function Hx(t){return/^<\/a\s*>/i.test(t)}function $x(t){const e=t|32;return e>=97&&e<=122}function qx(t,e){if(!t.md.options.html)return!1;const i=t.posMax,r=t.pos;if(t.src.charCodeAt(r)!==60||r+2>=i)return!1;const s=t.src.charCodeAt(r+1);if(s!==33&&s!==63&&s!==47&&!$x(s))return!1;const n=t.src.slice(r).match(bx);if(!n)return!1;if(!e){const o=t.push("html_inline","",0);o.content=n[0],jx(o.content)&&t.linkLevel++,Hx(o.content)&&t.linkLevel--}return t.pos+=n[0].length,!0}const Wx=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,Kx=/^&([a-z][a-z0-9]{1,31});/i;function Vx(t,e){const i=t.pos,r=t.posMax;if(t.src.charCodeAt(i)!==38||i+1>=r)return!1;if(t.src.charCodeAt(i+1)===35){const n=t.src.slice(i).match(Wx);if(n){if(!e){const o=n[1][0].toLowerCase()==="x"?parseInt(n[1].slice(1),16):parseInt(n[1],10),a=t.push("text_special","",0);a.content=Of(o)?ka(o):ka(65533),a.markup=n[0],a.info="entity"}return t.pos+=n[0].length,!0}}else{const n=t.src.slice(i).match(Kx);if(n){const o=hw(n[0]);if(o!==n[0]){if(!e){const a=t.push("text_special","",0);a.content=o,a.markup=n[0],a.info="entity"}return t.pos+=n[0].length,!0}}}return!1}function pm(t){const e={},i=t.length;if(!i)return;let r=0,s=-2;const n=[];for(let o=0;o<i;o++){const a=t[o];if(n.push(0),(t[r].marker!==a.marker||s!==a.token-1)&&(r=o),s=a.token,a.length=a.length||0,!a.close)continue;e.hasOwnProperty(a.marker)||(e[a.marker]=[-1,-1,-1,-1,-1,-1]);const l=e[a.marker][(a.open?3:0)+a.length%3];let u=r-n[r]-1,c=u;for(;u>l;u-=n[u]+1){const h=t[u];if(h.marker===a.marker&&h.open&&h.end<0){let d=!1;if((h.close||a.open)&&(h.length+a.length)%3===0&&(h.length%3!==0||a.length%3!==0)&&(d=!0),!d){const f=u>0&&!t[u-1].open?n[u-1]+1:0;n[o]=o-u+f,n[u]=f,a.open=!1,h.end=o,h.close=!1,c=-1,s=-2;break}}}c!==-1&&(e[a.marker][(a.open?3:0)+(a.length||0)%3]=c)}}function Ux(t){const e=t.tokens_meta,i=t.tokens_meta.length;pm(t.delimiters);for(let r=0;r<i;r++)e[r]&&e[r].delimiters&&pm(e[r].delimiters)}function Gx(t){let e,i,r=0;const s=t.tokens,n=t.tokens.length;for(e=i=0;e<n;e++)s[e].nesting<0&&r--,s[e].level=r,s[e].nesting>0&&r++,s[e].type==="text"&&e+1<n&&s[e+1].type==="text"?s[e+1].content=s[e].content+s[e+1].content:(e!==i&&(s[i]=s[e]),i++);e!==i&&(s.length=i)}const oc=[["text",Cx],["linkify",Ex],["newline",Dx],["escape",Mx],["backticks",Tx],["strikethrough",kv.tokenize],["emphasis",Cv.tokenize],["link",Ox],["image",Px],["autolink",zx],["html_inline",qx],["entity",Vx]],ac=[["balance_pairs",Ux],["strikethrough",kv.postProcess],["emphasis",Cv.postProcess],["fragments_join",Gx]];function Xa(){this.ruler=new Ri;for(let t=0;t<oc.length;t++)this.ruler.push(oc[t][0],oc[t][1]);this.ruler2=new Ri;for(let t=0;t<ac.length;t++)this.ruler2.push(ac[t][0],ac[t][1])}Xa.prototype.skipToken=function(t){const e=t.pos,i=this.ruler.getRules(""),r=i.length,s=t.md.options.maxNesting,n=t.cache;if(typeof n[e]<"u"){t.pos=n[e];return}let o=!1;if(t.level<s){for(let a=0;a<r;a++)if(t.level++,o=i[a](t,!0),t.level--,o){if(e>=t.pos)throw new Error("inline rule didn't increment state.pos");break}}else t.pos=t.posMax;o||t.pos++,n[e]=t.pos};Xa.prototype.tokenize=function(t){const e=this.ruler.getRules(""),i=e.length,r=t.posMax,s=t.md.options.maxNesting;for(;t.pos<r;){const n=t.pos;let o=!1;if(t.level<s){for(let a=0;a<i;a++)if(o=e[a](t,!1),o){if(n>=t.pos)throw new Error("inline rule didn't increment state.pos");break}}if(o){if(t.pos>=r)break;continue}t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()};Xa.prototype.parse=function(t,e,i,r){const s=new this.State(t,e,i,r);this.tokenize(s);const n=this.ruler2.getRules(""),o=n.length;for(let a=0;a<o;a++)n[a](s)};Xa.prototype.State=Ya;function Yx(t){const e={};t=t||{},e.src_Any=hv.source,e.src_Cc=dv.source,e.src_Z=pv.source,e.src_P=Nf.source,e.src_ZPCc=[e.src_Z,e.src_P,e.src_Cc].join("|"),e.src_ZCc=[e.src_Z,e.src_Cc].join("|");const i="[><|]";return e.src_pseudo_letter=`(?:(?!${i}|${e.src_ZPCc})${e.src_Any})`,e.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",e.src_auth=`(?:(?:(?!${e.src_ZCc}|[@/\\[\\]()]).){1,50}@)?`,e.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",e.src_host_terminator=`(?=$|${i}|${e.src_ZPCc})(?!${t["---"]?"-(?!--)|":"-|"}_|:\\d|\\.-|\\.(?!$|${e.src_ZPCc}))`,e.src_path=`(?:[/?#](?:(?!${e.src_ZCc}|${i}|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!${e.src_ZCc}|\\]).)*\\]|\\((?:(?!${e.src_ZCc}|[)]).)*\\)|\\{(?:(?!${e.src_ZCc}|[}]).)*\\}|\\"(?:(?!${e.src_ZCc}|["]).)+\\"|\\'(?:(?!${e.src_ZCc}|[']).)+\\'|\\'(?=${e.src_pseudo_letter}|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!${e.src_ZCc}|[.]|$)|`+(t["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+`,(?!${e.src_ZCc}|$)|;(?!${e.src_ZCc}|$)|\\!+(?!${e.src_ZCc}|[!]|$)|\\?(?!${e.src_ZCc}|[?]|$))+|\\/)?`,e.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]{0,63}',e.src_xn="xn--[a-z0-9\\-]{1,59}",e.src_domain_root="(?:"+e.src_xn+`|${e.src_pseudo_letter}{1,63})`,e.src_domain="(?:"+e.src_xn+`|(?:${e.src_pseudo_letter})|(?:${e.src_pseudo_letter}(?:-|${e.src_pseudo_letter}){0,61}${e.src_pseudo_letter}))`,e.src_host=`(?:(?:(?:(?:${e.src_domain})\\.)*${e.src_domain}))`,e.tpl_host_fuzzy="(?:"+e.src_ip4+`|(?:(?:(?:${e.src_domain})\\.)+(?:%TLDS%)))`,e.tpl_host_no_ip_fuzzy=`(?:(?:(?:${e.src_domain})\\.)+(?:%TLDS%))`,e.src_host_strict=e.src_host+e.src_host_terminator,e.tpl_host_fuzzy_strict=e.tpl_host_fuzzy+e.src_host_terminator,e.src_host_port_strict=e.src_host+e.src_port+e.src_host_terminator,e.tpl_host_port_fuzzy_strict=e.tpl_host_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_port_no_ip_fuzzy_strict=e.tpl_host_no_ip_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_fuzzy_test=`localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:${e.src_ZPCc}|>|$))`,e.tpl_email_fuzzy=`(^|${i}|"|\\(|${e.src_ZCc})(${e.src_email_name}@${e.tpl_host_fuzzy_strict})`,e.tpl_link_fuzzy=`(^|(?![.:/\\-_@])(?:[$+<=>^\`||]|${e.src_ZPCc}))((?![$+<=>^\`||])${e.tpl_host_port_fuzzy_strict}${e.src_path})`,e.tpl_link_no_ip_fuzzy=`(^|(?![.:/\\-_@])(?:[$+<=>^\`||]|${e.src_ZPCc}))((?![$+<=>^\`||])${e.tpl_host_port_no_ip_fuzzy_strict}${e.src_path})`,e}function Kh(t){return Array.prototype.slice.call(arguments,1).forEach(function(i){i&&Object.keys(i).forEach(function(r){t[r]=i[r]})}),t}function h0(t){return Object.prototype.toString.call(t)}function Xx(t){return h0(t)==="[object String]"}function Jx(t){return h0(t)==="[object Object]"}function Zx(t){return h0(t)==="[object RegExp]"}function mm(t){return h0(t)==="[object Function]"}function Qx(t){return t.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const Av={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function eS(t){return Object.keys(t||{}).reduce(function(e,i){return e||Av.hasOwnProperty(i)},!1)}const tS={"http:":{validate:function(t,e,i){const r=t.slice(e);return i.re.http||(i.re.http=new RegExp(`^\\/\\/${i.re.src_auth}${i.re.src_host_port_strict}${i.re.src_path}`,"i")),i.re.http.test(r)?r.match(i.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(t,e,i){const r=t.slice(e);return i.re.no_http||(i.re.no_http=new RegExp("^"+i.re.src_auth+`(?:localhost|(?:(?:${i.re.src_domain})\\.)+${i.re.src_domain_root})`+i.re.src_port+i.re.src_host_terminator+i.re.src_path,"i")),i.re.no_http.test(r)?e>=3&&t[e-3]===":"||e>=3&&t[e-3]==="/"?0:r.match(i.re.no_http)[0].length:0}},"mailto:":{validate:function(t,e,i){const r=t.slice(e);return i.re.mailto||(i.re.mailto=new RegExp(`^${i.re.src_email_name}@${i.re.src_host_strict}`,"i")),i.re.mailto.test(r)?r.match(i.re.mailto)[0].length:0}}},iS="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",rS="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function sS(t){return function(e,i){const r=e.slice(i);return t.test(r)?r.match(t)[0].length:0}}function gm(){return function(t,e){e.normalize(t)}}function Du(t){const e=t.re=Yx(t.__opts__),i=t.__tlds__.slice();t.onCompile(),t.__tlds_replaced__||i.push(iS),i.push(e.src_xn),e.src_tlds=i.join("|");function r(a){return a.replace("%TLDS%",e.src_tlds)}e.email_fuzzy=RegExp(r(e.tpl_email_fuzzy),"i"),e.email_fuzzy_global=RegExp(r(e.tpl_email_fuzzy),"ig"),e.link_fuzzy=RegExp(r(e.tpl_link_fuzzy),"i"),e.link_fuzzy_global=RegExp(r(e.tpl_link_fuzzy),"ig"),e.link_no_ip_fuzzy=RegExp(r(e.tpl_link_no_ip_fuzzy),"i"),e.link_no_ip_fuzzy_global=RegExp(r(e.tpl_link_no_ip_fuzzy),"ig"),e.host_fuzzy_test=RegExp(r(e.tpl_host_fuzzy_test),"i");const s=[];t.__compiled__={};function n(a,l){throw new Error(`(LinkifyIt) Invalid schema "${a}": ${l}`)}Object.keys(t.__schemas__).forEach(function(a){const l=t.__schemas__[a];if(l===null)return;const u={validate:null,link:null};if(t.__compiled__[a]=u,Jx(l)){Zx(l.validate)?u.validate=sS(l.validate):mm(l.validate)?u.validate=l.validate:n(a,l),mm(l.normalize)?u.normalize=l.normalize:l.normalize?n(a,l):u.normalize=gm();return}if(Xx(l)){s.push(a);return}n(a,l)}),s.forEach(function(a){t.__compiled__[t.__schemas__[a]]&&(t.__compiled__[a].validate=t.__compiled__[t.__schemas__[a]].validate,t.__compiled__[a].normalize=t.__compiled__[t.__schemas__[a]].normalize)}),t.__compiled__[""]={validate:null,normalize:gm()};const o=Object.keys(t.__compiled__).filter(function(a){return a.length>0&&t.__compiled__[a]}).map(Qx).join("|");t.re.schema_test=RegExp(`(^|(?!_)(?:[><|]|${e.src_ZPCc}))(${o})`,"i"),t.re.schema_search=RegExp(`(^|(?!_)(?:[><|]|${e.src_ZPCc}))(${o})`,"ig"),t.re.schema_at_start=RegExp(`^${t.re.schema_search.source}`,"i"),t.re.pretest=RegExp(`(${t.re.schema_test.source})|(${t.re.host_fuzzy_test.source})|@`,"i")}function Ev(t,e,i,r){const s=t.slice(i,r);this.schema=e.toLowerCase(),this.index=i,this.lastIndex=r,this.raw=s,this.text=s,this.url=s}function qi(t,e){if(!(this instanceof qi))return new qi(t,e);e||eS(t)&&(e=t,t={}),this.__opts__=Kh({},Av,e),this.__schemas__=Kh({},tS,t),this.__compiled__={},this.__tlds__=rS,this.__tlds_replaced__=!1,this.re={},Du(this)}qi.prototype.add=function(e,i){return this.__schemas__[e]=i,Du(this),this};qi.prototype.set=function(e){return this.__opts__=Kh(this.__opts__,e),this};qi.prototype.test=function(e){if(!e.length)return!1;let i,r;if(this.re.schema_test.test(e)){for(r=this.re.schema_search,r.lastIndex=0;(i=r.exec(e))!==null;)if(this.testSchemaAt(e,i[2],r.lastIndex))return!0}return!!(this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&e.search(this.re.host_fuzzy_test)>=0&&e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy)!==null||this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&e.indexOf("@")>=0&&e.match(this.re.email_fuzzy)!==null)};qi.prototype.pretest=function(e){return this.re.pretest.test(e)};qi.prototype.testSchemaAt=function(e,i,r){return this.__compiled__[i.toLowerCase()]?this.__compiled__[i.toLowerCase()].validate(e,r,this):0};qi.prototype.match=function(e){const i=[],r=[],s=[],n=[];let o,a,l;function u(d,f){return d?f?d.index!==f.index?d.index<f.index?d:f:d.lastIndex>=f.lastIndex?d:f:d:f}if(!e.length)return null;if(this.re.schema_test.test(e))for(l=this.re.schema_search,l.lastIndex=0;(o=l.exec(e))!==null;)a=this.testSchemaAt(e,o[2],l.lastIndex),a&&r.push({schema:o[2],index:o.index+o[1].length,lastIndex:o.index+o[0].length+a});if(this.__opts__.fuzzyLink&&this.__compiled__["http:"])for(l=this.__opts__.fuzzyIP?this.re.link_fuzzy_global:this.re.link_no_ip_fuzzy_global,l.lastIndex=0;(o=l.exec(e))!==null;)s.push({schema:"",index:o.index+o[1].length,lastIndex:o.index+o[0].length});if(this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"])for(l=this.re.email_fuzzy_global,l.lastIndex=0;(o=l.exec(e))!==null;)n.push({schema:"mailto:",index:o.index+o[1].length,lastIndex:o.index+o[0].length});const c=[0,0,0];let h=0;for(;;){const d=[r[c[0]],n[c[1]],s[c[2]]],f=u(u(d[0],d[1]),d[2]);if(!f)break;if(f===d[0]?c[0]++:f===d[1]?c[1]++:c[2]++,f.index<h)continue;const p=new Ev(e,f.schema,f.index,f.lastIndex);this.__compiled__[p.schema].normalize(p,this),i.push(p),h=f.lastIndex}return i.length?i:null};qi.prototype.matchAtStart=function(e){if(!e.length)return null;const i=this.re.schema_at_start.exec(e);if(!i)return null;const r=this.testSchemaAt(e,i[2],i[0].length);if(!r)return null;const s=new Ev(e,i[2],i.index+i[1].length,i.index+i[0].length+r);return this.__compiled__[s.schema].normalize(s,this),s};qi.prototype.tlds=function(e,i){return e=Array.isArray(e)?e:[e],i?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(r,s,n){return r!==n[s-1]}).reverse(),Du(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,Du(this),this)};qi.prototype.normalize=function(e){e.schema||(e.url=`http://${e.url}`),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:${e.url}`)};qi.prototype.onCompile=function(){};const io=2147483647,Nr=36,If=1,Da=26,nS=38,oS=700,Dv=72,Mv=128,Tv="-",aS=/^xn--/,lS=/[^\0-\x7F]/,uS=/[\x2E\u3002\uFF0E\uFF61]/g,cS={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},lc=Nr-If,Lr=Math.floor,uc=String.fromCharCode;function Ds(t){throw new RangeError(cS[t])}function hS(t,e){const i=[];let r=t.length;for(;r--;)i[r]=e(t[r]);return i}function Bv(t,e){const i=t.split("@");let r="";i.length>1&&(r=i[0]+"@",t=i[1]),t=t.replace(uS,".");const s=t.split("."),n=hS(s,e).join(".");return r+n}function Rv(t){const e=[];let i=0;const r=t.length;for(;i<r;){const s=t.charCodeAt(i++);if(s>=55296&&s<=56319&&i<r){const n=t.charCodeAt(i++);(n&64512)==56320?e.push(((s&1023)<<10)+(n&1023)+65536):(e.push(s),i--)}else e.push(s)}return e}const dS=t=>String.fromCodePoint(...t),fS=function(t){return t>=48&&t<58?26+(t-48):t>=65&&t<91?t-65:t>=97&&t<123?t-97:Nr},vm=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},Nv=function(t,e,i){let r=0;for(t=i?Lr(t/oS):t>>1,t+=Lr(t/e);t>lc*Da>>1;r+=Nr)t=Lr(t/lc);return Lr(r+(lc+1)*t/(t+nS))},Lv=function(t){const e=[],i=t.length;let r=0,s=Mv,n=Dv,o=t.lastIndexOf(Tv);o<0&&(o=0);for(let a=0;a<o;++a)t.charCodeAt(a)>=128&&Ds("not-basic"),e.push(t.charCodeAt(a));for(let a=o>0?o+1:0;a<i;){const l=r;for(let c=1,h=Nr;;h+=Nr){a>=i&&Ds("invalid-input");const d=fS(t.charCodeAt(a++));d>=Nr&&Ds("invalid-input"),d>Lr((io-r)/c)&&Ds("overflow"),r+=d*c;const f=h<=n?If:h>=n+Da?Da:h-n;if(d<f)break;const p=Nr-f;c>Lr(io/p)&&Ds("overflow"),c*=p}const u=e.length+1;n=Nv(r-l,u,l==0),Lr(r/u)>io-s&&Ds("overflow"),s+=Lr(r/u),r%=u,e.splice(r++,0,s)}return String.fromCodePoint(...e)},Ov=function(t){const e=[];t=Rv(t);const i=t.length;let r=Mv,s=0,n=Dv;for(const l of t)l<128&&e.push(uc(l));const o=e.length;let a=o;for(o&&e.push(Tv);a<i;){let l=io;for(const c of t)c>=r&&c<l&&(l=c);const u=a+1;l-r>Lr((io-s)/u)&&Ds("overflow"),s+=(l-r)*u,r=l;for(const c of t)if(c<r&&++s>io&&Ds("overflow"),c===r){let h=s;for(let d=Nr;;d+=Nr){const f=d<=n?If:d>=n+Da?Da:d-n;if(h<f)break;const p=h-f,v=Nr-f;e.push(uc(vm(f+p%v,0))),h=Lr(p/v)}e.push(uc(vm(h,0))),n=Nv(s,u,a===o),s=0,++a}++s,++r}return e.join("")},pS=function(t){return Bv(t,function(e){return aS.test(e)?Lv(e.slice(4).toLowerCase()):e})},mS=function(t){return Bv(t,function(e){return lS.test(e)?"xn--"+Ov(e):e})},Pv={version:"2.3.1",ucs2:{decode:Rv,encode:dS},decode:Lv,encode:Ov,toASCII:mS,toUnicode:pS},gS={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},vS={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}},bS={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}},_S={default:gS,zero:vS,commonmark:bS},yS=/^(vbscript|javascript|file|data):/,wS=/^data:image\/(gif|png|jpeg|webp);/;function xS(t){const e=t.trim().toLowerCase();return yS.test(e)?wS.test(e):!0}const Fv=["http:","https:","mailto:"];function SS(t){const e=Rf(t,!0);if(e.hostname&&(!e.protocol||Fv.indexOf(e.protocol)>=0))try{e.hostname=Pv.toASCII(e.hostname)}catch{}return Ga(Bf(e))}function kS(t){const e=Rf(t,!0);if(e.hostname&&(!e.protocol||Fv.indexOf(e.protocol)>=0))try{e.hostname=Pv.toUnicode(e.hostname)}catch{}return ho(Bf(e),ho.defaultChars+"%")}function sr(t,e){if(!(this instanceof sr))return new sr(t,e);e||Lf(t)||(e=t||{},t="default"),this.inline=new Xa,this.block=new c0,this.core=new Pf,this.renderer=new Eo,this.linkify=new qi,this.validateLink=xS,this.normalizeLink=SS,this.normalizeLinkText=kS,this.utils=Ew,this.helpers=a0({},Bw),this.options={},this.configure(t),e&&this.set(e)}sr.prototype.set=function(t){return a0(this.options,t),this};sr.prototype.configure=function(t){const e=this;if(Lf(t)){const i=t;if(t=_S[i],!t)throw new Error('Wrong `markdown-it` preset "'+i+'", check name')}if(!t)throw new Error("Wrong `markdown-it` preset, can't be empty");return t.options&&e.set(t.options),t.components&&Object.keys(t.components).forEach(function(i){t.components[i].rules&&e[i].ruler.enableOnly(t.components[i].rules),t.components[i].rules2&&e[i].ruler2.enableOnly(t.components[i].rules2)}),this};sr.prototype.enable=function(t,e){let i=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(s){i=i.concat(this[s].ruler.enable(t,!0))},this),i=i.concat(this.inline.ruler2.enable(t,!0));const r=t.filter(function(s){return i.indexOf(s)<0});if(r.length&&!e)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+r);return this};sr.prototype.disable=function(t,e){let i=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(s){i=i.concat(this[s].ruler.disable(t,!0))},this),i=i.concat(this.inline.ruler2.disable(t,!0));const r=t.filter(function(s){return i.indexOf(s)<0});if(r.length&&!e)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+r);return this};sr.prototype.use=function(t){const e=[this].concat(Array.prototype.slice.call(arguments,1));return t.apply(t,e),this};sr.prototype.parse=function(t,e){if(typeof t!="string")throw new Error("Input data should be a String");const i=new this.core.State(t,this,e);return this.core.process(i),i.tokens};sr.prototype.render=function(t,e){return e=e||{},this.renderer.render(this.parse(t,e),this.options,e)};sr.prototype.parseInline=function(t,e){const i=new this.core.State(t,this,e);return i.inlineMode=!0,this.core.process(i),i.tokens};sr.prototype.renderInline=function(t,e){return e=e||{},this.renderer.render(this.parseInline(t,e),this.options,e)};class se extends Error{constructor(e,i){var r="KaTeX parse error: "+e,s,n,o=i&&i.loc;if(o&&o.start<=o.end){var a=o.lexer.input;s=o.start,n=o.end,s===a.length?r+=" at end of input: ":r+=" at position "+(s+1)+": ";var l=a.slice(s,n).replace(/[^]/g,"$&̲"),u;s>15?u="…"+a.slice(s-15,s):u=a.slice(0,s);var c;n+15<a.length?c=a.slice(n,n+15)+"…":c=a.slice(n),r+=u+l+c}super(r),this.name="ParseError",this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,se.prototype),this.position=s,s!=null&&n!=null&&(this.length=n-s),this.rawMessage=e}}var CS=/([A-Z])/g,AS=t=>t.replace(CS,"-$1").toLowerCase(),ES={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},DS=/[&><"']/g,ci=t=>String(t).replace(DS,e=>ES[e]),cu=t=>t.type==="ordgroup"||t.type==="color"?t.body.length===1?cu(t.body[0]):t:t.type==="font"?cu(t.body):t,MS=new Set(["mathord","textord","atom"]),fs=t=>MS.has(cu(t).type),TS=t=>{var e=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(t);return e?e[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(e[1])?null:e[1].toLowerCase():"_relative"},Vh={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:t=>"#"+t},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(t,e)=>(e.push(t),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:t=>Math.max(0,t),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:t=>Math.max(0,t),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:t=>Math.max(0,t),cli:"-e, --max-expand <n>",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};function BS(t){if(typeof t!="string")return t.enum[0];switch(t){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{};default:throw new Error("Unexpected schema type; settings must declare an explicit default.")}}function RS(t){if(t.default!==void 0)return t.default;var e=Array.isArray(t.type)?t.type[0]:t.type;return BS(e)}function NS(t,e,i,r){var s=i[e];t[e]=s!==void 0?r.processor?r.processor(s):s:RS(r)}let zf=class{constructor(e){e===void 0&&(e={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var i of Object.keys(Vh)){var r=Vh[i];r&&NS(this,i,e,r)}}reportNonstrict(e,i,r){var s=this.strict;if(typeof s=="function"&&(s=s(e,i,r)),!(!s||s==="ignore")){if(s===!0||s==="error")throw new se("LaTeX-incompatible input and strict mode is set to 'error': "+(i+" ["+e+"]"),r);s==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(i+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+i+" ["+e+"]"))}}useStrictBehavior(e,i,r){var s=this.strict;if(typeof s=="function")try{s=s(e,i,r)}catch{s="error"}return!s||s==="ignore"?!1:s===!0||s==="error"?!0:s==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(i+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+i+" ["+e+"]")),!1)}isTrusted(e){if("url"in e&&e.url&&!e.protocol){var i=TS(e.url);if(i==null)return!1;e.protocol=i}var r=typeof this.trust=="function"?this.trust(e):this.trust;return!!r}};class Cs{constructor(e,i,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=i,this.cramped=r}sup(){return Mr[LS[this.id]]}sub(){return Mr[OS[this.id]]}fracNum(){return Mr[PS[this.id]]}fracDen(){return Mr[FS[this.id]]}cramp(){return Mr[IS[this.id]]}text(){return Mr[zS[this.id]]}isTight(){return this.size>=2}}var jf=0,Mu=1,ro=2,ss=3,Ma=4,tr=5,po=6,vi=7,Mr=[new Cs(jf,0,!1),new Cs(Mu,0,!0),new Cs(ro,1,!1),new Cs(ss,1,!0),new Cs(Ma,2,!1),new Cs(tr,2,!0),new Cs(po,3,!1),new Cs(vi,3,!0)],LS=[Ma,tr,Ma,tr,po,vi,po,vi],OS=[tr,tr,tr,tr,vi,vi,vi,vi],PS=[ro,ss,Ma,tr,po,vi,po,vi],FS=[ss,ss,tr,tr,vi,vi,vi,vi],IS=[Mu,Mu,ss,ss,tr,tr,vi,vi],zS=[jf,Mu,ro,ss,ro,ss,ro,ss],Ne={DISPLAY:Mr[jf],TEXT:Mr[ro],SCRIPT:Mr[Ma],SCRIPTSCRIPT:Mr[po]},Uh=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function jS(t){for(var e=0;e<Uh.length;e++)for(var i=Uh[e],r=0;r<i.blocks.length;r++){var s=i.blocks[r];if(t>=s[0]&&t<=s[1])return i.name}return null}var hu=[];Uh.forEach(t=>t.blocks.forEach(e=>hu.push(...e)));function Iv(t){for(var e=0;e<hu.length;e+=2)if(t>=hu[e]&&t<=hu[e+1])return!0;return!1}var jt=t=>t+" "+t,Vn=80,HS=function(e,i){return"M95,"+(622+e+i)+`
55
+ c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
56
+ c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
57
+ c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
58
+ s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
59
+ c69,-144,104.5,-217.7,106.5,-221
60
+ l`+e/2.075+" -"+e+`
61
+ c5.3,-9.3,12,-14,20,-14
62
+ H400000v`+(40+e)+`H845.2724
63
+ s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
64
+ c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
65
+ M`+(834+e)+" "+i+"h400000v"+(40+e)+"h-400000z"},$S=function(e,i){return"M263,"+(601+e+i)+`c0.7,0,18,39.7,52,119
66
+ c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120
67
+ c340,-704.7,510.7,-1060.3,512,-1067
68
+ l`+e/2.084+" -"+e+`
69
+ c4.7,-7.3,11,-11,19,-11
70
+ H40000v`+(40+e)+`H1012.3
71
+ s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232
72
+ c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1
73
+ s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26
74
+ c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z
75
+ M`+(1001+e)+" "+i+"h400000v"+(40+e)+"h-400000z"},qS=function(e,i){return"M983 "+(10+e+i)+`
76
+ l`+e/3.13+" -"+e+`
77
+ c4,-6.7,10,-10,18,-10 H400000v`+(40+e)+`
78
+ H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7
79
+ s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744
80
+ c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30
81
+ c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722
82
+ c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5
83
+ c53.7,-170.3,84.5,-266.8,92.5,-289.5z
84
+ M`+(1001+e)+" "+i+"h400000v"+(40+e)+"h-400000z"},WS=function(e,i){return"M424,"+(2398+e+i)+`
85
+ c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514
86
+ c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20
87
+ s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121
88
+ s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081
89
+ l`+e/4.223+" -"+e+`c4,-6.7,10,-10,18,-10 H400000
90
+ v`+(40+e)+`H1014.6
91
+ s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185
92
+ c-2,6,-10,9,-24,9
93
+ c-8,0,-12,-0.7,-12,-2z M`+(1001+e)+" "+i+`
94
+ h400000v`+(40+e)+"h-400000z"},KS=function(e,i){return"M473,"+(2713+e+i)+`
95
+ c339.3,-1799.3,509.3,-2700,510,-2702 l`+e/5.298+" -"+e+`
96
+ c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+e)+`H1017.7
97
+ s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9
98
+ c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200
99
+ c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26
100
+ s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,
101
+ 606zM`+(1001+e)+" "+i+"h400000v"+(40+e)+"H1017.7z"},VS=function(e){var i=e/2;return"M400000 "+e+" H0 L"+i+" 0 l65 45 L145 "+(e-80)+" H400000z"},US=function(e,i,r){var s=r-54-i-e;return"M702 "+(e+i)+"H400000"+(40+e)+`
102
+ H742v`+s+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1
103
+ h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170
104
+ c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667
105
+ 219 661 l218 661zM702 `+i+"H400000v"+(40+e)+"H742z"},GS=function(e,i,r){i=1e3*i;var s="";switch(e){case"sqrtMain":s=HS(i,Vn);break;case"sqrtSize1":s=$S(i,Vn);break;case"sqrtSize2":s=qS(i,Vn);break;case"sqrtSize3":s=WS(i,Vn);break;case"sqrtSize4":s=KS(i,Vn);break;case"sqrtTall":s=US(i,Vn,r)}return s},YS=function(e,i){switch(e){case"⎜":return jt("M291 0 H417 V"+i+" H291z");case"∣":return jt("M145 0 H188 V"+i+" H145z");case"∥":return jt("M145 0 H188 V"+i+" H145z")+jt("M367 0 H410 V"+i+" H367z");case"⎟":return jt("M457 0 H583 V"+i+" H457z");case"⎢":return jt("M319 0 H403 V"+i+" H319z");case"⎥":return jt("M263 0 H347 V"+i+" H263z");case"⎪":return jt("M384 0 H504 V"+i+" H384z");case"⏐":return jt("M312 0 H355 V"+i+" H312z");case"‖":return jt("M257 0 H300 V"+i+" H257z")+jt("M478 0 H521 V"+i+" H478z");default:return""}},bm={doubleleftarrow:`M262 157
106
+ l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3
107
+ 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28
108
+ 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5
109
+ c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5
110
+ 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87
111
+ -86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7
112
+ -2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z
113
+ m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l
114
+ -10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5
115
+ 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88
116
+ -33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68
117
+ -17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18
118
+ -13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782
119
+ c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3
120
+ -107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120
121
+ 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8
122
+ -5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247
123
+ c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208
124
+ 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3
125
+ 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202
126
+ l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117
127
+ -45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7
128
+ 5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13
129
+ 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688
130
+ 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7
131
+ -331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,leftgroup:`M400000 80
132
+ H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0
133
+ 435 0h399565z`,leftgroupunder:`M400000 262
134
+ H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219
135
+ 435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3
136
+ -3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5
137
+ -18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7
138
+ -196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5
139
+ 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3
140
+ -4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7
141
+ -10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z
142
+ m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333
143
+ 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5
144
+ 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667
145
+ -152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12
146
+ 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7
147
+ -2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0
148
+ v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5
149
+ -83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3
150
+ -68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21
151
+ 71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:jt("M40 281 V428 H0 V94 H40 V241 H400000 v40z"),leftbracketunder:jt("M0 0 h120 V290 H399995 v120 H0z"),leftbracketover:jt("M0 440 h120 V150 H399995 v-120 H0z"),leftmapsto:jt("M40 281 V448H0V74H40V241H400000v40z"),leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23
152
+ -.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8
153
+ c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3
154
+ 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:jt("M0 50 h400000 v40H0z m0 194h40000v40H0z"),midbrace:`M200428 334
155
+ c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14
156
+ -53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7
157
+ 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11
158
+ 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214
159
+ c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14
160
+ 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3
161
+ 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0
162
+ -5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6
163
+ -320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z
164
+ m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8
165
+ 60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8
166
+ -451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z
167
+ m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2
168
+ c0 110 84 276 504 276s502.4-166 502.4-276z`,oiiintSize1:`M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6
169
+ -480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z
170
+ m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0
171
+ 85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,oiiintSize2:`M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8
172
+ -707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z
173
+ m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1
174
+ c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,rightarrow:`M0 241v40h399891c-47.3 35.3-84 78-110 128
175
+ -16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20
176
+ 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7
177
+ 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85
178
+ -40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
179
+ -12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
180
+ 151.7 139 205zm0 0v40h399900v-40z`,rightbrace:`M400000 542l
181
+ -6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5
182
+ s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1
183
+ c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,rightbraceunder:`M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3
184
+ 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237
185
+ -174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,rightgroup:`M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0
186
+ 3-1 3-3v-38c-76-158-257-219-435-219H0z`,rightgroupunder:`M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18
187
+ 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,rightharpoon:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3
188
+ -3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2
189
+ -10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58
190
+ 69.2 92 94.5zm0 0v40h399900v-40z`,rightharpoonplus:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11
191
+ -18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7
192
+ 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z
193
+ m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown:`M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8
194
+ 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5
195
+ -7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95
196
+ -27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,rightharpoondownplus:`M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8
197
+ 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3
198
+ 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3
199
+ -64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z
200
+ m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3
201
+ 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0
202
+ -13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21
203
+ 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:jt("M399960 241 V94 h40 V428 h-40 V281 H0 v-40z"),rightbracketunder:jt("M399995 0 h-120 V290 H0 v120 H400000z"),rightbracketover:jt("M399995 440 h-120 V150 H0 v-120 H399995z"),rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23
204
+ 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32
205
+ -52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142
206
+ -167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40
207
+ 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69
208
+ -70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3
209
+ -40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19
210
+ -37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101
211
+ 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,twoheadrightarrow:`M400000 167
212
+ c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3
213
+ 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42
214
+ 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333
215
+ -19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70
216
+ 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,tilde1:`M200 55.538c-77 0-168 73.953-177 73.953-3 0-7
217
+ -2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0
218
+ 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0
219
+ 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128
220
+ -68.267.847-113-73.952-191-73.952z`,tilde2:`M344 55.266c-142 0-300.638 81.316-311.5 86.418
221
+ -8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9
222
+ 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114
223
+ c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751
224
+ 181.476 676 181.476c-149 0-189-126.21-332-126.21z`,tilde3:`M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457
225
+ -11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0
226
+ 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697
227
+ 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696
228
+ -338 0-409-156.573-744-156.573z`,tilde4:`M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345
229
+ -11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409
230
+ 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9
231
+ 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409
232
+ -175.236-744-175.236z`,vec:`M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5
233
+ 3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11
234
+ 10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63
235
+ -1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1
236
+ -7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59
237
+ H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359
238
+ c-16-25.333-24-45-24-59z`,widehat1:`M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22
239
+ c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,widehat2:`M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10
240
+ -11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat3:`M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10
241
+ -11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat4:`M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10
242
+ -11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widecheck1:`M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,
243
+ -5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,widecheck2:`M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
244
+ -11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck3:`M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
245
+ -11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck4:`M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
246
+ -11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,baraboveleftarrow:`M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202
247
+ c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5
248
+ c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130
249
+ s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47
250
+ 121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6
251
+ s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11
252
+ c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z
253
+ M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,rightarrowabovebar:`M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32
254
+ -27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0
255
+ 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39
256
+ -84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5
257
+ -119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
258
+ -12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
259
+ 151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,baraboveshortleftharpoon:`M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
260
+ c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17
261
+ c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21
262
+ c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40
263
+ c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z
264
+ M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,rightharpoonaboveshortbar:`M0,241 l0,40c399126,0,399993,0,399993,0
265
+ c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
266
+ -231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
267
+ c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
268
+ M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,shortbaraboveleftharpoon:`M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
269
+ c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,
270
+ 1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,
271
+ -152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z
272
+ M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,shortrightharpoonabovebar:`M53,241l0,40c398570,0,399437,0,399437,0
273
+ c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
274
+ -231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
275
+ c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
276
+ M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},XS=function(e,i){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+i+` v1759 v84 h347 v-84
277
+ H403z M403 1759 V0 H319 V1759 v`+i+" v1759 v84 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+i+` v1759 H0 v84 H347z
278
+ M347 1759 V0 H263 V1759 v`+i+" v1759 h84z";case"vert":return"M145 15 v585 v"+i+` v585 c2.667,10,9.667,15,21,15
279
+ c10,0,16.667,-5,20,-15 v-585 v`+-i+` v-585 c-2.667,-10,-9.667,-15,-21,-15
280
+ c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+i+" v585 h43z";case"doublevert":return"M145 15 v585 v"+i+` v585 c2.667,10,9.667,15,21,15
281
+ c10,0,16.667,-5,20,-15 v-585 v`+-i+` v-585 c-2.667,-10,-9.667,-15,-21,-15
282
+ c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+i+` v585 h43z
283
+ M367 15 v585 v`+i+` v585 c2.667,10,9.667,15,21,15
284
+ c10,0,16.667,-5,20,-15 v-585 v`+-i+` v-585 c-2.667,-10,-9.667,-15,-21,-15
285
+ c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v`+i+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+i+` v1715 h263 v84 H319z
286
+ MM319 602 V0 H403 V602 v`+i+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+i+` v1799 H0 v-84 H319z
287
+ MM319 602 V0 H403 V602 v`+i+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+i+` v602 h84z
288
+ M403 1759 V0 H319 V1759 v`+i+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+i+` v602 h84z
289
+ M347 1759 V0 h-84 V1759 v`+i+" v602 h84z";case"lparen":return`M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1
290
+ c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,
291
+ -36,557 l0,`+(i+84)+`c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,
292
+ 949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9
293
+ c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,
294
+ -544.7,-112.5,-882c-2,-104,-3,-167,-3,-189
295
+ l0,-`+(i+92)+`c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,
296
+ -210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;case"rparen":return`M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,
297
+ 63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5
298
+ c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,`+(i+9)+`
299
+ c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664
300
+ c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11
301
+ c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17
302
+ c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558
303
+ l0,-`+(i+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
304
+ -470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};function JS(t){return"toText"in t}class Do{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),i=0;i<this.children.length;i++)e.appendChild(this.children[i].toNode());return e}toMarkup(){for(var e="",i=0;i<this.children.length;i++)e+=this.children[i].toMarkup();return e}toText(){return this.children.map(e=>{if(JS(e))return e.toText();throw new Error("Expected MathDomNode with toText, got "+e.constructor.name)}).join("")}}var Gh={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},ZS={ex:!0,em:!0,mu:!0},zv=function(e){return typeof e!="string"&&(e=e.unit),e in Gh||e in ZS||e==="ex"},gt=function(e,i){var r;if(e.unit in Gh)r=Gh[e.unit]/i.fontMetrics().ptPerEm/i.sizeMultiplier;else if(e.unit==="mu")r=i.fontMetrics().cssEmPerMu;else{var s;if(i.style.isTight()?s=i.havingStyle(i.style.text()):s=i,e.unit==="ex")r=s.fontMetrics().xHeight;else if(e.unit==="em")r=s.fontMetrics().quad;else throw new se("Invalid unit: '"+e.unit+"'");s!==i&&(r*=s.sizeMultiplier/i.sizeMultiplier)}return Math.min(e.number*r,i.maxSize)},ae=function(e){return+e.toFixed(4)+"em"},Hs=function(e){return e.filter(i=>i).join(" ")},Hf=function(e){var i="";for(var r of Object.keys(e)){var s=e[r];s!==void 0&&(i+=AS(r)+":"+s+";")}return i},jv=function(e,i,r){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=r||{},i){i.style.isTight()&&this.classes.push("mtight");var s=i.getColor();s&&(this.style.color=s)}},Hv=function(e){var i=document.createElement(e);i.className=Hs(this.classes),Object.assign(i.style,this.style);for(var r of Object.keys(this.attributes))i.setAttribute(r,this.attributes[r]);for(var s=0;s<this.children.length;s++)i.appendChild(this.children[s].toNode());return i},QS=/[\s"'>/=\x00-\x1f]/,$v=function(e){var i="<"+e;this.classes.length&&(i+=' class="'+ci(Hs(this.classes))+'"');var r=Hf(this.style);r&&(i+=' style="'+ci(r)+'"');for(var s of Object.keys(this.attributes)){if(QS.test(s))throw new se("Invalid attribute name '"+s+"'");i+=" "+s+'="'+ci(this.attributes[s])+'"'}i+=">";for(var n=0;n<this.children.length;n++)i+=this.children[n].toMarkup();return i+="</"+e+">",i};class Mo{constructor(e,i,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,this.italic=void 0,jv.call(this,e,r,s),this.children=i||[]}setAttribute(e,i){this.attributes[e]=i}hasClass(e){return this.classes.includes(e)}toNode(){return Hv.call(this,"span")}toMarkup(){return $v.call(this,"span")}}class d0{constructor(e,i,r,s){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,jv.call(this,i,s),this.children=r||[],this.setAttribute("href",e)}setAttribute(e,i){this.attributes[e]=i}hasClass(e){return this.classes.includes(e)}toNode(){return Hv.call(this,"a")}toMarkup(){return $v.call(this,"a")}}class e9{constructor(e,i,r){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=i,this.src=e,this.classes=["mord"],this.height=0,this.depth=0,this.maxFontSize=0,this.style=r}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");return e.src=this.src,e.alt=this.alt,e.className="mord",Object.assign(e.style,this.style),e}toMarkup(){var e='<img src="'+ci(this.src)+'"'+(' alt="'+ci(this.alt)+'"'),i=Hf(this.style);return i&&(e+=' style="'+ci(i)+'"'),e+="'/>",e}}var t9={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class Wi{constructor(e,i,r,s,n,o,a,l){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=e,this.height=i||0,this.depth=r||0,this.italic=s||0,this.skew=n||0,this.width=o||0,this.classes=a||[],this.style=l||{},this.maxFontSize=0;var u=jS(this.text.charCodeAt(0));u&&this.classes.push(u+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=t9[this.text])}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createTextNode(this.text),i=null;return this.italic>0&&(i=document.createElement("span"),i.style.marginRight=ae(this.italic)),this.classes.length>0&&(i=i||document.createElement("span"),i.className=Hs(this.classes)),Object.keys(this.style).length>0&&(i=i||document.createElement("span"),Object.assign(i.style,this.style)),i?(i.appendChild(e),i):e}toMarkup(){var e=!1,i="<span";this.classes.length&&(e=!0,i+=' class="',i+=ci(Hs(this.classes)),i+='"');var r="";this.italic>0&&(r+="margin-right:"+ae(this.italic)+";"),r+=Hf(this.style),r&&(e=!0,i+=' style="'+ci(r)+'"');var s=ci(this.text);return e?(i+=">",i+=s,i+="</span>",i):s}}class ls{constructor(e,i){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=i||{}}toNode(){var e="http://www.w3.org/2000/svg",i=document.createElementNS(e,"svg");for(var r of Object.keys(this.attributes))i.setAttribute(r,this.attributes[r]);for(var s=0;s<this.children.length;s++)i.appendChild(this.children[s].toNode());return i}toMarkup(){var e='<svg xmlns="http://www.w3.org/2000/svg"';for(var i of Object.keys(this.attributes))e+=" "+i+'="'+ci(this.attributes[i])+'"';e+=">";for(var r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e+="</svg>",e}}class $s{constructor(e,i){this.pathName=void 0,this.alternate=void 0,this.pathName=e,this.alternate=i}toNode(){var e="http://www.w3.org/2000/svg",i=document.createElementNS(e,"path");return this.alternate?i.setAttribute("d",this.alternate):i.setAttribute("d",bm[this.pathName]),i}toMarkup(){return this.alternate?'<path d="'+ci(this.alternate)+'"/>':'<path d="'+ci(bm[this.pathName])+'"/>'}}class Yh{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",i=document.createElementNS(e,"line");for(var r of Object.keys(this.attributes))i.setAttribute(r,this.attributes[r]);return i}toMarkup(){var e="<line";for(var i of Object.keys(this.attributes))e+=" "+i+'="'+ci(this.attributes[i])+'"';return e+="/>",e}}function i9(t){if(t instanceof Wi)return t;throw new Error("Expected symbolNode but got "+String(t)+".")}function r9(t){if(t instanceof Mo)return t;throw new Error("Expected span<HtmlDomNode> but got "+String(t)+".")}var s9=t=>t instanceof Mo||t instanceof d0||t instanceof Do,Or={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},_l={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},_m={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function n9(t,e){Or[t]=e}function $f(t,e,i){if(!Or[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),s=Or[e][r];if(!s&&t[0]in _m&&(r=_m[t[0]].charCodeAt(0),s=Or[e][r]),!s&&i==="text"&&Iv(r)&&(s=Or[e][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var cc={};function o9(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!cc[e]){var i=cc[e]={cssEmPerMu:_l.quad[e]/18};for(var r in _l)_l.hasOwnProperty(r)&&(i[r]=_l[r][e])}return cc[e]}var lt={math:{},text:{}};function g(t,e,i,r,s,n){lt[t][s]={font:e,group:i,replace:r},n&&r&&(lt[t][r]=lt[t][s])}var b="math",ee="text",y="main",B="ams",ct="accent-token",ge="bin",xi="close",To="inner",Se="mathord",Ot="op-token",Vi="open",Ja="punct",N="rel",ps="spacing",P="textord";g(b,y,N,"≡","\\equiv",!0);g(b,y,N,"≺","\\prec",!0);g(b,y,N,"≻","\\succ",!0);g(b,y,N,"∼","\\sim",!0);g(b,y,N,"⊥","\\perp");g(b,y,N,"⪯","\\preceq",!0);g(b,y,N,"⪰","\\succeq",!0);g(b,y,N,"≃","\\simeq",!0);g(b,y,N,"∣","\\mid",!0);g(b,y,N,"≪","\\ll",!0);g(b,y,N,"≫","\\gg",!0);g(b,y,N,"≍","\\asymp",!0);g(b,y,N,"∥","\\parallel");g(b,y,N,"⋈","\\bowtie",!0);g(b,y,N,"⌣","\\smile",!0);g(b,y,N,"⊑","\\sqsubseteq",!0);g(b,y,N,"⊒","\\sqsupseteq",!0);g(b,y,N,"≐","\\doteq",!0);g(b,y,N,"⌢","\\frown",!0);g(b,y,N,"∋","\\ni",!0);g(b,y,N,"∝","\\propto",!0);g(b,y,N,"⊢","\\vdash",!0);g(b,y,N,"⊣","\\dashv",!0);g(b,y,N,"∋","\\owns");g(b,y,Ja,".","\\ldotp");g(b,y,Ja,"⋅","\\cdotp");g(b,y,Ja,"⋅","·");g(ee,y,P,"⋅","·");g(b,y,P,"#","\\#");g(ee,y,P,"#","\\#");g(b,y,P,"&","\\&");g(ee,y,P,"&","\\&");g(b,y,P,"ℵ","\\aleph",!0);g(b,y,P,"∀","\\forall",!0);g(b,y,P,"ℏ","\\hbar",!0);g(b,y,P,"∃","\\exists",!0);g(b,y,P,"∇","\\nabla",!0);g(b,y,P,"♭","\\flat",!0);g(b,y,P,"ℓ","\\ell",!0);g(b,y,P,"♮","\\natural",!0);g(b,y,P,"♣","\\clubsuit",!0);g(b,y,P,"℘","\\wp",!0);g(b,y,P,"♯","\\sharp",!0);g(b,y,P,"♢","\\diamondsuit",!0);g(b,y,P,"ℜ","\\Re",!0);g(b,y,P,"♡","\\heartsuit",!0);g(b,y,P,"ℑ","\\Im",!0);g(b,y,P,"♠","\\spadesuit",!0);g(b,y,P,"§","\\S",!0);g(ee,y,P,"§","\\S");g(b,y,P,"¶","\\P",!0);g(ee,y,P,"¶","\\P");g(b,y,P,"†","\\dag");g(ee,y,P,"†","\\dag");g(ee,y,P,"†","\\textdagger");g(b,y,P,"‡","\\ddag");g(ee,y,P,"‡","\\ddag");g(ee,y,P,"‡","\\textdaggerdbl");g(b,y,xi,"⎱","\\rmoustache",!0);g(b,y,Vi,"⎰","\\lmoustache",!0);g(b,y,xi,"⟯","\\rgroup",!0);g(b,y,Vi,"⟮","\\lgroup",!0);g(b,y,ge,"∓","\\mp",!0);g(b,y,ge,"⊖","\\ominus",!0);g(b,y,ge,"⊎","\\uplus",!0);g(b,y,ge,"⊓","\\sqcap",!0);g(b,y,ge,"∗","\\ast");g(b,y,ge,"⊔","\\sqcup",!0);g(b,y,ge,"◯","\\bigcirc",!0);g(b,y,ge,"∙","\\bullet",!0);g(b,y,ge,"‡","\\ddagger");g(b,y,ge,"≀","\\wr",!0);g(b,y,ge,"⨿","\\amalg");g(b,y,ge,"&","\\And");g(b,y,N,"⟵","\\longleftarrow",!0);g(b,y,N,"⇐","\\Leftarrow",!0);g(b,y,N,"⟸","\\Longleftarrow",!0);g(b,y,N,"⟶","\\longrightarrow",!0);g(b,y,N,"⇒","\\Rightarrow",!0);g(b,y,N,"⟹","\\Longrightarrow",!0);g(b,y,N,"↔","\\leftrightarrow",!0);g(b,y,N,"⟷","\\longleftrightarrow",!0);g(b,y,N,"⇔","\\Leftrightarrow",!0);g(b,y,N,"⟺","\\Longleftrightarrow",!0);g(b,y,N,"↦","\\mapsto",!0);g(b,y,N,"⟼","\\longmapsto",!0);g(b,y,N,"↗","\\nearrow",!0);g(b,y,N,"↩","\\hookleftarrow",!0);g(b,y,N,"↪","\\hookrightarrow",!0);g(b,y,N,"↘","\\searrow",!0);g(b,y,N,"↼","\\leftharpoonup",!0);g(b,y,N,"⇀","\\rightharpoonup",!0);g(b,y,N,"↙","\\swarrow",!0);g(b,y,N,"↽","\\leftharpoondown",!0);g(b,y,N,"⇁","\\rightharpoondown",!0);g(b,y,N,"↖","\\nwarrow",!0);g(b,y,N,"⇌","\\rightleftharpoons",!0);g(b,B,N,"≮","\\nless",!0);g(b,B,N,"","\\@nleqslant");g(b,B,N,"","\\@nleqq");g(b,B,N,"⪇","\\lneq",!0);g(b,B,N,"≨","\\lneqq",!0);g(b,B,N,"","\\@lvertneqq");g(b,B,N,"⋦","\\lnsim",!0);g(b,B,N,"⪉","\\lnapprox",!0);g(b,B,N,"⊀","\\nprec",!0);g(b,B,N,"⋠","\\npreceq",!0);g(b,B,N,"⋨","\\precnsim",!0);g(b,B,N,"⪹","\\precnapprox",!0);g(b,B,N,"≁","\\nsim",!0);g(b,B,N,"","\\@nshortmid");g(b,B,N,"∤","\\nmid",!0);g(b,B,N,"⊬","\\nvdash",!0);g(b,B,N,"⊭","\\nvDash",!0);g(b,B,N,"⋪","\\ntriangleleft");g(b,B,N,"⋬","\\ntrianglelefteq",!0);g(b,B,N,"⊊","\\subsetneq",!0);g(b,B,N,"","\\@varsubsetneq");g(b,B,N,"⫋","\\subsetneqq",!0);g(b,B,N,"","\\@varsubsetneqq");g(b,B,N,"≯","\\ngtr",!0);g(b,B,N,"","\\@ngeqslant");g(b,B,N,"","\\@ngeqq");g(b,B,N,"⪈","\\gneq",!0);g(b,B,N,"≩","\\gneqq",!0);g(b,B,N,"","\\@gvertneqq");g(b,B,N,"⋧","\\gnsim",!0);g(b,B,N,"⪊","\\gnapprox",!0);g(b,B,N,"⊁","\\nsucc",!0);g(b,B,N,"⋡","\\nsucceq",!0);g(b,B,N,"⋩","\\succnsim",!0);g(b,B,N,"⪺","\\succnapprox",!0);g(b,B,N,"≆","\\ncong",!0);g(b,B,N,"","\\@nshortparallel");g(b,B,N,"∦","\\nparallel",!0);g(b,B,N,"⊯","\\nVDash",!0);g(b,B,N,"⋫","\\ntriangleright");g(b,B,N,"⋭","\\ntrianglerighteq",!0);g(b,B,N,"","\\@nsupseteqq");g(b,B,N,"⊋","\\supsetneq",!0);g(b,B,N,"","\\@varsupsetneq");g(b,B,N,"⫌","\\supsetneqq",!0);g(b,B,N,"","\\@varsupsetneqq");g(b,B,N,"⊮","\\nVdash",!0);g(b,B,N,"⪵","\\precneqq",!0);g(b,B,N,"⪶","\\succneqq",!0);g(b,B,N,"","\\@nsubseteqq");g(b,B,ge,"⊴","\\unlhd");g(b,B,ge,"⊵","\\unrhd");g(b,B,N,"↚","\\nleftarrow",!0);g(b,B,N,"↛","\\nrightarrow",!0);g(b,B,N,"⇍","\\nLeftarrow",!0);g(b,B,N,"⇏","\\nRightarrow",!0);g(b,B,N,"↮","\\nleftrightarrow",!0);g(b,B,N,"⇎","\\nLeftrightarrow",!0);g(b,B,N,"△","\\vartriangle");g(b,B,P,"ℏ","\\hslash");g(b,B,P,"▽","\\triangledown");g(b,B,P,"◊","\\lozenge");g(b,B,P,"Ⓢ","\\circledS");g(b,B,P,"®","\\circledR");g(ee,B,P,"®","\\circledR");g(b,B,P,"∡","\\measuredangle",!0);g(b,B,P,"∄","\\nexists");g(b,B,P,"℧","\\mho");g(b,B,P,"Ⅎ","\\Finv",!0);g(b,B,P,"⅁","\\Game",!0);g(b,B,P,"‵","\\backprime");g(b,B,P,"▲","\\blacktriangle");g(b,B,P,"▼","\\blacktriangledown");g(b,B,P,"■","\\blacksquare");g(b,B,P,"⧫","\\blacklozenge");g(b,B,P,"★","\\bigstar");g(b,B,P,"∢","\\sphericalangle",!0);g(b,B,P,"∁","\\complement",!0);g(b,B,P,"ð","\\eth",!0);g(ee,y,P,"ð","ð");g(b,B,P,"╱","\\diagup");g(b,B,P,"╲","\\diagdown");g(b,B,P,"□","\\square");g(b,B,P,"□","\\Box");g(b,B,P,"◊","\\Diamond");g(b,B,P,"¥","\\yen",!0);g(ee,B,P,"¥","\\yen",!0);g(b,B,P,"✓","\\checkmark",!0);g(ee,B,P,"✓","\\checkmark");g(b,B,P,"ℶ","\\beth",!0);g(b,B,P,"ℸ","\\daleth",!0);g(b,B,P,"ℷ","\\gimel",!0);g(b,B,P,"ϝ","\\digamma",!0);g(b,B,P,"ϰ","\\varkappa");g(b,B,Vi,"┌","\\@ulcorner",!0);g(b,B,xi,"┐","\\@urcorner",!0);g(b,B,Vi,"└","\\@llcorner",!0);g(b,B,xi,"┘","\\@lrcorner",!0);g(b,B,N,"≦","\\leqq",!0);g(b,B,N,"⩽","\\leqslant",!0);g(b,B,N,"⪕","\\eqslantless",!0);g(b,B,N,"≲","\\lesssim",!0);g(b,B,N,"⪅","\\lessapprox",!0);g(b,B,N,"≊","\\approxeq",!0);g(b,B,ge,"⋖","\\lessdot");g(b,B,N,"⋘","\\lll",!0);g(b,B,N,"≶","\\lessgtr",!0);g(b,B,N,"⋚","\\lesseqgtr",!0);g(b,B,N,"⪋","\\lesseqqgtr",!0);g(b,B,N,"≑","\\doteqdot");g(b,B,N,"≓","\\risingdotseq",!0);g(b,B,N,"≒","\\fallingdotseq",!0);g(b,B,N,"∽","\\backsim",!0);g(b,B,N,"⋍","\\backsimeq",!0);g(b,B,N,"⫅","\\subseteqq",!0);g(b,B,N,"⋐","\\Subset",!0);g(b,B,N,"⊏","\\sqsubset",!0);g(b,B,N,"≼","\\preccurlyeq",!0);g(b,B,N,"⋞","\\curlyeqprec",!0);g(b,B,N,"≾","\\precsim",!0);g(b,B,N,"⪷","\\precapprox",!0);g(b,B,N,"⊲","\\vartriangleleft");g(b,B,N,"⊴","\\trianglelefteq");g(b,B,N,"⊨","\\vDash",!0);g(b,B,N,"⊪","\\Vvdash",!0);g(b,B,N,"⌣","\\smallsmile");g(b,B,N,"⌢","\\smallfrown");g(b,B,N,"≏","\\bumpeq",!0);g(b,B,N,"≎","\\Bumpeq",!0);g(b,B,N,"≧","\\geqq",!0);g(b,B,N,"⩾","\\geqslant",!0);g(b,B,N,"⪖","\\eqslantgtr",!0);g(b,B,N,"≳","\\gtrsim",!0);g(b,B,N,"⪆","\\gtrapprox",!0);g(b,B,ge,"⋗","\\gtrdot");g(b,B,N,"⋙","\\ggg",!0);g(b,B,N,"≷","\\gtrless",!0);g(b,B,N,"⋛","\\gtreqless",!0);g(b,B,N,"⪌","\\gtreqqless",!0);g(b,B,N,"≖","\\eqcirc",!0);g(b,B,N,"≗","\\circeq",!0);g(b,B,N,"≜","\\triangleq",!0);g(b,B,N,"∼","\\thicksim");g(b,B,N,"≈","\\thickapprox");g(b,B,N,"⫆","\\supseteqq",!0);g(b,B,N,"⋑","\\Supset",!0);g(b,B,N,"⊐","\\sqsupset",!0);g(b,B,N,"≽","\\succcurlyeq",!0);g(b,B,N,"⋟","\\curlyeqsucc",!0);g(b,B,N,"≿","\\succsim",!0);g(b,B,N,"⪸","\\succapprox",!0);g(b,B,N,"⊳","\\vartriangleright");g(b,B,N,"⊵","\\trianglerighteq");g(b,B,N,"⊩","\\Vdash",!0);g(b,B,N,"∣","\\shortmid");g(b,B,N,"∥","\\shortparallel");g(b,B,N,"≬","\\between",!0);g(b,B,N,"⋔","\\pitchfork",!0);g(b,B,N,"∝","\\varpropto");g(b,B,N,"◀","\\blacktriangleleft");g(b,B,N,"∴","\\therefore",!0);g(b,B,N,"∍","\\backepsilon");g(b,B,N,"▶","\\blacktriangleright");g(b,B,N,"∵","\\because",!0);g(b,B,N,"⋘","\\llless");g(b,B,N,"⋙","\\gggtr");g(b,B,ge,"⊲","\\lhd");g(b,B,ge,"⊳","\\rhd");g(b,B,N,"≂","\\eqsim",!0);g(b,y,N,"⋈","\\Join");g(b,B,N,"≑","\\Doteq",!0);g(b,B,ge,"∔","\\dotplus",!0);g(b,B,ge,"∖","\\smallsetminus");g(b,B,ge,"⋒","\\Cap",!0);g(b,B,ge,"⋓","\\Cup",!0);g(b,B,ge,"⩞","\\doublebarwedge",!0);g(b,B,ge,"⊟","\\boxminus",!0);g(b,B,ge,"⊞","\\boxplus",!0);g(b,B,ge,"⋇","\\divideontimes",!0);g(b,B,ge,"⋉","\\ltimes",!0);g(b,B,ge,"⋊","\\rtimes",!0);g(b,B,ge,"⋋","\\leftthreetimes",!0);g(b,B,ge,"⋌","\\rightthreetimes",!0);g(b,B,ge,"⋏","\\curlywedge",!0);g(b,B,ge,"⋎","\\curlyvee",!0);g(b,B,ge,"⊝","\\circleddash",!0);g(b,B,ge,"⊛","\\circledast",!0);g(b,B,ge,"⋅","\\centerdot");g(b,B,ge,"⊺","\\intercal",!0);g(b,B,ge,"⋒","\\doublecap");g(b,B,ge,"⋓","\\doublecup");g(b,B,ge,"⊠","\\boxtimes",!0);g(b,B,N,"⇢","\\dashrightarrow",!0);g(b,B,N,"⇠","\\dashleftarrow",!0);g(b,B,N,"⇇","\\leftleftarrows",!0);g(b,B,N,"⇆","\\leftrightarrows",!0);g(b,B,N,"⇚","\\Lleftarrow",!0);g(b,B,N,"↞","\\twoheadleftarrow",!0);g(b,B,N,"↢","\\leftarrowtail",!0);g(b,B,N,"↫","\\looparrowleft",!0);g(b,B,N,"⇋","\\leftrightharpoons",!0);g(b,B,N,"↶","\\curvearrowleft",!0);g(b,B,N,"↺","\\circlearrowleft",!0);g(b,B,N,"↰","\\Lsh",!0);g(b,B,N,"⇈","\\upuparrows",!0);g(b,B,N,"↿","\\upharpoonleft",!0);g(b,B,N,"⇃","\\downharpoonleft",!0);g(b,y,N,"⊶","\\origof",!0);g(b,y,N,"⊷","\\imageof",!0);g(b,B,N,"⊸","\\multimap",!0);g(b,B,N,"↭","\\leftrightsquigarrow",!0);g(b,B,N,"⇉","\\rightrightarrows",!0);g(b,B,N,"⇄","\\rightleftarrows",!0);g(b,B,N,"↠","\\twoheadrightarrow",!0);g(b,B,N,"↣","\\rightarrowtail",!0);g(b,B,N,"↬","\\looparrowright",!0);g(b,B,N,"↷","\\curvearrowright",!0);g(b,B,N,"↻","\\circlearrowright",!0);g(b,B,N,"↱","\\Rsh",!0);g(b,B,N,"⇊","\\downdownarrows",!0);g(b,B,N,"↾","\\upharpoonright",!0);g(b,B,N,"⇂","\\downharpoonright",!0);g(b,B,N,"⇝","\\rightsquigarrow",!0);g(b,B,N,"⇝","\\leadsto");g(b,B,N,"⇛","\\Rrightarrow",!0);g(b,B,N,"↾","\\restriction");g(b,y,P,"‘","`");g(b,y,P,"$","\\$");g(ee,y,P,"$","\\$");g(ee,y,P,"$","\\textdollar");g(b,y,P,"%","\\%");g(ee,y,P,"%","\\%");g(b,y,P,"_","\\_");g(ee,y,P,"_","\\_");g(ee,y,P,"_","\\textunderscore");g(b,y,P,"∠","\\angle",!0);g(b,y,P,"∞","\\infty",!0);g(b,y,P,"′","\\prime");g(b,y,P,"△","\\triangle");g(b,y,P,"Γ","\\Gamma",!0);g(b,y,P,"Δ","\\Delta",!0);g(b,y,P,"Θ","\\Theta",!0);g(b,y,P,"Λ","\\Lambda",!0);g(b,y,P,"Ξ","\\Xi",!0);g(b,y,P,"Π","\\Pi",!0);g(b,y,P,"Σ","\\Sigma",!0);g(b,y,P,"Υ","\\Upsilon",!0);g(b,y,P,"Φ","\\Phi",!0);g(b,y,P,"Ψ","\\Psi",!0);g(b,y,P,"Ω","\\Omega",!0);g(b,y,P,"A","Α");g(b,y,P,"B","Β");g(b,y,P,"E","Ε");g(b,y,P,"Z","Ζ");g(b,y,P,"H","Η");g(b,y,P,"I","Ι");g(b,y,P,"K","Κ");g(b,y,P,"M","Μ");g(b,y,P,"N","Ν");g(b,y,P,"O","Ο");g(b,y,P,"P","Ρ");g(b,y,P,"T","Τ");g(b,y,P,"X","Χ");g(b,y,P,"¬","\\neg",!0);g(b,y,P,"¬","\\lnot");g(b,y,P,"⊤","\\top");g(b,y,P,"⊥","\\bot");g(b,y,P,"∅","\\emptyset");g(b,B,P,"∅","\\varnothing");g(b,y,Se,"α","\\alpha",!0);g(b,y,Se,"β","\\beta",!0);g(b,y,Se,"γ","\\gamma",!0);g(b,y,Se,"δ","\\delta",!0);g(b,y,Se,"ϵ","\\epsilon",!0);g(b,y,Se,"ζ","\\zeta",!0);g(b,y,Se,"η","\\eta",!0);g(b,y,Se,"θ","\\theta",!0);g(b,y,Se,"ι","\\iota",!0);g(b,y,Se,"κ","\\kappa",!0);g(b,y,Se,"λ","\\lambda",!0);g(b,y,Se,"μ","\\mu",!0);g(b,y,Se,"ν","\\nu",!0);g(b,y,Se,"ξ","\\xi",!0);g(b,y,Se,"ο","\\omicron",!0);g(b,y,Se,"π","\\pi",!0);g(b,y,Se,"ρ","\\rho",!0);g(b,y,Se,"σ","\\sigma",!0);g(b,y,Se,"τ","\\tau",!0);g(b,y,Se,"υ","\\upsilon",!0);g(b,y,Se,"ϕ","\\phi",!0);g(b,y,Se,"χ","\\chi",!0);g(b,y,Se,"ψ","\\psi",!0);g(b,y,Se,"ω","\\omega",!0);g(b,y,Se,"ε","\\varepsilon",!0);g(b,y,Se,"ϑ","\\vartheta",!0);g(b,y,Se,"ϖ","\\varpi",!0);g(b,y,Se,"ϱ","\\varrho",!0);g(b,y,Se,"ς","\\varsigma",!0);g(b,y,Se,"φ","\\varphi",!0);g(b,y,ge,"∗","*",!0);g(b,y,ge,"+","+");g(b,y,ge,"−","-",!0);g(b,y,ge,"⋅","\\cdot",!0);g(b,y,ge,"∘","\\circ",!0);g(b,y,ge,"÷","\\div",!0);g(b,y,ge,"±","\\pm",!0);g(b,y,ge,"×","\\times",!0);g(b,y,ge,"∩","\\cap",!0);g(b,y,ge,"∪","\\cup",!0);g(b,y,ge,"∖","\\setminus",!0);g(b,y,ge,"∧","\\land");g(b,y,ge,"∨","\\lor");g(b,y,ge,"∧","\\wedge",!0);g(b,y,ge,"∨","\\vee",!0);g(b,y,P,"√","\\surd");g(b,y,Vi,"⟨","\\langle",!0);g(b,y,Vi,"∣","\\lvert");g(b,y,Vi,"∥","\\lVert");g(b,y,xi,"?","?");g(b,y,xi,"!","!");g(b,y,xi,"⟩","\\rangle",!0);g(b,y,xi,"∣","\\rvert");g(b,y,xi,"∥","\\rVert");g(b,y,N,"=","=");g(b,y,N,":",":");g(b,y,N,"≈","\\approx",!0);g(b,y,N,"≅","\\cong",!0);g(b,y,N,"≥","\\ge");g(b,y,N,"≥","\\geq",!0);g(b,y,N,"←","\\gets");g(b,y,N,">","\\gt",!0);g(b,y,N,"∈","\\in",!0);g(b,y,N,"","\\@not");g(b,y,N,"⊂","\\subset",!0);g(b,y,N,"⊃","\\supset",!0);g(b,y,N,"⊆","\\subseteq",!0);g(b,y,N,"⊇","\\supseteq",!0);g(b,B,N,"⊈","\\nsubseteq",!0);g(b,B,N,"⊉","\\nsupseteq",!0);g(b,y,N,"⊨","\\models");g(b,y,N,"←","\\leftarrow",!0);g(b,y,N,"≤","\\le");g(b,y,N,"≤","\\leq",!0);g(b,y,N,"<","\\lt",!0);g(b,y,N,"→","\\rightarrow",!0);g(b,y,N,"→","\\to");g(b,B,N,"≱","\\ngeq",!0);g(b,B,N,"≰","\\nleq",!0);g(b,y,ps," ","\\ ");g(b,y,ps," ","\\space");g(b,y,ps," ","\\nobreakspace");g(ee,y,ps," ","\\ ");g(ee,y,ps," "," ");g(ee,y,ps," ","\\space");g(ee,y,ps," ","\\nobreakspace");g(b,y,ps,"","\\nobreak");g(b,y,ps,"","\\allowbreak");g(b,y,Ja,",",",");g(b,y,Ja,";",";");g(b,B,ge,"⊼","\\barwedge",!0);g(b,B,ge,"⊻","\\veebar",!0);g(b,y,ge,"⊙","\\odot",!0);g(b,y,ge,"⊕","\\oplus",!0);g(b,y,ge,"⊗","\\otimes",!0);g(b,y,P,"∂","\\partial",!0);g(b,y,ge,"⊘","\\oslash",!0);g(b,B,ge,"⊚","\\circledcirc",!0);g(b,B,ge,"⊡","\\boxdot",!0);g(b,y,ge,"△","\\bigtriangleup");g(b,y,ge,"▽","\\bigtriangledown");g(b,y,ge,"†","\\dagger");g(b,y,ge,"⋄","\\diamond");g(b,y,ge,"⋆","\\star");g(b,y,ge,"◃","\\triangleleft");g(b,y,ge,"▹","\\triangleright");g(b,y,Vi,"{","\\{");g(ee,y,P,"{","\\{");g(ee,y,P,"{","\\textbraceleft");g(b,y,xi,"}","\\}");g(ee,y,P,"}","\\}");g(ee,y,P,"}","\\textbraceright");g(b,y,Vi,"{","\\lbrace");g(b,y,xi,"}","\\rbrace");g(b,y,Vi,"[","\\lbrack",!0);g(ee,y,P,"[","\\lbrack",!0);g(b,y,xi,"]","\\rbrack",!0);g(ee,y,P,"]","\\rbrack",!0);g(b,y,Vi,"(","\\lparen",!0);g(b,y,xi,")","\\rparen",!0);g(ee,y,P,"<","\\textless",!0);g(ee,y,P,">","\\textgreater",!0);g(b,y,Vi,"⌊","\\lfloor",!0);g(b,y,xi,"⌋","\\rfloor",!0);g(b,y,Vi,"⌈","\\lceil",!0);g(b,y,xi,"⌉","\\rceil",!0);g(b,y,P,"\\","\\backslash");g(b,y,P,"∣","|");g(b,y,P,"∣","\\vert");g(ee,y,P,"|","\\textbar",!0);g(b,y,P,"∥","\\|");g(b,y,P,"∥","\\Vert");g(ee,y,P,"∥","\\textbardbl");g(ee,y,P,"~","\\textasciitilde");g(ee,y,P,"\\","\\textbackslash");g(ee,y,P,"^","\\textasciicircum");g(b,y,N,"↑","\\uparrow",!0);g(b,y,N,"⇑","\\Uparrow",!0);g(b,y,N,"↓","\\downarrow",!0);g(b,y,N,"⇓","\\Downarrow",!0);g(b,y,N,"↕","\\updownarrow",!0);g(b,y,N,"⇕","\\Updownarrow",!0);g(b,y,Ot,"∐","\\coprod");g(b,y,Ot,"⋁","\\bigvee");g(b,y,Ot,"⋀","\\bigwedge");g(b,y,Ot,"⨄","\\biguplus");g(b,y,Ot,"⋂","\\bigcap");g(b,y,Ot,"⋃","\\bigcup");g(b,y,Ot,"∫","\\int");g(b,y,Ot,"∫","\\intop");g(b,y,Ot,"∬","\\iint");g(b,y,Ot,"∭","\\iiint");g(b,y,Ot,"∏","\\prod");g(b,y,Ot,"∑","\\sum");g(b,y,Ot,"⨂","\\bigotimes");g(b,y,Ot,"⨁","\\bigoplus");g(b,y,Ot,"⨀","\\bigodot");g(b,y,Ot,"∮","\\oint");g(b,y,Ot,"∯","\\oiint");g(b,y,Ot,"∰","\\oiiint");g(b,y,Ot,"⨆","\\bigsqcup");g(b,y,Ot,"∫","\\smallint");g(ee,y,To,"…","\\textellipsis");g(b,y,To,"…","\\mathellipsis");g(ee,y,To,"…","\\ldots",!0);g(b,y,To,"…","\\ldots",!0);g(b,y,To,"⋯","\\@cdots",!0);g(b,y,To,"⋱","\\ddots",!0);g(b,y,P,"⋮","\\varvdots");g(ee,y,P,"⋮","\\varvdots");g(b,y,ct,"ˊ","\\acute");g(b,y,ct,"ˋ","\\grave");g(b,y,ct,"¨","\\ddot");g(b,y,ct,"~","\\tilde");g(b,y,ct,"ˉ","\\bar");g(b,y,ct,"˘","\\breve");g(b,y,ct,"ˇ","\\check");g(b,y,ct,"^","\\hat");g(b,y,ct,"⃗","\\vec");g(b,y,ct,"˙","\\dot");g(b,y,ct,"˚","\\mathring");g(b,y,Se,"","\\@imath");g(b,y,Se,"","\\@jmath");g(b,y,P,"ı","ı");g(b,y,P,"ȷ","ȷ");g(ee,y,P,"ı","\\i",!0);g(ee,y,P,"ȷ","\\j",!0);g(ee,y,P,"ß","\\ss",!0);g(ee,y,P,"æ","\\ae",!0);g(ee,y,P,"œ","\\oe",!0);g(ee,y,P,"ø","\\o",!0);g(ee,y,P,"Æ","\\AE",!0);g(ee,y,P,"Œ","\\OE",!0);g(ee,y,P,"Ø","\\O",!0);g(ee,y,ct,"ˊ","\\'");g(ee,y,ct,"ˋ","\\`");g(ee,y,ct,"ˆ","\\^");g(ee,y,ct,"˜","\\~");g(ee,y,ct,"ˉ","\\=");g(ee,y,ct,"˘","\\u");g(ee,y,ct,"˙","\\.");g(ee,y,ct,"¸","\\c");g(ee,y,ct,"˚","\\r");g(ee,y,ct,"ˇ","\\v");g(ee,y,ct,"¨",'\\"');g(ee,y,ct,"˝","\\H");g(ee,y,ct,"◯","\\textcircled");var qv={"--":!0,"---":!0,"``":!0,"''":!0};g(ee,y,P,"–","--",!0);g(ee,y,P,"–","\\textendash");g(ee,y,P,"—","---",!0);g(ee,y,P,"—","\\textemdash");g(ee,y,P,"‘","`",!0);g(ee,y,P,"‘","\\textquoteleft");g(ee,y,P,"’","'",!0);g(ee,y,P,"’","\\textquoteright");g(ee,y,P,"“","``",!0);g(ee,y,P,"“","\\textquotedblleft");g(ee,y,P,"”","''",!0);g(ee,y,P,"”","\\textquotedblright");g(b,y,P,"°","\\degree",!0);g(ee,y,P,"°","\\degree");g(ee,y,P,"°","\\textdegree",!0);g(b,y,P,"£","\\pounds");g(b,y,P,"£","\\mathsterling",!0);g(ee,y,P,"£","\\pounds");g(ee,y,P,"£","\\textsterling",!0);g(b,B,P,"✠","\\maltese");g(ee,B,P,"✠","\\maltese");var ym='0123456789/@."';for(var hc=0;hc<ym.length;hc++){var wm=ym.charAt(hc);g(b,y,P,wm,wm)}var xm='0123456789!@*()-=+";:?/.,';for(var dc=0;dc<xm.length;dc++){var Sm=xm.charAt(dc);g(ee,y,P,Sm,Sm)}var Tu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var fc=0;fc<Tu.length;fc++){var yl=Tu.charAt(fc);g(b,y,Se,yl,yl),g(ee,y,P,yl,yl)}g(b,B,P,"C","ℂ");g(ee,B,P,"C","ℂ");g(b,B,P,"H","ℍ");g(ee,B,P,"H","ℍ");g(b,B,P,"N","ℕ");g(ee,B,P,"N","ℕ");g(b,B,P,"P","ℙ");g(ee,B,P,"P","ℙ");g(b,B,P,"Q","ℚ");g(ee,B,P,"Q","ℚ");g(b,B,P,"R","ℝ");g(ee,B,P,"R","ℝ");g(b,B,P,"Z","ℤ");g(ee,B,P,"Z","ℤ");g(b,y,Se,"h","ℎ");g(ee,y,Se,"h","ℎ");var De;for(var di=0;di<Tu.length;di++){var bt=Tu.charAt(di);De=String.fromCharCode(55349,56320+di),g(b,y,Se,bt,De),g(ee,y,P,bt,De),De=String.fromCharCode(55349,56372+di),g(b,y,Se,bt,De),g(ee,y,P,bt,De),De=String.fromCharCode(55349,56424+di),g(b,y,Se,bt,De),g(ee,y,P,bt,De),De=String.fromCharCode(55349,56580+di),g(b,y,Se,bt,De),g(ee,y,P,bt,De),De=String.fromCharCode(55349,56684+di),g(b,y,Se,bt,De),g(ee,y,P,bt,De),De=String.fromCharCode(55349,56736+di),g(b,y,Se,bt,De),g(ee,y,P,bt,De),De=String.fromCharCode(55349,56788+di),g(b,y,Se,bt,De),g(ee,y,P,bt,De),De=String.fromCharCode(55349,56840+di),g(b,y,Se,bt,De),g(ee,y,P,bt,De),De=String.fromCharCode(55349,56944+di),g(b,y,Se,bt,De),g(ee,y,P,bt,De),di<26&&(De=String.fromCharCode(55349,56632+di),g(b,y,Se,bt,De),g(ee,y,P,bt,De),De=String.fromCharCode(55349,56476+di),g(b,y,Se,bt,De),g(ee,y,P,bt,De))}De="𝕜";g(b,y,Se,"k",De);g(ee,y,P,"k",De);for(var an=0;an<10;an++){var As=an.toString();De=String.fromCharCode(55349,57294+an),g(b,y,Se,As,De),g(ee,y,P,As,De),De=String.fromCharCode(55349,57314+an),g(b,y,Se,As,De),g(ee,y,P,As,De),De=String.fromCharCode(55349,57324+an),g(b,y,Se,As,De),g(ee,y,P,As,De),De=String.fromCharCode(55349,57334+an),g(b,y,Se,As,De),g(ee,y,P,As,De)}var Xh="ÐÞþ";for(var pc=0;pc<Xh.length;pc++){var wl=Xh.charAt(pc);g(b,y,Se,wl,wl),g(ee,y,P,wl,wl)}var Jh={mathClass:"mathbf",textClass:"textbf",font:"Main-Bold"},km={mathClass:"mathnormal",textClass:"textit",font:"Math-Italic"},Cm={mathClass:"boldsymbol",textClass:"boldsymbol",font:"Main-BoldItalic"},a9={mathClass:"mathscr",textClass:"textscr",font:"Script-Regular"},pn={mathClass:"",textClass:"",font:""},Am={mathClass:"mathfrak",textClass:"textfrak",font:"Fraktur-Regular"},Em={mathClass:"mathbb",textClass:"textbb",font:"AMS-Regular"},Dm={mathClass:"mathboldfrak",textClass:"textboldfrak",font:"Fraktur-Regular"},Zh={mathClass:"mathsf",textClass:"textsf",font:"SansSerif-Regular"},Qh={mathClass:"mathboldsf",textClass:"textboldsf",font:"SansSerif-Bold"},Mm={mathClass:"mathitsf",textClass:"textitsf",font:"SansSerif-Italic"},ed={mathClass:"mathtt",textClass:"texttt",font:"Typewriter-Regular"},Tm=[Jh,Jh,km,km,Cm,Cm,a9,pn,pn,pn,Am,Am,Em,Em,Dm,Dm,Zh,Zh,Qh,Qh,Mm,Mm,pn,pn,ed,ed],l9=[Jh,pn,Zh,Qh,ed],u9=t=>{var e=t.charCodeAt(0),i=t.charCodeAt(1),r=(e-55296)*1024+(i-56320)+65536;if(119808<=r&&r<120484){var s=Math.floor((r-119808)/26);return Tm[s]}else if(120782<=r&&r<=120831){var n=Math.floor((r-120782)/10);return l9[n]}else{if(r===120485||r===120486)return Tm[0];if(120486<r&&r<120782)return pn;throw new se("Unsupported character: "+t)}},f0=function(e,i,r){if(lt[r][e]){var s=lt[r][e].replace;s&&(e=s)}return{value:e,metrics:$f(e,i,r)}},pi=function(e,i,r,s,n){var o=f0(e,i,r),a=o.metrics;e=o.value;var l;if(a){var u=a.italic;(r==="text"||s&&s.font==="mathit")&&(u=0),l=new Wi(e,a.height,a.depth,u,a.skew,a.width,n)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+e+"' in style '"+i+"' and mode '"+r+"'")),l=new Wi(e,0,0,0,0,0,n);if(s){l.maxFontSize=s.sizeMultiplier,s.style.isTight()&&l.classes.push("mtight");var c=s.getColor();c&&(l.style.color=c)}return l},qf=function(e,i,r,s){return s===void 0&&(s=[]),r.font==="boldsymbol"&&f0(e,"Main-Bold",i).metrics?pi(e,"Main-Bold",i,r,s.concat(["mathbf"])):e==="\\"||lt[i][e].font==="main"?pi(e,"Main-Regular",i,r,s):pi(e,"AMS-Regular",i,r,s.concat(["amsrm"]))},c9=function(e,i,r){return r!=="textord"&&f0(e,"Math-BoldItalic",i).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},p0=function(e,i){var r=e.type==="mathord"?"mathord":"textord",s=e.mode,n=e.text,o=["mord"],{font:a,fontFamily:l,fontWeight:u,fontShape:c}=i,h=s==="math"||s==="text"&&!!a,d=h?a:l,f="",p="";if(n.charCodeAt(0)===55349){var v=u9(n);f=v.font,p=v[s+"Class"]}if(f)return pi(n,f,s,i,o.concat(p));if(d){var _,w;if(d==="boldsymbol"){var x=c9(n,s,r);_=x.fontName,w=[x.fontClass]}else h?(_=td[a].fontName,w=[a]):(_=xl(l,u,c),w=[l,u,c]);if(f0(n,_,s).metrics)return pi(n,_,s,i,o.concat(w));if(qv.hasOwnProperty(n)&&_.slice(0,10)==="Typewriter"){for(var C=[],D=0;D<n.length;D++)C.push(pi(n[D],_,s,i,o.concat(w)));return ms(C)}}if(r==="mathord")return pi(n,"Math-Italic",s,i,o.concat(["mathnormal"]));if(r==="textord"){var R=lt[s][n]&&lt[s][n].font;if(R==="ams"){var E=xl("amsrm",u,c);return pi(n,E,s,i,o.concat("amsrm",u,c))}else if(R==="main"||!R){var L=xl("textrm",u,c);return pi(n,L,s,i,o.concat(u,c))}else{var q=xl(R,u,c);return pi(n,q,s,i,o.concat(q,u,c))}}else throw new Error("unexpected type: "+r+" in makeOrd")},h9=(t,e)=>{if(Hs(t.classes)!==Hs(e.classes)||t.skew!==e.skew||t.maxFontSize!==e.maxFontSize||t.italic!==0&&t.hasClass("mathnormal"))return!1;if(t.classes.length===1){var i=t.classes[0];if(i==="mbin"||i==="mord")return!1}for(var r of Object.keys(t.style))if(t.style[r]!==e.style[r])return!1;for(var s of Object.keys(e.style))if(t.style[s]!==e.style[s])return!1;return!0},Wv=t=>{for(var e=0;e<t.length-1;e++){var i=t[e],r=t[e+1];i instanceof Wi&&r instanceof Wi&&h9(i,r)&&(i.text+=r.text,i.height=Math.max(i.height,r.height),i.depth=Math.max(i.depth,r.depth),i.italic=r.italic,t.splice(e+1,1),e--)}return t},Wf=function(e){for(var i=0,r=0,s=0,n=0;n<e.children.length;n++){var o=e.children[n];o.height>i&&(i=o.height),o.depth>r&&(r=o.depth),o.maxFontSize>s&&(s=o.maxFontSize)}e.height=i,e.depth=r,e.maxFontSize=s},ie=function(e,i,r,s){var n=new Mo(e,i,r,s);return Wf(n),n},qs=(t,e,i,r)=>new Mo(t,e,i,r),mo=function(e,i,r){var s=ie([e],[],i);return s.height=Math.max(r||i.fontMetrics().defaultRuleThickness,i.minRuleThickness),s.style.borderBottomWidth=ae(s.height),s.maxFontSize=1,s},d9=function(e,i,r,s){var n=new d0(e,i,r,s);return Wf(n),n},ms=function(e){var i=new Do(e);return Wf(i),i},go=function(e,i){return e instanceof Do?ie([],[e],i):e},f9=function(e){if(e.positionType==="individualShift"){for(var i=e.children,r=[i[0]],s=-i[0].shift-i[0].elem.depth,n=s,o=1;o<i.length;o++){var a=-i[o].shift-n-i[o].elem.depth,l=a-(i[o-1].elem.height+i[o-1].elem.depth);n=n+a,r.push({type:"kern",size:l}),r.push(i[o])}return{children:r,depth:s}}var u;if(e.positionType==="top"){for(var c=e.positionData,h=0;h<e.children.length;h++){var d=e.children[h];c-=d.type==="kern"?d.size:d.elem.height+d.elem.depth}u=c}else if(e.positionType==="bottom")u=-e.positionData;else{var f=e.children[0];if(f.type!=="elem")throw new Error('First child must have type "elem".');if(e.positionType==="shift")u=-f.elem.depth-e.positionData;else if(e.positionType==="firstBaseline")u=-f.elem.depth;else throw new Error("Invalid positionType "+e.positionType+".")}return{children:e.children,depth:u}},Ue=function(e,i){for(var{children:r,depth:s}=f9(e),n=0,o=0;o<r.length;o++){var a=r[o];if(a.type==="elem"){var l=a.elem;n=Math.max(n,l.maxFontSize,l.height)}}n+=2;var u=ie(["pstrut"],[]);u.style.height=ae(n);for(var c=[],h=s,d=s,f=s,p=0;p<r.length;p++){var v=r[p];if(v.type==="kern")f+=v.size;else{var _=v.elem,w=v.wrapperClasses||[],x=v.wrapperStyle||{},C=ie(w,[u,_],void 0,x);C.style.top=ae(-n-f-_.depth),v.marginLeft&&(C.style.marginLeft=v.marginLeft),v.marginRight&&(C.style.marginRight=v.marginRight),c.push(C),f+=_.height+_.depth}h=Math.min(h,f),d=Math.max(d,f)}var D=ie(["vlist"],c);D.style.height=ae(d);var R;if(h<0){var E=ie([],[]),L=ie(["vlist"],[E]);L.style.height=ae(-h);var q=ie(["vlist-s"],[new Wi("​")]);R=[ie(["vlist-r"],[D,q]),ie(["vlist-r"],[L])]}else R=[ie(["vlist-r"],[D])];var F=ie(["vlist-t"],R);return R.length===2&&F.classes.push("vlist-t2"),F.height=d,F.depth=-h,F},Kv=(t,e)=>{var i=ie(["mspace"],[],e),r=gt(t,e);return i.style.marginRight=ae(r),i},xl=(t,e,i)=>{var r,s;switch(t){case"amsrm":r="AMS";break;case"textrm":r="Main";break;case"textsf":r="SansSerif";break;case"texttt":r="Typewriter";break;default:r=t}return e==="textbf"&&i==="textit"?s="BoldItalic":e==="textbf"?s="Bold":i==="textit"?s="Italic":s="Regular",r+"-"+s},td={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},Vv={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},Uv=function(e,i){var[r,s,n]=Vv[e],o=new $s(r),a=new ls([o],{width:ae(s),height:ae(n),style:"width:"+ae(s),viewBox:"0 0 "+1e3*s+" "+1e3*n,preserveAspectRatio:"xMinYMin"}),l=qs(["overlay"],[a],i);return l.height=n,l.style.height=ae(n),l.style.width=ae(s),l},pt={number:3,unit:"mu"},ln={number:4,unit:"mu"},Zr={number:5,unit:"mu"},p9={mord:{mop:pt,mbin:ln,mrel:Zr,minner:pt},mop:{mord:pt,mop:pt,mrel:Zr,minner:pt},mbin:{mord:ln,mop:ln,mopen:ln,minner:ln},mrel:{mord:Zr,mop:Zr,mopen:Zr,minner:Zr},mopen:{},mclose:{mop:pt,mbin:ln,mrel:Zr,minner:pt},mpunct:{mord:pt,mop:pt,mrel:Zr,mopen:pt,mclose:pt,mpunct:pt,minner:pt},minner:{mord:pt,mop:pt,mbin:ln,mrel:Zr,mopen:pt,mpunct:pt,minner:pt}},m9={mord:{mop:pt},mop:{mord:pt,mop:pt},mbin:{},mrel:{},mopen:{},mclose:{mop:pt},mpunct:{},minner:{mop:pt}},Gv={},Ta={},Ba={};function pe(t){for(var{type:e,names:i,htmlBuilder:r,mathmlBuilder:s}=t,n=0;n<i.length;++n)Gv[i[n]]=t;e&&(r&&(Ta[e]=r),s&&(Ba[e]=s))}function On(t){var{type:e,htmlBuilder:i,mathmlBuilder:r}=t;i&&(Ta[e]=i),r&&(Ba[e]=r)}var Bu=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},Rt=function(e){return e.type==="ordgroup"?e.body:[e]},g9=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),v9=new Set(["rightmost","mrel","mclose","mpunct"]),b9={display:Ne.DISPLAY,text:Ne.TEXT,script:Ne.SCRIPT,scriptscript:Ne.SCRIPTSCRIPT},_9={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},$t=function(e,i,r,s){s===void 0&&(s=[null,null]);for(var n=[],o=0;o<e.length;o++){var a=Ge(e[o],i);if(a instanceof Do){var l=a.children;n.push(...l)}else n.push(a)}if(Wv(n),!r)return n;var u=i;if(e.length===1){var c=e[0];c.type==="sizing"?u=i.havingSize(c.size):c.type==="styling"&&(u=i.havingStyle(b9[c.style]))}var h=ie([s[0]||"leftmost"],[],i),d=ie([s[1]||"rightmost"],[],i),f=r==="root";return id(n,(p,v)=>{var _=v.classes[0],w=p.classes[0];_==="mbin"&&v9.has(w)?v.classes[0]="mord":w==="mbin"&&g9.has(_)&&(p.classes[0]="mord")},{node:h},d,f),id(n,(p,v)=>{var _,w,x=sd(v),C=sd(p),D=x&&C?p.hasClass("mtight")?(_=m9[x])==null?void 0:_[C]:(w=p9[x])==null?void 0:w[C]:null;if(D)return Kv(D,u)},{node:h},d,f),n},id=function(e,i,r,s,n){s&&e.push(s);for(var o=0;o<e.length;o++){var a=e[o],l=Yv(a);if(l){id(l.children,i,r,null,n);continue}var u=!a.hasClass("mspace");if(u){var c=i(a,r.node);c&&(r.insertAfter?r.insertAfter(c):(e.unshift(c),o++))}u?r.node=a:n&&a.hasClass("newline")&&(r.node=ie(["leftmost"])),r.insertAfter=(h=>d=>{e.splice(h+1,0,d),o++})(o)}s&&e.pop()},Yv=function(e){return e instanceof Do||e instanceof d0||e instanceof Mo&&e.hasClass("enclosing")?e:null},rd=function(e,i){var r=Yv(e);if(r){var s=r.children;if(s.length){if(i==="right")return rd(s[s.length-1],"right");if(i==="left")return rd(s[0],"left")}}return e},sd=function(e,i){if(!e)return null;i&&(e=rd(e,i));var r=e.classes[0];return _9[r]||null},Ra=function(e,i){var r=["nulldelimiter"].concat(e.baseSizingClasses());return ie(i.concat(r))},Ge=function(e,i,r){if(!e)return ie();if(Ta[e.type]){var s=Ta[e.type](e,i);if(r&&i.size!==r.size){s=ie(i.sizingClasses(r),[s],i);var n=i.sizeMultiplier/r.sizeMultiplier;s.height*=n,s.depth*=n}return s}else throw new se("Got group of unknown type: '"+e.type+"'")};function Sl(t,e){var i=ie(["base"],t,e),r=ie(["strut"]);return r.style.height=ae(i.height+i.depth),i.depth&&(r.style.verticalAlign=ae(-i.depth)),i.children.unshift(r),i}function nd(t,e){var i=null;t.length===1&&t[0].type==="tag"&&(i=t[0].tag,t=t[0].body);var r=$t(t,e,"root"),s;r.length===2&&r[1].hasClass("tag")&&(s=r.pop());for(var n=[],o=[],a=0;a<r.length;a++)if(o.push(r[a]),r[a].hasClass("mbin")||r[a].hasClass("mrel")||r[a].hasClass("allowbreak")){for(var l=!1;a<r.length-1&&r[a+1].hasClass("mspace")&&!r[a+1].hasClass("newline");)a++,o.push(r[a]),r[a].hasClass("nobreak")&&(l=!0);l||(n.push(Sl(o,e)),o=[])}else r[a].hasClass("newline")&&(o.pop(),o.length>0&&(n.push(Sl(o,e)),o=[]),n.push(r[a]));o.length>0&&n.push(Sl(o,e));var u;i?(u=Sl($t(i,e,!0),e),u.classes=["tag"],n.push(u)):s&&n.push(s);var c=ie(["katex-html"],n);if(c.setAttribute("aria-hidden","true"),u){var h=u.children[0];h.style.height=ae(c.height+c.depth),c.depth&&(h.style.verticalAlign=ae(-c.depth))}return c}function Xv(t){return new Do(t)}class ne{constructor(e,i,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=i||[],this.classes=r||[]}setAttribute(e,i){this.attributes[e]=i}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var i in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,i)&&e.setAttribute(i,this.attributes[i]);this.classes.length>0&&(e.className=Hs(this.classes));for(var r=0;r<this.children.length;r++)if(this.children[r]instanceof Nt&&this.children[r+1]instanceof Nt){for(var s=this.children[r].toText()+this.children[++r].toText();this.children[r+1]instanceof Nt;)s+=this.children[++r].toText();e.appendChild(new Nt(s).toNode())}else e.appendChild(this.children[r].toNode());return e}toMarkup(){var e="<"+this.type;for(var i in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,i)&&(e+=" "+i+'="',e+=ci(this.attributes[i]),e+='"');this.classes.length>0&&(e+=' class ="'+ci(Hs(this.classes))+'"'),e+=">";for(var r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e+="</"+this.type+">",e}toText(){return this.children.map(e=>e.toText()).join("")}}let Nt=class{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return ci(this.toText())}toText(){return this.text}};class Jv{constructor(e){this.width=void 0,this.character=void 0,this.width=e,e>=.05555&&e<=.05556?this.character=" ":e>=.1666&&e<=.1667?this.character=" ":e>=.2222&&e<=.2223?this.character=" ":e>=.2777&&e<=.2778?this.character="  ":e>=-.05556&&e<=-.05555?this.character=" ⁣":e>=-.1667&&e<=-.1666?this.character=" ⁣":e>=-.2223&&e<=-.2222?this.character=" ⁣":e>=-.2778&&e<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",ae(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+ae(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var y9=new Set(["\\imath","\\jmath"]),w9=new Set(["mrow","mtable"]),nr=function(e,i,r){return lt[i][e]&&lt[i][e].replace&&e.charCodeAt(0)!==55349&&!(qv.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=lt[i][e].replace),new Nt(e)},Kf=function(e){return e.length===1?e[0]:new ne("mrow",e)},x9={mathit:"italic",boldsymbol:t=>t.type==="textord"?"bold":"bold-italic",mathbf:"bold",mathbb:"double-struck",mathsfit:"sans-serif-italic",mathfrak:"fraktur",mathscr:"script",mathcal:"script",mathsf:"sans-serif",mathtt:"monospace"},Vf=(t,e)=>{if(t.mode==="text"){if(e.fontFamily==="texttt")return"monospace";if(e.fontFamily==="textsf")return e.fontShape==="textit"&&e.fontWeight==="textbf"?"sans-serif-bold-italic":e.fontShape==="textit"?"sans-serif-italic":e.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(e.fontShape==="textit"&&e.fontWeight==="textbf")return"bold-italic";if(e.fontShape==="textit")return"italic";if(e.fontWeight==="textbf")return"bold"}var i=e.font;if(!i||i==="mathnormal")return null;var r=t.mode,s=x9[i];if(s)return typeof s=="function"?s(t):s;var n=t.text;if(y9.has(n))return null;if(lt[r][n]){var o=lt[r][n].replace;o&&(n=o)}var a=td[i].fontName;return $f(n,a,r)?td[i].variant:null};function mc(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof Nt&&e.text==="."}else if(t.type==="mo"&&t.children.length===1&&t.getAttribute("separator")==="true"&&t.getAttribute("lspace")==="0em"&&t.getAttribute("rspace")==="0em"){var i=t.children[0];return i instanceof Nt&&i.text===","}else return!1}var Ui=function(e,i,r){if(e.length===1){var s=tt(e[0],i);return r&&s instanceof ne&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var n=[],o,a=0;a<e.length;a++){var l=tt(e[a],i);if(l instanceof ne&&o instanceof ne){if(l.type==="mtext"&&o.type==="mtext"&&l.getAttribute("mathvariant")===o.getAttribute("mathvariant")){o.children.push(...l.children);continue}else if(l.type==="mn"&&o.type==="mn"){o.children.push(...l.children);continue}else if(mc(l)&&o.type==="mn"){o.children.push(...l.children);continue}else if(l.type==="mn"&&mc(o))l.children=[...o.children,...l.children],n.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(o.type==="mn"||mc(o))){var u=l.children[0];u instanceof ne&&u.type==="mn"&&(u.children=[...o.children,...u.children],n.pop())}else if(o.type==="mi"&&o.children.length===1){var c=o.children[0];if(c instanceof Nt&&c.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var h=l.children[0];h instanceof Nt&&h.text.length>0&&(h.text=h.text.slice(0,1)+"̸"+h.text.slice(1),n.pop())}}}n.push(l),o=l}return n},Ws=function(e,i,r){return Kf(Ui(e,i,r))},tt=function(e,i){if(!e)return new ne("mrow");if(Ba[e.type])return Ba[e.type](e,i);throw new se("Got group of unknown type: '"+e.type+"'")};function Bm(t,e,i,r,s){var n=Ui(t,i),o;n.length===1&&n[0]instanceof ne&&w9.has(n[0].type)?o=n[0]:o=new ne("mrow",n);var a=new ne("annotation",[new Nt(e)]);a.setAttribute("encoding","application/x-tex");var l=new ne("semantics",[o,a]),u=new ne("math",[l]);u.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&u.setAttribute("display","block");var c=s?"katex":"katex-mathml";return ie([c],[u])}var S9=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],Rm=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],Nm=function(e,i){return i.size<2?e:S9[e-1][i.size-1]};class Qr{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||Qr.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=Rm[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var i={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};return Object.assign(i,e),new Qr(i)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:Nm(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:Rm[e-1]})}havingBaseStyle(e){e=e||this.style.text();var i=Nm(Qr.BASESIZE,e);return this.size===i&&this.textSize===Qr.BASESIZE&&this.style===e?this:this.extend({style:e,size:i})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==Qr.BASESIZE?["sizing","reset-size"+this.size,"size"+Qr.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=o9(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}Qr.BASESIZE=6;var Zv=function(e){return new Qr({style:e.displayMode?Ne.DISPLAY:Ne.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},Qv=function(e,i){if(i.displayMode){var r=["katex-display"];i.leqno&&r.push("leqno"),i.fleqn&&r.push("fleqn"),e=ie(r,[e])}return e},k9=function(e,i,r){var s=Zv(r),n;if(r.output==="mathml")return Bm(e,i,s,r.displayMode,!0);if(r.output==="html"){var o=nd(e,s);n=ie(["katex"],[o])}else{var a=Bm(e,i,s,r.displayMode,!1),l=nd(e,s);n=ie(["katex"],[a,l])}return Qv(n,r)},C9=function(e,i,r){var s=Zv(r),n=nd(e,s),o=ie(["katex"],[n]);return Qv(o,r)},A9={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",underbracket:"⎵",overbracket:"⎴",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},m0=function(e){var i=new ne("mo",[new Nt(A9[e.replace(/^\\/,"")])]);return i.setAttribute("stretchy","true"),i},E9={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overbracket:[["leftbracketover","rightbracketover"],1.6,440],underbracket:[["leftbracketunder","rightbracketunder"],1.6,410],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},D9=new Set(["widehat","widecheck","widetilde","utilde"]),g0=function(e,i){function r(){var a=4e5,l=e.label.slice(1);if(D9.has(l)&&"base"in e){var u=e.base.type==="ordgroup"?e.base.body.length:1,c,h,d;if(u>5)l==="widehat"||l==="widecheck"?(c=420,a=2364,d=.42,h=l+"4"):(c=312,a=2340,d=.34,h="tilde4");else{var f=[1,1,2,2,3,3][u];l==="widehat"||l==="widecheck"?(a=[0,1062,2364,2364,2364][f],c=[0,239,300,360,420][f],d=[0,.24,.3,.3,.36,.42][f],h=l+f):(a=[0,600,1033,2339,2340][f],c=[0,260,286,306,312][f],d=[0,.26,.286,.3,.306,.34][f],h="tilde"+f)}var p=new $s(h),v=new ls([p],{width:"100%",height:ae(d),viewBox:"0 0 "+a+" "+c,preserveAspectRatio:"none"});return{span:qs([],[v],i),minWidth:0,height:d}}else{var _=[],w=E9[l];if(!w)throw new Error('No SVG data for "'+l+'".');var[x,C,D]=w,R=D/1e3,E=x.length,L,q;if(E===1){if(w.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+l+'".');L=["hide-tail"],q=[w[3]]}else if(E===2)L=["halfarrow-left","halfarrow-right"],q=["xMinYMin","xMaxYMin"];else if(E===3)L=["brace-left","brace-center","brace-right"],q=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
305
+ `+E+" children.");for(var F=0;F<E;F++){var $=new $s(x[F]),W=new ls([$],{width:"400em",height:ae(R),viewBox:"0 0 "+a+" "+D,preserveAspectRatio:q[F]+" slice"}),z=qs([L[F]],[W],i);if(E===1)return{span:z,minWidth:C,height:R};z.style.height=ae(R),_.push(z)}return{span:ie(["stretchy"],_,i),minWidth:C,height:R}}}var{span:s,minWidth:n,height:o}=r();return s.height=o,s.style.height=ae(o),n>0&&(s.style.minWidth=ae(n)),s},M9=function(e,i,r,s,n){var o,a=e.height+e.depth+r+s;if(/fbox|color|angl/.test(i)){if(o=ie(["stretchy",i],[],n),i==="fbox"){var l=n.color&&n.getColor();l&&(o.style.borderColor=l)}}else{var u=[];/^[bx]cancel$/.test(i)&&u.push(new Yh({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(i)&&u.push(new Yh({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var c=new ls(u,{width:"100%",height:ae(a)});o=qs([],[c],n)}return o.height=a,o.style.height=ae(a),o},T9={bin:1,close:1,inner:1,open:1,punct:1,rel:1},B9={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};function R9(t){return t in T9}function Le(t,e){if(!t||t.type!==e)throw new Error("Expected node of type "+e+", but got "+(t?"node of type "+t.type:String(t)));return t}function v0(t){var e=b0(t);if(!e)throw new Error("Expected node of symbol group type, but got "+(t?"node of type "+t.type:String(t)));return e}function b0(t){return t&&(t.type==="atom"||B9.hasOwnProperty(t.type))?t:null}var e3=t=>{if(t instanceof Wi)return t;if(s9(t)&&t.children.length===1)return e3(t.children[0])},t3=(t,e)=>{var i,r,s;t&&t.type==="supsub"?(r=Le(t.base,"accent"),i=r.base,t.base=i,s=r9(Ge(t,e)),t.base=r):(r=Le(t,"accent"),i=r.base);var n=Ge(i,e.havingCrampedStyle()),o=r.isShifty&&fs(i),a=0;if(o){var l,u;a=(l=(u=e3(n))==null?void 0:u.skew)!=null?l:0}var c=r.label==="\\c",h=c?n.height+n.depth:Math.min(n.height,e.fontMetrics().xHeight),d;if(r.isStretchy)d=g0(r,e),d=Ue({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"elem",elem:d,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+ae(2*a)+")",marginLeft:ae(2*a)}:void 0}]});else{var f,p;r.label==="\\vec"?(f=Uv("vec",e),p=Vv.vec[1]):(f=p0({type:"textord",mode:r.mode,text:r.label},e),f=i9(f),f.italic=0,p=f.width,c&&(h+=f.depth)),d=ie(["accent-body"],[f]);var v=r.label==="\\textcircled";v&&(d.classes.push("accent-full"),h=n.height);var _=a;v||(_-=p/2),d.style.left=ae(_),r.label==="\\textcircled"&&(d.style.top=".2em"),d=Ue({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:-h},{type:"elem",elem:d}]})}var w=ie(["mord","accent"],[d],e);return s?(s.children[0]=w,s.height=Math.max(w.height,s.height),s.classes[0]="mord",s):w},N9=(t,e)=>{var i=t.isStretchy?m0(t.label):new ne("mo",[nr(t.label,t.mode)]),r=new ne("mover",[tt(t.base,e),i]);return r.setAttribute("accent","true"),r},L9=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));pe({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],numArgs:1,handler:(t,e)=>{var i=Bu(e[0]),r=!L9.test(t.funcName),s=!r||t.funcName==="\\widehat"||t.funcName==="\\widetilde"||t.funcName==="\\widecheck";return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:r,isShifty:s,base:i}},htmlBuilder:t3,mathmlBuilder:N9});pe({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"],handler:(t,e)=>{var i=e[0],r=t.parser.mode;return r==="math"&&(t.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+t.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:t.funcName,isStretchy:!1,isShifty:!0,base:i}}});pe({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],numArgs:1,handler:(t,e)=>{var{parser:i,funcName:r}=t,s=e[0];return{type:"accentUnder",mode:i.mode,label:r,base:s}},htmlBuilder:(t,e)=>{var i=Ge(t.base,e),r=g0(t,e),s=t.label==="\\utilde"?.12:0,n=Ue({positionType:"top",positionData:i.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:i}]});return ie(["mord","accentunder"],[n],e)},mathmlBuilder:(t,e)=>{var i=m0(t.label),r=new ne("munder",[tt(t.base,e),i]);return r.setAttribute("accentunder","true"),r}});var kl=t=>{var e=new ne("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};pe({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],numArgs:1,numOptionalArgs:1,handler(t,e,i){var{parser:r,funcName:s}=t;return{type:"xArrow",mode:r.mode,label:s,body:e[0],below:i[0]}},htmlBuilder(t,e){var i=e.style,r=e.havingStyle(i.sup()),s=go(Ge(t.body,r,e),e),n=t.label.slice(0,2)==="\\x"?"x":"cd";s.classes.push(n+"-arrow-pad");var o;t.below&&(r=e.havingStyle(i.sub()),o=go(Ge(t.below,r,e),e),o.classes.push(n+"-arrow-pad"));var a=g0(t,e),l=-e.fontMetrics().axisHeight+.5*a.height,u=-e.fontMetrics().axisHeight-.5*a.height-.111;(s.depth>.25||t.label==="\\xleftequilibrium")&&(u-=s.depth);var c;if(o){var h=-e.fontMetrics().axisHeight+o.height+.5*a.height+.111;c=Ue({positionType:"individualShift",children:[{type:"elem",elem:s,shift:u},{type:"elem",elem:a,shift:l,wrapperClasses:["svg-align"]},{type:"elem",elem:o,shift:h}]})}else c=Ue({positionType:"individualShift",children:[{type:"elem",elem:s,shift:u},{type:"elem",elem:a,shift:l,wrapperClasses:["svg-align"]}]});return ie(["mrel","x-arrow"],[c],e)},mathmlBuilder(t,e){var i=m0(t.label);i.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(t.body){var s=kl(tt(t.body,e));if(t.below){var n=kl(tt(t.below,e));r=new ne("munderover",[i,n,s])}else r=new ne("mover",[i,s])}else if(t.below){var o=kl(tt(t.below,e));r=new ne("munder",[i,o])}else r=kl(),r=new ne("mover",[i,r]);return r}});function O9(t,e){var i=$t(t.body,e,!0);return ie([t.mclass],i,e)}function P9(t,e){var i,r=Ui(t.body,e);return t.mclass==="minner"?i=new ne("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(i=r[0],i.type="mi"):i=new ne("mi",r):(t.isCharacterBox?(i=r[0],i.type="mo"):i=new ne("mo",r),t.mclass==="mbin"?(i.attributes.lspace="0.22em",i.attributes.rspace="0.22em"):t.mclass==="mpunct"?(i.attributes.lspace="0em",i.attributes.rspace="0.17em"):(t.mclass==="mopen"||t.mclass==="mclose")&&(i.attributes.lspace="0em",i.attributes.rspace="0em")),i}pe({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],numArgs:1,primitive:!0,handler(t,e){var{parser:i,funcName:r}=t,s=e[0];return{type:"mclass",mode:i.mode,mclass:"m"+r.slice(5),body:Rt(s),isCharacterBox:fs(s)}},htmlBuilder:O9,mathmlBuilder:P9});var _0=t=>{var e=t.type==="ordgroup"&&t.body.length?t.body[0]:t;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};pe({type:"mclass",names:["\\@binrel"],numArgs:2,handler(t,e){var{parser:i}=t;return{type:"mclass",mode:i.mode,mclass:_0(e[0]),body:Rt(e[1]),isCharacterBox:fs(e[1])}}});pe({type:"mclass",names:["\\stackrel","\\overset","\\underset"],numArgs:2,handler(t,e){var{parser:i,funcName:r}=t,s=e[1],n=e[0],o;r!=="\\stackrel"?o=_0(s):o="mrel";var a={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:Rt(s)},l=r==="\\underset"?{type:"supsub",mode:n.mode,base:a,sub:n}:{type:"supsub",mode:n.mode,base:a,sup:n};return{type:"mclass",mode:i.mode,mclass:o,body:[l],isCharacterBox:fs(l)}}});pe({type:"pmb",names:["\\pmb"],numArgs:1,allowedInText:!0,handler(t,e){var{parser:i}=t;return{type:"pmb",mode:i.mode,mclass:_0(e[0]),body:Rt(e[0])}},htmlBuilder(t,e){var i=$t(t.body,e,!0),r=ie([t.mclass],i,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(t,e){var i=Ui(t.body,e),r=new ne("mstyle",i);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var F9={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},Lm=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),Om=t=>t.type==="textord"&&t.text==="@",I9=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function z9(t,e,i){var r=F9[t];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return i.callFunction(r,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var s=i.callFunction("\\\\cdleft",[e[0]],[]),n={type:"atom",text:r,mode:"math",family:"rel"},o=i.callFunction("\\Big",[n],[]),a=i.callFunction("\\\\cdright",[e[1]],[]),l={type:"ordgroup",mode:"math",body:[s,o,a]};return i.callFunction("\\\\cdparent",[l],[])}case"\\\\cdlongequal":return i.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var u={type:"textord",text:"\\Vert",mode:"math"};return i.callFunction("\\Big",[u],[])}default:return{type:"textord",text:" ",mode:"math"}}}function j9(t){var e=[];for(t.gullet.beginGroup(),t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();;){e.push(t.parseExpression(!1,"\\\\")),t.gullet.endGroup(),t.gullet.beginGroup();var i=t.fetch().text;if(i==="&"||i==="\\\\")t.consume();else if(i==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new se("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var r=[],s=[r],n=0;n<e.length;n++){for(var o=e[n],a=Lm(),l=0;l<o.length;l++)if(!Om(o[l]))a.body.push(o[l]);else{r.push(a),l+=1;var u=v0(o[l]).text,c=new Array(2);if(c[0]={type:"ordgroup",mode:"math",body:[]},c[1]={type:"ordgroup",mode:"math",body:[]},!"=|.".includes(u))if("<>AV".includes(u))for(var h=0;h<2;h++){for(var d=!0,f=l+1;f<o.length;f++){if(I9(o[f],u)){d=!1,l=f;break}if(Om(o[f]))throw new se("Missing a "+u+" character to complete a CD arrow.",o[f]);c[h].body.push(o[f])}if(d)throw new se("Missing a "+u+" character to complete a CD arrow.",o[l])}else throw new se('Expected one of "<>AV=|." after @',o[l]);var p=z9(u,c,t),v={type:"styling",body:[p],mode:"math",style:"display",resetFont:!0};r.push(v),a=Lm()}n%2===0?r.push(a):r.shift(),r=[],s.push(r)}t.gullet.endGroup(),t.gullet.endGroup();var _=new Array(s[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:s,arraystretch:1,addJot:!0,rowGaps:[null],cols:_,colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}pe({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],numArgs:1,handler(t,e){var{parser:i,funcName:r}=t;return{type:"cdlabel",mode:i.mode,side:r.slice(4),label:e[0]}},htmlBuilder(t,e){var i=e.havingStyle(e.style.sup()),r=go(Ge(t.label,i,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=ae(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var i=new ne("mrow",[tt(t.label,e)]);return i=new ne("mpadded",[i]),i.setAttribute("width","0"),t.side==="left"&&i.setAttribute("lspace","-1width"),i.setAttribute("voffset","0.7em"),i=new ne("mstyle",[i]),i.setAttribute("displaystyle","false"),i.setAttribute("scriptlevel","1"),i}});pe({type:"cdlabelparent",names:["\\\\cdparent"],numArgs:1,handler(t,e){var{parser:i}=t;return{type:"cdlabelparent",mode:i.mode,fragment:e[0]}},htmlBuilder(t,e){var i=go(Ge(t.fragment,e),e);return i.classes.push("cd-vert-arrow"),i},mathmlBuilder(t,e){return new ne("mrow",[tt(t.fragment,e)])}});pe({type:"textord",names:["\\@char"],numArgs:1,allowedInText:!0,handler(t,e){for(var{parser:i}=t,r=Le(e[0],"ordgroup"),s=r.body,n="",o=0;o<s.length;o++){var a=Le(s[o],"textord");n+=a.text}var l=parseInt(n),u;if(isNaN(l))throw new se("\\@char has non-numeric argument "+n);if(l<0||l>=1114111)throw new se("\\@char with invalid code point "+n);return l<=65535?u=String.fromCharCode(l):(l-=65536,u=String.fromCharCode((l>>10)+55296,(l&1023)+56320)),{type:"textord",mode:i.mode,text:u}}});var H9=(t,e)=>{var i=$t(t.body,e.withColor(t.color),!1);return ms(i)},$9=(t,e)=>{var i=Ui(t.body,e.withColor(t.color)),r=new ne("mstyle",i);return r.setAttribute("mathcolor",t.color),r};pe({type:"color",names:["\\textcolor"],numArgs:2,allowedInText:!0,argTypes:["color","original"],handler(t,e){var{parser:i}=t,r=Le(e[0],"color-token").color,s=e[1];return{type:"color",mode:i.mode,color:r,body:Rt(s)}},htmlBuilder:H9,mathmlBuilder:$9});pe({type:"color",names:["\\color"],numArgs:1,allowedInText:!0,argTypes:["color"],handler(t,e){var{parser:i,breakOnTokenText:r}=t,s=Le(e[0],"color-token").color;i.gullet.macros.set("\\current@color",s);var n=i.parseExpression(!0,r);return{type:"color",mode:i.mode,color:s,body:n}}});pe({type:"cr",names:["\\\\"],numArgs:0,numOptionalArgs:0,allowedInText:!0,handler(t,e,i){var{parser:r}=t,s=r.gullet.future().text==="["?r.parseSizeGroup(!0):null,n=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:n,size:s&&Le(s,"size").value}},htmlBuilder(t,e){var i=ie(["mspace"],[],e);return t.newLine&&(i.classes.push("newline"),t.size&&(i.style.marginTop=ae(gt(t.size,e)))),i},mathmlBuilder(t,e){var i=new ne("mspace");return t.newLine&&(i.setAttribute("linebreak","newline"),t.size&&i.setAttribute("height",ae(gt(t.size,e)))),i}});var od={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},i3=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new se("Expected a control sequence",t);return e},q9=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},r3=(t,e,i,r)=>{var s=t.gullet.macros.get(i.text);s==null&&(i.noexpand=!0,s={tokens:[i],numArgs:0,unexpandable:!t.gullet.isExpandable(i.text)}),t.gullet.macros.set(e,s,r)};pe({type:"internal",names:["\\global","\\long","\\\\globallong"],numArgs:0,allowedInText:!0,handler(t){var{parser:e,funcName:i}=t;e.consumeSpaces();var r=e.fetch();if(od[r.text])return(i==="\\global"||i==="\\\\globallong")&&(r.text=od[r.text]),Le(e.parseFunction(),"internal");throw new se("Invalid token after macro prefix",r)}});pe({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],numArgs:0,allowedInText:!0,primitive:!0,handler(t){var{parser:e,funcName:i}=t,r=e.gullet.popToken(),s=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(s))throw new se("Expected a control sequence",r);for(var n=0,o,a=[[]];e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){o=e.gullet.future(),a[n].push("{");break}if(r=e.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new se('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==n+1)throw new se('Argument number "'+r.text+'" out of order');n++,a.push([])}else{if(r.text==="EOF")throw new se("Expected a macro definition");a[n].push(r.text)}var{tokens:l}=e.gullet.consumeArg();return o&&l.unshift(o),(i==="\\edef"||i==="\\xdef")&&(l=e.gullet.expandTokens(l),l.reverse()),e.gullet.macros.set(s,{tokens:l,numArgs:n,delimiters:a},i===od[i]),{type:"internal",mode:e.mode}}});pe({type:"internal",names:["\\let","\\\\globallet"],numArgs:0,allowedInText:!0,primitive:!0,handler(t){var{parser:e,funcName:i}=t,r=i3(e.gullet.popToken());e.gullet.consumeSpaces();var s=q9(e);return r3(e,r,s,i==="\\\\globallet"),{type:"internal",mode:e.mode}}});pe({type:"internal",names:["\\futurelet","\\\\globalfuture"],numArgs:0,allowedInText:!0,primitive:!0,handler(t){var{parser:e,funcName:i}=t,r=i3(e.gullet.popToken()),s=e.gullet.popToken(),n=e.gullet.popToken();return r3(e,r,n,i==="\\\\globalfuture"),e.gullet.pushToken(n),e.gullet.pushToken(s),{type:"internal",mode:e.mode}}});var ea=function(e,i,r){var s=lt.math[e]&&lt.math[e].replace,n=$f(s||e,i,r);if(!n)throw new Error("Unsupported symbol "+e+" and font size "+i+".");return n},Uf=function(e,i,r,s){var n=r.havingBaseStyle(i),o=ie(s.concat(n.sizingClasses(r)),[e],r),a=n.sizeMultiplier/r.sizeMultiplier;return o.height*=a,o.depth*=a,o.maxFontSize=n.sizeMultiplier,o},s3=function(e,i,r){var s=i.havingBaseStyle(r),n=(1-i.sizeMultiplier/s.sizeMultiplier)*i.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=ae(n),e.height-=n,e.depth+=n},W9=function(e,i,r,s,n,o){var a=pi(e,"Main-Regular",n,s),l=Uf(a,i,s,o);return s3(l,s,i),l},K9=function(e,i,r,s){return pi(e,"Size"+i+"-Regular",r,s)},n3=function(e,i,r,s,n,o){var a=K9(e,i,n,s),l=Uf(ie(["delimsizing","size"+i],[a],s),Ne.TEXT,s,o);return r&&s3(l,s,Ne.TEXT),l},gc=function(e,i,r){var s;i==="Size1-Regular"?s="delim-size1":s="delim-size4";var n=ie(["delimsizinginner",s],[ie([],[pi(e,i,r)])]);return{type:"elem",elem:n}},vc=function(e,i,r){var s=Or["Size4-Regular"][e.charCodeAt(0)]?Or["Size4-Regular"][e.charCodeAt(0)][4]:Or["Size1-Regular"][e.charCodeAt(0)][4],n=new $s("inner",YS(e,Math.round(1e3*i))),o=new ls([n],{width:ae(s),height:ae(i),style:"width:"+ae(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*i),preserveAspectRatio:"xMinYMin"}),a=qs([],[o],r);return a.height=i,a.style.height=ae(i),a.style.width=ae(s),{type:"elem",elem:a}},ad=.008,Cl={type:"kern",size:-1*ad},V9=new Set(["|","\\lvert","\\rvert","\\vert"]),U9=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),o3=function(e,i,r,s,n,o){var a,l,u,c,h="",d=0;a=u=c=e,l=null;var f="Size1-Regular";e==="\\uparrow"?u=c="⏐":e==="\\Uparrow"?u=c="‖":e==="\\downarrow"?a=u="⏐":e==="\\Downarrow"?a=u="‖":e==="\\updownarrow"?(a="\\uparrow",u="⏐",c="\\downarrow"):e==="\\Updownarrow"?(a="\\Uparrow",u="‖",c="\\Downarrow"):V9.has(e)?(u="∣",h="vert",d=333):U9.has(e)?(u="∥",h="doublevert",d=556):e==="["||e==="\\lbrack"?(a="⎡",u="⎢",c="⎣",f="Size4-Regular",h="lbrack",d=667):e==="]"||e==="\\rbrack"?(a="⎤",u="⎥",c="⎦",f="Size4-Regular",h="rbrack",d=667):e==="\\lfloor"||e==="⌊"?(u=a="⎢",c="⎣",f="Size4-Regular",h="lfloor",d=667):e==="\\lceil"||e==="⌈"?(a="⎡",u=c="⎢",f="Size4-Regular",h="lceil",d=667):e==="\\rfloor"||e==="⌋"?(u=a="⎥",c="⎦",f="Size4-Regular",h="rfloor",d=667):e==="\\rceil"||e==="⌉"?(a="⎤",u=c="⎥",f="Size4-Regular",h="rceil",d=667):e==="("||e==="\\lparen"?(a="⎛",u="⎜",c="⎝",f="Size4-Regular",h="lparen",d=875):e===")"||e==="\\rparen"?(a="⎞",u="⎟",c="⎠",f="Size4-Regular",h="rparen",d=875):e==="\\{"||e==="\\lbrace"?(a="⎧",l="⎨",c="⎩",u="⎪",f="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(a="⎫",l="⎬",c="⎭",u="⎪",f="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(a="⎧",c="⎩",u="⎪",f="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(a="⎫",c="⎭",u="⎪",f="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(a="⎧",c="⎭",u="⎪",f="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(a="⎫",c="⎩",u="⎪",f="Size4-Regular");var p=ea(a,f,n),v=p.height+p.depth,_=ea(u,f,n),w=_.height+_.depth,x=ea(c,f,n),C=x.height+x.depth,D=0,R=1;if(l!==null){var E=ea(l,f,n);D=E.height+E.depth,R=2}var L=v+C+D,q=Math.max(0,Math.ceil((i-L)/(R*w))),F=L+q*R*w,$=s.fontMetrics().axisHeight;r&&($*=s.sizeMultiplier);var W=F/2-$,z=[];if(h.length>0){var j=F-v-C,A=Math.round(F*1e3),O=XS(h,Math.round(j*1e3)),T=new $s(h,O),U=ae(d/1e3),H=ae(A/1e3),re=new ls([T],{width:U,height:H,viewBox:"0 0 "+d+" "+A}),G=qs([],[re],s);G.height=A/1e3,G.style.width=U,G.style.height=H,z.push({type:"elem",elem:G})}else{if(z.push(gc(c,f,n)),z.push(Cl),l===null){var X=F-v-C+2*ad;z.push(vc(u,X,s))}else{var oe=(F-v-C-D)/2+2*ad;z.push(vc(u,oe,s)),z.push(Cl),z.push(gc(l,f,n)),z.push(Cl),z.push(vc(u,oe,s))}z.push(Cl),z.push(gc(a,f,n))}var I=s.havingBaseStyle(Ne.TEXT),Y=Ue({positionType:"bottom",positionData:W,children:z});return Uf(ie(["delimsizing","mult"],[Y],I),Ne.TEXT,s,o)},bc=80,_c=.08,yc=function(e,i,r,s,n){var o=GS(e,s,r),a=new $s(e,o),l=new ls([a],{width:"400em",height:ae(i),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return qs(["hide-tail"],[l],n)},G9=function(e,i){var r=i.havingBaseSizing(),s=h3("\\surd",e*r.sizeMultiplier,c3,r),n=r.sizeMultiplier,o=Math.max(0,i.minRuleThickness-i.fontMetrics().sqrtRuleThickness),a,l,u,c,h;return s.type==="small"?(c=1e3+1e3*o+bc,e<1?n=1:e<1.4&&(n=.7),l=(1+o+_c)/n,u=(1+o)/n,a=yc("sqrtMain",l,c,o,i),a.style.minWidth="0.853em",h=.833/n):s.type==="large"?(c=(1e3+bc)*ca[s.size],u=(ca[s.size]+o)/n,l=(ca[s.size]+o+_c)/n,a=yc("sqrtSize"+s.size,l,c,o,i),a.style.minWidth="1.02em",h=1/n):(l=e+o+_c,u=e+o,c=Math.floor(1e3*e+o)+bc,a=yc("sqrtTall",l,c,o,i),a.style.minWidth="0.742em",h=1.056),a.height=u,a.style.height=ae(l),{span:a,advanceWidth:h,ruleWidth:(i.fontMetrics().sqrtRuleThickness+o)*n}},a3=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),Y9=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),l3=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),ca=[0,1.2,1.8,2.4,3],u3=function(e,i,r,s,n){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),a3.has(e)||l3.has(e))return n3(e,i,!1,r,s,n);if(Y9.has(e))return o3(e,ca[i],!1,r,s,n);throw new se("Illegal delimiter: '"+e+"'")},X9=[{type:"small",style:Ne.SCRIPTSCRIPT},{type:"small",style:Ne.SCRIPT},{type:"small",style:Ne.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],J9=[{type:"small",style:Ne.SCRIPTSCRIPT},{type:"small",style:Ne.SCRIPT},{type:"small",style:Ne.TEXT},{type:"stack"}],c3=[{type:"small",style:Ne.SCRIPTSCRIPT},{type:"small",style:Ne.SCRIPT},{type:"small",style:Ne.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],Z9=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";var i=e.type;throw new Error("Add support for delim type '"+i+"' here.")},h3=function(e,i,r,s){for(var n=Math.min(2,3-s.style.size),o=n;o<r.length;o++){var a=r[o];if(a.type==="stack")break;var l=ea(e,Z9(a),"math"),u=l.height+l.depth;if(a.type==="small"){var c=s.havingBaseStyle(a.style);u*=c.sizeMultiplier}if(u>i)return a}return r[r.length-1]},ld=function(e,i,r,s,n,o){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var a;l3.has(e)?a=X9:a3.has(e)?a=c3:a=J9;var l=h3(e,i,a,s);return l.type==="small"?W9(e,l.style,r,s,n,o):l.type==="large"?n3(e,l.size,r,s,n,o):o3(e,i,r,s,n,o)},wc=function(e,i,r,s,n,o){var a=s.fontMetrics().axisHeight*s.sizeMultiplier,l=901,u=5/s.fontMetrics().ptPerEm,c=Math.max(i-a,r+a),h=Math.max(c/500*l,2*c-u);return ld(e,h,!0,s,n,o)},Pm={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},Q9=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."]);function Fm(t){return"isMiddle"in t}function y0(t,e){var i=b0(t);if(i&&Q9.has(i.text))return i;throw i?new se("Invalid delimiter '"+i.text+"' after '"+e.funcName+"'",t):new se("Invalid delimiter type '"+t.type+"'",t)}pe({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],numArgs:1,argTypes:["primitive"],handler:(t,e)=>{var i=y0(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:Pm[t.funcName].size,mclass:Pm[t.funcName].mclass,delim:i.text}},htmlBuilder:(t,e)=>t.delim==="."?ie([t.mclass]):u3(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(nr(t.delim,t.mode));var i=new ne("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?i.setAttribute("fence","true"):i.setAttribute("fence","false"),i.setAttribute("stretchy","true");var r=ae(ca[t.size]);return i.setAttribute("minsize",r),i.setAttribute("maxsize",r),i}});function Im(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}pe({type:"leftright-right",names:["\\right"],numArgs:1,primitive:!0,handler:(t,e)=>{var i=t.parser.gullet.macros.get("\\current@color");if(i&&typeof i!="string")throw new se("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:y0(e[0],t).text,color:i}}});pe({type:"leftright",names:["\\left"],numArgs:1,primitive:!0,handler:(t,e)=>{var i=y0(e[0],t),r=t.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var n=Le(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:i.text,right:n.delim,rightColor:n.color}},htmlBuilder:(t,e)=>{Im(t);for(var i=$t(t.body,e,!0,["mopen","mclose"]),r=0,s=0,n=!1,o=0;o<i.length;o++){var a=i[o];Fm(a)?n=!0:(r=Math.max(i[o].height,r),s=Math.max(i[o].depth,s))}r*=e.sizeMultiplier,s*=e.sizeMultiplier;var l;if(t.left==="."?l=Ra(e,["mopen"]):l=wc(t.left,r,s,e,t.mode,["mopen"]),i.unshift(l),n)for(var u=1;u<i.length;u++){var c=i[u];if(Fm(c)){var h=c.isMiddle;i[u]=wc(h.delim,r,s,h.options,t.mode,[])}}var d;if(t.right===".")d=Ra(e,["mclose"]);else{var f=t.rightColor?e.withColor(t.rightColor):e;d=wc(t.right,r,s,f,t.mode,["mclose"])}return i.push(d),ie(["minner"],i,e)},mathmlBuilder:(t,e)=>{Im(t);var i=Ui(t.body,e);if(t.left!=="."){var r=new ne("mo",[nr(t.left,t.mode)]);r.setAttribute("fence","true"),i.unshift(r)}if(t.right!=="."){var s=new ne("mo",[nr(t.right,t.mode)]);s.setAttribute("fence","true"),t.rightColor&&s.setAttribute("mathcolor",t.rightColor),i.push(s)}return Kf(i)}});pe({type:"middle",names:["\\middle"],numArgs:1,primitive:!0,handler:(t,e)=>{var i=y0(e[0],t);if(!t.parser.leftrightDepth)throw new se("\\middle without preceding \\left",i);return{type:"middle",mode:t.parser.mode,delim:i.text}},htmlBuilder:(t,e)=>{var i;return t.delim==="."?i=Ra(e,[]):(i=u3(t.delim,1,e,t.mode,[]),i.isMiddle={delim:t.delim,options:e}),i},mathmlBuilder:(t,e)=>{var i=t.delim==="\\vert"||t.delim==="|"?nr("|","text"):nr(t.delim,t.mode),r=new ne("mo",[i]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var ek=(t,e)=>{var i=go(Ge(t.body,e),e),r=t.label.slice(1),s=e.sizeMultiplier,n,o,a=fs(t.body);if(r==="sout")n=ie(["stretchy","sout"]),n.height=e.fontMetrics().defaultRuleThickness/s,o=-.5*e.fontMetrics().xHeight;else if(r==="phase"){var l=gt({number:.6,unit:"pt"},e),u=gt({number:.35,unit:"ex"},e),c=e.havingBaseSizing();s=s/c.sizeMultiplier;var h=i.height+i.depth+l+u;i.style.paddingLeft=ae(h/2+l);var d=Math.floor(1e3*h*s),f=VS(d),p=new ls([new $s("phase",f)],{width:"400em",height:ae(d/1e3),viewBox:"0 0 400000 "+d,preserveAspectRatio:"xMinYMin slice"});n=qs(["hide-tail"],[p],e),n.style.height=ae(h),o=i.depth+l+u}else{/cancel/.test(r)?a||i.classes.push("cancel-pad"):r==="angl"?i.classes.push("anglpad"):i.classes.push("boxpad");var v,_,w=0;/box/.test(r)?(w=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),v=e.fontMetrics().fboxsep+(r==="colorbox"?0:w),_=v):r==="angl"?(w=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),v=4*w,_=Math.max(0,.25-i.depth)):(v=a?.2:0,_=v),n=M9(i,r,v,_,e),/fbox|boxed|fcolorbox/.test(r)?(n.style.borderStyle="solid",n.style.borderWidth=ae(w)):r==="angl"&&w!==.049&&(n.style.borderTopWidth=ae(w),n.style.borderRightWidth=ae(w)),o=i.depth+_,t.backgroundColor&&(n.style.backgroundColor=t.backgroundColor,t.borderColor&&(n.style.borderColor=t.borderColor))}var x;if(t.backgroundColor)x=Ue({positionType:"individualShift",children:[{type:"elem",elem:n,shift:o},{type:"elem",elem:i,shift:0}]});else{var C=/cancel|phase/.test(r)?["svg-align"]:[];x=Ue({positionType:"individualShift",children:[{type:"elem",elem:i,shift:0},{type:"elem",elem:n,shift:o,wrapperClasses:C}]})}return/cancel/.test(r)&&(x.height=i.height,x.depth=i.depth),/cancel/.test(r)&&!a?ie(["mord","cancel-lap"],[x],e):ie(["mord"],[x],e)},tk=(t,e)=>{var i,r=new ne(t.label.includes("colorbox")?"mpadded":"menclose",[tt(t.body,e)]);switch(t.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(i=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*i+"pt"),r.setAttribute("height","+"+2*i+"pt"),r.setAttribute("lspace",i+"pt"),r.setAttribute("voffset",i+"pt"),t.label==="\\fcolorbox"){var s=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);r.setAttribute("style","border: "+ae(s)+" solid "+t.borderColor)}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return t.backgroundColor&&r.setAttribute("mathbackground",t.backgroundColor),r};pe({type:"enclose",names:["\\colorbox"],numArgs:2,allowedInText:!0,argTypes:["color","hbox"],handler(t,e,i){var{parser:r,funcName:s}=t,n=Le(e[0],"color-token").color,o=e[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:n,body:o}},htmlBuilder:ek,mathmlBuilder:tk});pe({type:"enclose",names:["\\fcolorbox"],numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"],handler(t,e,i){var{parser:r,funcName:s}=t,n=Le(e[0],"color-token").color,o=Le(e[1],"color-token").color,a=e[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:o,borderColor:n,body:a}}});pe({type:"enclose",names:["\\fbox"],numArgs:1,argTypes:["hbox"],allowedInText:!0,handler(t,e){var{parser:i}=t;return{type:"enclose",mode:i.mode,label:"\\fbox",body:e[0]}}});pe({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\phase"],numArgs:1,handler(t,e){var{parser:i,funcName:r}=t,s=e[0];return{type:"enclose",mode:i.mode,label:r,body:s}}});pe({type:"enclose",names:["\\sout"],numArgs:1,allowedInText:!0,handler(t,e){var{parser:i,funcName:r}=t;i.mode==="math"&&i.settings.reportNonstrict("mathVsSout","LaTeX's \\sout works only in text mode");var s=e[0];return{type:"enclose",mode:i.mode,label:r,body:s}}});pe({type:"enclose",names:["\\angl"],numArgs:1,argTypes:["hbox"],allowedInText:!1,handler(t,e){var{parser:i}=t;return{type:"enclose",mode:i.mode,label:"\\angl",body:e[0]}}});var d3={};function Vr(t){for(var{type:e,names:i,props:r,handler:s,htmlBuilder:n,mathmlBuilder:o}=t,a={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},l=0;l<i.length;++l)d3[i[l]]=a;n&&(Ta[e]=n),o&&(Ba[e]=o)}var f3={};function S(t,e){f3[t]=e}class Ai{constructor(e,i,r){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=i,this.end=r}static range(e,i){return i?!e||!e.loc||!i.loc||e.loc.lexer!==i.loc.lexer?null:new Ai(e.loc.lexer,e.loc.start,i.loc.end):e&&e.loc}}class $i{constructor(e,i){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=i}range(e,i){return new $i(i,Ai.range(this,e))}}function zm(t){var e=[];t.consumeSpaces();var i=t.fetch().text;for(i==="\\relax"&&(t.consume(),t.consumeSpaces(),i=t.fetch().text);i==="\\hline"||i==="\\hdashline";)t.consume(),e.push(i==="\\hdashline"),t.consumeSpaces(),i=t.fetch().text;return e}var w0=t=>{var e=t.parser.settings;if(!e.displayMode)throw new se("{"+t.envName+"} can be used only in display mode.")},ik=new Set(["gather","gather*"]);function Gf(t){if(!t.includes("ed"))return!t.includes("*")}function Ys(t,e,i){var{hskipBeforeAndAfter:r,addJot:s,cols:n,arraystretch:o,colSeparationType:a,autoTag:l,singleRow:u,emptySingleRow:c,maxNumCols:h,leqno:d}=e;if(t.gullet.beginGroup(),u||t.gullet.macros.set("\\cr","\\\\\\relax"),!o){var f=t.gullet.expandMacroAsText("\\arraystretch");if(f==null)o=1;else if(o=parseFloat(f),!o||o<0)throw new se("Invalid \\arraystretch: "+f)}t.gullet.beginGroup();var p=[],v=[p],_=[],w=[],x=l!=null?[]:void 0;function C(){l&&t.gullet.macros.set("\\@eqnsw","1",!0)}function D(){x&&(t.gullet.macros.get("\\df@tag")?(x.push(t.subparse([new $i("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):x.push(!!l&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(C(),w.push(zm(t));;){var R=t.parseExpression(!1,u?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup();var E={type:"ordgroup",mode:t.mode,body:R};i&&(E={type:"styling",mode:t.mode,style:i,resetFont:!0,body:[E]}),p.push(E);var L=t.fetch().text;if(L==="&"){if(h&&p.length===h){if(u||a)throw new se("Too many tab characters: &",t.nextToken);t.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}t.consume()}else if(L==="\\end"){D(),p.length===1&&E.type==="styling"&&E.body.length===1&&E.body[0].type==="ordgroup"&&E.body[0].body.length===0&&(v.length>1||!c)&&v.pop(),w.length<v.length+1&&w.push([]);break}else if(L==="\\\\"){t.consume();var q=void 0;t.gullet.future().text!==" "&&(q=t.parseSizeGroup(!0)),_.push(q?q.value:null),D(),w.push(zm(t)),p=[],v.push(p),C()}else throw new se("Expected & or \\\\ or \\cr or \\end",t.nextToken)}return t.gullet.endGroup(),t.gullet.endGroup(),{type:"array",mode:t.mode,addJot:s,arraystretch:o,body:v,cols:n,rowGaps:_,hskipBeforeAndAfter:r,hLinesBeforeRow:w,colSeparationType:a,tags:x,leqno:d}}function Yf(t){return t.slice(0,1)==="d"?"display":"text"}var Ur=function(e,i){var r,s,n=e.body.length,o=e.hLinesBeforeRow,a=0,l=new Array(n),u=[],c=Math.max(i.fontMetrics().arrayRuleWidth,i.minRuleThickness),h=1/i.fontMetrics().ptPerEm,d=5*h;if(e.colSeparationType&&e.colSeparationType==="small"){var f=i.havingStyle(Ne.SCRIPT).sizeMultiplier;d=.2778*(f/i.sizeMultiplier)}var p=e.colSeparationType==="CD"?gt({number:3,unit:"ex"},i):12*h,v=3*h,_=e.arraystretch*p,w=.7*_,x=.3*_,C=0;function D(Re){for(var $e=0;$e<Re.length;++$e)$e>0&&(C+=.25),u.push({pos:C,isDashed:Re[$e]})}for(D(o[0]),r=0;r<e.body.length;++r){var R=e.body[r],E=w,L=x;a<R.length&&(a=R.length);var q={cells:new Array(R.length),height:0,depth:0,pos:0};for(s=0;s<R.length;++s){var F=Ge(R[s],i);L<F.depth&&(L=F.depth),E<F.height&&(E=F.height),q.cells[s]=F}var $=e.rowGaps[r],W=0;$&&(W=gt($,i),W>0&&(W+=x,L<W&&(L=W),W=0)),e.addJot&&r<e.body.length-1&&(L+=v),q.height=E,q.depth=L,C+=E,q.pos=C,C+=L+W,l[r]=q,D(o[r+1])}var z=C/2+i.fontMetrics().axisHeight,j=e.cols||[],A=[],O,T,U=[];if(e.tags&&e.tags.some(Re=>Re))for(r=0;r<n;++r){var H=l[r],re=H.pos-z,G=e.tags[r],X=void 0;G===!0?X=ie(["eqn-num"],[],i):G===!1?X=ie([],[],i):X=ie([],$t(G,i,!0),i),X.depth=H.depth,X.height=H.height,U.push({type:"elem",elem:X,shift:re})}for(s=0,T=0;s<a||T<j.length;++s,++T){for(var oe,I=j[T],Y=!0;((le=I)==null?void 0:le.type)==="separator";){var le;if(Y||(O=ie(["arraycolsep"],[]),O.style.width=ae(i.fontMetrics().doubleRuleSep),A.push(O)),I.separator==="|"||I.separator===":"){var te=I.separator==="|"?"solid":"dashed",de=ie(["vertical-separator"],[],i);de.style.height=ae(C),de.style.borderRightWidth=ae(c),de.style.borderRightStyle=te,de.style.margin="0 "+ae(-c/2);var ke=C-z;ke&&(de.style.verticalAlign=ae(-ke)),A.push(de)}else throw new se("Invalid separator type: "+I.separator);T++,I=j[T],Y=!1}if(!(s>=a)){var Ye=void 0;if(s>0||e.hskipBeforeAndAfter){var Ct,At;Ye=(Ct=(At=I)==null?void 0:At.pregap)!=null?Ct:d,Ye!==0&&(O=ie(["arraycolsep"],[]),O.style.width=ae(Ye),A.push(O))}var st=[];for(r=0;r<n;++r){var Be=l[r],vt=Be.cells[s];if(vt){var vr=Be.pos-z;vt.depth=Be.depth,vt.height=Be.height,st.push({type:"elem",elem:vt,shift:vr})}}var ht=Ue({positionType:"individualShift",children:st}),Yr=ie(["col-align-"+(((oe=I)==null?void 0:oe.align)||"c")],[ht]);if(A.push(Yr),s<a-1||e.hskipBeforeAndAfter){var Pt,br;Ye=(Pt=(br=I)==null?void 0:br.postgap)!=null?Pt:d,Ye!==0&&(O=ie(["arraycolsep"],[]),O.style.width=ae(Ye),A.push(O))}}}var qt=ie(["mtable"],A);if(u.length>0){for(var Ni=mo("hline",i,c),Si=mo("hdashline",i,c),Wt=[{type:"elem",elem:qt,shift:0}];u.length>0;){var Gi=u.pop(),Yi=Gi.pos-z;Gi.isDashed?Wt.push({type:"elem",elem:Si,shift:Yi}):Wt.push({type:"elem",elem:Ni,shift:Yi})}qt=Ue({positionType:"individualShift",children:Wt})}if(U.length===0)return ie(["mord"],[qt],i);var ce=Ue({positionType:"individualShift",children:U}),Ae=ie(["tag"],[ce],i);return ms([qt,Ae])},rk={c:"center ",l:"left ",r:"right "},Gr=function(e,i){for(var r=[],s=new ne("mtd",[],["mtr-glue"]),n=new ne("mtd",[],["mml-eqn-num"]),o=0;o<e.body.length;o++){for(var a=e.body[o],l=[],u=0;u<a.length;u++)l.push(new ne("mtd",[tt(a[u],i)]));e.tags&&e.tags[o]&&(l.unshift(s),l.push(s),e.leqno?l.unshift(n):l.push(n)),r.push(new ne("mtr",l))}var c=new ne("mtable",r),h=e.arraystretch===.5?.1:.16+e.arraystretch-1+(e.addJot?.09:0);c.setAttribute("rowspacing",ae(h));var d="",f="";if(e.cols&&e.cols.length>0){var p=e.cols,v="",_=!1,w=0,x=p.length;p[0].type==="separator"&&(d+="top ",w=1),p[p.length-1].type==="separator"&&(d+="bottom ",x-=1);for(var C=w;C<x;C++){var D=p[C];D.type==="align"?(f+=rk[D.align],_&&(v+="none "),_=!0):D.type==="separator"&&_&&(v+=D.separator==="|"?"solid ":"dashed ",_=!1)}c.setAttribute("columnalign",f.trim()),/[sd]/.test(v)&&c.setAttribute("columnlines",v.trim())}if(e.colSeparationType==="align"){for(var R=e.cols||[],E="",L=1;L<R.length;L++)E+=L%2?"0em ":"1em ";c.setAttribute("columnspacing",E.trim())}else e.colSeparationType==="alignat"||e.colSeparationType==="gather"?c.setAttribute("columnspacing","0em"):e.colSeparationType==="small"?c.setAttribute("columnspacing","0.2778em"):e.colSeparationType==="CD"?c.setAttribute("columnspacing","0.5em"):c.setAttribute("columnspacing","1em");var q="",F=e.hLinesBeforeRow;d+=F[0].length>0?"left ":"",d+=F[F.length-1].length>0?"right ":"";for(var $=1;$<F.length-1;$++)q+=F[$].length===0?"none ":F[$][0]?"dashed ":"solid ";return/[sd]/.test(q)&&c.setAttribute("rowlines",q.trim()),d!==""&&(c=new ne("menclose",[c]),c.setAttribute("notation",d.trim())),e.arraystretch&&e.arraystretch<1&&(c=new ne("mstyle",[c]),c.setAttribute("scriptlevel","1")),c},p3=function(e,i){e.envName.includes("ed")||w0(e);var r=[],s=e.envName==="split",n=Ys(e.parser,{cols:r,addJot:!0,autoTag:s?void 0:Gf(e.envName),emptySingleRow:!0,colSeparationType:e.envName.includes("at")?"alignat":"align",maxNumCols:s?2:void 0,leqno:e.parser.settings.leqno},"display"),o=0,a=0,l={type:"ordgroup",mode:e.mode,body:[]};if(i[0]&&i[0].type==="ordgroup"){for(var u="",c=0;c<i[0].body.length;c++){var h=Le(i[0].body[c],"textord");u+=h.text}o=Number(u),a=o*2}var d=!a;n.body.forEach(function(_){for(var w=1;w<_.length;w+=2){var x=Le(_[w],"styling"),C=Le(x.body[0],"ordgroup");C.body.unshift(l)}if(d)a<_.length&&(a=_.length);else{var D=_.length/2;if(o<D)throw new se("Too many math in a row: "+("expected "+o+", but got "+D),_[0])}});for(var f=0;f<a;++f){var p="r",v=0;f%2===1?p="l":f>0&&d&&(v=1),r[f]={type:"align",align:p,pregap:v,postgap:0}}return n.colSeparationType=d?"align":"alignat",n};Vr({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var i=b0(e[0]),r=i?[e[0]]:Le(e[0],"ordgroup").body,s=r.map(function(o){var a=v0(o),l=a.text;if("lcr".includes(l))return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new se("Unknown column alignment: "+l,o)}),n={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return Ys(t.parser,n,Yf(t.envName))},htmlBuilder:Ur,mathmlBuilder:Gr});Vr({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(t){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[t.envName.replace("*","")],i="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:i}]};if(t.envName.charAt(t.envName.length-1)==="*"){var s=t.parser;if(s.consumeSpaces(),s.fetch().text==="["){if(s.consume(),s.consumeSpaces(),i=s.fetch().text,!"lcr".includes(i))throw new se("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),r.cols=[{type:"align",align:i}]}}var n=Ys(t.parser,r,Yf(t.envName)),o=Math.max(0,...n.body.map(a=>a.length));return n.cols=new Array(o).fill({type:"align",align:i}),e?{type:"leftright",mode:t.mode,body:[n],left:e[0],right:e[1],rightColor:void 0}:n},htmlBuilder:Ur,mathmlBuilder:Gr});Vr({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},i=Ys(t.parser,e,"script");return i.colSeparationType="small",i},htmlBuilder:Ur,mathmlBuilder:Gr});Vr({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var i=b0(e[0]),r=i?[e[0]]:Le(e[0],"ordgroup").body,s=r.map(function(a){var l=v0(a),u=l.text;if("lc".includes(u))return{type:"align",align:u};throw new se("Unknown column alignment: "+u,a)});if(s.length>1)throw new se("{subarray} can contain only one column");var n={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5},o=Ys(t.parser,n,"script");if(o.body.length>0&&o.body[0].length>1)throw new se("{subarray} can contain only one column");return o},htmlBuilder:Ur,mathmlBuilder:Gr});Vr({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(t){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},i=Ys(t.parser,e,Yf(t.envName));return{type:"leftright",mode:t.mode,body:[i],left:t.envName.includes("r")?".":"\\{",right:t.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:Ur,mathmlBuilder:Gr});Vr({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:p3,htmlBuilder:Ur,mathmlBuilder:Gr});Vr({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){ik.has(t.envName)&&w0(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:Gf(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return Ys(t.parser,e,"display")},htmlBuilder:Ur,mathmlBuilder:Gr});Vr({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:p3,htmlBuilder:Ur,mathmlBuilder:Gr});Vr({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){w0(t);var e={autoTag:Gf(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return Ys(t.parser,e,"display")},htmlBuilder:Ur,mathmlBuilder:Gr});Vr({type:"array",names:["CD"],props:{numArgs:0},handler(t){return w0(t),j9(t.parser)},htmlBuilder:Ur,mathmlBuilder:Gr});S("\\nonumber","\\gdef\\@eqnsw{0}");S("\\notag","\\nonumber");pe({type:"text",names:["\\hline","\\hdashline"],numArgs:0,allowedInText:!0,allowedInMath:!0,handler(t,e){throw new se(t.funcName+" valid only within array environment")}});var jm=d3;pe({type:"environment",names:["\\begin","\\end"],numArgs:1,argTypes:["text"],handler(t,e){var{parser:i,funcName:r}=t,s=e[0];if(s.type!=="ordgroup")throw new se("Invalid environment name",s);for(var n="",o=0;o<s.body.length;++o)n+=Le(s.body[o],"textord").text;if(r==="\\begin"){if(!jm.hasOwnProperty(n))throw new se("No such environment: "+n,s);var a=jm[n],{args:l,optArgs:u}=i.parseArguments("\\begin{"+n+"}",a),c={mode:i.mode,envName:n,parser:i},h=a.handler(c,l,u);i.expect("\\end",!1);var d=i.nextToken,f=Le(i.parseFunction(),"environment");if(f.name!==n)throw new se("Mismatch: \\begin{"+n+"} matched by \\end{"+f.name+"}",d);return h}return{type:"environment",mode:i.mode,name:n,nameGroup:s}}});var sk=(t,e)=>{var i=t.font,r=e.withFont(i);return Ge(t.body,r)},nk=(t,e)=>{var i=t.font,r=e.withFont(i);return tt(t.body,r)},Hm={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};pe({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],numArgs:1,allowedInArgument:!0,handler:(t,e)=>{var{parser:i,funcName:r}=t,s=Bu(e[0]),n=r in Hm?Hm[r]:r;return{type:"font",mode:i.mode,font:n.slice(1),body:s}},htmlBuilder:sk,mathmlBuilder:nk});pe({type:"mclass",names:["\\boldsymbol","\\bm"],numArgs:1,handler:(t,e)=>{var{parser:i}=t,r=e[0];return{type:"mclass",mode:i.mode,mclass:_0(r),body:[{type:"font",mode:i.mode,font:"boldsymbol",body:r}],isCharacterBox:fs(r)}}});pe({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],numArgs:0,allowedInText:!0,handler:(t,e)=>{var{parser:i,funcName:r,breakOnTokenText:s}=t,{mode:n}=i,o=i.parseExpression(!0,s);return{type:"font",mode:n,font:"math"+r.slice(1),body:{type:"ordgroup",mode:i.mode,body:o}}}});var ok=(t,e)=>{var i=e.style,r=i.fracNum(),s=i.fracDen(),n;n=e.havingStyle(r);var o=Ge(t.numer,n,e);if(t.continued){var a=8.5/e.fontMetrics().ptPerEm,l=3.5/e.fontMetrics().ptPerEm;o.height=o.height<a?a:o.height,o.depth=o.depth<l?l:o.depth}n=e.havingStyle(s);var u=Ge(t.denom,n,e),c,h,d;t.hasBarLine?(t.barSize?(h=gt(t.barSize,e),c=mo("frac-line",e,h)):c=mo("frac-line",e),h=c.height,d=c.height):(c=null,h=0,d=e.fontMetrics().defaultRuleThickness);var f,p,v;i.size===Ne.DISPLAY.size?(f=e.fontMetrics().num1,h>0?p=3*d:p=7*d,v=e.fontMetrics().denom1):(h>0?(f=e.fontMetrics().num2,p=d):(f=e.fontMetrics().num3,p=3*d),v=e.fontMetrics().denom2);var _;if(c){var x=e.fontMetrics().axisHeight;f-o.depth-(x+.5*h)<p&&(f+=p-(f-o.depth-(x+.5*h))),x-.5*h-(u.height-v)<p&&(v+=p-(x-.5*h-(u.height-v)));var C=-(x-.5*h);_=Ue({positionType:"individualShift",children:[{type:"elem",elem:u,shift:v},{type:"elem",elem:c,shift:C},{type:"elem",elem:o,shift:-f}]})}else{var w=f-o.depth-(u.height-v);w<p&&(f+=.5*(p-w),v+=.5*(p-w)),_=Ue({positionType:"individualShift",children:[{type:"elem",elem:u,shift:v},{type:"elem",elem:o,shift:-f}]})}n=e.havingStyle(i),_.height*=n.sizeMultiplier/e.sizeMultiplier,_.depth*=n.sizeMultiplier/e.sizeMultiplier;var D;i.size===Ne.DISPLAY.size?D=e.fontMetrics().delim1:i.size===Ne.SCRIPTSCRIPT.size?D=e.havingStyle(Ne.SCRIPT).fontMetrics().delim2:D=e.fontMetrics().delim2;var R,E;return t.leftDelim==null?R=Ra(e,["mopen"]):R=ld(t.leftDelim,D,!0,e.havingStyle(i),t.mode,["mopen"]),t.continued?E=ie([]):t.rightDelim==null?E=Ra(e,["mclose"]):E=ld(t.rightDelim,D,!0,e.havingStyle(i),t.mode,["mclose"]),ie(["mord"].concat(n.sizingClasses(e)),[R,ie(["mfrac"],[_]),E],e)},ak=(t,e)=>{var i=new ne("mfrac",[tt(t.numer,e),tt(t.denom,e)]);if(!t.hasBarLine)i.setAttribute("linethickness","0px");else if(t.barSize){var r=gt(t.barSize,e);i.setAttribute("linethickness",ae(r))}if(t.leftDelim!=null||t.rightDelim!=null){var s=[];if(t.leftDelim!=null){var n=new ne("mo",[new Nt(t.leftDelim.replace("\\",""))]);n.setAttribute("fence","true"),s.push(n)}if(s.push(i),t.rightDelim!=null){var o=new ne("mo",[new Nt(t.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),s.push(o)}return Kf(s)}return i},m3=(t,e)=>{if(!e)return t;var i={type:"styling",mode:t.mode,style:e,body:[t]};return i};pe({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],numArgs:2,allowedInArgument:!0,handler:(t,e)=>{var{parser:i,funcName:r}=t,s=e[0],n=e[1],o,a=null,l=null;switch(r){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":o=!0;break;case"\\\\atopfrac":o=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":o=!1,a="(",l=")";break;case"\\\\bracefrac":o=!1,a="\\{",l="\\}";break;case"\\\\brackfrac":o=!1,a="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}var u=r==="\\cfrac",c=null;return u||r.startsWith("\\d")?c="display":r.startsWith("\\t")&&(c="text"),m3({type:"genfrac",mode:i.mode,numer:s,denom:n,continued:u,hasBarLine:o,leftDelim:a,rightDelim:l,barSize:null},c)},htmlBuilder:ok,mathmlBuilder:ak});pe({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],numArgs:0,infix:!0,handler(t){var{parser:e,funcName:i,token:r}=t,s;switch(i){case"\\over":s="\\frac";break;case"\\choose":s="\\binom";break;case"\\atop":s="\\\\atopfrac";break;case"\\brace":s="\\\\bracefrac";break;case"\\brack":s="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:s,token:r}}});var $m=["display","text","script","scriptscript"],qm=function(e){var i=null;return e.length>0&&(i=e,i=i==="."?null:i),i};pe({type:"genfrac",names:["\\genfrac"],numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"],handler(t,e){var{parser:i}=t,r=e[4],s=e[5],n=Bu(e[0]),o=n.type==="atom"&&n.family==="open"?qm(n.text):null,a=Bu(e[1]),l=a.type==="atom"&&a.family==="close"?qm(a.text):null,u=Le(e[2],"size"),c,h=null;u.isBlank?c=!0:(h=u.value,c=h.number>0);var d=null,f=e[3];if(f.type==="ordgroup"){if(f.body.length>0){var p=Le(f.body[0],"textord");d=$m[Number(p.text)]}}else f=Le(f,"textord"),d=$m[Number(f.text)];return m3({type:"genfrac",mode:i.mode,numer:r,denom:s,continued:!1,hasBarLine:c,barSize:h,leftDelim:o,rightDelim:l},d)}});pe({type:"infix",names:["\\above"],numArgs:1,argTypes:["size"],infix:!0,handler(t,e){var{parser:i,funcName:r,token:s}=t;return{type:"infix",mode:i.mode,replaceWith:"\\\\abovefrac",size:Le(e[0],"size").value,token:s}}});pe({type:"genfrac",names:["\\\\abovefrac"],numArgs:3,argTypes:["math","size","math"],handler:(t,e)=>{var{parser:i,funcName:r}=t,s=e[0],n=Le(e[1],"infix").size;if(!n)throw new Error("\\\\abovefrac expected size, but got "+String(n));var o=e[2],a=n.number>0;return{type:"genfrac",mode:i.mode,numer:s,denom:o,continued:!1,hasBarLine:a,barSize:n,leftDelim:null,rightDelim:null}}});var g3=(t,e)=>{var i=e.style,r,s;t.type==="supsub"?(r=t.sup?Ge(t.sup,e.havingStyle(i.sup()),e):Ge(t.sub,e.havingStyle(i.sub()),e),s=Le(t.base,"horizBrace")):s=Le(t,"horizBrace");var n=Ge(s.base,e.havingBaseStyle(Ne.DISPLAY)),o=g0(s,e),a;if(s.isOver?a=Ue({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:.1},{type:"elem",elem:o,wrapperClasses:["svg-align"]}]}):a=Ue({positionType:"bottom",positionData:n.depth+.1+o.height,children:[{type:"elem",elem:o,wrapperClasses:["svg-align"]},{type:"kern",size:.1},{type:"elem",elem:n}]}),r){var l=ie(["minner",s.isOver?"mover":"munder"],[a],e);s.isOver?a=Ue({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:r}]}):a=Ue({positionType:"bottom",positionData:l.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:l}]})}return ie(["minner",s.isOver?"mover":"munder"],[a],e)},lk=(t,e)=>{var i=m0(t.label);return new ne(t.isOver?"mover":"munder",[tt(t.base,e),i])};pe({type:"horizBrace",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],numArgs:1,handler(t,e){var{parser:i,funcName:r}=t;return{type:"horizBrace",mode:i.mode,label:r,isOver:r.includes("\\over"),base:e[0]}},htmlBuilder:g3,mathmlBuilder:lk});pe({type:"href",names:["\\href"],numArgs:2,argTypes:["url","original"],allowedInText:!0,handler:(t,e)=>{var{parser:i}=t,r=e[1],s=Le(e[0],"url").url;return i.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:i.mode,href:s,body:Rt(r)}:i.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var i=$t(t.body,e,!1);return d9(t.href,[],i,e)},mathmlBuilder:(t,e)=>{var i=Ws(t.body,e);return i instanceof ne||(i=new ne("mrow",[i])),i.setAttribute("href",t.href),i}});pe({type:"href",names:["\\url"],numArgs:1,argTypes:["url"],allowedInText:!0,handler:(t,e)=>{var{parser:i}=t,r=Le(e[0],"url").url;if(!i.settings.isTrusted({command:"\\url",url:r}))return i.formatUnsupportedCmd("\\url");for(var s=[],n=0;n<r.length;n++){var o=r[n];o==="~"&&(o="\\textasciitilde"),s.push({type:"textord",mode:"text",text:o})}var a={type:"text",mode:i.mode,font:"\\texttt",body:s};return{type:"href",mode:i.mode,href:r,body:Rt(a)}}});pe({type:"hbox",names:["\\hbox"],numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0,handler(t,e){var{parser:i}=t;return{type:"hbox",mode:i.mode,body:Rt(e[0])}},htmlBuilder(t,e){var i=$t(t.body,e.withFont(""),!1);return ms(i)},mathmlBuilder(t,e){return new ne("mrow",Ui(t.body,e.withFont("")))}});pe({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],numArgs:2,argTypes:["raw","original"],allowedInText:!0,handler:(t,e)=>{var{parser:i,funcName:r,token:s}=t,n=Le(e[0],"raw").string,o=e[1];i.settings.strict&&i.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var a,l={};switch(r){case"\\htmlClass":l.class=n,a={command:"\\htmlClass",class:n};break;case"\\htmlId":l.id=n,a={command:"\\htmlId",id:n};break;case"\\htmlStyle":l.style=n,a={command:"\\htmlStyle",style:n};break;case"\\htmlData":{for(var u=n.split(","),c=0;c<u.length;c++){var h=u[c],d=h.indexOf("=");if(d<0)throw new se("\\htmlData key/value '"+h+"' missing equals sign");var f=h.slice(0,d),p=h.slice(d+1);l["data-"+f.trim()]=p}a={command:"\\htmlData",attributes:l};break}default:throw new Error("Unrecognized html command")}return i.settings.isTrusted(a)?{type:"html",mode:i.mode,attributes:l,body:Rt(o)}:i.formatUnsupportedCmd(r)},htmlBuilder:(t,e)=>{var i=$t(t.body,e,!1),r=["enclosing"];t.attributes.class&&r.push(...t.attributes.class.trim().split(/\s+/));var s=ie(r,i,e);for(var n in t.attributes)n!=="class"&&t.attributes.hasOwnProperty(n)&&s.setAttribute(n,t.attributes[n]);return s},mathmlBuilder:(t,e)=>Ws(t.body,e)});pe({type:"htmlmathml",names:["\\html@mathml"],numArgs:2,allowedInArgument:!0,allowedInText:!0,handler:(t,e)=>{var{parser:i}=t;return{type:"htmlmathml",mode:i.mode,html:Rt(e[0]),mathml:Rt(e[1])}},htmlBuilder:(t,e)=>{var i=$t(t.html,e,!1);return ms(i)},mathmlBuilder:(t,e)=>Ws(t.mathml,e)});var xc=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var i=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!i)throw new se("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(i[1]+i[2]),unit:i[3]};if(!zv(r))throw new se("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};pe({type:"includegraphics",names:["\\includegraphics"],numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1,handler:(t,e,i)=>{var{parser:r}=t,s={number:0,unit:"em"},n={number:.9,unit:"em"},o={number:0,unit:"em"},a="";if(i[0])for(var l=Le(i[0],"raw").string,u=l.split(","),c=0;c<u.length;c++){var h=u[c].split("=");if(h.length===2){var d=h[1].trim();switch(h[0].trim()){case"alt":a=d;break;case"width":s=xc(d);break;case"height":n=xc(d);break;case"totalheight":o=xc(d);break;default:throw new se("Invalid key: '"+h[0]+"' in \\includegraphics.")}}}var f=Le(e[0],"url").url;return a===""&&(a=f,a=a.replace(/^.*[\\/]/,""),a=a.substring(0,a.lastIndexOf("."))),r.settings.isTrusted({command:"\\includegraphics",url:f})?{type:"includegraphics",mode:r.mode,alt:a,width:s,height:n,totalheight:o,src:f}:r.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(t,e)=>{var i=gt(t.height,e),r=0;t.totalheight.number>0&&(r=gt(t.totalheight,e)-i);var s=0;t.width.number>0&&(s=gt(t.width,e));var n={height:ae(i+r)};s>0&&(n.width=ae(s)),r>0&&(n.verticalAlign=ae(-r));var o=new e9(t.src,t.alt,n);return o.height=i,o.depth=r,o},mathmlBuilder:(t,e)=>{var i=new ne("mglyph",[]);i.setAttribute("alt",t.alt);var r=gt(t.height,e),s=0;if(t.totalheight.number>0&&(s=gt(t.totalheight,e)-r,i.setAttribute("valign",ae(-s))),i.setAttribute("height",ae(r+s)),t.width.number>0){var n=gt(t.width,e);i.setAttribute("width",ae(n))}return i.setAttribute("src",t.src),i}});pe({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0,handler(t,e){var{parser:i,funcName:r}=t,s=Le(e[0],"size");if(i.settings.strict){var n=r[1]==="m",o=s.value.unit==="mu";n?(o||i.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, "+("not "+s.value.unit+" units")),i.mode!=="math"&&i.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):o&&i.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:i.mode,dimension:s.value}},htmlBuilder(t,e){return Kv(t.dimension,e)},mathmlBuilder(t,e){var i=gt(t.dimension,e);return new Jv(i)}});pe({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],numArgs:1,allowedInText:!0,handler:(t,e)=>{var{parser:i,funcName:r}=t,s=e[0];return{type:"lap",mode:i.mode,alignment:r.slice(5),body:s}},htmlBuilder:(t,e)=>{var i;t.alignment==="clap"?(i=ie([],[Ge(t.body,e)]),i=ie(["inner"],[i],e)):i=ie(["inner"],[Ge(t.body,e)]);var r=ie(["fix"],[]),s=ie([t.alignment],[i,r],e),n=ie(["strut"]);return n.style.height=ae(s.height+s.depth),s.depth&&(n.style.verticalAlign=ae(-s.depth)),s.children.unshift(n),s=ie(["thinbox"],[s],e),ie(["mord","vbox"],[s],e)},mathmlBuilder:(t,e)=>{var i=new ne("mpadded",[tt(t.body,e)]);if(t.alignment!=="rlap"){var r=t.alignment==="llap"?"-1":"-0.5";i.setAttribute("lspace",r+"width")}return i.setAttribute("width","0px"),i}});pe({type:"styling",names:["\\(","$"],numArgs:0,allowedInText:!0,allowedInMath:!1,handler(t,e){var{funcName:i,parser:r}=t,s=r.mode;r.switchMode("math");var n=i==="\\("?"\\)":"$",o=r.parseExpression(!1,n);return r.expect(n),r.switchMode(s),{type:"styling",mode:r.mode,style:"text",resetFont:!0,body:o}}});pe({type:"text",names:["\\)","\\]"],numArgs:0,allowedInText:!0,allowedInMath:!1,handler(t,e){throw new se("Mismatched "+t.funcName)}});var Wm=(t,e)=>{switch(e.style.size){case Ne.DISPLAY.size:return t.display;case Ne.TEXT.size:return t.text;case Ne.SCRIPT.size:return t.script;case Ne.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};pe({type:"mathchoice",names:["\\mathchoice"],numArgs:4,primitive:!0,handler:(t,e)=>{var{parser:i}=t;return{type:"mathchoice",mode:i.mode,display:Rt(e[0]),text:Rt(e[1]),script:Rt(e[2]),scriptscript:Rt(e[3])}},htmlBuilder:(t,e)=>{var i=Wm(t,e),r=$t(i,e,!1);return ms(r)},mathmlBuilder:(t,e)=>{var i=Wm(t,e);return Ws(i,e)}});var v3=(t,e,i,r,s,n,o)=>{t=ie([],[t]);var a=i&&fs(i),l,u;if(e){var c=Ge(e,r.havingStyle(s.sup()),r);u={elem:c,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-c.depth)}}if(i){var h=Ge(i,r.havingStyle(s.sub()),r);l={elem:h,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-h.height)}}var d;if(u&&l){var f=r.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+t.depth+o;d=Ue({positionType:"bottom",positionData:f,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:ae(-n)},{type:"kern",size:l.kern},{type:"elem",elem:t},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:ae(n)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else if(l){var p=t.height-o;d=Ue({positionType:"top",positionData:p,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:ae(-n)},{type:"kern",size:l.kern},{type:"elem",elem:t}]})}else if(u){var v=t.depth+o;d=Ue({positionType:"bottom",positionData:v,children:[{type:"elem",elem:t},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:ae(n)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else return t;var _=[d];if(l&&n!==0&&!a){var w=ie(["mspace"],[],r);w.style.marginRight=ae(n),_.unshift(w)}return ie(["mop","op-limits"],_,r)},b3=new Set(["\\smallint"]),_3=(t,e)=>{var i,r,s=!1,n;t.type==="supsub"?(i=t.sup,r=t.sub,n=Le(t.base,"op"),s=!0):n=Le(t,"op");var o=e.style,a=!1;o.size===Ne.DISPLAY.size&&n.symbol&&!b3.has(n.name)&&(a=!0);var l,u;if(n.symbol){var c=a?"Size2-Regular":"Size1-Regular",h="";if((n.name==="\\oiint"||n.name==="\\oiiint")&&(h=n.name.slice(1),n.name=h==="oiint"?"\\iint":"\\iiint"),l=pi(n.name,c,"math",e,["mop","op-symbol",a?"large-op":"small-op"]),u=l.italic,h.length>0){var d=Uv(h+"Size"+(a?"2":"1"),e);l=Ue({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:d,shift:a?.08:0}]}),n.name="\\"+h,l.classes.unshift("mop"),l.italic=u}}else if(n.body){var f=$t(n.body,e,!0);f.length===1&&f[0]instanceof Wi?(l=f[0],l.classes[0]="mop"):l=ie(["mop"],f,e)}else{for(var p=[],v=1;v<n.name.length;v++)p.push(qf(n.name[v],n.mode,e));l=ie(["mop"],p,e)}var _=0,w=0;if((l instanceof Wi||n.name==="\\oiint"||n.name==="\\oiiint")&&!n.suppressBaseShift){var x;_=(l.height-l.depth)/2-e.fontMetrics().axisHeight,w=(x=l.italic)!=null?x:0}return s?v3(l,i,r,e,o,w,_):(_&&(l.style.position="relative",l.style.top=ae(_)),l)},uk=(t,e)=>{var i;if(t.symbol)i=new ne("mo",[nr(t.name,t.mode)]),b3.has(t.name)&&i.setAttribute("largeop","false");else if(t.body)i=new ne("mo",Ui(t.body,e));else{i=new ne("mi",[new Nt(t.name.slice(1))]);var r=new ne("mo",[nr("⁡","text")]);t.parentIsSupSub?i=new ne("mrow",[i,r]):i=Xv([i,r])}return i},ck={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};pe({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],numArgs:0,handler:(t,e)=>{var{parser:i,funcName:r}=t,s=r;return s.length===1&&(s=ck[s]),{type:"op",mode:i.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:_3,mathmlBuilder:uk});pe({type:"op",names:["\\mathop"],numArgs:1,primitive:!0,handler:(t,e)=>{var{parser:i}=t,r=e[0];return{type:"op",mode:i.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:Rt(r)}}});var hk={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};pe({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],numArgs:0,handler(t){var{parser:e,funcName:i}=t;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:i}}});pe({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],numArgs:0,handler(t){var{parser:e,funcName:i}=t;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:i}}});pe({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],numArgs:0,allowedInArgument:!0,handler(t){var{parser:e,funcName:i}=t,r=i;return r.length===1&&(r=hk[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}}});var y3=(t,e)=>{var i,r,s=!1,n;t.type==="supsub"?(i=t.sup,r=t.sub,n=Le(t.base,"operatorname"),s=!0):n=Le(t,"operatorname");var o;if(n.body.length>0){for(var a=n.body.map(h=>{var d="text"in h?h.text:void 0;return typeof d=="string"?{type:"textord",mode:h.mode,text:d}:h}),l=$t(a,e.withFont("mathrm"),!0),u=0;u<l.length;u++){var c=l[u];c instanceof Wi&&(c.text=c.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=ie(["mop"],l,e)}else o=ie(["mop"],[],e);return s?v3(o,i,r,e,e.style,0,0):o},dk=(t,e)=>{for(var i=Ui(t.body,e.withFont("mathrm")),r=!0,s=0;s<i.length;s++){var n=i[s];if(!(n instanceof Jv))if(n instanceof ne)switch(n.type){case"mi":case"mn":case"mspace":case"mtext":break;case"mo":{var o=n.children[0];n.children.length===1&&o instanceof Nt?o.text=o.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break}default:r=!1}else r=!1}if(r){var a=i.map(c=>c.toText()).join("");i=[new Nt(a)]}var l=new ne("mi",i);l.setAttribute("mathvariant","normal");var u=new ne("mo",[nr("⁡","text")]);return t.parentIsSupSub?new ne("mrow",[l,u]):Xv([l,u])};pe({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],numArgs:1,handler:(t,e)=>{var{parser:i,funcName:r}=t,s=e[0];return{type:"operatorname",mode:i.mode,body:Rt(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:y3,mathmlBuilder:dk});S("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");On({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?ms($t(t.body,e,!1)):ie(["mord"],$t(t.body,e,!0),e)},mathmlBuilder(t,e){return Ws(t.body,e,!0)}});pe({type:"overline",names:["\\overline"],numArgs:1,handler(t,e){var{parser:i}=t,r=e[0];return{type:"overline",mode:i.mode,body:r}},htmlBuilder(t,e){var i=Ge(t.body,e.havingCrampedStyle()),r=mo("overline-line",e),s=e.fontMetrics().defaultRuleThickness,n=Ue({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:3*s},{type:"elem",elem:r},{type:"kern",size:s}]});return ie(["mord","overline"],[n],e)},mathmlBuilder(t,e){var i=new ne("mo",[new Nt("‾")]);i.setAttribute("stretchy","true");var r=new ne("mover",[tt(t.body,e),i]);return r.setAttribute("accent","true"),r}});pe({type:"phantom",names:["\\phantom"],numArgs:1,allowedInText:!0,handler:(t,e)=>{var{parser:i}=t,r=e[0];return{type:"phantom",mode:i.mode,body:Rt(r)}},htmlBuilder:(t,e)=>{var i=$t(t.body,e.withPhantom(),!1);return ms(i)},mathmlBuilder:(t,e)=>{var i=Ui(t.body,e);return new ne("mphantom",i)}});S("\\hphantom","\\smash{\\phantom{#1}}");pe({type:"vphantom",names:["\\vphantom"],numArgs:1,allowedInText:!0,handler:(t,e)=>{var{parser:i}=t,r=e[0];return{type:"vphantom",mode:i.mode,body:r}},htmlBuilder:(t,e)=>{var i=ie(["inner"],[Ge(t.body,e.withPhantom())]),r=ie(["fix"],[]);return ie(["mord","rlap"],[i,r],e)},mathmlBuilder:(t,e)=>{var i=Ui(Rt(t.body),e),r=new ne("mphantom",i),s=new ne("mpadded",[r]);return s.setAttribute("width","0px"),s}});pe({type:"raisebox",names:["\\raisebox"],numArgs:2,argTypes:["size","hbox"],allowedInText:!0,handler(t,e){var{parser:i}=t,r=Le(e[0],"size").value,s=e[1];return{type:"raisebox",mode:i.mode,dy:r,body:s}},htmlBuilder(t,e){var i=Ge(t.body,e),r=gt(t.dy,e);return Ue({positionType:"shift",positionData:-r,children:[{type:"elem",elem:i}]})},mathmlBuilder(t,e){var i=new ne("mpadded",[tt(t.body,e)]),r=t.dy.number+t.dy.unit;return i.setAttribute("voffset",r),i}});pe({type:"internal",names:["\\relax"],numArgs:0,allowedInText:!0,allowedInArgument:!0,handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});pe({type:"rule",names:["\\rule"],numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"],handler(t,e,i){var{parser:r}=t,s=i[0],n=Le(e[0],"size"),o=Le(e[1],"size");return{type:"rule",mode:r.mode,shift:s&&Le(s,"size").value,width:n.value,height:o.value}},htmlBuilder(t,e){var i=ie(["mord","rule"],[],e),r=gt(t.width,e),s=gt(t.height,e),n=t.shift?gt(t.shift,e):0;return i.style.borderRightWidth=ae(r),i.style.borderTopWidth=ae(s),i.style.bottom=ae(n),i.width=r,i.height=s+n,i.depth=-n,i.maxFontSize=s*1.125*e.sizeMultiplier,i},mathmlBuilder(t,e){var i=gt(t.width,e),r=gt(t.height,e),s=t.shift?gt(t.shift,e):0,n=e.color&&e.getColor()||"black",o=new ne("mspace");o.setAttribute("mathbackground",n),o.setAttribute("width",ae(i)),o.setAttribute("height",ae(r));var a=new ne("mpadded",[o]);return s>=0?a.setAttribute("height",ae(s)):(a.setAttribute("height",ae(s)),a.setAttribute("depth",ae(-s))),a.setAttribute("voffset",ae(s)),a}});function w3(t,e,i){for(var r=$t(t,e,!1),s=e.sizeMultiplier/i.sizeMultiplier,n=0;n<r.length;n++){var o=r[n].classes.indexOf("sizing");o<0?Array.prototype.push.apply(r[n].classes,e.sizingClasses(i)):r[n].classes[o+1]==="reset-size"+e.size&&(r[n].classes[o+1]="reset-size"+i.size),r[n].height*=s,r[n].depth*=s}return ms(r)}var Km=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],fk=(t,e)=>{var i=e.havingSize(t.size);return w3(t.body,i,e)};pe({type:"sizing",names:Km,numArgs:0,allowedInText:!0,handler:(t,e)=>{var{breakOnTokenText:i,funcName:r,parser:s}=t,n=s.parseExpression(!1,i);return{type:"sizing",mode:s.mode,size:Km.indexOf(r)+1,body:n}},htmlBuilder:fk,mathmlBuilder:(t,e)=>{var i=e.havingSize(t.size),r=Ui(t.body,i),s=new ne("mstyle",r);return s.setAttribute("mathsize",ae(i.sizeMultiplier)),s}});pe({type:"smash",names:["\\smash"],numArgs:1,numOptionalArgs:1,allowedInText:!0,handler:(t,e,i)=>{var{parser:r}=t,s=!1,n=!1,o=i[0]&&Le(i[0],"ordgroup");if(o)for(var a,l=0;l<o.body.length;++l){var u=o.body[l];if(a=v0(u).text,a==="t")s=!0;else if(a==="b")n=!0;else{s=!1,n=!1;break}}else s=!0,n=!0;var c=e[0];return{type:"smash",mode:r.mode,body:c,smashHeight:s,smashDepth:n}},htmlBuilder:(t,e)=>{var i=ie([],[Ge(t.body,e)]);if(!t.smashHeight&&!t.smashDepth)return i;if(t.smashHeight&&(i.height=0),t.smashDepth&&(i.depth=0),t.smashHeight&&t.smashDepth)return ie(["mord","smash"],[i],e);if(i.children)for(var r=0;r<i.children.length;r++)t.smashHeight&&(i.children[r].height=0),t.smashDepth&&(i.children[r].depth=0);var s=Ue({positionType:"firstBaseline",children:[{type:"elem",elem:i}]});return ie(["mord"],[s],e)},mathmlBuilder:(t,e)=>{var i=new ne("mpadded",[tt(t.body,e)]);return t.smashHeight&&i.setAttribute("height","0px"),t.smashDepth&&i.setAttribute("depth","0px"),i}});pe({type:"sqrt",names:["\\sqrt"],numArgs:1,numOptionalArgs:1,handler(t,e,i){var{parser:r}=t,s=i[0],n=e[0];return{type:"sqrt",mode:r.mode,body:n,index:s}},htmlBuilder(t,e){var i=Ge(t.body,e.havingCrampedStyle());i.height===0&&(i.height=e.fontMetrics().xHeight),i=go(i,e);var r=e.fontMetrics(),s=r.defaultRuleThickness,n=s;e.style.id<Ne.TEXT.id&&(n=e.fontMetrics().xHeight);var o=s+n/4,a=i.height+i.depth+o+s,{span:l,ruleWidth:u,advanceWidth:c}=G9(a,e),h=l.height-u;h>i.height+i.depth+o&&(o=(o+h-i.height-i.depth)/2);var d=l.height-i.height-o-u;i.style.paddingLeft=ae(c);var f=Ue({positionType:"firstBaseline",children:[{type:"elem",elem:i,wrapperClasses:["svg-align"]},{type:"kern",size:-(i.height+d)},{type:"elem",elem:l},{type:"kern",size:u}]});if(t.index){var p=e.havingStyle(Ne.SCRIPTSCRIPT),v=Ge(t.index,p,e),_=.6*(f.height-f.depth),w=Ue({positionType:"shift",positionData:-_,children:[{type:"elem",elem:v}]}),x=ie(["root"],[w]);return ie(["mord","sqrt"],[x,f],e)}else return ie(["mord","sqrt"],[f],e)},mathmlBuilder(t,e){var{body:i,index:r}=t;return r?new ne("mroot",[tt(i,e),tt(r,e)]):new ne("msqrt",[tt(i,e)])}});var ud={display:Ne.DISPLAY,text:Ne.TEXT,script:Ne.SCRIPT,scriptscript:Ne.SCRIPTSCRIPT};function pk(t){return t in ud}pe({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],numArgs:0,allowedInText:!0,primitive:!0,handler(t,e){var{breakOnTokenText:i,funcName:r,parser:s}=t,n=s.parseExpression(!0,i),o=r.slice(1,r.length-5);if(!pk(o))throw new Error("Unknown style: "+o);return{type:"styling",mode:s.mode,style:o,body:n}},htmlBuilder(t,e){var i=ud[t.style],r=e.havingStyle(i);return t.resetFont&&(r=r.withFont("")),w3(t.body,r,e)},mathmlBuilder(t,e){var i=ud[t.style],r=e.havingStyle(i);t.resetFont&&(r=r.withFont(""));var s=Ui(t.body,r),n=new ne("mstyle",s),o={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},a=o[t.style];return n.setAttribute("scriptlevel",a[0]),n.setAttribute("displaystyle",a[1]),n}});var mk=function(e,i){var r=e.base;if(r)if(r.type==="op"){var s=r.limits&&(i.style.size===Ne.DISPLAY.size||r.alwaysHandleSupSub);return s?_3:null}else if(r.type==="operatorname"){var n=r.alwaysHandleSupSub&&(i.style.size===Ne.DISPLAY.size||r.limits);return n?y3:null}else{if(r.type==="accent")return fs(r.base)?t3:null;if(r.type==="horizBrace"){var o=!e.sub;return o===r.isOver?g3:null}else return null}else return null};On({type:"supsub",htmlBuilder(t,e){var i=mk(t,e);if(i)return i(t,e);var{base:r,sup:s,sub:n}=t,o=Ge(r,e),a,l,u=e.fontMetrics(),c=0,h=0,d=r&&fs(r);if(s){var f=e.havingStyle(e.style.sup());a=Ge(s,f,e),d||(c=o.height-f.fontMetrics().supDrop*f.sizeMultiplier/e.sizeMultiplier)}if(n){var p=e.havingStyle(e.style.sub());l=Ge(n,p,e),d||(h=o.depth+p.fontMetrics().subDrop*p.sizeMultiplier/e.sizeMultiplier)}var v;e.style===Ne.DISPLAY?v=u.sup1:e.style.cramped?v=u.sup3:v=u.sup2;var _=e.sizeMultiplier,w=ae(.5/u.ptPerEm/_),x=null;if(l){var C=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");if(o instanceof Wi||C){var D;x=ae(-((D=o.italic)!=null?D:0))}}var R;if(a&&l){c=Math.max(c,v,a.depth+.25*u.xHeight),h=Math.max(h,u.sub2);var E=u.defaultRuleThickness,L=4*E;if(c-a.depth-(l.height-h)<L){h=L-(c-a.depth)+l.height;var q=.8*u.xHeight-(c-a.depth);q>0&&(c+=q,h-=q)}var F=[{type:"elem",elem:l,shift:h,marginRight:w,marginLeft:x},{type:"elem",elem:a,shift:-c,marginRight:w}];R=Ue({positionType:"individualShift",children:F})}else if(l){h=Math.max(h,u.sub1,l.height-.8*u.xHeight);var $=[{type:"elem",elem:l,marginLeft:x,marginRight:w}];R=Ue({positionType:"shift",positionData:h,children:$})}else if(a)c=Math.max(c,v,a.depth+.25*u.xHeight),R=Ue({positionType:"shift",positionData:-c,children:[{type:"elem",elem:a,marginRight:w}]});else throw new Error("supsub must have either sup or sub.");var W=sd(o,"right")||"mord";return ie([W],[o,ie(["msupsub"],[R])],e)},mathmlBuilder(t,e){var i=!1,r,s;t.base&&t.base.type==="horizBrace"&&(s=!!t.sup,s===t.base.isOver&&(i=!0,r=t.base.isOver)),t.base&&(t.base.type==="op"||t.base.type==="operatorname")&&(t.base.parentIsSupSub=!0);var n=[tt(t.base,e)];t.sub&&n.push(tt(t.sub,e)),t.sup&&n.push(tt(t.sup,e));var o;if(i)o=r?"mover":"munder";else if(t.sub)if(t.sup){var u=t.base;u&&u.type==="op"&&u.limits&&e.style===Ne.DISPLAY||u&&u.type==="operatorname"&&u.alwaysHandleSupSub&&(e.style===Ne.DISPLAY||u.limits)?o="munderover":o="msubsup"}else{var l=t.base;l&&l.type==="op"&&l.limits&&(e.style===Ne.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||e.style===Ne.DISPLAY)?o="munder":o="msub"}else{var a=t.base;a&&a.type==="op"&&a.limits&&(e.style===Ne.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||e.style===Ne.DISPLAY)?o="mover":o="msup"}return new ne(o,n)}});On({type:"atom",htmlBuilder(t,e){return qf(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var i=new ne("mo",[nr(t.text,t.mode)]);if(t.family==="bin"){var r=Vf(t,e);r==="bold-italic"&&i.setAttribute("mathvariant",r)}else t.family==="punct"?i.setAttribute("separator","true"):(t.family==="open"||t.family==="close")&&i.setAttribute("stretchy","false");return i}});var x3={mi:"italic",mn:"normal",mtext:"normal"};On({type:"mathord",htmlBuilder(t,e){return p0(t,e)},mathmlBuilder(t,e){var i=new ne("mi",[nr(t.text,t.mode,e)]),r=Vf(t,e)||"italic";return r!==x3[i.type]&&i.setAttribute("mathvariant",r),i}});On({type:"textord",htmlBuilder(t,e){return p0(t,e)},mathmlBuilder(t,e){var i=nr(t.text,t.mode,e),r=Vf(t,e)||"normal",s;return t.mode==="text"?s=new ne("mtext",[i]):/[0-9]/.test(t.text)?s=new ne("mn",[i]):t.text==="\\prime"?s=new ne("mo",[i]):s=new ne("mi",[i]),r!==x3[s.type]&&s.setAttribute("mathvariant",r),s}});var Sc={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},kc={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};On({type:"spacing",htmlBuilder(t,e){if(kc.hasOwnProperty(t.text)){var i=kc[t.text].className||"";if(t.mode==="text"){var r=p0(t,e);return r.classes.push(i),r}else return ie(["mspace",i],[qf(t.text,t.mode,e)],e)}else{if(Sc.hasOwnProperty(t.text))return ie(["mspace",Sc[t.text]],[],e);throw new se('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var i;if(kc.hasOwnProperty(t.text))i=new ne("mtext",[new Nt(" ")]);else{if(Sc.hasOwnProperty(t.text))return new ne("mspace");throw new se('Unknown type of space "'+t.text+'"')}return i}});var Vm=()=>{var t=new ne("mtd",[]);return t.setAttribute("width","50%"),t};On({type:"tag",mathmlBuilder(t,e){var i=new ne("mtable",[new ne("mtr",[Vm(),new ne("mtd",[Ws(t.body,e)]),Vm(),new ne("mtd",[Ws(t.tag,e)])])]);return i.setAttribute("width","100%"),i}});var Um={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},Gm={"\\textbf":"textbf","\\textmd":"textmd"},gk={"\\textit":"textit","\\textup":"textup"},Ym=(t,e)=>{var i=t.font;if(i){if(Um[i])return e.withTextFontFamily(Um[i]);if(Gm[i])return e.withTextFontWeight(Gm[i]);if(i==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(gk[i])};pe({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0,handler(t,e){var{parser:i,funcName:r}=t,s=e[0];return{type:"text",mode:i.mode,body:Rt(s),font:r}},htmlBuilder(t,e){var i=Ym(t,e),r=$t(t.body,i,!0);return ie(["mord","text"],r,i)},mathmlBuilder(t,e){var i=Ym(t,e);return Ws(t.body,i)}});pe({type:"underline",names:["\\underline"],numArgs:1,allowedInText:!0,handler(t,e){var{parser:i}=t;return{type:"underline",mode:i.mode,body:e[0]}},htmlBuilder(t,e){var i=Ge(t.body,e),r=mo("underline-line",e),s=e.fontMetrics().defaultRuleThickness,n=Ue({positionType:"top",positionData:i.height,children:[{type:"kern",size:s},{type:"elem",elem:r},{type:"kern",size:3*s},{type:"elem",elem:i}]});return ie(["mord","underline"],[n],e)},mathmlBuilder(t,e){var i=new ne("mo",[new Nt("‾")]);i.setAttribute("stretchy","true");var r=new ne("munder",[tt(t.body,e),i]);return r.setAttribute("accentunder","true"),r}});pe({type:"vcenter",names:["\\vcenter"],numArgs:1,argTypes:["original"],allowedInText:!1,handler(t,e){var{parser:i}=t;return{type:"vcenter",mode:i.mode,body:e[0]}},htmlBuilder(t,e){var i=Ge(t.body,e),r=e.fontMetrics().axisHeight,s=.5*(i.height-r-(i.depth+r));return Ue({positionType:"shift",positionData:s,children:[{type:"elem",elem:i}]})},mathmlBuilder(t,e){var i=new ne("mpadded",[tt(t.body,e)],["vcenter"]);return new ne("mrow",[i])}});pe({type:"verb",names:["\\verb"],numArgs:0,allowedInText:!0,handler(t,e,i){throw new se("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var i=Xm(t),r=[],s=e.havingStyle(e.style.text()),n=0;n<i.length;n++){var o=i[n];o==="~"&&(o="\\textasciitilde"),r.push(pi(o,"Typewriter-Regular",t.mode,s,["mord","texttt"]))}return ie(["mord","text"].concat(s.sizingClasses(e)),Wv(r),s)},mathmlBuilder(t,e){var i=new Nt(Xm(t)),r=new ne("mtext",[i]);return r.setAttribute("mathvariant","monospace"),r}});var Xm=t=>t.body.replace(/ /g,t.star?"␣":" "),Fs=Gv,S3=`[ \r
306
+ ]`,vk="\\\\[a-zA-Z@]+",bk="\\\\[^\uD800-\uDFFF]",_k="("+vk+")"+S3+"*",yk=`\\\\(
307
+ |[ \r ]+
308
+ ?)[ \r ]*`,cd="[̀-ͯ]",wk=new RegExp(cd+"+$"),xk="("+S3+"+)|"+(yk+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(cd+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(cd+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+_k)+("|"+bk+")");class Jm{constructor(e,i){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=i,this.tokenRegex=new RegExp(xk,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,i){this.catcodes[e]=i}lex(){var e=this.input,i=this.tokenRegex.lastIndex;if(i===e.length)return new $i("EOF",new Ai(this,i,i));var r=this.tokenRegex.exec(e);if(r===null||r.index!==i)throw new se("Unexpected character: '"+e[i]+"'",new $i(e[i],new Ai(this,i,i+1)));var s=r[6]||r[3]||(r[2]?"\\ ":" ");if(this.catcodes[s]===14){var n=e.indexOf(`
309
+ `,this.tokenRegex.lastIndex);return n===-1?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=n+1,this.lex()}return new $i(s,new Ai(this,i,this.tokenRegex.lastIndex))}}class Sk{constructor(e,i){e===void 0&&(e={}),i===void 0&&(i={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=i,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new se("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var i in e)e.hasOwnProperty(i)&&(e[i]==null?delete this.current[i]:this.current[i]=e[i])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,i,r){if(r===void 0&&(r=!1),r){for(var s=0;s<this.undefStack.length;s++)delete this.undefStack[s][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=i)}else{var n=this.undefStack[this.undefStack.length-1];n&&!n.hasOwnProperty(e)&&(n[e]=this.current[e])}i==null?delete this.current[e]:this.current[e]=i}}var kk=f3;S("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});S("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}});S("\\@firstoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[0],numArgs:0}});S("\\@secondoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[1],numArgs:0}});S("\\@ifnextchar",function(t){var e=t.consumeArgs(3);t.consumeSpaces();var i=t.future();return e[0].length===1&&e[0][0].text===i.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});S("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");S("\\TextOrMath",function(t){var e=t.consumeArgs(2);return t.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var Zm={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};S("\\char",function(t){var e=t.popToken(),i,r=0;if(e.text==="'")i=8,e=t.popToken();else if(e.text==='"')i=16,e=t.popToken();else if(e.text==="`")if(e=t.popToken(),e.text[0]==="\\")r=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new se("\\char` missing argument");r=e.text.charCodeAt(0)}else i=10;if(i){if(r=Zm[e.text],r==null||r>=i)throw new se("Invalid base-"+i+" digit "+e.text);for(var s;(s=Zm[t.future().text])!=null&&s<i;)r*=i,r+=s,t.popToken()}return"\\@char{"+r+"}"});var Xf=(t,e,i,r)=>{var s=t.consumeArg().tokens;if(s.length!==1)throw new se("\\newcommand's first argument must be a macro name");var n=s[0].text,o=t.isDefined(n);if(o&&!e)throw new se("\\newcommand{"+n+"} attempting to redefine "+(n+"; use \\renewcommand"));if(!o&&!i)throw new se("\\renewcommand{"+n+"} when command "+n+" does not yet exist; use \\newcommand");var a=0;if(s=t.consumeArg().tokens,s.length===1&&s[0].text==="["){for(var l="",u=t.expandNextToken();u.text!=="]"&&u.text!=="EOF";)l+=u.text,u=t.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new se("Invalid number of arguments: "+l);a=parseInt(l),s=t.consumeArg().tokens}return o&&r||t.macros.set(n,{tokens:s,numArgs:a}),""};S("\\newcommand",t=>Xf(t,!1,!0,!1));S("\\renewcommand",t=>Xf(t,!0,!1,!1));S("\\providecommand",t=>Xf(t,!0,!0,!0));S("\\message",t=>{var e=t.consumeArgs(1)[0];return console.log(e.reverse().map(i=>i.text).join("")),""});S("\\errmessage",t=>{var e=t.consumeArgs(1)[0];return console.error(e.reverse().map(i=>i.text).join("")),""});S("\\show",t=>{var e=t.popToken(),i=e.text;return console.log(e,t.macros.get(i),Fs[i],lt.math[i],lt.text[i]),""});S("\\bgroup","{");S("\\egroup","}");S("~","\\nobreakspace");S("\\lq","`");S("\\rq","'");S("\\aa","\\r a");S("\\AA","\\r A");S("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");S("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");S("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");S("ℬ","\\mathscr{B}");S("ℰ","\\mathscr{E}");S("ℱ","\\mathscr{F}");S("ℋ","\\mathscr{H}");S("ℐ","\\mathscr{I}");S("ℒ","\\mathscr{L}");S("ℳ","\\mathscr{M}");S("ℛ","\\mathscr{R}");S("ℭ","\\mathfrak{C}");S("ℌ","\\mathfrak{H}");S("ℨ","\\mathfrak{Z}");S("\\Bbbk","\\Bbb{k}");S("\\llap","\\mathllap{\\textrm{#1}}");S("\\rlap","\\mathrlap{\\textrm{#1}}");S("\\clap","\\mathclap{\\textrm{#1}}");S("\\mathstrut","\\vphantom{(}");S("\\underbar","\\underline{\\text{#1}}");S("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');S("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");S("\\ne","\\neq");S("≠","\\neq");S("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");S("∉","\\notin");S("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");S("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");S("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");S("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");S("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");S("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");S("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");S("⟂","\\perp");S("‼","\\mathclose{!\\mkern-0.8mu!}");S("∌","\\notni");S("⌜","\\ulcorner");S("⌝","\\urcorner");S("⌞","\\llcorner");S("⌟","\\lrcorner");S("©","\\copyright");S("®","\\textregistered");S("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');S("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');S("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');S("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');S("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");S("⋮","\\vdots");S("\\varGamma","\\mathit{\\Gamma}");S("\\varDelta","\\mathit{\\Delta}");S("\\varTheta","\\mathit{\\Theta}");S("\\varLambda","\\mathit{\\Lambda}");S("\\varXi","\\mathit{\\Xi}");S("\\varPi","\\mathit{\\Pi}");S("\\varSigma","\\mathit{\\Sigma}");S("\\varUpsilon","\\mathit{\\Upsilon}");S("\\varPhi","\\mathit{\\Phi}");S("\\varPsi","\\mathit{\\Psi}");S("\\varOmega","\\mathit{\\Omega}");S("\\substack","\\begin{subarray}{c}#1\\end{subarray}");S("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");S("\\boxed","\\fbox{$\\displaystyle{#1}$}");S("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");S("\\implies","\\DOTSB\\;\\Longrightarrow\\;");S("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");S("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");S("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var Qm={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"},Ck=new Set(["bin","rel"]);S("\\dots",function(t){var e="\\dotso",i=t.expandAfterFuture().text;return i in Qm?e=Qm[i]:(i.slice(0,4)==="\\not"||i in lt.math&&Ck.has(lt.math[i].group))&&(e="\\dotsb"),e});var Jf={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};S("\\dotso",function(t){var e=t.future().text;return e in Jf?"\\ldots\\,":"\\ldots"});S("\\dotsc",function(t){var e=t.future().text;return e in Jf&&e!==","?"\\ldots\\,":"\\ldots"});S("\\cdots",function(t){var e=t.future().text;return e in Jf?"\\@cdots\\,":"\\@cdots"});S("\\dotsb","\\cdots");S("\\dotsm","\\cdots");S("\\dotsi","\\!\\cdots");S("\\dotsx","\\ldots\\,");S("\\DOTSI","\\relax");S("\\DOTSB","\\relax");S("\\DOTSX","\\relax");S("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");S("\\,","\\tmspace+{3mu}{.1667em}");S("\\thinspace","\\,");S("\\>","\\mskip{4mu}");S("\\:","\\tmspace+{4mu}{.2222em}");S("\\medspace","\\:");S("\\;","\\tmspace+{5mu}{.2777em}");S("\\thickspace","\\;");S("\\!","\\tmspace-{3mu}{.1667em}");S("\\negthinspace","\\!");S("\\negmedspace","\\tmspace-{4mu}{.2222em}");S("\\negthickspace","\\tmspace-{5mu}{.277em}");S("\\enspace","\\kern.5em ");S("\\enskip","\\hskip.5em\\relax");S("\\quad","\\hskip1em\\relax");S("\\qquad","\\hskip2em\\relax");S("\\tag","\\@ifstar\\tag@literal\\tag@paren");S("\\tag@paren","\\tag@literal{({#1})}");S("\\tag@literal",t=>{if(t.macros.get("\\df@tag"))throw new se("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});S("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");S("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");S("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");S("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");S("\\newline","\\\\\\relax");S("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var k3=ae(Or["Main-Regular"][84][1]-.7*Or["Main-Regular"][65][1]);S("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+k3+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");S("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+k3+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");S("\\hspace","\\@ifstar\\@hspacer\\@hspace");S("\\@hspace","\\hskip #1\\relax");S("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");S("\\ordinarycolon",":");S("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");S("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');S("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');S("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');S("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');S("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');S("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');S("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');S("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');S("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');S("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');S("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');S("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');S("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');S("∷","\\dblcolon");S("∹","\\eqcolon");S("≔","\\coloneqq");S("≕","\\eqqcolon");S("⩴","\\Coloneqq");S("\\ratio","\\vcentcolon");S("\\coloncolon","\\dblcolon");S("\\colonequals","\\coloneqq");S("\\coloncolonequals","\\Coloneqq");S("\\equalscolon","\\eqqcolon");S("\\equalscoloncolon","\\Eqqcolon");S("\\colonminus","\\coloneq");S("\\coloncolonminus","\\Coloneq");S("\\minuscolon","\\eqcolon");S("\\minuscoloncolon","\\Eqcolon");S("\\coloncolonapprox","\\Colonapprox");S("\\coloncolonsim","\\Colonsim");S("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");S("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");S("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");S("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");S("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");S("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");S("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");S("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");S("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");S("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");S("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");S("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");S("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");S("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");S("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");S("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");S("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");S("\\nleqq","\\html@mathml{\\@nleqq}{≰}");S("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");S("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");S("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");S("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");S("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");S("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");S("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");S("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");S("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");S("\\imath","\\html@mathml{\\@imath}{ı}");S("\\jmath","\\html@mathml{\\@jmath}{ȷ}");S("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");S("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");S("⟦","\\llbracket");S("⟧","\\rrbracket");S("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");S("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");S("⦃","\\lBrace");S("⦄","\\rBrace");S("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");S("⦵","\\minuso");S("\\darr","\\downarrow");S("\\dArr","\\Downarrow");S("\\Darr","\\Downarrow");S("\\lang","\\langle");S("\\rang","\\rangle");S("\\uarr","\\uparrow");S("\\uArr","\\Uparrow");S("\\Uarr","\\Uparrow");S("\\N","\\mathbb{N}");S("\\R","\\mathbb{R}");S("\\Z","\\mathbb{Z}");S("\\alef","\\aleph");S("\\alefsym","\\aleph");S("\\Alpha","\\mathrm{A}");S("\\Beta","\\mathrm{B}");S("\\bull","\\bullet");S("\\Chi","\\mathrm{X}");S("\\clubs","\\clubsuit");S("\\cnums","\\mathbb{C}");S("\\Complex","\\mathbb{C}");S("\\Dagger","\\ddagger");S("\\diamonds","\\diamondsuit");S("\\empty","\\emptyset");S("\\Epsilon","\\mathrm{E}");S("\\Eta","\\mathrm{H}");S("\\exist","\\exists");S("\\harr","\\leftrightarrow");S("\\hArr","\\Leftrightarrow");S("\\Harr","\\Leftrightarrow");S("\\hearts","\\heartsuit");S("\\image","\\Im");S("\\infin","\\infty");S("\\Iota","\\mathrm{I}");S("\\isin","\\in");S("\\Kappa","\\mathrm{K}");S("\\larr","\\leftarrow");S("\\lArr","\\Leftarrow");S("\\Larr","\\Leftarrow");S("\\lrarr","\\leftrightarrow");S("\\lrArr","\\Leftrightarrow");S("\\Lrarr","\\Leftrightarrow");S("\\Mu","\\mathrm{M}");S("\\natnums","\\mathbb{N}");S("\\Nu","\\mathrm{N}");S("\\Omicron","\\mathrm{O}");S("\\plusmn","\\pm");S("\\rarr","\\rightarrow");S("\\rArr","\\Rightarrow");S("\\Rarr","\\Rightarrow");S("\\real","\\Re");S("\\reals","\\mathbb{R}");S("\\Reals","\\mathbb{R}");S("\\Rho","\\mathrm{P}");S("\\sdot","\\cdot");S("\\sect","\\S");S("\\spades","\\spadesuit");S("\\sub","\\subset");S("\\sube","\\subseteq");S("\\supe","\\supseteq");S("\\Tau","\\mathrm{T}");S("\\thetasym","\\vartheta");S("\\weierp","\\wp");S("\\Zeta","\\mathrm{Z}");S("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");S("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");S("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");S("\\bra","\\mathinner{\\langle{#1}|}");S("\\ket","\\mathinner{|{#1}\\rangle}");S("\\braket","\\mathinner{\\langle{#1}\\rangle}");S("\\Bra","\\left\\langle#1\\right|");S("\\Ket","\\left|#1\\right\\rangle");var C3=t=>e=>{var i=e.consumeArg().tokens,r=e.consumeArg().tokens,s=e.consumeArg().tokens,n=e.consumeArg().tokens,o=e.macros.get("|"),a=e.macros.get("\\|");e.macros.beginGroup();var l=h=>d=>{t&&(d.macros.set("|",o),s.length&&d.macros.set("\\|",a));var f=h;if(!h&&s.length){var p=d.future();p.text==="|"&&(d.popToken(),f=!0)}return{tokens:f?s:r,numArgs:0}};e.macros.set("|",l(!1)),s.length&&e.macros.set("\\|",l(!0));var u=e.consumeArg().tokens,c=e.expandTokens([...n,...u,...i]);return e.macros.endGroup(),{tokens:c.reverse(),numArgs:0}};S("\\bra@ket",C3(!1));S("\\bra@set",C3(!0));S("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");S("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");S("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");S("\\angln","{\\angl n}");S("\\blue","\\textcolor{##6495ed}{#1}");S("\\orange","\\textcolor{##ffa500}{#1}");S("\\pink","\\textcolor{##ff00af}{#1}");S("\\red","\\textcolor{##df0030}{#1}");S("\\green","\\textcolor{##28ae7b}{#1}");S("\\gray","\\textcolor{gray}{#1}");S("\\purple","\\textcolor{##9d38bd}{#1}");S("\\blueA","\\textcolor{##ccfaff}{#1}");S("\\blueB","\\textcolor{##80f6ff}{#1}");S("\\blueC","\\textcolor{##63d9ea}{#1}");S("\\blueD","\\textcolor{##11accd}{#1}");S("\\blueE","\\textcolor{##0c7f99}{#1}");S("\\tealA","\\textcolor{##94fff5}{#1}");S("\\tealB","\\textcolor{##26edd5}{#1}");S("\\tealC","\\textcolor{##01d1c1}{#1}");S("\\tealD","\\textcolor{##01a995}{#1}");S("\\tealE","\\textcolor{##208170}{#1}");S("\\greenA","\\textcolor{##b6ffb0}{#1}");S("\\greenB","\\textcolor{##8af281}{#1}");S("\\greenC","\\textcolor{##74cf70}{#1}");S("\\greenD","\\textcolor{##1fab54}{#1}");S("\\greenE","\\textcolor{##0d923f}{#1}");S("\\goldA","\\textcolor{##ffd0a9}{#1}");S("\\goldB","\\textcolor{##ffbb71}{#1}");S("\\goldC","\\textcolor{##ff9c39}{#1}");S("\\goldD","\\textcolor{##e07d10}{#1}");S("\\goldE","\\textcolor{##a75a05}{#1}");S("\\redA","\\textcolor{##fca9a9}{#1}");S("\\redB","\\textcolor{##ff8482}{#1}");S("\\redC","\\textcolor{##f9685d}{#1}");S("\\redD","\\textcolor{##e84d39}{#1}");S("\\redE","\\textcolor{##bc2612}{#1}");S("\\maroonA","\\textcolor{##ffbde0}{#1}");S("\\maroonB","\\textcolor{##ff92c6}{#1}");S("\\maroonC","\\textcolor{##ed5fa6}{#1}");S("\\maroonD","\\textcolor{##ca337c}{#1}");S("\\maroonE","\\textcolor{##9e034e}{#1}");S("\\purpleA","\\textcolor{##ddd7ff}{#1}");S("\\purpleB","\\textcolor{##c6b9fc}{#1}");S("\\purpleC","\\textcolor{##aa87ff}{#1}");S("\\purpleD","\\textcolor{##7854ab}{#1}");S("\\purpleE","\\textcolor{##543b78}{#1}");S("\\mintA","\\textcolor{##f5f9e8}{#1}");S("\\mintB","\\textcolor{##edf2df}{#1}");S("\\mintC","\\textcolor{##e0e5cc}{#1}");S("\\grayA","\\textcolor{##f6f7f7}{#1}");S("\\grayB","\\textcolor{##f0f1f2}{#1}");S("\\grayC","\\textcolor{##e3e5e6}{#1}");S("\\grayD","\\textcolor{##d6d8da}{#1}");S("\\grayE","\\textcolor{##babec2}{#1}");S("\\grayF","\\textcolor{##888d93}{#1}");S("\\grayG","\\textcolor{##626569}{#1}");S("\\grayH","\\textcolor{##3b3e40}{#1}");S("\\grayI","\\textcolor{##21242c}{#1}");S("\\kaBlue","\\textcolor{##314453}{#1}");S("\\kaGreen","\\textcolor{##71B307}{#1}");var A3={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class Ak{constructor(e,i,r){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=i,this.expansionCount=0,this.feed(e),this.macros=new Sk(kk,i.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new Jm(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var i,r,s;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;i=this.popToken(),{tokens:s,end:r}=this.consumeArg(["]"])}else({tokens:s,start:i,end:r}=this.consumeArg());return this.pushToken(new $i("EOF",r.loc)),this.pushTokens(s),new $i("",Ai.range(i,r))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var i=[],r=e&&e.length>0;r||this.consumeSpaces();var s=this.future(),n,o=0,a=0;do{if(n=this.popToken(),i.push(n),n.text==="{")++o;else if(n.text==="}"){if(--o,o===-1)throw new se("Extra }",n)}else if(n.text==="EOF")throw new se("Unexpected end of input in a macro argument, expected '"+(e&&r?e[a]:"}")+"'",n);if(e&&r)if((o===0||o===1&&e[a]==="{")&&n.text===e[a]){if(++a,a===e.length){i.splice(-a,a);break}}else a=0}while(o!==0||r);return s.text==="{"&&i[i.length-1].text==="}"&&(i.pop(),i.shift()),i.reverse(),{tokens:i,start:s,end:n}}consumeArgs(e,i){if(i){if(i.length!==e+1)throw new se("The length of delimiters doesn't match the number of args!");for(var r=i[0],s=0;s<r.length;s++){var n=this.popToken();if(r[s]!==n.text)throw new se("Use of the macro doesn't match its definition",n)}}for(var o=[],a=0;a<e;a++)o.push(this.consumeArg(i&&i[a+1]).tokens);return o}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.settings.maxExpand)throw new se("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var i=this.popToken(),r=i.text,s=i.noexpand?null:this._getExpansion(r);if(s==null||e&&s.unexpandable){if(e&&s==null&&r[0]==="\\"&&!this.isDefined(r))throw new se("Undefined control sequence: "+r);return this.pushToken(i),!1}this.countExpansion(1);var n=s.tokens,o=this.consumeArgs(s.numArgs,s.delimiters);if(s.numArgs){n=n.slice();for(var a=n.length-1;a>=0;--a){var l=n[a];if(l.text==="#"){if(a===0)throw new se("Incomplete placeholder at end of macro body",l);if(l=n[--a],l.text==="#")n.splice(a+1,1);else if(/^[1-9]$/.test(l.text))n.splice(a,2,...o[+l.text-1]);else throw new se("Not a valid argument number",l)}}}return this.pushTokens(n),n.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}}expandMacro(e){return this.macros.has(e)?this.expandTokens([new $i(e)]):void 0}expandTokens(e){var i=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;)if(this.expandOnce(!0)===!1){var s=this.stack.pop();s.treatAsRelax&&(s.noexpand=!1,s.treatAsRelax=!1),i.push(s)}return this.countExpansion(i.length),i}expandMacroAsText(e){var i=this.expandMacro(e);return i&&i.map(r=>r.text).join("")}_getExpansion(e){var i=this.macros.get(e);if(i==null)return i;if(e.length===1){var r=this.lexer.catcodes[e];if(r!=null&&r!==13)return}var s=typeof i=="function"?i(this):i;if(typeof s=="string"){var n=0;if(s.includes("#"))for(var o=s.replace(/##/g,"");o.includes("#"+(n+1));)++n;for(var a=new Jm(s,this.settings),l=[],u=a.lex();u.text!=="EOF";)l.push(u),u=a.lex();l.reverse();var c={tokens:l,numArgs:n};return c}return s}isDefined(e){return this.macros.has(e)||Fs.hasOwnProperty(e)||lt.math.hasOwnProperty(e)||lt.text.hasOwnProperty(e)||A3.hasOwnProperty(e)}isExpandable(e){var i=this.macros.get(e);return i!=null?typeof i=="string"||typeof i=="function"||!i.unexpandable:Fs.hasOwnProperty(e)&&!Fs[e].primitive}}var eg=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Al=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),Cc={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},tg={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};let E3=class D3{constructor(e,i){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new Ak(e,i,this.mode),this.settings=i,this.leftrightDepth=0,this.nextToken=null}expect(e,i){if(i===void 0&&(i=!0),this.fetch().text!==e)throw new se("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());i&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var i=this.nextToken;this.consume(),this.gullet.pushToken(new $i("}")),this.gullet.pushTokens(e);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=i,r}parseExpression(e,i){for(var r=[];;){this.mode==="math"&&this.consumeSpaces();var s=this.fetch();if(D3.endOfExpression.has(s.text)||i&&s.text===i||e&&Fs[s.text]&&Fs[s.text].infix)break;var n=this.parseAtom(i);if(n){if(n.type==="internal")continue}else break;r.push(n)}return this.mode==="text"&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(e){for(var i=-1,r,s=0;s<e.length;s++){var n=e[s];if(n.type==="infix"){if(i!==-1)throw new se("only one infix operator per group",n.token);i=s,r=n.replaceWith}}if(i!==-1&&r){var o,a,l=e.slice(0,i),u=e.slice(i+1);l.length===1&&l[0].type==="ordgroup"?o=l[0]:o={type:"ordgroup",mode:this.mode,body:l},u.length===1&&u[0].type==="ordgroup"?a=u[0]:a={type:"ordgroup",mode:this.mode,body:u};var c;return r==="\\\\abovefrac"?c=this.callFunction(r,[o,e[i],a],[]):c=this.callFunction(r,[o,a],[]),[c]}else return e}handleSupSubscript(e){var i=this.fetch(),r=i.text;this.consume(),this.consumeSpaces();var s;do{var n;s=this.parseGroup(e)}while(((n=s)==null?void 0:n.type)==="internal");if(!s)throw new se("Expected group after '"+r+"'",i);return s}formatUnsupportedCmd(e){for(var i=[],r=0;r<e.length;r++)i.push({type:"textord",mode:"text",text:e[r]});var s={type:"text",mode:this.mode,body:i},n={type:"color",mode:this.mode,color:this.settings.errorColor,body:[s]};return n}parseAtom(e){var i=this.parseGroup("atom",e);if((i==null?void 0:i.type)==="internal"||this.mode==="text")return i;for(var r,s;;){this.consumeSpaces();var n=this.fetch();if(n.text==="\\limits"||n.text==="\\nolimits"){if(i&&i.type==="op")i.limits=n.text==="\\limits",i.alwaysHandleSupSub=!0;else if(i&&i.type==="operatorname")i.alwaysHandleSupSub&&(i.limits=n.text==="\\limits");else throw new se("Limit controls must follow a math operator",n);this.consume()}else if(n.text==="^"){if(r)throw new se("Double superscript",n);r=this.handleSupSubscript("superscript")}else if(n.text==="_"){if(s)throw new se("Double subscript",n);s=this.handleSupSubscript("subscript")}else if(n.text==="'"){if(r)throw new se("Double superscript",n);var o={type:"textord",mode:this.mode,text:"\\prime"},a=[o];for(this.consume();this.fetch().text==="'";)a.push(o),this.consume();this.fetch().text==="^"&&a.push(this.handleSupSubscript("superscript")),r={type:"ordgroup",mode:this.mode,body:a}}else if(Al[n.text]){var l=eg.test(n.text),u=[];for(u.push(new $i(Al[n.text])),this.consume();;){var c=this.fetch().text;if(!Al[c]||eg.test(c)!==l)break;u.unshift(new $i(Al[c])),this.consume()}var h=this.subparse(u);l?s={type:"ordgroup",mode:"math",body:h}:r={type:"ordgroup",mode:"math",body:h}}else break}return r&&s?{type:"supsub",mode:this.mode,base:i,sup:r,sub:s}:r?{type:"supsub",mode:this.mode,base:i,sup:r}:s?{type:"supsub",mode:this.mode,base:i,sub:s}:i}parseFunction(e,i){var r=this.fetch(),s=r.text,n=Fs[s];if(!n)return null;if(this.consume(),i&&i!=="atom"&&!n.allowedInArgument)throw new se("Got function '"+s+"' with no arguments"+(i?" as "+i:""),r);if(this.mode==="text"&&!n.allowedInText)throw new se("Can't use function '"+s+"' in text mode",r);if(this.mode==="math"&&n.allowedInMath===!1)throw new se("Can't use function '"+s+"' in math mode",r);var{args:o,optArgs:a}=this.parseArguments(s,n);return this.callFunction(s,o,a,r,e)}callFunction(e,i,r,s,n){var o={funcName:e,parser:this,token:s,breakOnTokenText:n},a=Fs[e];if(a&&a.handler)return a.handler(o,i,r);throw new se("No function handler for "+e)}parseArguments(e,i){var r,s=(r=i.numOptionalArgs)!=null?r:0,n=i.numArgs+s;if(n===0)return{args:[],optArgs:[]};for(var o=[],a=[],l=0;l<n;l++){var u,c=(u=i.argTypes)==null?void 0:u[l],h=l<s;("primitive"in i&&i.primitive&&c==null||i.type==="sqrt"&&l===1&&a[0]==null)&&(c="primitive");var d=this.parseGroupOfType("argument to '"+e+"'",c,h);if(h)a.push(d);else if(d!=null)o.push(d);else throw new se("Null argument, please report this as a bug")}return{args:o,optArgs:a}}parseGroupOfType(e,i,r){switch(i){case"color":return this.parseColorGroup(r);case"size":return this.parseSizeGroup(r);case"url":return this.parseUrlGroup(r);case"math":case"text":return this.parseArgumentGroup(r,i);case"hbox":{var s=this.parseArgumentGroup(r,"text");return s!=null?{type:"styling",mode:s.mode,body:[s],style:"text",resetFont:!0}:null}case"raw":{var n=this.parseStringGroup(r);return n!=null?{type:"raw",mode:"text",string:n.text}:null}case"primitive":{if(r)throw new se("A primitive argument cannot be optional");var o=this.parseGroup(e);if(o==null)throw new se("Expected group as "+e,this.fetch());return o}case"original":case void 0:return this.parseArgumentGroup(r);default:throw new se("Unknown group type as "+e,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(e){var i=this.gullet.scanArgument(e);if(i==null)return null;for(var r="",s;(s=this.fetch()).text!=="EOF";)r+=s.text,this.consume();return this.consume(),i.text=r,i}parseRegexGroup(e,i){for(var r=this.fetch(),s=r,n="",o;(o=this.fetch()).text!=="EOF"&&e.test(n+o.text);)s=o,n+=s.text,this.consume();if(n==="")throw new se("Invalid "+i+": '"+r.text+"'",r);return r.range(s,n)}parseColorGroup(e){var i=this.parseStringGroup(e);if(i==null)return null;var r=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(i.text);if(!r)throw new se("Invalid color: '"+i.text+"'",i);var s=r[0];return/^[0-9a-f]{6}$/i.test(s)&&(s="#"+s),{type:"color-token",mode:this.mode,color:s}}parseSizeGroup(e){var i,r=!1;if(this.gullet.consumeSpaces(),!e&&this.gullet.future().text!=="{"?i=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):i=this.parseStringGroup(e),!i)return null;!e&&i.text.length===0&&(i.text="0pt",r=!0);var s=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(i.text);if(!s)throw new se("Invalid size: '"+i.text+"'",i);var n={number:+(s[1]+s[2]),unit:s[3]};if(!zv(n))throw new se("Invalid unit: '"+n.unit+"'",i);return{type:"size",mode:this.mode,value:n,isBlank:r}}parseUrlGroup(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var i=this.parseStringGroup(e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),i==null)return null;var r=i.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:r}}parseArgumentGroup(e,i){var r=this.gullet.scanArgument(e);if(r==null)return null;var s=this.mode;i&&this.switchMode(i),this.gullet.beginGroup();var n=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var o={type:"ordgroup",mode:this.mode,loc:r.loc,body:n};return i&&this.switchMode(s),o}parseGroup(e,i){var r=this.fetch(),s=r.text,n;if(s==="{"||s==="\\begingroup"){this.consume();var o=s==="{"?"}":"\\endgroup";this.gullet.beginGroup();var a=this.parseExpression(!1,o),l=this.fetch();this.expect(o),this.gullet.endGroup(),n={type:"ordgroup",mode:this.mode,loc:Ai.range(r,l),body:a,semisimple:s==="\\begingroup"||void 0}}else if(n=this.parseFunction(i,e)||this.parseSymbol(),n==null&&s[0]==="\\"&&!A3.hasOwnProperty(s)){if(this.settings.throwOnError)throw new se("Undefined control sequence: "+s,r);n=this.formatUnsupportedCmd(s),this.consume()}return n}formLigatures(e){for(var i=e.length-1,r=0;r<i;++r){var s=e[r];if(s.type==="textord"){var n=s.text,o=e[r+1];if(!(!o||o.type!=="textord")){if(n==="-"&&o.text==="-"){var a=e[r+2];r+1<i&&a&&a.type==="textord"&&a.text==="-"?(e.splice(r,3,{type:"textord",mode:"text",loc:Ai.range(s,a),text:"---"}),i-=2):(e.splice(r,2,{type:"textord",mode:"text",loc:Ai.range(s,o),text:"--"}),i-=1)}(n==="'"||n==="`")&&o.text===n&&(e.splice(r,2,{type:"textord",mode:"text",loc:Ai.range(s,o),text:n+n}),i-=1)}}}}parseSymbol(){var e=this.fetch(),i=e.text;if(/^\\verb[^a-zA-Z]/.test(i)){this.consume();var r=i.slice(5),s=r.charAt(0)==="*";if(s&&(r=r.slice(1)),r.length<2||r.charAt(0)!==r.slice(-1))throw new se(`\\verb assertion failed --
310
+ please report what input caused this bug`);return r=r.slice(1,-1),{type:"verb",mode:"text",body:r,star:s}}tg.hasOwnProperty(i[0])&&!lt[this.mode][i[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+i[0]+'" used in math mode',e),i=tg[i[0]]+i.slice(1));var n=wk.exec(i);n&&(i=i.substring(0,n.index),i==="i"?i="ı":i==="j"&&(i="ȷ"));var o;if(lt[this.mode][i]){this.settings.strict&&this.mode==="math"&&Xh.includes(i)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+i[0]+'" used in math mode',e);var a=lt[this.mode][i].group,l=Ai.range(e),u;R9(a)?u={type:"atom",mode:this.mode,family:a,loc:l,text:i}:u={type:a,mode:this.mode,loc:l,text:i},o=u}else if(i.charCodeAt(0)>=128)this.settings.strict&&(Iv(i.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+i[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+i[0]+'"'+(" ("+i.charCodeAt(0)+")"),e)),o={type:"textord",mode:"text",loc:Ai.range(e),text:i};else return null;if(this.consume(),n)for(var c=0;c<n[0].length;c++){var h=n[0][c];if(!Cc[h])throw new se("Unknown accent ' "+h+"'",e);var d=Cc[h][this.mode]||Cc[h].text;if(!d)throw new se("Accent "+h+" unsupported in "+this.mode+" mode",e);o={type:"accent",mode:this.mode,loc:Ai.range(e),label:d,isStretchy:!1,isShifty:!0,base:o}}return o}};E3.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var Zf=function(e,i){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var r=new E3(e,i);delete r.gullet.macros.current["\\df@tag"];var s=r.parse();if(delete r.gullet.macros.current["\\current@color"],delete r.gullet.macros.current["\\color"],r.gullet.macros.get("\\df@tag")){if(!i.displayMode)throw new se("\\tag works only in display equations");s=[{type:"tag",mode:"text",body:s,tag:r.subparse([new $i("\\df@tag")])}]}return s},M3=function(e,i,r){i.textContent="";var s=Qf(e,r).toNode();i.appendChild(s)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),M3=function(){throw new se("KaTeX doesn't work in quirks mode.")});var Ek=function(e,i){var r=Qf(e,i).toMarkup();return r},Dk=function(e,i){var r=new zf(i);return Zf(e,r)},T3=function(e,i,r){if(r.throwOnError||!(e instanceof se))throw e;var s=ie(["katex-error"],[new Wi(i)]);return s.setAttribute("title",e.toString()),s.setAttribute("style","color:"+r.errorColor),s},Qf=function(e,i){var r=new zf(i);try{var s=Zf(e,r);return k9(s,e,r)}catch(n){return T3(n,e,r)}},Mk=function(e,i){var r=new zf(i);try{var s=Zf(e,r);return C9(s,e,r)}catch(n){return T3(n,e,r)}},Tk="0.17.0",Bk={Span:Mo,Anchor:d0,SymbolNode:Wi,SvgNode:ls,PathNode:$s,LineNode:Yh},Rk={version:Tk,render:M3,renderToString:Ek,ParseError:se,SETTINGS_SCHEMA:Vh,__parse:Dk,__renderToDomTree:Qf,__renderToHTMLTree:Mk,__setFontMetrics:n9,__defineSymbol:g,__defineFunction:pe,__defineMacro:S,__domTree:Bk};const Nk=Object.freeze({throwOnError:!1,strict:"ignore"}),du=(t,e)=>{let i=0;for(let r=e-1;r>=0&&t[r]==="\\";r-=1)i+=1;return i%2===1},Lk=(t,e,i)=>{for(let r=e;r<t.length;r+=1){if(t[r]===`
311
+ `||t[r]==="`")return-1;if(!(!t.startsWith(i,r)||du(t,r))&&!(i==="$"&&(t[r+1]==="$"||/\d/.test(t[r+1]||""))))return r}return-1},Ok=t=>{const e=/^\/api\/(?:evidence|yatsu\/blob)\/([0-9a-f]{64})$/i.exec(String(t||""));return(e==null?void 0:e[1])||null},Pk=t=>{t.inline.ruler.before("escape","prose_math_inline",(e,i)=>{const r=e.pos;let s=null,n=null;if(e.src[r]==="$"&&e.src[r+1]!=="$"&&e.src[r-1]!=="$"&&!du(e.src,r)?(s="$",n="$"):e.src.startsWith("\\(",r)&&!du(e.src,r)&&(s="\\(",n="\\)"),!s||/\s/.test(e.src[r+s.length]||""))return!1;const o=Lk(e.src,r+s.length,n);if(o<0||/\s/.test(e.src[o-1]||""))return!1;if(!i){const a=e.push("prose_math_inline","math",0);a.content=e.src.slice(r+s.length,o),a.markup=s}return e.pos=o+n.length,!0}),t.block.ruler.after("blockquote","prose_math_block",(e,i,r,s)=>{if(e.sCount[i]-e.blkIndent>=4)return!1;const n=e.bMarks[i]+e.tShift[i],o=e.eMarks[i],a=e.src.startsWith("$$",n)?"$$":e.src.startsWith("\\[",n)?"\\[":null;if(!a)return!1;const l=a==="$$"?"$$":"\\]",u=[e.src.slice(n+a.length,o)];let c=-1;for(let f=i;f<r;f+=1){const p=f===i?u[0]:e.src.slice(e.bMarks[f]+e.tShift[f],e.eMarks[f]),v=p.lastIndexOf(l);if(v>=0&&!du(p,v)&&p.slice(v+l.length).trim()===""){f===i?u[0]=p.slice(0,v):u.push(p.slice(0,v)),c=f;break}f!==i&&u.push(p)}const h=u.join(`
312
+ `).trim();if(c<0||!h)return!1;if(s)return!0;const d=e.push("prose_math_block","math",0);return d.block=!0,d.content=h,d.map=[i,c+1],d.markup=a,e.line=c+1,!0},{alt:["paragraph","reference","blockquote","list"]})},Fk=t=>{t.inline.ruler.before("link","prose_evidence",(e,i)=>{const r=e.src.slice(e.pos),s=/^!\[([^\]]*)\]\((\/api\/(?:evidence|yatsu\/blob)\/[0-9a-f]{64})(?:\s+["']([^"']*)["'])?\)/i.exec(r);if(!s)return!1;if(!i){const n=e.push("prose_evidence","a",0);n.content=s[1],n.meta={hash:Ok(s[2]),src:s[2],alt:s[1],title:s[3]||null}}return e.pos+=s[0].length,!0}),t.inline.ruler.before("text","prose_spec_ref",(e,i)=>{if(!e.src.startsWith("[[",e.pos))return!1;const r=e.src.indexOf("]]",e.pos+2);if(r<0||r===e.pos+2||e.src.slice(e.pos+2,r).includes(`
313
+ `))return!1;if(!i){const s=e.src.slice(e.pos+2,r),n=e.push("prose_spec_ref","a",0);n.content=s,n.meta={id:s}}return e.pos=r+2,!0}),t.block.ruler.before("paragraph","prose_time_anchor",(e,i,r,s)=>{var c;const n=e.bMarks[i]+e.tShift[i],o=e.eMarks[i],a=e.src.slice(n,o).trim(),l=/^▶\s*(\d+):([0-5]?\d)(?:\s*·\s*([^\n]*))?$/.exec(a);if(!l)return!1;if(s)return!0;const u=e.push("prose_time_anchor","span",0);return u.block=!0,u.content=a,u.map=[i,i+1],u.meta={tMs:(Number(l[1])*60+Number(l[2]))*1e3,step:((c=l[3])==null?void 0:c.trim())||null,label:a},e.line=i+1,!0})},Ik=new sr({linkify:!0,html:!1}).use(Pk).use(Fk),zk=t=>{for(const e of t)if(!(e.type!=="inline"||!e.children||!e.map))for(const i of e.children)i.map||(i.map=[...e.map]);return t};function jk(t){const e=t==null?"":String(t);return zk(Ik.parse(e,{}))}function dR(t){const e=t==null?"":String(t),i=/^#\s+[^\n]*(?:\n+|$)/.exec(e);if(!i)return{source:e,removedLines:0};const r=i[0].endsWith(`
314
+ `)?i[0].split(`
315
+ `).length-1:1;return{source:e.slice(i[0].length),removedLines:r}}const B3=t=>/^(?:https?:|mailto:|#|\/)/i.test(String(t||""))?String(t):null,Ei=(t,e)=>{const i=t==null?void 0:t.map;return!i||!Number.isInteger(e)||e<=0?{}:{"data-l0":e+i[0],"data-l1":e+i[1]-1}},xn=(t,e)=>{var i;return((i=t==null?void 0:t.attrGet)==null?void 0:i.call(t,e))??null},ig=t=>{if(!t)return;const e={};for(const i of String(t).split(";")){const r=i.indexOf(":");if(r<0)continue;const s=i.slice(0,r).trim(),n=i.slice(r+1).trim();if(!s||!n)continue;const o=s.startsWith("--")?s:s.replace(/-([a-z])/g,(a,l)=>l.toUpperCase());e[o]=n}return Object.keys(e).length?e:void 0},$o=new Map,Hk=512,$k=(t,e)=>{const i=`${e?"d":"i"}\0${t}`;if($o.has(i))return $o.get(i);let r=null;try{r=Rk.renderToString(t,{...Nk,displayMode:e})}catch{r=null}return $o.size>=Hk&&$o.clear(),$o.set(i,r),r},R3=(t,e,i,r={})=>{const s=$k(e.content,i);return s===null?t(i?"pre":"span",{...r,className:"doc-math-error"},e.content):t(i?"div":"span",{...r,className:i?"doc-math-block":"doc-math","data-math-source":e.content,dangerouslySetInnerHTML:{__html:s}})},rg=(t,e,i,r)=>{const s=Ei(e,r.lineBase);if(e.type==="link_open"){const n=B3(xn(e,"href"));return n?t("a",{...s,className:"doc-link doc-external",href:n,target:"_blank",rel:"noreferrer"},i):i}return e.type==="strong_open"?t("strong",s,i):e.type==="em_open"?t("em",s,i):e.type==="s_open"?t("del",s,i):i},qk=(t,e=[],i)=>{var o,a;const r=[],s=[{token:null,children:r}],n=()=>s[s.length-1].children;for(const l of e)if(l.type==="text")n().push(l.content);else if(l.type==="hardbreak")n().push(t("br"));else if(l.type==="softbreak")n().push(i.softBreak==="break"?t("br"):" ");else if(l.type==="code_inline")n().push(t("code",Ei(l,i.lineBase),l.content));else if(l.type==="prose_math_inline")n().push(R3(t,l,!1,Ei(l,i.lineBase)));else if(l.type==="prose_spec_ref"){const u=(o=i.renderSpecRef)==null?void 0:o.call(i,l.meta.id,l,Ei(l,i.lineBase));n().push(u??t("span",{...Ei(l,i.lineBase),className:"doc-ref","data-spec-id":l.meta.id},l.meta.id))}else if(l.type==="prose_evidence"){const u=(a=i.renderEvidence)==null?void 0:a.call(i,l.meta,l,Ei(l,i.lineBase));n().push(u??t("a",{...Ei(l,i.lineBase),className:"doc-evidence",href:l.meta.src,"data-evidence-hash":l.meta.hash},l.meta.alt))}else if(l.type==="image"){const u=B3(xn(l,"src"));n().push(u?t("img",{...Ei(l,i.lineBase),className:"doc-image",src:u,alt:l.content||xn(l,"alt")||"",title:xn(l,"title")||void 0}):l.content)}else if(l.type==="link_open"||l.type==="strong_open"||l.type==="em_open"||l.type==="s_open")s.push({token:l,children:[]});else if(l.type==="link_close"||l.type==="strong_close"||l.type==="em_close"||l.type==="s_close"){if(s.length===1)continue;const u=s.pop();n().push(rg(t,u.token,u.children,i))}for(;s.length>1;){const l=s.pop();n().push(rg(t,l.token,l.children,i))}return r},sg=(t,e,i,r)=>{const s=Ei(e,r.lineBase);switch(e.type){case"paragraph_open":return t("p",s,i);case"heading_open":return t(e.tag,{...s,className:`doc-h doc-h-level doc-h${e.tag.slice(1)}`},i);case"blockquote_open":return t("blockquote",{...s,className:"doc-quote"},i);case"bullet_list_open":return t("ul",s,i);case"ordered_list_open":return t("ol",{...s,start:xn(e,"start")||void 0},i);case"list_item_open":return t("li",s,i);case"table_open":return t("table",{...s,className:"doc-table"},i);case"thead_open":return t("thead",s,i);case"tbody_open":return t("tbody",s,i);case"tr_open":return t("tr",s,i);case"th_open":return t("th",{...s,style:ig(xn(e,"style"))},i);case"td_open":return t("td",{...s,style:ig(xn(e,"style"))},i);default:return i}};function Wk(t,e={}){var o,a;const i=e.h;if(typeof i!="function")throw new TypeError("renderProseTokens requires a React-compatible h function");const r=[],s=[{token:null,children:r}],n=()=>s[s.length-1].children;for(const l of t||[])if(l.type==="inline")n().push(...qk(i,l.children,e));else if(l.type==="fence"||l.type==="code_block"){const u=(o=l.info)==null?void 0:o.trim().split(/\s+/,1)[0];n().push(i("pre",{...Ei(l,e.lineBase),className:"doc-pre"},i("code",{className:u?`language-${u}`:void 0},l.content)))}else if(l.type==="prose_math_block")n().push(R3(i,l,!0,Ei(l,e.lineBase)));else if(l.type==="prose_time_anchor"){const u=(a=e.renderTimeAnchor)==null?void 0:a.call(e,l.meta,l,Ei(l,e.lineBase));n().push(u??i("span",{...Ei(l,e.lineBase),className:"fv-anchor static","data-time-ms":l.meta.tMs},l.meta.label))}else if(l.type==="hr")n().push(i("hr",Ei(l,e.lineBase)));else if(l.type==="html_block"||l.type==="html_inline")n().push(l.content);else if(l.nesting===1)s.push({token:l,children:[]});else if(l.nesting===-1){if(s.length===1)continue;const u=s.pop();n().push(sg(i,u.token,u.children,e))}for(;s.length>1;){const l=s.pop();n().push(sg(i,l.token,l.children,e))}return r}function Kk({children:t,className:e="",lineBase:i=0,softBreak:r,renderSpecRef:s,renderEvidence:n,renderTimeAnchor:o}){const a=k.useMemo(()=>{try{return jk(t)}catch{return null}},[t]),l=a?Wk(a,{h:(()=>{let u=0;return(c,h,...d)=>{const f=h!==null&&typeof h=="object"&&!Array.isArray(h),p=f?{...h,key:h.key??`prose-${u++}`}:{key:`prose-${u++}`};return f?k.createElement(c,p,...d):k.createElement(c,p,h,...d)}})(),lineBase:i,softBreak:r,renderSpecRef:s,renderEvidence:n,renderTimeAnchor:o}):k.createElement("p",null,t==null?"":String(t));return k.createElement("div",{className:e},l)}function N3({children:t,className:e="",softBreak:i,renderSpecRef:r,renderEvidence:s,renderTimeAnchor:n}){const o=r||((l,u,c)=>k.createElement("span",{className:"doc-ref","data-spec-id":l,...c},l)),a=s||((l,u,c)=>k.createElement("a",{className:"doc-evidence",href:l.src,"data-evidence-hash":l.hash,...c},l.alt||l.hash));return k.createElement(Kk,{className:`rich-text${e?` ${e}`:""}`,softBreak:i,renderSpecRef:o,renderEvidence:a,renderTimeAnchor:n},t)}const ng=t=>{const e=document.createRange();return e.selectNode(t),e};function Vk(t,e){if(!t||t.collapsed||!e)return"";const i=[...e.querySelectorAll("[data-math-source]")].filter(a=>t.intersectsNode(a));if(!i.length)return t.toString();const r=[];let s=t.startContainer,n=t.startOffset;for(const[a,l]of i.entries()){const u=ng(l),c=t.compareBoundaryPoints(Range.START_TO_START,u)<=0;if(a>0||c){const d=document.createRange();d.setStart(s,n),d.setEndBefore(l),r.push(d.toString())}r.push(l.getAttribute("data-math-source")||"");const h=document.createRange();h.setStartAfter(l),h.collapse(!0),s=h.startContainer,n=h.startOffset}const o=ng(i[i.length-1]);if(t.compareBoundaryPoints(Range.END_TO_END,o)>=0){const a=document.createRange();a.setStart(s,n),a.setEnd(t.endContainer,t.endOffset),r.push(a.toString())}return r.join("")}function Uk(t,e,i=0,r){if(!t)return;const s=r||getComputedStyle(t),n=s.boxSizing==="border-box"?(parseFloat(s.borderTopWidth)||0)+(parseFloat(s.borderBottomWidth)||0):0,o=t.placeholder;!t.value&&o&&(t.placeholder=""),t.style.height="auto";const a=t.scrollHeight+n;t.style.overflowY=a>e?"auto":"hidden",t.style.height=`${Math.min(Math.max(a,i),e)}px`,t.placeholder!==o&&(t.placeholder=o)}function ha(t){var e,i;return t.isComposing||((e=t.nativeEvent)==null?void 0:e.isComposing)||t.keyCode===229||((i=t.nativeEvent)==null?void 0:i.keyCode)===229}const hd=k.forwardRef(function({value:e,className:i="",...r},s){const n=k.useRef(null);return k.useImperativeHandle(s,()=>n.current),k.useLayoutEffect(()=>{const o=n.current;if(!o)return;const a=getComputedStyle(o);Uk(o,parseFloat(a.maxHeight)||1/0,parseFloat(a.minHeight)||0,a)},[e]),m.jsx("textarea",{ref:n,value:e,className:`composer-textarea ${i}`.trim(),...r})}),L3=k.forwardRef(function({as:e="div",className:i="",preview:r=null,editor:s,footer:n,...o},a){return m.jsxs(e,{ref:a,className:`composer-surface ${i}`.trim(),...o,children:[r,m.jsx("div",{className:"composer-editor",children:s}),m.jsx("div",{className:"composer-footer",children:n})]})}),vo=t=>Di(`/api/evidence/${t}`);function Gk({src:t,alt:e,onClose:i}){return ni(!0,i),m.jsx("div",{className:"lightbox",onClick:i,children:m.jsx("img",{src:t,alt:e})})}function Yk({hash:t}){const e=Ie(),[i,r]=k.useState(null);return k.useEffect(()=>{let s=!0;return fetch(vo(t)).then(n=>n.ok?n.text():Promise.reject(new Error("miss"))).then(n=>{s&&r(n)}).catch(()=>{s&&r("")}),()=>{s=!1}},[t]),i===null?m.jsx("pre",{className:"eval-transcript loading",children:e("nodeView.eval.loadingTranscript")}):m.jsx("pre",{className:"eval-transcript",children:i})}function Xk({hash:t,collapsed:e=!1}){const i=Ie(),[r,s]=k.useState(null);if(k.useEffect(()=>{let o=!0;return fetch(vo(t)).then(a=>a.ok?a.text():Promise.reject(new Error("miss"))).then(a=>{let l=a,u=!0;try{l=JSON.stringify(JSON.parse(a),null,2)}catch{u=!1}o&&s({text:l,valid:u})}).catch(()=>{o&&s({text:"",valid:!1})}),()=>{o=!1}},[t]),r===null)return m.jsx("pre",{className:"eval-data loading",children:i("nodeView.eval.loadingData")});const n=r.valid?i("nodeView.eval.data"):i("nodeView.eval.dataInvalid");return e?m.jsxs("details",{className:"eval-datawrap eval-datafold",children:[m.jsx("summary",{className:"eval-datahead",children:n}),m.jsx("pre",{className:"eval-data",children:r.text})]}):m.jsxs("div",{className:"eval-datawrap",children:[m.jsx("div",{className:"eval-datahead",children:n}),m.jsx("pre",{className:"eval-data",children:r.text})]})}function Jk({hash:t,alt:e}){const[i,r]=k.useState(!1);return m.jsxs(m.Fragment,{children:[m.jsx("img",{className:"an-image",src:vo(t),alt:e,loading:"lazy",onClick:()=>r(!0)}),i&&m.jsx(Gk,{src:vo(t),alt:e,onClose:()=>r(!1)})]})}function Zk({exit:t}){return m.jsx(ze,{name:t?"minimize":"maximize",size:15})}function fR({target:t,className:e=""}){const i=Ie(),[r,s]=k.useState(!1);k.useEffect(()=>{const o=()=>{const a=document.fullscreenElement,l=t==null?void 0:t.current;s(!!a&&!!l&&(a===l||l.contains(a)))};return document.addEventListener("fullscreenchange",o),()=>document.removeEventListener("fullscreenchange",o)},[t]);const n=()=>{var a,l;const o=t==null?void 0:t.current;o&&(document.fullscreenElement?(a=document.exitFullscreen||document.webkitExitFullscreen)==null||a.call(document):(l=o.requestFullscreen||o.webkitRequestFullscreen)==null||l.call(o))};return m.jsx("button",{type:"button",className:`an-fs ${e}`,onClick:n,"data-tip":i(r?"annotator.exitFullscreen":"annotator.fullscreen"),"aria-label":i(r?"annotator.exitFullscreen":"annotator.fullscreen"),children:m.jsx(Zk,{exit:r})})}function Qk({e:t,alt:e="",collapsed:i=!1}){const r=Ie();return t.state==="miss"?m.jsx("div",{className:"eval-noimg",children:r("nodeView.eval.miss")}):t.kind==="transcript"?m.jsx(Yk,{hash:t.hash}):t.kind==="data"?m.jsx(Xk,{hash:t.hash,collapsed:i}):t.kind==="video"?m.jsx("video",{className:"eval-video",src:vo(t.hash),controls:!0,preload:"metadata",playsInline:!0}):m.jsx(Jk,{hash:t.hash,alt:e})}const El=new Map;function eC(t){const[e,i]=k.useState(()=>El.get(t)??null);return k.useEffect(()=>{if(El.has(t)){i(El.get(t));return}let r=!0;return fetch(vo(t),{headers:{Range:"bytes=0-0"}}).then(s=>{const n=s.headers.get("content-type")||"",o=s.ok?{kind:n.startsWith("video/")?"video":n.startsWith("image/")?"image":n.startsWith("application/json")?"data":"transcript",state:"present"}:{kind:"image",state:"miss"};El.set(t,o),r&&i(o)}).catch(()=>{r&&i({kind:"image",state:"miss"})}),()=>{r=!1}},[t]),e}function tC({hash:t,alt:e=""}){const i=eC(t);return i?m.jsx(Qk,{e:{hash:t,...i},alt:e}):null}function Ru({children:t,className:e=""}){return m.jsx(N3,{className:e,softBreak:"break",renderSpecRef:(i,r,s)=>{const n=Vt("spec",i);return m.jsx("a",{className:"doc-link",href:n,...s,onClick:o=>u5(o,n),children:i})},renderEvidence:(i,r,s)=>m.jsx("span",{className:"rich-evidence",...s,children:m.jsx(tC,{hash:i.hash,alt:i.alt||"evidence"})}),children:t})}const e1=(t,e)=>e&&t.output===void 0,O3=k.createContext(null);function iC({tool:t}){var n;const e=Ie(),i=k.useContext(O3),[r,s]=k.useState(null);return k.useEffect(()=>{if(!i)return;let o=!0;return i.load(t.id).then(a=>{o&&s(a)},a=>{o&&s({ok:!1,error:String((a==null?void 0:a.message)||a)})}),()=>{o=!1}},[i,t.id]),r?r.ok?m.jsx("pre",{className:"tc-tool-out",children:((n=r.data)==null?void 0:n.output)??""}):m.jsx("div",{className:"tc-tool-out tc-tool-out-state is-error",children:r.error}):m.jsx("div",{className:"tc-tool-out tc-tool-out-state",children:e("common.loading")})}const og=t=>(t||"").replace(/\s+/g," ").trim(),rC=(t,e)=>{const i=og(t).replace(/(\.\.\.|…)$/,""),r=og(e);return!!i&&!!r&&(r.startsWith(i)||i.startsWith(r))};function sC({tool:t,open:e,onToggle:i,live:r=!1}){const s=Ie(),n=O7(t.input),{lead:o,trail:a}=P7(n),l=t.outputLines||0,u=t.output===null,c=!!t.input||t.output!==void 0||u,h=e1(t,r),d=c?"button":"div";return m.jsxs("div",{className:`tc-tool${h?" is-running":""}`,children:[m.jsxs(d,{...c?{type:"button",onClick:i,"aria-expanded":e}:{},className:`tc-tool-row${c?" is-openable":""}`,children:[m.jsx("span",{className:"tc-tool-verb",children:ov(t.name)}),o&&m.jsx("span",{className:"tc-tool-target",children:o}),a&&m.jsx("span",{className:"tc-tool-trail",children:a}),l>0&&m.jsxs("span",{className:"tc-tool-size",children:[l," lines"]}),h&&m.jsxs("span",{className:"tc-tool-running",children:[m.jsx(ze,{name:"loader",size:11,className:"tc-tool-spin"}),s("session.executionRunning")]}),c&&m.jsx(qa,{open:e,className:"tc-tool-caret"})]}),e&&c&&m.jsxs(m.Fragment,{children:[t.input&&m.jsx("pre",{className:"tc-tool-in",children:t.input}),u?m.jsx(iC,{tool:t}):t.output!==void 0&&m.jsx("pre",{className:"tc-tool-out",children:t.output})]})]})}function nC({tools:t,openIds:e,onToggle:i,live:r=!1,fold:s=!0}){if(!(t!=null&&t.length))return null;const n=u=>m.jsx(sC,{tool:u,open:e.has(u.id),onToggle:()=>i(u.id),live:r},u.id);if(!s||t.length<av)return m.jsx("div",{className:"tc-tools",children:t.map(n)});const o=`run:${t[0].id}`,a=e.has(o),l=t.some(u=>e1(u,r));return m.jsx("div",{className:"tc-tools",children:m.jsxs("div",{className:`tc-tool${l?" is-running":""}`,children:[m.jsxs("button",{type:"button",className:"tc-tool-row is-openable is-run","aria-expanded":a,onClick:()=>i(o),children:[m.jsxs("span",{className:"tc-tool-verb",children:[t.length," tool uses"]}),m.jsx("span",{className:"tc-tool-trail",children:lv(t)}),m.jsx(qa,{open:a,className:"tc-tool-caret"})]}),a&&m.jsx("div",{className:"tc-tool-kids",children:t.map(n)})]})})}function oC(t,e=!1){const i=[];let r=[];const s=()=>{var h;if(!r.length)return;const o=r.reduce((d,f)=>{var p;return d+(((p=f.tools)==null?void 0:p.length)||0)},0);let a=r.length-1;for(;a>0&&!r[a].text;)a-=1;const l=(h=r[a])!=null&&h.text?r[a]:null,u=l?r.slice(0,a):r,c=l?r.slice(a+1):[];i.push({kind:"work",work:u,answer:l,after:c,calls:o,folded:o>=av&&u.length>0,now:!1}),r=[]};for(const o of t){if(o.role==="user"){s();continue}r.push(o)}s();const n=i[i.length-1];return e&&(n==null?void 0:n.kind)==="work"&&(n.now=!0,n.folded=n.folded&&!!n.answer),i}function Dl({turn:t,openIds:e,onToggle:i,live:r,fold:s=!0}){return m.jsxs("div",{className:"tc-say",children:[t.text&&m.jsx("div",{className:"tc-say-text",children:m.jsx(Ru,{children:t.text})}),m.jsx(nC,{tools:t.tools,openIds:e,onToggle:i,live:r,fold:s})]})}function aC({segment:t,openIds:e,onToggle:i,live:r}){var u,c,h;const s=`seg:${((u=t.work[0])==null?void 0:u.id)||((c=t.work[0])==null?void 0:c.at)||((h=t.answer)==null?void 0:h.at)}`,n=e.has(s),o=lv(t.work.flatMap(d=>d.tools||[])),a=t.work.reduce((d,f)=>{var p;return d+(((p=f.tools)==null?void 0:p.length)||0)},0),l=!t.now||!!t.answer;return m.jsxs(m.Fragment,{children:[t.folded?m.jsxs("div",{className:"tc-work",children:[m.jsxs("button",{type:"button",className:"tc-work-row","aria-expanded":n,onClick:()=>i(s),children:[m.jsxs("span",{className:"tc-work-lead",children:[a," tool uses"]}),o&&m.jsx("span",{className:"tc-work-detail",children:o}),m.jsx(qa,{open:n,className:"tc-work-caret"})]}),n&&m.jsx("div",{className:"tc-work-body",children:t.work.map((d,f)=>m.jsx(Dl,{turn:d,openIds:e,onToggle:i,live:r},`t${f}`))})]}):t.work.map((d,f)=>m.jsx(Dl,{turn:d,openIds:e,onToggle:i,live:r,fold:l},`t${f}`)),t.answer&&m.jsx(Dl,{turn:t.answer,openIds:e,onToggle:i,live:r,fold:!t.now}),t.after.map((d,f)=>m.jsx(Dl,{turn:d,openIds:e,onToggle:i,live:r,fold:!t.now},`after${f}`))]})}function P3(){const[t,e]=k.useState(()=>new Set);return[t,r=>e(s=>{const n=new Set(s);return n.has(r)?n.delete(r):n.add(r),n})]}const fu=t=>new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),lC=t=>t.length>700||(t.match(/\n/g)||[]).length>10;function ag({who:t,ts:e,text:i,className:r=""}){const s=Ie(),[n,o]=k.useState(!1),a=!n&&lC(i);return m.jsxs("div",{className:`m-quote${a?" is-clamped":""}${r?` ${r}`:""}`,children:[(t||e)&&m.jsxs("div",{className:"m-quote-head",children:[t&&m.jsx("span",{className:"m-quote-who",children:t}),e&&m.jsx("time",{className:"m-tin",children:fu(e)})]}),m.jsx("div",{className:"m-ev-text",children:m.jsx(Ru,{children:i})}),a&&m.jsx("button",{type:"button",className:"m-quote-more",onClick:()=>o(!0),children:s("mobile.more")})]})}function uC({data:t,live:e=!1}){var s;const[i,r]=P3();return(s=t==null?void 0:t.turns)!=null&&s.length?m.jsxs("div",{className:"tc-flow",children:[m.jsx(F3,{turns:t.turns,openIds:i,onToggle:r,live:e}),t.truncated&&m.jsxs("div",{className:"m-transcript-truncated",children:["transcript 已截断:省略 ",t.omittedTurns||0," turns、",t.omittedBytes||0," bytes",t.outOfOrderEvents?`,检测到 ${t.outOfOrderEvents} 条乱序记录`:""]})]}):m.jsx("div",{className:"m-transcript-empty",children:"transcript 已读取:该区间没有 turn"})}function F3({turns:t,openIds:e,onToggle:i,live:r=!1}){return oC(t,r).map((s,n)=>m.jsx(aC,{segment:s,openIds:e,onToggle:i,live:r},`w${n}`))}function cC(t){let e=0;return t.forEach((i,r)=>{i.role==="user"&&(e=r+1)}),t.slice(e)}function hC(t){const e=cC(t);let i=-1;for(let r=e.length-1;r>=0;r--)if(e[r].text){i=r;break}return i<0?e:e.slice(i)}function dC({data:t,lastSaid:e=null}){var c;const[i,r]=P3(),s=k.useMemo(()=>t!=null&&t.turns?hC(t.turns):[],[t]);if(!s.length)return null;const n=rC(s[0].text,e),o=s.some(h=>(h.tools||[]).some(d=>e1(d,!0)));if(n&&!o)return null;const a=n?[{...s[0],text:void 0},...s.slice(1)]:s;if(!a.some(h=>{var d;return h.text||((d=h.tools)==null?void 0:d.length)}))return null;const l=a[a.length-1],u=!!l.text&&!((c=l.tools)!=null&&c.length);return m.jsx("div",{className:`m-live${u?" is-speaking":""}`,"data-revision":t.revision,children:m.jsx(F3,{turns:a,openIds:i,onToggle:r,live:!0})})}const lg=t=>typeof t=="number"?t:Date.parse(t),fC=/\n*— from session (?:"(.*?)" \(([^\s)]+)\)|(\S+))(?: on machine \S+)?\. To reply: spex session send (?:--ssh \S+ )?\S+ "<your reply>"\s*$/;function pC(t){const e=fC.exec(t||"");return e?{text:t.slice(0,e.index),envelope:{label:e[1]||null,id:e[2]||e[3]}}:{text:t,envelope:null}}function mC(t,e){const i=[];let r=null,s=!1;const n=a=>{r??(r={kind:"seam",ts:a,from:lg(a)})},o=(a,l=!1)=>{r&&i.push({...r,to:a,open:l}),r=null};for(const a of t){const l=a.display||a.status;if(a.kind==="status"&&(s=l==="working"),a.kind==="status"&&s&&!a.note){n(a.ts);continue}o(lg(a.ts)),a.kind==="sent"?i.push({kind:"quote",ts:a.ts,from:a.from,...pC(a.text)}):l==="error"||l==="corrupt"?i.push({kind:"event",ts:a.ts,status:l,text:a.note}):i.push({kind:"say",ts:a.ts,status:l,text:a.note}),s&&n(a.ts)}return r&&o(Math.max(r.from+1,e),!0),i}const Nu={merged:{color:"#859900"},active:{color:"#cb4b16"},drift:{color:"#b58900"},pending:{color:"#93a1a1"}},gC={added:"+",edited:"~",deleted:"✕",moved:"→"},pR=["merged","active","drift","pending"];function mR(t){var o,a;const e={merged:[],active:[],drift:[],pending:[]},i=[],r=new Set,s={pass:0,fail:0,stalePass:0,staleFail:0,empty:0},n={pass:[],fail:[],stalePass:[],staleFail:[],empty:[]};for(const l of t){e[l.status]&&e[l.status].push(l.id);const u=(o=l.reviewSummary)==null?void 0:o.issues;if(u!=null&&u.open){i.push(l.id);for(const h of u.openIds||[])r.add(h)}const c=(a=l.reviewSummary)==null?void 0:a.evals;if(c)for(const h of Object.keys(s)){const d=c[h]||0;s[h]+=d,d>0&&n[h].push(l.id)}}return{total:t.length,status:e,issueIds:i,issueCount:r.size,scoreCount:s,scoreNodes:n}}function gR(t,e=14){const i=String(t??"");if(i.length<=e)return i;if(e<=1)return"…".slice(0,e);const r=e-1,s=Math.max(1,Math.floor(r/2)-1),n=r-s;return`${i.slice(0,s)}…${i.slice(i.length-n)}`}const ug=["◆","▲","●","■","★","✦","⬟","⬢","❖","◈","✸","⟡","✚","❂","◐","◑","⬣","▰","✶","⬤","✹","◇","⊛","✺"],cg=["circle","rounded","square","hex"];function vC(t){const e=T5(t);return{seed:t,glyph:ug[(e>>>9)%ug.length],shape:cg[(e>>>17)%cg.length],...B5(t)}}function t1({seed:t,status:e,title:i,size:r=16}){const s=vC(t),n={width:r,height:r};return m.jsx("span",{className:`avatar av-st-${e||"none"}`,"data-tip":i,"aria-label":i,style:n,children:m.jsx("span",{className:`av-face av-gen av-${s.shape}`,style:{...n,background:s.bg,color:s.fg,fontSize:r*.62},children:s.glyph})})}function I3(t){var e;return Hr(t)||((e=t==null?void 0:t.id)==null?void 0:e.slice(0,8))||""}function dd({session:t,active:e=!1,selected:i=!1,onPick:r,onHover:s,onOpen:n,compact:o=!1,newSession:a=!1,name:l=null,className:u=""}){const c=Ie(),h=a?null:o0(t),d=a?c("sessionPicker.newSession"):I3(t),f=a?d:`${d} · ${c(`status.${h.status}`)}`;return m.jsxs("button",{type:"button",role:"option","aria-selected":i,className:`session-picker-row${e?" active":""}${i?" selected":""}${o?" compact":""}${a?" new":""}${u?` ${u}`:""}`,"data-session-picker-id":a?"new":t.id,title:f,onMouseDown:p=>p.preventDefault(),onMouseEnter:s,onDoubleClick:()=>n==null?void 0:n(a?"new":t.id),onClick:()=>r==null?void 0:r(a?"new":t.id),children:[a?m.jsx("span",{className:"session-picker-new-icon","aria-hidden":"true",children:m.jsx(ze,{name:"plus",size:13})}):m.jsx(t1,{seed:t.id,status:h.status,size:o?15:17,title:f}),m.jsx("span",{className:"session-picker-name",children:l||d}),!a&&m.jsx("span",{className:"session-picker-status",style:{color:h.color},"aria-label":c(`status.${h.status}`),children:h.glyph})]})}function bC({sessions:t=[],value:e="",onChange:i,onOpen:r,includeNew:s=!1,filter:n=!0,placeholder:o,ariaLabel:a,className:l="",compact:u=!1,autoFocus:c=!1}){const h=Ie(),d=k.useRef(null),[f,p]=k.useState(""),[v,_]=k.useState(0),w=k.useMemo(()=>{const D=f.trim().toLocaleLowerCase(),R=t.filter(E=>!D||[I3(E),f4(E),E.id].some(L=>L==null?void 0:L.toLocaleLowerCase().includes(D)));return s?[...R,{id:"new",__new:!0}]:R},[s,f,t]);k.useEffect(()=>{_(D=>Math.min(D,Math.max(w.length-1,0)))},[w.length]),k.useEffect(()=>{var D;c&&((D=d.current)==null||D.focus())},[c]);const x=D=>{i==null||i(D),D!=="new"&&p("")},C=D=>{if(D.key==="ArrowDown")D.preventDefault(),_(R=>w.length?(R+1)%w.length:0);else if(D.key==="ArrowUp")D.preventDefault(),_(R=>w.length?(R-1+w.length)%w.length:0);else if(D.key==="Enter"){D.preventDefault();const R=w[v];R&&x(R.id)}};return m.jsxs("div",{className:`session-picker${u?" compact":""}${l?` ${l}`:""}`,children:[n&&m.jsx("input",{ref:d,className:"session-picker-filter",value:f,placeholder:o||h("sessionPicker.filter"),"aria-label":a||h("sessionPicker.filter"),onChange:D=>{p(D.target.value),_(0)},onKeyDown:C}),m.jsx("div",{className:"session-picker-list",role:"listbox","aria-label":a||h("sessionPicker.label"),children:w.length?w.map((D,R)=>D.__new?m.jsx(dd,{newSession:!0,active:R===v,selected:e==="new",onPick:x,onOpen:r,onHover:()=>_(R),compact:u},"new"):m.jsx(dd,{session:D,active:R===v,selected:e===D.id,onPick:x,onOpen:r,onHover:()=>_(R),compact:u},D.id)):m.jsx("div",{className:"session-picker-empty",children:h("sessionPicker.empty")})})]})}const _C=/\[\[(\.?[\p{L}\p{N}_-]+)\]\]/gu,z3=(t,e=[])=>t.replace(_C,(i,r)=>{const s=e.find(n=>n.id===r);return s?`[[${s.id}]] (${s.path})`:i}),j3=(t,e=[])=>e.find(i=>i.ui&&t.trim()===`/${i.name}`)||null,H3=t=>(t||"").replace(/^\.spec\//,"").replace(/\/spec\.md$/,"");function yC(t,e,i){const r=e.toLowerCase(),s=[];for(const n of t){const o=n.id.toLowerCase(),a=H3(n.path).toLowerCase();let l;if(!r)l=3;else if(o.startsWith(r))l=0;else if(o.includes(r))l=1;else if(a.includes(r))l=2;else continue;n.id===i&&(l=-1),s.push({s:n,score:l})}return s.sort((n,o)=>n.score-o.score||n.s.id.length-o.s.id.length||n.s.id.localeCompare(o.s.id)),s.slice(0,8).map(n=>n.s)}function wC(t,e){const i=e.toLowerCase(),r=u=>Hr(u)||(u.id||"").slice(0,8),s=u=>{var c,h;return[u==null?void 0:u.title,u==null?void 0:u.label,(c=u==null?void 0:u.raw)==null?void 0:c.name,(h=u==null?void 0:u.raw)==null?void 0:h.title,u==null?void 0:u.activity,u==null?void 0:u.promptPreview,u==null?void 0:u.note].filter(d=>typeof d=="string"&&d.trim()).map(d=>d.toLowerCase())},n=[];for(const u of t||[]){const c=(u.id||"").toLowerCase(),h=s(u);let d;if(!i)d=3;else if(c===i||h.some(f=>f===i))d=0;else if(c.startsWith(i)||h.some(f=>f.startsWith(i)))d=1;else if(c.includes(i)||h.some(f=>f.includes(i)))d=2;else continue;n.push({s:u,score:d})}n.sort((u,c)=>u.score-c.score||(c.s.created||0)-(u.s.created||0));const o=n.map(u=>({id:u.s.id,label:r(u.s),sub:u.s.node||u.s.status,session:u.s})),a=n.filter(u=>u.score===0).length,l=o.slice(0,Math.min(a,7));return[...l,{id:"new",label:"new",sub:"choose a launcher"},...o.slice(l.length)].slice(0,8)}function xC(t,e){const i=e.toLowerCase();return(t||[]).map(r=>{const s=(r.name||"").toLowerCase(),n=i?s.startsWith(i)?0:s.includes(i)?1:-1:1;return{launcher:r,score:n}}).filter(r=>r.score>=0).sort((r,s)=>r.score-s.score||r.launcher.name.localeCompare(s.launcher.name)).slice(0,8).map(({launcher:r})=>({id:r.name,label:r.name,sub:r.cmd||r.harness||""}))}function ta(t,e){if(!e)return t;const i=t.toLowerCase().indexOf(e.toLowerCase());return i<0?t:m.jsxs(m.Fragment,{children:[t.slice(0,i),m.jsx("b",{className:"mention-hit",children:t.slice(i,i+e.length)}),t.slice(i+e.length)]})}function $3(t,e){const i=e.toLowerCase(),r=[];for(const s of t){const n=s.name.toLowerCase();let o;if(!i)o=1;else if(n.startsWith(i))o=0;else if(n.includes(i))o=1;else continue;r.push({c:s,score:o})}return r.sort((s,n)=>s.score-n.score),r.slice(0,10).map(s=>s.c)}function SC(t,e,i){let r=e;for(;r>0&&!/\s/.test(t[r-1]);)r--;if(t[r]!=="/")return null;const s=t.slice(r+1,e),n=$3(i,s);return n.length?{items:n,index:0,start:r,end:e,query:s}:null}function kC(t,e){const i=/^\/(\S*)$/.exec(t);if(!i)return null;const r=$3(e,i[1]);return r.length?{items:r,index:0,start:0,end:t.length,query:i[1]}:null}const CC=t=>t&&t[0].toUpperCase()+t.slice(1),AC={user:"(user)",project:"(project)",skill:"[skill]","built-in":"built-in",ui:"[ui]",preset:"[preset]",review:"[review]"};function EC({menu:t,up:e,head:i,onPick:r,onHover:s}){const n=Ie();return m.jsxs("ul",{className:e?"mention-menu up":"mention-menu",role:"listbox",children:[m.jsxs("li",{className:"mention-head",children:["// ",i," — ",n("session.menuHint")]}),t.items.map((o,a)=>{const l=o.ui?"ui":o.source??o.kind,u=o.ui?` sc-${o.color}`:"";return m.jsxs("li",{role:"option","aria-selected":a===t.index,className:`${a===t.index?"mention-item on":"mention-item"}${u}`,onMouseDown:c=>{c.preventDefault(),r(o)},onMouseEnter:()=>s(a),children:[m.jsxs("span",{className:o.ui?"slash-name ui":"slash-name",children:["/",ta(o.name,t.query)]}),m.jsx("span",{className:"slash-desc",children:CC(o.description??o.desc)}),m.jsx("span",{className:`slash-src src-${l}`,children:AC[l]||l})]},`${l}:${o.name}`)})]})}function DC(t,e,i,r){let s=e-1;for(;s>=0&&/[\p{L}\p{N}_.\-]/u.test(t[s]);)s--;if(s>=1&&t[s-1]==="["&&t[s]==="["){const n=t.slice(s+1,e),o=yC(i,n,r);return o.length?{kind:"mention",items:o,index:0,start:s-1,end:e,query:n}:null}return null}function hg(t,e,i,r=[]){let s=e-1;for(;s>=0&&/[\p{L}\p{N}_.:\-]/u.test(t[s]);)s--;if(s>=0&&t[s]==="@"&&(s===0||/\s/.test(t[s-1]))){const n=t.slice(s+1,e);if(n.startsWith("new:")){const a=xC(r,n.slice(4));return a.length?{kind:"launcher",items:a,index:0,start:s,end:e,query:n.slice(4)}:null}const o=wC(i,n);return o.length?{kind:"session",items:o,index:0,start:s,end:e,query:n}:null}return null}function MC({menu:t,up:e,fixedStyle:i,onPick:r,onHover:s}){const n=Ie(),o=t.kind==="launcher",a=t.kind==="session"||o,l=o?`@new:${t.query}`:t.query?a?`@${t.query}`:`[[${t.query}]]`:n(a?"session.menuSessions":"session.menuSpecNodes");return m.jsxs("ul",{className:`${e?"mention-menu up":"mention-menu"}${i?" fixed":""}`,style:i||void 0,role:"listbox",children:[m.jsxs("li",{className:"mention-head",children:["// ",l," — ",n("session.menuHint")]}),t.items.map((u,c)=>{var h;return a&&u.session?m.jsx(dd,{session:u.session,compact:!0,active:c===t.index,onPick:()=>r(u),onHover:()=>s(c),className:"mention-item",name:m.jsxs(m.Fragment,{children:["@",ta(u.label,t.query)]})},u.id):m.jsxs("li",{role:"option","aria-selected":c===t.index,className:`${c===t.index?"mention-item on":"mention-item"}${o||t.kind==="session"&&u.id==="new"?" new":""}`,onMouseDown:d=>{d.preventDefault(),r(u)},onMouseEnter:()=>s(c),children:[!a&&m.jsx("span",{className:"mention-dot",style:{background:((h=Nu[u.status])==null?void 0:h.color)||Nu.pending.color}}),m.jsx("span",{className:"mention-id",children:o?m.jsxs(m.Fragment,{children:["@new:",ta(u.label,t.query)]}):a?m.jsxs(m.Fragment,{children:["@",ta(u.label,t.query)]}):ta(u.id,t.query)}),m.jsx("span",{className:"mention-path",children:a?u.sub:H3(u.path)})]},u.id)})]})}function fd({inputRef:t,value:e,setValue:i,specs:r=[],sessions:s=[],launchers:n=[],focusId:o=null,up:a=!1,fixedAbove:l=null,slash:u=null}){const[c,h]=k.useState(null),[d,f]=k.useState(null),p=k.useRef(null),v=F=>`${F.value}\0${F.selectionStart}`,_=(F,$)=>{var z;if(!((z=u==null?void 0:u.commands)!=null&&z.length))return null;const W=u.mode==="token"?SC(F,$,u.commands):kC(F,u.commands);return W?{kind:"slash",...W}:null},w=F=>{var T;if(!F){h(null),f(null);return}const $=v(F);if(p.current===$){h(null),f(null);return}p.current=null;const W=F.selectionStart,z=DC(F.value,W,r,o)||hg(F.value,W,s,n)||_(F.value,W);if(h(z),!z||!l){f(null);return}const j=F.getBoundingClientRect(),A=(T=F.closest(l))==null?void 0:T.getBoundingClientRect(),O=(A==null?void 0:A.top)??j.top;f({left:`${j.left}px`,width:`${j.width}px`,right:"auto",bottom:`${Math.max(8,window.innerHeight-O+8)}px`})};k.useEffect(()=>{const F=t.current;n.length&&F&&document.activeElement===F&&w(F)},[n]);const x=F=>h($=>$&&{...$,index:($.index+F+$.items.length)%$.items.length}),C=F=>h($=>$&&{...$,index:F}),D=F=>{var j;if(!F||!c)return;p.current=null;const $=e.slice(0,c.start);if(c.kind==="slash"){if((j=u==null?void 0:u.onPick)!=null&&j.call(u,F,c)){h(null),f(null);return}const A=`/${F.name} `;i($+A+e.slice(c.end)),h(null),f(null);const O=$.length+A.length;requestAnimationFrame(()=>{const T=t.current;T&&(T.focus(),T.setSelectionRange(O,O))});return}if(c.kind==="session"&&F.id==="new"){const A="@new:",O=$+A+e.slice(c.end),T=$.length+A.length;i(O),h(hg(O,T,s,n)),requestAnimationFrame(()=>{const U=t.current;U&&(U.focus(),U.setSelectionRange(T,T))});return}const W=c.kind==="session"?`@${F.id} `:c.kind==="launcher"?`@new:${F.id} `:`[[${F.id}]] `;i($+W+e.slice(c.end)),h(null),f(null);const z=$.length+W.length;requestAnimationFrame(()=>{const A=t.current;A&&(A.focus(),A.setSelectionRange(z,z))})},R=F=>c?F.key==="ArrowDown"?(F.preventDefault(),F.stopPropagation(),x(1),!0):F.key==="ArrowUp"?(F.preventDefault(),F.stopPropagation(),x(-1),!0):F.key==="Enter"||F.key==="Tab"?(F.preventDefault(),F.stopPropagation(),D(c.items[c.index]),!0):F.key==="Escape"?(F.preventDefault(),F.stopPropagation(),E(),!0):!1:!1,E=()=>{t.current&&(p.current=v(t.current)),h(null),f(null)},L=()=>{p.current=null,h(null),f(null)};ni(!!c,E);const q=c?c.kind==="slash"?m.jsx(EC,{menu:c,up:a,head:c.query?`/${c.query}`:u==null?void 0:u.head,onPick:D,onHover:C}):m.jsx(MC,{menu:c,up:a,fixedStyle:d,onPick:D,onHover:C}):null;return{menu:c,sync:w,onKeyDown:R,close:L,dismiss:E,accept:D,nav:x,menuEl:q}}function vR(t,e,i,r){return e?t.key==="ArrowDown"?(t.preventDefault(),t.stopPropagation(),i(s=>s&&{...s,index:(s.index+1)%s.items.length}),!0):t.key==="ArrowUp"?(t.preventDefault(),t.stopPropagation(),i(s=>s&&{...s,index:(s.index-1+s.items.length)%s.items.length}),!0):t.key==="Enter"||t.key==="Tab"?(t.preventDefault(),t.stopPropagation(),r(e.items[e.index]),!0):t.key==="Escape"?(t.preventDefault(),t.stopPropagation(),i(null),!0):!1:!1}function q3(t,e,i,r=null){if(!t)return;const s=t.selectionStart??t.value.length,n=t.selectionEnd??s;i(t.value.slice(0,s)+e+t.value.slice(n));const o=s+e.length;requestAnimationFrame(()=>{t.isConnected&&(t.focus(),t.setSelectionRange(o,o),r==null||r(t))})}function bR({label:t,onClick:e,disabled:i=!1,children:r}){return m.jsx("button",{type:"button",className:"fv-trigger-btn","data-tip":t,"aria-label":t,disabled:i,onMouseDown:s=>s.preventDefault(),onClick:e,children:r})}const Ml=1,pd=1024,TC=1024,BC=1024,md=pd*TC,dg=md*BC;let RC=0;const NC=()=>{var t,e;return((e=(t=globalThis.crypto)==null?void 0:t.randomUUID)==null?void 0:e.call(t))||`attachment-${Date.now()}-${++RC}`},fg=t=>t<pd?`${t} B`:t<md?`${Math.round(t/pd)} KB`:t<dg?`${(t/md).toFixed(1)} MB`:`${(t/dg).toFixed(2)} GB`,Tl=async t=>{const e=await t.json().catch(()=>null);return(e==null?void 0:e.error)||`upload failed (HTTP ${t.status})`},LC=(t,e)=>(t==null?void 0:t.size)===e&&Number.isSafeInteger(t.chunkBytes)&&t.chunkBytes>0&&Number.isSafeInteger(t.concurrency)&&t.concurrency>0&&Number.isSafeInteger(t.requestTimeoutMs)&&t.requestTimeoutMs>0&&Number.isSafeInteger(t.retryLimit)&&t.retryLimit>=0&&Number.isSafeInteger(t.retryDelayMs)&&t.retryDelayMs>=0&&Number.isSafeInteger(t.offset)&&t.offset>=0&&t.offset<=e,OC=(t,e)=>new Promise((i,r)=>{if(e.signal.aborted){r(new Error("upload cancelled"));return}const s=window.setTimeout(()=>{e.signal.removeEventListener("abort",n),i()},t),n=()=>{window.clearTimeout(s),r(new Error("upload cancelled"))};e.signal.addEventListener("abort",n,{once:!0})}),pg=async(t,e,i,r)=>{const s=new AbortController,n=()=>s.abort();i.signal.addEventListener("abort",n,{once:!0});const o=window.setTimeout(()=>s.abort(),r);try{return await fetch(t,{...e,signal:s.signal})}catch(a){throw!i.signal.aborted&&s.signal.aborted?new Error("upload request timed out"):a}finally{window.clearTimeout(o),i.signal.removeEventListener("abort",n)}},PC=async(t,e,i)=>{let r=0;for(;;)try{return await t()}catch(s){if(i.signal.aborted||r>=e.retryLimit)throw s;r+=1,await OC(e.retryDelayMs,i)}},FC=(t,e,i)=>{const r=t.current;if(!r){e(u=>{const c=u||"";return c+(c&&!/\s$/.test(c)?" ":"")+i+" "});return}const s=r.value,n=r.selectionStart,o=r.selectionEnd,a=s.slice(0,n),l=(a&&!/\s$/.test(a)?" ":"")+i+" ";e(a+l+s.slice(o)),requestAnimationFrame(()=>{if(!r.isConnected)return;r.focus();const u=a.length+l.length;r.setSelectionRange(u,u)})};function gd({inputRef:t,setValue:e,variant:i="command",disabled:r=!1}){const s=Ie(),[n,o]=k.useState([]),[a,l]=k.useState(!1),u=k.useRef([]),c=k.useRef(new Map),h=k.useRef(!1),d=k.useRef(null),f=k.useRef(null);f.current=A=>FC(t,e,A);const p=A=>{u.current=A,o(A)},v=(A,O)=>p(u.current.map(T=>T.id===A?{...T,...O}:T)),_=async(A,O=null)=>{const T=u.current.find(H=>H.id===A);if(!T||T.phase==="cancelled")return null;v(A,{phase:"uploading",error:null});const U=new AbortController;c.current.set(A,U);try{let H=T.transferId,re=null;if(H){const Y=await fetch(Di(`/api/uploads/${H}`),{signal:U.signal});if(Y.ok)re=await Y.json();else if(Y.status!==404)throw new Error(await Tl(Y))}if(!re){const Y=await fetch(Di("/api/uploads"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:T.file.name||"pasted",size:T.file.size}),signal:U.signal});if(!Y.ok)throw new Error(await Tl(Y));if(re=await Y.json(),H=re==null?void 0:re.id,!H)throw new Error("upload did not return a transfer id");v(A,{transferId:H})}if(!LC(re,T.file.size))throw new Error("upload transfer metadata is invalid");O==null||O(re.concurrency);let G=re.offset;for(v(A,{offset:G});G<T.file.size;){const Y=T.file.slice(G,Math.min(T.file.size,G+re.chunkBytes)),le=await PC(async()=>{const de=await pg(Di(`/api/uploads/${H}`),{method:"PATCH",headers:{"content-type":"application/offset+octet-stream","upload-offset":String(G)},body:Y},U,re.requestTimeoutMs);if(de.status>=500)throw new Error(await Tl(de));return de},re,U),te=await le.json().catch(()=>null);if(le.status===409&&Number.isSafeInteger(te==null?void 0:te.offset)&&te.offset>=0&&te.offset<=T.file.size){G=te.offset,v(A,{offset:G});continue}if(!le.ok)throw new Error((te==null?void 0:te.error)||`upload failed (HTTP ${le.status})`);if(!Number.isSafeInteger(te==null?void 0:te.offset)||te.offset<=G||te.offset>T.file.size)throw new Error("upload did not advance its committed offset");G=te.offset,v(A,{offset:G})}const X=await pg(Di(`/api/uploads/${H}/complete`),{method:"POST"},U,re.requestTimeoutMs);if(!X.ok)throw new Error(await Tl(X));const oe=await X.json().catch(()=>null);if(!(oe!=null&&oe.path))throw new Error("upload did not return a path");const I=u.current.find(Y=>Y.id===A);return(I==null?void 0:I.phase)==="cancelled"?null:(T.splice(oe.path),v(A,{phase:"complete",offset:T.file.size,path:oe.path}),re.concurrency)}catch(H){O==null||O(null),U.signal.aborted?v(A,{phase:"cancelled",offset:0,transferId:null,error:null}):v(A,{phase:"failed",error:H instanceof Error?H.message:String(H)})}finally{c.current.delete(A)}return null},w=async A=>{if(!h.current){h.current=!0;try{const[O,...T]=A;let U;const H=new Promise(Y=>{U=Y}),re=O?_(O,U):Promise.resolve(Ml),G=O?await H:Ml,X=Math.min(Math.max(0,(G||Ml)-Ml),T.length);if(X===0){await re;for(const Y of T)await _(Y);return}let oe=0;const I=Array.from({length:X},async()=>{for(;oe<T.length;){const Y=T[oe];oe+=1,await _(Y)}});await Promise.all([re,...I])}finally{h.current=!1}}},x=A=>{h.current||w([A])},C=async A=>{var T;const O=u.current.find(U=>U.id===A);O&&((T=c.current.get(A))==null||T.abort(),O.transferId&&await fetch(Di(`/api/uploads/${O.transferId}`),{method:"DELETE"}).catch(()=>{}),v(A,{phase:"cancelled",offset:0,transferId:null,error:null}))},D=A=>{const O=u.current.find(T=>T.id===A);O&&(O.phase!=="complete"&&O.phase!=="cancelled"&&C(A),p(u.current.filter(T=>T.id!==A)))},R=async A=>{const O=[...A||[]];if(!O.length||r||h.current)return;const T=f.current,U=O.map(H=>({id:NC(),file:H,splice:T,phase:"queued",offset:0,transferId:null,error:null}));p([...u.current,...U]),await w(U.map(H=>H.id))},E=()=>{var A;r||(A=d.current)==null||A.click()},L=A=>{var T;const O=(T=A.clipboardData)==null?void 0:T.files;r||!O||!O.length||(A.preventDefault(),R(O))},q=A=>{var O;r||[...((O=A.dataTransfer)==null?void 0:O.types)||[]].includes("Files")&&(A.preventDefault(),l(!0))},F=()=>l(!1),$=A=>{var O;A.preventDefault(),l(!1),R((O=A.dataTransfer)==null?void 0:O.files)},W=n.some(A=>A.phase==="queued"||A.phase==="uploading"),z=m.jsx("input",{ref:d,type:"file",multiple:!0,style:{display:"none"},onChange:A=>{R(A.target.files),A.target.value=""}}),j=n.length?m.jsx("div",{className:`si-attach-queue ${i}`,"aria-live":"polite",children:n.map(A=>{const O=A.phase==="queued"||A.phase==="uploading",T=A.phase==="queued"?s("session.attachQueued"):A.phase==="uploading"?`${fg(A.offset)} / ${fg(A.file.size)}`:A.phase==="complete"?s("session.attachDone"):A.phase==="cancelled"?s("session.attachCancelled"):A.error;return m.jsxs("div",{className:`si-attach-row ${A.phase}`,onAnimationEnd:U=>{U.target===U.currentTarget&&U.animationName==="si-attach-complete-out"&&D(A.id)},children:[m.jsxs("span",{className:"si-attach-name",title:A.file.name,children:[m.jsx(ze,{name:"paperclip",size:12}),A.file.name]}),m.jsx("progress",{className:"si-attach-progress",value:A.offset,max:A.file.size,"aria-label":`${A.file.name}: ${T}`}),m.jsx("span",{className:"si-attach-status",role:A.phase==="failed"?"alert":"status",children:T}),A.phase==="failed"&&m.jsx(Zt,{icon:"rotate-ccw",size:13,className:"si-attach-action",label:s("session.attachRetry"),disabled:h.current,onClick:()=>x(A.id)}),(O||A.phase==="failed")&&m.jsx(Zt,{icon:"x",size:13,className:"si-attach-action",label:s("session.attachCancel"),onClick:()=>{C(A.id)}}),(A.phase==="complete"||A.phase==="cancelled")&&m.jsx(Zt,{icon:"x",size:13,className:"si-attach-action",label:s("session.attachDismiss"),onClick:()=>D(A.id)})]},A.id)})}):null;return{pick:E,busy:W,dragging:a,onPaste:L,fileInput:z,queue:j,dropProps:{onDragOver:q,onDragLeave:F,onDrop:$}}}const W3=new Map,i1=t=>W3.get(t)||null;async function IC(t,e){var i,r;try{const s=((r=(i=globalThis.crypto)==null?void 0:i.randomUUID)==null?void 0:r.call(i))||`session-create-${Date.now()}-${Math.random().toString(16).slice(2)}`,n=await fetch(Di("/api/sessions"),{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":s},body:JSON.stringify({prompt:t,...e?{launcher:e}:{}})}),o=await n.json().catch(()=>null),a={ok:n.ok,error:o==null?void 0:o.error};return o!=null&&o.id&&(W3.set(o.id,o),a.id=o.id,a.session=o),a}catch{return{ok:!1}}}let vn=null,Bl=null;const zC=()=>vn?Promise.resolve(vn):(Bl||(Bl=a4().then(t=>(vn=t,t)).catch(t=>{throw Bl=null,t})),Bl),mg=t=>Array.isArray(t==null?void 0:t.launchers)?t.launchers:[],jC=()=>{try{return localStorage.getItem("si.launcher")||""}catch{return""}},gg=(t,e,i=jC())=>{var r;return t.some(s=>s.name===i)?i:e&&t.some(s=>s.name===e)?e:((r=t[0])==null?void 0:r.name)||i};function K3(){const t=mg(vn),[e,i]=k.useState(t),[r,s]=k.useState(()=>gg(t,vn==null?void 0:vn.default)),n=o=>{s(o);try{localStorage.setItem("si.launcher",o)}catch{}};return k.useEffect(()=>{zC().then(o=>{const a=mg(o);a.length&&(i(a),s(l=>gg(a,o.default,l)))}).catch(()=>{})},[]),{launchers:e,launcher:r,pickLauncher:n}}function V3(){const[t,e]=k.useState([]);return k.useEffect(()=>{R5().then(i=>{Array.isArray(i)&&e(i)}).catch(()=>{})},[]),t}function U3(t){const[e,i]=k.useState([]);return k.useEffect(()=>{let r=!0;return fetch(Di(`/api/slash-commands?harness=${encodeURIComponent(t||"claude")}`)).then(s=>s.json()).then(s=>{r&&Array.isArray(s)&&i(s)}).catch(()=>{}),()=>{r=!1}},[t]),e}const HC=[{name:"command",color:"blue",icon:"command",button:!0,typed:!1,pressed:!0,anchor:"right",when:t=>!!(t!=null&&t.status)&&t.status!=="offline"&&t.status!=="queued"&&t.liveness!=="offline",labelKey:"session.commandBtn",titleKey:"session.commandTitle",shortcut:"shell.commandBox"},{name:"eval",color:"cyan",button:!1,when:t=>!!(t!=null&&t.status),labelKey:"sessionEval.btn",titleKey:"sessionEval.btnTitle",descKey:"session.cmd.evalDesc"},{name:"relaunch",color:"blue",icon:"rotate-ccw",button:!0,typed:!1,when:t=>!!(t!=null&&t.status)&&t.status!=="queued"&&t.status!=="retired"&&t.liveness==="offline",labelKey:"session.relaunch",titleKey:"session.relaunchTitle"},{name:"stop",color:"muted",button:!1,when:t=>!!(t!=null&&t.status)&&t.status!=="offline"&&t.status!=="queued"&&t.liveness!=="offline",titleKey:"session.cmd.stopTitle",descKey:"session.cmd.stopDesc"},{name:"close",color:"red",button:!1,when:t=>!!(t!=null&&t.status)&&t.status!=="offline",titleKey:"session.cmd.closeTitle",descKey:"session.cmd.closeDesc"}];function vg(t,e={}){return t!=null&&t.archived?[]:HC.filter(i=>i.when(t)).map(i=>{var r;return{...i,...((r=i.availability)==null?void 0:r.call(i,t))||{enabled:!0},run:e[i.name]}})}function G3(t=[],e=[],i=[]){const r=new Set;return[...t,...e.map(s=>({...s,source:"preset"})),...i].filter(s=>!(s!=null&&s.name)||r.has(s.name)?!1:(r.add(s.name),!0))}const $C=t=>new Date(t).toLocaleDateString([],{month:"short",day:"numeric"}),bg=t=>new Date(t).toDateString(),Ac=new Map;function _g(t,e,i){return`${t}:${e}:${i}`}function Ec(t,e){return`${t}:${e}`}const qC=(t,e)=>t!=null&&t.length===e.length&&(t.length===0||JSON.stringify(t[t.length-1])===JSON.stringify(e[e.length-1])),WC='button, summary, a, input, textarea, select, option, label, [role], [contenteditable]:not([contenteditable="false"])',KC=new Set(["Backspace","Delete","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"]),Ar=Object.freeze({NORMAL:0,WORD:1,LINE:2}),x0=()=>typeof Highlight<"u"&&typeof CSS<"u"&&!!CSS.highlights,VC=()=>{x0()&&CSS.highlights.delete("timeline-sel")},UC=()=>x0()&&typeof document.caretRangeFromPoint=="function",GC=t=>{const e=document.getSelection();if(!t||!e||e.rangeCount===0)return;const i=r=>!!r&&t.contains(r);(i(e.anchorNode)||i(e.focusNode))&&e.removeAllRanges()},yg=t=>!x0()||!t||t.collapsed?!1:(CSS.highlights.set("timeline-sel",new Highlight(t)),!0),YC=t=>{let e=!1;const i=s=>{if(s.clipboardData)try{s.clipboardData.setData("text/plain",t),s.preventDefault(),e=!0}catch{}};document.addEventListener("copy",i,!0);let r=!1;try{r=document.execCommand("copy")===!0}catch{}return document.removeEventListener("copy",i,!0),e&&r},XC=async t=>{var e;try{if(typeof((e=navigator.clipboard)==null?void 0:e.writeText)=="function")return await navigator.clipboard.writeText(t),!0}catch{}return YC(t)},Lu=(t,e,i)=>{var s;const r=(s=document.caretRangeFromPoint)==null?void 0:s.call(document,e,i);return r&&t.contains(r.startContainer)?r:null},wg=(t,e,i)=>{const r=Lu(t,e,i),s=r==null?void 0:r.startContainer;if(!s||s.nodeType!==Node.TEXT_NODE||!s.data)return null;const n=Math.min(r.startOffset,s.data.length);let o=null;if(typeof Intl.Segmenter=="function"){const l=[...new Intl.Segmenter(void 0,{granularity:"word"}).segment(s.data)];o=l.find(({index:u,segment:c,isWordLike:h})=>h&&u<=n&&n<u+c.length)||l.findLast(({index:u,segment:c,isWordLike:h})=>h&&u<n&&n<=u+c.length),o&&(o=[o.index,o.index+o.segment.length])}if(!o){const l=h=>/[\p{L}\p{M}\p{N}_]/u.test(h);let u=Math.min(n,s.data.length-1);if(!l(s.data[u])&&u>0&&l(s.data[u-1])&&(u-=1),!l(s.data[u]))return null;let c=u+1;for(;u>0&&l(s.data[u-1]);)u-=1;for(;c<s.data.length&&l(s.data[c]);)c+=1;o=[u,c]}const a=document.createRange();return a.setStart(s,o[0]),a.setEnd(s,o[1]),a},xg=(t,e,i)=>{const r=Lu(t,e,i),s=r==null?void 0:r.startContainer,n=(s==null?void 0:s.nodeType)===Node.ELEMENT_NODE?s:s==null?void 0:s.parentElement,o=n==null?void 0:n.closest(".m-ev-note, .m-ev-text");if(!o||!t.contains(o))return null;const a=document.createRange();return a.selectNodeContents(o),a},JC=(t,e,i)=>{const r=t.compareBoundaryPoints(Range.START_TO_START,e)<=0,s=r?t:e,n=r?e:t,o=document.createRange();return o.setStart(s.startContainer,s.startOffset),i===Ar.NORMAL?o.setEnd(n.startContainer,n.startOffset):o.setEnd(n.endContainer,n.endOffset),o};function ZC({session:t,state:e,active:i,inputRef:r,draft:s,setDraft:n,sending:o,send:a,sendErr:l,sendNote:u,onRestore:c,actionOutcome:h,onComposerPress:d,working:f=!1,stopping:p=!1,stop:v,specs:_=[],sessions:w=[],boardCommands:x=[]}){const C=Ie(),D=e!=="live",R=!D&&f,{launchers:E}=K3(),L=V3(),q=U3(t==null?void 0:t.harness),F=k.useMemo(()=>G3(x,L,q),[x,L,q]),$=fd({inputRef:r,value:s,setValue:n,specs:_,sessions:w,launchers:E,up:!0,slash:{commands:F,mode:"line",head:C("session.menuCommands"),onPick:A=>{var O;return A.ui?(n(""),(O=A.run)==null||O.call(A),!0):!1}}}),W=gd({inputRef:r,setValue:n,variant:"command",disabled:D}),z=A=>q3(r.current,A,n,$.sync),j=()=>{var T;if(D)return;const A=s.trim();if(!A)return;const O=j3(A,F);if(O){n(""),$.close(),(T=O.run)==null||T.call(O);return}a(z3(A,_))};return m.jsx(L3,{as:"footer",className:`m-composer is-${e}${W.dragging?" dragover":""}`,"data-footer-state":e,...W.dropProps,preview:(l||u)&&m.jsx("div",{className:l?"m-senderr":"m-sendnote",children:l||u}),editor:!D&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"m-composer-line fv-tawrap",children:[m.jsx(hd,{ref:r,className:"m-input","data-focus-sink":i&&!D?"":void 0,rows:1,placeholder:C("mobile.inputPlaceholder"),value:s,onMouseDownCapture:d,onChange:A=>{n(A.target.value),$.sync(A.target)},onSelect:A=>$.sync(A.target),onBlur:$.close,onPaste:W.onPaste,onKeyDown:A=>{ha(A)||$.onKeyDown(A)||!D&&A.key==="Enter"&&!A.shiftKey&&!ha(A)&&(A.preventDefault(),A.stopPropagation(),j())}}),$.menuEl]}),W.queue]}),footer:m.jsxs(m.Fragment,{children:[!D&&m.jsxs(m.Fragment,{children:[W.fileInput,m.jsxs("div",{className:"si-command-tools m-composer-tools",children:[m.jsxs("span",{className:"si-command-title",children:[m.jsx(ze,{name:"command",size:12}),C("session.commandBox")]}),m.jsx("button",{type:"button",className:"fv-trigger-btn","data-tip":C("thread.mentionActor"),"aria-label":C("thread.mentionActor"),onMouseDown:A=>A.preventDefault(),onClick:()=>z("@"),children:"@"}),m.jsx("button",{type:"button",className:"fv-trigger-btn","data-tip":C("thread.mentionNode"),"aria-label":C("thread.mentionNode"),onMouseDown:A=>A.preventDefault(),onClick:()=>z("[["),children:"[["}),m.jsx("button",{type:"button",className:"fv-trigger-btn","data-tip":C("session.menuCommands"),"aria-label":C("session.menuCommands"),onMouseDown:A=>A.preventDefault(),onClick:()=>z("/"),children:"/"}),m.jsx(Zt,{icon:W.busy?"loader":"paperclip",size:14,iconClassName:W.busy?"si-attach-busy":void 0,className:"si-command-tool",label:C("session.attachTitle"),disabled:W.busy,onClick:W.pick}),R&&m.jsx(Zt,{icon:"stop",size:12,className:"m-stop",label:C("mobile.stop"),disabled:p,onMouseDown:A=>A.preventDefault(),onClick:v}),m.jsx(Zt,{icon:"send",size:14,className:"m-send",label:C("mobile.send"),disabled:!s.trim()||o,onMouseDown:A=>A.preventDefault(),onClick:j})]})]}),D&&m.jsxs("div",{className:"m-coldline",children:[m.jsx("span",{children:C(e==="archived"?"session.archivedReadOnly":"session.offlineReadOnly")}),c&&m.jsx("button",{type:"button",className:"m-coldline-action",disabled:(h==null?void 0:h.phase)==="pending",onClick:c,children:C(e==="archived"?"session.shelfRestore":"session.relaunch")})]}),D&&h&&m.jsx("div",{className:`si-action-outcome ${h.phase}`,role:h.phase==="failed"?"alert":"status",children:h.message})]})})}function QC({s:t,sessions:e=[],active:i=!0,footerState:r="live",onRestore:s,actionOutcome:n,specs:o=[],boardCommands:a=[]}){var jn,ye;const l=Ie(),u=J5(),[c,h]=k.useState(null),[d,f]=k.useState(null),[p,v]=k.useState(""),[_,w]=k.useState(!1),[x,C]=k.useState(!1),[D,R]=k.useState(null),[E,L]=k.useState(null),[q,F]=k.useState(null),[$,W]=k.useState(()=>new Set),[z,j]=k.useState(()=>new Map),[A,O]=k.useState(null),[T,U]=k.useState(()=>Date.now()),H=k.useRef(null),re=k.useRef(null),G=k.useRef(null),X=k.useRef(null),oe=k.useRef(null),I=k.useRef(null),Y=k.useRef(new Map),le=k.useRef(new Map),te=J=>{let Q=le.current.get(J);return Q||(Q={load:Ee=>{const Me=`${J}:${Ee}`;let We=Y.current.get(Me);return We||(We=F5(t.id,J,Ee),Y.current.set(Me,We)),We}},le.current.set(J,Q)),Q},[de,ke]=k.useState(()=>Date.now()),Ye=k.useRef(0),Ct=k.useRef(new Set),At=k.useRef(new Map),st=k.useRef(new Map),Be=k.useRef(!0),vt=k.useCallback(()=>N5(t.id).then(J=>{Number.isFinite(J==null?void 0:J.serverNow)&&(Ye.current=J.serverNow-Date.now());const Q=Date.now()+Ye.current;U(Q),ke(Q),J&&h(Ee=>qC(Ee,J.events)?Ee:J.events)}),[t.id]),vr=i&&r==="live"&&t.status==="working";k.useEffect(()=>{if(!vr)return;const J=()=>{document.visibilityState!=="hidden"&&U(Date.now()+Ye.current)};J();const Q=setInterval(J,1e3);return()=>clearInterval(Q)},[vr]),k.useEffect(()=>{h(null),f(null),F(null),L(null),W(new Set),j(new Map),Ct.current.clear(),At.current.clear(),st.current.clear(),Y.current.clear(),le.current.clear(),O(null),br.current=null,qt.current=!1,Si(!1),U(Date.now()),ke(Date.now()),Be.current=!0},[t.id]),k.useEffect(()=>{i&&(vt(),L5(t.id).then(J=>{J&&f(J)}))},[t.id,vt,i]),k.useEffect(()=>{if(!i||u||document.visibilityState==="hidden")return;const J=requestAnimationFrame(()=>{const Q=G.current;i&&!u&&document.visibilityState!=="hidden"&&(Q==null?void 0:Q.offsetParent)!==null&&getComputedStyle(Q).visibility!=="hidden"&&document.activeElement!==Q&&Q.focus()});return()=>cancelAnimationFrame(J)},[t.id,i,u]),k.useEffect(()=>{if(!i||r==="archived")return;const J=setInterval(vt,8e3);return()=>clearInterval(J)},[vt,i,r]),k.useEffect(()=>{i&&r!=="archived"&&vt()},[t.status,t.note,vt,i,r]);const ht=k.useMemo(()=>mC(c||[],de),[c,de]),Yr=ht.length&&ht[ht.length-1].kind==="seam"&&ht[ht.length-1].open?ht[ht.length-1]:null,Pt=i&&r==="live"&&Yr?Yr.from:null,br=k.useRef(null);k.useEffect(()=>{if(Pt!==null)return br.current!==Pt&&(br.current=Pt,O(null)),O5(t.id,Pt,O)},[t.id,Pt]);const qt=k.useRef(!1),[Ni,Si]=k.useState(!1),Wt=!qt.current&&c!==null&&Pt!==null&&A===null&&!Ni;k.useEffect(()=>{if(!Wt)return;const J=setTimeout(()=>Si(!0),600);return()=>clearTimeout(J)},[Wt]),c!==null&&!Wt&&(qt.current=!0);const Gi=k.useMemo(()=>{for(let J=ht.length-1;J>=0;J--)if(ht[J].kind==="say"&&ht[J].text)return ht[J].text;return null},[ht]),Yi=k.useCallback(async(J,Q)=>{const Ee=_g(t.id,J.from,J.to);At.current.set(Q,Ee);const Me=Ac.get(Ee);if(Me){j(Oe=>new Map(Oe).set(Q,{...Me,transcriptKey:Ee}));return}if(Ct.current.has(Ee))return;Ct.current.add(Ee),j(Oe=>{var Oi;return((Oi=Oe.get(Q))==null?void 0:Oi.state)==="ready"?Oe:new Map(Oe).set(Q,{state:"loading",transcriptKey:Ee})});const We=await P5(t.id,J.from,J.to);Ct.current.delete(Ee);const nt=We.ok?{state:"ready",data:We.data,transcriptKey:Ee}:{state:"error",error:We.error,transcriptKey:Ee},He=st.current.get(Q);He&&He!==Ee&&Ac.delete(He),Ac.set(Ee,nt),st.current.set(Q,Ee),j(Oe=>{if(At.current.get(Q)!==Ee)return Oe;const Oi=Oe.get(Q);return!We.ok&&(Oi==null?void 0:Oi.state)==="ready"?new Map(Oe).set(Q,{...Oi,transcriptKey:Ee}):new Map(Oe).set(Q,nt)})},[t.id]);k.useEffect(()=>{if(!(!i||!c))for(const J of ht){if(J.kind!=="seam"||J.open&&J.from===Pt)continue;const Q=Ec(t.id,J.from);if(!$.has(Q))continue;const Ee=_g(t.id,J.from,J.to),Me=z.get(Q);(Me==null?void 0:Me.transcriptKey)===Ee||Ct.current.has(Ee)||Yi(J,Q)}},[i,c,ht,$,Yi,t.id,z,Pt]);const ce=k.useCallback(()=>{const J=H.current;J&&Be.current&&(J.scrollTop=J.scrollHeight)},[]),Ae=()=>{const J=H.current;J&&(Be.current=J.scrollHeight-J.scrollTop-J.clientHeight<48)};k.useLayoutEffect(ce,[c,ce]),k.useLayoutEffect(()=>{if(!i||typeof ResizeObserver!="function")return;const J=re.current;if(!J)return;const Q=new ResizeObserver(ce);return Q.observe(J),()=>Q.disconnect()},[i,ce]);const Re=()=>{oe.current=null,VC(),GC(H.current),F(null)},$e=k.useCallback(async J=>{clearTimeout(I.current),F(null);const Q=await XC(J);return F(Q?"copied":"failed"),Q&&(I.current=setTimeout(()=>F(null),1200)),Q},[]);k.useEffect(()=>()=>clearTimeout(I.current),[]);const In=J=>{const Q=H.current,Ee=J.target;if(J.button!==0||!Q||!(Ee instanceof Element)||!UC())return;const Me=Ee.closest(WC);if(Me&&Q.contains(Me))return;if(Ee===Q){const He=Q.getBoundingClientRect();if(J.clientX-He.left-Q.clientLeft>=Q.clientWidth||J.clientY-He.top-Q.clientTop>=Q.clientHeight)return}Re(),J.preventDefault();const We=J.detail===2?Ar.WORD:J.detail>=3?Ar.LINE:Ar.NORMAL,nt=We===Ar.WORD?wg(Q,J.clientX,J.clientY):We===Ar.LINE?xg(Q,J.clientX,J.clientY):Lu(Q,J.clientX,J.clientY);nt&&(X.current={mode:We,anchor:nt.cloneRange(),x:J.clientX,y:J.clientY},We!==Ar.NORMAL&&(oe.current=nt,yg(nt)))};k.useEffect(()=>{if(!i)return;const J=Me=>{const We=X.current,nt=H.current;if(!We||!nt||(Me.preventDefault(),We.mode===Ar.NORMAL&&Math.hypot(Me.clientX-We.x,Me.clientY-We.y)<3))return;const He=We.mode===Ar.WORD?wg(nt,Me.clientX,Me.clientY):We.mode===Ar.LINE?xg(nt,Me.clientX,Me.clientY):Lu(nt,Me.clientX,Me.clientY);if(!He||!We.anchor.startContainer.isConnected)return;const Oe=JC(We.anchor,He,We.mode);oe.current=Oe,yg(Oe)},Q=()=>{X.current=null},Ee=Me=>{const We=oe.current,nt=G.current;if(!We||We.collapsed||!nt)return;const He=Me.ctrlKey||Me.metaKey,Oe=Me.key.toLowerCase();if(Me.key==="Escape"){Re();return}if(He&&Oe==="c"){if(document.activeElement!==nt||nt.selectionStart!==nt.selectionEnd)return;Me.preventDefault(),Me.stopPropagation(),$e(Vk(We,H.current));return}if(document.activeElement!==nt)return;const Oi=Me.key.length===1&&!He&&!Me.altKey,en=He&&!Me.altKey&&["a","v","x","y","z"].includes(Oe),Hn=Me.isComposing||Me.key==="Process"||Me.key==="Dead";(Oi||en||Hn||KC.has(Me.key))&&Re()};return document.addEventListener("mousemove",J,!0),document.addEventListener("mouseup",Q,!0),document.addEventListener("keydown",Ee,!0),()=>{X.current=null,Re(),document.removeEventListener("mousemove",J,!0),document.removeEventListener("mouseup",Q,!0),document.removeEventListener("keydown",Ee,!0)}},[i,$e]);const _r=()=>Re(),il=async J=>{var Ee,Me;if(!J||_)return;w(!0),R(null);const Q=await l4(t.id,J,{replyVia:"note"});w(!1),Q.ok?(v(""),L(((Ee=Q.outcome)==null?void 0:Ee.mentionSummary)||null),vt()):R(((Me=Q.outcome)==null?void 0:Me.error)||l("mobile.sendFailed"))},Js=async()=>{if(x)return;C(!0),R(null);const J=await I5(t.id);C(!1),J.ok?vt():R(J.error||l("mobile.stopFailed"))},rl=J=>{if(!J)return l("mobile.you");const Q=e.find(Ee=>Ee.id===J);return Q?Hr(Q):J.slice(0,8)},Zs=J=>{const Q=Ec(t.id,J.from),Ee=new Set($);if(Ee.has(Q)){Ee.delete(Q),W(Ee);return}Ee.add(Q),W(Ee),J.open&&J.from===Pt||Yi(J,Q)},Xi=[];let Li=null;const zn=(J,Q)=>{bg(J)!==Li&&(Li=bg(J),Xi.push(m.jsxs("div",{className:"m-day",children:[m.jsx("div",{className:"m-gut",children:$C(J)}),m.jsx("div",{className:"m-day-rule"})]},`d${Q}`)))},Ft=J=>m.jsx("div",{className:"m-gut",children:m.jsx("time",{children:fu(J)})}),Qs=t.created||(d==null?void 0:d.created)||((jn=c==null?void 0:c[0])==null?void 0:jn.ts);d!=null&&d.prompt&&(Qs&&zn(Qs,"p"),Xi.push(m.jsxs("div",{className:"m-ev m-ev-prompt",children:[m.jsx(ag,{ts:Qs,text:d.prompt}),Qs?Ft(Qs):m.jsx("div",{className:"m-gut"})]},"prompt")));for(const[J,Q]of ht.entries())if(zn(Q.ts,J),Q.kind==="quote")Xi.push(m.jsxs("div",{className:"m-ev m-ev-sent",children:[m.jsx(ag,{who:Q.from?((ye=Q.envelope)==null?void 0:ye.label)||rl(Q.from):null,ts:Q.ts,text:Q.text}),Ft(Q.ts)]},J));else if(Q.kind==="say")Xi.push(m.jsxs("div",{className:"m-ev m-ev-say",children:[m.jsx("div",{className:"m-gut"}),m.jsxs("article",{className:"m-say",children:[m.jsxs("div",{className:"m-say-head",children:[m.jsx("time",{className:"m-line-time",children:fu(Q.ts)}),m.jsxs("span",{className:"m-say-chip",style:{color:lr[Q.status]},children:[m.jsx("span",{className:"m-ev-glyph",children:Au[Q.status]||"·"}),m.jsx("span",{className:"m-ev-word",children:l(`status.${Q.status}`)})]}),Q.text&&!x0()&&m.jsx("button",{type:"button",className:"m-copy-note",onClick:()=>$e(Q.text),children:l("mobile.copy")})]}),Q.text&&m.jsx("div",{className:"m-ev-note",children:m.jsx(Ru,{children:Q.text})})]})]},J));else if(Q.kind==="event")Xi.push(m.jsxs("div",{className:"m-ev m-ev-line",children:[m.jsx("div",{className:"m-gut"}),m.jsxs("div",{className:"m-line",children:[m.jsx("time",{className:"m-line-time",children:fu(Q.ts)}),m.jsx("span",{className:"m-ev-glyph",style:{color:lr[Q.status]},children:Au[Q.status]||"·"}),m.jsx("span",{className:"m-ev-word",style:{color:lr[Q.status]},children:l(`status.${Q.status}`)}),Q.text&&m.jsx("div",{className:"m-line-text m-ev-note",children:m.jsx(Ru,{children:Q.text})})]})]},J));else{const Ee=Ec(t.id,Q.from),Me=$.has(Ee),We=Q.open&&r==="live",nt=Q.open&&Q.from===Pt,He=nt?A===null?{state:"loading"}:A.error?{state:"error",error:A.error}:{state:"ready",data:A}:z.get(Ee),Oe=We?`${l("status.working")} · ${Yp(Math.max(0,T-Q.from))}`:Q.open?l("status.working"):`${l("mobile.worked")} ${Yp(Q.to-Q.from)}`,Oi=(He==null?void 0:He.state)==="ready"?He.data.turns.reduce((en,Hn)=>{var No;return en+(((No=Hn.tools)==null?void 0:No.length)||0)},0):0;Xi.push(m.jsxs("div",{className:"m-ev m-ev-seam",children:[m.jsx("div",{className:"m-gut"}),m.jsxs("div",{className:"m-seam",children:[m.jsxs("button",{type:"button",className:`m-seam-row${We?" is-live":""}`,"aria-expanded":Me,onClick:()=>Zs(Q),children:[m.jsx("span",{className:"m-seam-lead",children:Oe}),(He==null?void 0:He.state)==="ready"&&m.jsxs("span",{className:"m-seam-detail",children:[He.data.turns.length," turns · ",Oi," tool uses"]}),m.jsx(qa,{open:Me,className:"m-seam-caret"})]}),m.jsxs(O3.Provider,{value:te(Q.from),children:[Me&&m.jsxs("div",{className:"m-seam-inset",children:[(He==null?void 0:He.state)==="loading"&&m.jsx("div",{className:"m-transcript-state",children:"transcript 加载中…"}),(He==null?void 0:He.state)==="error"&&m.jsxs("div",{className:"m-transcript-state is-error",children:["transcript 已不可用:",He.error]}),(He==null?void 0:He.state)==="ready"&&m.jsx(uC,{data:He.data,live:nt})]}),nt&&!Me&&m.jsx(dC,{data:A,lastSaid:Gi},Ee)]})]})]},J))}return m.jsxs("div",{className:"tl-chat",children:[m.jsx("div",{className:"m-timeline","data-selectable":!0,ref:H,onScroll:Ae,onMouseDown:In,children:m.jsx("div",{className:"m-col",ref:re,children:c===null||Wt?m.jsx("div",{className:"m-empty",children:l("common.loading")}):Xi.length===0?m.jsx("div",{className:"m-empty",children:l("mobile.noEvents")}):Xi})}),q&&m.jsx("div",{className:`m-copy-status ${q}`,role:"status","aria-live":"polite","aria-atomic":"true",children:l(`mobile.${q==="copied"?"copied":"copyFailed"}`)}),m.jsx(ZC,{session:t,state:r,active:i,inputRef:G,draft:p,setDraft:v,sending:_,send:il,sendErr:D,sendNote:E,onRestore:s,actionOutcome:n,onComposerPress:_r,working:t.status==="working",stopping:x,stop:Js,specs:o,sessions:e,boardCommands:a})]})}let vd=[],Y3=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,i=0;e<t.length;e++)(e%2?Y3:vd).push(i=i+t[e])})();function eA(t){if(t<768)return!1;for(let e=0,i=vd.length;;){let r=e+i>>1;if(t<vd[r])i=r;else if(t>=Y3[r])e=r+1;else return!0;if(e==i)return!1}}function Sg(t){return t>=127462&&t<=127487}const kg=8205;function tA(t,e,i=!0,r=!0){return(i?X3:iA)(t,e,r)}function X3(t,e,i){if(e==t.length)return e;e&&J3(t.charCodeAt(e))&&Z3(t.charCodeAt(e-1))&&e--;let r=Dc(t,e);for(e+=Cg(r);e<t.length;){let s=Dc(t,e);if(r==kg||s==kg||i&&eA(s))e+=Cg(s),r=s;else if(Sg(s)){let n=0,o=e-2;for(;o>=0&&Sg(Dc(t,o));)n++,o-=2;if(n%2==0)break;e+=2}else break}return e}function iA(t,e,i){for(;e>1;){let r=X3(t,e-2,i);if(r<e)return r;e--}return 0}function Dc(t,e){let i=t.charCodeAt(e);if(!Z3(i)||e+1==t.length)return i;let r=t.charCodeAt(e+1);return J3(r)?(i-55296<<10)+(r-56320)+65536:i}function J3(t){return t>=56320&&t<57344}function Z3(t){return t>=55296&&t<56320}function Cg(t){return t<65536?1:2}let Ve=class Q3{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,i,r){[e,i]=bo(this,e,i);let s=[];return this.decompose(0,e,s,2),r.length&&r.decompose(0,r.length,s,3),this.decompose(i,this.length,s,1),Tr.from(s,this.length-(i-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,i=this.length){[e,i]=bo(this,e,i);let r=[];return this.decompose(e,i,r,0),Tr.from(r,i-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let i=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),s=new da(this),n=new da(e);for(let o=i,a=i;;){if(s.next(o),n.next(o),o=0,s.lineBreak!=n.lineBreak||s.done!=n.done||s.value!=n.value)return!1;if(a+=s.value.length,s.done||a>=r)return!0}}iter(e=1){return new da(this,e)}iterRange(e,i=this.length){return new eb(this,e,i)}iterLines(e,i){let r;if(e==null)r=this.iter();else{i==null&&(i=this.lines+1);let s=this.line(e).from;r=this.iterRange(s,Math.max(s,i==this.lines+1?this.length:i<=1?0:this.line(i-1).to))}return new tb(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Q3.empty:e.length<=32?new St(e):Tr.from(St.split(e,[]))}};class St extends Ve{constructor(e,i=rA(e)){super(),this.text=e,this.length=i}get lines(){return this.text.length}get children(){return null}lineInner(e,i,r,s){for(let n=0;;n++){let o=this.text[n],a=s+o.length;if((i?r:a)>=e)return new sA(s,a,r,o);s=a+1,r++}}decompose(e,i,r,s){let n=e<=0&&i>=this.length?this:new St(Ag(this.text,e,i),Math.min(i,this.length)-Math.max(0,e));if(s&1){let o=r.pop(),a=pu(n.text,o.text.slice(),0,n.length);if(a.length<=32)r.push(new St(a,o.length+n.length));else{let l=a.length>>1;r.push(new St(a.slice(0,l)),new St(a.slice(l)))}}else r.push(n)}replace(e,i,r){if(!(r instanceof St))return super.replace(e,i,r);[e,i]=bo(this,e,i);let s=pu(this.text,pu(r.text,Ag(this.text,0,e)),i),n=this.length+r.length-(i-e);return s.length<=32?new St(s,n):Tr.from(St.split(s,[]),n)}sliceString(e,i=this.length,r=`
316
+ `){[e,i]=bo(this,e,i);let s="";for(let n=0,o=0;n<=i&&o<this.text.length;o++){let a=this.text[o],l=n+a.length;n>e&&o&&(s+=r),e<l&&i>n&&(s+=a.slice(Math.max(0,e-n),i-n)),n=l+1}return s}flatten(e){for(let i of this.text)e.push(i)}scanIdentical(){return 0}static split(e,i){let r=[],s=-1;for(let n of e)r.push(n),s+=n.length+1,r.length==32&&(i.push(new St(r,s)),r=[],s=-1);return s>-1&&i.push(new St(r,s)),i}}class Tr extends Ve{constructor(e,i){super(),this.children=e,this.length=i,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,i,r,s){for(let n=0;;n++){let o=this.children[n],a=s+o.length,l=r+o.lines-1;if((i?l:a)>=e)return o.lineInner(e,i,r,s);s=a+1,r=l+1}}decompose(e,i,r,s){for(let n=0,o=0;o<=i&&n<this.children.length;n++){let a=this.children[n],l=o+a.length;if(e<=l&&i>=o){let u=s&((o<=e?1:0)|(l>=i?2:0));o>=e&&l<=i&&!u?r.push(a):a.decompose(e-o,i-o,r,u)}o=l+1}}replace(e,i,r){if([e,i]=bo(this,e,i),r.lines<this.lines)for(let s=0,n=0;s<this.children.length;s++){let o=this.children[s],a=n+o.length;if(e>=n&&i<=a){let l=o.replace(e-n,i-n,r),u=this.lines-o.lines+l.lines;if(l.lines<u>>4&&l.lines>u>>6){let c=this.children.slice();return c[s]=l,new Tr(c,this.length-(i-e)+r.length)}return super.replace(n,a,l)}n=a+1}return super.replace(e,i,r)}sliceString(e,i=this.length,r=`
317
+ `){[e,i]=bo(this,e,i);let s="";for(let n=0,o=0;n<this.children.length&&o<=i;n++){let a=this.children[n],l=o+a.length;o>e&&n&&(s+=r),e<l&&i>o&&(s+=a.sliceString(e-o,i-o,r)),o=l+1}return s}flatten(e){for(let i of this.children)i.flatten(e)}scanIdentical(e,i){if(!(e instanceof Tr))return 0;let r=0,[s,n,o,a]=i>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=i,n+=i){if(s==o||n==a)return r;let l=this.children[s],u=e.children[n];if(l!=u)return r+l.scanIdentical(u,i);r+=l.length+1}}static from(e,i=e.reduce((r,s)=>r+s.length+1,-1)){let r=0;for(let f of e)r+=f.lines;if(r<32){let f=[];for(let p of e)p.flatten(f);return new St(f,i)}let s=Math.max(32,r>>5),n=s<<1,o=s>>1,a=[],l=0,u=-1,c=[];function h(f){let p;if(f.lines>n&&f instanceof Tr)for(let v of f.children)h(v);else f.lines>o&&(l>o||!l)?(d(),a.push(f)):f instanceof St&&l&&(p=c[c.length-1])instanceof St&&f.lines+p.lines<=32?(l+=f.lines,u+=f.length+1,c[c.length-1]=new St(p.text.concat(f.text),p.length+1+f.length)):(l+f.lines>s&&d(),l+=f.lines,u+=f.length+1,c.push(f))}function d(){l!=0&&(a.push(c.length==1?c[0]:Tr.from(c,u)),u=-1,l=c.length=0)}for(let f of e)h(f);return d(),a.length==1?a[0]:new Tr(a,i)}}Ve.empty=new St([""],0);function rA(t){let e=-1;for(let i of t)e+=i.length+1;return e}function pu(t,e,i=0,r=1e9){for(let s=0,n=0,o=!0;n<t.length&&s<=r;n++){let a=t[n],l=s+a.length;l>=i&&(l>r&&(a=a.slice(0,r-s)),s<i&&(a=a.slice(i-s)),o?(e[e.length-1]+=a,o=!1):e.push(a)),s=l+1}return e}function Ag(t,e,i){return pu(t,[""],e,i)}class da{constructor(e,i=1){this.dir=i,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[i>0?1:(e instanceof St?e.text.length:e.children.length)<<1]}nextInner(e,i){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,s=this.nodes[r],n=this.offsets[r],o=n>>1,a=s instanceof St?s.text.length:s.children.length;if(o==(i>0?a:0)){if(r==0)return this.done=!0,this.value="",this;i>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((n&1)==(i>0?0:1)){if(this.offsets[r]+=i,e==0)return this.lineBreak=!0,this.value=`
318
+ `,this;e--}else if(s instanceof St){let l=s.text[o+(i<0?-1:0)];if(this.offsets[r]+=i,l.length>Math.max(0,e))return this.value=e==0?l:i>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=s.children[o+(i<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=i):(i<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(i>0?1:(l instanceof St?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class eb{constructor(e,i,r){this.value="",this.done=!1,this.cursor=new da(e,i>r?-1:1),this.pos=i>r?e.length:0,this.from=Math.min(i,r),this.to=Math.max(i,r)}nextInner(e,i){if(i<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,i<0?this.pos-this.to:this.from-this.pos);let r=i<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*i,this.value=s.length<=r?s:i<0?s.slice(s.length-r):s.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class tb{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:i,lineBreak:r,value:s}=this.inner.next(e);return i&&this.afterBreak?(this.value="",this.afterBreak=!1):i?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Ve.prototype[Symbol.iterator]=function(){return this.iter()},da.prototype[Symbol.iterator]=eb.prototype[Symbol.iterator]=tb.prototype[Symbol.iterator]=function(){return this});class sA{constructor(e,i,r,s){this.from=e,this.to=i,this.number=r,this.text=s}get length(){return this.to-this.from}}function bo(t,e,i){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,i))]}function Pr(t,e,i=!0,r=!0){return tA(t,e,i,r)}function nA(t){return t>=56320&&t<57344}function oA(t){return t>=55296&&t<56320}function aA(t,e){let i=t.charCodeAt(e);if(!oA(i)||e+1==t.length)return i;let r=t.charCodeAt(e+1);return nA(r)?(i-55296<<10)+(r-56320)+65536:i}function lA(t){return t<65536?1:2}const bd=/\r\n?|\n/;var ji=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(ji||(ji={}));class ns{constructor(e){this.sections=e}get length(){let e=0;for(let i=0;i<this.sections.length;i+=2)e+=this.sections[i];return e}get newLength(){let e=0;for(let i=0;i<this.sections.length;i+=2){let r=this.sections[i+1];e+=r<0?this.sections[i]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let i=0,r=0,s=0;i<this.sections.length;){let n=this.sections[i++],o=this.sections[i++];o<0?(e(r,s,n),s+=n):s+=o,r+=n}}iterChangedRanges(e,i=!1){_d(this,e,i)}get invertedDesc(){let e=[];for(let i=0;i<this.sections.length;){let r=this.sections[i++],s=this.sections[i++];s<0?e.push(r,s):e.push(s,r)}return new ns(e)}composeDesc(e){return this.empty?e:e.empty?this:ib(this,e)}mapDesc(e,i=!1){return e.empty?this:yd(this,e,i)}mapPos(e,i=-1,r=ji.Simple){let s=0,n=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],u=s+a;if(l<0){if(u>e)return n+(e-s);n+=a}else{if(r!=ji.Simple&&u>=e&&(r==ji.TrackDel&&s<e&&u>e||r==ji.TrackBefore&&s<e||r==ji.TrackAfter&&u>e))return null;if(u>e||u==e&&i<0&&!a)return e==s||i<0?n:n+l;n+=l}s=u}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return n}touchesRange(e,i=e){for(let r=0,s=0;r<this.sections.length&&s<=i;){let n=this.sections[r++],o=this.sections[r++],a=s+n;if(o>=0&&s<=i&&a>=e)return s<e&&a>i?"cover":!0;s=a}return!1}toString(){let e="";for(let i=0;i<this.sections.length;){let r=this.sections[i++],s=this.sections[i++];e+=(e?" ":"")+r+(s>=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(i=>typeof i!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new ns(e)}static create(e){return new ns(e)}}class Mt extends ns{constructor(e,i){super(e),this.inserted=i}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return _d(this,(i,r,s,n,o)=>e=e.replace(s,s+(r-i),o),!1),e}mapDesc(e,i=!1){return yd(this,e,i,!0)}invert(e){let i=this.sections.slice(),r=[];for(let s=0,n=0;s<i.length;s+=2){let o=i[s],a=i[s+1];if(a>=0){i[s]=a,i[s+1]=o;let l=s>>1;for(;r.length<l;)r.push(Ve.empty);r.push(o?e.slice(n,n+o):Ve.empty)}n+=o}return new Mt(i,r)}compose(e){return this.empty?e:e.empty?this:ib(this,e,!0)}map(e,i=!1){return e.empty?this:yd(this,e,i,!0)}iterChanges(e,i=!1){_d(this,e,i)}get desc(){return ns.create(this.sections)}filter(e){let i=[],r=[],s=[],n=new Na(this);e:for(let o=0,a=0;;){let l=o==e.length?1e9:e[o++];for(;a<l||a==l&&n.len==0;){if(n.done)break e;let c=Math.min(n.len,l-a);li(s,c,-1);let h=n.ins==-1?-1:n.off==0?n.ins:0;li(i,c,h),h>0&&Is(r,i,n.text),n.forward(c),a+=c}let u=e[o++];for(;a<u;){if(n.done)break e;let c=Math.min(n.len,u-a);li(i,c,-1),li(s,c,n.ins==-1?-1:n.off==0?n.ins:0),n.forward(c),a+=c}}return{changes:new Mt(i,r),filtered:ns.create(s)}}toJSON(){let e=[];for(let i=0;i<this.sections.length;i+=2){let r=this.sections[i],s=this.sections[i+1];s<0?e.push(r):s==0?e.push([r]):e.push([r].concat(this.inserted[i>>1].toJSON()))}return e}static of(e,i,r){let s=[],n=[],o=0,a=null;function l(c=!1){if(!c&&!s.length)return;o<i&&li(s,i-o,-1);let h=new Mt(s,n);a=a?a.compose(h.map(a)):h,s=[],n=[],o=0}function u(c){if(Array.isArray(c))for(let h of c)u(h);else if(c instanceof Mt){if(c.length!=i)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${i})`);l(),a=a?a.compose(c.map(a)):c}else{let{from:h,to:d=h,insert:f}=c;if(h>d||h<0||d>i)throw new RangeError(`Invalid change range ${h} to ${d} (in doc of length ${i})`);let p=f?typeof f=="string"?Ve.of(f.split(r||bd)):f:Ve.empty,v=p.length;if(h==d&&v==0)return;h<o&&l(),h>o&&li(s,h-o,-1),li(s,d-h,v),Is(n,s,p),o=d}}return u(e),l(!a),a}static empty(e){return new Mt(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let i=[],r=[];for(let s=0;s<e.length;s++){let n=e[s];if(typeof n=="number")i.push(n,-1);else{if(!Array.isArray(n)||typeof n[0]!="number"||n.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(n.length==1)i.push(n[0],0);else{for(;r.length<s;)r.push(Ve.empty);r[s]=Ve.of(n.slice(1)),i.push(n[0],r[s].length)}}}return new Mt(i,r)}static createSet(e,i){return new Mt(e,i)}}function li(t,e,i,r=!1){if(e==0&&i<=0)return;let s=t.length-2;s>=0&&i<=0&&i==t[s+1]?t[s]+=e:s>=0&&e==0&&t[s]==0?t[s+1]+=i:r?(t[s]+=e,t[s+1]+=i):t.push(e,i)}function Is(t,e,i){if(i.length==0)return;let r=e.length-2>>1;if(r<t.length)t[t.length-1]=t[t.length-1].append(i);else{for(;t.length<r;)t.push(Ve.empty);t.push(i)}}function _d(t,e,i){let r=t.inserted;for(let s=0,n=0,o=0;o<t.sections.length;){let a=t.sections[o++],l=t.sections[o++];if(l<0)s+=a,n+=a;else{let u=s,c=n,h=Ve.empty;for(;u+=a,c+=l,l&&r&&(h=h.append(r[o-2>>1])),!(i||o==t.sections.length||t.sections[o+1]<0);)a=t.sections[o++],l=t.sections[o++];e(s,u,n,c,h),s=u,n=c}}}function yd(t,e,i,r=!1){let s=[],n=r?[]:null,o=new Na(t),a=new Na(e);for(let l=-1;;){if(o.done&&a.len||a.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&a.ins==-1){let u=Math.min(o.len,a.len);li(s,u,-1),o.forward(u),a.forward(u)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!i))){let u=a.len;for(li(s,a.ins,-1);u;){let c=Math.min(o.len,u);o.ins>=0&&l<o.i&&o.len<=c&&(li(s,0,o.ins),n&&Is(n,s,o.text),l=o.i),o.forward(c),u-=c}a.next()}else if(o.ins>=0){let u=0,c=o.len;for(;c;)if(a.ins==-1){let h=Math.min(c,a.len);u+=h,c-=h,a.forward(h)}else if(a.ins==0&&a.len<c)c-=a.len,a.next();else break;li(s,u,l<o.i?o.ins:0),n&&l<o.i&&Is(n,s,o.text),l=o.i,o.forward(o.len-c)}else{if(o.done&&a.done)return n?Mt.createSet(s,n):ns.create(s);throw new Error("Mismatched change set lengths")}}}function ib(t,e,i=!1){let r=[],s=i?[]:null,n=new Na(t),o=new Na(e);for(let a=!1;;){if(n.done&&o.done)return s?Mt.createSet(r,s):ns.create(r);if(n.ins==0)li(r,n.len,0,a),n.next();else if(o.len==0&&!o.done)li(r,0,o.ins,a),s&&Is(s,r,o.text),o.next();else{if(n.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(n.len2,o.len),u=r.length;if(n.ins==-1){let c=o.ins==-1?-1:o.off?0:o.ins;li(r,l,c,a),s&&c&&Is(s,r,o.text)}else o.ins==-1?(li(r,n.off?0:n.len,l,a),s&&Is(s,r,n.textBit(l))):(li(r,n.off?0:n.len,o.off?0:o.ins,a),s&&!o.off&&Is(s,r,o.text));a=(n.ins>l||o.ins>=0&&o.len>l)&&(a||r.length>u),n.forward2(l),o.forward(l)}}}}class Na{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,i=this.i-2>>1;return i>=e.length?Ve.empty:e[i]}textBit(e){let{inserted:i}=this.set,r=this.i-2>>1;return r>=i.length&&!e?Ve.empty:i[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Rs{constructor(e,i,r,s){this.from=e,this.to=i,this.flags=r,this.goalColumn=s}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,i=-1){let r,s;return this.empty?r=s=e.mapPos(this.from,i):(r=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),r==this.from&&s==this.to?this:new Rs(r,s,this.flags,this.goalColumn)}extend(e,i=e,r=0){if(e<=this.anchor&&i>=this.anchor)return ve.range(e,i,void 0,void 0,r);let s=Math.abs(e-this.anchor)>Math.abs(i-this.anchor)?e:i;return ve.range(this.anchor,s,void 0,void 0,r)}eq(e,i=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!i||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return ve.range(e.anchor,e.head)}static create(e,i,r,s){return new Rs(e,i,r,s)}}class ve{constructor(e,i){this.ranges=e,this.mainIndex=i}map(e,i=-1){return e.empty?this:ve.create(this.ranges.map(r=>r.map(e,i)),this.mainIndex)}eq(e,i=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],i))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new ve([this.main],0)}addRange(e,i=!0){return ve.create([e].concat(this.ranges),i?0:this.mainIndex+1)}replaceRange(e,i=this.mainIndex){let r=this.ranges.slice();return r[i]=e,ve.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new ve(e.ranges.map(i=>Rs.fromJSON(i)),e.main)}static single(e,i=e){return new ve([ve.range(e,i)],0)}static create(e,i=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,s=0;s<e.length;s++){let n=e[s];if(n.empty?n.from<=r:n.from<r)return ve.normalized(e.slice(),i);r=n.to}return new ve(e,i)}static cursor(e,i=0,r,s){return Rs.create(e,e,(i==0?0:i<0?8:16)|(r==null?7:Math.min(6,r)),s)}static range(e,i,r,s,n){let o=s==null?7:Math.min(6,s);return!n&&e!=i&&(n=i<e?1:-1),n&&(o|=n<0?8:16),i<e?Rs.create(i,e,o|32,r):Rs.create(e,i,o,r)}static undirectionalRange(e,i){return Rs.create(e,i,64,void 0)}static normalized(e,i=0){let r=e[i];e.sort((s,n)=>s.from-n.from),i=e.indexOf(r);for(let s=1;s<e.length;s++){let n=e[s],o=e[s-1];if(n.empty?n.from<=o.to:n.from<o.to){let a=o.from,l=Math.max(n.to,o.to);s<=i&&i--,e.splice(--s,2,n.anchor>n.head?ve.range(l,a):ve.range(a,l))}}return new ve(e,i)}}function rb(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let r1=0;class we{constructor(e,i,r,s,n){this.combine=e,this.compareInput=i,this.compare=r,this.isStatic=s,this.id=r1++,this.default=e([]),this.extensions=typeof n=="function"?n(this):n}get reader(){return this}static define(e={}){return new we(e.combine||(i=>i),e.compareInput||((i,r)=>i===r),e.compare||(e.combine?(i,r)=>i===r:s1),!!e.static,e.enables)}of(e){return new mu([],this,0,e)}compute(e,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new mu(e,this,1,i)}computeN(e,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new mu(e,this,2,i)}from(e,i){return i||(i=r=>r),this.compute([e],r=>i(r.field(e)))}}function s1(t,e){return t==e||t.length==e.length&&t.every((i,r)=>i===e[r])}class mu{constructor(e,i,r,s){this.dependencies=e,this.facet=i,this.type=r,this.value=s,this.id=r1++}dynamicSlot(e){var i;let r=this.value,s=this.facet.compareInput,n=this.id,o=e[n]>>1,a=this.type==2,l=!1,u=!1,c=[];for(let h of this.dependencies)h=="doc"?l=!0:h=="selection"?u=!0:((i=e[h.id])!==null&&i!==void 0?i:1)&1||c.push(e[h.id]);return{create(h){return h.values[o]=r(h),1},update(h,d){if(l&&d.docChanged||u&&(d.docChanged||d.selection)||wd(h,c)){let f=r(h);if(a?!Eg(f,h.values[o],s):!s(f,h.values[o]))return h.values[o]=f,1}return 0},reconfigure:(h,d)=>{let f,p=d.config.address[n];if(p!=null){let v=Pu(d,p);if(this.dependencies.every(_=>_ instanceof we?d.facet(_)===h.facet(_):_ instanceof or?d.field(_,!1)==h.field(_,!1):!0)||(a?Eg(f=r(h),v,s):s(f=r(h),v)))return h.values[o]=v,0}else f=r(h);return h.values[o]=f,1}}}get extension(){return this}}function Eg(t,e,i){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!i(t[r],e[r]))return!1;return!0}function wd(t,e){let i=!1;for(let r of e)fa(t,r)&1&&(i=!0);return i}function uA(t,e,i){let r=i.map(l=>t[l.id]),s=i.map(l=>l.type),n=r.filter(l=>!(l&1)),o=t[e.id]>>1;function a(l){let u=[];for(let c=0;c<r.length;c++){let h=Pu(l,r[c]);if(s[c]==2)for(let d of h)u.push(d);else u.push(h)}return e.combine(u)}return{create(l){for(let u of r)fa(l,u);return l.values[o]=a(l),1},update(l,u){if(!wd(l,n))return 0;let c=a(l);return e.compare(c,l.values[o])?0:(l.values[o]=c,1)},reconfigure(l,u){let c=wd(l,r),h=u.config.facets[e.id],d=u.facet(e);if(h&&!c&&s1(i,h))return l.values[o]=d,0;let f=a(l);return e.compare(f,d)?(l.values[o]=d,0):(l.values[o]=f,1)}}}const Rl=we.define({static:!0});class or{constructor(e,i,r,s,n){this.id=e,this.createF=i,this.updateF=r,this.compareF=s,this.spec=n,this.provides=void 0}static define(e){let i=new or(r1++,e.create,e.update,e.compare||((r,s)=>r===s),e);return e.provide&&(i.provides=e.provide(i)),i}create(e){let i=e.facet(Rl).find(r=>r.field==this);return((i==null?void 0:i.create)||this.createF)(e)}slot(e){let i=e[this.id]>>1;return{create:r=>(r.values[i]=this.create(r),1),update:(r,s)=>{let n=r.values[i],o=this.updateF(n,s);return this.compareF(n,o)?0:(r.values[i]=o,1)},reconfigure:(r,s)=>{let n=r.facet(Rl),o=s.facet(Rl),a;return(a=n.find(l=>l.field==this))&&a!=o.find(l=>l.field==this)?(r.values[i]=a.create(r),1):s.config.address[this.id]!=null?(r.values[i]=s.field(this),0):(r.values[i]=this.create(r),1)}}}init(e){return[this,Rl.of({field:this,create:e})]}get extension(){return this}}const mn={lowest:4,low:3,default:2,high:1,highest:0};function qo(t){return e=>new sb(e,t)}const Pn={highest:qo(mn.highest),high:qo(mn.high),default:qo(mn.default),low:qo(mn.low),lowest:qo(mn.lowest)};class sb{constructor(e,i){this.inner=e,this.prec=i}get extension(){return this}}class Bo{of(e){return new xd(this,e)}reconfigure(e){return Bo.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class xd{constructor(e,i){this.compartment=e,this.inner=i}get extension(){return this}}class Ou{constructor(e,i,r,s,n,o){for(this.base=e,this.compartments=i,this.dynamicSlots=r,this.address=s,this.staticValues=n,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let i=this.address[e.id];return i==null?e.default:this.staticValues[i>>1]}static resolve(e,i,r){let s=[],n=Object.create(null),o=new Map;for(let d of cA(e,i,o))d instanceof or?s.push(d):(n[d.facet.id]||(n[d.facet.id]=[])).push(d);let a=Object.create(null),l=[],u=[];for(let d of s)a[d.id]=u.length<<1,u.push(f=>d.slot(f));let c=r==null?void 0:r.config.facets;for(let d in n){let f=n[d],p=f[0].facet,v=c&&c[d]||[];if(f.every(_=>_.type==0))if(a[p.id]=l.length<<1|1,s1(v,f))l.push(r.facet(p));else{let _=p.combine(f.map(w=>w.value));l.push(r&&p.compare(_,r.facet(p))?r.facet(p):_)}else{for(let _ of f)_.type==0?(a[_.id]=l.length<<1|1,l.push(_.value)):(a[_.id]=u.length<<1,u.push(w=>_.dynamicSlot(w)));a[p.id]=u.length<<1,u.push(_=>uA(_,p,f))}}let h=u.map(d=>d(a));return new Ou(e,o,h,a,l,n)}}function cA(t,e,i){let r=[[],[],[],[],[]],s=new Map;function n(o,a){let l=s.get(o);if(l!=null){if(l<=a)return;let u=r[l].indexOf(o);u>-1&&r[l].splice(u,1),o instanceof xd&&i.delete(o.compartment)}if(s.set(o,a),Array.isArray(o))for(let u of o)n(u,a);else if(o instanceof xd){if(i.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let u=e.get(o.compartment)||o.inner;i.set(o.compartment,u),n(u,a)}else if(o instanceof sb)n(o.inner,o.prec);else if(o instanceof or)r[a].push(o),o.provides&&n(o.provides,a);else if(o instanceof mu)r[a].push(o),o.facet.extensions&&n(o.facet.extensions,mn.default);else{let u=o.extension;if(!u)throw new Error(`Unrecognized extension value in extension set (${o}).`);if(u==o)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);n(u,a)}}return n(t,mn.default),r.reduce((o,a)=>o.concat(a))}function fa(t,e){if(e&1)return 2;let i=e>>1,r=t.status[i];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[i]=4;let s=t.computeSlot(t,t.config.dynamicSlots[i]);return t.status[i]=2|s}function Pu(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const nb=we.define(),Sd=we.define({combine:t=>t.some(e=>e),static:!0}),ob=we.define({combine:t=>t.length?t[0]:void 0,static:!0}),ab=we.define(),lb=we.define(),ub=we.define(),cb=we.define({combine:t=>t.length?t[0]:!1});class Ro{constructor(e,i){this.type=e,this.value=i}static define(){return new hA}}class hA{of(e){return new Ro(this,e)}}class dA{constructor(e){this.map=e}of(e){return new at(this,e)}}class at{constructor(e,i){this.type=e,this.value=i}map(e){let i=this.type.map(this.value,e);return i===void 0?void 0:i==this.value?this:new at(this.type,i)}is(e){return this.type==e}static define(e={}){return new dA(e.map||(i=>i))}static mapEffects(e,i){if(!e.length)return e;let r=[];for(let s of e){let n=s.map(i);n&&r.push(n)}return r}}at.reconfigure=at.define();at.appendConfig=at.define();class ui{constructor(e,i,r,s,n,o){this.startState=e,this.changes=i,this.selection=r,this.effects=s,this.annotations=n,this.scrollIntoView=o,this._doc=null,this._state=null,r&&rb(r,i.newLength),n.some(a=>a.type==ui.time)||(this.annotations=n.concat(ui.time.of(Date.now())))}static create(e,i,r,s,n,o){return new ui(e,i,r,s,n,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let i of this.annotations)if(i.type==e)return i.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let i=this.annotation(ui.userEvent);return!!(i&&(i==e||i.length>e.length&&i.slice(0,e.length)==e&&i[e.length]=="."))}}ui.time=Ro.define();ui.userEvent=Ro.define();ui.addToHistory=Ro.define();ui.remote=Ro.define();function fA(t,e){let i=[];for(let r=0,s=0;;){let n,o;if(r<t.length&&(s==e.length||e[s]>=t[r]))n=t[r++],o=t[r++];else if(s<e.length)n=e[s++],o=e[s++];else return i;!i.length||i[i.length-1]<n?i.push(n,o):i[i.length-1]<o&&(i[i.length-1]=o)}}function hb(t,e,i){var r;let s,n,o;return i?(s=e.changes,n=Mt.empty(e.changes.length),o=t.changes.compose(e.changes)):(s=e.changes.map(t.changes),n=t.changes.mapDesc(e.changes,!0),o=t.changes.compose(s)),{changes:o,selection:e.selection?e.selection.map(n):(r=t.selection)===null||r===void 0?void 0:r.map(s),effects:at.mapEffects(t.effects,s).concat(at.mapEffects(e.effects,n)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function kd(t,e,i){let r=e.selection,s=so(e.annotations);return e.userEvent&&(s=s.concat(ui.userEvent.of(e.userEvent))),{changes:e.changes instanceof Mt?e.changes:Mt.of(e.changes||[],i,t.facet(ob)),selection:r&&(r instanceof ve?r:ve.single(r.anchor,r.head)),effects:so(e.effects),annotations:s,scrollIntoView:!!e.scrollIntoView}}function db(t,e,i){let r=kd(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(i=!1);for(let n=1;n<e.length;n++){e[n].filter===!1&&(i=!1);let o=!!e[n].sequential;r=hb(r,kd(t,e[n],o?r.changes.newLength:t.doc.length),o)}let s=ui.create(t,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return mA(i?pA(s):s)}function pA(t){let e=t.startState,i=!0;for(let s of e.facet(ab)){let n=s(t);if(n===!1){i=!1;break}Array.isArray(n)&&(i=i===!0?n:fA(i,n))}if(i!==!0){let s,n;if(i===!1)n=t.changes.invertedDesc,s=Mt.empty(e.doc.length);else{let o=t.changes.filter(i);s=o.changes,n=o.filtered.mapDesc(o.changes).invertedDesc}t=ui.create(e,s,t.selection&&t.selection.map(n),at.mapEffects(t.effects,n),t.annotations,t.scrollIntoView)}let r=e.facet(lb);for(let s=r.length-1;s>=0;s--){let n=r[s](t);n instanceof ui?t=n:Array.isArray(n)&&n.length==1&&n[0]instanceof ui?t=n[0]:t=db(e,so(n),!1)}return t}function mA(t){let e=t.startState,i=e.facet(ub),r=t;for(let s=i.length-1;s>=0;s--){let n=i[s](t);n&&Object.keys(n).length&&(r=hb(r,kd(e,n,t.changes.newLength),!0))}return r==t?t:ui.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const gA=[];function so(t){return t==null?gA:Array.isArray(t)?t:[t]}var rs=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(rs||(rs={}));const vA=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Cd;try{Cd=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function bA(t){if(Cd)return Cd.test(t);for(let e=0;e<t.length;e++){let i=t[e];if(/\w/.test(i)||i>"€"&&(i.toUpperCase()!=i.toLowerCase()||vA.test(i)))return!0}return!1}function _A(t){return e=>{if(!/\S/.test(e))return rs.Space;if(bA(e))return rs.Word;for(let i=0;i<t.length;i++)if(e.indexOf(t[i])>-1)return rs.Word;return rs.Other}}class Ke{constructor(e,i,r,s,n,o){this.config=e,this.doc=i,this.selection=r,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=n,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)fa(this,a<<1);this.computeSlot=null}field(e,i=!0){let r=this.config.address[e.id];if(r==null){if(i)throw new RangeError("Field is not present in this state");return}return fa(this,r),Pu(this,r)}update(...e){return db(this,e,!0)}applyTransaction(e){let i=this.config,{base:r,compartments:s}=i;for(let a of e.effects)a.is(Bo.reconfigure)?(i&&(s=new Map,i.compartments.forEach((l,u)=>s.set(u,l)),i=null),s.set(a.value.compartment,a.value.extension)):a.is(at.reconfigure)?(i=null,r=a.value):a.is(at.appendConfig)&&(i=null,r=so(r).concat(a.value));let n;i?n=e.startState.values.slice():(i=Ou.resolve(r,s,this),n=new Ke(i,this.doc,this.selection,i.dynamicSlots.map(()=>null),(l,u)=>u.reconfigure(l,this),null).values);let o=e.startState.facet(Sd)?e.newSelection:e.newSelection.asSingle();new Ke(i,e.newDoc,o,n,(a,l)=>l.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:e},range:ve.cursor(i.from+e.length)}))}changeByRange(e){let i=this.selection,r=e(i.ranges[0]),s=this.changes(r.changes),n=[r.range],o=so(r.effects);for(let a=1;a<i.ranges.length;a++){let l=e(i.ranges[a]),u=this.changes(l.changes),c=u.map(s);for(let d=0;d<a;d++)n[d]=n[d].map(c);let h=s.mapDesc(u,!0);n.push(l.range.map(h)),s=s.compose(c),o=at.mapEffects(o,c).concat(at.mapEffects(so(l.effects),h))}return{changes:s,selection:ve.create(n,i.mainIndex),effects:o}}changes(e=[]){return e instanceof Mt?e:Mt.of(e,this.doc.length,this.facet(Ke.lineSeparator))}toText(e){return Ve.of(e.split(this.facet(Ke.lineSeparator)||bd))}sliceDoc(e=0,i=this.doc.length){return this.doc.sliceString(e,i,this.lineBreak)}facet(e){let i=this.config.address[e.id];return i==null?e.default:(fa(this,i),Pu(this,i))}toJSON(e){let i={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let s=e[r];s instanceof or&&this.config.address[s.id]!=null&&(i[r]=s.spec.toJSON(this.field(e[r]),this))}return i}static fromJSON(e,i={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(r){for(let n in r)if(Object.prototype.hasOwnProperty.call(e,n)){let o=r[n],a=e[n];s.push(o.init(l=>o.spec.fromJSON(a,l)))}}return Ke.create({doc:e.doc,selection:ve.fromJSON(e.selection),extensions:i.extensions?s.concat([i.extensions]):s})}static create(e={}){let i=Ou.resolve(e.extensions||[],new Map),r=e.doc instanceof Ve?e.doc:Ve.of((e.doc||"").split(i.staticFacet(Ke.lineSeparator)||bd)),s=e.selection?e.selection instanceof ve?e.selection:ve.single(e.selection.anchor,e.selection.head):ve.single(0);return rb(s,r.length),i.staticFacet(Sd)||(s=s.asSingle()),new Ke(i,r,s,i.dynamicSlots.map(()=>null),(n,o)=>o.create(n),null)}get tabSize(){return this.facet(Ke.tabSize)}get lineBreak(){return this.facet(Ke.lineSeparator)||`
319
+ `}get readOnly(){return this.facet(cb)}phrase(e,...i){for(let r of this.facet(Ke.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return i.length&&(e=e.replace(/\$(\$|\d*)/g,(r,s)=>{if(s=="$")return"$";let n=+(s||1);return!n||n>i.length?r:i[n-1]})),e}languageDataAt(e,i,r=-1){let s=[];for(let n of this.facet(nb))for(let o of n(this,i,r))Object.prototype.hasOwnProperty.call(o,e)&&s.push(o[e]);return s}charCategorizer(e){let i=this.languageDataAt("wordChars",e);return _A(i.length?i[0]:"")}wordAt(e){let{text:i,from:r,length:s}=this.doc.lineAt(e),n=this.charCategorizer(e),o=e-r,a=e-r;for(;o>0;){let l=Pr(i,o,!1);if(n(i.slice(l,o))!=rs.Word)break;o=l}for(;a<s;){let l=Pr(i,a);if(n(i.slice(a,l))!=rs.Word)break;a=l}return o==a?null:ve.range(o+r,a+r)}}Ke.allowMultipleSelections=Sd;Ke.tabSize=we.define({combine:t=>t.length?t[0]:4});Ke.lineSeparator=ob;Ke.readOnly=cb;Ke.phrases=we.define({compare(t,e){let i=Object.keys(t),r=Object.keys(e);return i.length==r.length&&i.every(s=>t[s]==e[s])}});Ke.languageData=nb;Ke.changeFilter=ab;Ke.transactionFilter=lb;Ke.transactionExtender=ub;Bo.reconfigure=at.define();function yA(t,e,i={}){let r={};for(let s of t)for(let n of Object.keys(s)){let o=s[n],a=r[n];if(a===void 0)r[n]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(i,n))r[n]=i[n](a,o);else throw new Error("Config merge conflict for field "+n)}for(let s in e)r[s]===void 0&&(r[s]=e[s]);return r}class En{eq(e){return this==e}range(e,i=e){return Ad.create(e,i,this)}}En.prototype.startSide=En.prototype.endSide=0;En.prototype.point=!1;En.prototype.mapMode=ji.TrackDel;function n1(t,e){return t==e||t.constructor==e.constructor&&t.eq(e)}let Ad=class fb{constructor(e,i,r){this.from=e,this.to=i,this.value=r}static create(e,i,r){return new fb(e,i,r)}};function Ed(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}let wA=class pb{constructor(e,i,r,s){this.from=e,this.to=i,this.value=r,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,i,r,s=0){let n=r?this.to:this.from;for(let o=s,a=n.length;;){if(o==a)return o;let l=o+a>>1,u=n[l]-e||(r?this.value[l].endSide:this.value[l].startSide)-i;if(l==o)return u>=0?o:a;u>=0?a=l:o=l+1}}between(e,i,r,s){for(let n=this.findIndex(i,-1e9,!0),o=this.findIndex(r,1e9,!1,n);n<o;n++)if(s(this.from[n]+e,this.to[n]+e,this.value[n])===!1)return!1}map(e,i){let r=[],s=[],n=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let u=this.value[l],c=this.from[l]+e,h=this.to[l]+e,d,f;if(c==h){let p=i.mapPos(c,u.startSide,u.mapMode);if(p==null||(d=f=p,u.startSide!=u.endSide&&(f=i.mapPos(c,u.endSide),f<d)))continue}else if(d=i.mapPos(c,u.startSide),f=i.mapPos(h,u.endSide),d>f||d==f&&u.startSide>0&&u.endSide<=0)continue;(f-d||u.endSide-u.startSide)<0||(o<0&&(o=d),u.point&&(a=Math.max(a,f-d)),r.push(u),s.push(d-o),n.push(f-o))}return{mapped:r.length?new pb(s,n,r,a):null,pos:o}}};class je{constructor(e,i,r,s){this.chunkPos=e,this.chunk=i,this.nextLayer=r,this.maxPoint=s}static create(e,i,r,s){return new je(e,i,r,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let i of this.chunk)e+=i.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:i=[],sort:r=!1,filterFrom:s=0,filterTo:n=this.length}=e,o=e.filter;if(i.length==0&&!o)return this;if(r&&(i=i.slice().sort(Ed)),this.isEmpty)return i.length?je.of(i):this;let a=new mb(this,null,-1).goto(0),l=0,u=[],c=new fr;for(;a.value||l<i.length;)if(l<i.length&&(a.from-i[l].from||a.startSide-i[l].value.startSide)>=0){let h=i[l++];c.addInner(h.from,h.to,h.value)||u.push(h)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==i.length||this.chunkEnd(a.chunkIndex)<i[l].from)&&(!o||s>this.chunkEnd(a.chunkIndex)||n<this.chunkPos[a.chunkIndex])&&c.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||s>a.to||n<a.from||o(a.from,a.to,a.value))&&(c.addInner(a.from,a.to,a.value)||u.push(Ad.create(a.from,a.to,a.value))),a.next());return c.finishInner(this.nextLayer.isEmpty&&!u.length?je.empty:this.nextLayer.update({add:u,filter:o,filterFrom:s,filterTo:n}))}map(e){if(e.empty||this.isEmpty)return this;let i=[],r=[],s=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],u=e.touchesRange(a,a+l.length);if(u===!1)s=Math.max(s,l.maxPoint),i.push(l),r.push(e.mapPos(a));else if(u===!0){let{mapped:c,pos:h}=l.map(a,e);c&&(s=Math.max(s,c.maxPoint),i.push(c),r.push(h))}}let n=this.nextLayer.map(e);return i.length==0?n:new je(r,i,n||je.empty,s)}between(e,i,r){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let n=this.chunkPos[s],o=this.chunk[s];if(i>=n&&e<=n+o.length&&o.between(n,e-n,i-n,r)===!1)return}this.nextLayer.between(e,i,r)}}iter(e=0){return La.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,i=0){return La.from(e).goto(i)}static compare(e,i,r,s,n=-1){let o=e.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=n),a=i.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=n),l=Dg(o,a,r),u=new Wo(o,l,n),c=new Wo(a,l,n);r.iterGaps((h,d,f)=>Mg(u,h,c,d,f,s)),r.empty&&r.length==0&&Mg(u,0,c,0,0,s)}static eq(e,i,r=0,s){s==null&&(s=999999999);let n=e.filter(c=>!c.isEmpty&&i.indexOf(c)<0),o=i.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(n.length!=o.length)return!1;if(!n.length)return!0;let a=Dg(n,o),l=new Wo(n,a,0).goto(r),u=new Wo(o,a,0).goto(r);for(;;){if(l.to!=u.to||!Dd(l.active,u.active)||l.point&&(!u.point||!n1(l.point,u.point)))return!1;if(l.to>s)return!0;l.next(),u.next()}}static spans(e,i,r,s,n=-1){let o=new Wo(e,null,n).goto(i),a=i,l=o.openStart;for(;;){let u=Math.min(o.to,r);if(o.point){let c=o.activeForPoint(o.to),h=o.pointFrom<i?c.length+1:o.point.startSide<0?c.length:Math.min(c.length,l);s.point(a,u,o.point,c,h,o.pointRank),l=Math.min(o.openEnd(u),c.length)}else u>a&&(s.span(a,u,o.active,l),l=o.openEnd(u));if(o.to>r)return l+(o.point&&o.to>r?1:0);a=o.to,o.next()}}static of(e,i=!1){let r=new fr;for(let s of e instanceof Ad?[e]:i?xA(e):e)r.add(s.from,s.to,s.value);return r.finish()}static join(e){if(!e.length)return je.empty;let i=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let s=e[r];s!=je.empty;s=s.nextLayer)i=new je(s.chunkPos,s.chunk,i,Math.max(s.maxPoint,i.maxPoint));return i}}je.empty=new je([],[],null,-1);function xA(t){if(t.length>1)for(let e=t[0],i=1;i<t.length;i++){let r=t[i];if(Ed(e,r)>0)return t.slice().sort(Ed);e=r}return t}je.empty.nextLayer=je.empty;class fr{finishChunk(e){this.chunks.push(new wA(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,i,r){this.addInner(e,i,r)||(this.nextLayer||(this.nextLayer=new fr)).add(e,i,r)}addInner(e,i,r){let s=e-this.lastTo||r.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(i-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=i,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,i-e)),!0)}addChunk(e,i){if((e-this.lastTo||i.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,i.maxPoint),this.chunks.push(i),this.chunkPos.push(e);let r=i.value.length-1;return this.last=i.value[r],this.lastFrom=i.from[r]+e,this.lastTo=i.to[r]+e,!0}finish(){return this.finishInner(je.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let i=je.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,i}}function Dg(t,e,i){let r=new Map;for(let n of t)for(let o=0;o<n.chunk.length;o++)n.chunk[o].maxPoint<=0&&r.set(n.chunk[o],n.chunkPos[o]);let s=new Set;for(let n of e)for(let o=0;o<n.chunk.length;o++){let a=r.get(n.chunk[o]);a!=null&&(i?i.mapPos(a):a)==n.chunkPos[o]&&!(i!=null&&i.touchesRange(a,a+n.chunk[o].length))&&s.add(n.chunk[o])}return s}class mb{constructor(e,i,r,s=0){this.layer=e,this.skip=i,this.minPoint=r,this.rank=s}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,i=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,i,!1),this}gotoInner(e,i,r){for(;this.chunkIndex<this.layer.chunk.length;){let s=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(s)||this.layer.chunkEnd(this.chunkIndex)<e||s.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let s=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],i,!0);(!r||this.rangeIndex<s)&&this.setRangeIndex(s)}this.next()}forward(e,i){(this.to-e||this.endSide-i)<0&&this.gotoInner(e,i,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],i=this.layer.chunk[this.chunkIndex],r=e+i.from[this.rangeIndex];if(this.from=r,this.to=e+i.to[this.rangeIndex],this.value=i.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class La{constructor(e){this.heap=e}static from(e,i=null,r=-1){let s=[];for(let n=0;n<e.length;n++)for(let o=e[n];!o.isEmpty;o=o.nextLayer)o.maxPoint>=r&&s.push(new mb(o,i,r,n));return s.length==1?s[0]:new La(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,i=-1e9){for(let r of this.heap)r.goto(e,i);for(let r=this.heap.length>>1;r>=0;r--)Mc(this.heap,r);return this.next(),this}forward(e,i){for(let r of this.heap)r.forward(e,i);for(let r=this.heap.length>>1;r>=0;r--)Mc(this.heap,r);(this.to-e||this.value.endSide-i)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Mc(this.heap,0)}}}function Mc(t,e){for(let i=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let s=t[r];if(r+1<t.length&&s.compare(t[r+1])>=0&&(s=t[r+1],r++),i.compare(s)<0)break;t[r]=i,t[e]=s,e=r}}class Wo{constructor(e,i,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=La.from(e,i,r)}goto(e,i=-1e9){return this.cursor.goto(e,i),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=i,this.openStart=-1,this.next(),this}forward(e,i){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-i)<0;)this.removeActive(this.minActive);this.cursor.forward(e,i)}removeActive(e){Nl(this.active,e),Nl(this.activeTo,e),Nl(this.activeRank,e),this.minActive=Tg(this.active,this.activeTo)}addActive(e){let i=0,{value:r,to:s,rank:n}=this.cursor;for(;i<this.activeRank.length&&(n-this.activeRank[i]||s-this.activeTo[i])>0;)i++;Ll(this.active,i,r),Ll(this.activeTo,i,s),Ll(this.activeRank,i,n),e&&Ll(e,i,this.cursor.from),this.minActive=Tg(this.active,this.activeTo)}next(){let e=this.to,i=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),r&&Nl(r,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let n=this.cursor.value;if(!n.point)this.addActive(r),this.cursor.next();else if(i&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=n,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=n.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(r){this.openStart=0;for(let s=r.length-1;s>=0&&r[s]<e;s--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let i=[];for(let r=this.active.length-1;r>=0&&!(this.activeRank[r]<this.pointRank);r--)(this.activeTo[r]>e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&i.push(this.active[r]);return i.reverse()}openEnd(e){let i=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)i++;return i}}function Mg(t,e,i,r,s,n){t.goto(e),i.goto(r);let o=r+s,a=r,l=r-e,u=!!n.boundChange;for(let c=!1;;){let h=t.to+l-i.to,d=h||t.endSide-i.endSide,f=d<0?t.to+l:i.to,p=Math.min(f,o);if(t.point||i.point?(t.point&&i.point&&n1(t.point,i.point)&&Dd(t.activeForPoint(t.to),i.activeForPoint(i.to))||n.comparePoint(a,p,t.point,i.point),c=!1):(c&&n.boundChange(a),p>a&&!Dd(t.active,i.active)&&n.compareRange(a,p,t.active,i.active),u&&p<o&&(h||t.openEnd(f)!=i.openEnd(f))&&(c=!0)),f>o)break;a=f,d<=0&&t.next(),d>=0&&i.next()}}function Dd(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!=e[i]&&!n1(t[i],e[i]))return!1;return!0}function Nl(t,e){for(let i=e,r=t.length-1;i<r;i++)t[i]=t[i+1];t.pop()}function Ll(t,e,i){for(let r=t.length-1;r>=e;r--)t[r+1]=t[r];t[e]=i}function Tg(t,e){let i=-1,r=1e9;for(let s=0;s<e.length;s++)(e[s]-r||t[s].endSide-t[i].endSide)<0&&(i=s,r=e[s]);return i}function SA(t,e,i,r){for(let s=0,n=0;;){if(n>=e)return s;if(s==t.length)break;n+=t.charCodeAt(s)==9?i-n%i:1,s=Pr(t,s)}return t.length}const Md="ͼ",Bg=typeof Symbol>"u"?"__"+Md:Symbol.for(Md),Td=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Rg=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class us{constructor(e,i){this.rules=[];let{finish:r}=i||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function n(o,a,l,u){let c=[],h=/^@(\w+)\b/.exec(o[0]),d=h&&h[1]=="keyframes";if(h&&a==null)return l.push(o[0]+";");for(let f in a){let p=a[f];if(/&/.test(f))n(f.split(/,\s*/).map(v=>o.map(_=>v.replace(/&/,_))).reduce((v,_)=>v.concat(_)),p,l);else if(p&&typeof p=="object"){if(!h)throw new RangeError("The value of a property ("+f+") should be a primitive value.");n(s(f),p,c,d)}else p!=null&&c.push(f.replace(/_.*/,"").replace(/[A-Z]/g,v=>"-"+v.toLowerCase())+": "+p+";")}(c.length||d)&&l.push((r&&!h&&!u?o.map(r):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in e)n(s(o),e[o],this.rules)}getRules(){return this.rules.join(`
320
+ `)}static newName(){let e=Rg[Bg]||1;return Rg[Bg]=e+1,Md+e.toString(36)}static mount(e,i,r){let s=e[Td],n=r&&r.nonce;s?n&&s.setNonce(n):s=new kA(e,n),s.mount(Array.isArray(i)?i:[i],e)}}let Ng=new Map;class kA{constructor(e,i){let r=e.ownerDocument||e,s=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let n=Ng.get(r);if(n)return e[Td]=n;this.sheet=new s.CSSStyleSheet,Ng.set(r,this)}else this.styleTag=r.createElement("style"),i&&this.styleTag.setAttribute("nonce",i);this.modules=[],e[Td]=this}mount(e,i){let r=this.sheet,s=0,n=0;for(let o=0;o<e.length;o++){let a=e[o],l=this.modules.indexOf(a);if(l<n&&l>-1&&(this.modules.splice(l,1),n--,l=-1),l==-1){if(this.modules.splice(n++,0,a),r)for(let u=0;u<a.rules.length;u++)r.insertRule(a.rules[u],s++)}else{for(;n<l;)s+=this.modules[n++].rules.length;s+=a.rules.length,n++}}if(r)i.adoptedStyleSheets.indexOf(this.sheet)<0&&(i.adoptedStyleSheets=[this.sheet,...i.adoptedStyleSheets]);else{let o="";for(let l=0;l<this.modules.length;l++)o+=this.modules[l].getRules()+`
321
+ `;this.styleTag.textContent=o;let a=i.head||i;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var Ks={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Oa={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},CA=typeof navigator<"u"&&/Mac/.test(navigator.platform),AA=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ri=0;ri<10;ri++)Ks[48+ri]=Ks[96+ri]=String(ri);for(var ri=1;ri<=24;ri++)Ks[ri+111]="F"+ri;for(var ri=65;ri<=90;ri++)Ks[ri]=String.fromCharCode(ri+32),Oa[ri]=String.fromCharCode(ri);for(var Tc in Ks)Oa.hasOwnProperty(Tc)||(Oa[Tc]=Ks[Tc]);function EA(t){var e=CA&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||AA&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",i=!e&&t.key||(t.shiftKey?Oa:Ks)[t.keyCode]||t.key||"Unidentified";return i=="Esc"&&(i="Escape"),i=="Del"&&(i="Delete"),i=="Left"&&(i="ArrowLeft"),i=="Up"&&(i="ArrowUp"),i=="Right"&&(i="ArrowRight"),i=="Down"&&(i="ArrowDown"),i}let mi=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Bd=typeof document<"u"?document:{documentElement:{style:{}}};const Rd=/Edge\/(\d+)/.exec(mi.userAgent),gb=/MSIE \d/.test(mi.userAgent),Nd=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(mi.userAgent),S0=!!(gb||Nd||Rd),Lg=!S0&&/gecko\/(\d+)/i.test(mi.userAgent),Bc=!S0&&/Chrome\/(\d+)/.exec(mi.userAgent),Og="webkitFontSmoothing"in Bd.documentElement.style,Ld=!S0&&/Apple Computer/.test(mi.vendor),Pg=Ld&&(/Mobile\/\w+/.test(mi.userAgent)||mi.maxTouchPoints>2);var me={mac:Pg||/Mac/.test(mi.platform),windows:/Win/.test(mi.platform),linux:/Linux|X11/.test(mi.platform),ie:S0,ie_version:gb?Bd.documentMode||6:Nd?+Nd[1]:Rd?+Rd[1]:0,gecko:Lg,gecko_version:Lg?+(/Firefox\/(\d+)/.exec(mi.userAgent)||[0,0])[1]:0,chrome:!!Bc,chrome_version:Bc?+Bc[1]:0,ios:Pg,android:/Android\b/.test(mi.userAgent),webkit:Og,webkit_version:Og?+(/\bAppleWebKit\/(\d+)/.exec(mi.userAgent)||[0,0])[1]:0,safari:Ld,safari_version:Ld?+(/\bVersion\/(\d+(\.\d+)?)/.exec(mi.userAgent)||[0,0])[1]:0,tabSize:Bd.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function o1(t,e){for(let i in t)i=="class"&&e.class?e.class+=" "+t.class:i=="style"&&e.style?e.style+=";"+t.style:e[i]=t[i];return e}const Fu=Object.create(null);function a1(t,e,i){if(t==e)return!0;t||(t=Fu),e||(e=Fu);let r=Object.keys(t),s=Object.keys(e);if(r.length-0!=s.length-0)return!1;for(let n of r)if(n!=i&&(s.indexOf(n)==-1||t[n]!==e[n]))return!1;return!0}function DA(t,e){for(let i=t.attributes.length-1;i>=0;i--){let r=t.attributes[i].name;e[r]==null&&t.removeAttribute(r)}for(let i in e){let r=e[i];i=="style"?t.style.cssText=r:t.getAttribute(i)!=r&&t.setAttribute(i,r)}}function Fg(t,e,i){let r=!1;if(e)for(let s in e)i&&s in i||(r=!0,s=="style"?t.style.cssText="":t.removeAttribute(s));if(i)for(let s in i)e&&e[s]==i[s]||(r=!0,s=="style"?t.style.cssText=i[s]:t.setAttribute(s,i[s]));return r}function MA(t){let e=Object.create(null);for(let i=0;i<t.attributes.length;i++){let r=t.attributes[i];e[r.name]=r.value}return e}class Xs{eq(e){return!1}updateDOM(e,i,r){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,i,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Ti=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(Ti||(Ti={}));class qe extends En{constructor(e,i,r,s){super(),this.startSide=e,this.endSide=i,this.widget=r,this.spec=s}get heightRelevant(){return!1}static mark(e){return new Za(e)}static widget(e){let i=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return i+=r&&!e.inlineOrder?i>0?3e8:-4e8:i>0?1e8:-1e8,new Dn(e,i,i,r,e.widget||null,!1)}static replace(e){let i=!!e.block,r,s;if(e.isBlockGap)r=-5e8,s=4e8;else{let{start:n,end:o}=vb(e,i);r=(n?i?-3e8:-1:5e8)-1,s=(o?i?2e8:1:-6e8)+1}return new Dn(e,r,s,i,e.widget||null,!0)}static line(e){return new Qa(e)}static set(e,i=!1){return je.of(e,i)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}qe.none=je.empty;class Za extends qe{constructor(e){let{start:i,end:r}=vb(e);super(i?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?o1(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||Fu}eq(e){return this==e||e instanceof Za&&this.tagName==e.tagName&&a1(this.attrs,e.attrs)}range(e,i=e){if(e>=i)throw new RangeError("Mark decorations may not be empty");return super.range(e,i)}}Za.prototype.point=!1;class Qa extends qe{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Qa&&this.spec.class==e.spec.class&&a1(this.spec.attributes,e.spec.attributes)}range(e,i=e){if(i!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,i)}}Qa.prototype.mapMode=ji.TrackBefore;Qa.prototype.point=!0;class Dn extends qe{constructor(e,i,r,s,n,o){super(i,r,n,e),this.block=s,this.isReplace=o,this.mapMode=s?i<=0?ji.TrackBefore:ji.TrackAfter:ji.TrackDel}get type(){return this.startSide!=this.endSide?Ti.WidgetRange:this.startSide<=0?Ti.WidgetBefore:Ti.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Dn&&TA(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,i=e){if(this.isReplace&&(e>i||e==i&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&i!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,i)}}Dn.prototype.point=!0;function vb(t,e=!1){let{inclusiveStart:i,inclusiveEnd:r}=t;return i==null&&(i=t.inclusive),r==null&&(r=t.inclusive),{start:i??e,end:r??e}}function TA(t,e){return t==e||!!(t&&e&&t.compare(e))}function no(t,e,i,r=0){let s=i.length-1;s>=0&&i[s]+r>=t?i[s]=Math.max(i[s],e):i.push(t,e)}class Pa extends En{constructor(e,i,r){super(),this.tagName=e,this.attributes=i,this.rank=r}eq(e){return e==this||e instanceof Pa&&this.tagName==e.tagName&&a1(this.attributes,e.attributes)}static create(e){return new Pa(e.tagName,e.attributes||Fu,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,i=!1){return je.of(e,i)}}Pa.prototype.startSide=Pa.prototype.endSide=-1;function Fa(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function Od(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function pa(t,e){if(!e.anchorNode)return!1;try{return Od(t,e.anchorNode)}catch{return!1}}function gu(t){return t.nodeType==3?Ia(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function ma(t,e,i,r){return i?Ig(t,e,i,r,-1)||Ig(t,e,i,r,1):!1}function Vs(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function Iu(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function Ig(t,e,i,r,s){for(;;){if(t==i&&e==r)return!0;if(e==(s<0?0:cs(t))){if(t.nodeName=="DIV")return!1;let n=t.parentNode;if(!n||n.nodeType!=1)return!1;e=Vs(t)+(s<0?0:1),t=n}else if(t.nodeType==1){if(t=t.childNodes[e+(s<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=s<0?cs(t):0}else return!1}}function cs(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function zu(t,e){let{left:i,right:r}=t;if(i==r)return t;let s=e?i:r;return{left:s,right:s,top:t.top,bottom:t.bottom}}function BA(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function bb(t,e){let i=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.width-t.offsetWidth)<1)&&(i=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:i,scaleY:r}}function RA(t,e,i,r,s,n,o,a){let l=t.ownerDocument,u=l.defaultView||window;for(let c=t,h=!1;c&&!h;)if(c.nodeType==1){let d,f=c==l.body,p=1,v=1;if(f)d=BA(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(h=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let x=c.getBoundingClientRect();({scaleX:p,scaleY:v}=bb(c,x)),d={left:x.left,right:x.left+c.clientWidth*p,top:x.top,bottom:x.top+c.clientHeight*v}}let _=0,w=0;if(s=="nearest")e.top<d.top+o?(w=e.top-(d.top+o),i>0&&e.bottom>d.bottom+w&&(w=e.bottom-d.bottom+o)):e.bottom>d.bottom-o&&(w=e.bottom-d.bottom+o,i<0&&e.top-w<d.top&&(w=e.top-(d.top+o)));else{let x=e.bottom-e.top,C=d.bottom-d.top;w=(s=="center"&&x<=C?e.top+x/2-C/2:s=="start"||s=="center"&&i<0?e.top-o:e.bottom-C+o)-d.top}if(r=="nearest"?e.left<d.left+n?(_=e.left-(d.left+n),i>0&&e.right>d.right+_&&(_=e.right-d.right+n)):e.right>d.right-n&&(_=e.right-d.right+n,i<0&&e.left<d.left+_&&(_=e.left-(d.left+n))):_=(r=="center"?e.left+(e.right-e.left)/2-(d.right-d.left)/2:r=="start"==a?e.left-n:e.right-(d.right-d.left)+n)-d.left,_||w)if(f)u.scrollBy(_,w);else{let x=0,C=0;if(w){let D=c.scrollTop;c.scrollTop+=w/v,C=(c.scrollTop-D)*v}if(_){let D=c.scrollLeft;c.scrollLeft+=_/p,x=(c.scrollLeft-D)*p}e={left:e.left-x,top:e.top-C,right:e.right-x,bottom:e.bottom-C},x&&Math.abs(x-_)<1&&(r="nearest"),C&&Math.abs(C-w)<1&&(s="nearest")}if(f)break;(e.top<d.top||e.bottom>d.bottom||e.left<d.left||e.right>d.right)&&(e={left:Math.max(e.left,d.left),right:Math.min(e.right,d.right),top:Math.max(e.top,d.top),bottom:Math.min(e.bottom,d.bottom)}),c=c.assignedSlot||c.parentNode}else if(c.nodeType==11)c=c.host;else break}function _b(t,e=!0){let i=t.ownerDocument,r=null,s=null;for(let n=t.parentNode;n&&!(n==i.body||(!e||r)&&s);)if(n.nodeType==1)!s&&n.scrollHeight>n.clientHeight&&(s=n),e&&!r&&n.scrollWidth>n.clientWidth&&(r=n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;return{x:r,y:s}}class NA{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:i,focusNode:r}=e;this.set(i,Math.min(e.anchorOffset,i?cs(i):0),r,Math.min(e.focusOffset,r?cs(r):0))}set(e,i,r,s){this.anchorNode=e,this.anchorOffset=i,this.focusNode=r,this.focusOffset=s}}function yb(t){let e=[];for(let i=t;i;i=i.nodeType==11?i.host:i.parentNode)i.nodeType==1&&e.push({node:i,left:i.scrollLeft,top:i.scrollTop});return e}function wb(t,e=!0){for(let{node:i,left:r,top:s}of t)e&&i.scrollTop!=s&&(i.scrollTop=s),i.scrollLeft!=r&&(i.scrollLeft=r)}let fn=null;me.safari&&me.safari_version>=26&&(fn=!1);function xb(t){if(t.setActive)return t.setActive();if(fn)return t.focus(fn);let e=yb(t);t.focus(fn==null?{get preventScroll(){return fn={preventScroll:!0},!0}}:void 0),fn||(fn=!1,wb(e))}let zg;function Ia(t,e,i=e){let r=zg||(zg=document.createRange());return r.setEnd(t,i),r.setStart(t,e),r}function oo(t,e,i,r){let s={key:e,code:e,keyCode:i,which:i,cancelable:!0};r&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=r);let n=new KeyboardEvent("keydown",s);n.synthetic=!0,t.dispatchEvent(n);let o=new KeyboardEvent("keyup",s);return o.synthetic=!0,t.dispatchEvent(o),n.defaultPrevented||o.defaultPrevented}function LA(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function OA(t,e){let i=e.focusNode,r=e.focusOffset;if(!i||e.anchorNode!=i||e.anchorOffset!=r)return!1;for(r=Math.min(r,cs(i));;)if(r){if(i.nodeType!=1)return!1;let s=i.childNodes[r-1];s.contentEditable=="false"?r--:(i=s,r=cs(i))}else{if(i==t)return!0;r=Vs(i),i=i.parentNode}}function Sb(t){return t instanceof Window?t.pageYOffset>Math.max(0,t.document.documentElement.scrollHeight-t.innerHeight-4):t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function kb(t,e){for(let i=t,r=e;;){if(i.nodeType==3&&r>0)return{node:i,offset:r};if(i.nodeType==1&&r>0){if(i.contentEditable=="false")return null;i=i.childNodes[r-1],r=cs(i)}else if(i.parentNode&&!Iu(i))r=Vs(i),i=i.parentNode;else return null}}function Cb(t,e){for(let i=t,r=e;;){if(i.nodeType==3&&r<i.nodeValue.length)return{node:i,offset:r};if(i.nodeType==1&&r<i.childNodes.length){if(i.contentEditable=="false")return null;i=i.childNodes[r],r=0}else if(i.parentNode&&!Iu(i))r=Vs(i)+1,i=i.parentNode;else return null}}class cr{constructor(e,i,r=!0){this.node=e,this.offset=i,this.precise=r}static before(e,i){return new cr(e.parentNode,Vs(e),i)}static after(e,i){return new cr(e.parentNode,Vs(e)+1,i)}}var Lt=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Lt||(Lt={}));const Mn=Lt.LTR,l1=Lt.RTL;function Ab(t){let e=[];for(let i=0;i<t.length;i++)e.push(1<<+t[i]);return e}const PA=Ab("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),FA=Ab("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Pd=Object.create(null),xr=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),i=t.charCodeAt(1);Pd[e]=i,Pd[i]=-e}function Eb(t){return t<=247?PA[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?FA[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const IA=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Fr{get dir(){return this.level%2?l1:Mn}constructor(e,i,r){this.from=e,this.to=i,this.level=r}side(e,i){return this.dir==i==e?this.to:this.from}forward(e,i){return e==(this.dir==i)}static find(e,i,r,s){let n=-1;for(let o=0;o<e.length;o++){let a=e[o];if(a.from<=i&&a.to>=i){if(a.level==r)return o;(n<0||(s!=0?s<0?a.from<i:a.to>i:e[n].level>a.level))&&(n=o)}}if(n<0)throw new RangeError("Index out of range");return n}}function Db(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++){let r=t[i],s=e[i];if(r.from!=s.from||r.to!=s.to||r.direction!=s.direction||!Db(r.inner,s.inner))return!1}return!0}const et=[];function zA(t,e,i,r,s){for(let n=0;n<=r.length;n++){let o=n?r[n-1].to:e,a=n<r.length?r[n].from:i,l=n?256:s;for(let u=o,c=l,h=l;u<a;u++){let d=Eb(t.charCodeAt(u));d==512?d=c:d==8&&h==4&&(d=16),et[u]=d==4?2:d,d&7&&(h=d),c=d}for(let u=o,c=l,h=l;u<a;u++){let d=et[u];if(d==128)u<a-1&&c==et[u+1]&&c&24?d=et[u]=c:et[u]=256;else if(d==64){let f=u+1;for(;f<a&&et[f]==64;)f++;let p=u&&c==8||f<i&&et[f]==8?h==1?1:8:256;for(let v=u;v<f;v++)et[v]=p;u=f-1}else d==8&&h==1&&(et[u]=1);c=d,d&7&&(h=d)}}}function jA(t,e,i,r,s){let n=s==1?2:1;for(let o=0,a=0,l=0;o<=r.length;o++){let u=o?r[o-1].to:e,c=o<r.length?r[o].from:i;for(let h=u,d,f,p;h<c;h++)if(f=Pd[d=t.charCodeAt(h)])if(f<0){for(let v=a-3;v>=0;v-=3)if(xr[v+1]==-f){let _=xr[v+2],w=_&2?s:_&4?_&1?n:s:0;w&&(et[h]=et[xr[v]]=w),a=v;break}}else{if(xr.length==189)break;xr[a++]=h,xr[a++]=d,xr[a++]=l}else if((p=et[h])==2||p==1){let v=p==s;l=v?0:1;for(let _=a-3;_>=0;_-=3){let w=xr[_+2];if(w&2)break;if(v)xr[_+2]|=2;else{if(w&4)break;xr[_+2]|=4}}}}}function HA(t,e,i,r){for(let s=0,n=r;s<=i.length;s++){let o=s?i[s-1].to:t,a=s<i.length?i[s].from:e;for(let l=o;l<a;){let u=et[l];if(u==256){let c=l+1;for(;;)if(c==a){if(s==i.length)break;c=i[s++].to,a=s<i.length?i[s].from:e}else if(et[c]==256)c++;else break;let h=n==1,d=(c<e?et[c]:r)==1,f=h==d?h?1:2:r;for(let p=c,v=s,_=v?i[v-1].to:t;p>l;)p==_&&(p=i[--v].from,_=v?i[v-1].to:t),et[--p]=f;l=c}else n=u,l++}}}function Fd(t,e,i,r,s,n,o){let a=r%2?2:1;if(r%2==s%2)for(let l=e,u=0;l<i;){let c=!0,h=!1;if(u==n.length||l<n[u].from){let v=et[l];v!=a&&(c=!1,h=v==16)}let d=!c&&a==1?[]:null,f=c?r:r+1,p=l;e:for(;;)if(u<n.length&&p==n[u].from){if(h)break e;let v=n[u];if(!c)for(let _=v.to,w=u+1;;){if(_==i)break e;if(w<n.length&&n[w].from==_)_=n[w++].to;else{if(et[_]==a)break e;break}}if(u++,d)d.push(v);else{v.from>l&&o.push(new Fr(l,v.from,f));let _=v.direction==Mn!=!(f%2);Id(t,_?r+1:r,s,v.inner,v.from,v.to,o),l=v.to}p=v.to}else{if(p==i||(c?et[p]!=a:et[p]==a))break;p++}d?Fd(t,l,p,r+1,s,d,o):l<p&&o.push(new Fr(l,p,f)),l=p}else for(let l=i,u=n.length;l>e;){let c=!0,h=!1;if(!u||l>n[u-1].to){let v=et[l-1];v!=a&&(c=!1,h=v==16)}let d=!c&&a==1?[]:null,f=c?r:r+1,p=l;e:for(;;)if(u&&p==n[u-1].to){if(h)break e;let v=n[--u];if(!c)for(let _=v.from,w=u;;){if(_==e)break e;if(w&&n[w-1].to==_)_=n[--w].from;else{if(et[_-1]==a)break e;break}}if(d)d.push(v);else{v.to<l&&o.push(new Fr(v.to,l,f));let _=v.direction==Mn!=!(f%2);Id(t,_?r+1:r,s,v.inner,v.from,v.to,o),l=v.from}p=v.from}else{if(p==e||(c?et[p-1]!=a:et[p-1]==a))break;p--}d?Fd(t,p,l,r+1,s,d,o):p<l&&o.push(new Fr(p,l,f)),l=p}}function Id(t,e,i,r,s,n,o){let a=e%2?2:1;zA(t,s,n,r,a),jA(t,s,n,r,a),HA(s,n,r,a),Fd(t,s,n,e,i,r,o)}function $A(t,e,i){if(!t)return[new Fr(0,0,e==l1?1:0)];if(e==Mn&&!i.length&&!IA.test(t))return Mb(t.length);if(i.length)for(;t.length>et.length;)et[et.length]=256;let r=[],s=e==Mn?0:1;return Id(t,s,s,i,0,t.length,r),r}function Mb(t){return[new Fr(0,t,0)]}let Tb="";function qA(t,e,i,r,s){var n;let o=r.head-t.from,a=Fr.find(e,o,(n=r.bidiLevel)!==null&&n!==void 0?n:-1,r.assoc),l=e[a],u=l.side(s,i);if(o==u){let d=a+=s?1:-1;if(d<0||d>=e.length)return null;l=e[a=d],o=l.side(!s,i),u=l.side(s,i)}let c=Pr(t.text,o,l.forward(s,i));(c<l.from||c>l.to)&&(c=u),Tb=t.text.slice(Math.min(o,c),Math.max(o,c));let h=a==(s?e.length-1:0)?null:e[a+(s?1:-1)];return h&&c==u&&h.level+(s?0:1)<l.level?ve.cursor(h.side(!s,i)+t.from,h.forward(s,i)?1:-1,h.level):ve.cursor(c+t.from,l.forward(s,i)?-1:1,l.level)}function WA(t,e,i){for(let r=e;r<i;r++){let s=Eb(t.charCodeAt(r));if(s==1)return Mn;if(s==2||s==4)return l1}return Mn}const Bb=we.define(),Rb=we.define(),Nb=we.define(),Lb=we.define(),zd=we.define(),Ob=we.define(),Pb=we.define(),u1=we.define(),c1=we.define(),Fb=we.define({combine:t=>t.some(e=>e)}),KA=we.define({combine:t=>t.some(e=>e)}),Ib=we.define();class ao{constructor(e,i,r,s,n,o=!1){this.range=e,this.y=i,this.x=r,this.yMargin=s,this.xMargin=n,this.isSnapshot=o}map(e){return e.empty?this:new ao(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new ao(ve.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Ol=at.define({map:(t,e)=>t.map(e)}),zb=at.define();function Ir(t,e,i){let r=t.facet(Lb);r.length?r[0](e):window.onerror&&window.onerror(String(e),i,void 0,void 0,e)||(i?console.error(i+":",e):console.error(e))}const ts=we.define({combine:t=>t.length?t[0]:!0});let VA=0;const Zn=we.define({combine(t){return t.filter((e,i)=>{for(let r=0;r<i;r++)if(t[r].plugin==e.plugin)return!1;return!0})}});class qr{constructor(e,i,r,s,n){this.id=e,this.create=i,this.domEventHandlers=r,this.domEventObservers=s,this.baseExtensions=n(this),this.extension=this.baseExtensions.concat(Zn.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Zn.of({plugin:this,arg:e}))}static define(e,i){const{eventHandlers:r,eventObservers:s,provide:n,decorations:o}=i||{};return new qr(VA++,e,r,s,a=>{let l=[];return o&&l.push(k0.of(u=>{let c=u.plugin(a);return c?o(c):qe.none})),n&&l.push(n(a)),l})}static fromClass(e,i){return qr.define((r,s)=>new e(r,s),i)}}class Rc{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let i=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(i)}catch(r){if(Ir(i.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(i){Ir(e.state,i,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var i;if(!((i=this.value)===null||i===void 0)&&i.destroy)try{this.value.destroy()}catch(r){Ir(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const jb=we.define(),h1=we.define(),k0=we.define(),Hb=we.define(),d1=we.define(),el=we.define(),$b=we.define();function jg(t,e){let i=t.state.facet($b);if(!i.length)return i;let r=i.map(n=>n instanceof Function?n(t):n),s=[];return je.spans(r,e.from,e.to,{point(){},span(n,o,a,l){let u=n-e.from,c=o-e.from,h=s;for(let d=a.length-1;d>=0;d--,l--){let f=a[d].spec.bidiIsolate,p;if(f==null&&(f=WA(e.text,u,c)),l>0&&h.length&&(p=h[h.length-1]).to==u&&p.direction==f)p.to=c,h=p.inner;else{let v={from:u,to:c,direction:f,inner:[]};h.push(v),h=v.inner}}}}),s}const qb=we.define();function Wb(t){let e=0,i=0,r=0,s=0;for(let n of t.state.facet(qb)){let o=n(t);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(i=Math.max(i,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:e,right:i,top:r,bottom:s}}const ia=we.define();class ir{constructor(e,i,r,s){this.fromA=e,this.toA=i,this.fromB=r,this.toB=s}join(e){return new ir(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let i=e.length,r=this;for(;i>0;i--){let s=e[i-1];if(!(s.fromA>r.toA)){if(s.toA<r.fromA)break;r=r.join(s),e.splice(i-1,1)}}return e.splice(i,0,r),e}static extendWithRanges(e,i){if(i.length==0)return e;let r=[];for(let s=0,n=0,o=0;;){let a=s<e.length?e[s].fromB:1e9,l=n<i.length?i[n]:1e9,u=Math.min(a,l);if(u==1e9)break;let c=u+o,h=u,d=c;for(;;)if(n<i.length&&i[n]<=h){let f=i[n+1];n+=2,h=Math.max(h,f);for(let p=s;p<e.length&&e[p].fromB<=h;p++)o=e[p].toA-e[p].toB;d=Math.max(d,f+o)}else if(s<e.length&&e[s].fromB<=h){let f=e[s++];h=Math.max(h,f.toB),d=Math.max(d,f.toA),o=f.toA-f.toB}else break;r.push(new ir(c,d,u,h))}return r}}class ju{constructor(e,i,r){this.view=e,this.state=i,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=Mt.empty(this.startState.doc.length);for(let n of r)this.changes=this.changes.compose(n.changes);let s=[];this.changes.iterChangedRanges((n,o,a,l)=>s.push(new ir(n,o,a,l))),this.changedRanges=s}static create(e,i,r){return new ju(e,i,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const UA=[];class yt{constructor(e,i,r=0){this.dom=e,this.length=i,this.flags=r,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return UA}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let i=this.domAttrs;i&&DA(this.dom,i)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,i=this.posAtStart){let r=i;for(let s of this.children){if(s==e)return r;r+=s.length+s.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,i,r){return null}domPosFor(e,i){let r=Vs(this.dom),s=this.length?e>0:i>0;return new cr(this.parent.dom,r+(s?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof A0)return e;return null}static get(e){return e.cmTile}}class C0 extends yt{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let i=this.dom,r=null,s,n=(e==null?void 0:e.node)==i?e:null,o=0;for(let a of this.children){if(a.sync(e),o+=a.length+a.breakAfter,s=r?r.nextSibling:i.firstChild,n&&s!=a.dom&&(n.written=!0),a.dom.parentNode==i)for(;s&&s!=a.dom;)s=Hg(s);else i.insertBefore(a.dom,s);r=a.dom}for(s=r?r.nextSibling:i.firstChild,n&&s&&(n.written=!0);s;)s=Hg(s);this.length=o}}function Hg(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class A0 extends C0{constructor(e,i){super(i),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let i=yt.get(e);if(i&&this.owns(i))return i;e=e.parentNode}}blockTiles(e){for(let i=[],r=this,s=0,n=0;;)if(s==r.children.length){if(!i.length)return;r=r.parent,r.breakAfter&&n++,s=i.pop()}else{let o=r.children[s++];if(o instanceof os)i.push(s),r=o,s=0;else{let a=n+o.length,l=e(o,n);if(l!==void 0)return l;n=a+o.breakAfter}}}resolveBlock(e,i){let r,s=-1,n,o=-1;if(this.blockTiles((a,l)=>{let u=l+a.length;if(e>=l&&e<=u){if(a.isWidget()&&i>=-1&&i<=1){if(a.flags&32)return!0;a.flags&16&&(r=void 0)}(l<e||e==u&&(i<-1?a.length:a.covers(1)))&&(!r||!a.isWidget()&&r.isWidget())&&(r=a,s=e-l),(u>e||e==l&&(i>1?a.length:a.covers(-1)))&&(!n||!a.isWidget()&&n.isWidget())&&(n=a,o=e-l)}}),!r&&!n)throw new Error("No tile at position "+e);return r&&i<0||!n?{tile:r,offset:s}:{tile:n,offset:o}}}class os extends C0{constructor(e,i){super(e),this.wrapper=i}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,i){let r=new os(i||document.createElement(e.tagName),e);return i||(r.flags|=4),r}}class _o extends C0{constructor(e,i){super(e),this.attrs=i}isLine(){return!0}static start(e,i,r){let s=new _o(i||document.createElement("div"),e);return(!i||!r)&&(s.flags|=4),s}get domAttrs(){return this.attrs}resolveInline(e,i,r){let s=null,n=-1,o=null,a=-1;function l(c,h){for(let d=0,f=0;d<c.children.length&&f<=h;d++){let p=c.children[d],v=f+p.length;v>=h&&(p.isComposite()?l(p,h-f):(!o||o.isHidden&&(i>0&&!(o.flags&32)||r&&YA(o,p)))&&(v>h||p.flags&32&&i<=1)?(o=p,a=h-f):(f<h||p.flags&16&&!p.isHidden&&i>=-1)&&(s=p,n=h-f)),f=v}}l(this,e);let u=(i<0?s:o)||s||o;return u?{tile:u,offset:u==s?n:a}:null}coordsIn(e,i,r){let s=this.resolveInline(e,i,!0);return s?s.tile.coordsIn(Math.max(0,s.offset),i,r):GA(this)}domIn(e,i){let r=this.resolveInline(e,i);if(r){let{tile:s,offset:n}=r;if(this.dom.contains(s.dom))return s.isText()?new cr(s.dom,Math.min(s.dom.nodeValue.length,n)):s.domPosFor(n,s.flags&16?1:s.flags&32?-1:i);let o=r.tile.parent,a=!1;for(let l of o.children){if(a)return new cr(l.dom,0);l==r.tile&&(a=!0)}}return new cr(this.dom,0)}}function GA(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let i=gu(e);return i[i.length-1]||null}function YA(t,e){let i=t.coordsIn(0,1),r=e.coordsIn(0,1);return i&&r&&r.top<i.bottom}class Mi extends C0{constructor(e,i){super(e),this.mark=i}get domAttrs(){return this.mark.attrs}static of(e,i){let r=new Mi(i||document.createElement(e.tagName),e);return i||(r.flags|=4),r}}class bn extends yt{constructor(e,i){super(e,i.length),this.text=i}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,i,r){let s=this.dom.nodeValue.length;e>s&&(e=s);let n=e,o=e,a=0;e==0&&i<0||e==s&&i>=0?me.chrome||me.gecko||(e?(n--,a=1):o<s&&(o++,a=-1)):i<0?n--:o<s&&o++;let l=Ia(this.dom,n,o).getClientRects();if(!l.length)return null;let u=l[(a?a<0:i>=0)?0:l.length-1];return me.safari&&!a&&u.width==0&&(u=Array.prototype.find.call(l,c=>c.width)||u),r==null?u:zu(u,(a?a>0:i<0)==r)}static of(e,i){let r=new bn(i||document.createTextNode(e),e);return i||(r.flags|=2),r}}class Tn extends yt{constructor(e,i,r,s){super(e,i,s),this.widget=r}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,i){return this.coordsInWidget(e,i,!1)}coordsInWidget(e,i,r){let s=this.widget.coordsAt(this.dom,e,i);if(s)return s;if(r)return zu(this.dom.getBoundingClientRect(),this.length?e==0:i<=0);{let n=this.dom.getClientRects(),o=null;if(!n.length)return null;let a=this.flags&16?!0:this.flags&32?!1:e>0;for(let l=a?n.length-1:0;o=n[l],!(e>0?l==0:l==n.length-1||o.top<o.bottom);l+=a?-1:1);return zu(o,!a)}}get overrideDOMText(){if(!this.length)return Ve.empty;let{root:e}=this;if(!e)return Ve.empty;let i=this.posAtStart;return e.view.state.doc.slice(i,i+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,i,r,s,n){return n||(n=e.toDOM(i),e.editable||(n.contentEditable="false")),new Tn(n,r,e,s)}}class Hu extends yt{constructor(e){let i=document.createElement("img");i.className="cm-widgetBuffer",i.setAttribute("aria-hidden","true"),super(i,0,e)}get isHidden(){return!0}get overrideDOMText(){return Ve.empty}coordsIn(e,i,r){let s=this.dom.getBoundingClientRect();return r==null?s:zu(s,i>0==r)}}class XA{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,i,r){let{tile:s,index:n,beforeBreak:o,parents:a}=this;for(;e||i>0;)if(s.isComposite())if(o){if(!e)break;r&&r.break(),e--,o=!1}else if(n==s.children.length){if(!e&&!a.length)break;r&&r.leave(s),o=!!s.breakAfter,{tile:s,index:n}=a.pop(),n++}else{let l=s.children[n],u=l.breakAfter;(i>0?l.length<=e:l.length<e)&&(!r||r.skip(l,0,l.length)!==!1||!l.isComposite)?(o=!!u,n++,e-=l.length):(a.push({tile:s,index:n}),s=l,n=0,r&&l.isComposite()&&r.enter(l))}else{let l=s.length;if(n<l&&e){let u=Math.min(e,l-n);r&&r.skip(s,n,n+u),e-=u,n+=u}if(n==l)o=!!s.breakAfter,{tile:s,index:n}=a.pop(),n++;else if(!e)break}return this.tile=s,this.index=n,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class JA{constructor(e,i,r,s){this.from=e,this.to=i,this.wrapper=r,this.rank=s}}class ZA{constructor(e,i,r){this.cache=e,this.root=i,this.blockWrappers=r,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,i,r,s){var n;this.flushBuffer();let o=this.ensureMarks(i,r),a=o.lastChild;if(a&&a.isText()&&!(a.flags&8)&&a.length+e.length<512){this.cache.reused.set(a,2);let l=o.children[o.children.length-1]=new bn(a.dom,a.text+e);l.parent=o}else o.append(s||bn.of(e,(n=this.cache.find(bn))===null||n===void 0?void 0:n.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,i){let r=this.curLine;r.dom!=i.line.dom&&(r.setDOM(this.cache.reused.has(i.line)?Nc(i.line.dom):i.line.dom),this.cache.reused.set(i.line,2));let s=r;for(let a=i.marks.length-1;a>=0;a--){let l=i.marks[a],u=s.lastChild;if(u instanceof Mi&&u.mark.eq(l.mark))u.dom!=l.dom&&u.setDOM(Nc(l.dom)),s=u;else{if(this.cache.reused.get(l)){let h=yt.get(l.dom);h&&h.setDOM(Nc(l.dom))}let c=Mi.of(l.mark,l.dom);s.append(c),s=c}this.cache.reused.set(l,2)}let n=yt.get(e.text);n&&this.cache.reused.set(n,2);let o=new bn(e.text,e.text.nodeValue);o.flags|=8,this.pos=e.range.toB,s.append(o)}addInlineWidget(e,i,r){let s=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);s||this.flushBuffer();let n=this.ensureMarks(i,r);!s&&!(e.flags&16)&&n.append(this.getBuffer(1)),n.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,i,r){this.flushBuffer(),this.ensureMarks(i,r).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let i=this.afterWidget||this.lastBlock;i.length+=e,this.pos+=e}addLineStart(e,i){var r;e||(e=Kb);let s=_o.start(e,i||((r=this.cache.find(_o))===null||r===void 0?void 0:r.dom),!!i);this.getBlockPos().append(this.lastBlock=this.curLine=s)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,i){var r;let s=this.curLine;for(let n=e.length-1;n>=0;n--){let o=e[n],a;if(i>0&&(a=s.lastChild)&&a instanceof Mi&&a.mark.eq(o))s=a,i--;else{let l=Mi.of(o,(r=this.cache.find(Mi,u=>u.mark.eq(o)))===null||r===void 0?void 0:r.dom);s.append(l),s=l,i=0}}return s}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!$g(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(me.ios&&$g(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Lc,0,32)||new Tn(Lc.toDOM(),0,Lc,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let i=e.rank*102+e.value.rank,r=new JA(e.from,e.to,e.value,i),s=this.wrappers.length;for(;s>0&&(this.wrappers[s-1].rank-r.rank||this.wrappers[s-1].to-r.to)<0;)s--;this.wrappers.splice(s,0,r)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let i=this.root;for(let r of this.wrappers){let s=i.lastChild;if(r.from<this.pos&&s instanceof os&&s.wrapper.eq(r.wrapper))i=s;else{let n=os.of(r.wrapper,(e=this.cache.find(os,o=>o.wrapper.eq(r.wrapper)))===null||e===void 0?void 0:e.dom);i.append(n),i=n}}return i}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let i=2|(e<0?16:32),r=this.cache.find(Hu,void 0,1);return r&&(r.flags=i),r||new Hu(i)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class QA{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:s,lineBreak:n,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=s;let a=this.textOff=Math.min(e,s.length);return n?null:s.slice(0,a)}let i=Math.min(this.text.length,this.textOff+e),r=this.text.slice(this.textOff,i);return this.textOff=i,r}}const $u=[Tn,_o,bn,Mi,Hu,os,A0];for(let t=0;t<$u.length;t++)$u[t].bucket=t;class eE{constructor(e){this.view=e,this.buckets=$u.map(()=>[]),this.index=$u.map(()=>0),this.reused=new Map}add(e){let i=e.constructor.bucket,r=this.buckets[i];r.length<6?r.push(e):r[this.index[i]=(this.index[i]+1)%6]=e}find(e,i,r=2){let s=e.bucket,n=this.buckets[s],o=this.index[s];for(let a=0;a<n.length;a++){let l=(a+o)%n.length,u=n[l];if((!i||i(u))&&!this.reused.has(u))return n.splice(l,1),l<o&&this.index[s]--,this.reused.set(u,r),u}return null}findWidget(e,i,r){let s=this.buckets[0];if(s.length)for(let n=0,o=0;;n++){if(n==s.length){if(o)return null;o=1,n=0}let a=s[n];if(!this.reused.has(a)&&(o==0?a.widget.compare(e):a.widget.constructor==e.constructor&&e.updateDOM(a.dom,this.view,a.widget)))return s.splice(n,1),n<this.index[0]&&this.index[0]--,a.widget==e&&a.length==i&&(a.flags&497)==r?(this.reused.set(a,1),a):(this.reused.set(a,2),new Tn(a.dom,i,e,a.flags&-498|r))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,i=2){if(!this.reused.has(e))return this.reused.set(e,i),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class tE{constructor(e,i,r,s,n){this.view=e,this.decorations=s,this.disallowBlockEffectsFor=n,this.openWidget=!1,this.openMarks=0,this.cache=new eE(e),this.text=new QA(e.state.doc),this.builder=new ZA(this.cache,new A0(e,e.contentDOM),je.iter(r)),this.cache.reused.set(i,2),this.old=new XA(i),this.reuseWalker={skip:(o,a,l)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,i){let r=i&&this.getCompositionContext(i.text);for(let s=0,n=0,o=0;;){let a=o<e.length?e[o++]:null,l=a?a.fromA:this.old.root.length;if(l>s){let u=l-s;this.preserve(u,!o,!a),s=l,n+=u}if(!a)break;i&&a.fromA<=i.range.fromA&&a.toA>=i.range.toA?(this.forward(a.fromA,i.range.fromA,i.range.fromA<i.range.toA?1:-1),this.emit(n,i.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(i,r),this.text.skip(i.range.toB-i.range.fromB),this.forward(i.range.fromA,a.toA),this.emit(i.range.toB,a.toB)):(this.forward(a.fromA,a.toA),this.emit(n,a.toB)),n=a.toB,s=a.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,i,r){let s=sE(this.old),n=this.openMarks;this.old.advance(e,r?1:-1,{skip:(o,a,l)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(l-a);else{let u=l>0||a<o.length?Tn.of(o.widget,this.view,l-a,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);u.flags&256?(u.flags&=-2,this.builder.addBlockWidget(u)):(this.builder.ensureLine(null),this.builder.addInlineWidget(u,s,n),n=s.length)}else if(o.isText())this.builder.ensureLine(null),!a&&l==o.length&&!this.cache.reused.has(o)?this.builder.addText(o.text,s,n,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(a,l),s,n)),n=s.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof Hu)this.cache.add(o);else if(o instanceof Mi)this.builder.ensureLine(null),this.builder.addMark(o,s,n),this.cache.reused.set(o,1),n=s.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof Mi&&s.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?s.length&&(s.length=n=0):o instanceof Mi&&(s.shift(),n=Math.min(n,s.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,i){let r=null,s=this.builder,n=-1,o=je.spans(this.decorations,e,i,{point:(a,l,u,c,h,d)=>{if(u instanceof Dn){if(this.disallowBlockEffectsFor[d]){if(u.block)throw new RangeError("Block decorations may not be specified via plugins");if(l>this.view.state.doc.lineAt(a).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(n=c.length,h>c.length)s.continueWidget(l-a);else{let f=u.widget||(u.block?yo.block:yo.inline),p=iE(u),v=this.cache.findWidget(f,l-a,p)||Tn.of(f,this.view,l-a,p);u.block?(u.startSide>0&&s.addLineStartIfNotCovered(r),s.addBlockWidget(v)):(s.ensureLine(r),s.addInlineWidget(v,c,h))}r=null}else r=rE(r,u);l>a&&this.text.skip(l-a)},span:(a,l,u,c)=>{for(let h=a;h<l;){let d=this.text.next(Math.min(512,l-h));d==null?(s.addLineStartIfNotCovered(r),s.addBreak(),h++):(s.ensureLine(r),s.addText(d,u,h==a?c:u.length),h+=d.length),r=null}n=u.length}});n>-1&&(this.openWidget=o>n),this.openWidget||s.addLineStartIfNotCovered(r),this.openMarks=o}forward(e,i,r=1){i-e<=10?this.old.advance(i-e,r,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(i-e-10,-1),this.old.advance(5,r,this.reuseWalker))}getCompositionContext(e){let i=[],r=null;for(let s=e.parentNode;;s=s.parentNode){let n=yt.get(s);if(s==this.view.contentDOM)break;n instanceof Mi?i.push(n):n!=null&&n.isLine()?r=n:n instanceof os||(s.nodeName=="DIV"&&!r&&s!=this.view.contentDOM?r=new _o(s,Kb):r||i.push(Mi.of(new Za({tagName:s.nodeName.toLowerCase(),attributes:MA(s)}),s)))}return{line:r,marks:i}}}function $g(t,e){let i=r=>{for(let s of r.children)if((e?s.isText():s.length)||i(s))return!0;return!1};return i(t)}function iE(t){let e=t.isReplace?(t.startSide<0?64:0)|(t.endSide>0?128:0):t.startSide>0?32:16;return t.block&&(e|=256),e}const Kb={class:"cm-line"};function rE(t,e){let i=e.spec.attributes,r=e.spec.class;return!i&&!r||(t||(t={class:"cm-line"}),i&&o1(i,t),r&&(t.class+=" "+r)),t}function sE(t){let e=[];for(let i=t.parents.length;i>1;i--){let r=i==t.parents.length?t.tile:t.parents[i].tile;r instanceof Mi&&e.push(r.mark)}return e}function Nc(t){let e=yt.get(t);return e&&e.setDOM(t.cloneNode()),t}class yo extends Xs{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}yo.inline=new yo("span");yo.block=new yo("div");const Lc=new class extends Xs{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class qg{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=qe.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new A0(e,e.contentDOM),this.updateInner([new ir(0,0,0,e.state.doc.length)],null)}update(e){var i;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:c,toA:h})=>h<this.minWidthFrom||c>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((i=this.domChanged)===null||i===void 0)&&i.newSel?s=this.domChanged.newSel.head:!fE(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let n=s>-1?oE(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){let{from:c,to:h}=this.hasComposition;r=new ir(c,h,e.changes.mapPos(c,-1),e.changes.mapPos(h,1)).addToSet(r.slice())}this.hasComposition=n?{from:n.range.fromB,to:n.range.toB}:null,(me.ie||me.chrome)&&!n&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.blockWrappers;this.updateDeco();let l=uE(o,this.decorations,e.changes);l.length&&(r=ir.extendWithRanges(r,l));let u=hE(a,this.blockWrappers,e.changes);return u.length&&(r=ir.extendWithRanges(r,u)),n&&!r.some(c=>c.fromA<=n.range.fromA&&c.toA>=n.range.toA)&&(r=n.range.addToSet(r.slice())),this.tile.flags&2&&r.length==0?!1:(this.updateInner(r,n),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,i){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(i||e.length){let o=this.tile,a=new tE(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);i&&yt.get(i.text)&&a.cache.reused.set(yt.get(i.text),2),this.tile=a.run(e,i),jd(o,a.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let n=me.chrome||me.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(n),n&&(n.written||r.selectionRange.focusNode!=n.node||!this.tile.dom.contains(n.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let n of this.tile.children)n.isWidget()&&n.widget instanceof Oc&&s.push(n.dom);r.updateGaps(s)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let i of e.transactions)for(let r of i.effects)r.is(zb)&&(this.editContextFormatting=r.value)}updateSelection(e=!1,i=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:r}=this.tile,s=this.view.root.activeElement,n=s==r,o=!n&&!(this.view.state.facet(ts)||r.tabIndex>-1)&&pa(r,this.view.observer.selectionRange)&&!(s&&r.contains(s));if(!(n||i||o))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,u,c;if(l.empty?c=u=this.inlineDOMNearPos(l.anchor,l.assoc||1):(c=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),u=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1)),me.gecko&&l.empty&&!this.hasComposition&&nE(u)){let d=document.createTextNode("");this.view.observer.ignore(()=>u.node.insertBefore(d,u.node.childNodes[u.offset]||null)),u=c=new cr(d,0),a=!0}let h=this.view.observer.selectionRange;(a||!h.focusNode||(!ma(u.node,u.offset,h.anchorNode,h.anchorOffset)||!ma(c.node,c.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,l))&&(this.view.observer.ignore(()=>{me.android&&me.chrome&&r.contains(h.focusNode)&&dE(h.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let d=Fa(this.view.root);if(d)if(l.empty){if(me.gecko){let f=aE(u.node,u.offset);if(f&&f!=3){let p=(f==1?kb:Cb)(u.node,u.offset);p&&(u=new cr(p.node,p.offset))}}d.collapse(u.node,u.offset),l.bidiLevel!=null&&d.caretBidiLevel!==void 0&&(d.caretBidiLevel=l.bidiLevel)}else if(d.extend){d.collapse(u.node,u.offset);try{d.extend(c.node,c.offset)}catch{}}else{let f=document.createRange();l.anchor>l.head&&([u,c]=[c,u]),f.setEnd(c.node,c.offset),f.setStart(u.node,u.offset),d.removeAllRanges(),d.addRange(f)}o&&this.view.root.activeElement==r&&(r.blur(),s&&s.focus())}),this.view.observer.setSelectionRange(u,c)),this.impreciseAnchor=u.precise?null:new cr(h.anchorNode,h.anchorOffset),this.impreciseHead=c.precise?null:new cr(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,i){return this.hasComposition&&i.empty&&ma(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==i.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,i=e.state.selection.main,r=Fa(e.root),{anchorNode:s,anchorOffset:n}=e.observer.selectionRange;if(!r||!i.empty||!i.assoc||!r.modify)return;let o=this.lineAt(i.head,i.assoc);if(!o)return;let a=o.posAtStart;if(i.head==a||i.head==a+o.length)return;let l=this.coordsAt(i.head,-1),u=this.coordsAt(i.head,1);if(!l||!u||l.bottom>u.top)return;let c=this.domAtPos(i.head+i.assoc,i.assoc);r.collapse(c.node,c.offset),r.modify("move",i.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=i.from&&r.collapse(s,n)}posFromDOM(e,i){let r=this.tile.nearest(e);if(!r)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let s=r.posAtStart;if(r.isComposite()){let n;if(e==r.dom)n=r.dom.childNodes[i];else{let o=cs(e)==0?0:i==0?-1:1;for(;;){let a=e.parentNode;if(a==r.dom)break;o==0&&a.firstChild!=a.lastChild&&(e==a.firstChild?o=-1:o=1),e=a}o<0?n=e:n=e.nextSibling}if(n==r.dom.firstChild)return s;for(;n&&!yt.get(n);)n=n.nextSibling;if(!n)return s+r.length;for(let o=0,a=s;;o++){let l=r.children[o];if(l.dom==n)return a;a+=l.length+l.breakAfter}}else return r.isText()?e==r.dom?s+i:s+(i?r.length:0):s}domAtPos(e,i){let{tile:r,offset:s}=this.tile.resolveBlock(e,i);return r.isWidget()?r.domPosFor(s,i):r.domIn(s,i)}inlineDOMNearPos(e,i){let r,s=-1,n=!1,o,a=-1,l=!1;return this.tile.blockTiles((u,c)=>{if(u.isWidget()){if(u.flags&32&&c>=e)return!0;u.flags&16&&(n=!0)}else{let h=c+u.length;if(c<=e&&(r=u,s=e-c,n=h<e),h>=e&&!o&&(o=u,a=e-c,l=c>e),c>e&&o)return!0}}),!r&&!o?this.domAtPos(e,i):(n&&o?r=null:l&&r&&(o=null),r&&i<0||!o?r.domIn(s,i):o.domIn(a,i))}coordsAt(e,i,r){let{tile:s,offset:n}=this.tile.resolveBlock(e,i);return s.isWidget()?s.widget instanceof Oc?null:s.coordsInWidget(n,i,!0):s.coordsIn(n,i,r)}lineAt(e,i){let{tile:r}=this.tile.resolveBlock(e,i);return r.isLine()?r:null}coordsForChar(e){let{tile:i,offset:r}=this.tile.resolveBlock(e,1);if(!i.isLine())return null;function s(n,o){if(n.isComposite())for(let a of n.children){if(a.length>=o){let l=s(a,o);if(l)return l}if(o-=a.length,o<0)break}else if(n.isText()&&o<n.length){let a=Pr(n.text,o);if(a==o)return null;let l=Ia(n.dom,o,a).getClientRects();for(let u=0;u<l.length;u++){let c=l[u];if(u==l.length-1||c.top<c.bottom&&c.left<c.right)return c}}return null}return s(i,r)}measureVisibleLineHeights(e){let i=[],{from:r,to:s}=e,n=this.view.contentDOM.clientWidth,o=n>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==Lt.LTR,u=0,c=(h,d,f)=>{for(let p=0;p<h.children.length&&!(d>s);p++){let v=h.children[p],_=d+v.length,w=v.dom.getBoundingClientRect(),{height:x}=w;if(f&&!p&&(u+=w.top-f.top),v instanceof os)_>r&&c(v,d,w);else if(d>=r&&(u>0&&i.push(-u),i.push(x+u),u=0,o)){let C=v.dom.lastChild,D=C?gu(C):[];if(D.length){let R=D[D.length-1],E=l?R.right-w.left:w.right-R.left;E>a&&(a=E,this.minWidth=n,this.minWidthFrom=d,this.minWidthTo=_)}}f&&p==h.children.length-1&&(u+=f.bottom-w.bottom),d=_+v.breakAfter}};return c(this.tile,0,null),i}textDirectionAt(e){let{tile:i}=this.tile.resolveBlock(e,1);return getComputedStyle(i.dom).direction=="rtl"?Lt.RTL:Lt.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let a=0,l;for(let u of o.children){if(!u.isText()||/[^ -~]/.test(u.text))return;let c=gu(u.dom);if(c.length!=1)return;a+=c[0].width,l=c[0].height}if(a)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:a/o.length,textHeight:l}}});if(e)return e;let i=document.createElement("div"),r,s,n;return i.className="cm-line",i.style.width="99999px",i.style.position="absolute",i.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(i);let o=gu(i.firstChild)[0];r=i.getBoundingClientRect().height,s=o&&o.width?o.width/27:7,n=o&&o.height?o.height:r,i.remove()}),{lineHeight:r,charWidth:s,textHeight:n}}computeBlockGapDeco(){let e=[],i=this.view.viewState;for(let r=0,s=0;;s++){let n=s==i.viewports.length?null:i.viewports[s],o=n?n.from-1:this.view.state.doc.length;if(o>r){let a=(i.lineBlockAt(o).bottom-i.lineBlockAt(r).top)/this.view.scaleY;e.push(qe.replace({widget:new Oc(a),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!n)break;r=n.to+1}return qe.set(e)}updateDeco(){let e=1,i=this.view.state.facet(k0).map(n=>(this.dynamicDecorationMap[e++]=typeof n=="function")?n(this.view):n),r=!1,s=this.view.state.facet(d1).map((n,o)=>{let a=typeof n=="function";return a&&(r=!0),a?n(this.view):n});for(s.length&&(this.dynamicDecorationMap[e++]=r,i.push(je.join(s))),this.decorations=[this.editContextFormatting,...i,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(Hb).map(n=>typeof n=="function"?n(this.view):n)}scrollIntoView(e){if(e.isSnapshot){let u=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=u.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let u of this.view.state.facet(Ib))try{if(u(this.view,e.range,e))return!0}catch(c){Ir(this.view.state,c,"scroll handler")}let{range:i}=e,r=this.coordsAt(i.head,i.assoc||(i.head>i.anchor?-1:1)),s;if(!r)return;!i.empty&&(s=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(r={left:Math.min(r.left,s.left),top:Math.min(r.top,s.top),right:Math.max(r.right,s.right),bottom:Math.max(r.bottom,s.bottom)});let n=Wb(this.view),o={left:r.left-n.left,top:r.top-n.top,right:r.right+n.right,bottom:r.bottom+n.bottom},{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;if(RA(this.view.scrollDOM,o,i.head<i.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,a),-a),Math.max(Math.min(e.yMargin,l),-l),this.view.textDirection==Lt.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(r.top>window.visualViewport.offsetTop+window.visualViewport.height||r.bottom<window.visualViewport.offsetTop)){let u=this.view.docView.lineAt(i.head,1);if(u){let c=yb(u.dom);u.dom.scrollIntoView({block:"nearest"}),wb(c,!1)}}}lineHasWidget(e){let i=r=>r.isWidget()||r.children.some(i);return i(this.tile.resolveBlock(e,1).tile)}destroy(){jd(this.tile)}}function jd(t,e){let i=e==null?void 0:e.get(t);if(i!=1){i==null&&t.destroy();for(let r of t.children)jd(r,e)}}function nE(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}function Vb(t,e){let i=t.observer.selectionRange;if(!i.focusNode)return null;let r=kb(i.focusNode,i.focusOffset),s=Cb(i.focusNode,i.focusOffset),n=r||s;if(s&&r&&s.node!=r.node){let a=yt.get(s.node);if(!a||a.isText()&&a.text!=s.node.nodeValue)n=s;else if(t.docView.lastCompositionAfterCursor){let l=yt.get(r.node);!l||l.isText()&&l.text!=r.node.nodeValue||(n=s)}}if(t.docView.lastCompositionAfterCursor=n!=r,!n)return null;let o=e-n.offset;return{from:o,to:o+n.node.nodeValue.length,node:n.node}}function oE(t,e,i){let r=Vb(t,i);if(!r)return null;let{node:s,from:n,to:o}=r,a=s.nodeValue;if(/[\n\r]/.test(a)||t.state.doc.sliceString(r.from,r.to)!=a)return null;let l=e.invertedDesc;return{range:new ir(l.mapPos(n),l.mapPos(o),n,o),text:s}}function aE(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e<t.childNodes.length&&t.childNodes[e].contentEditable=="false"?2:0)}let lE=class{constructor(){this.changes=[]}compareRange(e,i){no(e,i,this.changes)}comparePoint(e,i){no(e,i,this.changes)}boundChange(e){no(e,e,this.changes)}};function uE(t,e,i){let r=new lE;return je.compare(t,e,i,r),r.changes}class cE{constructor(){this.changes=[]}compareRange(e,i){no(e,i,this.changes)}comparePoint(){}boundChange(e){no(e,e,this.changes)}}function hE(t,e,i){let r=new cE;return je.compare(t,e,i,r),r.changes}function dE(t,e){for(let i=t;i&&i!=e;i=i.assignedSlot||i.parentNode)if(i.nodeType==1&&i.contentEditable=="false")return!0;return!1}function fE(t,e){let i=!1;return e&&t.iterChangedRanges((r,s)=>{r<e.to&&s>e.from&&(i=!0)}),i}class Oc extends Xs{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function pE(t,e,i=1){let r=t.charCategorizer(e),s=t.doc.lineAt(e),n=e-s.from;if(s.length==0)return ve.cursor(e);n==0?i=1:n==s.length&&(i=-1);let o=n,a=n;i<0?o=Pr(s.text,n,!1):a=Pr(s.text,n);let l=r(s.text.slice(o,a));for(;o>0;){let u=Pr(s.text,o,!1);if(r(s.text.slice(u,o))!=l)break;o=u}for(;a<s.length;){let u=Pr(s.text,a);if(r(s.text.slice(a,u))!=l)break;a=u}return ve.undirectionalRange(o+s.from,a+s.from)}function mE(t,e,i,r,s){let n=Math.round((r-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&i.height>t.defaultLineHeight*1.5){let a=t.viewState.heightOracle.textHeight,l=Math.floor((s-i.top-(t.defaultLineHeight-a)*.5)/a);n+=l*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(i.from,i.to);return i.from+SA(o,n,t.state.tabSize)}function gE(t,e,i){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){let s;for(let n of r.type){if(n.from>e)break;if(!(n.to<e)){if(n.from<e&&n.to>e)return n;(!s||n.type==Ti.Text&&(s.type!=n.type||(i<0?n.from<e:n.to>e)))&&(s=n)}}return s||r}return r}function vE(t,e,i,r){let s=gE(t,e.head,e.assoc||-1),n=!r||s.type!=Ti.Text||!(t.lineWrapping||s.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(n){let o=t.dom.getBoundingClientRect(),a=t.textDirectionAt(s.from),l=t.posAtCoords({x:i==(a==Lt.LTR)?o.right-1:o.left+1,y:(n.top+n.bottom)/2});if(l!=null)return ve.cursor(l,i?-1:1)}return ve.cursor(i?s.to:s.from,i?-1:1)}function Wg(t,e,i,r){let s=t.state.doc.lineAt(e.head),n=t.bidiSpans(s),o=t.textDirectionAt(s.from);for(let a=e,l=null;;){let u=qA(s,n,o,a,i),c=Tb;if(!u){if(s.number==(i?t.state.doc.lines:1))return a;c=`
322
+ `,s=t.state.doc.line(s.number+(i?1:-1)),n=t.bidiSpans(s),u=t.visualLineSide(s,!i)}if(l){if(!l(c))return a}else{if(!r)return u;l=r(c)}a=u}}function bE(t,e,i){let r=t.state.charCategorizer(e),s=r(i);return n=>{let o=r(n);return s==rs.Space&&(s=o),s==o}}function _E(t,e,i,r){let s=e.head,n=i?1:-1;if(s==(i?t.state.doc.length:0))return ve.cursor(s,e.assoc);let o=e.goalColumn,a,l=t.contentDOM.getBoundingClientRect(),u=t.coordsAtPos(s,e.assoc||((e.empty?i:e.head==e.from)?1:-1)),c=t.documentTop;if(u)o==null&&(o=u.left-l.left),a=n<0?u.top:u.bottom;else{let p=t.viewState.lineBlockAt(s);o==null&&(o=Math.min(l.right-l.left,t.defaultCharacterWidth*(s-p.from))),a=(n<0?p.top:p.bottom)+c}let h=l.left+o,d=t.viewState.heightOracle.textHeight>>1,f=r??d;for(let p=0;;p+=d){let v=a+(f+p)*n,_=Hd(t,{x:h,y:v},!1,n);if(i?v>l.bottom:v<l.top)return ve.cursor(_.pos,_.assoc);let w=t.coordsAtPos(_.pos,_.assoc),x=w?(w.top+w.bottom)/2:0;if(!w||(i?x>a:x<a))return ve.cursor(_.pos,_.assoc,void 0,o)}}function ga(t,e,i){for(;;){let r=0;for(let s of t)s.between(e-1,e+1,(n,o,a)=>{if(e>n&&e<o){let l=r||i||(e-n<o-e?-1:1);e=l<0?n:o,r=l}});if(!r)return e}}function Ub(t,e){let i=null;for(let r=0;r<e.ranges.length;r++){let s=e.ranges[r],n=null;if(s.empty){let o=ga(t,s.from,0);o!=s.from&&(n=ve.cursor(o,-1))}else{let o=ga(t,s.from,-1),a=ga(t,s.to,1);(o!=s.from||a!=s.to)&&(s.undirectional?n=ve.undirectionalRange(s.from,s.to):n=ve.range(s.from==s.anchor?o:a,s.from==s.head?o:a))}n&&(i||(i=e.ranges.slice()),i[r]=n)}return i?ve.create(i,e.mainIndex):e}function Pc(t,e,i){let r=ga(t.state.facet(el).map(s=>s(t)),i.from,e.head>i.from?-1:1);return r==i.from?i:ve.cursor(r,r<i.from?1:-1)}class Br{constructor(e,i){this.pos=e,this.assoc=i}}function Hd(t,e,i,r){let s=t.contentDOM.getBoundingClientRect(),n=s.top+t.viewState.paddingTop,{x:o,y:a}=e,l=a-n,u;for(;;){if(l<0)return new Br(0,1);if(l>t.viewState.docHeight)return new Br(t.state.doc.length,-1);if(u=t.elementAtHeight(l),r==null)break;if(u.type==Ti.Text){if(r<0?u.to<t.viewport.from:u.from>t.viewport.to)break;let d=t.docView.coordsAt(r<0?u.from:u.to,r>0?-1:1);if(d&&(r<0?d.top<=l+n:d.bottom>=l+n))break}let h=t.viewState.heightOracle.textHeight/2;l=r>0?u.bottom+h:u.top-h}if(t.viewport.from>=u.to||t.viewport.to<=u.from){if(i)return null;if(u.type==Ti.Text){let h=mE(t,s,u,o,a);return new Br(h,h==u.from?1:-1)}}if(u.type!=Ti.Text)return l<(u.top+u.bottom)/2?new Br(u.from,1):new Br(u.to,-1);let c=t.docView.lineAt(u.from,2);return(!c||c.length!=u.length)&&(c=t.docView.lineAt(u.from,-2)),new yE(t,o,a,t.textDirectionAt(u.from)).scanTile(c,u.from)}class yE{constructor(e,i,r,s){this.view=e,this.x=i,this.y=r,this.baseDir=s,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,i){let{line:r,spans:s}=this.bidiSpansAt(e);return s[Fr.find(s,e-r.from,-1,i)].level==this.baseDir}dirAt(e,i){let{line:r,spans:s}=this.bidiSpansAt(e);return s[Fr.find(s,e-r.from,-1,i)].dir}bidiIn(e,i){let{spans:r,line:s}=this.bidiSpansAt(e);return r.length>1||r.length&&(r[0].level!=this.baseDir||r[0].to+s.from<i)}scan(e,i,r=!1){let s=0,n=e.length-1,o=new Set,a=this.bidiIn(e[0],e[n]),l,u,c=-1,h=1e9,d;e:for(;s<n;){let p=n-s,v=s+n>>1;t:if(o.has(v)){for(let x=1;x<p;x++){let C=v+x;if(C>=n&&(C-=p),!o.has(C)){v=C;break t}}break e}o.add(v);let _=i(v),w=0;if(_)for(let x=0;x<_.length;x++){let C=_[x];if(!(C.width==0&&_.length>1))if(C.bottom<this.y)(!l||l.bottom<C.bottom)&&(l=C),w=1;else if(C.top>this.y)(!u||u.top>C.top)&&(u=C),w=-1;else{let D=C.left>this.x?this.x-C.left:C.right<this.x?this.x-C.right:0,R=Math.abs(D);R<h&&(c=v,h=R,d=C),D&&(w=D<0==(this.baseDir==Lt.LTR)?-1:1)}}w==-1&&(!a||this.baseDirAt(e[v],1))?n=v:w==1&&(!a||this.baseDirAt(e[v+1],-1))&&(s=v+1)}if(!d){if(!u&&!l)return{i:e[0],after:!1};let p=l&&(!u||this.y-l.bottom<u.top-this.y)?l:u;return this.y=(p.top+p.bottom)/2,this.scan(e,i,!0)}if(h&&!r){let{top:p,bottom:v}=d;if(l&&l.bottom>(p+p+v)/3)return this.y=l.bottom-1,this.scan(e,i,!0);if(u&&u.top<(p+v+v)/3)return this.y=u.top+1,this.scan(e,i,!0)}let f=(a?this.dirAt(e[c],1):this.baseDir)==Lt.LTR;return{i:c,after:this.x>(d.left+d.right)/2==f}}scanText(e,i){let r=[];for(let n=0;n<e.length;n=Pr(e.text,n))r.push(i+n);r.push(i+e.length);let s=this.scan(r,n=>{let o=r[n]-i,a=r[n+1]-i;return Ia(e.dom,o,a).getClientRects()});return s.after?new Br(r[s.i+1],-1):new Br(r[s.i],1)}scanTile(e,i){if(!e.length)return new Br(i,1);if(e.children.length==1){let a=e.children[0];if(a.isText())return this.scanText(a,i);if(a.isComposite())return this.scanTile(a,i)}let r=[i];for(let a=0,l=i;a<e.children.length;a++)r.push(l+=e.children[a].length);let s=this.scan(r,a=>{let l=e.children[a];return l.flags&48?null:(l.dom.nodeType==1?l.dom:Ia(l.dom,0,l.length)).getClientRects()}),n=e.children[s.i],o=r[s.i];return n.isText()?this.scanText(n,o):n.isComposite()?this.scanTile(n,o):s.after?new Br(r[s.i+1],-1):new Br(o,1)}}const Gn="￿";class wE{constructor(e,i){this.points=e,this.view=i,this.text="",this.lineSeparator=i.state.facet(Ke.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Gn}readRange(e,i){if(!e)return this;let r=e.parentNode;for(let s=e;;){this.findPointBefore(r,s);let n=this.text.length;this.readNode(s);let o=yt.get(s),a=s.nextSibling;if(a==i){o!=null&&o.breakAfter&&!a&&r!=this.view.contentDOM&&this.lineBreak();break}let l=yt.get(a);(o&&l?o.breakAfter:(o?o.breakAfter:Iu(s))||Iu(a)&&(s.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>n)&&!SE(a,i)&&this.lineBreak(),s=a}return this.findPointBefore(r,i),this}readTextNode(e){let i=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,i.length));for(let r=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let n=-1,o=1,a;if(this.lineSeparator?(n=i.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(a=s.exec(i))&&(n=a.index,o=a[0].length),this.append(i.slice(r,n<0?i.length:n)),n<0)break;if(this.lineBreak(),o>1)for(let l of this.points)l.node==e&&l.pos>this.text.length&&(l.pos-=o-1);r=n+o}}readNode(e){let i=yt.get(e),r=i&&i.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let s=r.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,i){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==i&&(r.pos=this.text.length)}findPointInside(e,i){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(xE(e,r.node,r.offset)?i:0))}}function xE(t,e,i){for(;;){if(!e||i<cs(e))return!1;if(e==t)return!0;i=Vs(e)+1,e=e.parentNode}}function SE(t,e){let i;for(;!(t==e||!t);t=t.nextSibling){let r=yt.get(t);if(!(r!=null&&r.isWidget()))return!1;r&&(i||(i=[])).push(r)}if(i)for(let r of i){let s=r.overrideDOMText;if(s!=null&&s.length)return!1}return!0}class Kg{constructor(e,i){this.node=e,this.offset=i,this.pos=-1}}class kE{constructor(e,i,r,s){this.typeOver=s,this.bounds=null,this.text="",this.domChanged=i>-1;let{impreciseHead:n,impreciseAnchor:o}=e.docView,a=e.state.selection;if(e.state.readOnly&&i>-1)this.newSel=null;else if(i>-1&&(this.bounds=Gb(e.docView.tile,i,r,0))){let l=n||o?[]:AE(e),u=new wE(l,e);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=EE(l,this.bounds.from)}else{let l=e.observer.selectionRange,u=n&&n.node==l.focusNode&&n.offset==l.focusOffset||!Od(e.contentDOM,l.focusNode)?a.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),c=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Od(e.contentDOM,l.anchorNode)?a.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),h=e.viewport;if((me.ios||me.chrome)&&u!=c&&Math.min(u,c)<=a.main.from&&Math.max(u,c)>=a.main.to&&(h.from>0||h.to<e.state.doc.length)){let d=Math.min(u,c),f=Math.max(u,c),p=h.from-d,v=h.to-f;(p==0||p==1||d==0)&&(v==0||v==-1||f==e.state.doc.length)&&(u=0,c=e.state.doc.length)}if(e.inputState.composing>-1&&a.ranges.length>1)this.newSel=a.replaceRange(ve.range(c,u));else if(e.lineWrapping&&c==u&&!(a.main.empty&&a.main.head==u)&&e.inputState.lastTouchTime>Date.now()-100){let d=e.coordsAtPos(u,-1),f=0;d&&(f=e.inputState.lastTouchY<=d.bottom?-1:1),this.newSel=ve.create([ve.cursor(u,f)])}else this.newSel=ve.single(c,u)}}}function Gb(t,e,i,r){if(t.isComposite()){let s=-1,n=-1,o=-1,a=-1;for(let l=0,u=r,c=r;l<t.children.length;l++){let h=t.children[l],d=u+h.length;if(u<e&&d>i)return Gb(h,e,i,u);if(d>=e&&s==-1&&(s=l,n=u),u>i&&h.dom.parentNode==t.dom){o=l,a=c;break}c=d,u=d+h.breakAfter}return{from:n,to:a<0?r+t.length:a,startDOM:(s?t.children[s-1].dom.nextSibling:null)||t.dom.firstChild,endDOM:o<t.children.length&&o>=0?t.children[o].dom:null}}else return t.isText()?{from:r,to:r+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}function Yb(t,e){let i,{newSel:r}=e,{state:s}=t,n=s.selection.main,o=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:a,to:l}=e.bounds,u=n.from,c=null;(o===8||me.android&&e.text.length<l-a)&&(u=n.to,c="end");let h=s.doc.sliceString(a,l,Gn),d,f;!n.empty&&n.from>=a&&n.to<=l&&(e.typeOver||h!=e.text)&&h.slice(0,n.from-a)==e.text.slice(0,n.from-a)&&h.slice(n.to-a)==e.text.slice(d=e.text.length-(h.length-(n.to-a)))?i={from:n.from,to:n.to,insert:Ve.of(e.text.slice(n.from-a,d).split(Gn))}:(f=Xb(h,e.text,u-a,c))&&(me.chrome&&o==13&&f.toB==f.from+2&&e.text.slice(f.from,f.toB)==Gn+Gn&&f.toB--,i={from:a+f.from,to:a+f.toA,insert:Ve.of(e.text.slice(f.from,f.toB).split(Gn))})}else r&&(!t.hasFocus&&s.facet(ts)||qu(r,n))&&(r=null);if(!i&&!r)return!1;if((me.mac||me.android)&&i&&i.from==i.to&&i.from==n.head-1&&/^\. ?$/.test(i.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(r&&i.insert.length==2&&(r=ve.single(r.main.anchor-1,r.main.head-1)),i={from:i.from,to:i.to,insert:Ve.of([i.insert.toString().replace("."," ")])}):s.doc.lineAt(n.from).to<n.to&&t.docView.lineHasWidget(n.to)&&t.inputState.insertingTextAt>Date.now()-50?i={from:n.from,to:n.to,insert:s.toText(t.inputState.insertingText)}:me.chrome&&i&&i.from==i.to&&i.from==n.head&&i.insert.toString()==`
323
+ `&&t.lineWrapping&&(r&&(r=ve.single(r.main.anchor-1,r.main.head-1)),i={from:n.from,to:n.to,insert:Ve.of([" "])}),i)return f1(t,i,r,o);if(r&&!qu(r,n)){let a=!1,l="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(a=!0),l=t.inputState.lastSelectionOrigin,l=="select.pointer"&&(r=Ub(s.facet(el).map(u=>u(t)),r))),t.dispatch({selection:r,scrollIntoView:a,userEvent:l}),!0}else return!1}function f1(t,e,i,r=-1){if(me.ios&&t.inputState.flushIOSKey(e))return!0;let s=t.state.selection.main;if(me.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&t.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&oo(t.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>s.head)&&oo(t.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&oo(t.contentDOM,"Delete",46)))return!0;let n=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let o,a=()=>o||(o=CE(t,e,i));return t.state.facet(Ob).some(l=>l(t,e.from,e.to,n,a))||t.dispatch(a()),!0}function CE(t,e,i){let r,s=t.state,n=s.selection.main,o=-1;if(e.from==e.to&&e.from<n.from||e.from>n.to){let l=e.from<n.from?-1:1,u=l<0?n.from:n.to,c=ga(s.facet(el).map(h=>h(t)),u,l);e.from==c&&(o=c)}if(o>-1)r={changes:e,selection:ve.cursor(e.from+e.insert.length,-1)};else if(e.from>=n.from&&e.to<=n.to&&e.to-e.from>=(n.to-n.from)/3&&(!i||i.main.empty&&i.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let l=n.from<e.from?s.sliceDoc(n.from,e.from):"",u=n.to>e.to?s.sliceDoc(e.to,n.to):"";r=s.replaceSelection(t.state.toText(l+e.insert.sliceString(0,void 0,t.state.lineBreak)+u))}else{let l=s.changes(e),u=i&&i.main.to<=l.newLength?i.main:void 0;if(s.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=n.to+10&&e.to>=n.to-10){let c=t.state.sliceDoc(e.from,e.to),h,d=i&&Vb(t,i.main.head);if(d){let p=e.insert.length-(e.to-e.from);h={from:d.from,to:d.to-p}}else h=t.state.doc.lineAt(n.head);let f=n.to-e.to;r=s.changeByRange(p=>{if(p.from==n.from&&p.to==n.to)return{changes:l,range:u||p.map(l)};let v=p.to-f,_=v-c.length;if(t.state.sliceDoc(_,v)!=c||v>=h.from&&_<=h.to)return{range:p};let w=s.changes({from:_,to:v,insert:e.insert}),x=p.to-n.to;return{changes:w,range:u?ve.range(Math.max(0,u.anchor+x),Math.max(0,u.head+x)):p.map(w)}})}else r={changes:l,selection:u&&s.selection.replaceRange(u)}}let a="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,a+=".compose",t.inputState.compositionFirstChange&&(a+=".start",t.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:a,scrollIntoView:!0})}function Xb(t,e,i,r){let s=Math.min(t.length,e.length),n=0;for(;n<s&&t.charCodeAt(n)==e.charCodeAt(n);)n++;if(n==s&&t.length==e.length)return null;let o=t.length,a=e.length;for(;o>0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(r=="end"){let l=Math.max(0,n-Math.min(o,a));i-=o+l-n}if(o<n&&t.length<e.length){let l=i<=n&&i>=o?n-i:0;n-=l,a=n+(a-o),o=n}else if(a<n){let l=i<=n&&i>=a?n-i:0;n-=l,o=n+(o-a),a=n}return{from:n,toA:o,toB:a}}function AE(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:i,anchorOffset:r,focusNode:s,focusOffset:n}=t.observer.selectionRange;return i&&(e.push(new Kg(i,r)),(s!=i||n!=r)&&e.push(new Kg(s,n))),e}function EE(t,e){if(t.length==0)return null;let i=t[0].pos,r=t.length==2?t[1].pos:i;return i>-1&&r>-1?ve.single(i+e,r+e):null}function qu(t,e){return e.head==t.main.head&&e.anchor==t.main.anchor}class DE{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,me.safari&&e.contentDOM.addEventListener("input",()=>null),me.gecko&&WE(e.contentDOM.ownerDocument)}handleEvent(e){!FE(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,i){let r=this.handlers[e];if(r){for(let s of r.observers)s(this.view,i);for(let s of r.handlers){if(i.defaultPrevented)break;if(s(this.view,i)){i.preventDefault();break}}}}ensureHandlers(e){let i=TE(e),r=this.handlers,s=this.view.contentDOM;for(let n in i)if(n!="scroll"){let o=!i[n].handlers.length,a=r[n];a&&o!=!a.handlers.length&&(s.removeEventListener(n,this.handleEvent),a=null),a||s.addEventListener(n,this.handleEvent,{passive:o})}for(let n in r)n!="scroll"&&!i[n]&&s.removeEventListener(n,this.handleEvent);this.handlers=i}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&Zb.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),me.android&&me.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(me.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(Jb.some(i=>i.keyCode==e.keyCode)&&!e.ctrlKey||BE.indexOf(e.key)>-1&&e.ctrlKey)){let i={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};return i.shiftKey&&me.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&ME(this.view.win)&&(i.shiftKey=!1),this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:i},setTimeout(()=>this.flushIOSKey(),250),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let i=this.pendingIOSKey;return!i||i.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,oo(this.view.contentDOM,i.key,i.keyCode,i.mods))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:me.safari&&!me.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function ME(t){return t.visualViewport?t.visualViewport.height*t.visualViewport.scale/t.document.documentElement.clientHeight<.85:!1}function Vg(t,e){return(i,r)=>{try{return e.call(t,r,i)}catch(s){Ir(i.state,s)}}}function TE(t){let e=Object.create(null);function i(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let s=r.spec,n=s&&s.plugin.domEventHandlers,o=s&&s.plugin.domEventObservers;if(n)for(let a in n){let l=n[a];l&&i(a).handlers.push(Vg(r.value,l))}if(o)for(let a in o){let l=o[a];l&&i(a).observers.push(Vg(r.value,l))}}for(let r in pr)i(r).handlers.push(pr[r]);for(let r in _i)i(r).observers.push(_i[r]);return e}const Jb=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],BE="dthko",Zb=[16,17,18,20,91,92,224,225],Pl=6;function Fl(t){return Math.max(0,t)*.7+8}function RE(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class NE{constructor(e,i,r,s){this.view=e,this.startEvent=i,this.style=r,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=i,this.scrollParents=_b(e.contentDOM),this.atoms=e.state.facet(el).map(o=>o(e));let n=e.contentDOM.ownerDocument;n.addEventListener("mousemove",this.move=this.move.bind(this)),n.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=i.shiftKey,this.multiple=e.state.facet(Ke.allowMultipleSelections)&&LE(e,i),this.dragging=PE(e,i)&&t6(i)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&RE(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let i=0,r=0,s=0,n=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:n,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=Wb(this.view);e.clientX-l.left<=s+Pl?i=-Fl(s-e.clientX):e.clientX+l.right>=o-Pl&&(i=Fl(e.clientX-o)),e.clientY-l.top<=n+Pl?r=-Fl(n-e.clientY):e.clientY+l.bottom>=a-Pl&&(r=Fl(e.clientY-a)),this.setScrollSpeed(i,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,i){this.scrollSpeed={x:e,y:i},e||i?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:i}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),i&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=i,i=0),(e||i)&&this.view.win.scrollBy(e,i),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:i}=this,r=Ub(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(i.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(i=>i.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function LE(t,e){let i=t.state.facet(Bb);return i.length?i[0](e):me.mac?e.metaKey:e.ctrlKey}function OE(t,e){let i=t.state.facet(Rb);return i.length?i[0](e):me.mac?!e.altKey:!e.ctrlKey}function PE(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let r=Fa(t.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let n=0;n<s.length;n++){let o=s[n];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function FE(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let i=e.target,r;i!=t.contentDOM;i=i.parentNode)if(!i||i.nodeType==11||(r=yt.get(i))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(e))return!1;return!0}const pr=Object.create(null),_i=Object.create(null),Qb=me.ie&&me.ie_version<15||me.ios&&me.webkit_version<604;function IE(t){let e=t.dom.parentNode;if(!e)return;let i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout(()=>{t.focus(),i.remove(),e6(t,i.value)},50)}function E0(t,e,i){for(let r of t.facet(e))i=r(i,t);return i}function e6(t,e){e=E0(t.state,u1,e);let{state:i}=t,r,s=1,n=i.toText(e),o=n.lines==i.selection.ranges.length;if($d!=null&&i.selection.ranges.every(l=>l.empty)&&$d==n.toString()){let l=-1;r=i.changeByRange(u=>{let c=i.doc.lineAt(u.from);if(c.from==l)return{range:u};l=c.from;let h=i.toText((o?n.line(s++).text:e)+i.lineBreak);return{changes:{from:c.from,insert:h},range:ve.cursor(u.from+h.length)}})}else o?r=i.changeByRange(l=>{let u=n.line(s++);return{changes:{from:l.from,to:l.to,insert:u.text},range:ve.cursor(l.from+u.length)}}):r=i.replaceSelection(n);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}_i.scroll=t=>{let e=t.inputState;e.lastScrollTop=t.scrollDOM.scrollTop,e.lastScrollLeft=t.scrollDOM.scrollLeft,me.ios&&!e.touchActive&&(e.lastIOSMomentumScroll=Date.now())};_i.wheel=_i.mousewheel=t=>{t.inputState.lastWheelEvent=Date.now()};pr.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);_i.touchstart=(t,e)=>{let i=t.inputState,r=e.targetTouches[0];i.touchActive=!0,i.lastTouchTime=Date.now(),r&&(i.lastTouchX=r.clientX,i.lastTouchY=r.clientY),i.setSelectionOrigin("select.pointer")};_i.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};_i.touchend=(t,e)=>{t.inputState.touchActive=!1};pr.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let i=null;for(let r of t.state.facet(Nb))if(i=r(t,e),i)break;if(!i&&e.button==0&&(i=jE(t,e)),i){let r=!t.hasFocus;t.inputState.startMouseSelection(new NE(t,e,i,r)),r&&t.observer.ignore(()=>{xb(t.contentDOM);let n=t.root.activeElement;n&&!n.contains(t.contentDOM)&&n.blur()});let s=t.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function Ug(t,e,i,r){if(r==1)return ve.cursor(e,i);if(r==2)return pE(t.state,e,i);{let s=t.docView.lineAt(e,i),n=t.state.doc.lineAt(s?s.posAtEnd:e),o=s?s.posAtStart:n.from,a=s?s.posAtEnd:n.to;return a<t.state.doc.length&&a==n.to&&a++,ve.undirectionalRange(o,a)}}const zE=me.ie&&me.ie_version<=11;let Gg=null,Yg=0,Xg=0;function t6(t){if(!zE)return t.detail;let e=Gg,i=Xg;return Gg=t,Xg=Date.now(),Yg=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Yg+1)%3:1}function jE(t,e){let i=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),r=t6(e),s=t.state.selection;return{update(n){n.docChanged&&(i.pos=n.changes.mapPos(i.pos),s=s.map(n.changes))},get(n,o,a){let l=t.posAndSideAtCoords({x:n.clientX,y:n.clientY},!1),u,c=Ug(t,l.pos,l.assoc,r);if(i.pos!=l.pos&&!o){let h=Ug(t,i.pos,i.assoc,r),d=Math.min(h.from,c.from),f=Math.max(h.to,c.to);c=d<c.from?ve.range(d,f,c.assoc):ve.range(f,d,c.assoc)}return o?s.replaceRange(s.main.extend(c.from,c.to,c.assoc)):a&&r==1&&s.ranges.length>1&&(u=HE(s,l.pos))?u:a?s.addRange(c):ve.create([c])}}}function HE(t,e){for(let i=0;i<t.ranges.length;i++){let{from:r,to:s}=t.ranges[i];if(r<=e&&s>=e)return ve.create(t.ranges.slice(0,i).concat(t.ranges.slice(i+1)),t.mainIndex==i?0:t.mainIndex-(t.mainIndex>i?1:0))}return null}pr.dragstart=(t,e)=>{let{selection:{main:i}}=t.state;if(e.target.draggable){let s=t.docView.tile.nearest(e.target);if(s&&s.isWidget()){let n=s.posAtStart,o=n+s.length;(n>=i.to||o<=i.from)&&(i=ve.undirectionalRange(n,o))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=i,e.dataTransfer&&(e.dataTransfer.setData("Text",E0(t.state,c1,t.state.sliceDoc(i.from,i.to))),e.dataTransfer.effectAllowed="copyMove"),!1};pr.dragend=t=>(t.inputState.draggedContent=null,!1);function Jg(t,e,i,r){if(i=E0(t.state,u1,i),!i)return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:n}=t.inputState,o=r&&n&&OE(t,e)?{from:n.from,to:n.to}:null,a={from:s,insert:i},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}pr.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let i=e.dataTransfer.files;if(i&&i.length){let r=Array(i.length),s=0,n=()=>{++s==i.length&&Jg(t,e,r.filter(o=>o!=null).join(t.state.lineBreak),!1)};for(let o=0;o<i.length;o++){let a=new FileReader;a.onerror=n,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(r[o]=a.result),n()},a.readAsText(i[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return Jg(t,e,r,!0),!0}return!1};pr.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let i=Qb?null:e.clipboardData;return i?(e6(t,i.getData("text/plain")||i.getData("text/uri-list")),!0):(IE(t),!1)};function $E(t,e){let i=t.dom.parentNode;if(!i)return;let r=i.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function qE(t){let e=[],i=[],r=!1;for(let s of t.selection.ranges)s.empty||(e.push(t.sliceDoc(s.from,s.to)),i.push(s));if(!e.length){let s=-1;for(let{from:n}of t.selection.ranges){let o=t.doc.lineAt(n);o.number>s&&(e.push(o.text),i.push({from:o.from,to:Math.min(t.doc.length,o.to+1)})),s=o.number}r=!0}return{text:E0(t,c1,e.join(t.lineBreak)),ranges:i,linewise:r}}let $d=null;pr.copy=pr.cut=(t,e)=>{if(!pa(t.contentDOM,t.observer.selectionRange))return!1;let{text:i,ranges:r,linewise:s}=qE(t.state);if(!i&&!s)return!1;$d=s?i:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let n=Qb?null:e.clipboardData;return n?(n.clearData(),n.setData("text/plain",i),!0):($E(t,i),!1)};const i6=Ro.define();function r6(t,e){let i=[];for(let r of t.facet(Pb)){let s=r(t,e);s&&i.push(s)}return i.length?t.update({effects:i,annotations:i6.of(!0)}):null}function s6(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=r6(t.state,e);i?t.dispatch(i):t.update([])}},10)}_i.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),s6(t)};_i.blur=t=>{t.observer.clearSelectionRange(),s6(t)};_i.compositionstart=_i.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};_i.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,me.chrome&&me.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};_i.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};pr.beforeinput=(t,e)=>{var i,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let n=(i=e.dataTransfer)===null||i===void 0?void 0:i.getData("text/plain"),o=e.getTargetRanges();if(n&&o.length){let a=o[0],l=t.posAtDOM(a.startContainer,a.startOffset),u=t.posAtDOM(a.endContainer,a.endOffset);return f1(t,{from:l,to:u,insert:t.state.toText(n)},null),!0}}let s;if(me.chrome&&me.android&&(s=Jb.find(n=>n.inputType==e.inputType))&&(t.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let n=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>n+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return me.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),me.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>_i.compositionend(t,e),20),!1};const Zg=new Set;function WE(t){Zg.has(t)||(Zg.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const Qg=["pre-wrap","normal","pre-line","break-spaces"];let wo=!1;function e2(){wo=!1}class KE{constructor(e){this.lineWrapping=e,this.doc=Ve.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,i){let r=this.doc.lineAt(i).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((i-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Qg.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let i=!1;for(let r=0;r<e.length;r++){let s=e[r];s<0?r++:this.heightSamples[Math.floor(s*10)]||(i=!0,this.heightSamples[Math.floor(s*10)]=!0)}return i}refresh(e,i,r,s,n,o){let a=Qg.indexOf(e)>-1,l=Math.abs(i-this.lineHeight)>.3||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=i,this.charWidth=r,this.textHeight=s,this.lineLength=n,l){this.heightSamples={};for(let u=0;u<o.length;u++){let c=o[u];c<0?u++:this.heightSamples[Math.floor(c*10)]=!0}}return l}}class VE{constructor(e,i){this.from=e,this.heights=i,this.index=0}get more(){return this.index<this.heights.length}}class ur{constructor(e,i,r,s,n){this.from=e,this.length=i,this.top=r,this.height=s,this._content=n}get type(){return typeof this._content=="number"?Ti.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Dn?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let i=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new ur(this.from,this.length+e.length,this.top,this.height+e.height,i)}}var it=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(it||(it={}));const vu=.001;class bi{constructor(e,i,r=2){this.length=e,this.height=i,this.flags=r}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>vu&&(wo=!0),this.height=e)}replace(e,i,r){return bi.of(r)}decomposeLeft(e,i){i.push(this)}decomposeRight(e,i){i.push(this)}applyChanges(e,i,r,s){let n=this,o=r.doc;for(let a=s.length-1;a>=0;a--){let{fromA:l,toA:u,fromB:c,toB:h}=s[a],d=n.lineAt(l,it.ByPosNoHeight,r.setDoc(i),0,0),f=d.to>=u?d:n.lineAt(u,it.ByPosNoHeight,r,0,0);for(h+=f.to-u,u=f.to;a>0&&d.from<=s[a-1].toA;)l=s[a-1].fromA,c=s[a-1].fromB,a--,l<d.from&&(d=n.lineAt(l,it.ByPosNoHeight,r,0,0));c+=d.from-l,l=d.from;let p=p1.build(r.setDoc(o),e,c,h);n=Wu(n,n.replace(l,u,p))}return n.updateHeight(r,0)}static empty(){return new zi(0,0,0)}static of(e){if(e.length==1)return e[0];let i=0,r=e.length,s=0,n=0;for(;;)if(i==r)if(s>n*2){let a=e[i-1];a.break?e.splice(--i,1,a.left,null,a.right):e.splice(--i,1,a.left,a.right),r+=1+a.break,s-=a.size}else if(n>s*2){let a=e[r];a.break?e.splice(r,1,a.left,null,a.right):e.splice(r,1,a.left,a.right),r+=2+a.break,n-=a.size}else break;else if(s<n){let a=e[i++];a&&(s+=a.size)}else{let a=e[--r];a&&(n+=a.size)}let o=0;return e[i-1]==null?(o=1,i--):e[i]==null&&(o=1,r++),new GE(bi.of(e.slice(0,i)),o,bi.of(e.slice(r)))}}function Wu(t,e){return t==e?t:(t.constructor!=e.constructor&&(wo=!0),e)}bi.prototype.size=1;const UE=qe.replace({});class n6 extends bi{constructor(e,i,r){super(e,i),this.deco=r,this.spaceAbove=0}mainBlock(e,i){return new ur(i,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,i,r,s){return this.spaceAbove&&e<r+this.spaceAbove?new ur(s,0,r,this.spaceAbove,UE):this.mainBlock(r,s)}lineAt(e,i,r,s,n){let o=this.mainBlock(s,n);return this.spaceAbove?this.blockAt(0,r,s,n).join(o):o}forEachLine(e,i,r,s,n,o){e<=n+this.length&&i>=n&&o(this.lineAt(0,it.ByPos,r,s,n))}setMeasuredHeight(e){let i=e.heights[e.index++];i<0?(this.spaceAbove=-i,i=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(i)}updateHeight(e,i=0,r=!1,s){return s&&s.from<=i&&s.more&&this.setMeasuredHeight(s),this.outdated=!1,this}toString(){return`block(${this.length})`}}class zi extends n6{constructor(e,i,r){super(e,i,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(e,i){return new ur(i,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,i,r){let s=r[0];return r.length==1&&(s instanceof zi||s instanceof ti&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof ti?s=new zi(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):bi.of(r)}updateHeight(e,i=0,r=!1,s){return s&&s.from<=i&&s.more?this.setMeasuredHeight(s):(r||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class ti extends bi{constructor(e){super(e,0)}heightMetrics(e,i){let r=e.doc.lineAt(i).number,s=e.doc.lineAt(i+this.length).number,n=s-r+1,o,a=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*n);o=l/n,this.length>n+1&&(a=(this.height-l)/(this.length-n-1))}else o=this.height/n;return{firstLine:r,lastLine:s,perLine:o,perChar:a}}blockAt(e,i,r,s){let{firstLine:n,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(i,s);if(i.lineWrapping){let u=s+(e<i.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),c=i.doc.lineAt(u),h=a+c.length*l,d=Math.max(r,e-h/2);return new ur(c.from,c.length,d,h,0)}else{let u=Math.max(0,Math.min(o-n,Math.floor((e-r)/a))),{from:c,length:h}=i.doc.line(n+u);return new ur(c,h,r+a*u,a,0)}}lineAt(e,i,r,s,n){if(i==it.ByHeight)return this.blockAt(e,r,s,n);if(i==it.ByPosNoHeight){let{from:f,to:p}=r.doc.lineAt(e);return new ur(f,p-f,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(r,n),u=r.doc.lineAt(e),c=a+u.length*l,h=u.number-o,d=s+a*h+l*(u.from-n-h);return new ur(u.from,u.length,Math.max(s,Math.min(d,s+this.height-c)),c,0)}forEachLine(e,i,r,s,n,o){e=Math.max(e,n),i=Math.min(i,n+this.length);let{firstLine:a,perLine:l,perChar:u}=this.heightMetrics(r,n);for(let c=e,h=s;c<=i;){let d=r.doc.lineAt(c);if(c==e){let p=d.number-a;h+=l*p+u*(e-n-p)}let f=l+u*d.length;o(new ur(d.from,d.length,h,f,0)),h+=f,c=d.to+1}}replace(e,i,r){let s=this.length-i;if(s>0){let n=r[r.length-1];n instanceof ti?r[r.length-1]=new ti(n.length+s):r.push(null,new ti(s-1))}if(e>0){let n=r[0];n instanceof ti?r[0]=new ti(e+n.length):r.unshift(new ti(e-1),null)}return bi.of(r)}decomposeLeft(e,i){i.push(new ti(e-1),null)}decomposeRight(e,i){i.push(null,new ti(this.length-e-1))}updateHeight(e,i=0,r=!1,s){let n=i+this.length;if(s&&s.from<=i+this.length&&s.more){let o=[],a=Math.max(i,s.from),l=-1;for(s.from>i&&o.push(new ti(s.from-i-1).updateHeight(e,i));a<=n&&s.more;){let c=e.doc.lineAt(a).length;o.length&&o.push(null);let h=s.heights[s.index++],d=0;h<0&&(d=-h,h=s.heights[s.index++]),l==-1?l=h:Math.abs(h-l)>=vu&&(l=-2);let f=new zi(c,h,d);f.outdated=!1,o.push(f),a+=c+1}a<=n&&o.push(null,new ti(n-a).updateHeight(e,a));let u=bi.of(o);return(l<0||Math.abs(u.height-this.height)>=vu||Math.abs(l-this.heightMetrics(e,i).perLine)>=vu)&&(wo=!0),Wu(this,u)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(i,i+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class GE extends bi{constructor(e,i,r){super(e.length+i+r.length,e.height+r.height,i|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,i,r,s){let n=r+this.left.height;return e<n?this.left.blockAt(e,i,r,s):this.right.blockAt(e,i,n,s+this.left.length+this.break)}lineAt(e,i,r,s,n){let o=s+this.left.height,a=n+this.left.length+this.break,l=i==it.ByHeight?e<o:e<a,u=l?this.left.lineAt(e,i,r,s,n):this.right.lineAt(e,i,r,o,a);if(this.break||(l?u.to<a:u.from>a))return u;let c=i==it.ByPosNoHeight?it.ByPosNoHeight:it.ByPos;return l?u.join(this.right.lineAt(a,c,r,o,a)):this.left.lineAt(a,c,r,s,n).join(u)}forEachLine(e,i,r,s,n,o){let a=s+this.left.height,l=n+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,i,r,s,n,o),i>=l&&this.right.forEachLine(e,i,r,a,l,o);else{let u=this.lineAt(l,it.ByPos,r,s,n);e<u.from&&this.left.forEachLine(e,u.from-1,r,s,n,o),u.to>=e&&u.from<=i&&o(u),i>u.to&&this.right.forEachLine(u.to+1,i,r,a,l,o)}}replace(e,i,r){let s=this.left.length+this.break;if(i<s)return this.balanced(this.left.replace(e,i,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-s,i-s,r));let n=[];e>0&&this.decomposeLeft(e,n);let o=n.length;for(let a of r)n.push(a);if(e>0&&t2(n,o-1),i<this.length){let a=n.length;this.decomposeRight(i,n),t2(n,a)}return bi.of(n)}decomposeLeft(e,i){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,i);i.push(this.left),this.break&&(r++,e>=r&&i.push(null)),e>r&&this.right.decomposeLeft(e-r,i)}decomposeRight(e,i){let r=this.left.length,s=r+this.break;if(e>=s)return this.right.decomposeRight(e-s,i);e<r&&this.left.decomposeRight(e,i),this.break&&e<s&&i.push(null),i.push(this.right)}balanced(e,i){return e.size>2*i.size||i.size>2*e.size?bi.of(this.break?[e,null,i]:[e,i]):(this.left=Wu(this.left,e),this.right=Wu(this.right,i),this.setHeight(e.height+i.height),this.outdated=e.outdated||i.outdated,this.size=e.size+i.size,this.length=e.length+this.break+i.length,this)}updateHeight(e,i=0,r=!1,s){let{left:n,right:o}=this,a=i+n.length+this.break,l=null;return s&&s.from<=i+n.length&&s.more?l=n=n.updateHeight(e,i,r,s):n.updateHeight(e,i,r),s&&s.from<=a+o.length&&s.more?l=o=o.updateHeight(e,a,r,s):o.updateHeight(e,a,r),l?this.balanced(n,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function t2(t,e){let i,r;t[e]==null&&(i=t[e-1])instanceof ti&&(r=t[e+1])instanceof ti&&t.splice(e-1,3,new ti(i.length+1+r.length))}const YE=5;class p1{constructor(e,i){this.pos=e,this.oracle=i,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,i){if(this.lineStart>-1){let r=Math.min(i,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof zi?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new zi(r-this.pos,-1,0)),this.writtenTo=r,i>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=i}point(e,i,r){if(e<i||r.heightRelevant){let s=r.widget?r.widget.estimatedHeight:0,n=r.widget?r.widget.lineBreaks:0;s<0&&(s=this.oracle.lineHeight);let o=i-e;r.block?this.addBlock(new n6(o,s,r)):(o||n||s>=YE)&&this.addLineDeco(s,n,o)}else i>e&&this.span(e,i);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:i}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=i,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new zi(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,i){let r=new ti(i-e);return this.oracle.doc.lineAt(e).to==i&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof zi)return e;let i=new zi(0,-1,0);return this.nodes.push(i),i}addBlock(e){this.enterLine();let i=e.deco;i&&i.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,i&&i.endSide>0&&(this.covering=e)}addLineDeco(e,i,r){let s=this.ensureLine();s.length+=r,s.collapsed+=r,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=i,this.writtenTo=this.pos=this.pos+r}finish(e){let i=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(i instanceof zi)&&!this.isCovered?this.nodes.push(new zi(0,-1,0)):(this.writtenTo<this.pos||i==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let s of this.nodes)s instanceof zi&&s.updateHeight(this.oracle,r),r+=s?s.length:1;return this.nodes}static build(e,i,r,s){let n=new p1(r,e);return je.spans(i,r,s,n,0),n.finish(r)}}function XE(t,e,i){let r=new JE;return je.compare(t,e,i,r,0),r.changes}class JE{constructor(){this.changes=[]}compareRange(){}comparePoint(e,i,r,s){(e<i||r&&r.heightRelevant||s&&s.heightRelevant)&&no(e,i,this.changes,5)}}function ZE(t,e){let i=t.getBoundingClientRect(),r=t.ownerDocument,s=r.defaultView||window,n=Math.max(0,i.left),o=Math.min(s.innerWidth,i.right),a=Math.max(0,i.top),l=Math.min(s.innerHeight,i.bottom);for(let u=t.parentNode;u&&u!=r.body;)if(u.nodeType==1){let c=u,h=window.getComputedStyle(c);if((c.scrollHeight>c.clientHeight||c.scrollWidth>c.clientWidth)&&h.overflow!="visible"){let d=c.getBoundingClientRect();n=Math.max(n,d.left),o=Math.min(o,d.right),a=Math.max(a,d.top),l=Math.min(u==t.parentNode?s.innerHeight:l,d.bottom)}u=h.position=="absolute"||h.position=="fixed"?c.offsetParent:c.parentNode}else if(u.nodeType==11)u=u.host;else break;return{left:n-i.left,right:Math.max(n,o)-i.left,top:a-(i.top+e),bottom:Math.max(a,l)-(i.top+e)}}function QE(t){let e=t.getBoundingClientRect(),i=t.ownerDocument.defaultView||window;return e.left<i.innerWidth&&e.right>0&&e.top<i.innerHeight&&e.bottom>0}function eD(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class Fc{constructor(e,i,r,s){this.from=e,this.to=i,this.size=r,this.displaySize=s}static same(e,i){if(e.length!=i.length)return!1;for(let r=0;r<e.length;r++){let s=e[r],n=i[r];if(s.from!=n.from||s.to!=n.to||s.size!=n.size)return!1}return!0}draw(e,i){return qe.replace({widget:new tD(this.displaySize*(i?e.scaleY:e.scaleX),i)}).range(this.from,this.to)}}class tD extends Xs{constructor(e,i){super(),this.size=e,this.vertical=i}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class i2{constructor(e,i){this.view=e,this.state=i,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=r2,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Lt.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let r=i.facet(h1).some(s=>typeof s!="function"&&s.class=="cm-lineWrapping");this.heightOracle=new KE(r),this.stateDeco=s2(i),this.heightMap=bi.empty().applyChanges(this.stateDeco,Ve.empty,this.heightOracle.setDoc(i.doc),[new ir(0,0,0,i.doc.length)]);for(let s=0;s<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());s++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=qe.set(this.lineGaps.map(s=>s.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:i}=this.state.selection;for(let r=0;r<=1;r++){let s=r?i.head:i.anchor;if(!e.some(({from:n,to:o})=>s>=n&&s<=o)){let{from:n,to:o}=this.lineBlockAt(s);e.push(new Il(n,o))}}return this.viewports=e.sort((r,s)=>r.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?r2:new m1(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(ra(e,this.scaler))})}update(e,i=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=s2(this.state);let s=e.changedRanges,n=ir.extendWithRanges(s,XE(r,this.stateDeco,e?e.changes:Mt.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);e2(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),n),(this.heightMap.height!=o||wo)&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let l=n.length?this.mapViewport(this.viewport,e.changes):this.viewport;(i&&(i.range.head<l.from||i.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,i));let u=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,e.flags|=this.updateForViewport(),(u||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),i&&(this.scrollTarget=i),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(KA)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,i=e.contentDOM,r=window.getComputedStyle(i),s=this.heightOracle,n=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Lt.RTL:Lt.LTR;let o=this.heightOracle.mustRefreshForWrapping(n)||this.mustMeasureContent==="refresh",a=i.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let u=0,c=0;if(a.width&&a.height){let{scaleX:R,scaleY:E}=bb(i,a);(R>.005&&Math.abs(this.scaleX-R)>.005||E>.005&&Math.abs(this.scaleY-E)>.005)&&(this.scaleX=R,this.scaleY=E,u|=16,o=l=!0)}let h=(parseInt(r.paddingTop)||0)*this.scaleY,d=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=h||this.paddingBottom!=d)&&(this.paddingTop=h,this.paddingBottom=d,u|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,u|=16);let f=_b(this.view.contentDOM,!1).y;f!=this.scrollParent&&(this.scrollParent=f,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=Sb(this.scrollParent||e.win);let v=(this.printing?eD:ZE)(i,this.paddingTop),_=v.top-this.pixelViewport.top,w=v.bottom-this.pixelViewport.bottom;this.pixelViewport=v;let x=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(x!=this.inView&&(this.inView=x,x&&(l=!0)),!this.inView&&!this.scrollTarget&&!QE(e.dom))return 0;let C=a.width;if((this.contentDOMWidth!=C||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,u|=16),l){let R=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(R)&&(o=!0),o||s.lineWrapping&&Math.abs(C-this.contentDOMWidth)>s.charWidth){let{lineHeight:E,charWidth:L,textHeight:q}=e.docView.measureTextSize();o=E>0&&s.refresh(n,E,L,q,Math.max(5,C/L),R),o&&(e.docView.minWidth=0,u|=16)}_>0&&w>0?c=Math.max(_,w):_<0&&w<0&&(c=Math.min(_,w)),e2();for(let E of this.viewports){let L=E.from==this.viewport.from?R:e.docView.measureVisibleLineHeights(E);this.heightMap=(o?bi.empty().applyChanges(this.stateDeco,Ve.empty,this.heightOracle,[new ir(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new VE(E.from,L))}wo&&(u|=2)}let D=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return D&&(u&2&&(u|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),u|=this.updateForViewport()),(u&2||D)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),u}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,i){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,n=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new Il(s.lineAt(o-r*1e3,it.ByHeight,n,0,0).from,s.lineAt(a+(1-r)*1e3,it.ByHeight,n,0,0).to);if(i){let{head:u}=i.range;if(u<l.from||u>l.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),h=s.lineAt(u,it.ByPos,n,0,0),d;i.y=="center"?d=(h.top+h.bottom)/2-c/2:i.y=="start"||i.y=="nearest"&&u<l.from?d=h.top:d=h.bottom-c,l=new Il(s.lineAt(d-1e3/2,it.ByHeight,n,0,0).from,s.lineAt(d+c+1e3/2,it.ByHeight,n,0,0).to)}}return l}mapViewport(e,i){let r=i.mapPos(e.from,-1),s=i.mapPos(e.to,1);return new Il(this.heightMap.lineAt(r,it.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,it.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:i},r=0){if(!this.inView)return!0;let{top:s}=this.heightMap.lineAt(e,it.ByPos,this.heightOracle,0,0),{bottom:n}=this.heightMap.lineAt(i,it.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(e==0||s<=o-Math.max(10,Math.min(-r,250)))&&(i==this.state.doc.length||n>=a+Math.max(10,Math.min(r,250)))&&s>o-2*1e3&&n<a+2*1e3}mapLineGaps(e,i){if(!e.length||i.empty)return e;let r=[];for(let s of e)i.touchesRange(s.from,s.to)||r.push(new Fc(i.mapPos(s.from),i.mapPos(s.to),s.size,s.displaySize));return r}ensureLineGaps(e,i){let r=this.heightOracle.lineWrapping,s=r?1e4:2e3,n=s>>1,o=s<<1;if(this.defaultTextDirection!=Lt.LTR&&!r)return[];let a=[],l=(c,h,d,f)=>{if(h-c<n)return;let p=this.state.selection.main,v=[p.from];p.empty||v.push(p.to);for(let w of v)if(w>c&&w<h){l(c,w-10,d,f),l(w+10,h,d,f);return}let _=rD(e,w=>w.from>=d.from&&w.to<=d.to&&Math.abs(w.from-c)<n&&Math.abs(w.to-h)<n&&!v.some(x=>w.from<x&&w.to>x));if(!_){if(h<d.to&&i&&r&&i.visibleRanges.some(C=>C.from<=h&&C.to>=h)){let C=i.moveToLineBoundary(ve.cursor(h),!1,!0).head;C>c&&(h=C)}let w=this.gapSize(d,c,h,f),x=r||w<2e6?w:2e6;_=new Fc(c,h,w,x)}a.push(_)},u=c=>{if(c.length<o||c.type!=Ti.Text)return;let h=iD(c.from,c.to,this.stateDeco);if(h.total<o)return;let d=this.scrollTarget?this.scrollTarget.range.head:null,f,p;if(r){let v=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,_,w;if(d!=null){let x=jl(h,d),C=((this.visibleBottom-this.visibleTop)/2+v)/c.height;_=x-C,w=x+C}else _=(this.visibleTop-c.top-v)/c.height,w=(this.visibleBottom-c.top+v)/c.height;f=zl(h,_),p=zl(h,w)}else{let v=h.total*this.heightOracle.charWidth,_=s*this.heightOracle.charWidth,w=0;if(v>2e6)for(let E of e)E.from>=c.from&&E.from<c.to&&E.size!=E.displaySize&&E.from*this.heightOracle.charWidth+w<this.pixelViewport.left&&(w=E.size-E.displaySize);let x=this.pixelViewport.left+w,C=this.pixelViewport.right+w,D,R;if(d!=null){let E=jl(h,d),L=((C-x)/2+_)/v;D=E-L,R=E+L}else D=(x-_)/v,R=(C+_)/v;f=zl(h,D),p=zl(h,R)}f>c.from&&l(c.from,f,c,h),p<c.to&&l(p,c.to,c,h)};for(let c of this.viewportLines)Array.isArray(c.type)?c.type.forEach(u):u(c);return a}gapSize(e,i,r,s){let n=jl(s,r)-jl(s,i);return this.heightOracle.lineWrapping?e.height*n:s.total*this.heightOracle.charWidth*n}updateLineGaps(e){Fc.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=qe.set(e.map(i=>i.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let i=this.stateDeco;this.lineGaps.length&&(i=i.concat(this.lineGapDeco));let r=[];je.spans(i,this.viewport.from,this.viewport.to,{span(n,o){r.push({from:n,to:o})},point(){}},20);let s=0;if(r.length!=this.visibleRanges.length)s=12;else for(let n=0;n<r.length&&!(s&8);n++){let o=this.visibleRanges[n],a=r[n];(o.from!=a.from||o.to!=a.to)&&(s|=4,e&&e.mapPos(o.from,-1)==a.from&&e.mapPos(o.to,1)==a.to||(s|=8))}return this.visibleRanges=r,s}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(i=>i.from<=e&&i.to>=e)||ra(this.heightMap.lineAt(e,it.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(i=>i.top<=e&&i.bottom>=e)||ra(this.heightMap.lineAt(this.scaler.fromDOM(e),it.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(e){let i=this.lineBlockAtHeight(e+8);return i.from>=this.viewport.from||this.viewportLines[0].top-e>200?i:this.viewportLines[0]}elementAtHeight(e){return ra(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Il{constructor(e,i){this.from=e,this.to=i}}function iD(t,e,i){let r=[],s=t,n=0;return je.spans(i,t,e,{span(){},point(o,a){o>s&&(r.push({from:s,to:o}),n+=o-s),s=a}},20),s<e&&(r.push({from:s,to:e}),n+=e-s),{total:n,ranges:r}}function zl({total:t,ranges:e},i){if(i<=0)return e[0].from;if(i>=1)return e[e.length-1].to;let r=Math.floor(t*i);for(let s=0;;s++){let{from:n,to:o}=e[s],a=o-n;if(r<=a)return n+r;r-=a}}function jl(t,e){let i=0;for(let{from:r,to:s}of t.ranges){if(e<=s){i+=e-r;break}i+=s-r}return i/t.total}function rD(t,e){for(let i of t)if(e(i))return i}const r2={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};function s2(t){let e=t.facet(k0).filter(r=>typeof r!="function"),i=t.facet(d1).filter(r=>typeof r!="function");return i.length&&e.push(je.join(i)),e}class m1{constructor(e,i,r){let s=0,n=0,o=0;this.viewports=r.map(({from:a,to:l})=>{let u=i.lineAt(a,it.ByPos,e,0,0).top,c=i.lineAt(l,it.ByPos,e,0,0).bottom;return s+=c-u,{from:a,to:l,top:u,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(i.height-s);for(let a of this.viewports)a.domTop=o+(a.top-n)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),n=a.bottom}toDOM(e){for(let i=0,r=0,s=0;;i++){let n=i<this.viewports.length?this.viewports[i]:null;if(!n||e<n.top)return s+(e-r)*this.scale;if(e<=n.bottom)return n.domTop+(e-n.top);r=n.bottom,s=n.domBottom}}fromDOM(e){for(let i=0,r=0,s=0;;i++){let n=i<this.viewports.length?this.viewports[i]:null;if(!n||e<n.domTop)return r+(e-s)/this.scale;if(e<=n.domBottom)return n.top+(e-n.domTop);r=n.bottom,s=n.domBottom}}eq(e){return e instanceof m1?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((i,r)=>i.from==e.viewports[r].from&&i.to==e.viewports[r].to):!1}}function ra(t,e){if(e.scale==1)return t;let i=e.toDOM(t.top),r=e.toDOM(t.bottom);return new ur(t.from,t.length,i,r-i,Array.isArray(t._content)?t._content.map(s=>ra(s,e)):t._content)}const Hl=we.define({combine:t=>t.join(" ")}),qd=we.define({combine:t=>t.indexOf(!0)>-1}),Wd=us.newName(),o6=us.newName(),a6=us.newName(),l6={"&light":"."+o6,"&dark":"."+a6};function Kd(t,e,i){return new us(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,s=>{if(s=="&")return t;if(!i||!i[s])throw new RangeError(`Unsupported selector: ${s}`);return i[s]}):t+" "+r}})}const sD=Kd("."+Wd,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{userSelect:"none",position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},".cm-panels-top":{top:"0"},".cm-panels-bottom":{bottom:"0"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},l6),nD={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Ic=me.ie&&me.ie_version<=11;class oD{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new NA,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(i=>{for(let r of i)this.queue.push(r);(me.ie&&me.ie_version<=11||me.ios&&e.composing)&&i.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&me.android&&e.constructor.EDIT_CONTEXT!==!1&&!(me.chrome&&me.chrome_version<126)&&(this.editContext=new lD(e),e.state.facet(ts)&&(e.contentDOM.editContext=this.editContext.editContext)),Ic&&(this.onCharData=i=>{this.queue.push({target:i.target,type:"characterData",oldValue:i.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var i;((i=this.view.docView)===null||i===void 0?void 0:i.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(i=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),i.length>0&&i[i.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(i=>{i.length>0&&i[i.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((i,r)=>i!=e[r]))){this.gapIntersection.disconnect();for(let i of e)this.gapIntersection.observe(i);this.gaps=e}}onSelectionChange(e){let i=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,s=this.selectionRange;if(r.state.facet(ts)?r.root.activeElement!=this.dom:!pa(this.dom,s))return;let n=s.anchorNode&&r.docView.tile.nearest(s.anchorNode);if(n&&n.isWidget()&&n.widget.ignoreEvent(e)){i||(this.selectionChanged=!1);return}(me.ie&&me.ie_version<=11||me.android&&me.chrome)&&!r.state.selection.main.empty&&s.focusNode&&ma(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,i=Fa(e.root);if(!i)return!1;let r=me.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&aD(this.view,i)||i;if(!r||this.selectionRange.eq(r))return!1;let s=pa(this.dom,r);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&OA(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),s&&(this.selectionChanged=!0),!0)}setSelectionRange(e,i){this.selectionRange.set(e.node,e.offset,i.node,i.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,i=null;for(let r=this.dom;r;)if(r.nodeType==1)!i&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:i||(i=this.scrollTargets.slice(0,e)),i&&i.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!i&&(i=this.scrollTargets.slice(0,e)),i){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=i)r.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,nD),Ic&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Ic&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,i){var r;if(!this.delayedAndroidKey){let s=()=>{let n=this.delayedAndroidKey;n&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=n.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&n.force&&oo(this.dom,n.key,n.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:i,force:this.lastChange<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let i=-1,r=-1,s=!1;for(let n of e){let o=this.readMutation(n);o&&(o.typeOver&&(s=!0),i==-1?{from:i,to:r}=o:(i=Math.min(o.from,i),r=Math.max(o.to,r)))}return{from:i,to:r,typeOver:s}}readChange(){let{from:e,to:i,typeOver:r}=this.processRecords(),s=this.selectionChanged&&pa(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let n=new kE(this.view,e,i,r);return this.view.docView.domChanged={newSel:n.newSel?n.newSel.main:null},n}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let i=this.readChange();if(!i)return this.view.requestMeasure(),!1;let r=this.view.state,s=Yb(this.view,i);return this.view.state==r&&(i.domChanged||i.newSel&&!qu(this.view.state.selection,i.newSel.main))&&this.view.update([]),s}readMutation(e){let i=this.view.docView.tile.nearest(e.target);if(!i||i.isWidget())return null;if(i.markDirty(e.type=="attributes"),e.type=="childList"){let r=n2(i,e.previousSibling||e.target.previousSibling,-1),s=n2(i,e.nextSibling||e.target.nextSibling,1);return{from:r?i.posAfter(r):i.posAtStart,to:s?i.posBefore(s):i.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:i.posAtStart,to:i.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(ts)!=e.state.facet(ts)&&(e.view.contentDOM.editContext=e.state.facet(ts)?this.editContext.editContext:null))}destroy(){var e,i,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(i=this.gapIntersection)===null||i===void 0||i.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function n2(t,e,i){for(;e;){let r=yt.get(e);if(r&&r.parent==t)return r;let s=e.parentNode;e=s!=t.dom?s:i>0?e.nextSibling:e.previousSibling}return null}function o2(t,e){let i=e.startContainer,r=e.startOffset,s=e.endContainer,n=e.endOffset,o=t.docView.domAtPos(t.state.selection.main.anchor,1);return ma(o.node,o.offset,s,n)&&([i,r,s,n]=[s,n,i,r]),{anchorNode:i,anchorOffset:r,focusNode:s,focusOffset:n}}function aD(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return o2(t,s)}let i=null;function r(s){s.preventDefault(),s.stopImmediatePropagation(),i=s.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),i?o2(t,i):null}class lD{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let i=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let s=e.state.selection.main,{anchor:n,head:o}=s,a=this.toEditorPos(r.updateRangeStart),l=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:a,drifted:!1});let u=l-a>r.text.length;a==this.from&&n<this.from?a=n:l==this.to&&n>this.to&&(l=n);let c=Xb(e.state.sliceDoc(a,l),r.text,(u?s.from:s.to)-a,u?"end":null);if(!c){let d=ve.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));qu(d,s)||e.dispatch({selection:d,userEvent:"select"});return}let h={from:c.from+a,to:c.toA+a,insert:Ve.of(r.text.slice(c.from,c.toB).split(`
324
+ `))};if((me.mac||me.android)&&h.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(h={from:a,to:l,insert:Ve.of([r.text.replace("."," ")])}),this.pendingContextChange=h,!e.state.readOnly){let d=this.to-this.from+(h.to-h.from+h.insert.length);f1(e,h,ve.single(this.toEditorPos(r.selectionStart,d),this.toEditorPos(r.selectionEnd,d)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),h.from<h.to&&!h.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(i.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(i.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],n=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);o<a;o++){let l=e.coordsForChar(o);n=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||n||new DOMRect,s.push(n)}i.updateCharacterBounds(r.rangeStart,s)},this.handlers.textformatupdate=r=>{let s=[];for(let n of r.getTextFormats()){let o=n.underlineStyle,a=n.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(n.rangeStart),u=this.toEditorPos(n.rangeEnd);if(l<u){let c=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;s.push(qe.mark({attributes:{style:c}}).range(l,u))}}}e.dispatch({effects:zb.of(qe.set(s))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)i.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{let s=Fa(r.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let i=0,r=!1,s=this.pendingContextChange;return e.changes.iterChanges((n,o,a,l,u)=>{if(r)return;let c=u.length-(o-n);if(s&&o>=s.to)if(s.from==n&&s.to==o&&s.insert.eq(u)){s=this.pendingContextChange=null,i+=c,this.to+=c;return}else s=null,this.revertPending(e.state);if(n+=i,o+=i,o<=this.from)this.from+=c,this.to+=c;else if(n<this.to){if(n<this.from||o>this.to||this.to-this.from+u.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(n),this.toContextPos(o),u.toString()),this.to+=c}i+=c}),s&&!r&&this.revertPending(e.state),!r}update(e){let i=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||i)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:i}=e.selection.main;this.from=Math.max(0,i-1e4),this.to=Math.min(e.doc.length,i+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let i=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(i.from),this.toContextPos(i.from+i.insert.length),e.doc.sliceString(i.from,i.to))}setSelection(e){let{main:i}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,i.anchor))),s=this.toContextPos(i.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(r,s)}rangeIsValid(e){let{head:i}=e.selection.main;return!(this.from>0&&i-this.from<500||this.to<e.doc.length&&this.to-i<500||this.to-this.from>1e4*3)}toEditorPos(e,i=this.to-this.from){e=Math.min(e,i);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let i=this.composing;return i&&i.drifted?i.contextBase+(e-i.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class xe{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var i;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(s=>s.forEach(n=>r(n,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||LA(e.parent)||document,this.viewState=new i2(this,e.state||Ke.create(e)),e.scrollTo&&e.scrollTo.is(Ol)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Zn).map(s=>new Rc(s));for(let s of this.plugins)s.update(this);this.observer=new oD(this),this.inputState=new DE(this),this.inputState.ensureHandlers(this.plugins),this.docView=new qg(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((i=document.fonts)===null||i===void 0)&&i.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let i=e.length==1&&e[0]instanceof ui?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(i,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let i=!1,r=!1,s,n=this.state;for(let d of e){if(d.startState!=n)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");n=d.state}if(this.destroyed){this.viewState.state=n;return}let o=this.hasFocus,a=0,l=null;e.some(d=>d.annotation(i6))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=r6(n,o),l||(a=1));let u=this.observer.delayedAndroidKey,c=null;if(u?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(n.doc)||!this.state.selection.eq(n.selection))&&(c=null)):this.observer.clear(),n.facet(Ke.phrases)!=this.state.facet(Ke.phrases))return this.setState(n);s=ju.create(this,n,e),s.flags|=a;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let d of e){if(h&&(h=h.map(d.changes)),d.scrollIntoView){let{main:f}=d.state.selection,{x:p,y:v}=this.state.facet(xe.cursorScrollMargin);h=new ao(f.empty?f:ve.cursor(f.head,f.head>f.anchor?-1:1),"nearest","nearest",v,p)}for(let f of d.effects)f.is(Ol)&&(h=f.value.clip(this.state))}this.viewState.update(s,h),this.bidiCache=Ku.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),i=this.docView.update(s),this.state.facet(ia)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(i,e.some(d=>d.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Hl)!=s.state.facet(Hl)&&(this.viewState.mustMeasureContent=!0),(i||r||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),i&&this.docViewUpdate(),!s.empty)for(let d of this.state.facet(zd))try{d(s)}catch(f){Ir(this.state,f,"update listener")}(l||c)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),c&&!Yb(this,c)&&u.force&&oo(this.contentDOM,u.key,u.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let i=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new i2(this,e),this.plugins=e.facet(Zn).map(r=>new Rc(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new qg(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}i&&this.focus(),this.requestMeasure()}updatePlugins(e){let i=e.startState.facet(Zn),r=e.state.facet(Zn);if(i!=r){let s=[];for(let n of r){let o=i.indexOf(n);if(o<0)s.push(new Rc(n));else{let a=this.plugins[o];a.mustUpdate=e,s.push(a)}}for(let n of this.plugins)n.mustUpdate!=e&&n.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s<this.plugins.length;s++)this.plugins[s].update(this);i!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let i=e.value;if(i&&i.docViewUpdate)try{i.docViewUpdate(this)}catch(r){Ir(this.state,r,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let i=null,r=this.viewState.scrollParent,s=this.viewState.getScrollOffset(),{scrollAnchorPos:n,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(Sb(r||this.win))n=-1,o=this.viewState.heightMap.height;else{let f=this.viewState.scrollAnchorAt(s);n=f.from,o=f.top}this.updateState=1;let l=this.viewState.measure();if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let u=[];l&4||([this.measureRequests,u]=[u,this.measureRequests]);let c=u.map(f=>{try{return f.read(this)}catch(p){return Ir(this.state,p),a2}}),h=ju.create(this,this.state,[]),d=!1;h.flags|=l,i?i.flags|=l:i=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),d=this.docView.update(h),d&&this.docViewUpdate());for(let f=0;f<u.length;f++)if(c[f]!=a2)try{let p=u[f];p.write&&p.write(c[f],this)}catch(p){Ir(this.state,p)}if(d&&this.docView.updateSelection(!0),!h.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let p=((n<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(n).top)-o)/this.scaleY;if((p>1||p<-1)&&!(me.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(r==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){s=s+p,r?n<0?r.scrollTop=r.scrollHeight:r.scrollTop+=p:this.win.scrollBy(0,p),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(i&&!i.empty)for(let a of this.state.facet(zd))a(i)}get themeClasses(){return Wd+" "+(this.state.facet(qd)?a6:o6)+" "+this.state.facet(Hl)}updateAttrs(){let e=l2(this,jb,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),i={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(ts)?"true":"false",class:"cm-content",style:`${me.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(i["aria-readonly"]="true"),l2(this,h1,i);let r=this.observer.ignore(()=>{let s=Fg(this.contentDOM,this.contentAttrs,i),n=Fg(this.dom,this.editorAttrs,e);return s||n});return this.editorAttrs=e,this.contentAttrs=i,r}showAnnouncements(e){let i=!0;for(let r of e)for(let s of r.effects)if(s.is(xe.announce)){i&&(this.announceDOM.textContent=""),i=!1;let n=this.announceDOM.appendChild(document.createElement("div"));n.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(ia);let e=this.state.facet(xe.cspNonce);us.mount(this.root,this.styleModules.concat(sD).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let i=0;i<this.measureRequests.length;i++)if(this.measureRequests[i].key===e.key){this.measureRequests[i]=e;return}}this.measureRequests.push(e)}}plugin(e){let i=this.pluginMap.get(e);return(i===void 0||i&&i.plugin!=e)&&this.pluginMap.set(e,i=this.plugins.find(r=>r.plugin==e)||null),i&&i.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,i,r){return Pc(this,e,Wg(this,e,i,r))}moveByGroup(e,i){return Pc(this,e,Wg(this,e,i,r=>bE(this,e.head,r)))}visualLineSide(e,i){let r=this.bidiSpans(e),s=this.textDirectionAt(e.from),n=r[i?r.length-1:0];return ve.cursor(n.side(i,s)+e.from,n.forward(!i,s)?1:-1)}moveToLineBoundary(e,i,r=!0){return vE(this,e,i,r)}moveVertically(e,i,r){return Pc(this,e,_E(this,e,i,r))}domAtPos(e,i=1){return this.docView.domAtPos(e,i)}posAtDOM(e,i=0){return this.docView.posFromDOM(e,i)}posAtCoords(e,i=!0){this.readMeasured();let r=Hd(this,e,i);return r&&r.pos}posAndSideAtCoords(e,i=!0){return this.readMeasured(),Hd(this,e,i)}coordsAtPos(e,i=1){this.readMeasured();let r=this.state.doc.lineAt(e),s=this.bidiSpans(r),n=s[Fr.find(s,e-r.from,-1,i)];return this.docView.coordsAt(e,i,n.dir==Lt.RTL)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Fb)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>uD)return Mb(e.length);let i=this.textDirectionAt(e.from),r;for(let n of this.bidiCache)if(n.from==e.from&&n.dir==i&&(n.fresh||Db(n.isolates,r=jg(this,e))))return n.order;r||(r=jg(this,e));let s=$A(e.text,i,r);return this.bidiCache.push(new Ku(e.from,e.to,i,r,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||me.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{xb(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,i={}){var r,s,n,o;return Ol.of(new ao(typeof e=="number"?ve.cursor(e):e,(r=i.y)!==null&&r!==void 0?r:"nearest",(s=i.x)!==null&&s!==void 0?s:"nearest",(n=i.yMargin)!==null&&n!==void 0?n:5,(o=i.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:i}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return Ol.of(new ao(ve.cursor(r.from),"start","start",r.top-e,i,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return qr.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return qr.define(()=>({}),{eventObservers:e})}static theme(e,i){let r=us.newName(),s=[Hl.of(r),ia.of(Kd(`.${r}`,e))];return i&&i.dark&&s.push(qd.of(!0)),s}static baseTheme(e){return Pn.lowest(ia.of(Kd("."+Wd,e,l6)))}static findFromDOM(e){var i;let r=e.querySelector(".cm-content"),s=r&&yt.get(r)||yt.get(e);return((i=s==null?void 0:s.root)===null||i===void 0?void 0:i.view)||null}}xe.styleModule=ia;xe.inputHandler=Ob;xe.clipboardInputFilter=u1;xe.clipboardOutputFilter=c1;xe.scrollHandler=Ib;xe.focusChangeEffect=Pb;xe.perLineTextDirection=Fb;xe.exceptionSink=Lb;xe.updateListener=zd;xe.editable=ts;xe.mouseSelectionStyle=Nb;xe.dragMovesSelection=Rb;xe.clickAddsSelectionRange=Bb;xe.decorations=k0;xe.blockWrappers=Hb;xe.outerDecorations=d1;xe.atomicRanges=el;xe.bidiIsolatedRanges=$b;xe.cursorScrollMargin=we.define({combine:t=>{let e=5,i=5;for(let r of t)typeof r=="number"?e=i=r:{x:e,y:i}=r;return{x:e,y:i}}});xe.scrollMargins=qb;xe.darkTheme=qd;xe.cspNonce=we.define({combine:t=>t.length?t[0]:""});xe.contentAttributes=h1;xe.editorAttributes=jb;xe.lineWrapping=xe.contentAttributes.of({class:"cm-lineWrapping"});xe.announce=at.define();const uD=4096,a2={};class Ku{constructor(e,i,r,s,n,o){this.from=e,this.to=i,this.dir=r,this.isolates=s,this.fresh=n,this.order=o}static update(e,i){if(i.empty&&!e.some(n=>n.fresh))return e;let r=[],s=e.length?e[e.length-1].dir:Lt.LTR;for(let n=Math.max(0,e.length-10);n<e.length;n++){let o=e[n];o.dir==s&&!i.touchesRange(o.from,o.to)&&r.push(new Ku(i.mapPos(o.from,1),i.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function l2(t,e,i){for(let r=t.state.facet(e),s=r.length-1;s>=0;s--){let n=r[s],o=typeof n=="function"?n(t):n;o&&o1(o,i)}return i}const cD=me.mac?"mac":me.windows?"win":me.linux?"linux":"key";function hD(t,e){const i=t.split(/-(?!$)/);let r=i[i.length-1];r=="Space"&&(r=" ");let s,n,o,a;for(let l=0;l<i.length-1;++l){const u=i[l];if(/^(cmd|meta|m)$/i.test(u))a=!0;else if(/^a(lt)?$/i.test(u))s=!0;else if(/^(c|ctrl|control)$/i.test(u))n=!0;else if(/^s(hift)?$/i.test(u))o=!0;else if(/^mod$/i.test(u))e=="mac"?a=!0:n=!0;else throw new Error("Unrecognized modifier name: "+u)}return s&&(r="Alt-"+r),n&&(r="Ctrl-"+r),a&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function $l(t,e,i){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),i!==!1&&e.shiftKey&&(t="Shift-"+t),t}const dD=Pn.default(xe.domEventHandlers({keydown(t,e){return vD(pD(e.state),t,e,"editor")}})),fD=we.define({enables:dD}),u2=new WeakMap;function pD(t){let e=t.facet(fD),i=u2.get(e);return i||u2.set(e,i=gD(e.reduce((r,s)=>r.concat(s),[]))),i}let Ns=null;const mD=4e3;function gD(t,e=cD){let i=Object.create(null),r=Object.create(null),s=(o,a)=>{let l=r[o];if(l==null)r[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},n=(o,a,l,u,c)=>{var h,d;let f=i[o]||(i[o]=Object.create(null)),p=a.split(/ (?!$)/).map(w=>hD(w,e));for(let w=1;w<p.length;w++){let x=p.slice(0,w).join(" ");s(x,!0),f[x]||(f[x]={preventDefault:!0,stopPropagation:!1,run:[C=>{let D=Ns={view:C,prefix:x,scope:o};return setTimeout(()=>{Ns==D&&(Ns=null)},mD),!0}]})}let v=p.join(" ");s(v,!1);let _=f[v]||(f[v]={preventDefault:!1,stopPropagation:!1,run:((d=(h=f._any)===null||h===void 0?void 0:h.run)===null||d===void 0?void 0:d.slice())||[]});l&&_.run.push(l),u&&(_.preventDefault=!0),c&&(_.stopPropagation=!0)};for(let o of t){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let u of a){let c=i[u]||(i[u]=Object.create(null));c._any||(c._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:h}=o;for(let d in c)c[d].run.push(f=>h(f,Vd))}let l=o[e]||o.key;if(l)for(let u of a)n(u,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&n(u,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return i}let Vd=null;function vD(t,e,i,r){Vd=e;let s=EA(e),n=aA(s,0),o=lA(n)==s.length&&s!=" ",a="",l=!1,u=!1,c=!1;Ns&&Ns.view==i&&Ns.scope==r&&(a=Ns.prefix+" ",Zb.indexOf(e.keyCode)<0&&(u=!0,Ns=null));let h=new Set,d=_=>{if(_){for(let w of _.run)if(!h.has(w)&&(h.add(w),w(i)))return _.stopPropagation&&(c=!0),!0;_.preventDefault&&(_.stopPropagation&&(c=!0),u=!0)}return!1},f=t[r],p,v;return f&&(d(f[a+$l(s,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(me.windows&&e.ctrlKey&&e.altKey)&&!(me.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(p=Ks[e.keyCode])&&p!=s?(d(f[a+$l(p,e,!0)])||e.shiftKey&&(v=Oa[e.keyCode])!=s&&v!=p&&d(f[a+$l(v,e,!1)]))&&(l=!0):o&&e.shiftKey&&d(f[a+$l(s,e,!0)])&&(l=!0),!l&&d(f._any)&&(l=!0)),u&&(l=!0),l&&c&&e.stopPropagation(),Vd=null,l}function yR(){return _D}const bD=qe.line({class:"cm-activeLine"}),_D=qr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,i=[];for(let r of t.state.selection.ranges){let s=t.lineBlockAt(r.head);s.from>e&&(i.push(bD.range(s.from)),e=s.from)}return qe.set(i)}},{decorations:t=>t.decorations});class mr extends En{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}mr.prototype.elementClass="";mr.prototype.toDOM=void 0;mr.prototype.mapMode=ji.TrackBefore;mr.prototype.startSide=mr.prototype.endSide=-1;mr.prototype.point=!0;const bu=we.define(),yD=we.define(),wD={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>je.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},va=we.define();function u6(t){return[c6(),va.of({...wD,...t})]}const c2=we.define({combine:t=>t.some(e=>e)});function c6(t){return[xD]}const xD=qr.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(va).map(e=>new d2(t,e)),this.fixed=!t.state.facet(c2);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(t){if(this.updateGutters(t)){let e=this.prevViewport,i=t.view.viewport,r=Math.min(e.to,i.to)-Math.max(e.from,i.from);this.syncGutters(r<(i.to-i.from)*.8)}if(t.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(c2)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let i=je.iter(this.view.state.facet(bu),this.view.viewport.from),r=[],s=this.gutters.map(n=>new SD(n,this.view.viewport,-this.view.documentPadding.top));for(let n of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(n.type)){let o=!0;for(let a of n.type)if(a.type==Ti.Text&&o){Ud(i,r,a.from);for(let l of s)l.line(this.view,a,r);o=!1}else if(a.widget)for(let l of s)l.widget(this.view,a)}else if(n.type==Ti.Text){Ud(i,r,n.from);for(let o of s)o.line(this.view,n,r)}else if(n.widget)for(let o of s)o.widget(this.view,n);for(let n of s)n.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(va),i=t.state.facet(va),r=t.docChanged||t.heightChanged||t.viewportChanged||!je.eq(t.startState.facet(bu),t.state.facet(bu),t.view.viewport.from,t.view.viewport.to);if(e==i)for(let s of this.gutters)s.update(t)&&(r=!0);else{r=!0;let s=[];for(let n of i){let o=e.indexOf(n);o<0?s.push(new d2(this.view,n)):(this.gutters[o].update(t),s.push(this.gutters[o]))}for(let n of this.gutters)n.dom.remove(),s.indexOf(n)<0&&n.destroy();for(let n of s)n.config.side=="after"?this.getDOMAfter().appendChild(n.dom):this.dom.appendChild(n.dom);this.gutters=s}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>xe.scrollMargins.of(e=>{let i=e.plugin(t);if(!i||i.gutters.length==0||!i.fixed)return null;let r=i.dom.offsetWidth*e.scaleX,s=i.domAfter?i.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Lt.LTR?{left:r,right:s}:{right:r,left:s}})});function h2(t){return Array.isArray(t)?t:[t]}function Ud(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class SD{constructor(e,i,r){this.gutter=e,this.height=r,this.i=0,this.cursor=je.iter(e.markers,i.from)}addElement(e,i,r){let{gutter:s}=this,n=(i.top-this.height)/e.scaleY,o=i.height/e.scaleY;if(this.i==s.elements.length){let a=new h6(e,o,n,r);s.elements.push(a),s.dom.appendChild(a.dom)}else s.elements[this.i].update(e,o,n,r);this.height=i.bottom,this.i++}line(e,i,r){let s=[];Ud(this.cursor,s,i.from),r.length&&(s=s.concat(r));let n=this.gutter.config.lineMarker(e,i,s);n&&s.unshift(n);let o=this.gutter;s.length==0&&!o.config.renderEmptyElements||this.addElement(e,i,s)}widget(e,i){let r=this.gutter.config.widgetMarker(e,i.widget,i),s=r?[r]:null;for(let n of e.state.facet(yD)){let o=n(e,i.widget,i);o&&(s||(s=[])).push(o)}s&&this.addElement(e,i,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let i=e.elements.pop();e.dom.removeChild(i.dom),i.destroy()}}}class d2{constructor(e,i){this.view=e,this.config=i,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in i.domEventHandlers)this.dom.addEventListener(r,s=>{let n=s.target,o;if(n!=this.dom&&this.dom.contains(n)){for(;n.parentNode!=this.dom;)n=n.parentNode;let l=n.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=s.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);i.domEventHandlers[r](e,a,s)&&s.preventDefault()});this.markers=h2(i.markers(e)),i.initialSpacer&&(this.spacer=new h6(e,0,0,[i.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let i=this.markers;if(this.markers=h2(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let r=e.view.viewport;return!je.eq(this.markers,i,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class h6{constructor(e,i,r,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,i,r,s)}update(e,i,r,s){this.height!=i&&(this.height=i,this.dom.style.height=i+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),kD(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,i){let r="cm-gutterElement",s=this.dom.firstChild;for(let n=0,o=0;;){let a=o,l=n<i.length?i[n++]:null,u=!1;if(l){let c=l.elementClass;c&&(r+=" "+c);for(let h=o;h<this.markers.length;h++)if(this.markers[h].compare(l)){a=h,u=!0;break}}else a=this.markers.length;for(;o<a;){let c=this.markers[o++];if(c.toDOM){c.destroy(s);let h=s.nextSibling;s.remove(),s=h}}if(!l)break;l.toDOM&&(u?s=s.nextSibling:this.dom.insertBefore(l.toDOM(e),s)),u&&o++}this.dom.className=r,this.markers=i}destroy(){this.setMarkers(null,[])}}function kD(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(!t[i].compare(e[i]))return!1;return!0}const CD=we.define(),AD=we.define(),Qn=we.define({combine(t){return yA(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,i){let r=Object.assign({},e);for(let s in i){let n=r[s],o=i[s];r[s]=n?(a,l,u)=>n(a,l,u)||o(a,l,u):o}return r}})}});class zc extends mr{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function jc(t,e){return t.state.facet(Qn).formatNumber(e,t.state)}const ED=va.compute([Qn],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(CD)},lineMarker(e,i,r){return r.some(s=>s.toDOM)?null:new zc(jc(e,e.state.doc.lineAt(i.from).number))},widgetMarker:(e,i,r)=>{for(let s of e.state.facet(AD)){let n=s(e,i,r);if(n)return n}return null},lineMarkerChange:e=>e.startState.facet(Qn)!=e.state.facet(Qn),initialSpacer(e){return new zc(jc(e,f2(e.state.doc.lines)))},updateSpacer(e,i){let r=jc(i.view,f2(i.view.state.doc.lines));return r==e.number?e:new zc(r)},domEventHandlers:t.facet(Qn).domEventHandlers,side:"before"}));function DD(t={}){return[Qn.of(t),c6(),ED]}function f2(t){let e=9;for(;e<t;)e=e*10+9;return e}const MD=new class extends mr{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},TD=bu.compute(["selection"],t=>{let e=[],i=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.head).from;s>i&&(i=s,e.push(MD.range(s)))}return je.of(e)});function wR(){return TD}const BD=1024;let RD=0,Hc=class{constructor(e,i){this.from=e,this.to=i}};class Ze{constructor(e={}){this.id=RD++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Ki.match(e)),i=>{let r=e(i);return r===void 0?null:[this,r]}}}Ze.closedBy=new Ze({deserialize:t=>t.split(" ")});Ze.openedBy=new Ze({deserialize:t=>t.split(" ")});Ze.group=new Ze({deserialize:t=>t.split(" ")});Ze.isolate=new Ze({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Ze.contextHash=new Ze({perNode:!0});Ze.lookAhead=new Ze({perNode:!0});Ze.mounted=new Ze({perNode:!0});class ba{constructor(e,i,r,s=!1){this.tree=e,this.overlay=i,this.parser=r,this.bracketed=s}static get(e){return e&&e.props&&e.props[Ze.mounted.id]}}const ND=Object.create(null);class Ki{constructor(e,i,r,s=0){this.name=e,this.props=i,this.id=r,this.flags=s}static define(e){let i=e.props&&e.props.length?Object.create(null):ND,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new Ki(e.name||"",i,e.id,r);if(e.props){for(let n of e.props)if(Array.isArray(n)||(n=n(s)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");i[n[0].id]=n[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let i=this.prop(Ze.group);return i?i.indexOf(e)>-1:!1}return this.id==e}static match(e){let i=Object.create(null);for(let r in e)for(let s of r.split(" "))i[s]=e[r];return r=>{for(let s=r.prop(Ze.group),n=-1;n<(s?s.length:0);n++){let o=i[n<0?r.name:s[n]];if(o)return o}}}}Ki.none=new Ki("",Object.create(null),0,8);class d6{constructor(e){this.types=e;for(let i=0;i<e.length;i++)if(e[i].id!=i)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let i=[];for(let r of this.types){let s=null;for(let n of e){let o=n(r);if(o){s||(s=Object.assign({},r.props));let a=o[1],l=o[0];l.combine&&l.id in s&&(a=l.combine(s[l.id],a)),s[l.id]=a}}i.push(s?new Ki(r.name,s,r.id,r.flags):r)}return new d6(i)}}const ql=new WeakMap,p2=new WeakMap;var kt;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays",t[t.EnterBracketed=16]="EnterBracketed"})(kt||(kt={}));class oi{constructor(e,i,r,s,n){if(this.type=e,this.children=i,this.positions=r,this.length=s,this.props=null,n&&n.length){this.props=Object.create(null);for(let[o,a]of n)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=ba.get(this);if(e&&!e.overlay)return e.tree.toString();let i="";for(let r of this.children){let s=r.toString();s&&(i&&(i+=","),i+=s)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(i.length?"("+i+")":""):i}cursor(e=0){return new Yd(this.topNode,e)}cursorAt(e,i=0,r=0){let s=ql.get(this)||this.topNode,n=new Yd(s);return n.moveTo(e,i),ql.set(this,n._tree),n}get topNode(){return new Bi(this,0,0,null)}resolve(e,i=0){let r=za(ql.get(this)||this.topNode,e,i,!1);return ql.set(this,r),r}resolveInner(e,i=0){let r=za(p2.get(this)||this.topNode,e,i,!0);return p2.set(this,r),r}resolveStack(e,i=0){return PD(this,e,i)}iterate(e){let{enter:i,leave:r,from:s=0,to:n=this.length}=e,o=e.mode||0,a=(o&kt.IncludeAnonymous)>0;for(let l=this.cursor(o|kt.IncludeAnonymous);;){let u=!1;if(l.from<=n&&l.to>=s&&(!a&&l.type.isAnonymous||i(l)!==!1)){if(l.firstChild())continue;u=!0}for(;u&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;u=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let i in this.props)e.push([+i,this.props[i]]);return e}balance(e={}){return this.children.length<=8?this:b1(Ki.none,this.children,this.positions,0,this.children.length,0,this.length,(i,r,s)=>new oi(this.type,i,r,s,this.propValues),e.makeTree||((i,r,s)=>new oi(Ki.none,i,r,s)))}static build(e){return FD(e)}}oi.empty=new oi(Ki.none,[],[],0);class g1{constructor(e,i){this.buffer=e,this.index=i}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new g1(this.buffer,this.index)}}class Us{constructor(e,i,r){this.buffer=e,this.length=i,this.set=r}get type(){return Ki.none}toString(){let e=[];for(let i=0;i<this.buffer.length;)e.push(this.childString(i)),i=this.buffer[i+3];return e.join(",")}childString(e){let i=this.buffer[e],r=this.buffer[e+3],s=this.set.types[i],n=s.name;if(/\W/.test(n)&&!s.isError&&(n=JSON.stringify(n)),e+=4,r==e)return n;let o=[];for(;e<r;)o.push(this.childString(e)),e=this.buffer[e+3];return n+"("+o.join(",")+")"}findChild(e,i,r,s,n){let{buffer:o}=this,a=-1;for(let l=e;l!=i&&!(f6(n,s,o[l+1],o[l+2])&&(a=l,r>0));l=o[l+3]);return a}slice(e,i,r){let s=this.buffer,n=new Uint16Array(i-e),o=0;for(let a=e,l=0;a<i;){n[l++]=s[a++],n[l++]=s[a++]-r;let u=n[l++]=s[a++]-r;n[l++]=s[a++]-e,o=Math.max(o,u)}return new Us(n,o,this.set)}}function f6(t,e,i,r){switch(t){case-2:return i<e;case-1:return r>=e&&i<e;case 0:return i<e&&r>e;case 1:return i<=e&&r>e;case 2:return r>e;case 4:return!0}}function za(t,e,i,r){for(var s;t.from==t.to||(i<1?t.from>=e:t.from>e)||(i>-1?t.to<=e:t.to<e);){let o=!r&&t instanceof Bi&&t.index<0?null:t.parent;if(!o)return t;t=o}let n=r?0:kt.IgnoreOverlays;if(r)for(let o=t,a=o.parent;a;o=a,a=o.parent)o instanceof Bi&&o.index<0&&((s=a.enter(e,i,n))===null||s===void 0?void 0:s.from)!=o.from&&(t=a);for(;;){let o=t.enter(e,i,n);if(!o)return t;t=o}}class p6{cursor(e=0){return new Yd(this,e)}getChild(e,i=null,r=null){let s=m2(this,e,i,r);return s.length?s[0]:null}getChildren(e,i=null,r=null){return m2(this,e,i,r)}resolve(e,i=0){return za(this,e,i,!1)}resolveInner(e,i=0){return za(this,e,i,!0)}matchContext(e){return Gd(this.parent,e)}enterUnfinishedNodesBefore(e){let i=this.childBefore(e),r=this;for(;i;){let s=i.lastChild;if(!s||s.to!=i.to)break;s.type.isError&&s.from==s.to?(r=i,i=s.prevSibling):i=s}return r}get node(){return this}get next(){return this.parent}}class Bi extends p6{constructor(e,i,r,s){super(),this._tree=e,this.from=i,this.index=r,this._parent=s}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,i,r,s,n=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,u=i>0?a.length:-1;e!=u;e+=i){let c=a[e],h=l[e]+o.from,d;if(!(!(n&kt.EnterBracketed&&c instanceof oi&&(d=ba.get(c))&&!d.overlay&&d.bracketed&&r>=h&&r<=h+c.length)&&!f6(s,r,h,h+c.length))){if(c instanceof Us){if(n&kt.ExcludeBuffers)continue;let f=c.findChild(0,c.buffer.length,i,r-h,s);if(f>-1)return new zr(new LD(o,c,e,h),null,f)}else if(n&kt.IncludeAnonymous||!c.type.isAnonymous||v1(c)){let f;if(!(n&kt.IgnoreMounts)&&(f=ba.get(c))&&!f.overlay)return new Bi(f.tree,h,e,o);let p=new Bi(c,h,e,o);return n&kt.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(i<0?c.children.length-1:0,i,r,s,n)}}}if(n&kt.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+i:e=i<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,i,r=0){let s;if(!(r&kt.IgnoreOverlays)&&(s=ba.get(this._tree))&&s.overlay){let n=e-this.from,o=r&kt.EnterBracketed&&s.bracketed;for(let{from:a,to:l}of s.overlay)if((i>0||o?a<=n:a<n)&&(i<0||o?l>=n:l>n))return new Bi(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,i,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function m2(t,e,i,r){let s=t.cursor(),n=[];if(!s.firstChild())return n;if(i!=null){for(let o=!1;!o;)if(o=s.type.is(i),!s.nextSibling())return n}for(;;){if(r!=null&&s.type.is(r))return n;if(s.type.is(e)&&n.push(s.node),!s.nextSibling())return r==null?n:[]}}function Gd(t,e,i=e.length-1){for(let r=t;i>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[i]&&e[i]!=r.name)return!1;i--}}return!0}class LD{constructor(e,i,r,s){this.parent=e,this.buffer=i,this.index=r,this.start=s}}class zr extends p6{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,i,r){super(),this.context=e,this._parent=i,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,i,r){let{buffer:s}=this.context,n=s.findChild(this.index+4,s.buffer[this.index+3],e,i-this.context.start,r);return n<0?null:new zr(this.context,this,n)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,i,r=0){if(r&kt.ExcludeBuffers)return null;let{buffer:s}=this.context,n=s.findChild(this.index+4,s.buffer[this.index+3],i>0?1:-1,e-this.context.start,i);return n<0?null:new zr(this.context,this,n)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,i=e.buffer[this.index+3];return i<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new zr(this.context,this._parent,i):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,i=this._parent?this._parent.index+4:0;return this.index==i?this.externalSibling(-1):new zr(this.context,this._parent,e.findChild(i,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],i=[],{buffer:r}=this.context,s=this.index+4,n=r.buffer[this.index+3];if(n>s){let o=r.buffer[this.index+1];e.push(r.slice(s,n,o)),i.push(0)}return new oi(this.type,e,i,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function m6(t){if(!t.length)return null;let e=0,i=t[0];for(let n=1;n<t.length;n++){let o=t[n];(o.from>i.from||o.to<i.to)&&(i=o,e=n)}let r=i instanceof Bi&&i.index<0?null:i.parent,s=t.slice();return r?s[e]=r:s.splice(e,1),new OD(s,i)}class OD{constructor(e,i){this.heads=e,this.node=i}get next(){return m6(this.heads)}}function PD(t,e,i){let r=t.resolveInner(e,i),s=null;for(let n=r instanceof Bi?r:r.context.parent;n;n=n.parent)if(n.index<0){let o=n.parent;(s||(s=[r])).push(o.resolve(e,i)),n=o}else{let o=ba.get(n.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new Bi(o.tree,o.overlay[0].from+n.from,-1,n);(s||(s=[r])).push(za(a,e,i,!1))}}return s?m6(s):r}class Yd{get name(){return this.type.name}constructor(e,i=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=i&~kt.EnterBracketed,e instanceof Bi)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,i){this.index=e;let{start:r,buffer:s}=this.buffer;return this.type=i||s.set.types[s.buffer[e]],this.from=r+s.buffer[e+1],this.to=r+s.buffer[e+2],!0}yield(e){return e?e instanceof Bi?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,i,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,i,r,this.mode));let{buffer:s}=this.buffer,n=s.findChild(this.index+4,s.buffer[this.index+3],e,i-this.buffer.start,r);return n<0?!1:(this.stack.push(this.index),this.yieldBuf(n))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,i,r=this.mode){return this.buffer?r&kt.ExcludeBuffers?!1:this.enterChild(1,e,i):this.yield(this._tree.enter(e,i,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&kt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&kt.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:i}=this.buffer,r=this.stack.length-1;if(e<0){let s=r<0?0:this.stack[r]+4;if(this.index!=s)return this.yieldBuf(i.findChild(s,this.index,-1,0,4))}else{let s=i.buffer[this.index+3];if(s<(r<0?i.buffer.length:i.buffer[this.stack[r]+3]))return this.yieldBuf(s)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let i,r,{buffer:s}=this;if(s){if(e>0){if(this.index<s.buffer.buffer.length)return!1}else for(let n=0;n<this.index;n++)if(s.buffer.buffer[n+3]<this.index)return!1;({index:i,parent:r}=s)}else({index:i,_parent:r}=this._tree);for(;r;{index:i,_parent:r}=r)if(i>-1)for(let n=i+e,o=e<0?-1:r._tree.children.length;n!=o;n+=e){let a=r._tree.children[n];if(this.mode&kt.IncludeAnonymous||a instanceof Us||!a.type.isAnonymous||v1(a))return!1}return!0}move(e,i){if(i&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,i=0){for(;(this.from==this.to||(i<1?this.from>=e:this.from>e)||(i>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,i););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,i=null,r=0;if(e&&e.context==this.buffer)e:for(let s=this.index,n=this.stack.length;n>=0;){for(let o=e;o;o=o._parent)if(o.index==s){if(s==this.index)return o;i=o,r=n+1;break e}s=this.stack[--n]}for(let s=r;s<this.stack.length;s++)i=new zr(this.buffer,i,this.stack[s]);return this.bufferNode=new zr(this.buffer,i,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,i){for(let r=0;;){let s=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(s=!0)}for(;;){if(s&&i&&i(this),s=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,s=!0}}}matchContext(e){if(!this.buffer)return Gd(this.node.parent,e);let{buffer:i}=this.buffer,{types:r}=i.set;for(let s=e.length-1,n=this.stack.length-1;s>=0;n--){if(n<0)return Gd(this._tree,e,s);let o=r[i.buffer[this.stack[n]]];if(!o.isAnonymous){if(e[s]&&e[s]!=o.name)return!1;s--}}return!0}}function v1(t){return t.children.some(e=>e instanceof Us||!e.type.isAnonymous||v1(e))}function FD(t){var e;let{buffer:i,nodeSet:r,maxBufferLength:s=BD,reused:n=[],minRepeatType:o=r.types.length}=t,a=Array.isArray(i)?new g1(i,i.length):i,l=r.types,u=0,c=0;function h(R,E,L,q,F,$){let{id:W,start:z,end:j,size:A}=a,O=c,T=u;if(A<0)if(a.next(),A==-1){let X=n[W];L.push(X),q.push(z-R);return}else if(A==-3){u=W;return}else if(A==-4){c=W;return}else throw new RangeError(`Unrecognized record size: ${A}`);let U=l[W],H,re,G=z-R;if(j-z<=s&&(re=_(a.pos-E,F))){let X=new Uint16Array(re.size-re.skip),oe=a.pos-re.size,I=X.length;for(;a.pos>oe;)I=w(re.start,X,I);H=new Us(X,j-re.start,r),G=re.start-R}else{let X=a.pos-A;a.next();let oe=[],I=[],Y=W>=o?W:-1,le=0,te=j;for(;a.pos>X;)Y>=0&&a.id==Y&&a.size>=0?(a.end<=te-s&&(p(oe,I,z,le,a.end,te,Y,O,T),le=oe.length,te=a.end),a.next()):$>2500?d(z,X,oe,I):h(z,X,oe,I,Y,$+1);if(Y>=0&&le>0&&le<oe.length&&p(oe,I,z,le,z,te,Y,O,T),oe.reverse(),I.reverse(),Y>-1&&le>0){let de=f(U,T);H=b1(U,oe,I,0,oe.length,0,j-z,de,de)}else H=v(U,oe,I,j-z,O-j,T)}L.push(H),q.push(G)}function d(R,E,L,q){let F=[],$=0,W=-1;for(;a.pos>E;){let{id:z,start:j,end:A,size:O}=a;if(O>4)a.next();else{if(W>-1&&j<W)break;W<0&&(W=A-s),F.push(z,j,A),$++,a.next()}}if($){let z=new Uint16Array($*4),j=F[F.length-2];for(let A=F.length-3,O=0;A>=0;A-=3)z[O++]=F[A],z[O++]=F[A+1]-j,z[O++]=F[A+2]-j,z[O++]=O;L.push(new Us(z,F[2]-j,r)),q.push(j-R)}}function f(R,E){return(L,q,F)=>{let $=0,W=L.length-1,z,j;if(W>=0&&(z=L[W])instanceof oi){if(!W&&z.type==R&&z.length==F)return z;(j=z.prop(Ze.lookAhead))&&($=q[W]+z.length+j)}return v(R,L,q,F,$,E)}}function p(R,E,L,q,F,$,W,z,j){let A=[],O=[];for(;R.length>q;)A.push(R.pop()),O.push(E.pop()+L-F);R.push(v(r.types[W],A,O,$-F,z-$,j)),E.push(F-L)}function v(R,E,L,q,F,$,W){if($){let z=[Ze.contextHash,$];W=W?[z].concat(W):[z]}if(F>25){let z=[Ze.lookAhead,F];W=W?[z].concat(W):[z]}return new oi(R,E,L,q,W)}function _(R,E){let L=a.fork(),q=0,F=0,$=0,W=L.end-s,z={size:0,start:0,skip:0};e:for(let j=L.pos-R;L.pos>j;){let A=L.size;if(L.id==E&&A>=0){z.size=q,z.start=F,z.skip=$,$+=4,q+=4,L.next();continue}let O=L.pos-A;if(A<0||O<j||L.start<W)break;let T=L.id>=o?4:0,U=L.start;for(L.next();L.pos>O;){if(L.size<0)if(L.size==-3||L.size==-4)T+=4;else break e;else L.id>=o&&(T+=4);L.next()}F=U,q+=A,$+=T}return(E<0||q==R)&&(z.size=q,z.start=F,z.skip=$),z.size>4?z:void 0}function w(R,E,L){let{id:q,start:F,end:$,size:W}=a;if(a.next(),W>=0&&q<o){let z=L;if(W>4){let j=a.pos-(W-4);for(;a.pos>j;)L=w(R,E,L)}E[--L]=z,E[--L]=$-R,E[--L]=F-R,E[--L]=q}else W==-3?u=q:W==-4&&(c=q);return L}let x=[],C=[];for(;a.pos>0;)h(t.start||0,t.bufferStart||0,x,C,-1,0);let D=(e=t.length)!==null&&e!==void 0?e:x.length?C[0]+x[0].length:0;return new oi(l[t.topID],x.reverse(),C.reverse(),D)}const g2=new WeakMap;function _u(t,e){if(!t.isAnonymous||e instanceof Us||e.type!=t)return 1;let i=g2.get(e);if(i==null){i=1;for(let r of e.children){if(r.type!=t||!(r instanceof oi)){i=1;break}i+=_u(t,r)}g2.set(e,i)}return i}function b1(t,e,i,r,s,n,o,a,l){let u=0;for(let p=r;p<s;p++)u+=_u(t,e[p]);let c=Math.ceil(u*1.5/8),h=[],d=[];function f(p,v,_,w,x){for(let C=_;C<w;){let D=C,R=v[C],E=_u(t,p[C]);for(C++;C<w;C++){let L=_u(t,p[C]);if(E+L>=c)break;E+=L}if(C==D+1){if(E>c){let L=p[D];f(L.children,L.positions,0,L.children.length,v[D]+x);continue}h.push(p[D])}else{let L=v[C-1]+p[C-1].length-R;h.push(b1(t,p,v,D,C,R,L,null,l))}d.push(R+x-n)}}return f(e,i,r,s,0),(a||l)(h,d,o)}class SR{constructor(){this.map=new WeakMap}setBuffer(e,i,r){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(i,r)}getBuffer(e,i){let r=this.map.get(e);return r&&r.get(i)}set(e,i){e instanceof zr?this.setBuffer(e.context.buffer,e.index,i):e instanceof Bi&&this.map.set(e.tree,i)}get(e){return e instanceof zr?this.getBuffer(e.context.buffer,e.index):e instanceof Bi?this.map.get(e.tree):void 0}cursorSet(e,i){e.buffer?this.setBuffer(e.buffer.buffer,e.index,i):this.map.set(e.tree,i)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Sn{constructor(e,i,r,s,n=!1,o=!1){this.from=e,this.to=i,this.tree=r,this.offset=s,this.open=(n?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,i=[],r=!1){let s=[new Sn(0,e.length,e,0,!1,r)];for(let n of i)n.to>e.length&&s.push(n);return s}static applyChanges(e,i,r=128){if(!i.length)return e;let s=[],n=1,o=e.length?e[0]:null;for(let a=0,l=0,u=0;;a++){let c=a<i.length?i[a]:null,h=c?c.fromA:1e9;if(h-l>=r)for(;o&&o.from<h;){let d=o;if(l>=d.from||h<=d.to||u){let f=Math.max(d.from,l)-u,p=Math.min(d.to,h)-u;d=f>=p?null:new Sn(f,p,d.tree,d.offset+u,a>0,!!c)}if(d&&s.push(d),o.to>h)break;o=n<e.length?e[n++]:null}if(!c)break;l=c.toA,u=c.toA-c.toB}return s}}class ID{startParse(e,i,r){return typeof e=="string"&&(e=new zD(e)),r=r?r.length?r.map(s=>new Hc(s.from,s.to)):[new Hc(0,0)]:[new Hc(0,e.length)],this.createParse(e,i||[],r)}parse(e,i,r){let s=this.startParse(e,i,r);for(;;){let n=s.advance();if(n)return n}}}class zD{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,i){return this.string.slice(e,i)}}new Ze({perNode:!0});let jD=0;class er{constructor(e,i,r,s){this.name=e,this.set=i,this.base=r,this.modified=s,this.id=jD++}toString(){let{name:e}=this;for(let i of this.modified)i.name&&(e=`${i.name}(${e})`);return e}static define(e,i){let r=typeof e=="string"?e:"?";if(e instanceof er&&(i=e),i!=null&&i.base)throw new Error("Can not derive from a modified tag");let s=new er(r,[],null,[]);if(s.set.push(s),i)for(let n of i.set)s.set.push(n);return s}static defineModifier(e){let i=new Vu(e);return r=>r.modified.indexOf(i)>-1?r:Vu.get(r.base||r,r.modified.concat(i).sort((s,n)=>s.id-n.id))}}let HD=0;class Vu{constructor(e){this.name=e,this.instances=[],this.id=HD++}static get(e,i){if(!i.length)return e;let r=i[0].instances.find(a=>a.base==e&&$D(i,a.modified));if(r)return r;let s=[],n=new er(e.name,s,e,i);for(let a of i)a.instances.push(n);let o=qD(i);for(let a of e.set)if(!a.modified.length)for(let l of o)s.push(Vu.get(a,l));return n}}function $D(t,e){return t.length==e.length&&t.every((i,r)=>i==e[r])}function qD(t){let e=[[]];for(let i=0;i<t.length;i++)for(let r=0,s=e.length;r<s;r++)e.push(e[r].concat(t[i]));return e.sort((i,r)=>r.length-i.length)}function WD(t){let e=Object.create(null);for(let i in t){let r=t[i];Array.isArray(r)||(r=[r]);for(let s of i.split(" "))if(s){let n=[],o=2,a=s;for(let h=0;;){if(a=="..."&&h>0&&h+3==s.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!d)throw new RangeError("Invalid path: "+s);if(n.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),h+=d[0].length,h==s.length)break;let f=s[h++];if(h==s.length&&f=="!"){o=0;break}if(f!="/")throw new RangeError("Invalid path: "+s);a=s.slice(h)}let l=n.length-1,u=n[l];if(!u)throw new RangeError("Invalid path: "+s);let c=new ja(r,o,l>0?n.slice(0,l):null);e[u]=c.sort(e[u])}}return g6.add(e)}const g6=new Ze({combine(t,e){let i,r,s;for(;t||e;){if(!t||e&&t.depth>=e.depth?(s=e,e=e.next):(s=t,t=t.next),i&&i.mode==s.mode&&!s.context&&!i.context)continue;let n=new ja(s.tags,s.mode,s.context);i?i.next=n:r=n,i=n}return r}});class ja{constructor(e,i,r,s){this.tags=e,this.mode=i,this.context=r,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}ja.empty=new ja([],2,null);function v6(t,e){let i=Object.create(null);for(let n of t)if(!Array.isArray(n.tag))i[n.tag.id]=n.class;else for(let o of n.tag)i[o.id]=n.class;let{scope:r,all:s=null}=e||{};return{style:n=>{let o=s;for(let a of n)for(let l of a.set){let u=i[l.id];if(u){o=o?o+" "+u:u;break}}return o},scope:r}}function KD(t,e){let i=null;for(let r of t){let s=r.style(e);s&&(i=i?i+" "+s:s)}return i}function b6(t,e,i,r=0,s=t.length){let n=new VD(r,Array.isArray(e)?e:[e],i);n.highlightRange(t.cursor(),r,s,"",n.highlighters),n.flush(s)}class VD{constructor(e,i,r){this.at=e,this.highlighters=i,this.span=r,this.class=""}startSpan(e,i){i!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=i)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,i,r,s,n){let{type:o,from:a,to:l}=e;if(a>=r||l<=i)return;o.isTop&&(n=this.highlighters.filter(f=>!f.scope||f.scope(o)));let u=s,c=UD(e)||ja.empty,h=KD(n,c.tags);if(h&&(u&&(u+=" "),u+=h,c.mode==1&&(s+=(s?" ":"")+h)),this.startSpan(Math.max(i,a),u),c.opaque)return;let d=e.tree&&e.tree.prop(Ze.mounted);if(d&&d.overlay){let f=e.node.enter(d.overlay[0].from+a,1),p=this.highlighters.filter(_=>!_.scope||_.scope(d.tree.type)),v=e.firstChild();for(let _=0,w=a;;_++){let x=_<d.overlay.length?d.overlay[_]:null,C=x?x.from+a:l,D=Math.max(i,w),R=Math.min(r,C);if(D<R&&v)for(;e.from<R&&(this.highlightRange(e,D,R,s,n),this.startSpan(Math.min(R,e.to),u),!(e.to>=C||!e.nextSibling())););if(!x||C>r)break;w=x.to+a,w>i&&(this.highlightRange(f.cursor(),Math.max(i,x.from+a),Math.min(r,w),"",p),this.startSpan(Math.min(r,w),u))}v&&e.parent()}else if(e.firstChild()){d&&(s="");do if(!(e.to<=i)){if(e.from>=r)break;this.highlightRange(e,i,r,s,n),this.startSpan(Math.min(r,e.to),u)}while(e.nextSibling());e.parent()}}}function UD(t){let e=t.type.prop(g6);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const he=er.define,Wl=he(),Ms=he(),v2=he(Ms),b2=he(Ms),Ts=he(),Kl=he(Ts),$c=he(Ts),Er=he(),un=he(Er),Sr=he(),kr=he(),Xd=he(),Ko=he(Xd),Vl=he(),be={comment:Wl,lineComment:he(Wl),blockComment:he(Wl),docComment:he(Wl),name:Ms,variableName:he(Ms),typeName:v2,tagName:he(v2),propertyName:b2,attributeName:he(b2),className:he(Ms),labelName:he(Ms),namespace:he(Ms),macroName:he(Ms),literal:Ts,string:Kl,docString:he(Kl),character:he(Kl),attributeValue:he(Kl),number:$c,integer:he($c),float:he($c),bool:he(Ts),regexp:he(Ts),escape:he(Ts),color:he(Ts),url:he(Ts),keyword:Sr,self:he(Sr),null:he(Sr),atom:he(Sr),unit:he(Sr),modifier:he(Sr),operatorKeyword:he(Sr),controlKeyword:he(Sr),definitionKeyword:he(Sr),moduleKeyword:he(Sr),operator:kr,derefOperator:he(kr),arithmeticOperator:he(kr),logicOperator:he(kr),bitwiseOperator:he(kr),compareOperator:he(kr),updateOperator:he(kr),definitionOperator:he(kr),typeOperator:he(kr),controlOperator:he(kr),punctuation:Xd,separator:he(Xd),bracket:Ko,angleBracket:he(Ko),squareBracket:he(Ko),paren:he(Ko),brace:he(Ko),content:Er,heading:un,heading1:he(un),heading2:he(un),heading3:he(un),heading4:he(un),heading5:he(un),heading6:he(un),contentSeparator:he(Er),list:he(Er),quote:he(Er),emphasis:he(Er),strong:he(Er),link:he(Er),monospace:he(Er),strikethrough:he(Er),inserted:he(),deleted:he(),changed:he(),invalid:he(),meta:Vl,documentMeta:he(Vl),annotation:he(Vl),processingInstruction:he(Vl),definition:er.defineModifier("definition"),constant:er.defineModifier("constant"),function:er.defineModifier("function"),standard:er.defineModifier("standard"),local:er.defineModifier("local"),special:er.defineModifier("special")};for(let t in be){let e=be[t];e instanceof er&&(e.name=t)}v6([{tag:be.link,class:"tok-link"},{tag:be.heading,class:"tok-heading"},{tag:be.emphasis,class:"tok-emphasis"},{tag:be.strong,class:"tok-strong"},{tag:be.keyword,class:"tok-keyword"},{tag:be.atom,class:"tok-atom"},{tag:be.bool,class:"tok-bool"},{tag:be.url,class:"tok-url"},{tag:be.labelName,class:"tok-labelName"},{tag:be.inserted,class:"tok-inserted"},{tag:be.deleted,class:"tok-deleted"},{tag:be.literal,class:"tok-literal"},{tag:be.string,class:"tok-string"},{tag:be.number,class:"tok-number"},{tag:[be.regexp,be.escape,be.special(be.string)],class:"tok-string2"},{tag:be.variableName,class:"tok-variableName"},{tag:be.local(be.variableName),class:"tok-variableName tok-local"},{tag:be.definition(be.variableName),class:"tok-variableName tok-definition"},{tag:be.special(be.variableName),class:"tok-variableName2"},{tag:be.definition(be.propertyName),class:"tok-propertyName tok-definition"},{tag:be.typeName,class:"tok-typeName"},{tag:be.namespace,class:"tok-namespace"},{tag:be.className,class:"tok-className"},{tag:be.macroName,class:"tok-macroName"},{tag:be.propertyName,class:"tok-propertyName"},{tag:be.operator,class:"tok-operator"},{tag:be.comment,class:"tok-comment"},{tag:be.meta,class:"tok-meta"},{tag:be.invalid,class:"tok-invalid"},{tag:be.punctuation,class:"tok-punctuation"}]);var qc;const eo=new Ze;function GD(t){return we.define({combine:t?e=>e.concat(t):void 0})}const YD=new Ze;class hr{constructor(e,i,r=[],s=""){this.data=e,this.name=s,Ke.prototype.hasOwnProperty("tree")||Object.defineProperty(Ke.prototype,"tree",{get(){return Ha(this)}}),this.parser=i,this.extension=[Bn.of(this),Ke.languageData.of((n,o,a)=>{let l=_2(n,o,a),u=l.type.prop(eo);if(!u)return[];let c=n.facet(u),h=l.type.prop(YD);if(h){let d=l.resolve(o-l.from,a);for(let f of h)if(f.test(d,n)){let p=n.facet(f.facet);return f.type=="replace"?p:p.concat(c)}}return c})].concat(r)}isActiveAt(e,i,r=-1){return _2(e,i,r).type.prop(eo)==this.data}findRegions(e){let i=e.facet(Bn);if((i==null?void 0:i.data)==this.data)return[{from:0,to:e.doc.length}];if(!i||!i.allowsNesting)return[];let r=[],s=(n,o)=>{if(n.prop(eo)==this.data){r.push({from:o,to:o+n.length});return}let a=n.prop(Ze.mounted);if(a){if(a.tree.prop(eo)==this.data){if(a.overlay)for(let l of a.overlay)r.push({from:l.from+o,to:l.to+o});else r.push({from:o,to:o+n.length});return}else if(a.overlay){let l=r.length;if(s(a.tree,a.overlay[0].from+o),r.length>l)return}}for(let l=0;l<n.children.length;l++){let u=n.children[l];u instanceof oi&&s(u,n.positions[l]+o)}};return s(Ha(e),0),r}get allowsNesting(){return!0}}hr.setState=at.define();function _2(t,e,i){let r=t.facet(Bn),s=Ha(t).topNode;if(!r||r.allowsNesting)for(let n=s;n;n=n.enter(e,i,kt.ExcludeBuffers|kt.EnterBracketed))n.type.isTop&&(s=n);return s}class Jd extends hr{constructor(e,i,r){super(e,i,[],r),this.parser=i}static define(e){let i=GD(e.languageData);return new Jd(i,e.parser.configure({props:[eo.add(r=>r.isTop?i:void 0)]}),e.name)}configure(e,i){return new Jd(this.data,this.parser.configure(e),i||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Ha(t){let e=t.field(hr.state,!1);return e?e.tree:oi.empty}class XD{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,i){let r=this.cursorPos-this.string.length;return e<r||i>=this.cursorPos?this.doc.sliceString(e,i):this.string.slice(e-r,i-r)}}let Vo=null;class Uu{constructor(e,i,r=[],s,n,o,a,l){this.parser=e,this.state=i,this.fragments=r,this.tree=s,this.treeLen=n,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,i,r){return new Uu(e,i,[],oi.empty,0,r,[],null)}startParse(){return this.parser.startParse(new XD(this.state.doc),this.fragments)}work(e,i){return i!=null&&i>=this.state.doc.length&&(i=void 0),this.tree!=oi.empty&&this.isDone(i??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),i!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>i)&&i<this.state.doc.length&&this.parse.stopAt(i);;){let s=this.parse.advance();if(s)if(this.fragments=this.withoutTempSkipped(Sn.addTree(s,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=s,this.parse=null,this.treeLen<(i??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,i;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(i=this.parse.advance()););}),this.treeLen=e,this.tree=i,this.fragments=this.withoutTempSkipped(Sn.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let i=Vo;Vo=this;try{return e()}finally{Vo=i}}withoutTempSkipped(e){for(let i;i=this.tempSkipped.pop();)e=y2(e,i.from,i.to);return e}changes(e,i){let{fragments:r,tree:s,treeLen:n,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((u,c,h,d)=>l.push({fromA:u,toA:c,fromB:h,toB:d})),r=Sn.applyChanges(r,l),s=oi.empty,n=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let u of this.skipped){let c=e.mapPos(u.from,1),h=e.mapPos(u.to,-1);c<h&&a.push({from:c,to:h})}}}return new Uu(this.parser,i,r,s,n,o,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let i=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:s,to:n}=this.skipped[r];s<e.to&&n>e.from&&(this.fragments=y2(this.fragments,s,n),this.skipped.splice(r--,1))}return this.skipped.length>=i?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,i){this.skipped.push({from:e,to:i})}static getSkippingParser(e){return new class extends ID{createParse(i,r,s){let n=s[0].from,o=s[s.length-1].to;return{parsedPos:n,advance(){let l=Vo;if(l){for(let u of s)l.tempSkipped.push(u);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new oi(Ki.none,[],[],o-n)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let i=this.fragments;return this.treeLen>=e&&i.length&&i[0].from==0&&i[0].to>=e}static get(){return Vo}}function y2(t,e,i){return Sn.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class xo{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let i=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),i.viewport.to);return i.work(20,r)||i.takeTree(),new xo(i)}static init(e){let i=Math.min(3e3,e.doc.length),r=Uu.create(e.facet(Bn).parser,e,{from:0,to:i});return r.work(20,i)||r.takeTree(),new xo(r)}}hr.state=or.define({create:xo.init,update(t,e){for(let i of e.effects)if(i.is(hr.setState))return i.value;return e.startState.facet(Bn)!=e.state.facet(Bn)?xo.init(e.state):t.apply(e)}});let _6=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(_6=t=>{let e=-1,i=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const Wc=typeof navigator<"u"&&(!((qc=navigator.scheduling)===null||qc===void 0)&&qc.isInputPending)?()=>navigator.scheduling.isInputPending():null,JD=qr.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let i=this.view.state.field(hr.state).context;(i.updateViewport(e.view.viewport)||this.view.viewport.to>i.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(i)}scheduleWork(){if(this.working)return;let{state:e}=this.view,i=e.field(hr.state);(i.tree!=i.context.tree||!i.context.isDone(e.doc.length))&&(this.working=_6(this.work))}work(e){this.working=null;let i=Date.now();if(this.chunkEnd<i&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=i+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:s}}=this.view,n=r.field(hr.state);if(n.tree==n.context.tree&&n.context.isDone(s+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!Wc?Math.max(25,e.timeRemaining()-5):1e9),a=n.context.treeLen<s&&r.doc.length>s+1e3,l=n.context.work(()=>Wc&&Wc()||Date.now()>o,s+(a?0:1e5));this.chunkBudget-=Date.now()-i,(l||this.chunkBudget<=0)&&(n.context.takeTree(),this.view.dispatch({effects:hr.setState.of(new xo(n.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(n.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(i=>Ir(this.view.state,i)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Bn=we.define({combine(t){return t.length?t[0]:null},enables:t=>[hr.state,JD,xe.contentAttributes.compute([t],e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}})]});class CR{constructor(e,i=[]){this.language=e,this.support=i,this.extension=[e,i]}}const AR=we.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(i=>i!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}}),ER=new Ze;function ZD(t){let e=t.node,i=e.childAfter(e.from),r=e.lastChild;if(!i)return null;let s=t.options.simulateBreak,n=t.state.doc.lineAt(i.from),o=s==null||s<=n.from?n.to:Math.min(n.to,s);for(let a=i.to;;){let l=e.childAfter(a);if(!l||l==r)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let u=/^ */.exec(n.text.slice(i.to-n.from))[0].length;return{from:i.from,to:i.to+u}}a=l.to}}function DR({closing:t,align:e=!0,units:i=1}){return r=>QD(r,e,i,t)}function QD(t,e,i,r,s){let n=t.textAfter,o=n.match(/^\s*/)[0].length,a=r&&n.slice(o,o+r.length)==r||s==t.pos+o,l=e?ZD(t):null;return l?a?t.column(l.from):t.column(l.to):t.baseIndent+(a?0:t.unit*i)}const MR=t=>t.baseIndent;function TR({except:t,units:e=1}={}){return i=>{let r=t&&t.test(i.textAfter);return i.baseIndent+(r?0:e*i.unit)}}const BR=new Ze;function RR(t){let e=t.firstChild,i=t.lastChild;return e&&e.to<i.from?{from:e.to,to:i.type.isError?t.to:i.from}:null}class D0{constructor(e,i){this.specs=e;let r;function s(a){let l=us.newName();return(r||(r=Object.create(null)))["."+l]=a,l}const n=typeof i.all=="string"?i.all:i.all?s(i.all):void 0,o=i.scope;this.scope=o instanceof hr?a=>a.prop(eo)==o.data:o?a=>a==o:void 0,this.style=v6(e.map(a=>({tag:a.tag,class:a.class||s(Object.assign({},a,{tag:null}))})),{all:n}).style,this.module=r?new us(r):null,this.themeType=i.themeType}static define(e,i){return new D0(e,i||{})}}const Zd=we.define(),eM=we.define({combine(t){return t.length?[t[0]]:null}});function yu(t){let e=t.facet(Zd);return e.length?e:t.facet(eM)}function tM(t,e){let i=[sM],r;return t instanceof D0&&(t.module&&i.push(xe.styleModule.of(t.module)),r=t.themeType),r?i.push(Zd.computeN([xe.darkTheme],s=>s.facet(xe.darkTheme)==(r=="dark")?[t]:[])):i.push(Zd.of(t)),i}function iM(t,e,i){let r=yu(t),s=null;if(r){for(let n of r)if(!n.scope||i){let o=n.style(e);o&&(s=s?s+" "+o:o)}}return s}class rM{constructor(e){this.markCache=Object.create(null),this.tree=Ha(e.state),this.decorations=this.buildDeco(e,yu(e.state)),this.decoratedTo=e.viewport.to}update(e){let i=Ha(e.state),r=yu(e.state),s=r!=yu(e.startState),{viewport:n}=e.view,o=e.changes.mapPos(this.decoratedTo,1);i.length<n.to&&!s&&i.type==this.tree.type&&o>=n.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(i!=this.tree||e.viewportChanged||s)&&(this.tree=i,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=n.to)}buildDeco(e,i){if(!i||!this.tree.length)return qe.none;let r=new fr;for(let{from:s,to:n}of e.visibleRanges)b6(this.tree,i,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=qe.mark({class:l})))},s,n);return r.finish()}}const sM=Pn.high(qr.fromClass(rM,{decorations:t=>t.decorations})),nM=Object.create(null),w2=[Ki.none],x2=[],S2=Object.create(null),oM=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])oM[t]=aM(nM,e);function Kc(t,e){x2.indexOf(t)>-1||(x2.push(t),console.warn(e))}function aM(t,e){let i=[];for(let a of e.split(" ")){let l=[];for(let u of a.split(".")){let c=t[u]||be[u];c?typeof c=="function"?l.length?l=l.map(c):Kc(u,`Modifier ${u} used at start of tag`):l.length?Kc(u,`Tag ${u} used as modifier`):l=Array.isArray(c)?c:[c]:Kc(u,`Unknown highlighting tag ${u}`)}for(let u of l)i.push(u)}if(!i.length)return 0;let r=e.replace(/ /g,"_"),s=r+" "+i.map(a=>a.id),n=S2[s];if(n)return n.id;let o=S2[s]=Ki.define({id:w2.length,name:r,props:[WD({[r]:i})]});return w2.push(o),o.id}Lt.RTL,Lt.LTR;class Bt{constructor(e,i,r,s){this.fromA=e,this.toA=i,this.fromB=r,this.toB=s}offset(e,i=e){return new Bt(this.fromA+e,this.toA+e,this.fromB+i,this.toB+i)}}function Rn(t,e,i,r,s,n){if(t==r)return[];let o=y1(t,e,i,r,s,n),a=w1(t,e+o,i,r,s+o,n);e+=o,i-=a,s+=o,n-=a;let l=i-e,u=n-s;if(!l||!u)return[new Bt(e,i,s,n)];if(l>u){let h=t.slice(e,i).indexOf(r.slice(s,n));if(h>-1)return[new Bt(e,e+h,s,s),new Bt(e+h+u,i,n,n)]}else if(u>l){let h=r.slice(s,n).indexOf(t.slice(e,i));if(h>-1)return[new Bt(e,e,s,s+h),new Bt(i,i,s+h+l,n)]}if(l==1||u==1)return[new Bt(e,i,s,n)];let c=x6(t,e,i,r,s,n);if(c){let[h,d,f]=c;return Rn(t,e,h,r,s,d).concat(Rn(t,h+f,i,r,d+f,n))}return lM(t,e,i,r,s,n)}let sa=1e9,na=0,_1=!1;function lM(t,e,i,r,s,n){let o=i-e,a=n-s;if(sa<1e9&&Math.min(o,a)>sa*16||na>0&&Date.now()>na)return Math.min(o,a)>sa*64?[new Bt(e,i,s,n)]:k2(t,e,i,r,s,n);let l=Math.ceil((o+a)/2);Vc.reset(l),Uc.reset(l);let u=(f,p)=>t.charCodeAt(e+f)==r.charCodeAt(s+p),c=(f,p)=>t.charCodeAt(i-f-1)==r.charCodeAt(n-p-1),h=(o-a)%2!=0?Uc:null,d=h?null:Vc;for(let f=0;f<l;f++){if(f>sa||na>0&&!(f&63)&&Date.now()>na)return k2(t,e,i,r,s,n);let p=Vc.advance(f,o,a,l,h,!1,u)||Uc.advance(f,o,a,l,d,!0,c);if(p)return uM(t,e,i,e+p[0],r,s,n,s+p[1])}return[new Bt(e,i,s,n)]}class y6{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let i=0;i<this.len;i++)this.vec[i]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,i,r,s,n,o,a){for(let l=-e+this.start;l<=e-this.end;l+=2){let u=s+l,c=l==-e||l!=e&&this.vec[u-1]<this.vec[u+1]?this.vec[u+1]:this.vec[u-1]+1,h=c-l;for(;c<i&&h<r&&a(c,h);)c++,h++;if(this.vec[u]=c,c>i)this.end+=2;else if(h>r)this.start+=2;else if(n){let d=s+(i-r)-l;if(d>=0&&d<this.len&&n.vec[d]!=-1)if(o){let f=n.vec[d];if(f>=i-c)return[f,s+f-d]}else{let f=i-n.vec[d];if(c>=f)return[c,h]}}}return null}}const Vc=new y6,Uc=new y6;function uM(t,e,i,r,s,n,o,a){let l=!1;return!So(t,r)&&++r==i&&(l=!0),!So(s,a)&&++a==o&&(l=!0),l?[new Bt(e,i,n,o)]:Rn(t,e,r,s,n,a).concat(Rn(t,r,i,s,a,o))}function w6(t,e){let i=1,r=Math.min(t,e);for(;i<r;)i=i<<1;return i}function y1(t,e,i,r,s,n){if(e==i||e==n||t.charCodeAt(e)!=r.charCodeAt(s))return 0;let o=w6(i-e,n-s);for(let a=e,l=s;;){let u=a+o,c=l+o;if(u>i||c>n||t.slice(a,u)!=r.slice(l,c)){if(o==1)return a-e-(So(t,a)?0:1);o=o>>1}else{if(u==i||c==n)return u-e;a=u,l=c}}}function w1(t,e,i,r,s,n){if(e==i||s==n||t.charCodeAt(i-1)!=r.charCodeAt(n-1))return 0;let o=w6(i-e,n-s);for(let a=i,l=n;;){let u=a-o,c=l-o;if(u<e||c<s||t.slice(u,a)!=r.slice(c,l)){if(o==1)return i-a-(So(t,a)?0:1);o=o>>1}else{if(u==e||c==s)return i-u;a=u,l=c}}}function Qd(t,e,i,r,s,n,o,a){let l=r.slice(s,n),u=null;for(;;){if(u||o<a)return u;for(let c=e+o;;){So(t,c)||c++;let h=c+o;if(So(t,h)||(h+=h==c+1?1:-1),h>=i)break;let d=t.slice(c,h),f=-1;for(;(f=l.indexOf(d,f+1))!=-1;){let p=y1(t,h,i,r,s+f+d.length,n),v=w1(t,e,c,r,s,s+f),_=d.length+p+v;(!u||u[2]<_)&&(u=[c-v,s+f-v,_])}c=h}if(a<0)return u;o=o>>1}}function x6(t,e,i,r,s,n){let o=i-e,a=n-s;if(o<a){let l=x6(r,s,n,t,e,i);return l&&[l[1],l[0],l[2]]}return o<4||a*2<o?null:Qd(t,e,i,r,s,n,Math.floor(o/4),-1)}function k2(t,e,i,r,s,n){_1=!0;let o=i-e,a=n-s,l;if(o<a){let d=Qd(r,s,n,t,e,i,Math.floor(o/6),50);l=d&&[d[1],d[0],d[2]]}else l=Qd(t,e,i,r,s,n,Math.floor(a/6),50);if(!l)return[new Bt(e,i,s,n)];let[u,c,h]=l;return Rn(t,e,u,r,s,c).concat(Rn(t,u+h,i,r,c+h,n))}function S6(t,e){for(let i=1;i<t.length;i++){let r=t[i-1],s=t[i];r.toA>s.fromA-e&&r.toB>s.fromB-e&&(t[i-1]=new Bt(r.fromA,s.toA,r.fromB,s.toB),t.splice(i--,1))}}function cM(t,e,i){for(;;){S6(i,1);let r=!1;for(let s=0;s<i.length;s++){let n=i[s],o,a;(o=y1(t,n.fromA,n.toA,e,n.fromB,n.toB))&&(n=i[s]=new Bt(n.fromA+o,n.toA,n.fromB+o,n.toB)),(a=w1(t,n.fromA,n.toA,e,n.fromB,n.toB))&&(n=i[s]=new Bt(n.fromA,n.toA-a,n.fromB,n.toB-a));let l=n.toA-n.fromA,u=n.toB-n.fromB;if(l&&u)continue;let c=n.fromA-(s?i[s-1].toA:0),h=(s<i.length-1?i[s+1].fromA:t.length)-n.toA;if(!c||!h)continue;let d=l?t.slice(n.fromA,n.toA):e.slice(n.fromB,n.toB);c<=d.length&&t.slice(n.fromA-c,n.fromA)==d.slice(d.length-c)?(i[s]=new Bt(n.fromA-c,n.toA-c,n.fromB-c,n.toB-c),r=!0):h<=d.length&&t.slice(n.toA,n.toA+h)==d.slice(0,h)&&(i[s]=new Bt(n.fromA+h,n.toA+h,n.fromB+h,n.toB+h),r=!0)}if(!r)break}return i}function hM(t,e,i){for(let r=0,s=0;s<t.length;s++){let n=t[s],o=n.toA-n.fromA,a=n.toB-n.fromB;if(o&&a||o>3||a>3){let l=s==t.length-1?e.length:t[s+1].fromA,u=n.fromA-r,c=l-n.toA,h=A2(e,n.fromA,u),d=C2(e,n.toA,c),f=n.fromA-h,p=d-n.toA;if((!o||!a)&&f&&p){let v=Math.max(o,a),[_,w,x]=o?[e,n.fromA,n.toA]:[i,n.fromB,n.toB];v>f&&e.slice(h,n.fromA)==_.slice(x-f,x)?(n=t[s]=new Bt(h,h+o,n.fromB-f,n.toB-f),h=n.fromA,d=C2(e,n.toA,l-n.toA)):v>p&&e.slice(n.toA,d)==_.slice(w,w+p)&&(n=t[s]=new Bt(d-o,d,n.fromB+p,n.toB+p),d=n.toA,h=A2(e,n.fromA,n.fromA-r)),f=n.fromA-h,p=d-n.toA}if(f||p)n=t[s]=new Bt(n.fromA-f,n.toA+p,n.fromB-f,n.toB+p);else if(o){if(!a){let v=D2(e,n.fromA,n.toA),_,w=v<0?-1:E2(e,n.toA,n.fromA);v>-1&&(_=v-n.fromA)<=c&&e.slice(n.fromA,v)==e.slice(n.toA,n.toA+_)?n=t[s]=n.offset(_):w>-1&&(_=n.toA-w)<=u&&e.slice(n.fromA-_,n.fromA)==e.slice(w,n.toA)&&(n=t[s]=n.offset(-_))}}else{let v=D2(i,n.fromB,n.toB),_,w=v<0?-1:E2(i,n.toB,n.fromB);v>-1&&(_=v-n.fromB)<=c&&i.slice(n.fromB,v)==i.slice(n.toB,n.toB+_)?n=t[s]=n.offset(_):w>-1&&(_=n.toB-w)<=u&&i.slice(n.fromB-_,n.fromB)==i.slice(w,n.toB)&&(n=t[s]=n.offset(-_))}}r=n.toA}return S6(t,3),t}let kn;try{kn=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function k6(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function C6(t,e){if(e==t.length)return 0;let i=t.charCodeAt(e);return i<192?k6(i)?1:0:kn?!D6(i)||e==t.length-1?kn.test(String.fromCharCode(i))?1:0:kn.test(t.slice(e,e+2))?2:0:0}function A6(t,e){if(!e)return 0;let i=t.charCodeAt(e-1);return i<192?k6(i)?1:0:kn?!M6(i)||e==1?kn.test(String.fromCharCode(i))?1:0:kn.test(t.slice(e-2,e))?2:0:0}const E6=8;function C2(t,e,i){if(e==t.length||!A6(t,e))return e;for(let r=e,s=e+i,n=0;n<E6;n++){let o=C6(t,r);if(!o||r+o>s)return r;r+=o}return e}function A2(t,e,i){if(!e||!C6(t,e))return e;for(let r=e,s=e-i,n=0;n<E6;n++){let o=A6(t,r);if(!o||r-o<s)return r;r-=o}return e}function E2(t,e,i){for(;e!=i;e--)if(t.charCodeAt(e-1)==10)return e;return-1}function D2(t,e,i){for(;e!=i;e++)if(t.charCodeAt(e)==10)return e;return-1}const D6=t=>t>=55296&&t<=56319,M6=t=>t>=56320&&t<=57343;function So(t,e){return!e||e==t.length||!D6(t.charCodeAt(e-1))||!M6(t.charCodeAt(e))}function dM(t,e,i){var r;let s=i==null?void 0:i.override;return s?s(t,e):(sa=((r=i==null?void 0:i.scanLimit)!==null&&r!==void 0?r:1e9)>>1,na=i!=null&&i.timeout?Date.now()+i.timeout:0,_1=!1,cM(t,e,Rn(t,0,t.length,e,0,e.length)))}function T6(){return!_1}function B6(t,e,i){return hM(dM(t,e,i),t,e)}const gi=we.define({combine:t=>t[0]}),ef=at.define(),R6=we.define(),hi=or.define({create(t){return null},update(t,e){for(let i of e.effects)i.is(ef)&&(t=i.value);for(let i of e.state.facet(R6))t=i(t,e);return t}});let N6=t=>({state:e,dispatch:i})=>{let r=e.field(hi,!1),s=e.facet(gi);if(!r||!r.length||!s)return!1;let{head:n}=e.selection.main,o=0;for(let c=r.length-1;c>=0;c--){let h=r[c],[d,f]=s.side=="b"?[h.fromB,h.toB]:[h.fromA,h.toA];if(f<n){o=c+1;break}if(d<=n){if(r.length==1)return!1;o=c+(t<0?0:1);break}}let a=r[(o+(t<0?r.length-1:0))%r.length],[l,u]=s.side=="b"?[a.fromB,a.toB]:[a.fromA,a.toA];return i(e.update({selection:{anchor:l},userEvent:"select.byChunk",effects:xe.scrollIntoView(ve.range(u,l))})),!0};const fM=N6(1),pM=N6(-1);class as{constructor(e,i,r,s,n,o=!0){this.changes=e,this.fromA=i,this.toA=r,this.fromB=s,this.toB=n,this.precise=o}offset(e,i){return e||i?new as(this.changes,this.fromA+e,this.toA+e,this.fromB+i,this.toB+i,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,i,r){let s=B6(e.toString(),i.toString(),r);return L6(s,e,i,0,0,T6())}static updateA(e,i,r,s,n){return N2(R2(e,s,!0,r.length),e,i,r,n)}static updateB(e,i,r,s,n){return N2(R2(e,s,!1,i.length),e,i,r,n)}}function M2(t,e,i,r){let s=i.lineAt(t),n=r.lineAt(e);return s.to==t&&n.to==e&&t<i.length&&e<r.length?[t+1,e+1]:[s.from,n.from]}function T2(t,e,i,r){let s=i.lineAt(t),n=r.lineAt(e);return s.from==t&&n.from==e?[t,e]:[s.to+1,n.to+1]}function L6(t,e,i,r,s,n){let o=[];for(let a=0;a<t.length;a++){let l=t[a],[u,c]=M2(l.fromA+r,l.fromB+s,e,i),[h,d]=T2(l.toA+r,l.toB+s,e,i),f=[l.offset(-u+r,-c+s)];for(;a<t.length-1;){let p=t[a+1],[v,_]=M2(p.fromA+r,p.fromB+s,e,i);if(v>h+1&&_>d+1)break;f.push(p.offset(-u+r,-c+s)),[h,d]=T2(p.toA+r,p.toB+s,e,i),a++}o.push(new as(f,u,Math.max(u,h),c,Math.max(c,d),n))}return o}const Ul=1e3;function B2(t,e,i,r){let s=0,n=t.length;for(;;){if(s==n){let c=0,h=0;s&&({toA:c,toB:h}=t[s-1]);let d=e-(i?c:h);return[c+d,h+d]}let o=s+n>>1,a=t[o],[l,u]=i?[a.fromA,a.toA]:[a.fromB,a.toB];if(l>e)n=o;else if(u<=e)s=o+1;else return r?[a.fromA,a.fromB]:[a.toA,a.toB]}}function R2(t,e,i,r){let s=[];return e.iterChangedRanges((n,o,a,l)=>{let u=0,c=i?e.length:r,h=0,d=i?r:e.length;n>Ul&&([u,h]=B2(t,n-Ul,i,!0)),o<e.length-Ul&&([c,d]=B2(t,o+Ul,i,!1));let f=l-a-(o-n),p,[v,_]=i?[f,0]:[0,f];s.length&&(p=s[s.length-1]).toA>=u?s[s.length-1]={fromA:p.fromA,fromB:p.fromB,toA:c,toB:d,diffA:p.diffA+v,diffB:p.diffB+_}:s.push({fromA:u,toA:c,fromB:h,toB:d,diffA:v,diffB:_})}),s}function N2(t,e,i,r,s){if(!t.length)return e;let n=[];for(let o=0,a=0,l=0,u=0;;o++){let c=o==t.length?null:t[o],h=c?c.fromA+a:i.length,d=c?c.fromB+l:r.length;for(;u<e.length;){let _=e[u];if(c&&(_.toA+a>h||_.toB+l>d))break;n.push(_.offset(a,l)),u++}if(!c)break;let f=c.toA+a+c.diffA,p=c.toB+l+c.diffB,v=B6(i.sliceString(h,f),r.sliceString(d,p),s);for(let _ of L6(v,i,r,h,d,T6()))n.push(_);for(a+=c.diffA,l+=c.diffB;u<e.length;){let _=e[u];if(_.fromA+a>f&&_.fromB+l>p)break;u++}}return n}const O6={scanLimit:500},M0=qr.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=P2(t))}update(t){(t.docChanged||t.viewportChanged||mM(t.startState,t.state)||gM(t.startState,t.state))&&({deco:this.deco,gutter:this.gutter}=P2(t.view))}},{decorations:t=>t.deco}),Gl=Pn.low(u6({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(M0))===null||e===void 0?void 0:e.gutter)||je.empty}}));function mM(t,e){return t.field(hi,!1)!=e.field(hi,!1)}function gM(t,e){return t.facet(gi)!=e.facet(gi)}const L2=qe.line({class:"cm-changedLine"}),P6=qe.mark({class:"cm-changedText"}),vM=qe.mark({tagName:"ins",class:"cm-insertedLine"}),bM=qe.mark({tagName:"del",class:"cm-deletedLine"}),O2=new class extends mr{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function _M(t,e,i,r,s,n){let o=i?t.fromA:t.fromB,a=i?t.toA:t.toB,l=0;if(o!=a){s.add(o,o,L2),s.add(o,a,i?bM:vM),n&&n.add(o,o,O2);for(let u=e.iterRange(o,a-1),c=o;!u.next().done;){if(u.lineBreak){c++,s.add(c,c,L2),n&&n.add(c,c,O2);continue}let h=c+u.value.length;if(r)for(;l<t.changes.length;){let d=t.changes[l],f=o+(i?d.fromA:d.fromB),p=o+(i?d.toA:d.toB),v=Math.max(c,f),_=Math.min(h,p);if(v<_&&s.add(v,_,P6),p<h)l++;else break}c=h}}}function P2(t){let e=t.state.field(hi),{side:i,highlightChanges:r,markGutter:s,overrideChunk:n}=t.state.facet(gi),o=i=="a",a=new fr,l=s?new fr:null,{from:u,to:c}=t.viewport;for(let h of e){if((o?h.fromA:h.fromB)>=c)break;(o?h.toA:h.toB)>u&&(!n||!n(t.state,h,a,l))&&_M(h,t.state.doc,o,r,a,l)}return{deco:a.finish(),gutter:l&&l.finish()}}class Yl extends Xs{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement("div");return e.className="cm-mergeSpacer",e.style.height=this.height+"px",e}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}const Gu=at.define({map:(t,e)=>t.map(e)}),oa=or.define({create:()=>qe.none,update:(t,e)=>{for(let i of e.effects)if(i.is(Gu))return i.value;return t.map(e.changes)},provide:t=>xe.decorations.from(t)}),Xl=.01;function F2(t,e){if(t.size!=e.size)return!1;let i=t.iter(),r=e.iter();for(;i.value;){if(i.from!=r.from||Math.abs(i.value.spec.widget.height-r.value.spec.widget.height)>1)return!1;i.next(),r.next()}return!0}function yM(t,e,i){let r=new fr,s=new fr,n=t.state.field(oa).iter(),o=e.state.field(oa).iter(),a=0,l=0,u=0,c=0,h=t.viewport,d=e.viewport;for(let _=0;;_++){let w=_<i.length?i[_]:null,x=w?w.fromA:t.state.doc.length,C=w?w.fromB:e.state.doc.length;if(a<x){let D=t.lineBlockAt(a).top+u,R=e.lineBlockAt(l).top+c,E=D-R;E<-Xl?(u-=E,r.add(a,a,qe.widget({widget:new Yl(-E),block:!0,side:-1}))):E>Xl&&(c+=E,s.add(l,l,qe.widget({widget:new Yl(E),block:!0,side:-1})))}if(x>a+1e3&&a<h.from&&x>h.from&&l<d.from&&C>d.from){let D=Math.min(h.from-a,d.from-l);a+=D,l+=D,_--}else if(w)a=w.toA,l=w.toB;else break;for(;n.value&&n.from<a;)u-=n.value.spec.widget.height,n.next();for(;o.value&&o.from<l;)c-=o.value.spec.widget.height,o.next()}for(;n.value;)u-=n.value.spec.widget.height,n.next();for(;o.value;)c-=o.value.spec.widget.height,o.next();let f=t.contentHeight+u-(e.contentHeight+c);f<Xl?r.add(t.state.doc.length,t.state.doc.length,qe.widget({widget:new Yl(-f),block:!0,side:1})):f>Xl&&s.add(e.state.doc.length,e.state.doc.length,qe.widget({widget:new Yl(f),block:!0,side:1}));let p=r.finish(),v=s.finish();F2(p,t.state.field(oa))||t.dispatch({effects:Gu.of(p)}),F2(v,e.state.field(oa))||e.dispatch({effects:Gu.of(v)})}const tf=at.define({map:(t,e)=>e.mapPos(t)});class wM extends Xs{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let i=document.createElement("div");return i.className="cm-collapsedLines",i.textContent=e.state.phrase("$ unchanged lines",this.lines),i.addEventListener("click",r=>{let s=e.posAtDOM(r.target);e.dispatch({effects:tf.of(s)});let{side:n,sibling:o}=e.state.facet(gi);o&&o().dispatch({effects:tf.of(xM(s,e.state.field(hi),n=="a"))})}),i}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function xM(t,e,i){let r=0,s=0;for(let n=0;;n++){let o=n<e.length?e[n]:null;if(!o||(i?o.fromA:o.fromB)>=t)return s+(t-r);[r,s]=i?[o.toA,o.toB]:[o.toB,o.toA]}}const SM=or.define({create(t){return qe.none},update(t,e){t=t.map(e.changes);for(let i of e.effects)i.is(tf)&&(t=t.update({filter:r=>r!=i.value}));if(t.size&&e.state.field(hi)!=e.startState.field(hi,!1)){let i=e.state.facet(gi).side=="a",r=[];for(let s of e.state.field(hi))t.between(i?s.fromA:s.fromB,i?s.toA:s.toB,n=>{r.push(n)});r.length&&(t=t.update({filter:s=>r.indexOf(s)<0}))}return t},provide:t=>xe.decorations.from(t)});function rf({margin:t=3,minSize:e=4}){return SM.init(i=>kM(i,t,e))}function kM(t,e,i){let r=new fr,s=t.facet(gi).side=="a",n=t.field(hi),o=1;for(let a=0;;a++){let l=a<n.length?n[a]:null,u=a?o+e:1,c=l?t.doc.lineAt(s?l.fromA:l.fromB).number-1-e:t.doc.lines,h=c-u+1;if(h>=i&&r.add(t.doc.line(u).from,t.doc.line(c).to,qe.replace({widget:new wM(h),block:!0})),!l)break;o=t.doc.lineAt(Math.min(t.doc.length,s?l.toA:l.toB)).number}return r.finish()}const CM=xe.styleModule.of(new us({".cm-mergeView":{overflowY:"auto"},".cm-mergeViewEditors":{display:"flex",alignItems:"stretch"},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:"hidden"},".cm-merge-revert":{width:"1.6em",flexGrow:0,flexShrink:0,position:"relative"},".cm-merge-revert button":{position:"absolute",display:"block",width:"100%",boxSizing:"border-box",textAlign:"center",background:"none",border:"none",font:"inherit",cursor:"pointer"}})),F6=xe.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer","&:before":{content:'"⦚"',marginInlineEnd:"7px"},"&:after":{content:'"⦚"',marginInlineStart:"7px"}},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"},".cm-inlineChangedLineGutter":{background:"#75d"}}),I2=new Bo,Jl=new Bo;class AM{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||O6;let i=[Pn.low(M0),F6,CM,oa,xe.updateListener.of(h=>{this.measuring<0&&(h.heightChanged||h.viewportChanged)&&!h.transactions.some(d=>d.effects.some(f=>f.is(Gu)))&&this.measure()})],r=[gi.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&r.push(Gl);let s=Ke.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],xe.editorAttributes.of({class:"cm-merge-a"}),Jl.of(r),i]}),n=[gi.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(Gl);let o=Ke.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],xe.editorAttributes.of({class:"cm-merge-b"}),Jl.of(n),i]});this.chunks=as.build(s.doc,o.doc,this.diffConf);let a=[hi.init(()=>this.chunks),I2.of(e.collapseUnchanged?rf(e.collapseUnchanged):[])];s=s.update({effects:at.appendConfig.of(a)}).state,o=o.update({effects:at.appendConfig.of(a)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let l=e.orientation||"a-b",u=document.createElement("div");u.className="cm-mergeViewEditor";let c=document.createElement("div");c.className="cm-mergeViewEditor",this.editorDOM.appendChild(l=="a-b"?u:c),this.editorDOM.appendChild(l=="a-b"?c:u),this.a=new xe({state:s,parent:u,root:e.root,dispatchTransactions:h=>this.dispatch(h,this.a)}),this.b=new xe({state:o,parent:c,root:e.root,dispatchTransactions:h=>this.dispatch(h,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls=="b-to-a",e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,i){if(e.some(r=>r.docChanged)){let r=e[e.length-1],s=e.reduce((o,a)=>o.compose(a.changes),Mt.empty(e[0].startState.doc.length));this.chunks=i==this.a?as.updateA(this.chunks,r.newDoc,this.b.state.doc,s,this.diffConf):as.updateB(this.chunks,this.a.state.doc,r.newDoc,s,this.diffConf),i.update([...e,r.state.update({effects:ef.of(this.chunks)})]);let n=i==this.a?this.b:this.a;n.update([n.state.update({effects:ef.of(this.chunks)})]),this.scheduleMeasure()}else i.update(e)}reconfigure(e){if("diffConfig"in e&&(this.diffConf=e.diffConfig),"orientation"in e){let n=e.orientation!="b-a";if(n!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let o=this.a.dom.parentNode,a=this.b.dom.parentNode;o.remove(),a.remove(),this.editorDOM.insertBefore(n?o:a,this.editorDOM.firstChild),this.editorDOM.appendChild(n?a:o),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let n=!!this.revertDOM,o=this.revertToA,a=this.renderRevert;"revertControls"in e&&(n=!!e.revertControls,o=e.revertControls=="b-to-a"),"renderRevertControl"in e&&(a=e.renderRevertControl),this.setupRevertControls(n,o,a)}let i="highlightChanges"in e,r="gutter"in e,s="collapseUnchanged"in e;if(i||r||s){let n=[],o=[];if(i||r){let a=this.a.state.facet(gi),l=r?e.gutter!==!1:a.markGutter,u=i?e.highlightChanges!==!1:a.highlightChanges;n.push(Jl.reconfigure([gi.of({side:"a",sibling:()=>this.b,highlightChanges:u,markGutter:l}),l?Gl:[]])),o.push(Jl.reconfigure([gi.of({side:"b",sibling:()=>this.a,highlightChanges:u,markGutter:l}),l?Gl:[]]))}if(s){let a=I2.reconfigure(e.collapseUnchanged?rf(e.collapseUnchanged):[]);n.push(a),o.push(a)}this.a.dispatch({effects:n}),this.b.dispatch({effects:o})}this.scheduleMeasure()}setupRevertControls(e,i,r){this.revertToA=i,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=r,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",s=>this.revertClicked(s)),this.revertDOM.className="cm-merge-revert"):this.revertDOM&&(this.revertDOM.textContent="")}scheduleMeasure(){if(this.measuring<0){let e=this.dom.ownerDocument.defaultView||window;this.measuring=e.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){yM(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,i=e.firstChild,r=this.a.viewport,s=this.b.viewport;for(let n=0;n<this.chunks.length;n++){let o=this.chunks[n];if(o.fromA>r.to||o.fromB>s.to)break;if(o.fromA<r.from||o.fromB<s.from)continue;let a=this.a.lineBlockAt(o.fromA).top+"px";for(;i&&+i.dataset.chunk<n;)i=z2(i);i&&i.dataset.chunk==String(n)?(i.style.top!=a&&(i.style.top=a),i=i.nextSibling):e.insertBefore(this.renderRevertButton(a,n),i)}for(;i;)i=z2(i)}renderRevertButton(e,i){let r;if(this.renderRevert)r=this.renderRevert();else{r=document.createElement("button");let s=this.a.state.phrase("Revert this chunk");r.setAttribute("aria-label",s),r.setAttribute("title",s),r.textContent=this.revertToLeft?"⇜":"⇝"}return r.style.top=e,r.setAttribute("data-chunk",String(i)),r}revertClicked(e){let i=e.target,r;for(;i&&i.parentNode!=this.revertDOM;)i=i.parentNode;if(i&&(r=this.chunks[i.dataset.chunk])){let[s,n,o,a,l,u]=this.revertToA?[this.b,this.a,r.fromB,r.toB,r.fromA,r.toA]:[this.a,this.b,r.fromA,r.toA,r.fromB,r.toB],c=s.state.sliceDoc(o,Math.max(o,a-1));o!=a&&u<=n.state.doc.length&&(c+=s.state.lineBreak),n.dispatch({changes:{from:l,to:Math.min(n.state.doc.length,u),insert:c},userEvent:"revert"}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}}function z2(t){let e=t.nextSibling;return t.remove(),e}const EM=new class extends mr{constructor(){super(...arguments),this.elementClass="cm-deletedLineGutter"}},DM=Pn.low(u6({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(M0))===null||e===void 0?void 0:e.gutter)||je.empty},widgetMarker:(t,e)=>e instanceof I6?EM:null}));function MM(t){var e;let i=typeof t.original=="string"?Ve.of(t.original.split(/\r?\n/)):t.original,r=t.diffConfig||O6;return[Pn.low(M0),NM,F6,xe.editorAttributes.of({class:"cm-merge-b"}),R6.of((s,n)=>{let o=n.effects.find(a=>a.is(x1));return o&&(s=as.updateA(s,o.value.doc,n.startState.doc,o.value.changes,r)),n.docChanged&&(s=as.updateB(s,n.state.field(ko),n.newDoc,n.changes,r)),s}),gi.of({highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1,syntaxHighlightDeletions:t.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:(e=t.mergeControls)!==null&&e!==void 0?e:!0,overrideChunk:t.allowInlineDiffs?FM:void 0,side:"b"}),ko.init(()=>i),t.gutter!==!1?DM:[],t.collapseUnchanged?rf(t.collapseUnchanged):[],hi.init(s=>as.build(i,s.doc,r))]}const x1=at.define(),ko=or.define({create:()=>Ve.empty,update(t,e){for(let i of e.effects)i.is(x1)&&(t=i.value.doc);return t}}),j2=new WeakMap;class I6 extends Xs{constructor(e){super(),this.buildDOM=e,this.dom=null}eq(e){return this.dom==e.dom}toDOM(e){return this.dom||(this.dom=this.buildDOM(e))}}function TM(t,e,i){let r=j2.get(e.changes);if(r)return r;let s=o=>{let{highlightChanges:a,syntaxHighlightDeletions:l,syntaxHighlightDeletionsMaxLength:u,mergeControls:c}=t.facet(gi),h=document.createElement("div");if(h.className="cm-deletedChunk",c){let D=h.appendChild(document.createElement("div"));D.className="cm-chunkButtons";let R=L=>{L.preventDefault(),BM(o,o.posAtDOM(h))},E=L=>{L.preventDefault(),RM(o,o.posAtDOM(h))};if(typeof c=="function")D.appendChild(c("accept",R)),D.appendChild(c("reject",E));else{let L=D.appendChild(document.createElement("button"));L.name="accept",L.textContent=t.phrase("Accept"),L.onmousedown=R;let q=D.appendChild(document.createElement("button"));q.name="reject",q.textContent=t.phrase("Reject"),q.onmousedown=E}}if(i||e.fromA>=e.toA)return h;let d=o.state.field(ko).sliceString(e.fromA,e.endA),f=l&&t.facet(Bn),p=x(),v=e.changes,_=0,w=!1;function x(){let D=h.appendChild(document.createElement("div"));return D.className="cm-deletedLine",D.appendChild(document.createElement("del"))}function C(D,R,E){for(let L=D;L<R;){if(d.charAt(L)==`
325
+ `){p.firstChild||p.appendChild(document.createElement("br")),p=x(),L++;continue}let q=R,F=E+(w?" cm-deletedText":""),$=!1,W=d.indexOf(`
326
+ `,L);if(W>-1&&W<R&&(q=W),a&&_<v.length){let z=Math.max(0,w?v[_].toA:v[_].fromA);z<=q&&(q=z,w&&_++,$=!0)}if(q>L){let z=document.createTextNode(d.slice(L,q));if(F){let j=p.appendChild(document.createElement("span"));j.className=F,j.appendChild(z)}else p.appendChild(z);L=q}$&&(w=!w)}}if(f&&e.toA-e.fromA<=u){let D=f.parser.parse(d),R=0;b6(D,{style:E=>iM(t,E)},(E,L,q)=>{E>R&&C(R,E,""),C(E,L,q),R=L}),C(R,d.length,"")}else C(0,d.length,"");return p.firstChild||p.appendChild(document.createElement("br")),h},n=qe.widget({block:!0,side:-1,widget:new I6(s)});return j2.set(e.changes,n),n}function BM(t,e){let{state:i}=t,r=e??i.selection.main.head,s=t.state.field(hi).find(l=>l.fromB<=r&&l.endB>=r);if(!s)return!1;let n=t.state.sliceDoc(s.fromB,Math.max(s.fromB,s.toB-1)),o=t.state.field(ko);s.fromB!=s.toB&&s.toA<=o.length&&(n+=t.state.lineBreak);let a=Mt.of({from:s.fromA,to:Math.min(o.length,s.toA),insert:n},o.length);return t.dispatch({effects:x1.of({doc:a.apply(o),changes:a}),userEvent:"accept"}),!0}function RM(t,e){let{state:i}=t,r=e??i.selection.main.head,s=i.field(hi).find(a=>a.fromB<=r&&a.endB>=r);if(!s)return!1;let o=i.field(ko).sliceString(s.fromA,Math.max(s.fromA,s.toA-1));return s.fromA!=s.toA&&s.toB<=i.doc.length&&(o+=i.lineBreak),t.dispatch({changes:{from:s.fromB,to:Math.min(i.doc.length,s.toB),insert:o},userEvent:"revert"}),!0}function H2(t){let e=new fr;for(let i of t.field(hi)){let r=t.facet(gi).overrideChunk&&z6(t,i);e.add(i.fromB,i.fromB,TM(t,i,!!r))}return e.finish()}const NM=or.define({create:t=>H2(t),update(t,e){return e.state.field(hi,!1)!=e.startState.field(hi,!1)?H2(e.state):t},provide:t=>xe.decorations.from(t)}),$2=new WeakMap;function z6(t,e){let i=$2.get(e);if(i!==void 0)return i;i=null;let r=t.field(ko),s=t.doc,n=r.lineAt(e.endA).number-r.lineAt(e.fromA).number+1,o=s.lineAt(e.endB).number-s.lineAt(e.fromB).number+1;e:if(n==o&&n<10){let a=[],l=0,u=e.fromA,c=e.fromB;for(let h of e.changes){if(h.fromA<h.toA){l+=h.toA-h.fromA;let d=r.sliceString(u+h.fromA,u+h.toA);if(/\n/.test(d))break e;a.push(qe.widget({widget:new LM(d),side:-1}).range(c+h.fromB))}h.fromB<h.toB&&a.push(P6.range(c+h.fromB,c+h.toB))}l<e.endA-e.fromA-n*2&&(i=a)}return $2.set(e,i),i}class LM extends Xs{constructor(e){super(),this.text=e}eq(e){return this.text==e.text}toDOM(e){let i=document.createElement("del");return i.className="cm-deletedText",i.textContent=this.text,i}}const OM=new class extends mr{constructor(){super(...arguments),this.elementClass="cm-inlineChangedLineGutter"}},PM=qe.line({class:"cm-inlineChangedLine"});function FM(t,e,i,r){let s=z6(t,e),n=0;if(!s)return!1;for(let o=t.doc.lineAt(e.fromB);;){for(r&&r.add(o.from,o.from,OM),i.add(o.from,o.from,PM);n<s.length&&s[n].to<=o.to;){let a=s[n++];i.add(a.from,a.to,a.value)}if(o.to>=e.endB)break;o=t.doc.lineAt(o.to+1)}return!0}function Gc(t){const e={name:"",dirs:new Map,files:[]};for(const i of t){const r=String(i.path||"").split("/").filter(Boolean);if(!r.pop())continue;let n=e;for(const o of r)n.dirs.has(o)||n.dirs.set(o,{name:o,dirs:new Map,files:[]}),n=n.dirs.get(o);n.files.push(i)}return j6(e).children}function j6(t){const e=[];for(const r of t.dirs.values()){let s=j6(r);for(;!s.files.length&&s.children.length===1&&s.children[0].kind==="dir";){const n=s.children[0];s={...n,name:`${s.name}/${n.name}`}}e.push(s)}e.sort((r,s)=>r.name.localeCompare(s.name));const i=[...t.files].sort((r,s)=>r.path.localeCompare(s.path)).map(r=>({kind:"file",name:r.path.split("/").pop(),file:r}));return{kind:"dir",name:t.name,files:t.files,children:[...e,...i]}}function sf(t,e=""){const i=[];for(const r of t){if(r.kind!=="dir")continue;const s=e?`${e}/${r.name}`:r.name;i.push(s,...sf(r.children,s))}return i}function IM(t){const e=String(t||"").split("/"),i=e.pop()||"";return{dir:e.join("/"),name:i,dirSegments:e}}const zM=D0.define([{tag:[be.keyword,be.modifier,be.controlKeyword],color:"var(--magenta)"},{tag:[be.function(be.variableName),be.function(be.propertyName)],color:"var(--blue)"},{tag:[be.string,be.special(be.string)],color:"var(--green)"},{tag:[be.comment,be.lineComment,be.blockComment],color:"var(--muted)",fontStyle:"italic"},{tag:[be.number,be.bool,be.null],color:"var(--orange)"},{tag:[be.typeName,be.className,be.tagName],color:"var(--yellow)"},{tag:[be.propertyName,be.attributeName],color:"var(--cyan)"},{tag:[be.operator,be.punctuation],color:"var(--ink)"},{tag:[be.invalid],color:"var(--red)"}]),jM=xe.theme({"&":{backgroundColor:"var(--paper)",color:"var(--ink)",fontSize:"var(--type-meta)",minHeight:"100%"},".cm-content":{fontFamily:"var(--mono)",padding:"8px 0"},".cm-scroller":{fontFamily:"var(--mono)",lineHeight:"1.55",overflow:"auto"},".cm-gutters":{backgroundColor:"var(--paper)",color:"var(--muted)",border:"none",opacity:".7"},".cm-lineNumbers .cm-gutterElement":{padding:"0 10px"},".cm-line":{whiteSpace:"pre"},".cm-mergeView":{minWidth:"0"}},{dark:!0}),HM=new Set(["js","jsx","mjs","cjs","ts","tsx","mts","cts"]);async function $M(t){const e=(t.split(".").pop()||"").toLowerCase();if(!HM.has(e))return[];try{const{javascript:i}=await Gs(async()=>{const{javascript:r}=await import("./index-DqfNBCzh.js");return{javascript:r}},__vite__mapDeps([0,1,2,3,4]));return i({jsx:e.endsWith("sx"),typescript:e.startsWith("t")||e.startsWith("mt")||e.startsWith("ct")})}catch{return[]}}function qM(t){const e=[],i=[],r=[],s=[];let n=0,o=0,a=!1;for(const l of String(t||"").split(`
327
+ `)){const u=l.match(/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(u){n=Number(u[1]),o=Number(u[2]),a=!0;continue}if(!(!a||l.startsWith("--- ")||l.startsWith("+++ ")||l.startsWith("diff ")||l.startsWith("index ")||l.startsWith("\\"))){if(l.startsWith("-")){e.push(l.slice(1)),r.push(n++);continue}if(l.startsWith("+")){i.push(l.slice(1)),s.push(o++);continue}if(l.startsWith(" ")){const c=l.slice(1);e.push(c),i.push(c),r.push(n++),s.push(o++)}}}return{oldText:e.join(`
328
+ `),newText:i.join(`
329
+ `),oldNumbers:r,newNumbers:s}}function WM(t){return DD({formatNumber:e=>t[e-1]?String(t[e-1]):""})}function Yc(t,e,i){return[Ke.readOnly.of(!0),xe.editable.of(!1),WM(t),tM(zM),e,i?xe.lineWrapping:[],jM]}const Un=t=>t?`${t.scope}:${t.file.path}`:"",KM=(t,e)=>{var i;return!!e&&[...((t==null?void 0:t.files)||[]).map(r=>`branch:${r.path}`),...(((i=t==null?void 0:t.working)==null?void 0:i.files)||[]).map(r=>`working:${r.path}`)].includes(e)},VM=t=>{var e;return((t==null?void 0:t.files)||[]).length?{scope:"branch",file:t.files[0]}:(((e=t==null?void 0:t.working)==null?void 0:e.files)||[]).length?{scope:"working",file:t.working.files[0]}:null};function UM({sessionId:t,file:e,scope:i,comments:r,open:s,mode:n,wrap:o,onComment:a,onEdit:l,onRetract:u,onView:c,onNext:h,onPrevious:d}){const f=Ie(),p=k.useRef(null),v=k.useRef(null),[_,w]=k.useState(e.patch||""),x=k.useMemo(()=>qM(_),[_]);k.useEffect(()=>{if(!s||_||!e.path)return;let E=!0;return Hi(`${Go(t,"diff")}?scope=${i}&path=${encodeURIComponent(e.path)}`,{cache:"no-store"}).then(L=>L.json()).then(L=>{var F,$,W,z,j;const q=i==="working"?(W=($=(F=L==null?void 0:L.working)==null?void 0:F.files)==null?void 0:$[0])==null?void 0:W.patch:(j=(z=L==null?void 0:L.files)==null?void 0:z[0])==null?void 0:j.patch;E&&typeof q=="string"&&w(q)}).catch(()=>{}),()=>{E=!1}},[t,e.path,s,_,i]),k.useEffect(()=>{if(!s||!p.current||!_)return;let E=!0;return(async()=>{const q=await $M(e.path);if(!(!E||!p.current))if(n==="split"){const F=new AM({a:{doc:x.oldText,extensions:Yc(x.oldNumbers,q,o)},b:{doc:x.newText,extensions:Yc(x.newNumbers,q,o)},parent:p.current,orientation:"a-b",highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:10,minSize:12},diffConfig:{scanLimit:5e3,timeout:100}});v.current=F,c(e.path,F)}else{const F=new xe({parent:p.current,state:Ke.create({doc:x.newText,extensions:[...Yc(x.newNumbers,q,o),MM({original:x.oldText,highlightChanges:!0,syntaxHighlightDeletions:!0,mergeControls:!1,collapseUnchanged:{margin:10,minSize:12},diffConfig:{scanLimit:5e3,timeout:100}})]})});v.current=F,c(e.path,F)}})(),()=>{var q;E=!1,(q=v.current)==null||q.destroy(),v.current=null,c(e.path,null)}},[e.path,n,s,x,c,_,o]);const C=E=>{var j,A,O,T,U,H;if(E.button!==0)return;const L=(A=(j=E.target).closest)==null?void 0:A.call(j,".cm-line");if(!L||!((O=p.current)!=null&&O.contains(L)))return;const q=L.closest(".cm-editor"),F=n==="split"?q===((U=(T=v.current)==null?void 0:T.a)==null?void 0:U.dom)?v.current.a:(H=v.current)==null?void 0:H.b:v.current;if(!F)return;const $=F.state.doc.lineAt(F.posAtDOM(L,0)).number,z=(n==="split"&&F===v.current.a?x.oldNumbers:x.newNumbers)[$-1];z&&a(z,z)},{dirSegments:D,name:R}=IM(e.path);return m.jsxs("section",{className:"diff-file is-open","data-diff-file":e.path,"data-diff-scope":i,children:[m.jsxs("header",{className:"diff-file-head","data-tip":e.path,children:[m.jsxs("span",{className:"diff-file-name",children:[m.jsx(H6,{segments:D}),m.jsx("strong",{children:R})]}),m.jsx("span",{className:`diff-file-status is-${e.status}`,children:e.status}),m.jsxs("span",{className:"diff-file-stat",children:[m.jsxs("span",{className:"diff-add",children:["+",e.additions]})," ",m.jsxs("span",{className:"diff-del",children:["−",e.deletions]})]}),i==="working"&&m.jsx("span",{className:"diff-file-scope",children:f("session.diffUncommitted")}),m.jsx("span",{className:"diff-toolbar-spacer"}),m.jsxs("span",{className:"diff-hunk-tools",children:[m.jsx("button",{type:"button",onClick:d,"aria-label":f("session.diffPrevious"),children:"↑"}),m.jsx("button",{type:"button",onClick:h,"aria-label":f("session.diffNext"),children:"↓"})]})]}),m.jsx("div",{className:`diff-editor diff-editor-${n}${o?" is-wrap":""}`,ref:p,onMouseDown:C}),r.length>0&&m.jsx("div",{className:"diff-comments",children:r.map(E=>m.jsxs("div",{className:`diff-comment${E.sentAt?" sent":""}`,children:[m.jsxs("span",{className:"diff-comment-line",children:["L",E.lineStart,E.lineEnd!==E.lineStart?`-L${E.lineEnd}`:""]}),m.jsx("span",{className:"diff-comment-body",children:E.body}),E.sentAt&&m.jsx(ze,{name:"check",size:12}),m.jsx(Zt,{icon:"pencil",size:12,label:f("session.diffEdit"),onClick:()=>l(E)}),m.jsx(Zt,{icon:"trash",size:12,label:f("session.diffRetract"),onClick:()=>u(E)})]},E.id))})]})}function H6({segments:t}){const e=k.useRef(null),[i,r]=k.useState(!1);return k.useEffect(()=>{const s=e.current;if(!s||typeof ResizeObserver>"u")return;const n=()=>r(s.scrollWidth>s.clientWidth+1);n();const o=new ResizeObserver(n);return o.observe(s),()=>o.disconnect()},[t]),t.length?m.jsx("span",{className:`path-head${i?" is-clipped":""}`,ref:e,children:[...t].reverse().map((s,n)=>m.jsxs("span",{children:[s,"/"]},`${t.length-n}:${s}`))}):null}function $6({nodes:t,depth:e,prefix:i,scope:r,selected:s,openDirs:n,onToggleDir:o,onSelect:a}){return t.map(l=>{if(l.kind==="dir"){const c=i?`${i}/${l.name}`:l.name,h=n.has(c);return m.jsxs(k.Fragment,{children:[m.jsxs("button",{type:"button",className:"ft-row ft-dir",style:{paddingLeft:6+e*11,"--depth":e},"aria-expanded":h,"data-tip":c,onClick:()=>o(c),children:[m.jsx("span",{className:"ft-caret",children:m.jsx(qa,{open:h})}),m.jsx("span",{className:"ft-label",children:l.name.includes("/")?m.jsxs(m.Fragment,{children:[m.jsx(H6,{segments:l.name.split("/").slice(0,-1)}),m.jsx("span",{className:"path-leaf",children:l.name.split("/").pop()})]}):m.jsx("span",{className:"path-leaf",children:l.name})})]}),h&&m.jsx($6,{nodes:l.children,depth:e+1,prefix:c,scope:r,selected:s,openDirs:n,onToggleDir:o,onSelect:a})]},`d:${c}`)}const u=`${r}:${l.file.path}`;return m.jsxs("button",{type:"button",className:`ft-row ft-code diff-tree-file${u===s?" on":""}`,style:{paddingLeft:6+e*11,"--depth":e},"aria-current":u===s?"true":void 0,"data-tip":l.file.path,onClick:()=>a(u),children:[m.jsx("span",{className:"ft-caret"}),m.jsx("span",{className:"ft-label",children:m.jsx("span",{className:"path-leaf",children:l.name})}),m.jsxs("span",{className:"diff-tree-stat",children:[m.jsxs("span",{className:"diff-add",children:["+",l.file.additions]})," ",m.jsxs("span",{className:"diff-del",children:["−",l.file.deletions]})]})]},`f:${u}`)})}function GM({sessionId:t}){var H,re,G,X,oe;const e=Ie(),{lang:i}=u4(),r=k.useRef(new Map),[s,n]=k.useState({phase:"loading",data:null,error:null}),[o,a]=k.useState(null),[l,u]=k.useState(""),[c,h]=k.useState("split"),[d,f]=k.useState(!1),[p,v]=k.useState(""),[_,w]=k.useState(()=>new Set),x=k.useCallback((I,Y)=>{Y?r.current.set(I,Y):r.current.delete(I)},[]),C=()=>{n(I=>({...I,phase:"loading"})),Hi(Go(t,"diff"),{cache:"no-store"}).then(async I=>{var le;const Y=await I.json().catch(()=>({}));if(I.status===409){n({phase:"unavailable",data:null,error:null,detail:(Y==null?void 0:Y.error)||""});return}if(!I.ok)throw new Error((Y==null?void 0:Y.error)||`HTTP ${I.status}`);n({phase:"ready",data:Y,error:null}),v(te=>KM(Y,te)?te:Un(VM(Y))),w(new Set([...sf(Gc(Y.files||[])),...sf(Gc(((le=Y.working)==null?void 0:le.files)||[]))]))}).catch(I=>n({phase:"error",data:null,error:I}))};k.useEffect(()=>(C(),()=>{r.current.clear()}),[t]);const D=((H=s.data)==null?void 0:H.files)||[],R=((G=(re=s.data)==null?void 0:re.working)==null?void 0:G.files)||[],E=[...D.map(I=>({scope:"branch",file:I})),...R.map(I=>({scope:"working",file:I}))],L=((X=s.data)==null?void 0:X.comments)||[],q=L.filter(I=>!I.sentAt).length,F=E.find(I=>Un(I)===p)||E[0]||null,$=Math.max(0,E.findIndex(I=>Un(I)===p)),W=k.useCallback(I=>w(Y=>{const le=new Set(Y);return le.delete(I)||le.add(I),le}),[]),z=I=>{const Y=I>0?fM:pM,le=r.current.get(p);le&&Y(c==="split"?le.b:le)||E.length<2||v(Un(E[($+I+E.length)%E.length]))},j=async()=>{if(!o||!l.trim())return;const I=E.find(le=>le.file.path===o.filePath)||F;if(!I)return;(await Hi(Go(t,"diff-comments"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...o,filePath:o.filePath||I.file.path,body:l,diffIdentity:I.file.diffIdentity})})).ok&&(a(null),u(""),C())},A=async I=>{(await Hi(`${Go(t,"diff-comments")}/${encodeURIComponent(I.id)}`,{method:"DELETE"})).ok&&(a(le=>(le==null?void 0:le.id)===I.id?null:le),C())},O=async()=>{(await Hi(Go(t,"diff-comments","send"),{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"})).ok&&C()};if(s.phase==="loading")return m.jsx("div",{className:"diff-state",children:e("session.diffLoading")});if(s.phase==="unavailable")return m.jsxs("div",{className:"diff-state diff-unavailable",children:[e("session.diffUnavailable"),s.detail?m.jsx("code",{className:"diff-oids",children:s.detail}):null]});if(s.phase==="error")return m.jsx("div",{className:"diff-state error",children:e("session.diffFailed",{message:((oe=s.error)==null?void 0:oe.message)||String(s.error)})});const T=s.data.branchState==="no-commits"?m.jsx("div",{className:"diff-state diff-no-commits",children:e("session.diffNoCommits")}):s.data.branchState==="merged"?m.jsxs("div",{className:"diff-state diff-merged",children:[m.jsx("strong",{children:e("session.diffMerged",{base:s.data.baseRef})}),s.data.commitUrl?m.jsx("a",{href:s.data.commitUrl,target:"_blank",rel:"noreferrer",children:e("session.diffCommit",{commit:s.data.head})}):m.jsx("code",{children:s.data.head})]}):m.jsx("div",{className:"diff-state",children:e("session.diffEmpty")}),U=(I,Y)=>Y.length>0&&m.jsxs(k.Fragment,{children:[m.jsx("div",{className:"diff-file-group",children:e(I==="branch"?"session.diffGroupCommitted":"session.diffGroupUncommitted",{n:Y.length})}),m.jsx($6,{nodes:Gc(Y),depth:0,prefix:"",scope:I,selected:p,openDirs:_,onToggleDir:W,onSelect:v})]},I);return m.jsxs("div",{className:"diff-document","data-diff-document":!0,"data-branch-state":s.data.branchState,lang:i,children:[m.jsxs("header",{className:"diff-toolbar",children:[m.jsxs("span",{className:"diff-refs",children:[m.jsx(ze,{name:"git-merge",size:14}),m.jsx("strong",{children:s.data.branch}),m.jsx("span",{children:"→"}),m.jsx("strong",{children:s.data.baseRef})]}),m.jsx("span",{className:"diff-toolbar-spacer"}),m.jsxs("div",{className:"diff-mode",role:"group","aria-label":e("session.diffMode"),children:[m.jsx("button",{type:"button","aria-pressed":c==="split",onClick:()=>h("split"),children:e("session.diffSplit")}),m.jsx("button",{type:"button","aria-pressed":c==="unified",onClick:()=>h("unified"),children:e("session.diffUnified")})]}),m.jsx("button",{type:"button","aria-pressed":d,onClick:()=>f(I=>!I),children:e("session.diffWrap")}),q>0&&m.jsx("span",{className:"diff-unsent",children:e("session.diffUnsent",{n:q})}),m.jsx(Zt,{icon:"send",size:14,label:e("session.diffSend"),disabled:!q,onClick:O})]}),m.jsxs("code",{className:"diff-oids",children:[s.data.head," → ",s.data.base]}),!E.length&&T,E.length>0&&m.jsxs("div",{className:"diff-review-body",children:[m.jsxs("nav",{className:"diff-file-panel","aria-label":e("session.diffFiles"),children:[m.jsx("div",{className:"diff-file-panel-head",children:m.jsx("span",{children:e("session.diffFiles")})}),[U("branch",D),U("working",R)]]}),m.jsxs("div",{className:"diff-files",children:[!D.length&&m.jsx("div",{className:"diff-scope-note",children:T}),F&&m.jsx(UM,{sessionId:t,file:F.file,scope:F.scope,open:!0,mode:c,wrap:d,comments:L.filter(I=>I.filePath===F.file.path),onView:(I,Y)=>x(Un(F),Y),onNext:()=>z(1),onPrevious:()=>z(-1),onComment:(I,Y)=>{I!=null&&(a({filePath:F.file.path,lineStart:I,lineEnd:Y}),u(""))},onEdit:I=>{a(I),u(I.body)},onRetract:A},`${Un(F)}:${F.file.diffIdentity}`)]})]}),o&&m.jsxs("div",{className:"diff-comment-compose",role:"dialog",children:[m.jsx("strong",{children:e("session.diffComment")}),m.jsxs("span",{children:[o.filePath||(F==null?void 0:F.file.path),":L",o.lineStart]}),m.jsx("textarea",{autoFocus:!0,value:l,onChange:I=>u(I.target.value),placeholder:e("session.diffCommentPlaceholder")}),m.jsxs("div",{children:[m.jsx("button",{type:"button",onClick:()=>a(null),children:e("common.cancel")}),m.jsx("button",{type:"button",disabled:!l.trim(),onClick:j,children:e("session.diffCommentSave")})]})]})]})}const YM=[{id:"claude",label:"Claude Code",Glyph:z5},{id:"codex",label:"Codex",Glyph:j5},{id:"opencode",label:"opencode",Glyph:H5},{id:"pi",label:"pi",Glyph:$5}],q2=Object.fromEntries(YM.map(t=>[t.id,t])),W2=t=>{const e=typeof t=="string"?t.replace(/-headless$/,""):"";return q2[e]||q2.claude},Zl=new Map;async function XM(t){if(Zl.has(t))return Zl.get(t);const e=Hi(t).then(async i=>{const r=await i.json().catch(()=>null);if(!i.ok)throw new Error((r==null?void 0:r.error)||`HTTP ${i.status}`);return r}).finally(()=>Zl.delete(t));return Zl.set(t,e),e}const NR=t=>{const e=typeof t=="string"&&/^\d+$/.test(t)?Number(t):Number.NaN;return Number.isSafeInteger(e)&&e>0?e:1};function JM(t,e){return e<=0?[]:e<=10?Array.from({length:e},(i,r)=>r+1):t<=7?[...Array.from({length:8},(i,r)=>r+1),"gap",e-1,e]:t>=e-6||t>e?[1,2,"gap",...Array.from({length:8},(i,r)=>e-7+r)]:[1,2,"gap",t-2,t-1,t,t+1,t+2,"gap",e-1,e]}function LR(t,e,i,{enabled:r=!0,refreshKey:s=null,pollMs:n=15e3,view:o=null}={}){const[a,l]=k.useState(null),[u,c]=k.useState(null),[h,d]=k.useState(r),f=k.useRef(0),p=k.useCallback(async({quiet:_=!1}={})=>{if(!r)return null;const w=++f.current;_||d(!0),c(null);const x=new URLSearchParams({q:String(e||""),page:String(i)});o&&x.set("view",o);try{const C=await XM(`/api/${t}?${x}`);return w===f.current&&l(D=>D&&C&&D.revision===C.revision?D:C),C}catch(C){return w===f.current&&c(C instanceof Error?C.message:String(C)),null}finally{w===f.current&&d(!1)}},[t,r,i,e,o]),v=k.useRef(null);return k.useEffect(()=>{if(!r){d(!1);return}const _=`${t}\0${e}\0${i}\0${o||""}`,w=_!==v.current;v.current=_,w&&l(null),p({quiet:!w});const x=n>0?setInterval(()=>p({quiet:!0}),n):null;return()=>{x&&clearInterval(x)}},[t,e,i,o,r,p,n,s]),{data:a,error:u,loading:h,reload:p}}const Ql=8,K2=t=>[...(t==null?void 0:t.querySelectorAll('[role="menuitem"]:not(:disabled)'))||[]];function S1({x:t,y:e,anchorKey:i,label:r,keyboard:s=!1,children:n}){const o=k.useRef(null),[a,l]=k.useState({left:t,top:e,visibility:"hidden"});k.useLayoutEffect(()=>{var h;const c=(h=o.current)==null?void 0:h.getBoundingClientRect();c&&l({left:Math.max(Ql,Math.min(t,window.innerWidth-c.width-Ql)),top:Math.max(Ql,Math.min(e,window.innerHeight-c.height-Ql)),visibility:"visible"})},[t,e,i]),k.useEffect(()=>{var c;s&&a.visibility==="visible"&&((c=K2(o.current)[0])==null||c.focus())},[s,a.visibility,i]);const u=k.useCallback(c=>{const h=K2(o.current);if(!h.length)return;const d=c.key==="ArrowDown"?1:c.key==="ArrowUp"?-1:0,f=c.key==="Home"?0:c.key==="End"?h.length-1:null;if(!d&&f===null)return;if(c.preventDefault(),c.stopPropagation(),f!==null){h[f].focus();return}const p=h.indexOf(document.activeElement);h[p===-1?d>0?0:h.length-1:(p+d+h.length)%h.length].focus()},[]);return m.jsx("div",{ref:o,className:"sess-menu",role:"menu","aria-label":r,style:a,onClick:c=>c.stopPropagation(),onKeyDown:u,onMouseDownCapture:ya,children:n})}function Yu({children:t}){return m.jsx("div",{className:"sess-menu-group",role:"group",children:t})}function q6(){return m.jsx("div",{className:"sess-menu-sep",role:"separator"})}function Ci({icon:t,leading:e,danger:i=!1,hint:r=null,className:s="",children:n,...o}){if(!t&&!e)throw new Error("context menu item requires an icon or leading glyph");const a=["sess-menu-item",i&&"danger",s].filter(Boolean).join(" ");return m.jsxs("button",{type:"button",role:"menuitem",className:a,...o,children:[m.jsx("span",{className:"sess-menu-icon",children:e??m.jsx(ze,{name:t,size:14,className:"sess-menu-svg"})}),m.jsx("span",{className:"sess-menu-label",children:n}),r?m.jsx("span",{className:"sess-menu-hint","aria-hidden":"true",children:r}):null]})}const OR=t=>({kind:"graph-node",nodeId:t}),PR=t=>({kind:"spec",nodeId:t}),FR=t=>({kind:"session",sessionId:t}),IR=t=>({kind:"issue",issueId:t}),zR=(t,e)=>({kind:"review-list",page:t,query:e}),jR=(t,e=null)=>({kind:"eval",nodeId:t,scenario:e}),nf=(t,e,i)=>({kind:"session-eval",sessionId:t,nodeId:e,scenario:i}),ZM=t=>({kind:"hash",hash:t});function tl(t){if(!t)return Vt("graph");if(t.kind==="hash")return t.hash;if(t.kind==="graph-node")return Vt("graph",t.nodeId);if(t.kind==="spec")return Vt("spec",t.nodeId);if(t.kind==="session")return Vt("sessions",t.sessionId);if(t.kind==="session-surface")return t.surface==="evals"?Vt("evals",null,{q:X1(t.sessionId)}):Vt("sessions",t.sessionId,{surface:t.surface});if(t.kind==="session-eval"){const e=t.nodeId&&t.scenario?`${t.nodeId}/${t.scenario}`:null;return Vt("evals",e,{q:e?`scope:${t.sessionId}`:X1(t.sessionId)})}return t.kind==="issue"?Vt("issues",t.issueId):t.kind==="review-list"?Vt(t.page,null,t.query?{q:t.query}:null):t.kind==="eval"?t.scenario?Vt("evals",`${t.nodeId}/${t.scenario}`):Vt("evals",null,{q:Z5(t.nodeId)}):Vt("graph")}function QM(t){const{page:e,param:i,query:r}=mf(tl(t));return{page:e,param:i,query:r}}const eT=(t,e=window.location.href)=>new URL(tl(t),e).href;function tT(t){var s;const e=document.activeElement,i=document.createElement("textarea");i.value=t,i.style.cssText="position:fixed;left:-9999px;top:0",document.body.append(i),i.select();let r=!1;try{r=document.execCommand("copy")}catch{}return i.remove(),(s=e==null?void 0:e.focus)==null||s.call(e),r}async function iT(t){var e;try{if((e=navigator.clipboard)!=null&&e.writeText)return await navigator.clipboard.writeText(t),!0}catch{}return tT(t)}const rT=t=>iT(eT(t));function HR(t,e=null){return t==="issues"?Vt("issues"):e?tl(nf(e)):Vt("evals")}function $R(t,{onOpenSession:e}={}){if(t)if(t.kind==="session")e?e(t.sessionId):yn("sessions",t.sessionId);else{const{page:i,param:r,query:s}=mf(tl(t));yn(i,r,{query:s})}}const V2={issue:{open:{icon:"issue-opened",tone:"open",label:"reviewState.issueOpen"},closed:{icon:"issue-closed",tone:"closed",label:"reviewState.issueClosed"}},eval:{pass:{icon:"circle-check",tone:"pass",label:"score.pass"},fail:{icon:"circle-x",tone:"fail",label:"score.fail"},stalePass:{icon:"circle-check-dashed",tone:"stale",label:"score.stalePass"},staleFail:{icon:"circle-x-dashed",tone:"stale",label:"score.staleFail"},review:{icon:"clock",tone:"review",label:"reviewList.needsReview"},empty:{icon:"circle-minus",tone:"empty",label:"score.empty"},missing:{icon:"circle-dashed",tone:"empty",label:"score.missing"},legacy:{icon:"circle-minus",tone:"empty",label:"score.empty"}}},sT=(t,e)=>{var r;const i=t==="issue"?e==="open"?"open":"closed":e||"empty";return((r=V2[t])==null?void 0:r[i])||V2.eval.empty};function to({kind:t,state:e,showLabel:i=!1,size:r=16,className:s="",title:n}){const o=Ie(),a=sT(t,e),l=n||o(a.label);return m.jsxs("span",{className:`review-state ${t} ${a.tone} ${s}`,"data-tip":l,"aria-label":l,children:[m.jsx("span",{className:"review-state-icon",style:{width:r,height:r},children:m.jsx(ze,{name:a.icon,size:r})}),i&&m.jsx("span",{className:"review-state-label",children:l})]})}function qR(t,e){const i={...t,...e};for(const[r,s]of Object.entries(i))(s==null||s==="")&&delete i[r];return i}const nT=t=>t&&typeof t=="object"?t.hasData?t.filtered:t.dataset:t,W6=(t,e,i)=>{const r=Array.isArray(t)?t:[];return!(e!=null&&String(e)!=="")||i==null||r.some(n=>String(n.value)==="")?r:[{value:"",label:i},...r]},oT=(t=[])=>t.reduce((e,i)=>((i.active??(i.value!=null&&String(i.value)!==""))&&(e.mobile+=1,i.mobileOnly||(e.desktop+=1)),e),{desktop:0,mobile:0}),k1=(t,e,i)=>e?i==="Home"?0:i==="End"?e-1:i==="ArrowDown"||i==="ArrowRight"?t<0?0:(t+1)%e:i==="ArrowUp"||i==="ArrowLeft"?t<0?e-1:(t-1+e)%e:t:-1,aT=(t,e)=>{var r;const i=t==null?void 0:t.tagName;return i==="INPUT"||i==="TEXTAREA"||i==="SELECT"||i==="BUTTON"&&(e==="Enter"||e===" ")||e==="Enter"&&((r=t==null?void 0:t.closest)!=null&&r.call(t,"a[href]"))?!1:e==="j"||e==="k"||e==="Enter"},Xc=t=>[...(t==null?void 0:t.querySelectorAll('[role="menuitemradio"]'))||[]].filter(e=>e.getClientRects().length>0),Jc=(t,e)=>{const i=t[e];if(i){for(const r of t)r.tabIndex=r===i?0:-1;i.focus()}};function K6(){const[t,e]=k.useState(!1),i=k.useRef(null),r=k.useRef(null),s=k.useRef(null),n=k.useRef("checked"),o=(d=!1)=>{var f;d&&((f=s.current)==null||f.focus()),e(!1)},a=(d,f="checked")=>{s.current=d,n.current=f,e(!0)},l=d=>{t?o(!1):a(d)};return ni(t,()=>o(!0)),k.useEffect(()=>{if(!t)return;const d=f=>{var p;(p=i.current)!=null&&p.contains(f.target)||o(!1)};return window.addEventListener("pointerdown",d,!0),()=>window.removeEventListener("pointerdown",d,!0)},[t]),k.useEffect(()=>{if(!t)return;const d=requestAnimationFrame(()=>{const f=Xc(r.current),p=f.findIndex(_=>_.getAttribute("aria-checked")==="true"),v=n.current==="last"?f.length-1:n.current==="first"?0:p>=0?p:0;Jc(f,v)});return()=>cancelAnimationFrame(d)},[t]),{open:t,ref:i,menuRef:r,close:o,toggle:l,onTriggerKeyDown:d=>{d.key!=="ArrowDown"&&d.key!=="ArrowUp"||(d.preventDefault(),d.stopPropagation(),a(d.currentTarget,d.key==="ArrowUp"?"last":"first"))},onMenuKeyDown:d=>{if(!["ArrowDown","ArrowUp","Home","End"].includes(d.key))return;const f=Xc(r.current),p=f.indexOf(document.activeElement);d.preventDefault(),d.stopPropagation(),Jc(f,k1(p,f.length,d.key))},onItemFocus:d=>{const f=Xc(r.current);Jc(f,f.indexOf(d.currentTarget))}}}function WR({label:t,value:e="",options:i=[],onChange:r,mobile:s=!1,clearLabel:n}){const o=K6(),a=W6(i,e,n);if(!a.length)return null;const l=a.find(h=>String(h.value)===String(e)),u=e?(l==null?void 0:l.label)||String(e):"",c=u?`${t}: ${u}`:t;return m.jsxs("div",{className:`rl-facet-wrap ${s?"mobile-stay":""}`,ref:o.ref,children:[m.jsxs("button",{type:"button",className:`rl-facet ${e?"active":""}`,"aria-label":c,"aria-haspopup":"menu","aria-expanded":o.open,onClick:h=>o.toggle(h.currentTarget),onKeyDown:o.onTriggerKeyDown,children:[m.jsx("span",{className:"rl-facet-label",children:c}),s&&m.jsx("span",{className:"rl-facet-label-mobile","aria-hidden":"true",children:u||t}),m.jsx(ze,{name:"chevron-down",size:12})]}),o.open&&m.jsx("div",{className:"rl-menu",role:"menu","aria-label":t,ref:o.menuRef,onKeyDown:o.onMenuKeyDown,children:a.map(h=>m.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":String(h.value)===String(e),tabIndex:-1,className:"rl-menu-item",onFocus:o.onItemFocus,onClick:()=>{o.close(!0),r(h.value)},children:[m.jsx(ze,{name:String(h.value)===String(e)?"check":"blank",size:13}),m.jsx("span",{children:h.label}),h.count!=null&&m.jsx("span",{className:"rl-menu-count",children:h.count})]},String(h.value)))})]})}function lT({label:t,groups:e=[],clearLabel:i,compact:r=!1,className:s=""}){const n=Ie(),o=k.useId(),a=e.map(d=>({...d,options:W6(d.options,d.value,d.clearLabel===null?null:d.clearLabel||i)})).filter(d=>d.options.length),l=a.some(d=>!d.mobileOnly),u=oT(a),c=K6();if(!a.length)return null;const h=(d,f)=>d>0&&m.jsxs("span",{className:`rl-secondary-filter-count ${f}`,children:[m.jsx("span",{"aria-hidden":"true",children:d}),m.jsx("span",{className:"sr-only",children:n("reviewList.activeFilters",{n:d})})]});return m.jsxs("div",{className:`rl-secondary-filters ${l?"":"mobile-only"} ${u.desktop?"active-desktop":""} ${u.mobile?"active-mobile":""} ${s}`,ref:c.ref,children:[r?m.jsx(Zt,{icon:"filter",size:16,className:"rl-secondary-filters-trigger compact",label:t,"aria-haspopup":"menu","aria-expanded":c.open,onClick:d=>c.toggle(d.currentTarget),onKeyDown:c.onTriggerKeyDown}):m.jsxs("button",{type:"button",className:"rl-secondary-filters-trigger","aria-haspopup":"menu","aria-expanded":c.open,onClick:d=>c.toggle(d.currentTarget),onKeyDown:c.onTriggerKeyDown,children:[m.jsx(ze,{name:"filter",size:14}),m.jsx("span",{children:t}),h(u.desktop,"for-desktop"),h(u.mobile,"for-mobile"),m.jsx(ze,{name:"chevron-down",size:12})]}),c.open&&m.jsx("div",{className:"rl-menu rl-secondary-filters-menu",role:"menu","aria-label":t,ref:c.menuRef,onKeyDown:c.onMenuKeyDown,children:a.map((d,f)=>m.jsxs("div",{role:"group","aria-labelledby":`${o}-group-${f}`,className:`rl-menu-group ${d.mobileOnly?"mobile-only":""}`,children:[m.jsx("div",{className:"rl-menu-label",id:`${o}-group-${f}`,children:d.label}),d.options.map(p=>m.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":String(p.value)===String(d.value||""),tabIndex:-1,className:"rl-menu-item",onFocus:c.onItemFocus,onClick:()=>{c.close(!0),d.onChange(p.value)},children:[m.jsx(ze,{name:String(p.value)===String(d.value||"")?"check":"blank",size:13}),m.jsx("span",{children:p.label}),p.count!=null&&m.jsx("span",{className:"rl-menu-count",children:p.count})]},String(p.value)))]},`${d.label}-${d.mobileOnly?"mobile":"all"}`))})]})}function KR({state:t,title:e,meta:i,aside:r}){return m.jsxs("div",{className:"rl-row-grid",children:[m.jsx("div",{className:"rl-row-state",children:t}),m.jsxs("div",{className:"rl-row-body",children:[m.jsx("div",{className:"rl-row-title",children:e}),i&&m.jsx("div",{className:"rl-row-meta",children:i})]}),r&&m.jsx("div",{className:"rl-row-aside",children:r})]})}const eu=t=>{const e=String(t??"").trim();return e?`${e} `:""};function uT({value:t="",onSubmit:e,placeholder:i,label:r,keys:s=[],suggest:n={}}){const[o,a]=k.useState(()=>eu(t)),[l,u]=k.useState(-1),[c,h]=k.useState(-1),d=k.useRef(null),f=k.useRef(null),p=k.useId(),v=k.useRef(null),_=E=>requestAnimationFrame(()=>{const L=d.current;L&&(E&&L.focus(),L.setSelectionRange(L.value.length,L.value.length))});k.useEffect(()=>{a(eu(t)),u(-1),h(-1),_(v.current!==null&&v.current!==t),v.current=t},[t]);const w=l>=0?Q5(o,l,s,n):{start:0,end:0,items:[]},x=w.items.length>0;ni(x,()=>u(-1));const C=()=>{f.current&&d.current&&(f.current.scrollLeft=d.current.scrollLeft)};k.useEffect(C);const D=E=>{u(-1),h(-1);const L=E.trim();a(eu(L)||eu(t)),_(!0),e(L)},R=E=>{const L=`${o.slice(0,w.start)}${E.insert}${o.slice(w.end)}`;if(a(L),E.type==="value"){D(L);return}const q=w.start+E.insert.length;u(q),h(-1),requestAnimationFrame(()=>{var F,$;(F=d.current)==null||F.focus(),($=d.current)==null||$.setSelectionRange(q,q)})};return m.jsxs("form",{className:"rl-query rq",role:"search",onSubmit:E=>{E.preventDefault(),D(o)},children:[m.jsxs("div",{className:"rq-wrap",children:[m.jsx("div",{className:"rq-hl","aria-hidden":"true",ref:f,children:e_(o).map((E,L)=>E.ws||E.key==null||!s.includes(E.key)?m.jsx("span",{children:E.raw},L):m.jsxs("span",{className:"rq-tok",children:[m.jsx("span",{className:"rq-tok-key",children:E.raw.slice(0,E.key.length+1)}),m.jsx("span",{className:"rq-tok-val",children:E.raw.slice(E.key.length+1)})]},L))}),m.jsx("input",{ref:d,role:"combobox","aria-expanded":x,"aria-controls":p,"aria-autocomplete":"list","aria-activedescendant":x&&c>=0?`${p}-o${c}`:void 0,value:o,spellCheck:!1,autoComplete:"off",placeholder:i,"aria-label":r,onChange:E=>{a(E.target.value),u(E.target.selectionStart??E.target.value.length),h(-1)},onScroll:C,onKeyDown:E=>{x&&(E.key==="ArrowDown"||E.key==="ArrowUp"?(E.preventDefault(),h(k1(c,w.items.length,E.key))):E.key==="Enter"&&c>=0&&(E.preventDefault(),R(w.items[c])))},onBlur:()=>u(-1)})]}),x&&m.jsx("div",{className:"rl-menu rq-list",role:"listbox",id:p,"aria-label":r,children:w.items.map((E,L)=>m.jsxs("div",{id:`${p}-o${L}`,role:"option","aria-selected":L===c,className:`rq-opt ${L===c?"active":""}`,onPointerDown:q=>{q.preventDefault(),R(E)},children:[m.jsx("span",{className:"rq-opt-token",children:E.insert.trim()}),E.label&&E.label!==E.value&&m.jsx("span",{className:"rq-opt-label",children:E.label})]},E.insert))}),m.jsx("button",{type:"submit",className:"rl-query-submit","data-tip":r,"aria-label":r,children:m.jsx(ze,{name:"search",size:16})})]})}function VR({value:t="",onChange:e,placeholder:i,searchLabel:r,filterLabel:s,groups:n,clearLabel:o,clearSearchLabel:a,summary:l,trailing:u=null}){const c=Ie(),h=m.jsxs("div",{className:"rf-compact",role:"search",children:[m.jsx("span",{className:"rf-search-icon",children:m.jsx(ze,{name:"search",size:13})}),m.jsx("input",{value:t,onChange:f=>e(f.target.value),placeholder:i,"aria-label":r}),t&&m.jsx(Zt,{icon:"x",size:12,className:"rf-clear",label:a,onClick:()=>e("")}),m.jsx(lT,{label:s,clearLabel:o,groups:n,compact:!0,className:"rf-secondary-filters"})]});if(!l)return h;const d=c("reviewList.showing",{shown:l.shown,total:l.total});return m.jsxs("div",{className:"rf-row",children:[m.jsxs("span",{className:"rf-summary","data-tip":d,children:[m.jsx("span",{className:"sr-only",children:d}),m.jsx("span",{className:"rf-summary-full","aria-hidden":"true",children:d}),m.jsxs("span",{className:"rf-summary-compact","aria-hidden":"true",children:[l.shown,"/",l.total]})]}),h,u]})}function cT({page:t,pageCount:e,prev:i,next:r,hrefFor:s}){const n=Ie();if(e<=1&&t<=1)return null;const o=(a,l,u,c="")=>a==null?m.jsx("span",{className:`rl-page-link disabled ${c}`,"aria-disabled":"true",children:l}):m.jsx("a",{className:`rl-page-link ${c}`,href:s(a),rel:u,"aria-label":u?n(`reviewList.${u}Page`):n("reviewList.page",{n:a}),children:l});return m.jsxs("nav",{className:"rl-pagination","aria-label":n("reviewList.pagination"),children:[o(i,n("reviewList.previous"),"prev","direction"),JM(t,e).map((a,l)=>a==="gap"?m.jsx("span",{className:"rl-page-gap","aria-hidden":"true",children:"…"},`gap-${l}`):m.jsx("a",{className:"rl-page-link number",href:s(a),"aria-label":n("reviewList.page",{n:a}),"aria-current":a===t?"page":void 0,children:a},a)),o(r,n("reviewList.next"),"next","direction")]})}function hT({menu:t,onClose:e}){const i=Ie();if(k.useEffect(()=>{if(t)return window.addEventListener("click",e),window.addEventListener("contextmenu",e,!0),()=>{window.removeEventListener("click",e),window.removeEventListener("contextmenu",e,!0)}},[t,e]),ni(!!t,e),!t)return null;const r=s=>n=>{n.stopPropagation(),e(),s()};return m.jsxs(S1,{x:t.x,y:t.y,anchorKey:t.href,label:i("reviewList.rowMenu"),children:[m.jsx(Ci,{icon:"plus",onClick:r(()=>{const s=l5(t.href);T1(s.page,s.param,s.query)}),children:i("tabs.openInNewTab")}),m.jsx(Ci,{icon:"copy",onClick:r(()=>rT(ZM(t.href))),children:i("reviewList.copyAddress")})]})}function UR({leading:t,error:e,loading:i=!1,title:r,action:s,search:n,sections:o=[],sectionMode:a="tabs",facets:l,secondaryFilters:u,rows:c,empty:h,pagination:d,children:f}){const p=Ie(),[v,_]=k.useState(null),[w,x]=k.useState(null),C=k.useId(),D=k.useRef({});D.current={rows:c,cur:v},gf($=>{if($.metaKey||$.ctrlKey||$.altKey||!aT($.target,$.key))return!1;const W=D.current.rows.filter(A=>A.href);if(!W.length)return!1;if($.key==="Enter"){const A=W.find(O=>O.key===D.current.cur);return A?($.preventDefault(),window.location.hash=A.href,!0):!1}$.preventDefault();const z=W.findIndex(A=>A.key===D.current.cur),j=z<0?$.key==="j"?0:W.length-1:Math.max(0,Math.min(W.length-1,z+($.key==="j"?1:-1)));return _(W[j].key),!0}),k.useEffect(()=>{var $;($=document.querySelector(".lp-row.cur"))==null||$.scrollIntoView({block:"nearest"})},[v]);const R=nT(h),E=Math.max(0,o.findIndex($=>$.active)),L=a==="tabs",q=`${C}-panel`,F=$=>`${C}-tab-${$}`;return m.jsxs(ru,{className:"lp-page",children:[t,m.jsxs("div",{className:"rl-content",children:[m.jsxs("div",{className:"rl-titlebar",children:[m.jsx("h1",{children:r}),s]}),n&&m.jsx(uT,{...n}),e&&m.jsx("div",{className:"fv-error lp-error",role:"alert",children:e}),m.jsxs("section",{className:"rl-list",children:[m.jsxs("header",{className:"lp-head",children:[m.jsx("div",{className:"rl-sections",role:L?"tablist":"group","aria-label":r,...L?{"aria-orientation":"horizontal"}:{},children:o.map(($,W)=>m.jsxs("button",{type:"button",role:L?"tab":void 0,"aria-selected":L?$.active:void 0,"aria-pressed":L?void 0:$.active,"aria-controls":L?q:void 0,id:L?F(W):void 0,tabIndex:L?W===E?0:-1:void 0,className:`rl-section ${$.active?"active":""}`,onClick:$.onSelect,onKeyDown:z=>{var O,T;if(!L||!["ArrowLeft","ArrowRight","Home","End"].includes(z.key))return;const j=[...z.currentTarget.closest('[role="tablist"]').querySelectorAll('[role="tab"]')],A=k1(j.indexOf(z.currentTarget),j.length,z.key);z.preventDefault(),z.stopPropagation(),(O=j[A])==null||O.focus(),(T=j[A])==null||T.click()},children:[m.jsx("span",{children:$.label}),m.jsx("span",{className:"rl-section-count",children:$.count}),$.countSuffix&&m.jsxs("span",{className:"rl-section-suffix","data-tip":$.countSuffix.text,children:[m.jsx("span",{className:"sr-only",children:$.countSuffix.text}),m.jsx("span",{className:"rl-section-suffix-full","aria-hidden":"true",children:$.countSuffix.text}),m.jsx("span",{className:"rl-section-suffix-compact","aria-hidden":"true",children:$.countSuffix.compact})]})]},$.key))}),m.jsxs("div",{className:"rl-facets",children:[l,u]})]}),m.jsxs("div",{className:"lp-rows",role:L?"tabpanel":"region",id:q,"aria-busy":i||void 0,"aria-labelledby":L?F(E):void 0,"aria-label":L?void 0:r,children:[c.length===0&&m.jsx("div",{className:"lp-empty",children:i?p("common.loading"):R}),c.map($=>m.jsxs("div",{className:`lp-row ${$.href?"":"inert"} ${$.cls||""} ${v===$.key?"cur":""}`,children:[$.href&&m.jsx("a",{className:"lp-row-link",href:$.href,onClick:W=>u5(W,$.href),onContextMenu:W=>{W.preventDefault(),x({x:W.clientX,y:W.clientY,href:$.href})},children:m.jsx("span",{className:"sr-only",children:$.label||$.key})}),$.content]},$.key))]})]}),d&&m.jsx(cT,{...d})]}),f,m.jsx(hT,{menu:w,onClose:()=>x(null)})]})}function GR({title:t,titleMeta:e,status:i,side:r,composer:s,missing:n,failure:o,listHref:a,listLabel:l,backHref:u,backLabel:c,children:h}){return o?m.jsxs(ru,{className:"ds-page ds-missing ds-failed",role:"alert",children:[m.jsx("div",{className:"ds-missing-note",children:o}),a&&m.jsx("a",{className:"ds-backlink",href:a,children:l})]}):n?m.jsxs(ru,{className:"ds-page ds-missing",children:[m.jsx("div",{className:"ds-missing-note",children:n}),a&&m.jsx("a",{className:"ds-backlink",href:a,children:l})]}):m.jsxs(ru,{className:"ds-page",children:[m.jsxs("header",{className:"ds-head",children:[u&&m.jsx("a",{className:"ds-back",href:u,"data-tip":c,"aria-label":c,children:m.jsx(ze,{name:"arrow-left",size:16})}),m.jsxs("h1",{className:"ds-title",children:[t,e&&m.jsx("span",{className:"ds-title-meta",children:e})]})]}),i&&m.jsx("div",{className:"ds-status",children:i}),m.jsxs("div",{className:"ds-cols",children:[m.jsxs("div",{className:"ds-main",children:[h,s&&m.jsx("div",{className:"ds-compose",children:s})]}),m.jsx("aside",{className:"ds-side",children:r})]})]})}function YR({label:t,children:e}){return m.jsxs("div",{className:"ds-side-sec",children:[m.jsx("span",{className:"ds-side-label",children:t}),m.jsx("div",{className:"ds-side-body",children:e})]})}function XR({text:t,tip:e,dim:i=!1,mono:r=!1,href:s=null,external:n=!1,onClick:o=null,className:a="",lead:l=null,trail:u=null,label:c=null}){const h=`ds-val${i?" dim":""}${r?" mono":""}${s||o?" link":""}${a?` ${a}`:""}`,d=e??(typeof t=="string"?t:void 0),f=c?{"aria-label":c}:{},p=m.jsxs(m.Fragment,{children:[l,m.jsx("span",{className:"ds-val-text",children:t}),u]});return s?m.jsx("a",{className:h,href:s,"data-tip":d,...f,...n?{target:"_blank",rel:"noreferrer"}:{},children:p}):o?m.jsx("button",{type:"button",className:h,onClick:o,"data-tip":d,...f,children:p}):m.jsx("span",{className:h,"data-tip":d,children:p})}function dT(t){var e,i;return((e=t==null?void 0:t.verdict)==null?void 0:e.status)==="pass"?"check":((i=t==null?void 0:t.verdict)==null?void 0:i.status)==="fail"?"cross":null}function fT(t){const e=dT(t);return e?t.fresh?e==="cross"?"fail":"pass":e==="cross"?"staleFail":"stalePass":"empty"}function pT(t,e){if(!t)return[];const i=new Map;for(const r of e||[])i.has(r.scenario)||i.set(r.scenario,r);return t.map(r=>{const s=i.get(r.name)||null;return{...r,reading:s,state:s?fT(s):"missing"}})}function mT(t){return t.length?t.some(e=>e.state==="fail")?"fail":t.some(e=>e.state==="staleFail")?"staleFail":t.some(e=>e.state==="stalePass")?"stalePass":t.some(e=>e.state==="empty"||e.state==="missing")?"empty":"pass":null}const gT=t=>t.fail>0?"fail":t.staleFail>0?"staleFail":t.stalePass>0?"stalePass":t.empty>0?"empty":"pass";function JR({scenarios:t,evals:e,summary:i=null,href:r}){const s=Ie(),n=i?null:pT(t,e),o=(i==null?void 0:i.total)??n.length;if(!o)return null;const a=i?gT(i):mT(n),l=(i==null?void 0:i.pass)??n.filter(d=>d.state==="pass").length,u=s("score.count",{satisfied:l,total:o,outstanding:o-l}),c=m.jsxs(m.Fragment,{children:[m.jsx(ze,{name:"check",size:11}),l,"/",o]});if(!r)return m.jsx("span",{className:`scenario-count ${a}`,"data-tip":u,"aria-label":u,children:c});const h=`${u} — ${s("score.openList")}`;return m.jsx("a",{className:`scenario-count ${a}`,href:r,"data-tip":h,"aria-label":h,children:c})}function Uo({kind:t,state:e,cls:i,n:r,label:s}){return m.jsxs("span",{className:`ovc ${i}`,"data-tip":s,children:[m.jsx(to,{kind:t,state:e,title:s,size:11}),r]})}function ZR({tags:t}){return t!=null&&t.length?m.jsx("span",{className:"tag-chips",children:t.map(e=>m.jsx("span",{className:"tag-chip",children:e},e))}):null}function QR({state:t,title:e}){return t?m.jsx(to,{kind:"eval",state:t,title:e,className:`score-badge ${t}`,size:14}):null}function U2({label:t,cmd:e}){const i=Ie(),[r,s]=k.useState(!1),n=()=>{var o;(o=navigator.clipboard)==null||o.writeText(e).then(()=>s(!0),()=>{})};return m.jsxs("div",{className:"sess-attach-row",children:[m.jsx("span",{className:"sess-attach-label",children:t}),m.jsx("input",{className:"sess-attach-cmd",readOnly:!0,value:e,spellCheck:!1,onFocus:o=>o.target.select()}),m.jsx("button",{type:"button",className:"sess-rename-btn sess-attach-copy",onClick:n,children:i(r?"sessionWindow.attachCopied":"sessionWindow.attachCopy")})]})}function vT({session:t,socket:e,onClose:i}){const r=Ie();if(ni(!!t,i),!t)return null;const s=`spex session attach ${t.id}`,n=`tmux -L ${e} attach -t ${t.id}`;return m.jsx(la,{title:r("sessionWindow.attachTitle",{name:Hr(t)}),closeLabel:r("common.close"),className:"sess-rename-modal sess-attach-modal",onClose:i,children:m.jsxs("div",{className:"sess-attach",children:[m.jsx(U2,{label:r("sessionWindow.attachSpex"),cmd:s}),m.jsx(U2,{label:r("sessionWindow.attachTmux"),cmd:n})]})})}function bT({menu:t,closeRequest:e=null,onCloseRequestDone:i,onClose:r,onChanged:s,onLock:n,onError:o,onMultiSelect:a,onDetach:l}){const u=Ie(),[c,h]=k.useState(null),[d,f]=k.useState(null),[p,v]=k.useState(null),[_,w]=k.useState(null),[x,C]=k.useState("spexcode"),[D,R]=k.useState(""),[E,L]=k.useState({adapter:"claude",thread:"",tmux:"",worktree:"",branch:""}),[q,F]=k.useState(!1),$=k.useRef(null);k.useEffect(()=>{a4().then(te=>{te!=null&&te.tmuxSocket&&C(te.tmuxSocket)}).catch(()=>{})},[]),k.useEffect(()=>{if(!t)return;const te=de=>{var ke,Ye;(Ye=(ke=de.target)==null?void 0:ke.closest)!=null&&Ye.call(ke,'.sess-menu, [aria-haspopup="menu"]')||r()};return window.addEventListener("mousedown",te,!0),()=>window.removeEventListener("mousedown",te,!0)},[t,r]),ni(!!t,r),ni(!!c,()=>h(null)),ni(!!d,()=>f(null)),ni(!!p,()=>v(null)),k.useEffect(()=>{c&&requestAnimationFrame(()=>{var te;return(te=$.current)==null?void 0:te.select()})},[c]);const W=te=>{te.stopPropagation();const{id:de}=t.session;r(),T1("sessions",de)},z=te=>{te.stopPropagation(),n==null||n(t.session),r()},j=te=>{var de;te.stopPropagation(),R((((de=t.session.raw)==null?void 0:de.name)??t.session.name)||""),h(t.session),r()},A=te=>{te.stopPropagation(),a==null||a(t.session),r()},O=te=>{te.stopPropagation(),l==null||l(t.session),r()},T=te=>{te.stopPropagation(),w(t.session),r()},U=te=>{te.stopPropagation();const{id:de}=t.session;r(),Hi(`/api/sessions/${de}/resume`,{method:"POST"}).then(async ke=>{if(ke.ok)return;const Ye=await ke.json().catch(()=>null);o==null||o((Ye==null?void 0:Ye.error)||`session resume refused (HTTP ${ke.status})`)}).catch(ke=>o==null?void 0:o(ke instanceof Error?ke.message:String(ke))).finally(()=>s==null?void 0:s())},H=te=>{te.stopPropagation(),f(t.session),r()},re=te=>{te.stopPropagation();const{id:de}=t.session;L({adapter:"claude",thread:"",tmux:de,worktree:"",branch:""}),v(t.session),r()},G=te=>de=>L(ke=>({...ke,[te]:de.target.value})),X=async te=>{if(te.preventDefault(),!(q||!p)){F(!0);try{const de=await Hi(`/api/sessions/${p.id}/quarantine`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...E,thread:E.thread.trim()||null})}),ke=await de.json().catch(()=>null);if(!de.ok||(ke==null?void 0:ke.ok)===!1){o==null||o((ke==null?void 0:ke.error)||`session quarantine refused (HTTP ${de.status})`);return}v(null)}catch(de){o==null||o(de instanceof Error?de.message:String(de))}finally{F(!1),s==null||s()}}},oe=d||e,I=()=>{f(null),i==null||i()},Y=()=>{const{id:te}=oe;I(),Hi(`/api/sessions/${te}/close`,{method:"POST"}).then(async de=>{const ke=await de.json().catch(()=>null);(!de.ok||(ke==null?void 0:ke.ok)===!1)&&(o==null||o((ke==null?void 0:ke.error)||`session close refused (HTTP ${de.status})`))}).catch(de=>o==null?void 0:o(de instanceof Error?de.message:String(de))).finally(()=>s==null?void 0:s())},le=async te=>{if(te.preventDefault(),!q){F(!0);try{const de=await Hi(`/api/sessions/${c.id}/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:D})}),ke=await de.json().catch(()=>null);(!de.ok||(ke==null?void 0:ke.ok)===!1)&&(s==null||s())}catch{}finally{F(!1),h(null)}}};return m.jsxs(m.Fragment,{children:[t&&m.jsxs(S1,{x:t.x,y:t.y,anchorKey:t.session.id,label:u("sessionWindow.menuLabel"),children:[m.jsxs(Yu,{children:[m.jsx(Ci,{icon:"plus",onClick:W,children:u("tabs.openInNewTab")}),m.jsx(Ci,{icon:"lock",onClick:z,children:u("sessionWindow.lock")}),m.jsx(Ci,{icon:"pencil",onClick:j,children:u("sessionWindow.rename")}),m.jsx(Ci,{icon:"list-checks",onClick:A,children:u("sessionWindow.select")}),t.session.parent&&m.jsx(Ci,{icon:"corner-up-left",onClick:O,children:u("sessionWindow.detach")}),t.session.liveness!=="offline"&&t.session.status!=="queued"&&m.jsx(Ci,{icon:"terminal",onClick:T,children:u("sessionWindow.attach")}),t.session.archived&&m.jsx(Ci,{icon:"star-filled",onClick:U,children:u("sessionWindow.resume")}),t.session.status==="corrupt"&&m.jsx(Ci,{icon:"archive",onClick:re,children:u("sessionWindow.quarantine")})]}),m.jsx(q6,{}),m.jsx(Yu,{children:m.jsx(Ci,{icon:"trash",danger:!0,onClick:H,children:u("sessionWindow.close")})})]}),m.jsx(vT,{session:_,socket:x,onClose:()=>w(null)}),c&&m.jsx(la,{title:u("sessionWindow.renameTitle",{name:Hr(c)}),closeLabel:u("common.close"),className:"sess-rename-modal",onClose:()=>h(null),children:m.jsxs("form",{className:"sess-rename",onSubmit:le,children:[m.jsx("input",{ref:$,className:"sess-rename-input",value:D,autoFocus:!0,placeholder:u("sessionWindow.renamePlaceholder"),onChange:te=>R(te.target.value)}),m.jsxs("div",{className:"sess-rename-actions",children:[m.jsx("button",{type:"button",className:"sess-rename-btn",onClick:()=>h(null),children:u("common.cancel")}),m.jsx("button",{type:"submit",className:"sess-rename-btn sess-rename-save",disabled:q,children:u("common.save")})]})]})}),oe&&m.jsx(la,{title:u("sessionWindow.closeTitle",{name:Hr(oe)}),closeLabel:u("common.close"),className:"sess-rename-modal",onClose:I,children:m.jsxs("div",{className:"sess-confirm",children:[m.jsx("p",{className:"sess-confirm-msg",children:u("sessionWindow.closeConfirm")}),m.jsxs("div",{className:"sess-rename-actions",children:[m.jsx("button",{type:"button",className:"sess-rename-btn",onClick:I,children:u("common.cancel")}),m.jsx("button",{type:"button",className:"sess-rename-btn danger",onClick:Y,autoFocus:!0,children:u("sessionWindow.close")})]})]})}),p&&m.jsx(la,{title:u("sessionWindow.quarantineTitle"),closeLabel:u("common.close"),className:"sess-rename-modal",onClose:()=>v(null),children:m.jsxs("form",{className:"sess-rename",onSubmit:X,children:[m.jsxs("label",{children:[m.jsx("span",{children:u("sessionWindow.quarantineAdapter")}),m.jsx("input",{className:"sess-rename-input",value:E.adapter,onChange:G("adapter"),autoFocus:!0})]}),m.jsxs("label",{children:[m.jsx("span",{children:u("sessionWindow.quarantineThread")}),m.jsx("input",{className:"sess-rename-input",value:E.thread,onChange:G("thread")})]}),m.jsxs("label",{children:[m.jsx("span",{children:u("sessionWindow.quarantineTmux")}),m.jsx("input",{className:"sess-rename-input",value:E.tmux,onChange:G("tmux")})]}),m.jsxs("label",{children:[m.jsx("span",{children:u("sessionWindow.quarantineWorktree")}),m.jsx("input",{className:"sess-rename-input",value:E.worktree,onChange:G("worktree")})]}),m.jsxs("label",{children:[m.jsx("span",{children:u("sessionWindow.quarantineBranch")}),m.jsx("input",{className:"sess-rename-input",value:E.branch,onChange:G("branch")})]}),m.jsxs("div",{className:"sess-rename-actions",children:[m.jsx("button",{type:"button",className:"sess-rename-btn",onClick:()=>v(null),children:u("common.cancel")}),m.jsx("button",{type:"submit",className:"sess-rename-btn",disabled:q,children:u("sessionWindow.quarantineConfirm")})]})]})})]})}const _T=({size:t=12})=>m.jsx(ze,{name:"lock",size:t});function yT(t){if(!(t!=null&&t.length))return null;const e={};return t.forEach(i=>{e[i.op]=(e[i.op]||0)+1}),Object.entries(e).map(([i,r])=>`${gC[i]}${r}`).join(" ")}function wT({guides:t=[],expandable:e,kin:i=0}){const r=e||t.length>0;return m.jsxs("span",{className:"sess-lead",children:[r&&m.jsx("span",{className:"sess-fold pod sess-fold-slot","aria-hidden":"true",children:i}),t.map((s,n)=>{const o=n===t.length-1?s?"tee":"elbow":s?"rail":"gap";return m.jsx("span",{className:`sess-rail ${o}`,"aria-hidden":"true"},n)})]})}function xT({expanded:t,rollup:e,kin:i,onToggle:r,inert:s=!1}){const n=`${t?"Hide":"Show"} ${i} nested session${i===1?"":"s"}`,o=t?{color:e,borderColor:e}:{background:e,borderColor:e};return s?m.jsx("span",{"aria-hidden":"true",className:`sess-fold pod sess-fold-control${t?" open":""}`,style:o,children:i}):m.jsx("button",{type:"button",tabIndex:-1,className:`sess-fold pod sess-fold-control${t?" open":""}`,style:o,"aria-expanded":t,"aria-label":n,"data-tip":n,onMouseDown:a=>a.preventDefault(),onClick:a=>{a.stopPropagation(),r()},children:i})}function G2({item:t,activeId:e,selecting:i=!1,picked:r=new Set,dragging:s=!1,dropTarget:n=!1,onToggleFold:o,rowProps:a={},inert:l=!1,style:u}){const{s:c}=t,h=e===c.id,d=i&&r.has(c.id),f=t.expandable||t.depth?m.jsx(wT,{guides:t.guides,expandable:t.expandable,kin:t.kin}):null,p=t.expandable?{expanded:t.expanded,rollup:t.rollup,kin:t.kin}:null,v=`sess-tree-row si-tree-row${s?" dragging":""}${n?" drop-target":""}${l?" si-session-drag-ghost":""}`,_=`si-item${h&&!i?" on":""}${d?" picked":""}`,w=m.jsx(m.Fragment,{children:m.jsx(ST,{s:c,locked:!1,showAvatar:!1,lead:f})}),x={"--ov":q5(c.id),"--sess-fold-indent":`${t.depth*14}px`,...u};return m.jsxs("div",{className:v,"data-session-depth":t.depth,style:x,...l?{"aria-hidden":"true"}:{"data-session-drop-id":c.id},children:[m.jsxs("button",{type:"button",className:_,tabIndex:l?-1:void 0,...a,children:[i&&!l&&m.jsx("span",{className:`si-check${d?" on":""}`,"aria-hidden":"true"}),w]}),p&&m.jsx(xT,{...p,inert:l,onToggle:o})]})}function eN(){const[t,e]=k.useState(()=>new Set),i=s=>e(n=>{const o=new Set(n);return o.has(s)?o.delete(s):o.add(s),o}),r=k.useCallback(s=>e(n=>{const o=s.filter(l=>l&&!n.has(l));if(!o.length)return n;const a=new Set(n);return o.forEach(l=>a.add(l)),a}),[]);return{expanded:t,toggle:i,expand:r}}function ST({s:t,locked:e,showAvatar:i=!0,lead:r=null}){const s=Ie(),n=yT(t.ops),o=o0(t),a=Hr(t),l=s(`status.${o.status}`);return m.jsxs(m.Fragment,{children:[r,i&&m.jsx(t1,{seed:t.id,status:o.status,title:`${f4(t)} · ${l} — ${t.id.slice(0,8)}`}),m.jsxs("span",{className:"sess-meta",children:[m.jsx("span",{className:"sess-glyph",style:{color:o.color},"data-tip":t.note?`${l} · ${t.note}`:l,"aria-label":t.note?`${l} · ${t.note}`:l,children:o.glyph}),n&&m.jsx("span",{className:"sess-ops",children:n})]}),m.jsx("span",{className:"sess-id","data-tip":a,children:a}),t.archiveHazard&&m.jsx("span",{className:"sess-hazard","data-tip":t.archiveHazard,"aria-label":t.archiveHazard,children:m.jsx(ze,{name:"issue-opened",size:13})}),e&&m.jsx("span",{className:"sess-lock","data-tip":s("sessionWindow.lockedTitle"),children:m.jsx(_T,{})})]})}function kT({item:t,baseClass:e,onToggle:i}){const r=Ie(),s=t.zone==="offline"||t.zone==="archive",n=`${e} ${e}-${t.zone}${s?` si-zone-fold${t.folded?"":" open"}`:""}${t.dropTarget?" drop-target":""}`;if(!s)return m.jsxs("div",{className:n,children:[t.count>0&&m.jsx("span",{className:"si-zone-count","aria-hidden":"true",children:t.count}),m.jsx("span",{className:"si-zone-label",children:r(`sessionZone.${t.zone}`)})]});const o=t.zone==="archive"?r(t.folded?"sessionZone.showArchive":"sessionZone.hideArchive",{n:t.count}):r(t.folded?"sessionZone.showHistory":"sessionZone.hideHistory",{n:t.count});return m.jsxs("button",{type:"button",className:n,"aria-expanded":!t.folded,"aria-label":o,"data-tip":o,"data-archive-count":t.zone==="archive"?t.count:void 0,"data-session-archive-drop":t.zone==="archive"?"":void 0,"data-session-archive-zone":t.zone==="archive"?"":void 0,onClick:i,children:[(t.count>0||t.zone==="archive")&&m.jsx("span",{className:"si-zone-count","aria-hidden":"true",children:t.count}),m.jsx("span",{className:"si-zone-label",children:r(`sessionZone.${t.zone}`)})]})}function tN({sessions:t=[],activeId:e=null,onPick:i,onOpenSession:r,onNew:s}){const n=Ie(),[o,a]=k.useState(!1);ni(o,()=>a(!1));const l=t.find(d=>d.source===e),u=(l?[l]:t).slice(0,3),c=d=>{if(d==="new"){a(!1),s==null||s();return}const f=t.find(p=>p.id===d);f&&(i==null||i(f))},h=d=>{a(!1),d!=="new"&&(r==null||r(d))};return m.jsxs("div",{className:"sess-badge",children:[m.jsxs("button",{type:"button",className:"sess-badge-trigger","aria-expanded":o,"aria-controls":"graph-session-picker","aria-label":n("sessionWindow.badgeLabel"),"data-tip":n("sessionWindow.badgeLabel"),onClick:()=>a(d=>!d),children:[m.jsx("span",{className:"sess-badge-face","aria-hidden":"true",children:u.map(d=>m.jsx(t1,{seed:d.id,status:d.status,size:15},d.id))}),m.jsx("span",{className:"sess-badge-count",children:t.length})]}),o&&m.jsx("div",{id:"graph-session-picker",className:"sess-badge-panel",role:"dialog","aria-label":n("sessionWindow.badgeLabel"),children:m.jsx(bC,{sessions:t,value:(l==null?void 0:l.id)||"",onChange:c,onOpen:h,includeNew:!0,filter:t.length>5,compact:!0,ariaLabel:n("sessionWindow.badgeLabel")})})]})}let dr={expanded:new Set,offlineOpen:!1};const of=new Set,C1=t=>{dr=t,of.forEach(e=>e())},CT=t=>(of.add(t),()=>of.delete(t)),V6=()=>k.useSyncExternalStore(CT,()=>dr,()=>dr),Zc=t=>{if(!t)return;const e=new Set(dr.expanded);e.has(t)?e.delete(t):e.add(t),C1({...dr,expanded:e})},AT=(t=[])=>{const e=new Set(dr.expanded);t.filter(Boolean).forEach(i=>e.add(i)),!(e.size===dr.expanded.size&&[...e].every(i=>dr.expanded.has(i)))&&C1({...dr,expanded:e})},ET=t=>{const e=!!t;e!==dr.offlineOpen&&C1({...dr,offlineOpen:e})};function DT({ids:t,onCancel:e,onClosed:i,onError:r}){const s=Ie(),[n,o]=k.useState(!1);ni(n,()=>o(!1));const a=()=>{o(!1),Promise.all(t.map(l=>Hi(`/api/sessions/${l}/close`,{method:"POST"}).then(async u=>{if(u.ok)return;const c=await u.json().catch(()=>null);throw new Error((c==null?void 0:c.error)||`session close refused (HTTP ${u.status})`)}))).then(()=>i==null?void 0:i()).catch(l=>{r==null||r(l instanceof Error?l.message:String(l)),i==null||i()})};return m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"si-selbar",children:[m.jsx("span",{className:"si-selcount",children:s("sessionSelect.selected",{n:t.length})}),m.jsx(Zt,{icon:"trash",size:14,className:"si-selaction danger",label:s("sessionSelect.close"),disabled:!t.length,onClick:()=>o(!0)}),m.jsx(Zt,{icon:"x",size:14,className:"si-selaction",label:s("common.cancel"),onClick:e})]}),n&&m.jsx(la,{title:s("sessionSelect.closeTitle",{n:t.length}),closeLabel:s("common.close"),className:"sess-rename-modal",onClose:()=>o(!1),children:m.jsxs("div",{className:"sess-confirm",children:[m.jsx("p",{className:"sess-confirm-msg",children:s("sessionSelect.closeConfirm")}),m.jsxs("div",{className:"sess-rename-actions",children:[m.jsx("button",{type:"button",className:"sess-rename-btn",onClick:()=>o(!1),children:s("common.cancel")}),m.jsx("button",{type:"button",className:"sess-rename-btn danger",onClick:a,children:s("sessionSelect.close")})]})]})})]})}const MT=6,Y2="is-dragging";function X2(){const t=e=>{e.stopPropagation(),e.preventDefault()};window.addEventListener("click",t,!0),window.setTimeout(()=>window.removeEventListener("click",t,!0),0)}function af(t,e,i){var r,s;return((s=(r=document.elementFromPoint(t,e))==null?void 0:r.closest)==null?void 0:s.call(r,i))||null}function U6(t,{threshold:e=MT,onStart:i,onMove:r,onDrop:s,onCancel:n}={}){if(t.button!==0)return()=>{};const o={x:t.clientX,y:t.clientY};let a=!1;const l=()=>{window.removeEventListener("mousemove",c,!0),window.removeEventListener("mouseup",h,!0),window.removeEventListener("keydown",d,!0),a&&document.body.classList.remove(Y2)},u=()=>{const f=a;l(),a=!1,f&&(X2(),n==null||n())};function c(f){const p={x:f.clientX,y:f.clientY};if(!a){if(Math.hypot(p.x-o.x,p.y-o.y)<e)return;a=!0,document.body.classList.add(Y2),i==null||i(p)}r==null||r(p)}function h(f){const p=a;l(),a=!1,p&&(X2(),s==null||s({x:f.clientX,y:f.clientY}))}function d(f){f.key==="Escape"&&u()}return window.addEventListener("mousemove",c,!0),window.addEventListener("mouseup",h,!0),window.addEventListener("keydown",d,!0),u}function TT(t,e,{min:i,max:r,dir:s=1}={}){const[n,o]=k.useState(()=>{try{const c=parseInt(localStorage.getItem(t),10);if(Number.isFinite(c))return Math.max(i,Math.min(r,c))}catch{}return e}),a=k.useRef(null),l=k.useCallback(c=>{c.preventDefault(),a.current={x:c.clientX,w:n};const h=f=>{const p=a.current;if(!p)return;const v=Math.max(i,Math.min(r,p.w+(f.clientX-p.x)*s));o(v)},d=()=>{a.current=null,window.removeEventListener("mousemove",h),window.removeEventListener("mouseup",d),document.body.classList.remove("is-resizing"),o(f=>{try{localStorage.setItem(t,String(Math.round(f)))}catch{}return f})};window.addEventListener("mousemove",h),window.addEventListener("mouseup",d),document.body.classList.add("is-resizing")},[t,n,i,r,s]),u=k.useCallback(()=>{o(e);try{localStorage.removeItem(t)}catch{}},[e,t]);return[n,l,u]}const _a={key:"spex.dockWidth",initial:204,min:180,max:460},J2=["spex.ftWidth","spex.siListWidth"];try{if(localStorage.getItem(_a.key)==null)for(const t of J2){const e=parseInt(localStorage.getItem(t),10);if(Number.isFinite(e)){localStorage.setItem(_a.key,String(e));break}}J2.forEach(t=>localStorage.removeItem(t))}catch{}function BT(t,e,i){if(!(i!=null&&i.altKey)||i.ctrlKey||i.metaKey)return null;const r=i.code||i.key;if(r!=="ArrowUp"&&r!=="ArrowDown")return null;const s=t.find(l=>l.type==="row"&&l.s.id===e);if(!s)return null;if(i.shiftKey)return{type:s.expandable?r==="ArrowDown"?"expand":"collapse":"noop",id:s.s.id};const n=t.filter(l=>l.type==="row"),o=n.findIndex(l=>l.s.id===e),a=n[o+(r==="ArrowDown"?1:-1)];return a?{type:"move",id:a.s.id}:{type:"noop"}}const Qc=.75;function RT({sessions:t=[],activeId:e,archiveActive:i=!1,closing:r=!1,opening:s=!1,onSelect:n,onArchive:o,onSearch:a,reload:l,onContextMenu:u,onError:c,selectRequest:h=null,onSelectRequestConsumed:d}){const f=Ie(),{expanded:p,offlineOpen:v}=V6(),[_,w]=k.useState(!1),[x,C]=k.useState(()=>new Set),[D,R]=k.useState(null),E=k.useRef(null),L=k.useRef(null),[q,F,$]=TT(_a.key,_a.initial,_a),W=k.useMemo(()=>Tf(t,G=>p.has(G),{zoneFolded:G=>G==="offline"&&!v,keepVisible:G=>G.id===e}),[t,p,v,e]);gf(G=>{const X=BT(W,e,G);if(!X)return!1;if(G.preventDefault(),G.stopPropagation(),X.type==="move")n==null||n(X.id);else if(X.type==="expand"){const oe=W.find(I=>I.type==="row"&&I.s.id===X.id);oe&&!oe.expanded&&Zc(X.id)}else if(X.type==="collapse"){const oe=W.find(I=>I.type==="row"&&I.s.id===X.id);oe!=null&&oe.expanded&&Zc(X.id)}return!0},30);const z=k.useCallback(async(G,X)=>{const oe=t.find(I=>I.id===G);if(!(!oe||(oe.parent||null)===X))try{const I=await Hi("/api/sessions/reparent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({children:[G],parent:X})}),Y=await I.json().catch(()=>null);if(!I.ok||(Y==null?void 0:Y.ok)===!1)throw new Error((Y==null?void 0:Y.error)||`session parent update refused (HTTP ${I.status})`);X&&AT([X]),l==null||l()}catch(I){c==null||c(I instanceof Error?I.message:String(I))}},[t,l,c]),j=k.useCallback((G,X)=>{const oe=af(G.x,G.y,"[data-session-drop-id]");if(oe){const I=oe.dataset.sessionDropId;return I===X.id||I===X.parent||I7(t,I).includes(X.id)?void 0:I}return X.parent&&af(G.x,G.y,"[data-session-root-drop]")?null:void 0},[t]),A=k.useCallback((G,X)=>{if(G.button!==0||_)return;const I=G.currentTarget.getBoundingClientRect(),Y={id:X.id,parent:X.parent||null,width:I.width,height:I.height,offsetX:G.clientX-I.left,offsetY:G.clientY-I.top,x:G.clientX,y:G.clientY,target:void 0,started:!1},le=de=>{Y.x=de.x,Y.y=de.y,Y.target=j(de,Y),R({...Y})},te=()=>{document.body.classList.remove("is-session-dragging"),R(null),E.current=null};E.current=U6(G,{onStart:de=>{Y.started=!0,document.body.classList.add("is-session-dragging"),le(de)},onMove:le,onDrop:de=>{const ke=j(de,Y);te(),ke!==void 0&&z(Y.id,ke)},onCancel:te})},[z,j,_]);k.useEffect(()=>()=>{var G;return(G=E.current)==null?void 0:G.call(E)},[]),k.useEffect(()=>{h&&(w(!0),C(new Set([h.id])),d==null||d())},[h,d]);const O=()=>{w(!1),C(new Set)},T=G=>C(X=>{const oe=new Set(X);return oe.has(G)?oe.delete(G):oe.add(G),oe}),U=()=>{O(),l==null||l()},H=D?W.find(G=>G.type==="row"&&G.s.id===D.id):null,re=!!(D!=null&&D.parent);return m.jsxs(m.Fragment,{children:[m.jsxs("aside",{className:r?"si-list dock-closing":"si-list","data-fold":s?"in":void 0,ref:L,style:{width:q},onMouseDownCapture:ya,"aria-hidden":r?"true":void 0,children:[_?m.jsx(DT,{ids:[...x],onCancel:O,onClosed:U,onError:c}):m.jsxs("div",{className:"si-toprow",children:[m.jsxs("button",{type:"button",className:`si-pill new${e==="new"?" on":""}`,"aria-label":f("session.newSessionTitle"),onClick:()=>n==null?void 0:n("new"),children:[m.jsx("span",{className:"si-pill-glyph",children:m.jsx(ze,{name:"plus",size:14})}),m.jsx("span",{className:"si-pill-label",children:f("session.newSessionTitle")})]}),m.jsx("button",{type:"button",className:`si-pill archive${i?" on":""}`,"aria-label":f("session.archiveTitle"),"data-tip":f("session.archiveTitle"),onClick:o,children:m.jsx("span",{className:"si-pill-glyph",children:m.jsx(ze,{name:"archive",size:14})})}),m.jsx("button",{type:"button",className:"si-pill search","aria-label":f("session.searchTitle"),"data-tip":f("session.searchTitle"),onClick:a,children:m.jsx("span",{className:"si-pill-glyph",children:m.jsx(ze,{name:"search",size:14})})})]}),m.jsxs("div",{className:"si-session-scroll","data-session-scroll":!0,children:[re&&m.jsxs("div",{className:`si-root-drop${D.target===null?" on":""}`,"data-session-root-drop":!0,"data-tip":f("session.rootDrop"),"aria-label":f("session.rootDrop"),children:[m.jsx(ze,{name:"corner-up-left",size:14}),m.jsx("span",{children:f("session.rootDrop")})]}),W.map(G=>{var oe;if(G.type==="zone")return m.jsx(kT,{item:G,baseClass:"si-zone",onToggle:()=>G.zone==="offline"?ET(!v):void 0},`zone-${G.zone}`);const X=G.s;return _&&x.has(X.id),m.jsx(G2,{item:G,activeId:e,selecting:_,picked:x,dragging:(D==null?void 0:D.id)===X.id,dropTarget:(D==null?void 0:D.target)===X.id,onToggleFold:()=>Zc(X.id),rowProps:{"data-sid":X.id,"aria-grabbed":(D==null?void 0:D.id)===X.id||void 0,onMouseDown:I=>A(I,X),onClick:I=>_?T(X.id):n==null?void 0:n(X.id,{newTab:a5(I)}),onContextMenu:I=>{I.preventDefault(),I.stopPropagation(),_||u==null||u({x:I.clientX,y:I.clientY,session:X})},"data-tip":(oe=X.ops)!=null&&oe.length?f("session.opsTitle"):f("session.lockTitle")}},X.id)})]}),H&&m.jsx(G2,{item:H,activeId:e,selecting:_,picked:x,inert:!0,style:{width:D.width,"--si-session-drag-ghost-scale":Qc,left:D.x-D.offsetX*Qc,top:D.y-D.offsetY*Qc}})]}),m.jsx("div",{className:"si-resizer",onMouseDownCapture:ya,onMouseDown:F,onDoubleClick:$,role:"separator","aria-orientation":"vertical","aria-label":f("session.resizeList")})]})}const Yn="terminal",Dr="conversation",aa="diff",Xu="resource:",NT="spexcode.session-surface.v1",LT=new Set([Yn,Dr]),lf=new Set;let G6=null;const Y6=(t=W5)=>`${NT}.${t||"root"}`,uf=()=>({defaultSurface:Dr,sessions:{}}),Ju=t=>LT.has(t),$a=t=>typeof t=="string"&&t.startsWith(Xu)&&t.length>Xu.length,OT=t=>Ju(t)||t===aa||$a(t),cf=t=>$a(t)?t.slice(Xu.length):null,Z2=t=>`${Xu}${t}`,Bs=(t,e,i)=>`${t}:${e}:${i}`;function PT(t){const e=uf();return!t||typeof t!="object"||(Ju(t.defaultSurface)&&(e.defaultSurface=t.defaultSurface),t.sessions&&typeof t.sessions=="object"&&!Array.isArray(t.sessions)&&(e.sessions=Object.fromEntries(Object.entries(t.sessions).filter(([,i])=>Ju(i))))),e}function T0(){try{const t=localStorage.getItem(Y6());return t?PT(JSON.parse(t)):uf()}catch{return G6||uf()}}function X6(t){G6=t;try{localStorage.setItem(Y6(),JSON.stringify(t))}catch{}for(const e of lf)e(t);return t}function J6(t){if(!Ju(t))throw new Error(`Invalid session base surface: ${t}`);return t}function iN(){return T0().defaultSurface}function tu(t){const e=T0();return e.sessions[t]||e.defaultSurface}function rN(t){const e=T0();return X6({...e,defaultSurface:J6(t)}).defaultSurface}function FT(t,e){if(!t)throw new Error("A session id is required to set its base surface");const i=T0();return X6({...i,sessions:{...i.sessions,[t]:J6(e)}}).sessions[t]}function IT(t){return lf.add(t),()=>lf.delete(t)}const Z6=[{id:"nav.up",keys:["ArrowUp","k","K"],rebind:!1,desc:"legend.graph.move"},{id:"nav.down",keys:["ArrowDown","j","J"],rebind:!1,desc:"legend.graph.move"},{id:"nav.parent",keys:["ArrowLeft","h","H"],rebind:!1,desc:"legend.graph.parent"},{id:"nav.child",keys:["ArrowRight","l","L"],rebind:!1,desc:"legend.graph.child"},{id:"graph.zoomIn",keys:["+","="],rebind:!0,desc:"legend.graph.zoom"},{id:"graph.zoomOut",keys:["-","_"],rebind:!0,desc:"legend.graph.zoom"},{id:"graph.zoomReset",keys:["0"],rebind:!0,desc:"legend.graph.zoom"},{id:"graph.info",keys:["i","I","Enter"],rebind:!0,desc:"legend.graph.info"},{id:"graph.search",keys:["/"],rebind:!0,desc:"legend.graph.search"},{id:"graph.cycle",keys:["o"],rebind:!0,desc:"legend.graph.overlayCycle"},{id:"graph.cycleRev",keys:["O"],rebind:!0,desc:"legend.graph.overlayCycle"},{id:"graph.fresh",keys:["["],rebind:!0,desc:"legend.graph.fresh"},{id:"graph.evals",keys:["f"],rebind:!0,desc:"legend.graph.evals"},{id:"graph.newChild",keys:["n"],sequence:["n","n"],rebind:!1,desc:"legend.graph.newChild"},{id:"graph.del",keys:["d"],sequence:["d","d"],rebind:!1,desc:"legend.graph.del"},{id:"graph.settings",keys:[","],rebind:!0,desc:"legend.graph.settings"},{id:"graph.help",keys:["?"],rebind:!0,desc:"legend.graph.help"},{id:"shell.newSession",keys:["Alt+KeyN"],rebind:!1,desc:"legend.shell.newSession"},{id:"shell.evals",keys:["Alt+KeyF"],rebind:!1,desc:"legend.shell.evals"},{id:"shell.search",keys:["Alt+Slash"],rebind:!1,desc:"legend.shell.search"},{id:"shell.sessionPrevious",keys:["Alt+ArrowUp"],rebind:!1,desc:"legend.shell.sessionPrevious"},{id:"shell.sessionNext",keys:["Alt+ArrowDown"],rebind:!1,desc:"legend.shell.sessionNext"},{id:"shell.sessionExpand",keys:["Alt+Shift+ArrowDown"],rebind:!1,desc:"legend.shell.sessionExpand"},{id:"shell.sessionCollapse",keys:["Alt+Shift+ArrowUp"],rebind:!1,desc:"legend.shell.sessionCollapse"},{id:"shell.dockToggle",keys:["Alt+Shift+KeyE"],rebind:!1,desc:"legend.shell.dockToggle"},{id:"shell.dockMode",keys:["Alt+Shift+KeyM"],rebind:!1,desc:"legend.shell.dockMode"},{id:"shell.contextToggle",keys:["Alt+Shift+KeyC"],rebind:!1,desc:"legend.shell.contextToggle"},{id:"shell.tabClose",keys:["Alt+Shift+KeyX"],rebind:!1,desc:"legend.shell.tabClose"},{id:"shell.tabNext",keys:["Alt+Shift+ArrowRight"],rebind:!1,desc:"legend.shell.tabNext"},{id:"shell.tabPrevious",keys:["Alt+Shift+ArrowLeft"],rebind:!1,desc:"legend.shell.tabPrevious"},{id:"shell.tabSplit",keys:["Alt+Shift+Enter"],rebind:!1,desc:"legend.shell.tabSplit"},{id:"shell.commandBox",keys:["Alt+KeyI"],rebind:!1,desc:"legend.shell.commandBox"},{id:"explorer.menu",keys:["Shift+F10","ContextMenu"],rebind:!1,desc:"legend.explorer.menu"},{id:"explorer.openInNewTab",keys:["Alt+Enter"],rebind:!1,desc:"legend.explorer.openInNewTab"}],zT={ArrowUp:"↑",ArrowDown:"↓",ArrowLeft:"←",ArrowRight:"→",Enter:"⏎",Escape:"esc"," ":"␣","-":"−"},jT={Alt:"⌥",Ctrl:"⌃",Meta:"⌘",Shift:"⇧"},HT={Slash:"/",Backslash:"\\",Comma:",",Period:".",Semicolon:";",Quote:"'",Backquote:"`",Minus:"−",Equal:"=",BracketLeft:"[",BracketRight:"]",Space:"␣"},Q2=t=>zT[t]||HT[t]||t.replace(/^Key([A-Z])$/,"$1").replace(/^Digit(\d)$/,"$1"),$T=t=>{if(typeof t!="string"||!t)return"";if(!t.includes("+"))return Q2(t);const e=t.split("+"),i=e.pop();return e.map(r=>jT[r]||`${r}+`).join("")+Q2(i)},qT=Object.fromEntries(Z6.map(t=>[t.id,t])),sN=t=>{var e;return((e=qT[t])==null?void 0:e.sequence)||[]},WT=(t,e=null)=>t!=null&&t.rebind?e||t.keys||[]:t!=null&&t.sequence?[t.sequence.join("")]:(t==null?void 0:t.keys)||[],A1="spex.keybindings.v1",Q6=Object.fromEntries(Z6.map(t=>[t.id,t]));function KT(){try{return JSON.parse(localStorage.getItem(A1))||{}}catch{return{}}}let _n=KT();function E1(t){var i;const e=_n[t];return e&&e.keys||((i=Q6[t])==null?void 0:i.keys)||[]}function nN(t){return!!_n[t]}function VT(t,e){return E1(t).includes(e)}function UT(t){const e=[];return t.altKey&&e.push("Alt"),t.ctrlKey&&e.push("Ctrl"),t.metaKey&&e.push("Meta"),t.shiftKey&&e.push("Shift"),`${e.length?`${e.join("+")}+`:""}${t.code||t.key}`}function GT(t,e){return E1(t).includes(UT(e))||!e.altKey&&!e.ctrlKey&&!e.metaKey&&VT(t,e.key)}function YT(...t){const e=[];for(const i of t){const r=$T(WT(Q6[i],E1(i))[0]);r&&!e.includes(r)&&e.push(r)}return e.join(" · ")}function XT(t,...e){const i=YT(...e);return i?`${t} (${i})`:t}function oN(t,e){_n={..._n,[t]:{..._n[t],...e}},localStorage.setItem(A1,JSON.stringify(_n))}function aN(){_n={},localStorage.removeItem(A1)}const JT=/<!-- spexcode-selection (\{.*?\}) -->/g,D1=t=>t&&typeof t.path=="string"&&t.path&&Number.isInteger(t.startLine)&&t.startLine>0&&Number.isInteger(t.endLine)&&t.endLine>=t.startLine&&typeof t.text=="string"&&(t.node===void 0||typeof t.node=="string"&&!!t.node);function ZT(t){if(!D1(t))throw new TypeError("invalid code selection");return`<!-- spexcode-selection ${JSON.stringify({...t.node?{node:t.node}:{},path:t.path,startLine:t.startLine,endLine:t.endLine,text:t.text})} -->`}function QT(t){const e=typeof t=="string"?t:"",i=[];return{text:e.replace(JT,(s,n)=>{try{const o=JSON.parse(n);if(D1(o))i.push(o);else return s}catch{return s}return""}).replace(/\n{3,}/g,`
330
+
331
+ `).trim(),selections:i}}function eB(t,e=[]){const i=typeof t=="string"?t.trim():"",r=e.filter(D1).map(ZT);return[i,...r].filter(Boolean).join(`
332
+
333
+ `)}function tB({selection:t,onRemove:e=null,className:i=""}){const r=Ie();if(!t)return null;const s=t.node||t.path,n=r("proseActions.lines",{a:t.startLine,b:t.endLine}),o=`${s}:${n}`;return m.jsxs("div",{role:"group",className:`selection-attachment${i?` ${i}`:""}`,"data-selection-attachment":!0,title:t.text||o,"aria-label":o,children:[m.jsx(ze,{name:"file-diff",size:12,className:"selection-attachment-icon"}),m.jsx("span",{className:"selection-attachment-address",title:s,children:s}),m.jsx("span",{className:"selection-attachment-range",children:n}),e&&m.jsx(Zt,{icon:"x",size:12,className:"icon-btn selection-attachment-remove",label:r("session.removeCodeSelection"),onClick:e})]})}const iB=t=>{try{const e=new URL(t);return`${e.hostname.replace(/^\[|\]$/g,"")}:${e.port}${e.pathname==="/"?"":e.pathname}`}catch{return t}},rB=128,sB=t=>{const e=String(t||"").indexOf("/");return e>0?{node:t.slice(0,e),scenario:t.slice(e+1)}:{node:t||"",scenario:""}};function hf(t,{specs:e,sessions:i,names:r,t:s}){var n,o,a;if(t.page==="graph")return s("tabs.graph");if(t.page==="spec")return t.param?((n=e==null?void 0:e.find(l=>l.id===t.param))==null?void 0:n.title)||t.param:s("tabs.spec");if(t.page==="file")return((o=t.param)==null?void 0:o.split("/").pop())||s("tabs.graph");if(t.page==="evals")return s("tabs.evals");if(t.page==="issues")return s("tabs.issues");if(t.page==="sessions"){if(!t.param||t.param==="new")return s("tabs.sessions");const l=(i==null?void 0:i.find(h=>{var d;return h.id===t.param||((d=h.id)==null?void 0:d.startsWith(t.param))}))||i1(t.param),u=l?Hr(l):t.param.slice(0,8),c=(a=t.query)==null?void 0:a.surface;if($a(c)){const h=cf(c),d=[...((l==null?void 0:l.files)||[]).map(f=>({id:Bs(l.id,"file",f),label:f.split("/").filter(Boolean).pop()||f})),...((l==null?void 0:l.web)||[]).map(f=>({id:Bs(l.id,"web",f.key),label:iB(f.url)}))].find(f=>f.id===h);return(d==null?void 0:d.label)||h}return u}return s(`tabs.${t.page}`)}function nB({tab:t,specs:e,sessions:i}){const r=t.page==="spec"?t.param:t.page==="evals"&&t.param?sB(t.param).node:null;if(r){const s=e==null?void 0:e.find(n=>n.id===r);return!s||!Nu[s.status]?null:m.jsx("i",{className:"tab-dot",style:{background:Nu[s.status].color}})}if(t.page==="sessions"&&t.param&&t.param!=="new"){const s=(i==null?void 0:i.find(o=>{var a;return o.id===t.param||((a=o.id)==null?void 0:a.startsWith(t.param))}))||i1(t.param);if((s==null?void 0:s.status)==="starting"||(s==null?void 0:s.status)==="queued")return m.jsx("i",{className:"tab-spinner","aria-hidden":"true",children:"⟳"});const n=s&&lr[s.status];return n?m.jsx("i",{className:"tab-dot",style:{background:n}}):null}return null}function oB({tab:t}){const e=KB(t.page)?WB(t.page):null;return e?m.jsx(ze,{name:e,size:13,className:"tab-kind-icon"}):null}function aB(t,e){const{page:i,param:r}=t||{};return i==="spec"||i==="file"||i==="sessions"&&r||(i==="evals"||i==="issues")&&r?hf(t,e):e.t(`place.${i}`)}function lB({specs:t,sessions:e,route:i,trailing:r=null,onSessionContextMenu:s=null}){const n=Ie(),[o,a]=k.useState([]),[l,u]=k.useState(!1),c=k.useRef(null),h=k.useCallback(T=>{var re;const U=Xe(T);a(G=>{if(G.some(oe=>oe.key===U))return G;const X=d.current.findIndex(oe=>Xe(oe)===U);return[...G,{key:U,tab:T,index:X}]});const H=(re=window.matchMedia)!=null&&re.call(window,"(prefers-reduced-motion: reduce)").matches?0:150;window.setTimeout(()=>a(G=>G.filter(X=>X.key!==U)),H)},[]),d=k.useRef([]),{tabs:f,activeKey:p,open:v,close:_,closeOthers:w,move:x}=c5({onCloseStart:h});d.current=f,k.useEffect(()=>{const T=c.current;if(!T||typeof ResizeObserver>"u")return;const U=()=>{const re=f.length*rB>T.clientWidth;u(G=>G===re?G:re)};U();const H=new ResizeObserver(U);return H.observe(T),()=>H.disconnect()},[f.length]);const C=K5(),{splitTo:D}=vf(),R=V5(),[E,L]=k.useState(null),[q,F]=k.useState(null),$=k.useRef(null);k.useEffect(()=>()=>{var T;return(T=$.current)==null?void 0:T.call($)},[]),k.useEffect(()=>{if(!q)return;const T=U=>{var H,re;(re=(H=U.target)==null?void 0:H.closest)!=null&&re.call(H,".sess-menu")||F(null)};return window.addEventListener("click",T),window.addEventListener("contextmenu",T,!0),()=>{window.removeEventListener("click",T),window.removeEventListener("contextmenu",T,!0)}},[q]),ni(!!q,()=>F(null));const W=(T,U)=>{const H=d.current,re=af(T.x,T.y,".tab");if(re){const I=H.findIndex(de=>Xe(de)===re.dataset.tabKey);if(I<0)return;const Y=re.getBoundingClientRect(),te=T.x>Y.left+Y.width/2?H[I+1]?Xe(H[I+1]):null:re.dataset.tabKey;return df(H,U,te)===H?void 0:te}const G=c.current;if(!G||!H.length)return;const X=G.getBoundingClientRect();if(T.x<X.left||T.x>X.right||T.y<X.top||T.y>X.bottom)return;const oe=Math.max(...[...G.querySelectorAll(".tab")].map(I=>I.getBoundingClientRect().right));if(!(T.x<oe))return df(H,U,null)===H?void 0:null},z=(T,U)=>{const H=Xe(U),re=G=>{const X=W(G,H);X!==void 0&&x(H,X),L(oe=>oe&&oe.key===H&&oe.before===X?oe:{key:H,before:X})};$.current=U6(T,{onStart:re,onMove:re,onDrop:G=>{const X=W(G,H);L(null),$.current=null,X!==void 0&&x(H,X)},onCancel:()=>{L(null),$.current=null}})},j=Vt(i.page,i.param,i.query),A=[...R.values()].filter(T=>T.document===j).sort((T,U)=>(U.priority??0)-(T.priority??0)||T.id.localeCompare(U.id)),O=[...f];return o.filter(T=>!f.some(U=>Xe(U)===T.key)).sort((T,U)=>T.index-U.index).forEach(T=>O.splice(Math.max(0,Math.min(T.index,O.length)),0,T.tab)),m.jsxs("div",{className:"tabstrip",children:[m.jsxs("div",{ref:c,className:`tabstrip-tabs${l?" wrapped":""}`,role:"tablist","aria-label":n("tabs.aria"),children:[!f.length&&m.jsx("span",{className:"tab-place",children:aB(i,{specs:t,sessions:e,names:C,t:n})}),O.map((T,U)=>{const H=Xe(T),re=o.some(I=>I.key===H)&&!f.some(I=>Xe(I)===H),G=H===p,X=hf(T,{specs:t,sessions:e,names:C,t:n}),oe=`${(E==null?void 0:E.key)===H?" tab-moving":""}${(E==null?void 0:E.before)===H?" tab-drop-before":""}${E&&E.before===null&&U===f.length-1?" tab-drop-after":""}`;return m.jsxs("div",{"data-tab-key":H,className:`tab${G?" on":""}${re?" tab-closing":""}${oe}`,role:"tab","aria-selected":G,"aria-grabbed":(E==null?void 0:E.key)===H||void 0,"aria-hidden":re?"true":void 0,onMouseDown:I=>{re||z(I,T)},onContextMenu:I=>{if(re)return;I.preventDefault();const Y=T.page==="sessions"&&T.param&&T.param!=="new"?(e==null?void 0:e.find(le=>{var te;return le.id===T.param||((te=le.id)==null?void 0:te.startsWith(T.param))}))||i1(T.param):null;Y&&s?(F(null),s({x:I.clientX,y:I.clientY,session:Y})):F({x:I.clientX,y:I.clientY,tab:T,key:H})},onAuxClick:I=>{!re&&I.button===1&&(I.preventDefault(),_(T))},children:[m.jsxs("button",{type:"button",className:"tab-face","data-tip":X,"aria-label":X,onClick:I=>{re||(I.altKey?D(T):v(T))},children:[m.jsx(oB,{tab:T}),m.jsx(nB,{tab:T,specs:t,sessions:e}),m.jsx("span",{className:"tab-label",children:X})]}),m.jsx("button",{type:"button",className:"tab-x",onClick:()=>{re||_(T)},"aria-label":n("tabs.close"),children:m.jsx(ze,{name:"x",size:11})})]},H)})]}),(A.length>0||r)&&m.jsxs("div",{className:"tabstrip-actions",role:"toolbar","aria-label":n("documentActions.aria"),children:[A.map(T=>{const U=T.disabled&&T.disabledReason||T.label;return m.jsxs("div",{className:"document-action",children:[T.node||m.jsx(Zt,{icon:T.icon,size:14,label:U,className:`document-action-button${T.pressed?" on":""}${T.disabled?" disabled":""}`,"data-action":T.id,"aria-pressed":T.pressed,"aria-haspopup":T.haspopup?"menu":void 0,disabled:T.disabled,onClick:T.onClick}),T.menu]},T.key||`${T.document}:${T.id}`)}),r]}),q&&m.jsxs(S1,{x:q.x,y:q.y,anchorKey:q.key,label:n("tabs.menuLabel"),children:[m.jsxs(Yu,{children:[m.jsx(Ci,{icon:"x",danger:!0,onClick:T=>{T.stopPropagation(),F(null),_(q.tab)},children:n("tabs.menuClose")}),m.jsx(Ci,{icon:"circle-minus",danger:!0,onClick:T=>{T.stopPropagation(),F(null),w(q.tab)},children:n("tabs.menuCloseOthers")})]}),m.jsx(q6,{}),m.jsx(Yu,{children:m.jsx(Ci,{icon:"panel-right",onClick:T=>{T.stopPropagation(),F(null),D(q.tab)},children:n("tabs.menuSplit")})})]})]})}const uB=170;function cB(t,e=uB){const[i,r]=k.useState(!1),[s,n]=k.useState(!1),o=k.useRef(t);return k.useEffect(()=>{if(o.current===t)return;if(o.current=t,t){r(!1),n(!0);const l=setTimeout(()=>n(!1),e);return()=>clearTimeout(l)}n(!1),r(!0);const a=setTimeout(()=>r(!1),e);return()=>clearTimeout(a)},[t,e]),[t||i,i,s]}const cn=t=>{var e;return((e=t==null?void 0:t.capabilities)==null?void 0:e.headless)===!0},eh=t=>!(t!=null&&t.archived)&&(t==null?void 0:t.liveness)==="online",Zu=t=>{if(typeof(t==null?void 0:t.closedAt)!="string")return null;const e=Date.parse(t.closedAt);return Number.isFinite(e)?e:null},e4=t=>[...t].sort((e,i)=>{const r=Zu(e),s=Zu(i);return r==null&&s==null?e.id.localeCompare(i.id):r==null?1:s==null?-1:s-r||e.id.localeCompare(i.id)}),th=t=>{if(t==null)return"unknown";const e=new Date(t);return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`};function hB({sessions:t,onOpenSession:e,onClose:i}){const{lang:r,t:s}=u4(),[n,o]=k.useState(""),a=k.useRef(null),l=k.useRef([]);ni(!0,i);const u=k.useMemo(()=>{const x=n.trim().toLocaleLowerCase(r);return x?t.filter(C=>[Hr(C),C.label,C.id,C.node].filter(Boolean).some(D=>String(D).toLocaleLowerCase(r).includes(x))):t},[t,n,r]),c=k.useMemo(()=>{const x=[];for(const C of u){const D=th(Zu(C)),R=x[x.length-1];(R==null?void 0:R.key)===D?R.rows.push(C):x.push({key:D,rows:[C]})}return x},[u]),h=th(Date.now()),d=new Date;d.setDate(d.getDate()-1);const f=th(d),p=x=>x==="unknown"?s("session.archiveUnknownDate"):x===h?s("session.archiveToday"):x===f?s("session.archiveYesterday"):new Intl.DateTimeFormat(r,{year:"numeric",month:"long",day:"numeric"}).format(new Date(`${x}T12:00:00`)),v=x=>{const C=Zu(x);return C==null?"":new Intl.DateTimeFormat(r,{hour:"2-digit",minute:"2-digit"}).format(C)},_=c.flatMap(x=>x.rows);k.useEffect(()=>{var x;(x=a.current)==null||x.focus()},[]);const w=x=>{var R;if(x.key!=="ArrowDown"&&x.key!=="ArrowUp")return;x.preventDefault();const C=l.current.findIndex(E=>E===document.activeElement),D=Math.max(0,Math.min(_.length-1,C+(x.key==="ArrowDown"?1:-1)));(R=l.current[D])==null||R.focus()};return m.jsx("div",{className:"si-archive-backdrop","data-archive-backdrop":!0,onKeyDown:w,onMouseDown:x=>{x.target===x.currentTarget&&i()},children:m.jsxs("div",{className:"si-archive-page","data-archive-page":!0,role:"dialog","aria-modal":"true","aria-label":s("session.archiveTitle"),children:[m.jsxs("header",{className:"si-archive-head",children:[m.jsxs("div",{children:[m.jsx("h1",{children:s("session.archiveTitle")}),m.jsx("span",{children:s("session.archiveCount",{n:t.length})})]}),m.jsxs("label",{className:"si-archive-search",children:[m.jsx(ze,{name:"search",size:15}),m.jsx("input",{ref:a,value:n,onChange:x=>o(x.target.value),placeholder:s("session.archiveSearch"),"aria-label":s("session.archiveSearch")})]})]}),m.jsxs("div",{className:"si-archive-index","data-archive-index":!0,children:[!c.length&&m.jsx("div",{className:"si-archive-empty",children:s("session.archiveEmpty")}),c.map(x=>m.jsxs("section",{className:"si-archive-group","data-archive-day":x.key,children:[m.jsx("h2",{className:"si-archive-date",children:p(x.key)}),x.rows.map(C=>m.jsxs("button",{ref:D=>{l.current[_.indexOf(C)]=D},type:"button",className:"si-archive-page-row","data-sid":C.id,onClick:()=>e(C.id),children:[m.jsx("span",{className:"si-archive-row-title",children:Hr(C)}),m.jsx("span",{className:"si-archive-row-node",children:C.node||C.label}),m.jsx("time",{dateTime:C.closedAt||void 0,children:v(C)}),m.jsx(ze,{name:"chevron-right",size:14})]},C.id))]},x.key))]})]})})}const dB=()=>m.jsx(ze,{name:"paperclip",size:15}),fB=()=>m.jsx(ze,{name:"loader",size:15,className:"si-attach-busy"}),pB=["███████╗██████╗ ███████╗██╗ ██╗ ██████╗ ██████╗ ██████╗ ███████╗","██╔════╝██╔══██╗██╔════╝╚██╗██╔╝██╔════╝██╔═══██╗██╔══██╗██╔════╝","███████╗██████╔╝█████╗ ╚███╔╝ ██║ ██║ ██║██║ ██║█████╗ ","╚════██║██╔═══╝ ██╔══╝ ██╔██╗ ██║ ██║ ██║██║ ██║██╔══╝ ","███████║██║ ███████╗██╔╝ ██╗╚██████╗╚██████╔╝██████╔╝███████╗","╚══════╝╚═╝ ╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝"].join(`
334
+ `);function e5(){return m.jsx("pre",{className:"si-hero","aria-label":"SpexCode",children:pB})}function t4({outcome:t}){if(!t)return null;const e=t.phase==="failed"?"alert":"status";return m.jsx("div",{className:`si-action-outcome ${t.phase}`,role:e,children:t.message})}const Qu=t=>t.split("/").filter(Boolean).pop()||t,mB=t=>/\.(?:md|markdown)$/i.test(t);function gB({path:t,text:e}){return mB(t)?m.jsx(N3,{className:"si-file-markdown",children:e}):m.jsx("pre",{className:"si-file-text",children:e})}function vB({path:t,html:e}){return m.jsx("iframe",{className:"si-file-html",srcDoc:e,title:Qu(t)})}const ih=t=>{try{const e=new URL(t);return`${e.hostname.replace(/^\[|\]$/g,"")}:${e.port}${e.pathname==="/"?"":e.pathname}`}catch{return t}},bB=(t,e)=>`${X5}/web/${encodeURIComponent(t)}/${encodeURIComponent(e)}/`;function _B({options:t,onOpen:e}){const i=Ie();return m.jsx("div",{className:"document-action-menu",role:"menu","aria-label":i("session.resourceMenuLabel"),onMouseDown:r=>r.stopPropagation(),children:t.length?t.map(r=>m.jsxs("button",{type:"button",className:"si-resource-menu-row",role:"menuitem",onClick:()=>e(r),children:[m.jsx(ze,{name:r.kind==="file"?"folder-open":"globe",size:13}),m.jsx("span",{children:r.label})]},r.id)):m.jsx("span",{className:"si-resource-menu-empty",children:i("session.resourceMenuEmpty")})})}function yB({document:t,action:e}){return Y5(t,e),null}function wB({document:t,actions:e}){return e.map(i=>m.jsx(yB,{document:t,action:i},i.id))}function xB({tab:t,active:e=!1,focusRequest:i=0,onEscape:r}){const s=Ie(),[n,o]=k.useState({phase:"loading"}),a=k.useRef(null),l=k.useRef(e),u=k.useRef(r);return l.current=e,u.current=r,k.useEffect(()=>{if(t.kind!=="file")return;let c=!1,h=null;const d=Di(`/api/sessions/${encodeURIComponent(t.sessionId)}/files/download?path=${encodeURIComponent(t.value)}&preview=1`);return o({phase:"loading"}),fetch(d).then(async f=>{if(!f.ok){const v=await f.json().catch(()=>null);throw new Error((v==null?void 0:v.error)||s("session.filePreviewFailed",{status:f.status}))}const p=f.headers.get("X-Spexcode-Preview-Kind");if(p==="image")h=URL.createObjectURL(await f.blob()),c||o({phase:"image",url:h});else{const v=await f.text();c||o({phase:p==="html"?"html":"text",text:v})}}).catch(f=>{c||o({phase:"error",message:f instanceof Error?f.message:String(f)})}),()=>{c=!0,h&&URL.revokeObjectURL(h)}},[t.kind,t.sessionId,t.value,t.revision,s]),k.useEffect(()=>{if(t.kind!=="web")return;const c=a.current;if(!c)return;let h=null;const d=v=>{var C;if(!(v.key==="Escape"||v.altKey&&!v.metaKey&&!v.ctrlKey))return;const w=new KeyboardEvent("keydown",{key:v.key,code:v.code,altKey:v.altKey,ctrlKey:v.ctrlKey,metaKey:v.metaKey,shiftKey:v.shiftKey,bubbles:!0,cancelable:!0}),x=!window.dispatchEvent(w);v.key==="Escape"?(v.preventDefault(),x||(C=u.current)==null||C.call(u)):x&&v.preventDefault()},f=()=>{h==null||h.removeEventListener("keydown",d,!0),h=c.contentWindow,h==null||h.addEventListener("keydown",d,!0)},p=()=>{f(),l.current&&document.visibilityState!=="hidden"&&requestAnimationFrame(()=>{var v;return(v=c.contentWindow)==null?void 0:v.focus()})};return c.addEventListener("load",p),f(),()=>{c.removeEventListener("load",p),h==null||h.removeEventListener("keydown",d,!0)}},[t.kind,t.revision]),k.useEffect(()=>{if(t.kind!=="web"||!e||document.visibilityState==="hidden")return;const c=requestAnimationFrame(()=>{var h,d;return(d=(h=a.current)==null?void 0:h.contentWindow)==null?void 0:d.focus()});return()=>cancelAnimationFrame(c)},[t.kind,t.revision,e,i]),t.kind==="web"?m.jsx("iframe",{ref:a,className:"si-resource-web",src:bB(t.sessionId,t.key),title:t.label},t.revision):m.jsxs("div",{className:`si-resource-file ${n.phase}`,"data-selectable":!0,children:[n.phase==="loading"&&m.jsx(ze,{name:"loader",size:18,className:"si-attach-busy"}),n.phase==="error"&&m.jsx("p",{className:"si-file-preview-error",role:"alert",children:n.message}),n.phase==="text"&&m.jsx(gB,{path:t.value,text:n.text}),n.phase==="html"&&m.jsx(vB,{path:t.value,html:n.text}),n.phase==="image"&&m.jsx("img",{src:n.url,alt:Qu(t.value)})]})}function t5(t,e=!0,i=!1){var s;if(!t)return{phase:i?"dormant":"loading"};const r=t.phase==="ready"&&t.value?t.value:(s=t.lastKnown)==null?void 0:s.value;return e?t.phase==="ready"&&t.value?{phase:"ready",...t.value}:t.phase==="dormant"?r?{phase:"dormant",...r}:{phase:"dormant"}:t.phase==="updating"?r?{phase:"updating",...r}:{phase:"loading"}:t.phase==="error"?r?{phase:"error",...r}:{phase:"error"}:{phase:"loading"}:r?{phase:"disconnected",...r}:{phase:"disconnected"}}function SB({summary:t}){const e=Ie(),i=Number.isInteger(t.total);return!i&&t.phase==="loading"?m.jsx("span",{className:"si-eval-wait","data-tip":e("session.evalLoading"),children:m.jsx(ze,{name:"loader",size:12,className:"si-eval-spinner"})}):!i&&t.phase==="dormant"?m.jsx("span",{className:"si-eval-wait",children:m.jsx(to,{kind:"eval",state:"missing",title:e("session.evalDormant"),size:12})}):i?m.jsxs("span",{className:`si-eval-stats ${t.phase}`,"aria-hidden":"true",children:[t.pass>0&&m.jsx(Uo,{kind:"eval",state:"pass",cls:"st-pass secondary",n:t.pass,label:e("session.evalPass",{n:t.pass})}),t.fail>0&&m.jsx(Uo,{kind:"eval",state:"fail",cls:"st-fail secondary",n:t.fail,label:e("session.evalFail",{n:t.fail})}),t.review>0&&m.jsx(Uo,{kind:"eval",state:"review",cls:"st-review secondary",n:t.review,label:e("session.evalReview",{n:t.review})}),t.blind>0&&m.jsx(Uo,{kind:"eval",state:"missing",cls:"st-empty blind",n:t.blind,label:e("session.evalBlind",{n:t.blind})}),t.unknown>0&&m.jsx(Uo,{kind:"eval",state:"missing",cls:"st-empty blind",n:t.unknown,label:e("session.evalUnknown",{n:t.unknown})}),t.phase==="updating"&&m.jsx(ze,{name:"loader",size:11,className:"si-eval-spinner si-eval-phase"}),t.phase==="dormant"&&m.jsx(to,{kind:"eval",state:"missing",title:e("session.evalDormantLast"),className:"si-eval-phase",size:11}),(t.phase==="disconnected"||t.phase==="error")&&m.jsx(to,{kind:"eval",state:"missing",title:e("session.evalUnavailable"),className:"si-eval-phase",size:11})]}):m.jsx("span",{className:"si-eval-wait",children:m.jsx(to,{kind:"eval",state:"missing",title:e("session.evalUnavailable"),size:12})})}function kB({launchers:t,launcher:e,pickLauncher:i}){const r=Ie(),[s,n]=k.useState(!1);ni(s,()=>n(!1));const o=t.find(u=>u.name===e),l=W2(o==null?void 0:o.harness).Glyph;return m.jsxs("div",{className:"si-launcher-picker",children:[m.jsxs("button",{type:"button",className:s?"si-launcher-btn on":"si-launcher-btn",onClick:()=>n(u=>!u),"aria-haspopup":"dialog","aria-expanded":s,"aria-label":r("session.launcherLabel"),"data-tip":r("session.launcherTip"),children:[m.jsx("span",{className:"si-launcher-harness","aria-hidden":"true",children:m.jsx(l,{})}),m.jsx("span",{className:"si-launcher-name",children:e})]}),s&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"si-launcher-backdrop",onMouseDown:()=>n(!1)}),m.jsx("div",{className:"si-launcher-pop",role:"dialog","aria-modal":"true","aria-label":r("session.launcherLabel"),children:t.map(u=>{const c=W2(u.harness),h=c.Glyph;return m.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":u.name===e,className:`si-launcher-row${u.name===e?" on":""}`,onClick:()=>{i(u.name),n(!1)},children:[m.jsxs("span",{className:"si-launcher-row-main",children:[m.jsx("span",{className:"si-launcher-harness","data-tip":c.label,"aria-hidden":"true",children:m.jsx(h,{})}),m.jsx("span",{className:"si-launcher-name",children:u.name}),u.name===e&&m.jsx(ze,{name:"check",size:13,className:"si-launcher-check"})]}),u.cmd?m.jsx("span",{className:"si-launcher-cmd",children:u.cmd}):null]},u.name)})})]})]})}function i5({sessions:t,specs:e=[],focusNode:i,open:r,searchOpen:s=!1,sel:n,setSel:o,seed:a,onSeedConsumed:l,onClose:u,onPickSession:c,onOpenArchive:h,onOpenSearch:d,reload:f,boardLive:p=!1,archiveRequested:v=!1,surface:_=null,route:w=null}){const x=Ie(),C=t0(),{notify:D}=U5(),{lockGraphTo:R}=vf(),{dock:E}=c4(),[L,q,F]=cB(E),[$,W]=k.useState(""),[z,j]=k.useState([]),[A,O]=k.useState(null),[T,U]=k.useState(null),[H,re]=k.useState({}),{launchers:G,launcher:X,pickLauncher:oe}=K3(),[I,Y]=k.useState(null),[le,te]=k.useState(!1),[de,ke]=k.useState(0),[Ye,Ct]=k.useState(0),[At,st]=k.useState([]),{tabs:Be}=c5(),[vt,vr]=k.useState(()=>new Set),[ht,Yr]=k.useState(()=>new Set),[Pt,br]=k.useState(0),[qt,Ni]=k.useState(!1),Si=k.useRef(null),Wt=k.useRef(null),Gi=k.useRef({}),Yi=k.useRef(null),ce=k.useRef(null);k.useEffect(()=>IT(()=>br(M=>M+1)),[]);const Ae=k.useRef(null);k.useEffect(()=>{!I||I.phase==="pending"||I.phase==="sending"||(D(I.message,{kind:I.phase==="delivered"?"success":"error"}),Y(null))},[I,D]);const Re=()=>{Ae.current&&window.clearTimeout(Ae.current),Ae.current=null,te(!1),Y(M=>(M==null?void 0:M.owner)==="command"?null:M)},[$e,In]=k.useState(null),[_r,il]=k.useState(null),Js=k.useCallback(()=>{if(ce.current)return ce.current;const M=fetch(Di("/api/sessions/archive-index")).then(async K=>{if(!K.ok)throw new Error(`archive index refused (HTTP ${K.status})`);const V=await K.json(),_e=e4(Array.isArray(V)?V.map(Ce=>({...Ce,archived:!0})):[]);return In(_e),_e}).catch(K=>(Y({owner:"panel",phase:"failed",message:K instanceof Error?K.message:String(K)}),[])).finally(()=>{ce.current=null});return ce.current=M,M},[]);k.useEffect(()=>{r&&$e===null&&Js()},[r,$e,Js]);const rl=k.useRef(null);k.useEffect(()=>{const M=new Set(t.map(V=>V.id)),K=rl.current;rl.current=M,r&&$e!==null&&K&&[...K].some(V=>!M.has(V))&&Js()},[r,t,$e,Js]);const Zs=k.useMemo(()=>{const M=new Map(t.map(K=>[K.id,K]));for(const K of $e||[])M.has(K.id)||M.set(K.id,K);return _r&&!M.has(_r.id)&&M.set(_r.id,_r),[...M.values()]},[t,$e,_r]),Xi=k.useRef(new Set);for(const M of Zs)Xi.current.add(M.id);const[Li,zn]=k.useState(null);k.useEffect(()=>{Li&&t.some(M=>M.id===Li.id)&&zn(null)},[t,Li]),k.useEffect(()=>{Li&&($e!=null&&$e.some(M=>M.id===Li.id))&&zn(null)},[$e,Li]);const Ft=k.useMemo(()=>!Li||Zs.some(M=>M.id===Li.id)?Zs:[...Zs,Li],[Zs,Li]);k.useEffect(()=>{_r&&t.some(M=>M.id===_r.id)&&il(null)},[t,_r]);const Qs=k.useMemo(()=>e4(Ft.filter(M=>M.archived)),[Ft]),jn=k.useMemo(()=>new Set(["new",...Ft.map(M=>M.id)]),[Ft]),ye=jn.has(n)||n!=="new"&&Xi.current.has(n)?n:"new",J=ye!=="new",{expanded:Q,offlineOpen:Ee}=V6(),Me=k.useMemo(()=>Tf(t||[],M=>Q.has(M),{zoneFolded:M=>M==="offline"&&!Ee,keepVisible:M=>M.id===ye}),[t,Q,Ee,ye]),We=k.useMemo(()=>["new",...Me.filter(M=>M.type==="row").map(M=>M.s.id)],[Me]),nt=k.useRef(new Set);k.useEffect(()=>{!r||n==="new"||jn.has(n)||!Xi.current.has(n)||nt.current.has(n)||(nt.current.add(n),fetch(Di(`/api/sessions/${encodeURIComponent(n)}`)).then(async M=>{if(!M.ok){o("new");return}const K=await M.json();zn({...K,archived:K.archived===!0,liveness:K.archived===!0?"offline":K.liveness})}).catch(M=>{Y({owner:"panel",phase:"failed",message:M instanceof Error?M.message:String(M)}),o("new")}))},[r,n,jn,o]);const He=(i==null?void 0:i.id)||null,Oe=Ft.find(M=>M.id===ye),[Oi,en]=k.useState(!1);k.useEffect(()=>{v&&en(!0)},[v]);const Hn=cn(Oe),No=(Oe==null?void 0:Oe.liveness)==="offline",h5=!!(Oe!=null&&Oe.archived),B1=No||h5,Lo=OT(_)?_:null,d5=$a(Lo)?cf(Lo):null,gs=Hn||B1?Dr:Lo||tu(ye),tn=gs===Dr,vs=gs===aa,f5=M=>{const K=Ft.find(V=>V.id===M);return cn(K)?Dr:tu(M)},R0=!tn&&vg(Oe,{}).some(M=>M.name==="command"),bs=t5(J?Oe==null?void 0:Oe.evalSummary:null,p,!!Oe),p5=Xp(Oe),R1=Oe?[...(Oe.files||[]).map(M=>({id:Bs(ye,"file",M),sessionId:ye,kind:"file",value:M,label:Qu(M),revision:0})),...(Oe.web||[]).map(M=>({id:Bs(ye,"web",M.key),sessionId:ye,kind:"web",key:M.key,value:M.url,label:ih(M.url),revision:0}))]:[],_s=J?d5:null,dt=At.find(M=>M.id===_s)||R1.find(M=>M.id===_s)||null,N1=R1.filter(M=>!Be.some(K=>{var V;return K.page==="sessions"&&K.param===ye&&((V=K.query)==null?void 0:V.surface)===Z2(M.id)})),m5=M=>{Ct(K=>K+1),Re()},L1=M=>{st(K=>K.some(V=>V.id===M.id)?K:[...K,M]),vr(K=>{if(!K.has(M.id))return K;const V=new Set(K);return V.delete(M.id),V}),m5(),Ni(!1),C.open({page:"sessions",param:M.sessionId,query:{surface:Z2(M.id)}})},g5=M=>st(K=>K.map(V=>V.id===M.id?{...V,revision:V.revision+1}:V)),O1=M=>Y({owner:"panel",phase:"failed",message:M instanceof Error?M.message:String(M)}),v5=async(M,K)=>{const V=Di(`/api/sessions/${encodeURIComponent(M)}/files/download?path=${encodeURIComponent(K)}`);try{const _e=await fetch(V,{method:"HEAD"});if(!_e.ok){const Qe=await _e.json().catch(()=>null);throw new Error((Qe==null?void 0:Qe.error)||x("session.fileDownloadFailed",{status:_e.status}))}const Ce=document.createElement("a");Ce.href=V,Ce.download=Qu(K),Ce.style.display="none",document.body.appendChild(Ce),Ce.click(),Ce.remove()}catch(_e){O1(_e)}},b5=async M=>{var K;try{if(!((K=navigator.clipboard)!=null&&K.writeText))throw new Error(x("session.fileCopyUnavailable"));await navigator.clipboard.writeText(M)}catch(V){O1(V)}};k.useEffect(()=>{const M=new Map;for(const _e of t)for(const Ce of _e.web||[]){const Qe={id:Bs(_e.id,"web",Ce.key),sessionId:_e.id,kind:"web",key:Ce.key,value:Ce.url,label:ih(Ce.url),revision:0};M.set(Qe.id,Qe)}const K=Yi.current;if(Yi.current=M,!K)return;const V=[...M].filter(([_e])=>!K.has(_e)).map(([,_e])=>_e);V.length&&vr(_e=>new Set([..._e,...V.map(Ce=>Ce.id)]))},[t]),k.useEffect(()=>{const M=new Set;for(const K of t){for(const V of K.files||[])M.add(Bs(K.id,"file",V));for(const V of K.web||[])M.add(Bs(K.id,"web",V.key))}st(K=>K.filter(V=>M.has(V.id)))},[t]),k.useEffect(()=>{const M=new Set(Be.filter(K=>{var V;return K.page==="sessions"&&$a((V=K.query)==null?void 0:V.surface)}).map(K=>cf(K.query.surface)));_s&&M.add(_s),st(K=>K.filter(V=>M.has(V.id)))},[Be,_s]),k.useEffect(()=>{!_s||!dt||st(M=>M.some(K=>K.id===_s)?M:[...M,dt])},[_s,dt]);const sl=k.useMemo(()=>{const M=[];for(const K of t)for(const V of K.web||[]){const _e={id:Bs(K.id,"web",V.key),sessionId:K.id,kind:"web",key:V.key,value:V.url,label:ih(V.url),revision:0};vt.has(_e.id)&&M.push(_e)}return M},[t,vt]);Y1(sl.length?{id:"session-resource-unread",side:"right",priority:20,kind:"standard",text:x("session.unreadResources",{n:sl.length}),tooltip:x("session.unreadResources",{n:sl.length}),onClick:()=>L1(sl[0])}:null),ni(qt,()=>Ni(!1)),k.useEffect(()=>{if(!qt)return;const M=K=>{var V,_e;(_e=(V=K.target)==null?void 0:V.closest)!=null&&_e.call(V,'.document-action-menu, [data-action="resource-picker"]')||Ni(!1)};return window.addEventListener("mousedown",M,!0),()=>window.removeEventListener("mousedown",M,!0)},[qt]),ni(vs,()=>C.open({page:"sessions",param:ye,query:null},{replace:!0}));const nl=H[ye]||"",rn=M=>re(K=>({...K,[ye]:typeof M=="function"?M(K[ye]||""):M})),N0=M=>{M!=="new"&&(Re(),I0(),I1(K=>K.has(M)?K:new Set(K).add(M)),o(M))},L0=(M,K,V=!1)=>{M!=="new"&&(N0(M),K===Dr?Yr(_e=>_e.has(M)?_e:new Set(_e).add(M)):ke(_e=>_e+1),(V||M===ye)&&C.open({page:"sessions",param:M,query:{surface:K}},{replace:!0}))},_5=U3(Oe==null?void 0:Oe.harness),P1=V3();k.useEffect(()=>{Ae.current&&window.clearTimeout(Ae.current),Ae.current=null,te(!1),Y(null),I0()},[ye]),k.useEffect(()=>{R0||Re()},[R0]),k.useEffect(()=>()=>{Ae.current&&window.clearTimeout(Ae.current)},[]);const[F1,I1]=k.useState(()=>new Set);k.useEffect(()=>{I1(M=>{const K=new Set([...M].filter(V=>{const _e=Ft.find(Ce=>Ce.id===V);return _e&&!cn(_e)&&eh(_e)}));for(const V of Ft)!cn(V)&&eh(V)&&K.add(V.id);if(ye!=="new"){const V=t.find(_e=>_e.id===ye);V&&cn(V)&&K.add(ye)}return K.size===M.size&&[...K].every(V=>M.has(V))?M:K})},[Ft,ye]),k.useEffect(()=>{Yr(M=>{const K=new Set(Ft.map(Ce=>Ce.id)),V=new Set([...M].filter(Ce=>K.has(Ce))),_e=ye==="new"?null:Ft.find(Ce=>Ce.id===ye);return _e&&(!eh(_e)||cn(_e)||tn)&&V.add(_e.id),V.size===M.size&&[...V].every(Ce=>M.has(Ce))?M:V})},[Ft,ye,tn,Pt]),k.useEffect(()=>{if(a==null)return;o("new");const M=QT(a);W(M.text),j(M.selections),I0(),l==null||l(),requestAnimationFrame(()=>{const K=Si.current;K&&(K.focus(),K.setSelectionRange(a.length,a.length))})},[a]),k.useEffect(()=>{if(!r)return;const M=setTimeout(()=>{var K,V;ye==="new"?(K=Si.current)==null||K.focus():le&&((V=Wt.current)==null||V.focus())},0);return()=>clearTimeout(M)},[r,ye,le]);const O0=()=>{const M=eB($,z);M&&(W(""),j([]),IC(M,X).then(K=>{var V,_e,Ce,Qe,Et,qn;K.ok&&K.id?(il({id:K.id,...K.session||{},label:((V=K.session)==null?void 0:V.label)||M.split(/\s+/).slice(0,8).join(" ")||K.id,title:((_e=K.session)==null?void 0:_e.title)||((Ce=K.session)==null?void 0:Ce.label)||M.split(/\s+/).slice(0,8).join(" ")||K.id,status:((Qe=K.session)==null?void 0:Qe.status)||"queued",liveness:((Et=K.session)==null?void 0:Et.liveness)||"offline",archived:!1,capabilities:((qn=K.session)==null?void 0:qn.capabilities)||{headless:!0}}),M1("sessions",K.id,null),C.open({page:"sessions",param:K.id,query:null}),f==null||f()):K.ok||D(K.error||x("session.launchFailed"),{kind:"error"})}))},z1=async()=>{const M=nl;if(!M.trim()||ye==="new")return;const K=j3(M,x5);if(K){rn(""),ys.close(),K.run();return}const V=z3(M,e);if((I==null?void 0:I.owner)==="command"&&I.phase==="sending")return;const _e=Gi.current[ye]||crypto.randomUUID();Gi.current[ye]=_e,Y({owner:"command",phase:"sending",message:x("session.outcomeSending")});const Ce=new AbortController,Qe=window.setTimeout(()=>Ce.abort(),G5);try{const{ok:Et,status:qn,outcome:ei}=await l4(ye,V,{deliveryId:_e,signal:Ce.signal});if(!Et){if(ei!=null&&ei.deliveryPending){Y({owner:"command",phase:"queued",message:x("session.outcomeQueued")});return}Y({owner:"command",phase:"failed",message:(ei==null?void 0:ei.error)||x("session.deliveryFailed",{status:qn})});return}if((ei==null?void 0:ei.delivery)==="queued"){Y({owner:"command",phase:"queued",message:x("session.outcomeQueued")});return}rn(ll=>ll===M?"":ll),delete Gi.current[ye];const H0=(ei==null?void 0:ei.mentionSummary)||((ei==null?void 0:ei.delivery)==="deferred"?x("session.outcomeAccepted"):x("session.outcomeDelivered"));Y({owner:"command",phase:"delivered",message:H0}),Ae.current=window.setTimeout(()=>Re(),650)}catch(Et){if(Ce.signal.aborted){Y({owner:"command",phase:"failed",message:x("session.outcomeUnconfirmed")});return}Y({owner:"command",phase:"failed",message:Et instanceof Error?Et.message:String(Et)})}finally{window.clearTimeout(Qe)}},y5=()=>z.length?m.jsx("div",{className:"si-code-selection-queue","aria-label":x("session.codeSelectionAttachments"),children:z.map((M,K)=>m.jsx(tB,{selection:M,onRemove:()=>j(V=>V.filter((_e,Ce)=>Ce!==K))},`${M.path}:${M.startLine}:${M.endLine}:${K}`))}):null,P0=async(M,K,V="panel",_e={})=>{Y({owner:V,phase:"pending",message:x("session.outcomeWorking")});let Ce=!0;try{const Qe=await fetch(Di(`/api/sessions/${ye}/${M}`),K?{method:"POST",headers:{"content-type":"application/json",..._e},body:JSON.stringify(K)}:{method:"POST",headers:_e}),Et=await Qe.json().catch(()=>null);(!Qe.ok||(Et==null?void 0:Et.ok)===!1)&&(Ce=!1,Y({owner:V,phase:"failed",message:(Et==null?void 0:Et.error)||`session ${M} refused (HTTP ${Qe.status})`}))}catch(Qe){Ce=!1,Y({owner:V,phase:"failed",message:Qe instanceof Error?Qe.message:String(Qe)})}return Ce&&Y(null),await(f==null?void 0:f()),Ce&&V==="command"&&Re(),Ce},j1=async()=>{const M=await P0("resume");return M&&await Js(),M},F0=vg(Oe,{command:()=>{le?Re():te(!0)},eval:()=>{J&&C.open(QM(nf(ye)))},relaunch:j1,stop:M=>P0("stop",void 0,M),close:M=>P0("close",void 0,M)}),H1=F0.filter(M=>M.typed!==!1&&M.enabled),$1=(M,K)=>({name:M.name,description:x(M.descKey),ui:!0,color:M.color,run:()=>{var V;return(V=M.run)==null?void 0:V.call(M,K)}}),q1=H1.map(M=>$1(M,"command")),w5=H1.map(M=>$1(M,"panel")),$n=fd({inputRef:Si,value:$,setValue:W,specs:e,sessions:Ft,launchers:G,focusId:He,slash:{commands:P1,mode:"token",head:x("session.menuPresets"),onPick:(M,K)=>{const V=[$.slice(0,K.start).trim(),$.slice(K.end).trim()].filter(Boolean).join(" "),_e=`/${M.name}${V?` ${V}`:""} `;return W(_e),requestAnimationFrame(()=>{const Ce=Si.current;Ce&&(Ce.focus(),Ce.setSelectionRange(_e.length,_e.length))}),!0}}}),ys=fd({inputRef:Wt,value:nl,setValue:rn,specs:e,sessions:Ft,launchers:G,focusId:He,up:!0,slash:{commands:G3(q1,P1,_5),mode:"line",head:x("session.menuCommands"),onPick:M=>M.ui?(rn(""),M.run(),!0):!1}}),x5=q1,I0=()=>{$n.close(),ys.close()},z0=M=>q3(Wt.current,M,rn,ys.sync),ws=gd({inputRef:Si,setValue:W,variant:"new"}),Xr=gd({inputRef:Wt,setValue:rn,variant:"command"}),sn=Number.isInteger(bs.total)?x("session.evalDoorSummary",bs):"",j0=bs.phase==="ready"?sn:bs.phase==="updating"?x("session.evalUpdating",{summary:sn}):bs.phase==="disconnected"?x("session.evalDisconnected",{summary:sn}):bs.phase==="dormant"?sn?x("session.evalDormantKnown",{summary:sn}):x("session.evalDormant"):bs.phase==="loading"?x("session.evalLoading"):sn?x("session.evalFailedKnown",{summary:sn}):x("session.evalUnavailable"),S5=h4()&&J&&F0.some(M=>M.name==="eval");Y1(S5?{id:"session-eval",side:"right",priority:25,tooltip:j0,node:m.jsxs("a",{className:"si-eval-door","data-action":"eval",href:tl(nf(ye)),"data-tip":j0,"aria-label":j0,children:[m.jsx(ze,{name:"evals",size:14}),m.jsx(SB,{summary:bs})]})}:null);const k5=J?Vt("sessions",ye,Lo?{surface:Lo}:null):null,C5=Hn||B1?[Dr]:[Dr,Yn,aa],ol=gs===aa?tu(ye):gs,A5=J?[{id:"resource-picker",icon:"folder-open",label:x("session.addResourceTab"),priority:100,pressed:qt,haspopup:!0,onClick:()=>Ni(M=>(M||O(null),!M)),menuKey:qt?N1.map(M=>M.id).join(","):"",menu:qt?m.jsx(_B,{options:N1,onOpen:L1}):null},...!dt&&C5.length>1?[{id:"surface-switcher",icon:ol===Yn?"message-square":"terminal",label:x(ol===Yn?"session.switchToConversation":"session.switchToTerminal"),priority:80,menuKey:`${ol}:${vs?"diff":"base"}`,onClick:()=>{Ni(!1);const M=ol===Yn?Dr:Yn;FT(ye,M),L0(ye,M,!0)}},{id:"diff-switcher",icon:"git-compare",label:x(vs?"session.diffClose":"session.diffScope"),priority:79,pressed:vs,menuKey:vs?"diff":"base",onClick:()=>{Ni(!1),L0(ye,vs?tu(ye):aa,!0)}}]:[],...F0.filter(M=>M.button&&!dt&&(gs==="terminal"||M.name!=="merge")).map(M=>{const K=M.enabled&&!(M.name==="command"&&tn);return{id:M.name,icon:M.icon,label:K?XT(x(M.titleKey),...M.shortcut?[M.shortcut]:[]):x(M.disabledTitleKey||M.titleKey),disabled:!K,disabledReason:M.enabled?void 0:x(M.disabledTitleKey),pressed:M.pressed?le:void 0,onClick:()=>{var V;return(V=M.run)==null?void 0:V.call(M)},priority:M.anchor==="right"?-10:50}}),...dt?[{id:"refresh-resource",icon:"rotate-ccw",label:x("session.refreshResourceTab",{name:dt.label}),priority:40,onClick:()=>g5(dt)},...dt.kind==="file"?[{id:"download-resource",icon:"download",label:x("session.downloadFile"),priority:39,onClick:()=>{v5(dt.sessionId,dt.value)}},{id:"copy-resource",icon:"copy",label:dt.value,priority:38,onClick:()=>{b5(dt.value)}}]:[]]:[]]:[],W1=k.useRef({}),al=ye==="new"?$n:ys;return W1.current={active:ye,submit:O0,menu:al.menu,navMenu:al.nav,accept:al.accept,closeMenu:al.dismiss,open:r,searchOpen:s,commandOpen:le,commandAvailable:R0,setCommandOpen:te,closeCommandBox:Re,sessionOrder:We},gf(M=>((V=>{var ul,U1,cl,G1;const{active:_e,submit:Ce,menu:Qe,navMenu:Et,accept:qn,closeMenu:ei,open:H0,searchOpen:ll,commandOpen:K1,commandAvailable:E5,setCommandOpen:D5,closeCommandBox:V1,sessionOrder:Oo}=W1.current;if(!(!H0||ll)&&!((U1=(ul=V.target)==null?void 0:ul.closest)!=null&&U1.call(ul,"[data-focus-overlay]"))&&!((V.key==="Enter"||V.key===" ")&&((G1=(cl=V.target)==null?void 0:cl.closest)!=null&&G1.call(cl,"button, a[href]")))){if(GT("shell.commandBox",V)&&!V.metaKey&&!V.ctrlKey&&_e!=="new"){V.preventDefault(),V.stopPropagation(),E5&&(K1?V1():D5(!0));return}if(!(V.altKey&&!V.metaKey&&!V.ctrlKey&&["KeyN","KeyF"].includes(V.code))){if(Qe){if(V.key==="ArrowDown"){V.preventDefault(),V.stopPropagation(),Et(1);return}if(V.key==="ArrowUp"){V.preventDefault(),V.stopPropagation(),Et(-1);return}if((V.key==="Enter"||V.key==="Tab")&&!ha(V)){V.preventDefault(),V.stopPropagation(),qn(Qe.items[Qe.index]);return}if(V.key==="Escape"){V.preventDefault(),V.stopPropagation(),ei();return}}if(K1&&V.key==="Escape"){V.preventDefault(),V.stopPropagation(),V1();return}if(V.key==="ArrowUp"||V.key==="ArrowDown"){if(t_(V.target))return;V.preventDefault(),V.stopPropagation();let $0=Oo.indexOf(_e);$0<0&&($0=0);const q0=Math.max(0,Math.min(Oo.length-1,$0+(V.key==="ArrowDown"?1:-1)));Oo[q0]!==_e&&(c?c(Oo[q0]):o(Oo[q0]));return}}}})(M),M.cancelBubble),10,{allowTyping:!0}),m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"si-page",children:[L&&m.jsx(RT,{closing:q,opening:F,sessions:t,activeId:ye,onSelect:(M,K)=>c?c(M,K):M==="new"?o("new"):N0(M),archiveActive:v,onArchive:h,onSearch:d,reload:f,onContextMenu:O,selectRequest:T,onSelectRequestConsumed:()=>U(null),onError:M=>Y({owner:"panel",phase:"failed",message:M})}),m.jsxs("div",{className:"si-document",children:[w&&m.jsx(lB,{specs:e,sessions:t,route:w,onSessionContextMenu:M=>{Ni(!1),O(M)}}),m.jsxs("div",{className:"si-panel",onMouseDownCapture:ya,children:[ws.fileInput,Xr.fileInput,m.jsxs("section",{className:`si-content${ye==="new"?" is-new":" is-session"}`,children:[ye==="new"&&m.jsxs("div",{className:"si-new-center",children:[m.jsx(e5,{}),m.jsxs("div",{className:ws.dragging?"si-inputwrap dragover":"si-inputwrap",...ws.dropProps,children:[m.jsx(hd,{ref:Si,className:"si-input","data-focus-sink":!0,rows:1,value:$,onKeyDown:M=>{M.key!=="Enter"||M.shiftKey||ha(M)||(M.preventDefault(),M.stopPropagation(),O0())},onChange:M=>{W(M.target.value),$n.sync(M.target)},onSelect:M=>$n.sync(M.target),onPaste:ws.onPaste,onBlur:$n.close,placeholder:x("session.inputPlaceholder"),spellCheck:!1}),m.jsx("button",{type:"button",className:"si-attach","data-tip":x("session.attachTitle"),onClick:ws.pick,disabled:ws.busy,children:ws.busy?m.jsx(fB,{}):m.jsx(dB,{})}),m.jsx(Zt,{icon:"send",size:14,className:"si-launch",label:x("session.launchSend"),disabled:!$.trim(),onMouseDown:ya,onClick:O0}),$n.menuEl]}),y5(),ws.queue,G.length?m.jsx(kB,{launchers:G,launcher:X,pickLauncher:oe}):null,m.jsxs("div",{className:"si-hint",children:[x("session.hint.before"),m.jsx("code",{children:"[["}),x("session.hint.mid"),m.jsx("code",{children:"/"}),x("session.hint.after")]})]}),m.jsxs("div",{className:"si-session-wrap","aria-hidden":!J,style:{display:"flex",flexDirection:"column",flex:1,minWidth:0,minHeight:0,position:J?"relative":"absolute",inset:J?void 0:0,visibility:J?"visible":"hidden",pointerEvents:J?"auto":"none"},children:[m.jsx(wB,{document:k5,actions:A5}),m.jsxs("div",{className:`si-term-body${tn?" is-conversation":""}${vs?" is-diff":""}${dt?" is-resource":""}`,id:dt?`si-resource-panel-${dt.id}`:`si-${gs}-panel-${ye}`,"aria-label":(dt==null?void 0:dt.label)||x(tn?"session.tabConversation":"session.tabTerminal"),style:{position:"relative"},children:[[...new Set([...F1,...ht])].map(M=>{const K=Ft.find(Et=>Et.id===M);if(!K)return null;const V=cn(K),_e=M===ye&&!dt,Ce=_e&&gs==="terminal",Qe=_e&&(V||gs===Dr);return m.jsxs("div",{children:[!V&&F1.has(M)&&m.jsx("div",{className:"si-term-layer",style:{position:"absolute",inset:0,visibility:Ce?"visible":"hidden",pointerEvents:Ce?"auto":"none"},children:m.jsx(R7,{sessionId:M,active:r&&Ce,focused:r&&Ce&&!le,writable:r&&Ce,focusRequest:M===ye?de:0})}),(V||ht.has(M))&&m.jsx("div",{className:"si-term-layer",style:{position:"absolute",inset:0,visibility:Qe?"visible":"hidden",pointerEvents:Qe?"auto":"none"},children:m.jsx(QC,{s:K,sessions:Ft,active:r&&Qe,specs:e,boardCommands:M===ye?w5:[],footerState:Xp(K),onRestore:M===ye&&K.status!=="retired"?j1:void 0,actionOutcome:M===ye&&(I==null?void 0:I.owner)==="panel"?I:null})})]},M)}),vs&&m.jsx(GM,{sessionId:ye}),At.map(M=>{const K=(dt==null?void 0:dt.id)===M.id;return m.jsx("div",{className:"si-resource-layer",style:{position:"absolute",inset:0,visibility:K?"visible":"hidden",pointerEvents:K?"auto":"none"},children:m.jsx(xB,{tab:M,active:r&&K,focusRequest:K?Ye:0,onEscape:()=>L0(M.sessionId,f5(M.sessionId),!0)})},M.id)}),(I==null?void 0:I.owner)==="panel"&&p5==="live"&&m.jsx("div",{className:"si-action-outcome-float",children:m.jsx(t4,{outcome:I})}),le&&!No&&!tn&&m.jsxs("div",{className:"si-command-layer",role:"dialog","aria-label":x("session.commandBox"),children:[m.jsx("button",{type:"button",className:"si-command-dismiss",tabIndex:-1,"aria-label":x("session.commandClose"),onMouseDown:Re}),m.jsx(L3,{className:`si-command-box${Xr.dragging?" dragover":""}`,...Xr.dropProps,editor:m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"fv-tawrap",children:[m.jsx(hd,{ref:Wt,className:"si-command-input",rows:1,value:nl,"data-focus-sink":!0,onChange:M=>{delete Gi.current[ye],rn(M.target.value),ys.sync(M.target)},onSelect:M=>ys.sync(M.target),onPaste:Xr.onPaste,onBlur:ys.close,onKeyDown:M=>{M.key==="Enter"&&!M.shiftKey&&!ha(M)&&(M.preventDefault(),M.stopPropagation(),z1())},placeholder:x("session.commandPlaceholder"),spellCheck:!1}),ys.menuEl]}),Xr.queue]}),footer:m.jsxs("div",{className:"si-command-tools",children:[m.jsxs("span",{className:"si-command-title",children:[m.jsx(ze,{name:"command",size:12}),x("session.commandBox")]}),m.jsx("button",{type:"button",className:"fv-trigger-btn","data-tip":x("thread.mentionActor"),"aria-label":x("thread.mentionActor"),onClick:()=>z0("@"),children:"@"}),m.jsx("button",{type:"button",className:"fv-trigger-btn","data-tip":x("thread.mentionNode"),"aria-label":x("thread.mentionNode"),onClick:()=>z0("[["),children:"[["}),m.jsx("button",{type:"button",className:"fv-trigger-btn","data-tip":x("session.menuCommands"),"aria-label":x("session.menuCommands"),onClick:()=>z0("/"),children:"/"}),m.jsx(Zt,{icon:Xr.busy?"loader":"paperclip",size:14,iconClassName:Xr.busy?"si-attach-busy":void 0,className:"si-command-tool",label:x("session.attachTitle"),disabled:Xr.busy,onClick:Xr.pick}),(I==null?void 0:I.owner)==="command"&&m.jsx(t4,{outcome:I}),m.jsx(Zt,{icon:"send",size:14,className:"si-command-send",label:x("session.commandSend"),disabled:!nl.trim()||(I==null?void 0:I.owner)==="command"&&I.phase==="sending",onClick:z1})]})})]})]})]})]})]})]})]}),Oi&&m.jsx(hB,{sessions:Qs,onOpenSession:M=>{en(!1),c==null||c(M),N0(M)},onClose:()=>{en(!1),v&&C.open({page:"sessions",param:ye==="new"?null:ye,query:null})}}),m.jsx(bT,{menu:A,onClose:()=>O(null),onChanged:f,onError:M=>{var V;const K=(V=A==null?void 0:A.session)==null?void 0:V.id;if(K&&K!==ye){o(K),requestAnimationFrame(()=>Y({owner:"panel",phase:"failed",message:M}));return}Y({owner:"panel",phase:"failed",message:M})},onLock:M=>{R(M.source,{toggle:!1}),u()},onMultiSelect:M=>U(M),onDetach:M=>{Hi("/api/sessions/reparent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({children:[M.id],parent:null})}).then(()=>f==null?void 0:f())}})]})}const lN=Object.freeze(Object.defineProperty({__proto__:null,LaunchHero:e5,default:i5,sessionEvalDisplay:t5},Symbol.toStringTag,{value:"Module"}));function CB({param:t,query:e}){const{specs:i,sessions:r,boardLive:s}=bf(),{reload:n}=d4(),{palette:o}=c4(),{openPalette:a,takeCompose:l,watchCompose:u}=vf(),c=t0(),h=k.useCallback((_,{newTab:w=!1}={})=>{const x={page:"sessions",param:_,query:null};return w&&_!=="new"&&M1(x.page,x.param,x.query),c.open(x)},[c]),d=t&&t!=="new"?t:"new",[f,p]=k.useState(null),v=h4();return k.useEffect(()=>{typeof(e==null?void 0:e.seed)=="string"&&e.seed.length&&p(e.seed)},[e==null?void 0:e.seed]),k.useEffect(()=>{if(!v)return;const _=()=>{const w=l();w!=null&&p(w)};return _(),u(_)},[v,l,u]),m.jsx(i5,{sessions:r,specs:i,focusNode:null,open:v,searchOpen:!!o,sel:d,surface:e==null?void 0:e.surface,setSel:h,seed:f,onSeedConsumed:()=>p(null),onClose:()=>c.open({page:"graph",param:null,query:null}),onPickSession:h,onOpenArchive:()=>c.open({page:"sessions",param:t&&t!=="new"?t:null,query:{archive:"1"}}),onOpenSearch:()=>a("sessions"),boardLive:s,reload:n,archiveRequested:(e==null?void 0:e.archive)==="1",route:{page:"sessions",param:t,query:e}})}const AB=/^[a-z][a-z0-9-]*$/,EB=t=>t&&typeof t=="object"&&!Array.isArray(t);function rh(t){if(typeof t!="string"||!AB.test(t))throw new TypeError(`view name must be lowercase kebab-case: ${String(t)}`)}const DB=new Set([Symbol.for("react.lazy"),Symbol.for("react.memo"),Symbol.for("react.forward_ref")]),MB=t=>typeof t=="function"||t&&typeof t=="object"&&DB.has(t.$$typeof);function i4(t){if(!t||typeof t!="object"||!MB(t.component))throw new TypeError("view definition requires a component function or React component");return Object.freeze({...t})}function TB(t={}){const e=new Map,i=new Map,r=new Map;for(const[l,u]of Object.entries(t))rh(l),e.set(l,i4(u)),i.set(l,"core");const s=(l,u,c="runtime")=>{if(rh(l),typeof c!="string"||c.length===0)throw new TypeError("view owner is required");if(e.has(l))throw new Error(`view already registered: ${l}`);return e.set(l,i4(u)),i.set(l,c),e.get(l)},n=l=>{if(!l||typeof l!="object"||typeof l.id!="string"||l.id.length===0)throw new TypeError("plugin requires a non-empty id");if(r.has(l.id))throw new Error(`plugin already registered: ${l.id}`);if(!l.views||typeof l.views!="object"||Array.isArray(l.views))throw new TypeError(`plugin ${l.id} requires a views object`);const u=Object.keys(l.views);for(const h of u)if(rh(h),e.has(h))throw new Error(`view already registered: ${h}`);const c=[];try{for(const h of u)s(h,l.views[h],l.id),c.push(h);r.set(l.id,Object.freeze({id:l.id,views:Object.freeze([...u])}))}catch(h){for(const d of c)e.delete(d),i.delete(d);throw h}return r.get(l.id)},o=l=>{const u=r.get(l);if(!u)return!1;for(const c of u.views)e.delete(c),i.delete(c);return r.delete(l),!0},a=Object.freeze({assertAddress:(l,u="address")=>{if(!EB(l)||typeof l.page!="string"||!e.has(l.page))throw new TypeError(`${u}.page is not a registered view: ${String(l==null?void 0:l.page)}`);const c=l.param??null;if(c!=null&&typeof c!="string")throw new TypeError(`${u}.param must be a string or null`);return typeof e.get(l.page).document=="function"&&c==="new"&&l.page==="sessions",l},isDocument:(l,u=null)=>{const c=e.get(l);return typeof(c==null?void 0:c.document)=="function"?c.document(l,u):!!(c!=null&&c.document)},isResident:(l,u=null)=>{var c;return!!((c=e.get(l))!=null&&c.resident)&&u==null}});return Object.freeze({get:l=>e.get(l),has:l=>e.has(l),ownerOf:l=>i.get(l),entries:()=>[...e.entries()],registerView:s,registerPlugin:n,unregisterPlugin:o,routeContract:a})}function BB(t){return{id:"dashboard-settings",views:{settings:{component:t,surface:"workspace",document:!0,resident:!0,icon:"settings",className:"view-settings"}}}}const sh="spexcode.chunk-reload";function Fn(t){return k.lazy(async()=>{for(let e=0;;e++)try{const i=await t();try{sessionStorage.removeItem(sh)}catch{}return i}catch(i){if(e<2){await new Promise(s=>setTimeout(s,250));continue}let r=!0;try{r=sessionStorage.getItem(sh)==="1"}catch{}if(r)throw i;try{sessionStorage.setItem(sh,"1")}catch{}location.reload(),await new Promise(()=>{})}})}const r5=Fn(()=>Gs(()=>import("./GraphView-CpSd8In8.js"),__vite__mapDeps([5,1,2,3,6,7,8,9,4,10]))),RB=Fn(()=>Gs(()=>import("./SpecView-Cz828zhT.js"),__vite__mapDeps([11,1,2,6,7,3,8,4]))),NB=Fn(()=>Gs(()=>import("./FileView-CiopSqO_.js"),__vite__mapDeps([12,1,2,8,3,4]))),LB=Fn(()=>Gs(()=>import("./EvalsPage-CvJFW7Xx.js"),__vite__mapDeps([13,1,2,7,3,4]))),OB=Fn(()=>Gs(()=>import("./IssuesPage-B0Lgqyjr.js"),__vite__mapDeps([14,1,2,6,7,3,8,4]))),PB=Fn(()=>Gs(()=>import("./Settings-DCI7WK4U.js"),__vite__mapDeps([15,1,2,3,4]))),FB=Fn(()=>Gs(()=>import("./EmptyView-9otc0raU.js"),__vite__mapDeps([16,1,2,3])));function IB({param:t,query:e}){return t==null?m.jsx(r5,{page:"spec",param:t,query:e}):m.jsx(RB,{param:t,query:e})}function zB({param:t,query:e}){const{specs:i,sessions:r,issuesStamp:s}=bf(),{reload:n}=d4(),o=t0(),a=l=>o.open({page:"sessions",param:l,query:null});return m.jsx(LB,{param:t,query:e,specs:i,sessions:r,issuesStamp:s,reloadBoard:n,onOpenSession:a})}function jB({param:t,query:e}){const{specs:i,sessions:r,issuesStamp:s}=bf(),n=t0(),o=a=>n.open({page:"sessions",param:a,query:null});return m.jsx(OB,{param:t,query:e,specs:i,sessions:r,issuesStamp:s,onOpenSession:o})}function HB(){return m.jsx(PB,{})}const $B=Object.freeze({graph:{component:r5,surface:"workspace",document:!1,icon:"graph",className:"view-graph"},spec:{component:IB,surface:"workspace",document:!0,resident:!0,icon:"graph",className:"view-spec"},file:{component:NB,surface:"workspace",document:(t,e)=>e!=null,icon:"files",className:"view-file"},sessions:{component:CB,surface:"workspace",document:(t,e)=>e!=null&&e!=="new",icon:"sessions",className:"view-sessions"},evals:{component:zB,surface:"workspace",document:!0,resident:!0,icon:"evals",className:"view-evals"},issues:{component:jB,surface:"workspace",document:!0,resident:!0,icon:"issues",className:"view-issues"},empty:{component:FB,surface:"workspace",document:!1,className:"view-empty"}}),Nn=TB($B),uN=Nn.routeContract,qB=t=>Nn.registerPlugin(t);qB(BB(HB));const cN=t=>Nn.get(t)||Nn.get("sessions"),WB=t=>{var e;return((e=Nn.get(t))==null?void 0:e.icon)||null},s5=(t,e=null)=>{const i=Nn.get(t);return typeof(i==null?void 0:i.document)=="function"?i.document(t,e):!!(i!=null&&i.document)},KB=(t,e=null)=>{var i;return!!((i=Nn.get(t))!=null&&i.resident)&&e==null},lo=t=>{var e;return(t==null?void 0:t.page)==="sessions"&&typeof((e=t==null?void 0:t.query)==null?void 0:e.surface)=="string"&&t.query.surface.startsWith("resource:")},e0=t=>lo(t)?"file":t==null?void 0:t.page,n5=new Set(["spec","evals","issues","settings"]),B0=t=>(t==null?void 0:t.page)==="sessions"&&(t!=null&&t.param)&&!lo(t)?{...t,query:null}:n5.has(t==null?void 0:t.page)?{...t,param:null,query:null}:t,Xe=t=>{const e=B0(t);return Vt(e.page,e.param,e.query)};function VB(t,e=()=>!0){const i=[],r=new Set;for(const s of t){if(!e(s.page,s.param??null))continue;const n={page:s.page,param:s.param??null,query:s.query??null},o=Xe(n);r.has(o)||(r.add(o),i.push(n))}return i}function UB(t,e,i="slot",r=null){const s={page:e.page,param:e.param??null,query:e.query??null},n=B0(s),o=Xe(n),a=t.find(c=>Xe(c)===o);if(a){const c=n.page==="sessions"&&!lo(n)&&JSON.stringify(a.query||null)!==JSON.stringify(n.query||null),h=n5.has(n.page)&&(a.param!==s.param||JSON.stringify(a.query||null)!==JSON.stringify(s.query||null));return!c&&!h?t:t.map(d=>Xe(d)===o?{...d,param:s.param,query:s.query}:d)}const l={page:s.page,param:s.param,query:s.query},u=i==="append"||r==null?-1:t.findIndex(c=>Xe(c)===r&&e0(c)===e0(n));return u<0?[...t,l]:t.map((c,h)=>h===u?l:c)}function df(t,e,i=null){const r=t.findIndex(o=>Xe(o)===e);if(r<0)return t;const s=t.filter((o,a)=>a!==r),n=i==null?s.length:s.findIndex(o=>Xe(o)===i);return n<0||n===r?t:[...s.slice(0,n),t[r],...s.slice(n)]}function GB(t,e,i,r=[]){const s=e0(B0(t));if(lo(t)){const c=e.find(h=>h.page==="sessions"&&h.param===t.param&&!lo(h));if(c)return c}const n=c=>{for(const h of r){const d=e.find(f=>Xe(f)===h);if(d&&c(d))return d}return null},o=c=>{for(let h=0;h<e.length;h+=1){const d=e[i+h];if(d&&c(d))return d;const f=e[i-1-h];if(f&&c(f))return f}return null},a=()=>!0,l=c=>e0(c)===s,u=n(a)||o(l)||o(a);return u||(lo(t)?{page:"sessions",param:"new",query:null}:(t==null?void 0:t.page)==="spec"||(t==null?void 0:t.page)==="file"?{page:"graph",param:null,query:null}:{page:"empty",param:null,query:null})}const ff="spexcode.tabs",YB=()=>{try{const t=JSON.parse(localStorage.getItem(ff)||"[]");if(!Array.isArray(t))return[];const e=t.filter(r=>r&&typeof r.page=="string"),i=VB(e,s5);return JSON.stringify(i)!==JSON.stringify(e)&&localStorage.setItem(ff,JSON.stringify(i)),i}catch{return[]}},XB=t=>{try{localStorage.setItem(ff,JSON.stringify(t))}catch{}};let o5=null;const pf=new Set,Ii=()=>o5??(o5=YB()),iu=t=>{const e=t;if(e===Ii())return e;o5=e,XB(e);for(const i of[...pf])i(e);return e};let uo=[],r4=null;const JB=t=>{if(uo[0]===t)return;const e=new Set(Ii().map(Xe));uo=[t,...uo.filter(i=>i!==t&&e.has(i))]};let Xn=null,Ls=null;function ZB(t){return Ls=t,()=>{Ls===t&&(Ls=null)}}function hN(t,...e){var i;return(i=Ls==null?void 0:Ls[t])==null?void 0:i.call(Ls,...e)}const a5=t=>t.button===0&&!t.shiftKey&&!t.altKey&&(t.ctrlKey||t.metaKey);function M1(t,e=null,i=null){const r=Xe(B0({page:t,param:e,query:i}));Xn=Ii().some(s=>Xe(s)===r)?null:r}function T1(t,e=null,i=null){M1(t,e,i),yn(t,e,{query:i})}const l5=t=>{const{page:e,param:i,query:r}=mf(t);return{page:e,param:i,query:Object.keys(r||{}).length?r:null}};function u5(t,e){if(!a5(t))return!1;t.preventDefault();const i=l5(e);return T1(i.page,i.param,i.query),!0}function dN(t){const e=Ii().filter(t),i=e[e.length-1];return i?(yn(i.page,i.param,{query:i.query}),!0):!1}function c5({onCloseStart:t}={}){const e=i_(),[i,r]=k.useState(Ii),s=k.useRef(t);k.useEffect(()=>{s.current=t},[t]),k.useEffect(()=>(pf.add(r),r(Ii()),()=>{pf.delete(r)}),[]),k.useEffect(()=>{const c=Xe(e),h=r4;if(r4=c,Xn&&Xn!==c&&(Xn=null),!s5(e.page,e.param))return;const d=Xn===c?"append":"slot";Xn=null,iu(UB(Ii(),e,d,h)),JB(c)},[e.page,e.param,e.query]);const n=Xe(e),o=k.useCallback(c=>yn(c.page,c.param,{query:c.query}),[]),a=k.useCallback(c=>{var v;const h=Xe(c),d=Ii(),f=d.findIndex(_=>Xe(_)===h);if(f<0)return;(v=s.current)==null||v.call(s,c);const p=d.filter((_,w)=>w!==f);if(iu(p),uo=uo.filter(_=>_!==h),h===n){const _=GB(c,p,f,uo);yn(_.page,_.param,{query:_.query})}},[n]),l=k.useCallback(c=>{const h=Xe(c),d=Ii();d.filter(f=>Xe(f)!==h).forEach(f=>{var p;return(p=s.current)==null?void 0:p.call(s,f)}),iu(d.filter(f=>Xe(f)===h)),h!==n&&yn(c.page,c.param,{query:c.query})},[n]),u=k.useCallback((c,h)=>{iu(df(Ii(),c,h))},[]);return k.useEffect(()=>ZB({closeActive:()=>{const c=Ii().find(h=>Xe(h)===n);c&&a(c)},move:c=>{const h=Ii(),d=h.findIndex(f=>Xe(f)===n);d<0||h.length<2||o(h[(d+c+h.length)%h.length])},active:()=>Ii().find(c=>Xe(c)===n)||null}),[n,o,a]),k.useMemo(()=>({tabs:i,activeKey:n,open:o,close:a,closeOthers:l,move:u}),[i,n,o,a,l,u])}export{hN as $,G2 as A,bT as B,S1 as C,_a as D,U6 as E,af as F,H3 as G,uR as H,Hr as I,f4 as J,lr as K,FR as L,cB as M,LR as N,pT as O,tl as P,jR as Q,to as R,Nu as S,IR as T,gC as U,Z6 as V,WT as W,E1 as X,$T as Y,aB as Z,VT as _,Yu as a,vR as a$,lB as a0,QM as a1,K3 as a2,mR as a3,pR as a4,QR as a5,cN as a6,W2 as a7,uN as a8,t1 as a9,UR as aA,lT as aB,WR as aC,fT as aD,YR as aE,XR as aF,GR as aG,fR as aH,Qk as aI,K6 as aJ,NR as aK,HR as aL,fd as aM,_C as aN,L3 as aO,bR as aP,q3 as aQ,VR as aR,zR as aS,dR as aT,Kk as aU,tC as aV,ZR as aW,Uo as aX,Xp as aY,eB as aZ,M1 as a_,eN as aa,kT as ab,wT as ac,ST as ad,xT as ae,qR as af,hd as ag,ha as ah,nf as ai,QC as aj,IC as ak,gR as al,JR as am,bC as an,tN as ao,_T as ap,sN as aq,xe as ar,Ke as as,DD as at,yR as au,wR as av,tM as aw,D0 as ax,be as ay,KR as az,Ci as b,EC as b0,tB as b1,o0 as b2,SC as b3,lR as b4,$3 as b5,w7 as b6,iN as b7,Yn as b8,Dr as b9,fD as bA,ji as bB,Xs as bC,we as bD,En as bE,CR as bF,Jd as bG,ER as bH,MR as bI,TR as bJ,DR as bK,BR as bL,RR as bM,YD as bN,GD as bO,SR as bP,lN as bQ,Vp as ba,_7 as bb,b7 as bc,aR as bd,rN as be,oN as bf,nN as bg,aN as bh,ID as bi,d6 as bj,Ki as bk,BD as bl,Ze as bm,oi as bn,kt as bo,WD as bp,Ha as bq,ui as br,Ve as bs,at as bt,AR as bu,Ro as bv,ve as bw,qe as bx,or as by,Pn as bz,q6 as c,rT as d,PR as e,dN as f,OR as g,iT as h,WB as i,ZM as j,u5 as k,GT as l,a5 as m,$R as n,T1 as o,V6 as p,AT as q,I7 as r,YT as s,qh as t,TT as u,ET as v,XT as w,Tf as x,BT as y,Zc as z};