@spexcode/spec-dashboard 0.6.7 → 0.6.8

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-DANZYsFg.js +2 -0
  2. package/dist/assets/EmptyView-xnSRh3XP.js +1 -0
  3. package/dist/assets/EvalsPage-DDxIUAuR.js +2 -0
  4. package/dist/assets/FileView-DZaiEPRK.js +2 -0
  5. package/dist/assets/GraphStats-CxHsXNy-.js +1 -0
  6. package/dist/assets/GraphView-DHEhg_eI.js +26 -0
  7. package/dist/assets/IssuesPage-B5qjvpP1.js +1 -0
  8. package/dist/assets/MobileApp-fvc4gfCx.js +2 -0
  9. package/dist/assets/NodeView-D6JZc3ap.js +3 -0
  10. package/dist/assets/PageScroll-DE6nL5p-.js +1 -0
  11. package/dist/assets/ProjectsPage-I7XFn8kG.js +1 -0
  12. package/dist/assets/ProseActions-LG4ve4AO.js +7 -0
  13. package/dist/assets/Settings-D7NeDdd1.js +1 -0
  14. package/dist/assets/SpecView-mkyrBxLO.js +1 -0
  15. package/dist/assets/Thread-Cx5fJkFO.js +9 -0
  16. package/dist/assets/WorkspaceSurface-DgbzdTEl.js +2 -0
  17. package/dist/assets/index-B-qrQ2QS.js +40 -0
  18. package/dist/assets/index-RoVUefLX.js +13 -0
  19. package/dist/assets/index-nweIph9V.css +1 -0
  20. package/dist/assets/tabs-Brk4lg7l.css +32 -0
  21. package/dist/assets/tabs-BxFTq-sB.js +334 -0
  22. package/dist/index.html +3 -3
  23. package/dist-public/assets/App-Bz1E7Es7.js +2 -0
  24. package/dist-public/assets/EmptyView-CX3NC0Nq.js +1 -0
  25. package/dist-public/assets/EvalsPage-BBzomD1v.js +2 -0
  26. package/dist-public/assets/FileView-Cf5bY14h.js +2 -0
  27. package/dist-public/assets/GraphStats-CxHsXNy-.js +1 -0
  28. package/dist-public/assets/GraphView-5dgjv4t6.js +26 -0
  29. package/dist-public/assets/IssuesPage-B_knZkH6.js +1 -0
  30. package/dist-public/assets/MobileApp-BpnF0xSz.js +2 -0
  31. package/dist-public/assets/NodeView-cN_xZ1kR.js +3 -0
  32. package/dist-public/assets/PageScroll-CEYT-x2I.js +1 -0
  33. package/dist-public/assets/ProjectsPage-CWaOO-Y7.js +1 -0
  34. package/dist-public/assets/ProseActions-rr5Mm1WB.js +7 -0
  35. package/dist-public/assets/Settings-louVIHfW.js +1 -0
  36. package/dist-public/assets/SpecView-qZMzQH75.js +1 -0
  37. package/dist-public/assets/Thread-Ca_r1oDT.js +9 -0
  38. package/dist-public/assets/WorkspaceSurface-bsUptX-4.js +2 -0
  39. package/dist-public/assets/index-3mcnUCQ1.js +40 -0
  40. package/dist-public/assets/index-BmOx7kVX.js +13 -0
  41. package/dist-public/assets/index-nweIph9V.css +1 -0
  42. package/dist-public/assets/tabs-BL3Okd06.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 +9 -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=["./index-BmOx7kVX.js","./index-3mcnUCQ1.js","./index-nweIph9V.css","./App-Bz1E7Es7.js","./PageScroll-CEYT-x2I.js","./GraphView-5dgjv4t6.js","./NodeView-cN_xZ1kR.js","./Thread-Ca_r1oDT.js","./ProseActions-rr5Mm1WB.js","./GraphStats-CxHsXNy-.js","./GraphView-BnuhLJ6X.css","./SpecView-qZMzQH75.js","./FileView-Cf5bY14h.js","./EvalsPage-BBzomD1v.js","./IssuesPage-B_knZkH6.js","./Settings-louVIHfW.js","./EmptyView-CX3NC0Nq.js"])))=>i.map(i=>d[i]);
2
+ import{v as j5,u as He,r as A,m as gi,j as m,I as Pe,w as H5,x as $5,y as q5,z as W5,A as K5,B as w4,a as yi,k as ji,C as Ko,_ as Js,D as x4,E as V5,F as U5,G as G5,H as Y5,J as X5,O as J5,K as Z5,L as Q5,e as e_,n as t_,M as i_,N as Ju,i as r_,o as vp,Q as s_,R as n_,T as o_}from"./index-3mcnUCQ1.js";import{b as ui,i as a_,r as Ut,n as _n,p as bf,s as bp,f as l_,d as _f,j as u_,k as c_,u as yf,a as S4,l as k4,m as h_,e as wf,c as C4,h as d_}from"./App-Bz1E7Es7.js";import{M as Yn,i as ga,P as Jl}from"./PageScroll-CEYT-x2I.js";const jr=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)},A4=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 E4=Object.defineProperty,f_=Object.getOwnPropertyDescriptor,p_=(t,e)=>{for(var i in e)E4(t,i,{get:e[i],enumerable:!0})},Ct=(t,e,i,r)=>{for(var s=r>1?void 0:r?f_(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&&E4(e,i,s),s},me=(t,e)=>(i,r)=>e(i,r,t),_p="Terminal input",uh={get:()=>_p,set:t=>_p=t},yp="Too much output to announce, navigate to rows manually to read",ch={get:()=>yp,set:t=>yp=t};function m_(t){return t.replace(/\r?\n/g,"\r")}function g_(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function v_(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function b_(t,e,i,r){if(t.stopPropagation(),t.clipboardData){let s=t.clipboardData.getData("text/plain");D4(s,e,i,r)}}function D4(t,e,i,r){t=m_(t),t=g_(t,i.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(t,!0),e.value=""}function M4(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 wp(t,e,i,r,s){M4(t,e,i),s&&r.rightClickSelect(t),e.value=r.selectionText,e.select()}function Ts(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function Zu(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 __=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}},y_=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,b;for(;(b=this.interim[++p]&63)&&p<4;)f<<=6,f|=b;let _=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,x=_-p;for(;u<x;){if(u>=i)return 0;if(b=t[u++],(b&192)!==128){u--,d=!0;break}else this.interim[p++]=b,f<<=6,f|=b&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}},T4="",Is=" ",za=class B4{constructor(){this.fg=0,this.bg=0,this.extended=new gu}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}},gu=class R4{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 R4(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},er=class N4 extends za{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new gu,this.combinedData=""}static fromCharData(e){let i=new N4;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?Ts(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()]}},xp="di$target",hh="di$dependencies",U0=new Map;function w_(t){return t[hh]||[]}function Qt(t){if(U0.has(t))return U0.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");x_(e,i,s)};return e._id=t,U0.set(t,e),e}function x_(t,e,i){e[xp]===e?e[hh].push({id:t,index:i}):(e[hh]=[{id:t,index:i}],e[xp]=e)}var Ci=Qt("BufferService"),L4=Qt("CoreMouseService"),Nn=Qt("CoreService"),S_=Qt("CharsetService"),xf=Qt("InstantiationService"),O4=Qt("LogService"),Ai=Qt("OptionsService"),P4=Qt("OscLinkService"),k_=Qt("UnicodeService"),ja=Qt("DecorationService"),dh=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 er,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 b=new URL(d);["http:","https:"].includes(b.protocol)||(p=!0)}catch{p=!0}p||r.push({text:d,range:f,activate:(b,_)=>s?s.activate(b,_,f):C_(b,_),hover:(b,_)=>{var x;return(x=s==null?void 0:s.hover)==null?void 0:x.call(s,b,_,f)},leave:(b,_)=>{var x;return(x=s==null?void 0:s.leave)==null?void 0:x.call(s,b,_,f)}})}u=!1,n.hasExtendedAttrs()&&n.extended.urlId?(l=h,a=n.extended.urlId):(l=-1,a=-1)}}e(r)}};dh=Ct([me(0,Ci),me(1,Ai),me(2,P4)],dh);function C_(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 Qu=Qt("CharSizeService"),ds=Qt("CoreBrowserService"),Sf=Qt("MouseService"),fs=Qt("RenderService"),A_=Qt("SelectionService"),F4=Qt("CharacterJoinerService"),bo=Qt("ThemeService"),I4=Qt("LinkProviderService"),E_=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?Sp.isErrorNoTelemetry(t)?new Sp(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)}},D_=new E_;function Zl(t){M_(t)||D_.onUnexpectedError(t)}var fh="Canceled";function M_(t){return t instanceof T_?!0:t instanceof Error&&t.name===fh&&t.message===fh}var T_=class extends Error{constructor(){super(fh),this.name=this.message}};function B_(t){return new Error(`Illegal argument: ${t}`)}var Sp=class ph extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof ph)return e;let i=new ph;return i.message=e.message,i.stack=e.stack,i}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},mh=class z4 extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,z4.prototype)}};function Pi(t,e=0){return t[t.length-(1+e)]}var R_;(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})(R_||(R_={}));function N_(t,e){let i=this,r=!1,s;return function(){return r||(r=!0,e||(s=t.apply(i,arguments))),s}}var j4;(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 M=D.length-1;M>=0;M--)yield D[M]}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,M){let C=0;for(let N of D)if(M(N,C++))return!0;return!1}t.some=c;function h(D,M){for(let C of D)if(M(C))return C}t.find=h;function*d(D,M){for(let C of D)M(C)&&(yield C)}t.filter=d;function*f(D,M){let C=0;for(let N of D)yield M(N,C++)}t.map=f;function*p(D,M){let C=0;for(let N of D)yield*M(N,C++)}t.flatMap=p;function*b(...D){for(let M of D)yield*M}t.concat=b;function _(D,M,C){let N=C;for(let W of D)N=M(N,W);return N}t.reduce=_;function*x(D,M,C=D.length){for(M<0&&(M+=D.length),C<0?C+=D.length:C>D.length&&(C=D.length);M<C;M++)yield D[M]}t.slice=x;function S(D,M=Number.POSITIVE_INFINITY){let C=[];if(M===0)return[C,D];let N=D[Symbol.iterator]();for(let W=0;W<M;W++){let q=N.next();if(q.done)return[C,t.empty()];C.push(q.value)}return[C,{[Symbol.iterator](){return N}}]}t.consume=S;async function E(D){let M=[];for await(let C of D)M.push(C);return Promise.resolve(M)}t.asyncToArray=E})(j4||(j4={}));function kn(t){if(j4.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 L_(...t){return pt(()=>kn(t))}function pt(t){return{dispose:N_(()=>{t()})}}var H4=class $4{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{kn(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?$4.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)}};H4.DISABLE_DISPOSED_WARNING=!1;var $s=H4,Ie=class{constructor(){this._store=new $s,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)}};Ie.None=Object.freeze({dispose(){}});var ro=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}},rs=typeof window=="object"?window:globalThis,gh=class vh{constructor(e){this.element=e,this.next=vh.Undefined,this.prev=vh.Undefined}};gh.Undefined=new gh(void 0);var bt=gh,kp=class{constructor(){this._first=bt.Undefined,this._last=bt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===bt.Undefined}clear(){let t=this._first;for(;t!==bt.Undefined;){let e=t.next;t.prev=bt.Undefined,t.next=bt.Undefined,t=e}this._first=bt.Undefined,this._last=bt.Undefined,this._size=0}unshift(t){return this._insert(t,!1)}push(t){return this._insert(t,!0)}_insert(t,e){let i=new bt(t);if(this._first===bt.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!==bt.Undefined){let t=this._first.element;return this._remove(this._first),t}}pop(){if(this._last!==bt.Undefined){let t=this._last.element;return this._remove(this._last),t}}_remove(t){if(t.prev!==bt.Undefined&&t.next!==bt.Undefined){let e=t.prev;e.next=t.next,t.next.prev=e}else t.prev===bt.Undefined&&t.next===bt.Undefined?(this._first=bt.Undefined,this._last=bt.Undefined):t.next===bt.Undefined?(this._last=this._last.prev,this._last.next=bt.Undefined):t.prev===bt.Undefined&&(this._first=this._first.next,this._first.prev=bt.Undefined);this._size-=1}*[Symbol.iterator](){let t=this._first;for(;t!==bt.Undefined;)yield t.element,t=t.next}},O_=globalThis.performance&&typeof globalThis.performance.now=="function",P_=class q4{static create(e){return new q4(e)}constructor(e){this._now=O_&&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}},ri;(t=>{t.None=()=>Ie.None;function e(I,z){return h(I,()=>{},0,void 0,!0,void 0,z)}t.defer=e;function i(I){return(z,P=null,j)=>{let O=!1,G;return G=I($=>{if(!O)return G?G.dispose():O=!0,z.call(P,$)},null,j),O&&G.dispose(),G}}t.once=i;function r(I,z,P){return u((j,O=null,G)=>I($=>j.call(O,z($)),null,G),P)}t.map=r;function s(I,z,P){return u((j,O=null,G)=>I($=>{z($),j.call(O,$)},null,G),P)}t.forEach=s;function n(I,z,P){return u((j,O=null,G)=>I($=>z($)&&j.call(O,$),null,G),P)}t.filter=n;function o(I){return I}t.signal=o;function a(...I){return(z,P=null,j)=>{let O=L_(...I.map(G=>G($=>z.call(P,$))));return c(O,j)}}t.any=a;function l(I,z,P,j){let O=P;return r(I,G=>(O=z(O,G),O),j)}t.reduce=l;function u(I,z){let P,j={onWillAddFirstListener(){P=I(O.fire,O)},onDidRemoveLastListener(){P==null||P.dispose()}},O=new ae(j);return z==null||z.add(O),O.event}function c(I,z){return z instanceof Array?z.push(I):z&&z.add(I),I}function h(I,z,P=100,j=!1,O=!1,G,$){let ue,Y,X,he=0,H,ne={leakWarningThreshold:G,onWillAddFirstListener(){ue=I(ce=>{he++,Y=z(Y,ce),j&&!X&&(pe.fire(Y),Y=void 0),H=()=>{let ie=Y;Y=void 0,X=void 0,(!j||he>1)&&pe.fire(ie),he=0},typeof P=="number"?(clearTimeout(X),X=setTimeout(H,P)):X===void 0&&(X=0,queueMicrotask(H))})},onWillRemoveListener(){O&&he>0&&(H==null||H())},onDidRemoveLastListener(){H=void 0,ue.dispose()}},pe=new ae(ne);return $==null||$.add(pe),pe.event}t.debounce=h;function d(I,z=0,P){return t.debounce(I,(j,O)=>j?(j.push(O),j):[O],z,void 0,!0,void 0,P)}t.accumulate=d;function f(I,z=(j,O)=>j===O,P){let j=!0,O;return n(I,G=>{let $=j||!z(G,O);return j=!1,O=G,$},P)}t.latch=f;function p(I,z,P){return[t.filter(I,z,P),t.filter(I,j=>!z(j),P)]}t.split=p;function b(I,z=!1,P=[],j){let O=P.slice(),G=I(Y=>{O?O.push(Y):ue.fire(Y)});j&&j.add(G);let $=()=>{O==null||O.forEach(Y=>ue.fire(Y)),O=null},ue=new ae({onWillAddFirstListener(){G||(G=I(Y=>ue.fire(Y)),j&&j.add(G))},onDidAddFirstListener(){O&&(z?setTimeout($):$())},onDidRemoveLastListener(){G&&G.dispose(),G=null}});return j&&j.add(ue),ue.event}t.buffer=b;function _(I,z){return(P,j,O)=>{let G=z(new S);return I(function($){let ue=G.evaluate($);ue!==x&&P.call(j,ue)},void 0,O)}}t.chain=_;let x=Symbol("HaltChainable");class S{constructor(){this.steps=[]}map(z){return this.steps.push(z),this}forEach(z){return this.steps.push(P=>(z(P),P)),this}filter(z){return this.steps.push(P=>z(P)?P:x),this}reduce(z,P){let j=P;return this.steps.push(O=>(j=z(j,O),j)),this}latch(z=(P,j)=>P===j){let P=!0,j;return this.steps.push(O=>{let G=P||!z(O,j);return P=!1,j=O,G?O:x}),this}evaluate(z){for(let P of this.steps)if(z=P(z),z===x)break;return z}}function E(I,z,P=j=>j){let j=(...ue)=>$.fire(P(...ue)),O=()=>I.on(z,j),G=()=>I.removeListener(z,j),$=new ae({onWillAddFirstListener:O,onDidRemoveLastListener:G});return $.event}t.fromNodeEventEmitter=E;function D(I,z,P=j=>j){let j=(...ue)=>$.fire(P(...ue)),O=()=>I.addEventListener(z,j),G=()=>I.removeEventListener(z,j),$=new ae({onWillAddFirstListener:O,onDidRemoveLastListener:G});return $.event}t.fromDOMEventEmitter=D;function M(I){return new Promise(z=>i(I)(z))}t.toPromise=M;function C(I){let z=new ae;return I.then(P=>{z.fire(P)},()=>{z.fire(void 0)}).finally(()=>{z.dispose()}),z.event}t.fromPromise=C;function N(I,z){return I(P=>z.fire(P))}t.forward=N;function W(I,z,P){return z(P),I(j=>z(j))}t.runAndSubscribe=W;class q{constructor(z,P){this._observable=z,this._counter=0,this._hasChanged=!1;let j={onWillAddFirstListener:()=>{z.addObserver(this)},onDidRemoveLastListener:()=>{z.removeObserver(this)}};this.emitter=new ae(j),P&&P.add(this.emitter)}beginUpdate(z){this._counter++}handlePossibleChange(z){}handleChange(z,P){this._hasChanged=!0}endUpdate(z){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function K(I,z){return new q(I,z).emitter.event}t.fromObservable=K;function V(I){return(z,P,j)=>{let O=0,G=!1,$={beginUpdate(){O++},endUpdate(){O--,O===0&&(I.reportChanges(),G&&(G=!1,z.call(P)))},handlePossibleChange(){},handleChange(){G=!0}};I.addObserver($),I.reportChanges();let ue={dispose(){I.removeObserver($)}};return j instanceof $s?j.add(ue):Array.isArray(j)&&j.push(ue),ue}}t.fromObservableLight=V})(ri||(ri={}));var bh=class _h{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${_h._idPool++}`,_h.all.add(this)}start(e){this._stopWatch=new P_,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}}};bh.all=new Set,bh._idPool=0;var F_=bh,I_=-1,W4=class K4{constructor(e,i,r=(K4._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 H_(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}};W4._idPool=1;var z_=W4,j_=class V4{constructor(e){this.value=e}static create(){let e=new Error;return new V4(e.stack??"")}print(){console.warn(this.value.split(`
20
+ `).slice(2).join(`
21
+ `))}},H_=class extends Error{constructor(t,e){super(t),this.name="ListenerLeakError",this.stack=e}},$_=class extends Error{constructor(t,e){super(t),this.name="ListenerRefusalError",this.stack=e}},q_=0,G0=class{constructor(t){this.value=t,this.id=q_++}},W_=2,K_,ae=class{constructor(t){var e,i,r,s;this._size=0,this._options=t,this._leakageMon=(e=this._options)!=null&&e.leakWarningThreshold?new z_((t==null?void 0:t.onListenerError)??Zl,((i=this._options)==null?void 0:i.leakWarningThreshold)??I_):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new F_(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 $_(`${h}. HINT: Stack shows most frequent listener (${d[1]}-times)`,d[0]);return(((o=this._options)==null?void 0:o.onListenerError)||Zl)(f),Ie.None}if(this._disposed)return Ie.None;e&&(t=t.bind(e));let r=new G0(t),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=j_.create(),s=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof G0?(this._deliveryQueue??(this._deliveryQueue=new V_),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=pt(()=>{s==null||s(),this._removeListener(r)});return i instanceof $s?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*W_<=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)||Zl;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 G0)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}},V_=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}},yh=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ae,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ae,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}};yh.INSTANCE=new yh;var kf=yh;function U_(t,e,i){typeof e=="string"&&(e=t.matchMedia(e)),e.addEventListener("change",i)}kf.INSTANCE.onDidChangeZoomLevel;function G_(t){return kf.INSTANCE.getZoomFactor(t)}kf.INSTANCE.onDidChangeFullscreen;var _o=typeof navigator=="object"?navigator.userAgent:"",wh=_o.indexOf("Firefox")>=0,Y_=_o.indexOf("AppleWebKit")>=0,Cf=_o.indexOf("Chrome")>=0,X_=!Cf&&_o.indexOf("Safari")>=0;_o.indexOf("Electron/")>=0;_o.indexOf("Android")>=0;var Y0=!1;if(typeof rs.matchMedia=="function"){let t=rs.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=rs.matchMedia("(display-mode: fullscreen)");Y0=t.matches,U_(rs,t,({matches:i})=>{Y0&&e.matches||(Y0=i)})}var qn="en",xh=!1,Sh=!1,Ql=!1,U4=!1,al,eu=qn,Cp=qn,J_,nr,yn=globalThis,ti,b4;typeof yn.vscode<"u"&&typeof yn.vscode.process<"u"?ti=yn.vscode.process:typeof process<"u"&&typeof((b4=process==null?void 0:process.versions)==null?void 0:b4.node)=="string"&&(ti=process);var _4,Z_=typeof((_4=ti==null?void 0:ti.versions)==null?void 0:_4.electron)=="string",Q_=Z_&&(ti==null?void 0:ti.type)==="renderer",y4;if(typeof ti=="object"){xh=ti.platform==="win32",Sh=ti.platform==="darwin",Ql=ti.platform==="linux",Ql&&ti.env.SNAP&&ti.env.SNAP_REVISION,ti.env.CI||ti.env.BUILD_ARTIFACTSTAGINGDIRECTORY,al=qn,eu=qn;let t=ti.env.VSCODE_NLS_CONFIG;if(t)try{let e=JSON.parse(t);al=e.userLocale,Cp=e.osLocale,eu=e.resolvedLanguage||qn,J_=(y4=e.languagePack)==null?void 0:y4.translationsConfigFile}catch{}U4=!0}else typeof navigator=="object"&&!Q_?(nr=navigator.userAgent,xh=nr.indexOf("Windows")>=0,Sh=nr.indexOf("Macintosh")>=0,(nr.indexOf("Macintosh")>=0||nr.indexOf("iPad")>=0||nr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Ql=nr.indexOf("Linux")>=0,(nr==null?void 0:nr.indexOf("Mobi"))>=0,eu=globalThis._VSCODE_NLS_LANGUAGE||qn,al=navigator.language.toLowerCase(),Cp=al):console.error("Unable to resolve platform.");var G4=xh,zr=Sh,e8=Ql,Ap=U4,Hr=nr,Cs=eu,t8;(t=>{function e(){return Cs}t.value=e;function i(){return Cs.length===2?Cs==="en":Cs.length>=3?Cs[0]==="e"&&Cs[1]==="n"&&Cs[2]==="-":!1}t.isDefaultVariant=i;function r(){return Cs==="en"}t.isDefault=r})(t8||(t8={}));var i8=typeof yn.postMessage=="function"&&!yn.importScripts;(()=>{if(i8){let t=[];yn.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}),yn.postMessage({vscodeScheduleAsyncWork:r},"*")}}return t=>setTimeout(t)})();var r8=!!(Hr&&Hr.indexOf("Chrome")>=0);Hr&&Hr.indexOf("Firefox")>=0;!r8&&Hr&&Hr.indexOf("Safari")>=0;Hr&&Hr.indexOf("Edg/")>=0;Hr&&Hr.indexOf("Android")>=0;var In=typeof navigator=="object"?navigator:{};Ap||document.queryCommandSupported&&document.queryCommandSupported("copy")||In&&In.clipboard&&In.clipboard.writeText,Ap||In&&In.clipboard&&In.clipboard.readText;var Af=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}},X0=new Af,Ep=new Af,Dp=new Af,s8=new Array(230),Y4;(t=>{function e(a){return X0.keyCodeToStr(a)}t.toString=e;function i(a){return X0.strToKeyCode(a)}t.fromString=i;function r(a){return Ep.keyCodeToStr(a)}t.toUserSettingsUS=r;function s(a){return Dp.keyCodeToStr(a)}t.toUserSettingsGeneral=s;function n(a){return Ep.strToKeyCode(a)||Dp.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 X0.keyCodeToStr(a)}t.toElectronAccelerator=o})(Y4||(Y4={}));var n8=class X4{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 X4&&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 o8([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},o8=class{constructor(t){if(t.length===0)throw B_("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 a8(t){if(t.charCode){let i=String.fromCharCode(t.charCode).toUpperCase();return Y4.fromString(i)}let e=t.keyCode;if(e===3)return 7;if(wh)switch(e){case 59:return 85;case 60:if(e8)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(zr)return 57;break}else if(Y_&&(zr&&e===93||!zr&&e===92))return 57;return s8[e]||0}var l8=zr?256:2048,u8=512,c8=1024,h8=zr?2048:256,Mp=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=a8(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|=l8),this.altKey&&(e|=u8),this.shiftKey&&(e|=c8),this.metaKey&&(e|=h8),e|=t,e}_computeKeyCodeChord(){let t=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(t=this.keyCode),new n8(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,t)}},Tp=new WeakMap;function d8(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 f8=class{static getSameOriginWindowChain(t){let e=Tp.get(t);if(!e){e=[],Tp.set(t,e);let i=t,r;do r=d8(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}}},ll=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=f8.getPositionOfChildWindowRelativeToAncestorWindow(t,e.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Bp=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(Cf){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?wh&&!zr?this.deltaY=-t.deltaY/3:this.deltaY=-t.deltaY:this.deltaY=-t.deltaY/40}if(typeof n.wheelDeltaX<"u")X_&&G4?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?wh&&!zr?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()}},J4=Object.freeze(function(t,e){let i=setTimeout(t.bind(e),0);return{dispose(){clearTimeout(i)}}}),p8;(t=>{function e(i){return i===t.None||i===t.Cancelled||i instanceof m8?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}t.isCancellationToken=e,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ri.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:J4})})(p8||(p8={}));var m8=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?J4:(this._emitter||(this._emitter=new ae),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Ef=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 mh("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,t()},e)}setIfNotSet(t,e){if(this._isDisposed)throw new mh("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,t()},e))}},g8=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 mh("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=i.setInterval(()=>{t()},e);this.disposable=pt(()=>{i.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},v8;(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})(v8||(v8={}));var Rp=class Yi{static fromArray(e){return new Yi(i=>{i.emitMany(e)})}static fromPromise(e){return new Yi(async i=>{i.emitMany(await e)})}static fromPromises(e){return new Yi(async i=>{await Promise.all(e.map(async r=>i.emitOne(await r)))})}static merge(e){return new Yi(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 ae,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 ri.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 Yi(async r=>{for await(let s of e)r.emitOne(i(s))})}map(e){return Yi.map(this,e)}static filter(e,i){return new Yi(async r=>{for await(let s of e)i(s)&&r.emitOne(s)})}filter(e){return Yi.filter(this,e)}static coalesce(e){return Yi.filter(e,i=>!!i)}coalesce(){return Yi.coalesce(this)}static async toPromise(e){let i=[];for await(let r of e)i.push(r);return i}toPromise(){return Yi.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())}};Rp.EMPTY=Rp.fromArray([]);var{getWindow:Tr,getWindowId:b8,onDidRegisterWindow:_8}=function(){let t=new Map,e={window:rs,disposables:new $s};t.set(rs.vscodeWindowId,e);let i=new ae,r=new ae,s=new ae;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 Ie.None;let a=new $s,l={window:o,disposables:a.add(new $s)};return t.set(o.vscodeWindowId,l),a.add(pt(()=>{t.delete(o.vscodeWindowId),r.fire(o)})),a.add(Te(o,Gt.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:rs},getDocument(o){return Tr(o).document}}}(),y8=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 y8(t,e,i,r)}var Np=function(t,e,i,r){return Te(t,e,i,r)},Df,w8=class extends g8{constructor(t){super(),this.defaultTarget=t&&Tr(t)}cancelAndSet(t,e,i){return super.cancelAndSet(t,e,i??this.defaultTarget)}},Lp=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){Zl(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(Lp.sort),o.shift().execute();r.set(n,!1)};Df=(n,o,a=0)=>{let l=b8(n),u=new Lp(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 x8(t){let e=t.getBoundingClientRect(),i=Tr(t);return{left:e.left+i.scrollX,top:e.top+i.scrollY,width:e.width,height:e.height}}var Gt={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"},S8=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=Di(t);this._maxWidth!==e&&(this._maxWidth=e,this.domNode.style.maxWidth=this._maxWidth)}setWidth(t){let e=Di(t);this._width!==e&&(this._width=e,this.domNode.style.width=this._width)}setHeight(t){let e=Di(t);this._height!==e&&(this._height=e,this.domNode.style.height=this._height)}setTop(t){let e=Di(t);this._top!==e&&(this._top=e,this.domNode.style.top=this._top)}setLeft(t){let e=Di(t);this._left!==e&&(this._left=e,this.domNode.style.left=this._left)}setBottom(t){let e=Di(t);this._bottom!==e&&(this._bottom=e,this.domNode.style.bottom=this._bottom)}setRight(t){let e=Di(t);this._right!==e&&(this._right=e,this.domNode.style.right=this._right)}setPaddingTop(t){let e=Di(t);this._paddingTop!==e&&(this._paddingTop=e,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(t){let e=Di(t);this._paddingLeft!==e&&(this._paddingLeft=e,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(t){let e=Di(t);this._paddingBottom!==e&&(this._paddingBottom=e,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(t){let e=Di(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=Di(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=Di(t);this._lineHeight!==e&&(this._lineHeight=e,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(t){let e=Di(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 Di(t){return typeof t=="number"?`${t}px`:t}function oa(t){return new S8(t)}var Z4=class{constructor(){this._hooks=new $s,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(pt(()=>{try{t.releasePointerCapture(e)}catch{}}))}catch{n=Tr(t)}this._hooks.add(Te(n,Gt.POINTER_MOVE,o=>{if(o.buttons!==i){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(Te(n,Gt.POINTER_UP,o=>this.stopMonitoring(!0)))}};function k8(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 kr;(t=>(t.Tap="-xterm-gesturetap",t.Change="-xterm-gesturechange",t.Start="-xterm-gesturestart",t.End="-xterm-gesturesend",t.Contextmenu="-xterm-gesturecontextmenu"))(kr||(kr={}));var Vo=class ai extends Ie{constructor(){super(),this.dispatched=!1,this.targets=new kp,this.ignoreTargets=new kp,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(ri.runAndSubscribe(_8,({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:rs,disposables:this._store}))}static addTarget(e){if(!ai.isTouchDevice())return Ie.None;ai.INSTANCE||(ai.INSTANCE=new ai);let i=ai.INSTANCE.targets.push(e);return pt(i)}static ignoreTarget(e){if(!ai.isTouchDevice())return Ie.None;ai.INSTANCE||(ai.INSTANCE=new ai);let i=ai.INSTANCE.ignoreTargets.push(e);return pt(i)}static isTouchDevice(){return"ontouchstart"in rs||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(kr.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(kr.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(kr.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],b=[...this.targets].filter(_=>l.initialTarget instanceof Node&&_.contains(l.initialTarget));this.inertia(e,b,r,Math.abs(f)/d,f>0?1:-1,c,Math.abs(p)/d,p>0?1:-1,h)}this.dispatchEvent(this.newGestureEvent(kr.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===kr.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===kr.Change||e.type===kr.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=Df(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 b=this.newGestureEvent(kr.Change);b.translationX=d,b.translationY=f,i.forEach(_=>_.dispatchEvent(b)),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(kr.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)}};Vo.SCROLL_FRICTION=-.005,Vo.HOLD_DELAY=700,Vo.CLEAR_TAP_COUNT_TIME=400,Ct([k8],Vo,"isTouchDevice",1);var C8=Vo,Mf=class extends Ie{onclick(t,e){this._register(Te(t,Gt.CLICK,i=>e(new ll(Tr(t),i))))}onmousedown(t,e){this._register(Te(t,Gt.MOUSE_DOWN,i=>e(new ll(Tr(t),i))))}onmouseover(t,e){this._register(Te(t,Gt.MOUSE_OVER,i=>e(new ll(Tr(t),i))))}onmouseleave(t,e){this._register(Te(t,Gt.MOUSE_LEAVE,i=>e(new ll(Tr(t),i))))}onkeydown(t,e){this._register(Te(t,Gt.KEY_DOWN,i=>e(new Mp(i))))}onkeyup(t,e){this._register(Te(t,Gt.KEY_UP,i=>e(new Mp(i))))}oninput(t,e){this._register(Te(t,Gt.INPUT,e))}onblur(t,e){this._register(Te(t,Gt.BLUR,e))}onfocus(t,e){this._register(Te(t,Gt.FOCUS,e))}onchange(t,e){this._register(Te(t,Gt.CHANGE,e))}ignoreGesture(t){return C8.ignoreTarget(t)}},Op=11,A8=class extends Mf{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=Op+"px",this.domNode.style.height=Op+"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(Np(this.bgDomNode,Gt.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(Np(this.domNode,Gt.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new w8),this._pointerdownScheduleRepeatTimer=this._register(new Ef)}_arrowPointerDown(t){if(!t.target||!(t.target instanceof Element))return;let e=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Tr(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()}},E8=class kh{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 kh(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 kh(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}}},D8=class extends Ie{constructor(t){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ae),this.onScroll=this._onScroll.event,this._smoothScrollDuration=t.smoothScrollDuration,this._scheduleAtNextAnimationFrame=t.scheduleAtNextAnimationFrame,this._state=new E8(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 Fp(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=Fp.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 J0(t,e){let i=e-t;return function(r){return t+i*B8(r)}}function M8(t,e,i){return function(r){return r<i?t(r/i):e((r-i)/(1-i))}}var Fp=class Ch{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),M8(J0(e,s),J0(n,i),.33)}return J0(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 Ch.start(e,i,r)}static start(e,i,r){r=r+10;let s=Date.now()-10;return new Ch(e,i,s,r)}};function T8(t){return Math.pow(t,3)}function B8(t){return 1-T8(1-t)}var R8=class extends Ie{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 Ef)}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":"")))}},N8=140,Q4=class extends Mf{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 R8(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=oa(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,Gt.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(t){let e=this._register(new A8(t));this.domNode.domNode.appendChild(e.bgDomNode),this.domNode.domNode.appendChild(e.domNode)}_createSlider(t,e,i,r){this.slider=oa(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,Gt.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=x8(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(G4&&o>N8){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()}},e3=class Ah{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 Ah(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=Ah._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)}},L8=class extends Q4{constructor(t,e,i){let r=t.getScrollDimensions(),s=t.getCurrentScrollPosition();if(super({lazyRender:e.lazyRender,host:i,scrollbarState:new e3(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}},O8=class extends Q4{constructor(t,e,i){let r=t.getScrollDimensions(),s=t.getCurrentScrollPosition();if(super({lazyRender:e.lazyRender,host:i,scrollbarState:new e3(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}},P8=500,Ip=50,F8=class{constructor(t,e,i){this.timestamp=t,this.deltaX=e,this.deltaY=i,this.score=0}},Eh=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(Cf){let i=Tr(e.browserEvent),r=G_(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 F8(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}};Eh.INSTANCE=new Eh;var I8=Eh,z8=class extends Mf{constructor(t,e,i){super(),this._onScroll=this._register(new ae),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ae),this.onWillScroll=this._onWillScroll.event,this._options=H8(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 O8(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new L8(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=oa(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=oa(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=oa(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 Ef),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=kn(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,zr&&(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 Bp(t))}_setListeningToMouseWheel(t){if(this._mouseWheelToDispose.length>0!==t&&(this._mouseWheelToDispose=kn(this._mouseWheelToDispose),t)){let e=i=>{this._onMouseWheel(new Bp(i))};this._mouseWheelToDispose.push(Te(this._listenOnDomNode,Gt.MOUSE_WHEEL,e,{passive:!1}))}}_onMouseWheel(t){var s;if((s=t.browserEvent)!=null&&s.defaultPrevented)return;let e=I8.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=!zr&&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=Ip*n,h=l.scrollTop-(c<0?Math.floor(c):Math.ceil(c));this._verticalScrollbar.writeScrollPosition(u,h)}if(o){let c=Ip*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(),P8)}},j8=class extends z8{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 H8(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,zr&&(e.className+=" mac"),e}var Dh=class extends Ie{constructor(t,e,i,r,s,n,o,a){super(),this._bufferService=i,this._optionsService=o,this._renderService=a,this._onRequestScrollLines=this._register(new ae),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let l=this._register(new D8({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:u=>Df(r.window,u)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{l.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new j8(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(ri.runAndSubscribe(n.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=n.colors.background.css})),t.appendChild(this._scrollableElement.getDomNode()),this._register(pt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),e.appendChild(this._styleElement),this._register(pt(()=>this._styleElement.remove())),this._register(ri.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}};Dh=Ct([me(2,Ci),me(3,ds),me(4,L4),me(5,bo),me(6,Ai),me(7,fs)],Dh);var Mh=class extends Ie{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(pt(()=>{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()}};Mh=Ct([me(1,Ci),me(2,ds),me(3,ja),me(4,fs)],Mh);var $8=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)}},_r={full:0,left:0,center:0,right:0},As={full:0,left:0,center:0,right:0},No={full:0,left:0,center:0,right:0},vu=class extends Ie{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 $8,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(pt(()=>{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);As.full=this._canvas.width,As.left=t,As.center=e,As.right=t,this._refreshDrawHeightConstants(),No.full=1,No.left=1,No.center=1+As.left,No.right=1+As.left+As.center}_refreshDrawHeightConstants(){_r.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);_r.left=e,_r.center=e,_r.right=e}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_r.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_r.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_r.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*_r.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(No[t.position||"full"],Math.round((this._canvas.height-1)*(t.startBufferLine/this._bufferService.buffers.active.lines.length)-_r[t.position||"full"]/2),As[t.position||"full"],Math.round((this._canvas.height-1)*((t.endBufferLine-t.startBufferLine)/this._bufferService.buffers.active.lines.length)+_r[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}))}};vu=Ct([me(2,Ci),me(3,ja),me(4,fs),me(5,Ai),me(6,bo),me(7,ds)],vu);var U;(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=""))(U||(U={}));var tu;(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="Ÿ"))(tu||(tu={}));var t3;(t=>t.ST=`${U.ESC}\\`)(t3||(t3={}));var Th=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(`${U.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)}}};Th=Ct([me(2,Ci),me(3,Ai),me(4,Nn),me(5,fs)],Th);var Yt=0,Xt=0,Jt=0,St=0,zp={css:"#00000000",rgba:0},Rt;(t=>{function e(s,n,o,a){return a!==void 0?`#${rn(s)}${rn(n)}${rn(o)}${rn(a)}`:`#${rn(s)}${rn(n)}${rn(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})(Rt||(Rt={}));var ut;(t=>{function e(l,u){if(St=(u.rgba&255)/255,St===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,b=l.rgba>>8&255;Yt=f+Math.round((c-f)*St),Xt=p+Math.round((h-p)*St),Jt=b+Math.round((d-b)*St);let _=Rt.toCss(Yt,Xt,Jt),x=Rt.toRgba(Yt,Xt,Jt);return{css:_,rgba:x}}t.blend=e;function i(l){return(l.rgba&255)===255}t.isOpaque=i;function r(l,u,c){let h=iu.ensureContrastRatio(l.rgba,u.rgba,c);if(h)return Rt.toColor(h>>24&255,h>>16&255,h>>8&255)}t.ensureContrastRatio=r;function s(l){let u=(l.rgba|255)>>>0;return[Yt,Xt,Jt]=iu.toChannels(u),{css:Rt.toCss(Yt,Xt,Jt),rgba:u}}t.opaque=s;function n(l,u){return St=Math.round(u*255),[Yt,Xt,Jt]=iu.toChannels(l.rgba),{css:Rt.toCss(Yt,Xt,Jt,St),rgba:Rt.toRgba(Yt,Xt,Jt,St)}}t.opacity=n;function o(l,u){return St=l.rgba&255,n(l,St*u/255)}t.multiplyOpacity=o;function a(l){return[l.rgba>>24&255,l.rgba>>16&255,l.rgba>>8&255]}t.toColorRGB=a})(ut||(ut={}));var yt;(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 Yt=parseInt(s.slice(1,2).repeat(2),16),Xt=parseInt(s.slice(2,3).repeat(2),16),Jt=parseInt(s.slice(3,4).repeat(2),16),Rt.toColor(Yt,Xt,Jt);case 5:return Yt=parseInt(s.slice(1,2).repeat(2),16),Xt=parseInt(s.slice(2,3).repeat(2),16),Jt=parseInt(s.slice(3,4).repeat(2),16),St=parseInt(s.slice(4,5).repeat(2),16),Rt.toColor(Yt,Xt,Jt,St);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 Yt=parseInt(n[1]),Xt=parseInt(n[2]),Jt=parseInt(n[3]),St=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Rt.toColor(Yt,Xt,Jt,St);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),[Yt,Xt,Jt,St]=e.getImageData(0,0,1,1).data,St!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Rt.toRgba(Yt,Xt,Jt,St),css:s}}t.toColor=r})(yt||(yt={}));var mi;(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})(mi||(mi={}));var iu;(t=>{function e(o,a){if(St=(a&255)/255,St===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 Yt=h+Math.round((l-h)*St),Xt=d+Math.round((u-d)*St),Jt=f+Math.round((c-f)*St),Rt.toRgba(Yt,Xt,Jt)}t.blend=e;function i(o,a,l){let u=mi.relativeLuminance(o>>8),c=mi.relativeLuminance(a>>8);if(Jr(u,c)<l){if(c<u){let f=r(o,a,l),p=Jr(u,mi.relativeLuminance(f>>8));if(p<l){let b=s(o,a,l),_=Jr(u,mi.relativeLuminance(b>>8));return p>_?f:b}return f}let h=s(o,a,l),d=Jr(u,mi.relativeLuminance(h>>8));if(d<l){let f=r(o,a,l),p=Jr(u,mi.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,b=Jr(mi.relativeLuminance2(d,f,p),mi.relativeLuminance2(u,c,h));for(;b<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)),b=Jr(mi.relativeLuminance2(d,f,p),mi.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,b=Jr(mi.relativeLuminance2(d,f,p),mi.relativeLuminance2(u,c,h));for(;b<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)),b=Jr(mi.relativeLuminance2(d,f,p),mi.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})(iu||(iu={}));function rn(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 q8=class extends za{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()]}},bu=class{constructor(t){this._bufferService=t,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new er}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||Is.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++)bu._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||Is.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}};bu=Ct([me(0,Ci)],bu);function W8(t){return 57508<=t&&t<=57558}function K8(t){return 9472<=t&&t<=9631}function V8(t){return W8(t)||K8(t)}function U8(){return{css:{canvas:ul(),cell:ul()},device:{canvas:ul(),cell:ul(),char:{width:0,height:0,left:0,top:0}}}}function ul(){return{width:0,height:0}}var Bh=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 er,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 b,_=0,x="",S=0,E=0,D=0,M=0,C=!1,N=0,W=!1,q=0,K=0,V=[],I=u!==-1&&c!==-1;for(let z=0;z<p;z++){t.loadCell(z,this._workCell);let P=this._workCell.getWidth();if(P===0)continue;let j=!1,O=z>=K,G=z,$=this._workCell;if(d.length>0&&z===d[0][0]&&O){let Re=d.shift(),Kt=this._isCellInSelection(Re[0],e);for(S=Re[0]+1;S<Re[1];S++)O&&(O=Kt===this._isCellInSelection(S,e));O&&(O=!i||n<Re[0]||n>=Re[1]),O?(j=!0,$=new q8(this._workCell,t.translateToString(!0,Re[0],Re[1]),Re[1]-Re[0]),G=Re[1]-1,P=$.getWidth()):K=Re[1]}let ue=this._isCellInSelection(z,e),Y=i&&z===n,X=I&&z>=u&&z<=c,he=!1;this._decorationService.forEachDecorationAtCell(z,e,void 0,Re=>{he=!0});let H=$.getChars()||Is;if(H===" "&&($.isUnderline()||$.isOverline())&&(H=" "),q=P*a-l.get(H,$.isBold(),$.isItalic()),!b)b=this._document.createElement("span");else if(_&&(ue&&W||!ue&&!W&&$.bg===E)&&(ue&&W&&f.selectionForeground||$.fg===D)&&$.extended.ext===M&&X===C&&q===N&&!Y&&!j&&!he&&O){$.isInvisible()?x+=Is:x+=H,b.style.width=`${parseFloat(b.style.width)+P*a}px`,_++;continue}else _&&(b.textContent=x),b=this._document.createElement("span"),_=0,x="";if(E=$.bg,D=$.fg,M=$.extended.ext,C=X,N=q,W=ue,j&&n>=z&&n<=G&&(n=z),!this._coreService.isCursorHidden&&Y&&this._coreService.isCursorInitialized){if(V.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&V.push("xterm-cursor-blink"),V.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":V.push("xterm-cursor-outline");break;case"block":V.push("xterm-cursor-block");break;case"bar":V.push("xterm-cursor-bar");break;case"underline":V.push("xterm-cursor-underline");break}}if($.isBold()&&V.push("xterm-bold"),$.isItalic()&&V.push("xterm-italic"),$.isDim()&&V.push("xterm-dim"),$.isInvisible()?x=Is:x=$.getChars()||Is,$.isUnderline()&&(V.push(`xterm-underline-${$.extended.underlineStyle}`),x===" "&&(x=" "),!$.isUnderlineColorDefault()))if($.isUnderlineColorRGB())b.style.textDecorationColor=`rgb(${za.toColorRGB($.getUnderlineColor()).join(",")})`;else{let Re=$.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&$.isBold()&&Re<8&&(Re+=8),b.style.textDecorationColor=f.ansi[Re].css}$.isOverline()&&(V.push("xterm-overline"),x===" "&&(x=" ")),$.isStrikethrough()&&V.push("xterm-strikethrough"),X&&(b.style.textDecoration="underline");let ne=$.getFgColor(),pe=$.getFgColorMode(),ce=$.getBgColor(),ie=$.getBgColorMode(),_e=!!$.isInverse();if(_e){let Re=ne;ne=ce,ce=Re;let Kt=pe;pe=ie,ie=Kt}let qe,nt,Wt=!1;this._decorationService.forEachDecorationAtCell(z,e,void 0,Re=>{Re.options.layer!=="top"&&Wt||(Re.backgroundColorRGB&&(ie=50331648,ce=Re.backgroundColorRGB.rgba>>8&16777215,qe=Re.backgroundColorRGB),Re.foregroundColorRGB&&(pe=50331648,ne=Re.foregroundColorRGB.rgba>>8&16777215,nt=Re.foregroundColorRGB),Wt=Re.options.layer==="top")}),!Wt&&ue&&(qe=this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque,ce=qe.rgba>>8&16777215,ie=50331648,Wt=!0,f.selectionForeground&&(pe=50331648,ne=f.selectionForeground.rgba>>8&16777215,nt=f.selectionForeground)),Wt&&V.push("xterm-decoration-top");let Mt;switch(ie){case 16777216:case 33554432:Mt=f.ansi[ce],V.push(`xterm-bg-${ce}`);break;case 50331648:Mt=Rt.toColor(ce>>16,ce>>8&255,ce&255),this._addStyle(b,`background-color:#${jp((ce>>>0).toString(16),"0",6)}`);break;case 0:default:_e?(Mt=f.foreground,V.push("xterm-bg-257")):Mt=f.background}switch(qe||$.isDim()&&(qe=ut.multiplyOpacity(Mt,.5)),pe){case 16777216:case 33554432:$.isBold()&&ne<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ne+=8),this._applyMinimumContrast(b,Mt,f.ansi[ne],$,qe,void 0)||V.push(`xterm-fg-${ne}`);break;case 50331648:let Re=Rt.toColor(ne>>16&255,ne>>8&255,ne&255);this._applyMinimumContrast(b,Mt,Re,$,qe,nt)||this._addStyle(b,`color:#${jp(ne.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(b,Mt,f.foreground,$,qe,nt)||_e&&V.push("xterm-fg-257")}V.length&&(b.className=V.join(" "),V.length=0),!Y&&!j&&!he&&O?_++:b.textContent=x,q!==this.defaultSpacing&&(b.style.letterSpacing=`${q}px`),b.style.display="inline-block",b.style.width=`${P*a}px`,b.style.overflow="hidden",b.style.verticalAlign="top",h.push(b),z=G}return b&&_&&(b.textContent=x),h}_applyMinimumContrast(t,e,i,r,s,n){if(this._optionsService.rawOptions.minimumContrastRatio===1||V8(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=ut.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]}};Bh=Ct([me(1,F4),me(2,Ai),me(3,ds),me(4,Nn),me(5,ja),me(6,bo)],Bh);function jp(t,e,i){for(;t.length<i;)t=e+t;return t}var G8=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}},Y8=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 X8(){return new Y8}var Z0="xterm-dom-renderer-owner-",Gi="xterm-rows",cl="xterm-fg-",Hp="xterm-bg-",Lo="xterm-focus",hl="xterm-selection",J8=1,Rh=class extends Ie{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=J8++,this._rowElements=[],this._selectionRenderModel=X8(),this.onRequestRedraw=this._register(new ae).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Gi),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(hl),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=U8(),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(Bh,document),this._element.classList.add(Z0+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(pt(()=>{this._element.classList.remove(Z0+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new G8(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} .${Gi} 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} .${Gi} { 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} .${Gi} .xterm-dim { color: ${ut.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} .${Gi}.${Lo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Gi}.${Lo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Gi}.${Lo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Gi} .xterm-cursor.xterm-cursor-block { background-color: ${t.cursor.css}; color: ${t.cursorAccent.css};}${this._terminalSelector} .${Gi} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${t.cursor.css} !important; color: ${t.cursorAccent.css} !important;}${this._terminalSelector} .${Gi} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${t.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Gi} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${t.cursor.css} inset;}${this._terminalSelector} .${Gi} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${t.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,e+=`${this._terminalSelector} .${hl} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${hl} div { position: absolute; background-color: ${t.selectionBackgroundOpaque.css};}${this._terminalSelector} .${hl} div { position: absolute; background-color: ${t.selectionInactiveBackgroundOpaque.css};}`;for(let[n,o]of t.ansi.entries())e+=`${this._terminalSelector} .${cl}${n} { color: ${o.css}; }${this._terminalSelector} .${cl}${n}.xterm-dim { color: ${ut.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${Hp}${n} { background-color: ${o.css}; }`;e+=`${this._terminalSelector} .${cl}257 { color: ${ut.opaque(t.background).css}; }${this._terminalSelector} .${cl}257.xterm-dim { color: ${ut.multiplyOpacity(ut.opaque(t.background),.5).css}; }${this._terminalSelector} .${Hp}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(Lo),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Lo),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`.${Z0}${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,b=this._rowElements[f],_=a.lines.get(p);if(!b||!_)break;b.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))}}};Rh=Ct([me(7,xf),me(8,Qu),me(9,Ai),me(10,Ci),me(11,Nn),me(12,ds),me(13,bo)],Rh);var Nh=class extends Ie{constructor(t,e,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ae),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Q8(this._optionsService))}catch{this._measureStrategy=this._register(new Z8(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())}};Nh=Ct([me(2,Ai)],Nh);var i3=class extends Ie{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)}},Z8=class extends i3{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 i3{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}},ey=class extends Ie{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 ty(this._window)),this._onDprChange=this._register(new ae),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ae),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(ri.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}},ty=class extends Ie{constructor(t){super(),this._parentWindow=t,this._windowResizeListener=this._register(new ro),this._onDprChange=this._register(new ae),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(pt(()=>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)}},iy=class extends Ie{constructor(){super(),this.linkProviders=[],this._register(pt(()=>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 Tf(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 ry(t,e,i,r,s,n,o,a,l){if(!n)return;let u=Tf(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 Lh=class{constructor(t,e){this._renderService=t,this._charSizeService=e}getCoords(t,e,i,r,s){return ry(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=Tf(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])}}};Lh=Ct([me(0,fs),me(1,Qu)],Lh);var sy=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=[]}},r3={};p_(r3,{getSafariVersion:()=>oy,isChromeOS:()=>a3,isFirefox:()=>s3,isIpad:()=>ay,isIphone:()=>ly,isLegacyEdge:()=>ny,isLinux:()=>Rf,isMac:()=>Bf,isNode:()=>e0,isSafari:()=>n3,isWindows:()=>o3});var e0=typeof process<"u"&&"title"in process,Ha=e0?"node":navigator.userAgent,$a=e0?"node":navigator.platform,s3=Ha.includes("Firefox"),ny=Ha.includes("Edge"),n3=/^((?!chrome|android).)*safari/i.test(Ha);function oy(){if(!n3)return 0;let t=Ha.match(/Version\/(\d+)/);return t===null||t.length<2?0:parseInt(t[1])}var Bf=["Macintosh","MacIntel","MacPPC","Mac68K"].includes($a),ay=$a==="iPad",ly=$a==="iPhone",o3=["Windows","Win16","Win32","WinCE"].includes($a),Rf=$a.indexOf("Linux")>=0,a3=/\bCrOS\b/.test(Ha),l3=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()}},uy=class extends l3{_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())}}},cy=class extends l3{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},_u=!e0&&"requestIdleCallback"in window?cy:uy,hy=class{constructor(){this._queue=new _u}set(t){this._queue.clear(),this._queue.enqueue(t)}flush(){this._queue.flush()}},Oh=class extends Ie{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 ro),this._pausedResizeTask=new hy,this._observerDisposable=this._register(new ro),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 ae),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ae),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ae),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ae),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new sy((u,c)=>this._renderRows(u,c),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new dy(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(pt(()=>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=pt(()=>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()}};Oh=Ct([me(2,Ai),me(3,Qu),me(4,Nn),me(5,ja),me(6,Ci),me(7,ds),me(8,bo)],Oh);var dy=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 fy(t,e,i,r){let s=i.buffer.x,n=i.buffer.y;if(!i.buffer.hasScrollback)return gy(s,n,t,e,i,r)+t0(n,e,i,r)+vy(s,n,t,e,i,r);let o;if(n===e)return o=s>t?"D":"C",ba(Math.abs(s-t),va(o,r));o=n>e?"D":"C";let a=Math.abs(n-e),l=my(n>e?t:s,i)+(a-1)*i.cols+1+py(n>e?s:t);return ba(l,va(o,r))}function py(t,e){return t-1}function my(t,e){return e.cols-t}function gy(t,e,i,r,s,n){return t0(e,r,s,n).length===0?"":ba(c3(t,e,t,e-Cn(e,s),!1,s).length,va("D",n))}function t0(t,e,i,r){let s=t-Cn(t,i),n=e-Cn(e,i),o=Math.abs(s-n)-by(t,e,i);return ba(o,va(u3(t,e),r))}function vy(t,e,i,r,s,n){let o;t0(e,r,s,n).length>0?o=r-Cn(r,s):o=e;let a=r,l=_y(t,e,i,r,s,n);return ba(c3(t,o,i,a,l==="C",s).length,va(l,n))}function by(t,e,i){var o;let r=0,s=t-Cn(t,i),n=e-Cn(e,i);for(let a=0;a<Math.abs(s-n);a++){let l=u3(t,e)==="A"?-1:1;(o=i.buffer.lines.get(s+l*a))!=null&&o.isWrapped&&r++}return r}function Cn(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 _y(t,e,i,r,s,n){let o;return t0(i,r,s,n).length>0?o=r-Cn(r,s):o=e,t<i&&o<=r||t>=i&&o<r?"C":"D"}function u3(t,e){return t>e?"A":"B"}function c3(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 va(t,e){let i=e?"O":"[";return U.ESC+i+t}function ba(t,e){t=Math.floor(t);let i="";for(let r=0;r<t;r++)i+=e;return i}var yy=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 $p(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 Q0=50,wy=15,xy=50,Sy=500,ky=" ",Cy=new RegExp(ky,"g"),Ph=class extends Ie{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 er,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ae),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ae),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ae),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ae),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 yy(this._bufferService),this._activeSelectionMode=0,this._register(pt(()=>{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(Cy," ")).join(o3?`\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())),Rf&&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=$p(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=Tf(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,-Q0),Q0),e/=Q0,e/Math.abs(e)+Math.round(e*(wy-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(),xy)}_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&&!(Bf&&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<Sy&&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=fy(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],x=t[0];n.getWidth(_)===0&&(c++,_--),n.getWidth(x)===2&&(h++,x++);let S=n.getString(x).length;for(S>1&&(f+=S-1,l+=S-1);_>0&&a>0&&!this._isCharWordSeparator(n.loadCell(_-1,this._workCell));){n.loadCell(_-1,this._workCell);let E=this._workCell.getChars().length;this._workCell.getWidth()===0?(c++,_--):E>1&&(d+=E-1,a-=E-1),a--,_--}for(;x<n.length&&l+1<o.length&&!this._isCharWordSeparator(n.loadCell(x+1,this._workCell));){n.loadCell(x+1,this._workCell);let E=this._workCell.getChars().length;this._workCell.getWidth()===2?(h++,x++):E>1&&(f+=E-1,l+=E-1),l++,x++}}l++;let p=a+u-c+d,b=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 x=this._getWordAt([this._bufferService.cols-1,t[1]-1],!1,!0,!1);if(x){let S=this._bufferService.cols-x.start;p-=S,b+=S}}}if(r&&p+b===this._bufferService.cols&&n.getCodePoint(this._bufferService.cols-1)!==32){let _=s.lines.get(t[1]+1);if(_!=null&&_.isWrapped&&_.getCodePoint(0)!==32){let x=this._getWordAt([0,t[1]+1],!1,!1,!0);x&&(b+=x.length)}}return{start:p,length:b}}}_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=$p(i,this._bufferService.cols)}};Ph=Ct([me(3,Ci),me(4,Nn),me(5,Sf),me(6,Ai),me(7,fs),me(8,ds)],Ph);var qp=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={}}},Wp=class{constructor(){this._color=new qp,this._css=new qp}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()}},zt=Object.freeze((()=>{let t=[yt.toColor("#2e3436"),yt.toColor("#cc0000"),yt.toColor("#4e9a06"),yt.toColor("#c4a000"),yt.toColor("#3465a4"),yt.toColor("#75507b"),yt.toColor("#06989a"),yt.toColor("#d3d7cf"),yt.toColor("#555753"),yt.toColor("#ef2929"),yt.toColor("#8ae234"),yt.toColor("#fce94f"),yt.toColor("#729fcf"),yt.toColor("#ad7fa8"),yt.toColor("#34e2e2"),yt.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:Rt.toCss(r,s,n),rgba:Rt.toRgba(r,s,n)})}for(let i=0;i<24;i++){let r=8+i*10;t.push({css:Rt.toCss(r,r,r),rgba:Rt.toRgba(r,r,r)})}return t})()),un=yt.toColor("#ffffff"),Uo=yt.toColor("#000000"),Kp=yt.toColor("#ffffff"),Vp=Uo,Oo={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},Ay=un,Fh=class extends Ie{constructor(t){super(),this._optionsService=t,this._contrastCache=new Wp,this._halfContrastCache=new Wp,this._onChangeColors=this._register(new ae),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:un,background:Uo,cursor:Kp,cursorAccent:Vp,selectionForeground:void 0,selectionBackgroundTransparent:Oo,selectionBackgroundOpaque:ut.blend(Uo,Oo),selectionInactiveBackgroundTransparent:Oo,selectionInactiveBackgroundOpaque:ut.blend(Uo,Oo),scrollbarSliderBackground:ut.opacity(un,.2),scrollbarSliderHoverBackground:ut.opacity(un,.4),scrollbarSliderActiveBackground:ut.opacity(un,.5),overviewRulerBorder:un,ansi:zt.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=tt(t.foreground,un),e.background=tt(t.background,Uo),e.cursor=ut.blend(e.background,tt(t.cursor,Kp)),e.cursorAccent=ut.blend(e.background,tt(t.cursorAccent,Vp)),e.selectionBackgroundTransparent=tt(t.selectionBackground,Oo),e.selectionBackgroundOpaque=ut.blend(e.background,e.selectionBackgroundTransparent),e.selectionInactiveBackgroundTransparent=tt(t.selectionInactiveBackground,e.selectionBackgroundTransparent),e.selectionInactiveBackgroundOpaque=ut.blend(e.background,e.selectionInactiveBackgroundTransparent),e.selectionForeground=t.selectionForeground?tt(t.selectionForeground,zp):void 0,e.selectionForeground===zp&&(e.selectionForeground=void 0),ut.isOpaque(e.selectionBackgroundTransparent)&&(e.selectionBackgroundTransparent=ut.opacity(e.selectionBackgroundTransparent,.3)),ut.isOpaque(e.selectionInactiveBackgroundTransparent)&&(e.selectionInactiveBackgroundTransparent=ut.opacity(e.selectionInactiveBackgroundTransparent,.3)),e.scrollbarSliderBackground=tt(t.scrollbarSliderBackground,ut.opacity(e.foreground,.2)),e.scrollbarSliderHoverBackground=tt(t.scrollbarSliderHoverBackground,ut.opacity(e.foreground,.4)),e.scrollbarSliderActiveBackground=tt(t.scrollbarSliderActiveBackground,ut.opacity(e.foreground,.5)),e.overviewRulerBorder=tt(t.overviewRulerBorder,Ay),e.ansi=zt.slice(),e.ansi[0]=tt(t.black,zt[0]),e.ansi[1]=tt(t.red,zt[1]),e.ansi[2]=tt(t.green,zt[2]),e.ansi[3]=tt(t.yellow,zt[3]),e.ansi[4]=tt(t.blue,zt[4]),e.ansi[5]=tt(t.magenta,zt[5]),e.ansi[6]=tt(t.cyan,zt[6]),e.ansi[7]=tt(t.white,zt[7]),e.ansi[8]=tt(t.brightBlack,zt[8]),e.ansi[9]=tt(t.brightRed,zt[9]),e.ansi[10]=tt(t.brightGreen,zt[10]),e.ansi[11]=tt(t.brightYellow,zt[11]),e.ansi[12]=tt(t.brightBlue,zt[12]),e.ansi[13]=tt(t.brightMagenta,zt[13]),e.ansi[14]=tt(t.brightCyan,zt[14]),e.ansi[15]=tt(t.brightWhite,zt[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]=tt(t.extendedAnsi[r],zt[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()}}};Fh=Ct([me(0,Ai)],Fh);function tt(t,e){if(t!==void 0)try{return yt.toColor(t)}catch{}return e}var Ey=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)}},Dy=class{constructor(){this._services=new Ey,this._services.set(xf,this)}setService(t,e){this._services.set(t,e)}getService(t){return this._services.get(t)}createInstance(t,...e){let i=w_(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)}},My={trace:0,debug:1,info:2,warn:3,error:4,off:5},Ty="xterm.js: ",Ih=class extends Ie{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=My[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?"":Ty)+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)}};Ih=Ct([me(0,Ai)],Ih);var Up=class extends Ie{constructor(t){super(),this._maxLength=t,this.onDeleteEmitter=this._register(new ae),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ae),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ae),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}},Fe=3,Tt=Object.freeze(new za),dl=0,ec=2,Go=class h3{constructor(e,i,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*Fe);let s=i||er.fromCharData([0,T4,1,0]);for(let n=0;n<e;++n)this.setCell(n,s);this.length=e}get(e){let i=this._data[e*Fe+0],r=i&2097151;return[this._data[e*Fe+1],i&2097152?this._combined[e]:r?Ts(r):"",i>>22,i&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):r]}set(e,i){this._data[e*Fe+1]=i[0],i[1].length>1?(this._combined[e]=i[1],this._data[e*Fe+0]=e|2097152|i[2]<<22):this._data[e*Fe+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(e){return this._data[e*Fe+0]>>22}hasWidth(e){return this._data[e*Fe+0]&12582912}getFg(e){return this._data[e*Fe+1]}getBg(e){return this._data[e*Fe+2]}hasContent(e){return this._data[e*Fe+0]&4194303}getCodePoint(e){let i=this._data[e*Fe+0];return i&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):i&2097151}isCombined(e){return this._data[e*Fe+0]&2097152}getString(e){let i=this._data[e*Fe+0];return i&2097152?this._combined[e]:i&2097151?Ts(i&2097151):""}isProtected(e){return this._data[e*Fe+2]&536870912}loadCell(e,i){return dl=e*Fe,i.content=this._data[dl+0],i.fg=this._data[dl+1],i.bg=this._data[dl+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*Fe+0]=i.content,this._data[e*Fe+1]=i.fg,this._data[e*Fe+2]=i.bg}setCellFromCodepoint(e,i,r,s){s.bg&268435456&&(this._extendedAttrs[e]=s.extended),this._data[e*Fe+0]=i|r<<22,this._data[e*Fe+1]=s.fg,this._data[e*Fe+2]=s.bg}addCodepointToCell(e,i,r){let s=this._data[e*Fe+0];s&2097152?this._combined[e]+=Ts(i):s&2097151?(this._combined[e]=Ts(s&2097151)+Ts(i),s&=-2097152,s|=2097152):s=i|1<<22,r&&(s&=-12582913,s|=r<<22),this._data[e*Fe+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 er;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 er;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*ec<this._data.buffer.byteLength;let r=e*Fe;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*ec<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*ec<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 h3(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*Fe+0]&4194303)return e+(this._data[e*Fe+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*Fe+0]&4194303||this._data[e*Fe+2]&50331648)return e+(this._data[e*Fe+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<Fe;u++)this._data[(r+l)*Fe+u]=o[(i+l)*Fe+u];o[(i+l)*Fe+2]&268435456&&(this._extendedAttrs[r+l]=e._extendedAttrs[i+l])}else for(let l=0;l<s;l++){for(let u=0;u<Fe;u++)this._data[(r+l)*Fe+u]=o[(i+l)*Fe+u];o[(i+l)*Fe+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*Fe+0],a=o&2097151,l=o&2097152?this._combined[i]:a?Ts(a):Is;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 By(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=_a(c,h,e),f=1,p=0;for(;f<c.length;){let _=_a(c,f,e),x=_-p,S=i-d,E=Math.min(x,S);c[h].copyCellsFrom(c[f],p,d,E,!1),d+=E,d===i&&(h++,d=0),p+=E,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 b=0;for(let _=c.length-1;_>0&&(_>h||c[_].getTrimmedLength()===0);_--)b++;b>0&&(o.push(a+c.length-b),o.push(b)),a+=c.length-1}return o}function Ry(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 Ny(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 Ly(t,e,i){let r=[],s=t.map((l,u)=>_a(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=_a(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 _a(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 d3=class f3{constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=f3._nextId++,this._onDispose=this.register(new ae),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),kn(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};d3._nextId=1;var Oy=d3,$t={},cn=$t.B;$t[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:"≥","{":"π","|":"≠","}":"£","~":"·"};$t.A={"#":"£"};$t.B=void 0;$t[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};$t.C=$t[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};$t.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};$t.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};$t.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};$t.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};$t.E=$t[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};$t.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};$t.H=$t[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};$t["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Gp=4294967295,Yp=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=Tt.clone(),this.savedCharset=cn,this.markers=[],this._nullCell=er.fromCharData([0,T4,1,0]),this._whitespaceCell=er.fromCharData([0,Is,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new _u,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Up(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 gu),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 gu),this._whitespaceCell}getBlankLine(t,e){return new Go(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>Gp?Gp:e}fillViewportRows(t){if(this.lines.length===0){t===void 0&&(t=Tt);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 Up(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(t,e){let i=this.getNullCell(Tt),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 Go(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 Go(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=By(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell(Tt),i);if(r.length>0){let s=Ry(this.lines,r);Ny(this.lines,s.layout),this._reflowLargerAdjustViewport(t,e,s.countRemoved)}}_reflowLargerAdjustViewport(t,e,i){let r=this.getNullCell(Tt),s=i;for(;s-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<e&&this.lines.push(new Go(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(Tt),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 E=this.ybase+this.y;if(E>=o&&E<o+l.length)continue}let u=l[l.length-1].getTrimmedLength(),c=Ly(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 E=0;E<h;E++){let D=this.getBlankLine(Tt,!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,b=c[p];b===0&&(p--,b=c[p]);let _=l.length-h-1,x=u;for(;_>=0;){let E=Math.min(x,b);if(l[p]===void 0)break;if(l[p].copyCellsFrom(l[_],x-E,b-E,E,!0),b-=E,b===0&&(p--,b=c[p]),x-=E,x===0){_--;let D=Math.max(_,0);x=_a(l,D,this._cols)}}for(let E=0;E<l.length;E++)c[E]<t&&l[E].setCell(c[E],r);let S=h-d;for(;S-- >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 b=0;b<this.lines.length;b++)a.push(this.lines.get(b));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 b=Math.min(this.lines.maxLength-1,l+n-1);b>=0;b--)if(h&&h.start>u+d){for(let _=h.newLines.length-1;_>=0;_--)this.lines.set(b--,h.newLines[_]);b++,o.push({index:u+1,amount:h.newLines.length}),d+=h.newLines.length,h=s[++c]}else this.lines.set(b,a[u--]);let f=0;for(let b=o.length-1;b>=0;b--)o[b].index+=f,this.lines.onInsertEmitter.fire(o[b]),f+=o[b].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 Oy(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)}},Py=class extends Ie{constructor(t,e){super(),this._optionsService=t,this._bufferService=e,this._onBufferActivate=this._register(new ae),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 Yp(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Yp(!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)}},p3=2,m3=1,zh=class extends Ie{constructor(t){super(),this.isUserScrolling=!1,this._onResize=this._register(new ae),this.onResize=this._onResize.event,this._onScroll=this._register(new ae),this.onScroll=this._onScroll.event,this.cols=Math.max(t.rawOptions.cols||0,p3),this.rows=Math.max(t.rawOptions.rows||0,m3),this.buffers=this._register(new Py(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))}};zh=Ct([me(0,Ai)],zh);var zn={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:Bf,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},Fy=["normal","bold","100","200","300","400","500","600","700","800","900"],Iy=class extends Ie{constructor(t){super(),this._onOptionChange=this._register(new ae),this.onOptionChange=this._onOptionChange.event;let e={...zn};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(pt(()=>{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 zn))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},e=(i,r)=>{if(!(i in zn))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=zn[t]),!zy(e))throw new Error(`"${e}" is not a valid value for ${t}`);break;case"wordSeparator":e||(e=zn[t]);break;case"fontWeight":case"fontWeightBold":if(typeof e=="number"&&1<=e&&e<=1e3)break;e=Fy.includes(e)?e:zn[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 zy(t){return t==="block"||t==="underline"||t==="bar"}function Yo(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]&&Yo(t[r],e-1);return i}var Xp=Object.freeze({insertMode:!1}),Jp=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),jh=class extends Ie{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 ae),this.onData=this._onData.event,this._onUserInput=this._register(new ae),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ae),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ae),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Yo(Xp),this.decPrivateModes=Yo(Jp)}reset(){this.modes=Yo(Xp),this.decPrivateModes=Yo(Jp)}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))}};jh=Ct([me(0,Ci),me(1,O4),me(2,Ai)],jh);var Zp={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 tc(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 ic=String.fromCharCode,Qp={DEFAULT:t=>{let e=[tc(t,!1)+32,t.col+32,t.row+32];return e[0]>255||e[1]>255||e[2]>255?"":`\x1B[M${ic(e[0])}${ic(e[1])}${ic(e[2])}`},SGR:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${tc(t,!0)};${t.col};${t.row}${e}`},SGR_PIXELS:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${tc(t,!0)};${t.x};${t.y}${e}`}},Hh=class extends Ie{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 ae),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(Zp))this.addProtocol(r,Zp[r]);for(let r of Object.keys(Qp))this.addEncoding(r,Qp[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)}};Hh=Ct([me(0,Ci),me(1,Nn),me(2,Ai)],Hh);var rc=[[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]],jy=[[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]],jt;function Hy(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 $y=class{constructor(){if(this.version="6",!jt){jt=new Uint8Array(65536),jt.fill(1),jt[0]=0,jt.fill(0,1,32),jt.fill(0,127,160),jt.fill(2,4352,4448),jt[9001]=2,jt[9002]=2,jt.fill(2,11904,42192),jt[12351]=1,jt.fill(2,44032,55204),jt.fill(2,63744,64256),jt.fill(2,65040,65050),jt.fill(2,65072,65136),jt.fill(2,65280,65377),jt.fill(2,65504,65511);for(let t=0;t<rc.length;++t)jt.fill(0,rc[t][0],rc[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?jt[t]:Hy(t,jy)?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=mn.extractWidth(e);s===0?r=!1:s>i&&(i=s)}return mn.createPropertyValue(0,i,r)}},mn=class ru{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ae,this.onChange=this._onChange.event;let e=new $y;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=ru.extractWidth(a);ru.extractShouldJoin(a)&&(l-=ru.extractWidth(r)),i+=l,r=a}return i}charProperties(e,i){return this._activeProvider.charProperties(e,i)}},qy=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 em(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 Po=2147483647,Wy=256,g3=class $h{constructor(e=32,i=32){if(this.maxLength=e,this.maxSubParamsLength=i,i>Wy)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 $h;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 $h(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>Po?Po: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>Po?Po: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,Po):e}},Fo=[],Ky=class{constructor(){this._state=0,this._active=Fo,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=Fo}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=Fo,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Fo,!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",Zu(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=Fo,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+=Zu(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}},Io=[],Vy=class{constructor(){this._handlers=Object.create(null),this._active=Io,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Io}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=Io,this._ident=0}hook(t,e){if(this.reset(),this._ident=t,this._active=this._handlers[t]||Io,!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",Zu(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=Io,this._ident=0}},Xo=new g3;Xo.addParam(0);var tm=class{constructor(t){this._handler=t,this._data="",this._params=Xo,this._hitLimit=!1}hook(t){this._params=t.length>1||t.params[0]?t.clone():Xo,this._data="",this._hitLimit=!1}put(t,e,i){this._hitLimit||(this._data+=Zu(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=Xo,this._data="",this._hitLimit=!1,i));return this._params=Xo,this._data="",this._hitLimit=!1,e}},Uy=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}},Xi=160,Gy=function(){let t=new Uy(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(Xi,0,2,0),t.add(Xi,8,5,8),t.add(Xi,6,0,6),t.add(Xi,11,0,11),t.add(Xi,13,13,13),t}(),Yy=class extends Ie{constructor(t=Gy){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 g3,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(pt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new Ky),this._dcsParser=this._register(new Vy),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:Xi)],s>>4){case 2:for(let d=a+1;;++d){if(d>=e||(r=t[d])<32||r>126&&r<Xi){this._printHandler(t,a,d),a=d-1;break}if(++d>=e||(r=t[d])<32||r>126&&r<Xi){this._printHandler(t,a,d),a=d-1;break}if(++d>=e||(r=t[d])<32||r>126&&r<Xi){this._printHandler(t,a,d),a=d-1;break}if(++d>=e||(r=t[d])<32||r>126&&r<Xi){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<Xi){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<Xi){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}}},Xy=/^([\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})$/,Jy=/^[\da-f]+$/;function im(t){if(!t)return;let e=t.toLowerCase();if(e.indexOf("rgb:")===0){e=e.slice(4);let i=Xy.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),Jy.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 sc(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 Zy(t,e=16){let[i,r,s]=t;return`rgb:${sc(i,e)}/${sc(r,e)}/${sc(s,e)}`}var Qy={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Es=131072,rm=10;function sm(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 nm=5e3,om=0,e7=class extends Ie{constructor(t,e,i,r,s,n,o,a,l=new Yy){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 __,this._utf8Decoder=new y_,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Tt.clone(),this._eraseAttrDataInternal=Tt.clone(),this._onRequestBell=this._register(new ae),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ae),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ae),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ae),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ae),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ae),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ae),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ae),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ae),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ae),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ae),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ae),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ae),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 qh(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(U.BEL,()=>this.bell()),this._parser.setExecuteHandler(U.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(U.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(U.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(U.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(U.BS,()=>this.backspace()),this._parser.setExecuteHandler(U.HT,()=>this.tab()),this._parser.setExecuteHandler(U.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(U.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(tu.IND,()=>this.index()),this._parser.setExecuteHandler(tu.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(tu.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 $t)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 tm((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"),nm))]).catch(e=>{if(e!=="#SLOW_TIMEOUT")throw e;console.warn(`async parser handler taking longer than ${nm} 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>Es&&(n=this._parseStack.position+Es)}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<Es&&(this._parseBuffer=new Uint32Array(Math.min(t.length,Es))),o||this._dirtyRowTracker.clearRange(),t.length>Es)for(let u=n;u<t.length;u+=Es){let c=u+Es<t.length?u+Es: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 x=n[String.fromCharCode(r)];x&&(r=x.charCodeAt(0))}let p=this._unicodeService.charProperties(r,d);s=mn.extractWidth(p);let b=mn.extractShouldJoin(p),_=b?mn.extractWidth(d):0;if(d=p,o&&this._onA11yChar.fire(Ts(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-_>a){if(l){let x=h,S=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 Go&&h.copyCellsFrom(x,S,0,_,!1);S<a;)x.setCellFromCodepoint(S++,0,1,c)}else if(this._activeBuffer.x=a-1,s===2)continue}if(b&&this._activeBuffer.x){let x=h.getWidth(this._activeBuffer.x-1)?1:2;h.addCodepointToCell(this._activeBuffer.x-x,r,s);for(let S=s-_;--S>=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=>sm(i.params[0],this._optionsService.rawOptions.windowOptions)?e(i):!0):this._parser.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._parser.registerDcsHandler(t,new tm(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(Tt));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=mn.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(U.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(U.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(t){return t.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(U.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(U.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(t.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(U.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,cn),this._charsetService.setgCharset(1,cn),this._charsetService.setgCharset(2,cn),this._charsetService.setgCharset(3,cn);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){(b=>(b[b.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",b[b.SET=1]="SET",b[b.RESET=2]="RESET",b[b.PERMANENTLY_SET=3]="PERMANENTLY_SET",b[b.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=(b,_)=>(o.triggerDataEvent(`${U.ESC}[${e?"":"?"}${b};${_}$y`),!0),f=b=>b?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|=za.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=Tt.fg,t.bg=Tt.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|=Tt.fg&16777215):i===49?(r.bg&=-67108864,r.bg|=Tt.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|=Tt.fg&16777215,r.bg&=-67108864,r.bg|=Tt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(t){switch(t.params[0]){case 5:this._coreService.triggerDataEvent(`${U.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${U.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(`${U.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=Tt.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(!sm(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(`${U.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(e===0||e===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>rm&&this._windowTitleStack.shift()),(e===0||e===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>rm&&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(am(n))if(s==="?")e.push({type:0,index:n});else{let o=im(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=im(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]);am(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,cn),!0}selectCharset(t){return t.length!==2?(this.selectDefaultCharset(),!0):(t[0]==="/"||this._charsetService.setgCharset(Qy[t[0]],$t[t[1]]||cn),!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=Tt.clone(),this._eraseAttrDataInternal=Tt.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 er;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(`${U.ESC}${o}${U.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)}},qh=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&&(om=t,t=e,e=om),t<this.start&&(this.start=t),e>this.end&&(this.end=e)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};qh=Ct([me(0,Ci)],qh);function am(t){return 0<=t&&t<256}var t7=5e7,lm=12,i7=50,r7=class extends Ie{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 ae),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>t7)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>=lm?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>=lm)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>i7&&(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()}},Wh=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)))}};Wh=Ct([me(0,Ci)],Wh);var um=!1,s7=class extends Ie{constructor(t){super(),this._windowsWrappingHeuristics=this._register(new ro),this._onBinary=this._register(new ae),this.onBinary=this._onBinary.event,this._onData=this._register(new ae),this.onData=this._onData.event,this._onLineFeed=this._register(new ae),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ae),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ae),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ae),this._instantiationService=new Dy,this.optionsService=this._register(new Iy(t)),this._instantiationService.setService(Ai,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(zh)),this._instantiationService.setService(Ci,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Ih)),this._instantiationService.setService(O4,this._logService),this.coreService=this._register(this._instantiationService.createInstance(jh)),this._instantiationService.setService(Nn,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Hh)),this._instantiationService.setService(L4,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(mn)),this._instantiationService.setService(k_,this.unicodeService),this._charsetService=this._instantiationService.createInstance(qy),this._instantiationService.setService(S_,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Wh),this._instantiationService.setService(P4,this._oscLinkService),this._inputHandler=this._register(new e7(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(ri.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(ri.forward(this._bufferService.onResize,this._onResize)),this._register(ri.forward(this.coreService.onData,this._onData)),this._register(ri.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 r7((e,i)=>this._inputHandler.parse(e,i))),this._register(ri.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ae),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&&!um&&(this._logService.warn("writeSync is unreliable and will be removed soon."),um=!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,p3),e=Math.max(e,m3),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(em.bind(null,this._bufferService))),t.push(this.registerCsiHandler({final:"H"},()=>(em(this._bufferService),!1))),this._windowsWrappingHeuristics.value=pt(()=>{for(let e of t)e.dispose()})}}},n7={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 o7(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=U.ESC+"OA":s.key=U.ESC+"[A":t.key==="UIKeyInputLeftArrow"?e?s.key=U.ESC+"OD":s.key=U.ESC+"[D":t.key==="UIKeyInputRightArrow"?e?s.key=U.ESC+"OC":s.key=U.ESC+"[C":t.key==="UIKeyInputDownArrow"&&(e?s.key=U.ESC+"OB":s.key=U.ESC+"[B");break;case 8:s.key=t.ctrlKey?"\b":U.DEL,t.altKey&&(s.key=U.ESC+s.key);break;case 9:if(t.shiftKey){s.key=U.ESC+"[Z";break}s.key=U.HT,s.cancel=!0;break;case 13:s.key=t.altKey?U.ESC+U.CR:U.CR,s.cancel=!0;break;case 27:s.key=U.ESC,t.altKey&&(s.key=U.ESC+U.ESC),s.cancel=!0;break;case 37:if(t.metaKey)break;n?s.key=U.ESC+"[1;"+(n+1)+"D":e?s.key=U.ESC+"OD":s.key=U.ESC+"[D";break;case 39:if(t.metaKey)break;n?s.key=U.ESC+"[1;"+(n+1)+"C":e?s.key=U.ESC+"OC":s.key=U.ESC+"[C";break;case 38:if(t.metaKey)break;n?s.key=U.ESC+"[1;"+(n+1)+"A":e?s.key=U.ESC+"OA":s.key=U.ESC+"[A";break;case 40:if(t.metaKey)break;n?s.key=U.ESC+"[1;"+(n+1)+"B":e?s.key=U.ESC+"OB":s.key=U.ESC+"[B";break;case 45:!t.shiftKey&&!t.ctrlKey&&(s.key=U.ESC+"[2~");break;case 46:n?s.key=U.ESC+"[3;"+(n+1)+"~":s.key=U.ESC+"[3~";break;case 36:n?s.key=U.ESC+"[1;"+(n+1)+"H":e?s.key=U.ESC+"OH":s.key=U.ESC+"[H";break;case 35:n?s.key=U.ESC+"[1;"+(n+1)+"F":e?s.key=U.ESC+"OF":s.key=U.ESC+"[F";break;case 33:t.shiftKey?s.type=2:t.ctrlKey?s.key=U.ESC+"[5;"+(n+1)+"~":s.key=U.ESC+"[5~";break;case 34:t.shiftKey?s.type=3:t.ctrlKey?s.key=U.ESC+"[6;"+(n+1)+"~":s.key=U.ESC+"[6~";break;case 112:n?s.key=U.ESC+"[1;"+(n+1)+"P":s.key=U.ESC+"OP";break;case 113:n?s.key=U.ESC+"[1;"+(n+1)+"Q":s.key=U.ESC+"OQ";break;case 114:n?s.key=U.ESC+"[1;"+(n+1)+"R":s.key=U.ESC+"OR";break;case 115:n?s.key=U.ESC+"[1;"+(n+1)+"S":s.key=U.ESC+"OS";break;case 116:n?s.key=U.ESC+"[15;"+(n+1)+"~":s.key=U.ESC+"[15~";break;case 117:n?s.key=U.ESC+"[17;"+(n+1)+"~":s.key=U.ESC+"[17~";break;case 118:n?s.key=U.ESC+"[18;"+(n+1)+"~":s.key=U.ESC+"[18~";break;case 119:n?s.key=U.ESC+"[19;"+(n+1)+"~":s.key=U.ESC+"[19~";break;case 120:n?s.key=U.ESC+"[20;"+(n+1)+"~":s.key=U.ESC+"[20~";break;case 121:n?s.key=U.ESC+"[21;"+(n+1)+"~":s.key=U.ESC+"[21~";break;case 122:n?s.key=U.ESC+"[23;"+(n+1)+"~":s.key=U.ESC+"[23~";break;case 123:n?s.key=U.ESC+"[24;"+(n+1)+"~":s.key=U.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=U.NUL:t.keyCode>=51&&t.keyCode<=55?s.key=String.fromCharCode(t.keyCode-51+27):t.keyCode===56?s.key=U.DEL:t.keyCode===219?s.key=U.ESC:t.keyCode===220?s.key=U.FS:t.keyCode===221&&(s.key=U.GS);else if((!i||r)&&t.altKey&&!t.metaKey){let a=(o=n7[t.keyCode])==null?void 0:o[t.shiftKey?1:0];if(a)s.key=U.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=U.ESC+u}else if(t.keyCode===32)s.key=U.ESC+(t.ctrlKey?U.NUL:" ");else if(t.key==="Dead"&&t.code.startsWith("Key")){let l=t.code.slice(3,4);t.shiftKey||(l=l.toLowerCase()),s.key=U.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=U.US),t.key==="@"&&(s.key=U.NUL));break}return s}var At=0,a7=class{constructor(t){this._getKey=t,this._array=[],this._insertedValues=[],this._flushInsertedTask=new _u,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new _u,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||(At=this._search(e),At===-1)||this._getKey(this._array[At])!==e)return!1;do if(this._array[At]===t)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(At),!0;while(++At<this._array.length&&this._getKey(this._array[At])===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&&(At=this._search(t),!(At<0||At>=this._array.length)&&this._getKey(this._array[At])===t))do yield this._array[At];while(++At<this._array.length&&this._getKey(this._array[At])===t)}forEachByKey(t,e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(At=this._search(t),!(At<0||At>=this._array.length)&&this._getKey(this._array[At])===t))do e(this._array[At]);while(++At<this._array.length&&this._getKey(this._array[At])===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}},nc=0,cm=0,l7=class extends Ie{constructor(){super(),this._decorations=new a7(t=>t==null?void 0:t.marker.line),this._onDecorationRegistered=this._register(new ae),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ae),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(pt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(t){if(t.marker.isDisposed)return;let e=new u7(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=>{nc=s.options.x??0,cm=nc+(s.options.width??1),t>=nc&&t<cm&&(!i||(s.options.layer??"bottom")===i)&&r(s)})}},u7=class extends $s{constructor(t){super(),this.options=t,this.onRenderEmitter=this.add(new ae),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ae),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=yt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=yt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},c7=1e3,h7=class{constructor(t,e=c7){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)}},hm=20,yu=class extends Ie{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 h7(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(pt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(t){for(let e=0;e<t;e++)this._handleChar(" ")}_handleChar(t){this._liveRegionLineCount<hm+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==t&&(this._charsToAnnounce+=t):this._charsToAnnounce+=t,t===`
27
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===hm+1&&(this._liveRegion.textContent+=ch.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})`}};yu=Ct([me(1,xf),me(2,ds),me(3,fs)],yu);var Kh=class extends Ie{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 ae),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ae),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(pt(()=>{var n;kn(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&&d7(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,kn(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}}};Kh=Ct([me(1,Sf),me(2,fs),me(3,Ci),me(4,I4)],Kh);function d7(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 f7=class extends s7{constructor(t={}){super(t),this._linkifier=this._register(new ro),this.browser=r3,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new ro),this._onCursorMove=this._register(new ae),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ae),this.onKey=this._onKey.event,this._onRender=this._register(new ae),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ae),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ae),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ae),this.onBell=this._onBell.event,this._onFocus=this._register(new ae),this._onBlur=this._register(new ae),this._onA11yCharEmitter=this._register(new ae),this._onA11yTabEmitter=this._register(new ae),this._onWillOpen=this._register(new ae),this._setup(),this._decorationService=this._instantiationService.createInstance(l7),this._instantiationService.setService(ja,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(iy),this._instantiationService.setService(I4,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(dh)),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(ri.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(ri.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(ri.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(ri.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(pt(()=>{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=ut.toColorRGB(i==="ansi"?this._themeService.colors.ansi[e.index]:this._themeService.colors[i]);this.coreService.triggerDataEvent(`${U.ESC}]${r};${Zy(s)}${t3.ST}`);break;case 1:if(i==="ansi")this._themeService.modifyColors(n=>n.ansi[e.index]=Rt.toColor(...e.color));else{let n=i;this._themeService.modifyColors(o=>o[n]=Rt.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(yu,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(t){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(U.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(U.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()&&v_(e,this._selectionService)}));let t=e=>b_(e,this.textarea,this.coreService,this.optionsService);this._register(Te(this.textarea,"paste",t)),this._register(Te(this.element,"paste",t)),s3?this._register(Te(this.element,"mousedown",e=>{e.button===2&&wp(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Te(this.element,"contextmenu",e=>{wp(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Rf&&this._register(Te(this.element,"auxclick",e=>{e.button===1&&M4(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",uh.get()),a3||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(ey,this.textarea,t.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(ds,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(Nh,this._document,this._helperContainer),this._instantiationService.setService(Qu,this._charSizeService),this._themeService=this._instantiationService.createInstance(Fh),this._instantiationService.setService(bo,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(bu),this._instantiationService.setService(F4,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Oh,this.rows,this.screenElement)),this._instantiationService.setService(fs,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(Th,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Lh),this._instantiationService.setService(Sf,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Kh,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(Dh,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(Ph,this.element,this.screenElement,r)),this._instantiationService.setService(A_,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(ri.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var n;this._selectionService.refresh(),(n=this._viewport)==null||n.queueSync()})),this._register(this._instantiationService.createInstance(Mh,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(yu,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",n=>this._handleScreenReaderModeOptionChange(n))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(vu,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",n=>{!this._overviewRulerRenderer&&n&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(vu,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Rh,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=U.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){D4(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=o7(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===U.ETX||i.key===U.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)&&(p7(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(Tt));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(U.ESC+"[I"):this.coreService.triggerDataEvent(U.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(`${U.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(`${U.ESC}[6;${s};${r}t`);break}}cancel(t,e){if(!(!this.options.cancelEvents&&!e))return t.preventDefault(),t.stopPropagation(),!1}};function p7(t){return t.keyCode===16||t.keyCode===17||t.keyCode===18}var m7=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)}},g7=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 er)}translateToString(t,e,i){return this._line.translateToString(t,e,i)}},dm=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 g7(e)}getNullCell(){return new er}},v7=class extends Ie{constructor(t){super(),this._core=t,this._onBufferChange=this._register(new ae),this.onBufferChange=this._onBufferChange.event,this._normal=new dm(this._core.buffers.normal,"normal"),this._alternate=new dm(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)}},b7=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)}},_7=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}},y7=["cols","rows"],yr=0,w7=class extends Ie{constructor(t){super(),this._core=this._register(new f7(t)),this._addonManager=this._register(new m7),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(y7.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 b7(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new _7(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 v7(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 uh.get()},set promptLabel(t){uh.set(t)},get tooMuchOutput(){return ch.get()},set tooMuchOutput(t){ch.set(t)}}}_verifyIntegers(...t){for(yr of t)if(yr===1/0||isNaN(yr)||yr%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...t){for(yr of t)if(yr&&(yr===1/0||isNaN(yr)||yr%1!==0||yr<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 x7=2,S7=1,k7=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(x7,Math.floor(c/t.css.cell.width)),rows:Math.max(S7,Math.floor(u/t.css.cell.height))}}};const fm=1,C7=[500,1e3,2e3,4e3,8e3],A7=3e3;function E7({url:t,binaryType:e="arraybuffer",WebSocketImpl:i=typeof WebSocket<"u"?WebSocket:void 0,setTimeoutImpl:r=setTimeout,clearTimeoutImpl:s=clearTimeout,backoff:n=C7,stableMs:o=A7,onOpen:a=()=>{},onMessage:l=()=>{},onState:u=()=>{}}){let c=null,h=0,d=!1,f=0,p=0;const b=j5(()=>{if(d||!c)return;const C=c;c=null,x();try{C.close()}catch{}D()},{setTimeoutImpl:r,clearTimeoutImpl:s}),_=typeof t=="function"?t:()=>t,x=()=>{p&&(s(p),p=0)},S=()=>{u(h===0?"connecting":"reconnecting");let C;try{C=new i(_())}catch{D();return}c=C,b.arm();try{C.binaryType=e}catch{}C.onopen=()=>{C===c&&(b.arm(),u("open"),p=r(()=>{h=0,p=0},o),a(M))},C.onmessage=N=>{if(C===c){if(b.arm(),N.data==="ping")try{C.send("pong")}catch{}l(N)}},C.onclose=()=>{C===c&&E()},C.onerror=()=>{}},E=()=>{x(),b.disarm(),!d&&D()},D=()=>{u("reconnecting");const C=n[Math.min(h,n.length-1)];h++,f=r(()=>{f=0,S()},C)},M={send(C){return c&&c.readyState===fm?(c.send(C),!0):!1},isOpen(){return!!c&&c.readyState===fm},close(){if(d=!0,b.disarm(),f&&(s(f),f=0),x(),c)try{c.close()}catch{}c=null},get raw(){return c}};return S(),M}const v3="spexcode.terminal-font-size",D7=9,M7=18,pm=1,Vh=new Set;function T7(){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 b3(t){const e=Number(t);return Number.isFinite(e)&&e>=D7&&e<=M7?Math.round(e/pm)*pm:null}function B7(){let t=null;try{t=b3(localStorage.getItem(v3))}catch{}return t??T7()}function cR(t){const e=b3(t);if(e===null)throw new Error(`Invalid terminal font size: ${t}`);try{localStorage.setItem(v3,String(e))}catch{}for(const i of Vh)i(e);return e}function R7(t){return Vh.add(t),()=>Vh.delete(t)}const N7="\x1B[?2026h",L7="\x1B[?2026l",O7=new Set([9,1002,1003,1005,1015]);function mm(t){return t.replace(/\x1b\[(?:I|O)/g,"")}function P7(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 F7(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 I7(t){return t.length>0&&t.every(e=>typeof e=="number"&&O7.has(e))}function z7(t){return t.length>0&&t.every(e=>e===2026)}function j7(){const e=getComputedStyle(document.documentElement).getPropertyValue("--mono").trim();if(!e)throw new Error("Terminal typography tokens are missing or invalid");return{fontSize:B7(),fontFamily:e}}function H7(t){var e;return(e=navigator.clipboard)!=null&&e.writeText?navigator.clipboard.writeText(t).then(()=>!0).catch(()=>gm(t)):Promise.resolve(gm(t))}function gm(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 $7({sessionId:t,active:e=!0,focused:i=e,writable:r=!0,resumeRequired:s=!1,focusRequest:n=0}){const o=He(),a=A.useRef(null),l=A.useRef(null),u=A.useRef({cols:0,rows:0}),c=A.useRef(null),h=A.useRef(e),d=A.useRef(i),f=A.useRef(r),p=A.useRef(s),b=A.useRef(!s),_=A.useRef(null),x=A.useRef(null);h.current=e,d.current=i,f.current=r,p.current=s;const[S,E]=A.useState(!1),[D,M]=A.useState(!1),[C,N]=A.useState(""),[W,q]=A.useState(!s);b.current=W;const[K,V]=A.useState("connecting");A.useEffect(()=>{var ni;const P=new w7({...j7(),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=P;const j=new k7;P.loadAddon(j),P.open(a.current);try{j.fit()}catch{}const O=(ni=a.current)==null?void 0:ni.querySelector(".xterm-helper-textarea"),G=fe=>{fe.inputType==="insertText"&&!fe.isComposing&&(O.value="")};O==null||O.addEventListener("input",G),P.attachCustomKeyEventHandler(fe=>fe.type==="keydown"&&fe.key.length===1&&!fe.ctrlKey&&!fe.altKey&&!fe.metaKey?!1:!(fe.key==="Enter"&&fe.shiftKey&&!fe.ctrlKey&&!fe.altKey&&!fe.metaKey)||fe.isComposing||fe.keyCode===229?!0:(fe.preventDefault(),fe.stopPropagation(),fe.type==="keydown"&&P.input("\x1B\r",!0),!1));const $=()=>h.current&&document.visibilityState!=="hidden",ue=requestAnimationFrame(()=>{var Ne;const fe=(Ne=a.current)==null?void 0:Ne.querySelector(".xterm-helper-textarea");f.current&&d.current&&$()&&(fe==null||fe.setAttribute("data-focus-sink",""),document.activeElement!==fe&&P.focus())}),Y=["h","l"].map(fe=>P.parser.registerCsiHandler({prefix:"?",final:fe},Ne=>I7(Ne)));let X=!1;const he=["h","l"].map(fe=>P.parser.registerCsiHandler({prefix:"?",final:fe},Ne=>X&&z7(Ne))),ne=`${location.protocol==="https:"?"wss":"ws"}://${location.host}${gi(`/api/sessions/${t}/socket`)}`;let pe=null,ce=!1;const ie=()=>{const fe=a.current;if(!fe||fe.clientWidth<40||fe.clientHeight<40)return;let Ne;try{Ne=j.proposeDimensions()}catch{return}const ze=Ne==null?void 0:Ne.cols,et=Ne==null?void 0:Ne.rows;if(!ze||!et||ze<20&&fe.clientWidth>200)return;const Gr=u.current;if(!(ze===Gr.cols&&et===Gr.rows)){if(u.current={cols:ze,rows:et},!$()){if(!ce)try{P.resize(ze,et)}catch{}return}pe!=null&&pe.isOpen()&&pe.send(JSON.stringify({t:"resize",cols:ze,rows:et}))}};c.current=ie,x.current=()=>{ce=!1,pe!=null&&pe.isOpen()&&pe.send(JSON.stringify({t:"visible",visible:!1}))};let _e=0;const qe=R7(fe=>{P.options.fontSize=fe,u.current={cols:0,rows:0},cancelAnimationFrame(_e),_e=requestAnimationFrame(()=>{var Ne;return(Ne=c.current)==null?void 0:Ne.call(c)})});let nt=null;const Wt=[];let Mt=!1;const Re=()=>{if(Mt||!Wt.length)return;Mt=!0;const{frame:fe,size:Ne}=Wt.shift(),ze=()=>{Mt=!1,Re()};if(!Ne){P.write(fe,ze);return}P.write(N7,()=>{X=!0;try{P.resize(Ne.cols,Ne.rows)}catch{}P.write(fe,()=>{X=!1,P.write(L7,ze)})})},Kt=(fe,Ne)=>{Wt.push({frame:fe,size:Ne}),Re()};pe=E7({url:ne,onState:V,onOpen:()=>{var fe;nt=null,ce=!1,Wt.length=0,P.reset(),u.current={cols:0,rows:0},$()?ie():(fe=x.current)==null||fe.call(x)},onMessage:fe=>{if(typeof fe.data=="string"){try{const et=JSON.parse(fe.data);(et==null?void 0:et.t)==="resize-commit"&&et.cols>0&&et.rows>0&&(nt={cols:Math.floor(et.cols),rows:Math.floor(et.rows)})}catch{}return}if(!(fe.data instanceof ArrayBuffer))return;$()||(ce=!0);const Ne=new Uint8Array(fe.data),ze=nt;nt=null,Kt(Ne,ze)}});const mr=()=>pe==null?void 0:pe.close();window.addEventListener("pagehide",mr);const Ui=fe=>!fe||!f.current||!d.current||!$()||!(pe!=null&&pe.isOpen())?!1:(pe.send(JSON.stringify({t:"input",data:fe})),!0);_.current=Ui;const le=P.onData(fe=>{if(!f.current||!d.current||!$()||!(pe!=null&&pe.isOpen()))return;const Ne=P7(mm(fe));if(!Ne)return;const ze=F7(mm(fe));if(p.current&&!b.current&&ze){N(ze),M(!0),P.blur();return}Ui(Ne)});let te;const $e=a.current,ve=fe=>{if(!(fe.metaKey||fe.ctrlKey)||fe.key!=="c"&&fe.key!=="C"||!$e||!h.current)return;const Ne=P.getSelection();if(!Ne)return;const ze=document.activeElement;ze&&!ze.classList.contains("xterm-helper-textarea")&&(ze.tagName==="TEXTAREA"||ze.tagName==="INPUT")&&ze.selectionStart!==ze.selectionEnd||(fe.preventDefault(),fe.stopPropagation(),H7(Ne).then(et=>{et&&(E(!0),clearTimeout(te),te=setTimeout(()=>E(!1),1200))}))};document.addEventListener("keydown",ve,!0);const Ke=requestAnimationFrame(ie),Ze=new ResizeObserver(ie);Ze.observe(a.current),window.addEventListener("resize",ie);let lt=0;const ht=()=>{var fe;if(!$()){(fe=x.current)==null||fe.call(x);return}u.current={cols:0,rows:0},ie();try{P.refresh(0,P.rows-1)}catch{}cancelAnimationFrame(lt),f.current&&d.current&&(lt=requestAnimationFrame(()=>{var ze;const Ne=(ze=a.current)==null?void 0:ze.querySelector(".xterm-helper-textarea");f.current&&d.current&&$()&&document.activeElement!==Ne&&P.focus()}))};return document.addEventListener("visibilitychange",ht),()=>{cancelAnimationFrame(Ke),cancelAnimationFrame(_e),cancelAnimationFrame(ue),cancelAnimationFrame(lt),clearTimeout(te),document.removeEventListener("keydown",ve,!0),document.removeEventListener("visibilitychange",ht),window.removeEventListener("pagehide",mr),Ze.disconnect(),window.removeEventListener("resize",ie);for(const fe of Y)fe.dispose();for(const fe of he)fe.dispose();O==null||O.removeEventListener("input",G),le.dispose(),qe(),pe.close(),P.dispose(),l.current=null,_.current=null,c.current=null,x.current=null}},[t]),A.useEffect(()=>{const P=!s;q(P),b.current=P,N(""),M(!1)},[t,s]);const I=()=>{var j;const P=C;M(!1),N(""),q(!0),b.current=!0,(j=_.current)==null||j.call(_,P),requestAnimationFrame(()=>{var O;f.current&&d.current&&h.current&&document.visibilityState!=="hidden"&&((O=l.current)==null||O.focus())})},z=()=>{M(!1),N("")};return A.useLayoutEffect(()=>{var G,$,ue;const P=l.current;if(!P)return;P.options.disableStdin=!r;let j=0;const O=(G=a.current)==null?void 0:G.querySelector(".xterm-helper-textarea");if(r&&i?O==null||O.setAttribute("data-focus-sink",""):O==null||O.removeAttribute("data-focus-sink"),e&&document.visibilityState!=="hidden"){u.current={cols:0,rows:0},($=c.current)==null||$.call(c);try{P.refresh(0,P.rows-1)}catch{}f.current&&i?j=requestAnimationFrame(()=>{var X,he;const Y=(X=a.current)==null?void 0:X.querySelector(".xterm-helper-textarea");f.current&&d.current&&h.current&&document.visibilityState!=="hidden"&&document.activeElement!==Y&&((he=l.current)==null||he.focus())}):P.blur()}else P.blur(),(ue=x.current)==null||ue.call(x);return()=>{cancelAnimationFrame(j),O==null||O.removeAttribute("data-focus-sink")}},[t,e,i]),A.useLayoutEffect(()=>{var O;const P=l.current;if(!P)return;P.options.disableStdin=!r;const j=(O=a.current)==null?void 0:O.querySelector(".xterm-helper-textarea");r||(j==null||j.removeAttribute("data-focus-sink"),P.blur())},[r]),A.useLayoutEffect(()=>{if(!n||!e||!i||!r||document.visibilityState==="hidden")return;const P=requestAnimationFrame(()=>{var O,G;const j=(O=a.current)==null?void 0:O.querySelector(".xterm-helper-textarea");h.current&&d.current&&f.current&&document.activeElement!==j&&((G=l.current)==null||G.focus())});return()=>cancelAnimationFrame(P)},[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:z,children:o("common.cancel")}),m.jsx("button",{type:"button",onClick:I,children:o("session.resumeInputConfirm")})]})]})}),S&&m.jsx("div",{className:"st-copyhint copied",children:"copied ✓"}),!S&&K==="reconnecting"&&m.jsx("div",{className:"st-copyhint reconnecting",children:"reconnecting…"})]})}const q7={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"},_3=t=>q7[t]||t||"tool",W7=["file_path","path","notebook_path","pattern","query","command","url","description"];function K7(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 W7){const r=e[i];if(typeof r=="string"&&r.trim())return r.trim()}return null}function V7(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 y3=3;function w3(t){const e=new Map;for(const r of t){const s=_3(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 vm(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 or={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)"},wu={working:"●",parked:"‖",asking:"?",review:"◑",done:"✓",error:"✕",idle:"·",starting:"◌",queued:"⋯","close-pending":"⊘",offline:"○",unknown:"⁇",corrupt:"⚠",retired:"⚑"},x3=new Set(["asking","review","done","close-pending","error","corrupt"]),i0=t=>{const e=(t==null?void 0:t.status)||"idle";return{zone:t!=null&&t.archived?"archive":x3.has(e)?"need":e==="offline"||e==="retired"?"offline":"run",status:e,color:or[e]||or.idle,glyph:wu[e]||wu.idle}},Uh=t=>i0(t).zone,S3=t=>!!(t!=null&&t.archived),bm=t=>S3(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",hR=(t,e)=>{const i=e?(t||[]).find(r=>r.id===e):null;return i&&i.status!=="offline"&&i.liveness!=="offline"&&!S3(i)?i:null},_m=t=>(t==null?void 0:t.sortKey)!=null?t.sortKey:(t==null?void 0:t.created)??0,ym=t=>{const e={need:0,run:1,offline:2,archive:3};return[...t].sort((i,r)=>e[Uh(i)]-e[Uh(r)]||_m(r)-_m(i))};function U7(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 G7(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 Y7(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=i0(l);x3.has(u.status)?i=!0:or[u.status]===or.working&&(r=!0),n(l.id,a)}};return n(t,new Set([t])),{color:i?or.asking:r?or.working:or.idle,count:s}}function Nf(t,e,{zoneFolded:i=()=>!1,keepVisible:r=()=>!1}={}){const{roots:s,childrenOf:n}=U7(t),o=[],a=(d,f,p,b)=>{const _=n.get(d.id)||[],x=_.length>0,S=x&&!!e(d.id),E=x?Y7(d.id,n):null;if(o.push({type:"row",s:d,depth:f,expandable:x,expanded:S,rollup:(E==null?void 0:E.color)??null,kin:(E==null?void 0:E.count)??0,guides:b}),S){const D=ym(_).filter(M=>!p.has(M.id));D.forEach((M,C)=>{p.add(M.id),a(M,f+1,p,[...b,C<D.length-1])})}},l=(d,f)=>{let p=1;for(const b of n.get(d.id)||[])f.has(b.id)||(f.add(b.id),p+=l(b,f));return p},u=new Set;let c=null,h=null;for(const d of ym(s)){if(u.has(d.id))continue;const f=Uh(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=[],b=(_,x)=>{r(_)&&!u.has(_.id)&&p.push(_);for(const S of n.get(_.id)||[])x.has(S.id)||(x.add(S.id),b(S,x))};b(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 dR=t=>Nf(t,()=>!0).filter(e=>e.type==="row").map(e=>e.s),wm={};function X7(t){let e=wm[t];if(e)return e;e=wm[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 so(t,e){typeof e!="string"&&(e=so.defaultChars);const i=X7(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})}so.defaultChars=";/?:@&=+$,#";so.componentChars="";const xm={};function J7(t){let e=xm[t];if(e)return e;e=xm[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 qa(t,e,i){typeof e!="string"&&(i=e,e=qa.defaultChars),typeof i>"u"&&(i=!0);const r=J7(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}qa.defaultChars=";/?:@&=+$,-_.!~*'()#";qa.componentChars="-_.!~*'()";function Lf(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 xu(){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 Z7=/^([a-z0-9.+-]+:)/i,Q7=/:[0-9]*$/,ew=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,tw=["<",">",'"',"`"," ","\r",`
40
+ `," "],iw=["{","}","|","\\","^","`"].concat(tw),rw=["'"].concat(iw),Sm=["%","/","?",";","#"].concat(rw),km=["/","?","#"],sw=255,Cm=/^[+a-z0-9A-Z_-]{0,63}$/,nw=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Am={javascript:!0,"javascript:":!0},Em={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Of(t,e){if(t&&t instanceof xu)return t;const i=new xu;return i.parse(t,e),i}xu.prototype.parse=function(t,e){let i,r,s,n=t;if(n=n.trim(),!e&&t.split("#").length===1){const u=ew.exec(n);if(u)return this.pathname=u[1],u[2]&&(this.search=u[2]),this}let o=Z7.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&&Am[o])&&(n=n.substr(2),this.slashes=!0)),!Am[o]&&(s||o&&!Em[o])){let u=-1;for(let p=0;p<km.length;p++)r=n.indexOf(km[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<Sm.length;p++)r=n.indexOf(Sm[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 b=0,_=p.length;b<_;b++){const x=p[b];if(x&&!x.match(Cm)){let S="";for(let E=0,D=x.length;E<D;E++)x.charCodeAt(E)>127?S+="x":S+=x[E];if(!S.match(Cm)){const E=p.slice(0,b),D=p.slice(b+1),M=x.match(nw);M&&(E.push(M[1]),D.unshift(M[2])),D.length&&(n=D.join(".")+n),this.hostname=E.join(".");break}}}}this.hostname.length>sw&&(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),Em[i]&&this.hostname&&!this.pathname&&(this.pathname=""),this};xu.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 ow=Object.freeze(Object.defineProperty({__proto__:null,decode:so,encode:qa,format:Lf,parse:Of},Symbol.toStringTag,{value:"Module"})),k3=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,C3=/[\0-\x1F\x7F-\x9F]/,aw=/[\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]/,Pf=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\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]/,A3=/[\$\+<->\^`\|~\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]/,E3=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,lw=Object.freeze(Object.defineProperty({__proto__:null,Any:k3,Cc:C3,Cf:aw,P:Pf,S:A3,Z:E3},Symbol.toStringTag,{value:"Module"})),uw=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))),cw=new Uint16Array("Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢".split("").map(t=>t.charCodeAt(0)));var oc;const hw=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]]),dw=(oc=String.fromCodePoint)!==null&&oc!==void 0?oc: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 fw(t){var e;return t>=55296&&t<=57343||t>1114111?65533:(e=hw.get(t))!==null&&e!==void 0?e:t}var Zt;(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"})(Zt||(Zt={}));const pw=32;var zs;(function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"})(zs||(zs={}));function Gh(t){return t>=Zt.ZERO&&t<=Zt.NINE}function mw(t){return t>=Zt.UPPER_A&&t<=Zt.UPPER_F||t>=Zt.LOWER_A&&t<=Zt.LOWER_F}function gw(t){return t>=Zt.UPPER_A&&t<=Zt.UPPER_Z||t>=Zt.LOWER_A&&t<=Zt.LOWER_Z||Gh(t)}function vw(t){return t===Zt.EQUALS||gw(t)}var Vt;(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"})(Vt||(Vt={}));var ts;(function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict",t[t.Attribute=2]="Attribute"})(ts||(ts={}));class bw{constructor(e,i,r){this.decodeTree=e,this.emitCodePoint=i,this.errors=r,this.state=Vt.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=ts.Strict}startEntity(e){this.decodeMode=e,this.state=Vt.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,i){switch(this.state){case Vt.EntityStart:return e.charCodeAt(i)===Zt.NUM?(this.state=Vt.NumericStart,this.consumed+=1,this.stateNumericStart(e,i+1)):(this.state=Vt.NamedEntity,this.stateNamedEntity(e,i));case Vt.NumericStart:return this.stateNumericStart(e,i);case Vt.NumericDecimal:return this.stateNumericDecimal(e,i);case Vt.NumericHex:return this.stateNumericHex(e,i);case Vt.NamedEntity:return this.stateNamedEntity(e,i)}}stateNumericStart(e,i){return i>=e.length?-1:(e.charCodeAt(i)|pw)===Zt.LOWER_X?(this.state=Vt.NumericHex,this.consumed+=1,this.stateNumericHex(e,i+1)):(this.state=Vt.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(Gh(s)||mw(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(Gh(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===Zt.SEMI)this.consumed+=1;else if(this.decodeMode===ts.Strict)return 0;return this.emitCodePoint(fw(this.result),this.consumed),this.errors&&(e!==Zt.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&zs.VALUE_LENGTH)>>14;for(;i<e.length;i++,this.excess++){const o=e.charCodeAt(i);if(this.treeIndex=_w(r,s,this.treeIndex+Math.max(1,n),o),this.treeIndex<0)return this.result===0||this.decodeMode===ts.Attribute&&(n===0||vw(o))?0:this.emitNotTerminatedNamedEntity();if(s=r[this.treeIndex],n=(s&zs.VALUE_LENGTH)>>14,n!==0){if(o===Zt.SEMI)return this.emitNamedEntityData(this.treeIndex,n,this.consumed+this.excess);this.decodeMode!==ts.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]&zs.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]&~zs.VALUE_LENGTH:s[e+1],r),i===3&&this.emitCodePoint(s[e+2],r),r}end(){var e;switch(this.state){case Vt.NamedEntity:return this.result!==0&&(this.decodeMode!==ts.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Vt.NumericDecimal:return this.emitNumericEntity(0,2);case Vt.NumericHex:return this.emitNumericEntity(0,3);case Vt.NumericStart:return(e=this.errors)===null||e===void 0||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Vt.EntityStart:return 0}}}function D3(t){let e="";const i=new bw(t,r=>e+=dw(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 _w(t,e,i,r){const s=(e&zs.BRANCH_LENGTH)>>7,n=e&zs.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 M3=D3(uw);D3(cw);function yw(t,e=ts.Legacy){return M3(t,e)}function ww(t){return M3(t,ts.Strict)}function xw(t){return Object.prototype.toString.call(t)}function Ff(t){return xw(t)==="[object String]"}const Sw=Object.prototype.hasOwnProperty;function kw(t,e){return Sw.call(t,e)}function r0(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 T3(t,e,i){return[].concat(t.slice(0,e),i,t.slice(e+1))}function If(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 ya(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 B3=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,Cw=/&([a-z#][a-z0-9]{1,31});/gi,Aw=new RegExp(B3.source+"|"+Cw.source,"gi"),Ew=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function Dw(t,e){if(e.charCodeAt(0)===35&&Ew.test(e)){const r=e[1].toLowerCase()==="x"?parseInt(e.slice(2),16):parseInt(e.slice(1),10);return If(r)?ya(r):t}const i=yw(t);return i!==t?i:t}function Mw(t){return t.indexOf("\\")<0?t:t.replace(B3,"$1")}function no(t){return t.indexOf("\\")<0&&t.indexOf("&")<0?t:t.replace(Aw,function(e,i,r){return i||Dw(e,r)})}const Tw=/[&<>"]/,Bw=/[&<>"]/g,Rw={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};function Nw(t){return Rw[t]}function qs(t){return Tw.test(t)?t.replace(Bw,Nw):t}const Lw=/[.?*+^$[\]\\(){}|-]/g;function Ow(t){return t.replace(Lw,"\\$&")}function at(t){switch(t){case 9:case 32:return!0}return!1}function wa(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 R3(t){return Pf.test(t)||A3.test(t)}function xa(t){return R3(ya(t))}function Sa(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 s0(t){return t=t.trim().replace(/\s+/g," "),"ẞ".toLowerCase()==="Ṿ"&&(t=t.replace(/ẞ/g,"ß")),t.toLowerCase().toUpperCase()}function Dm(t){return t===32||t===9||t===10||t===13}function n0(t){let e=0;for(;e<t.length&&Dm(t.charCodeAt(e));e++);let i=t.length-1;for(;i>=e&&Dm(t.charCodeAt(i));i--);return t.slice(e,i+1)}const Pw={mdurl:ow,ucmicro:lw},Fw=Object.freeze(Object.defineProperty({__proto__:null,arrayReplaceAt:T3,asciiTrim:n0,assign:r0,escapeHtml:qs,escapeRE:Ow,fromCodePoint:ya,has:kw,isMdAsciiPunct:Sa,isPunctChar:R3,isPunctCharCode:xa,isSpace:at,isString:Ff,isValidEntityCode:If,isWhiteSpace:wa,lib:Pw,normalizeReference:s0,unescapeAll:no,unescapeMd:Mw},Symbol.toStringTag,{value:"Module"}));function Iw(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 zw(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=no(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=no(t.slice(e,s)),n.pos=s,n.ok=!0),n}function jw(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+=no(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+=no(t.slice(e,n)),o}const Hw=Object.freeze(Object.defineProperty({__proto__:null,parseLinkDestination:zw,parseLinkLabel:Iw,parseLinkTitle:jw},Symbol.toStringTag,{value:"Module"})),qr={};qr.code_inline=function(t,e,i,r,s){const n=t[e];return"<code"+s.renderAttrs(n)+">"+qs(n.content)+"</code>"};qr.code_block=function(t,e,i,r,s){const n=t[e];return"<pre"+s.renderAttrs(n)+"><code>"+qs(t[e].content)+`</code></pre>
41
+ `};qr.fence=function(t,e,i,r,s){const n=t[e],o=n.info?no(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)||qs(n.content):u=qs(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
+ `};qr.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)};qr.hardbreak=function(t,e,i){return i.xhtmlOut?`<br />
45
+ `:`<br>
46
+ `};qr.softbreak=function(t,e,i){return i.breaks?i.xhtmlOut?`<br />
47
+ `:`<br>
48
+ `:`
49
+ `};qr.text=function(t,e){return qs(t[e].content)};qr.html_block=function(t,e){return t[e].content};qr.html_inline=function(t,e){return t[e].content};function yo(){this.rules=r0({},qr)}yo.prototype.renderAttrs=function(e){let i,r,s;if(!e.attrs)return"";for(s="",i=0,r=e.attrs.length;i<r;i++)s+=" "+qs(e.attrs[i][0])+'="'+qs(e.attrs[i][1])+'"';return s};yo.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};yo.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};yo.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};yo.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 Oi(){this.__rules__=[],this.__cache__=null}Oi.prototype.__find__=function(t){for(let e=0;e<this.__rules__.length;e++)if(this.__rules__[e].name===t)return e;return-1};Oi.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))})})};Oi.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};Oi.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};Oi.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};Oi.prototype.push=function(t,e,i){const r=i||{};this.__rules__.push({name:t,enabled:!0,fn:e,alt:r.alt||[]}),this.__cache__=null};Oi.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};Oi.prototype.enableOnly=function(t,e){Array.isArray(t)||(t=[t]),this.__rules__.forEach(function(i){i.enabled=!1}),this.enable(t,e)};Oi.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};Oi.prototype.getRules=function(t){return this.__cache__===null&&this.__compile__(),this.__cache__[t]||[]};function pr(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}pr.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};pr.prototype.attrPush=function(e){this.attrs?this.attrs.push(e):this.attrs=[e]};pr.prototype.attrSet=function(e,i){const r=this.attrIndex(e),s=[e,i];r<0?this.attrPush(s):this.attrs[r]=s};pr.prototype.attrGet=function(e){const i=this.attrIndex(e);let r=null;return i>=0&&(r=this.attrs[i][1]),r};pr.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 N3(t,e,i){this.src=t,this.env=i,this.tokens=[],this.inlineMode=!1,this.md=e}N3.prototype.Token=pr;const $w=/\r\n?|\n/g,qw=/\0/g;function Ww(t){let e;e=t.src.replace($w,`
53
+ `),e=e.replace(qw,"�"),t.src=e}function Kw(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 Vw(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 Uw(t){return/^<a[>\s]/i.test(t)}function Gw(t){return/^<\/a\s*>/i.test(t)}function Yw(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"&&(Uw(a.content)&&n>0&&n--,Gw(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,b=t.md.normalizeLink(p);if(!t.md.validateLink(b))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 x=u[f].index;if(x>d){const M=new t.Token("text","",0);M.content=l.slice(d,x),M.level=h,c.push(M)}const S=new t.Token("link_open","a",1);S.attrs=[["href",b]],S.level=h++,S.markup="linkify",S.info="auto",c.push(S);const E=new t.Token("text","",0);E.content=_,E.level=h,c.push(E);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=T3(s,o,c)}}}}const L3=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,Xw=/\((c|tm|r)\)/i,Jw=/\((c|tm|r)\)/ig,Zw={c:"©",r:"®",tm:"™"};function Qw(t,e){return Zw[e.toLowerCase()]}function ex(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(Jw,Qw)),r.type==="link_open"&&r.info==="auto"&&e--,r.type==="link_close"&&r.info==="auto"&&e++}}function tx(t){let e=0;for(let i=t.length-1;i>=0;i--){const r=t[i];r.type==="text"&&!e&&L3.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 ix(t){let e;if(t.md.options.typographer)for(e=t.tokens.length-1;e>=0;e--)t.tokens[e].type==="inline"&&(Xw.test(t.tokens[e].content)&&ex(t.tokens[e].children),L3.test(t.tokens[e].content)&&tx(t.tokens[e].children))}const rx=/['"]/,Mm=/['"]/g,Tm="’";function fl(t,e,i,r){t[e]||(t[e]=[]),t[e].push({pos:i,ch:r})}function sx(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 nx(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;){Mm.lastIndex=u;const h=Mm.exec(l);if(!h)break;let d=!0,f=!0;u=h.index+1;const p=h[0]==="'";let b=32;if(h.index-1>=0)b=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){b=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 x=Sa(b)||xa(b),S=Sa(_)||xa(_),E=wa(b),D=wa(_);if(D?d=!1:S&&(E||x||(d=!1)),E?f=!1:x&&(D||S||(f=!1)),_===34&&h[0]==='"'&&b>=48&&b<=57&&(f=d=!1),d&&f&&(d=x,f=S),!d&&!f){p&&fl(s,n,h.index,Tm);continue}if(f)for(i=r.length-1;i>=0;i--){let M=r[i];if(r[i].level<a)break;if(M.single===p&&r[i].level===a){M=r[i];let C,N;p?(C=e.md.options.quotes[2],N=e.md.options.quotes[3]):(C=e.md.options.quotes[0],N=e.md.options.quotes[1]),fl(s,n,h.index,N),fl(s,M.token,M.pos,C),r.length=i;continue e}}d?r.push({token:n,pos:h.index,single:p,level:a}):f&&p&&fl(s,n,h.index,Tm)}}Object.keys(s).forEach(function(n){t[n].content=sx(t[n].content,s[n])})}function ox(t){if(t.md.options.typographer)for(let e=t.tokens.length-1;e>=0;e--)t.tokens[e].type!=="inline"||!rx.test(t.tokens[e].content)||nx(t.tokens[e].children,t)}function ax(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 ac=[["normalize",Ww],["block",Kw],["inline",Vw],["linkify",Yw],["replacements",ix],["smartquotes",ox],["text_join",ax]];function zf(){this.ruler=new Oi;for(let t=0;t<ac.length;t++)this.ruler.push(ac[t][0],ac[t][1])}zf.prototype.process=function(t){const e=this.ruler.getRules("");for(let i=0,r=e.length;i<r;i++)e[i](t)};zf.prototype.State=N3;function Wr(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(at(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}Wr.prototype.push=function(t,e,i){const r=new pr(t,e,i);return r.block=!0,i<0&&this.level--,r.level=this.level,i>0&&this.level++,this.tokens.push(r),r};Wr.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]};Wr.prototype.skipEmptyLines=function(e){for(let i=this.lineMax;e<i&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e};Wr.prototype.skipSpaces=function(e){for(let i=this.src.length;e<i;e++){const r=this.src.charCodeAt(e);if(!at(r))break}return e};Wr.prototype.skipSpacesBack=function(e,i){if(e<=i)return e;for(;e>i;)if(!at(this.src.charCodeAt(--e)))return e+1;return e};Wr.prototype.skipChars=function(e,i){for(let r=this.src.length;e<r&&this.src.charCodeAt(e)===i;e++);return e};Wr.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};Wr.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(at(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("")};Wr.prototype.Token=pr;const lx=65536;function lc(t,e){const i=t.bMarks[e]+t.tShift[e],r=t.eMarks[e];return t.src.slice(i,r)}function Bm(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 ux(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&&!at(a)||o===45&&at(a))return!1;for(;n<t.eMarks[s];){const D=t.src.charCodeAt(n);if(D!==124&&D!==45&&D!==58&&!at(D))return!1;n++}let l=lc(t,e+1),u=l.split("|");const c=[];for(let D=0;D<u.length;D++){const M=u[D].trim();if(!M){if(D===0||D===u.length-1)continue;return!1}if(!/^:?-+:?$/.test(M))return!1;M.charCodeAt(M.length-1)===58?c.push(M.charCodeAt(0)===58?"center":"right"):M.charCodeAt(0)===58?c.push("left"):c.push("")}if(l=lc(t,e).trim(),l.indexOf("|")===-1||t.sCount[e]-t.blkIndent>=4)return!1;u=Bm(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),b=[e,0];p.map=b;const _=t.push("thead_open","thead",1);_.map=[e,e+1];const x=t.push("tr_open","tr",1);x.map=[e,e+1];for(let D=0;D<u.length;D++){const M=t.push("th_open","th",1);c[D]&&(M.attrs=[["style","text-align:"+c[D]]]);const C=t.push("inline","",0);C.content=u[D].trim(),C.children=[],t.push("th_close","th",-1)}t.push("tr_close","tr",-1),t.push("thead_close","thead",-1);let S,E=0;for(s=e+2;s<i&&!(t.sCount[s]<t.blkIndent);s++){let D=!1;for(let C=0,N=f.length;C<N;C++)if(f[C](t,s,i,!0)){D=!0;break}if(D||(l=lc(t,s).trim(),!l)||t.sCount[s]-t.blkIndent>=4||(u=Bm(l),u.length&&u[0]===""&&u.shift(),u.length&&u[u.length-1]===""&&u.pop(),E+=h-u.length,E>lx))break;if(s===e+2){const C=t.push("tbody_open","tbody",1);C.map=S=[e+2,0]}const M=t.push("tr_open","tr",1);M.map=[s,s+1];for(let C=0;C<h;C++){const N=t.push("td_open","td",1);c[C]&&(N.attrs=[["style","text-align:"+c[C]]]);const W=t.push("inline","",0);W.content=u[C]?u[C].trim():"",W.children=[],t.push("td_close","td",-1)}t.push("tr_close","tr",-1)}return S&&(t.push("tbody_close","tbody",-1),S[1]=s),t.push("table_close","table",-1),b[1]=s,t.parentType=d,t.line=s,!0}function cx(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 hx(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 dx(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 E=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&&!E){let M=t.sCount[p]+1,C,N;t.src.charCodeAt(s)===32?(s++,M++,N=!1,C=!0):t.src.charCodeAt(s)===9?(C=!0,(t.bsCount[p]+M)%4===3?(s++,M++,N=!1):N=!0):C=!1;let W=M;for(a.push(t.bMarks[p]),t.bMarks[p]=s;s<n;){const q=t.src.charCodeAt(s);if(at(q))q===9?W+=4-(W+t.bsCount[p]+(N?1:0))%4:W++;else break;s++}f=s>=n,l.push(t.bsCount[p]),t.bsCount[p]=t.sCount[p]+1+(C?1:0),u.push(t.sCount[p]),t.sCount[p]=W-M,c.push(t.tShift[p]),t.tShift[p]=s-t.bMarks[p];continue}if(f)break;let D=!1;for(let M=0,C=h.length;M<C;M++)if(h[M](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 b=t.blkIndent;t.blkIndent=0;const _=t.push("blockquote_open","blockquote",1);_.markup=">";const x=[e,0];_.map=x,t.md.block.tokenize(t,e,p);const S=t.push("blockquote_close","blockquote",-1);S.markup=">",t.lineMax=o,t.parentType=d,x[1]=t.line;for(let E=0;E<c.length;E++)t.bMarks[E+e]=a[E],t.tShift[E+e]=c[E],t.sCount[E+e]=u[E],t.bsCount[E+e]=l[E];return t.blkIndent=b,!0}function fx(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&&!at(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 Rm(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(!at(n))return-1}return r}function Nm(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),!at(n))?-1:s}function px(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 mx(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=Nm(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=Rm(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),b=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 x=!1;const S=t.md.block.ruler.getRules("list"),E=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 M=D;for(;n<s;){const j=t.src.charCodeAt(n);if(j===9)M+=4-(M+t.bsCount[l])%4;else if(j===32)M++;else break;n++}const C=n;let N;C>=s?N=1:N=M-D,N>4&&(N=1);const W=D+N;a=t.push("list_item_open","li",1),a.markup=String.fromCharCode(p);const q=[l,0];a.map=q,h&&(a.info=t.src.slice(o,f-1));const K=t.tight,V=t.tShift[l],I=t.sCount[l],z=t.listIndent;if(t.listIndent=t.blkIndent,t.blkIndent=W,t.tight=!0,t.tShift[l]=C-t.bMarks[l],t.sCount[l]=M,C>=s&&t.isEmpty(l+1)?t.line=Math.min(t.line+2,i):t.md.block.tokenize(t,l,i,!0),(!t.tight||x)&&(u=!1),x=t.line-l>1&&t.isEmpty(t.line-1),t.blkIndent=t.listIndent,t.listIndent=z,t.tShift[l]=V,t.sCount[l]=I,t.tight=K,a=t.push("list_item_close","li",-1),a.markup=String.fromCharCode(p),l=t.line,q[1]=l,l>=i||t.sCount[l]<t.blkIndent||t.sCount[l]-t.blkIndent>=4)break;let P=!1;for(let j=0,O=S.length;j<O;j++)if(S[j](t,l,i,!0)){P=!0;break}if(P)break;if(h){if(f=Nm(t,l),f<0)break;o=t.bMarks[l]+t.tShift[l]}else if(f=Rm(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=E,u&&px(t,b),!0}function gx(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(S){const E=t.lineMax;if(S>=E||t.isEmpty(S))return null;let D=!1;if(t.sCount[S]-t.blkIndent>3&&(D=!0),t.sCount[S]<0&&(D=!0),!D){const N=t.md.block.ruler.getRules("reference"),W=t.parentType;t.parentType="reference";let q=!1;for(let K=0,V=N.length;K<V;K++)if(N[K](t,S,E,!0)){q=!0;break}if(t.parentType=W,q)return null}const M=t.bMarks[S]+t.tShift[S],C=t.eMarks[S];return t.src.slice(M,C+1)}let l=t.src.slice(s,n+1);n=l.length;let u=-1;for(s=1;s<n;s++){const S=l.charCodeAt(s);if(S===91)return!1;if(S===93){u=s;break}else if(S===10){const E=a(o);E!==null&&(l+=E,n=l.length,o++)}else if(S===92&&(s++,s<n&&l.charCodeAt(s)===10)){const E=a(o);E!==null&&(l+=E,n=l.length,o++)}}if(u<0||l.charCodeAt(u+1)!==58)return!1;for(s=u+2;s<n;s++){const S=l.charCodeAt(s);if(S===10){const E=a(o);E!==null&&(l+=E,n=l.length,o++)}else if(!at(S))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 S=l.charCodeAt(s);if(S===10){const E=a(o);E!==null&&(l+=E,n=l.length,o++)}else if(!at(S))break}let b=t.md.helpers.parseLinkTitle(l,s,n);for(;b.can_continue;){const S=a(o);if(S===null)break;l+=S,s=n,n=l.length,o++,b=t.md.helpers.parseLinkTitle(l,s,n,b)}let _;for(s<n&&p!==s&&b.ok?(_=b.str,s=b.pos):(_="",s=d,o=f);s<n;){const S=l.charCodeAt(s);if(!at(S))break;s++}if(s<n&&l.charCodeAt(s)!==10&&_)for(_="",s=d,o=f;s<n;){const S=l.charCodeAt(s);if(!at(S))break;s++}if(s<n&&l.charCodeAt(s)!==10)return!1;const x=s0(l.slice(1,u));return x?(r||(typeof t.env.references>"u"&&(t.env.references={}),typeof t.env.references[x]>"u"&&(t.env.references[x]={title:_,href:h}),t.line=o),!0):!1}const vx=["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"],bx="[a-zA-Z_:][a-zA-Z0-9:._-]*",_x="[^\"'=<>`\\x00-\\x20]+",yx="'[^']*'",wx='"[^"]*"',xx="(?:"+_x+"|"+yx+"|"+wx+")",Sx="(?:\\s+"+bx+"(?:\\s*=\\s*"+xx+")?)",O3="<[A-Za-z][A-Za-z0-9\\-]*"+Sx+"*\\s*\\/?>",P3="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",kx="<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->",Cx="<[?][\\s\\S]*?[?]>",Ax="<![A-Za-z][^>]*>",Ex="<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",Dx=new RegExp("^(?:"+O3+"|"+P3+"|"+kx+"|"+Cx+"|"+Ax+"|"+Ex+")"),Mx=new RegExp("^(?:"+O3+"|"+P3+")"),sn=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+vx.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(Mx.source+"\\s*$"),/^$/,!1]];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||!t.md.options.html||t.src.charCodeAt(s)!==60)return!1;let o=t.src.slice(s,n),a=0;for(;a<sn.length&&!sn[a][0].test(o);a++);if(a===sn.length)return!1;if(r)return sn[a][2];let l=e+1;const u=sn[a][1].test("");if(!sn[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),sn[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 Bx(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&&!at(o))return!1;if(r)return!0;n=t.skipSpacesBack(n,s);const l=t.skipCharsBack(n,35,s);l>s&&at(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=n0(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 Rx(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=n0(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 Nx(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=n0(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 pl=[["table",ux,["paragraph","reference"]],["code",cx],["fence",hx,["paragraph","reference","blockquote","list"]],["blockquote",dx,["paragraph","reference","blockquote","list"]],["hr",fx,["paragraph","reference","blockquote","list"]],["list",mx,["paragraph","reference","blockquote"]],["reference",gx],["html_block",Tx,["paragraph","reference","blockquote"]],["heading",Bx,["paragraph","reference","blockquote"]],["lheading",Rx],["paragraph",Nx]];function o0(){this.ruler=new Oi;for(let t=0;t<pl.length;t++)this.ruler.push(pl[t][0],pl[t][1],{alt:(pl[t][2]||[]).slice()})}o0.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)}};o0.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)};o0.prototype.State=Wr;function Wa(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}Wa.prototype.pushPending=function(){const t=new pr("text","",0);return t.content=this.pending,t.level=this.pendingLevel,this.tokens.push(t),this.pending="",t};Wa.prototype.push=function(t,e,i){this.pending&&this.pushPending();const r=new pr(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};Wa.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=Sa(s)||xa(s),u=Sa(a)||xa(a),c=wa(s),h=wa(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}};Wa.prototype.Token=pr;function Lx(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 Ox(t,e){let i=t.pos;for(;i<t.posMax&&!Lx(t.src.charCodeAt(i));)i++;return i===t.pos?!1:(e||(t.pending+=t.src.slice(t.pos,i)),t.pos=i,!0)}const Px=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function Fx(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(Px);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 Ix(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&&at(t.src.charCodeAt(i));)i++;return t.pos=i,!0}const jf=[];for(let t=0;t<256;t++)jf.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(t){jf[t.charCodeAt(0)]=1});function zx(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),!!at(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&&jf[s]!==0?a.content=n:a.content=o,a.markup=o,a.info="escape"}return t.pos=i+1,!0}function jx(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 Hx(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 Lm(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 $x(t){const e=t.tokens_meta,i=t.tokens_meta.length;Lm(t,t.delimiters);for(let r=0;r<i;r++)e[r]&&e[r].delimiters&&Lm(t,e[r].delimiters)}const F3={tokenize:Hx,postProcess:$x};function qx(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 Om(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 Wx(t){const e=t.tokens_meta,i=t.tokens_meta.length;Om(t,t.delimiters);for(let r=0;r<i;r++)e[r]&&e[r].delimiters&&Om(t,e[r].delimiters)}const I3={tokenize:qx,postProcess:Wx};function Kx(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),!(!at(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),!(!at(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),!(!at(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[s0(r)],!n)return t.pos=c,!1;o=n.href,a=n.title}if(!e){t.pos=d,t.posMax=f;const b=t.push("link_open","a",1),_=[["href",o]];b.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 Vx(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),!(!at(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),!(!at(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),!(!at(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[s0(s)],!o)return t.pos=h,!1;c=o.href,l=o.title}if(!e){r=t.src.slice(f,p);const b=[];t.md.inline.parse(r,t.md,t.env,b);const _=t.push("image","img",0),x=[["src",c],["alt",""]];_.attrs=x,_.children=b,_.content=r,l&&x.push(["title",l])}return t.pos=n,t.posMax=d,!0}const Ux=/^([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])?)*)$/,Gx=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function Yx(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(Gx.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(Ux.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 Xx(t){return/^<a[>\s]/i.test(t)}function Jx(t){return/^<\/a\s*>/i.test(t)}function Zx(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&&!Zx(s))return!1;const n=t.src.slice(r).match(Dx);if(!n)return!1;if(!e){const o=t.push("html_inline","",0);o.content=n[0],Xx(o.content)&&t.linkLevel++,Jx(o.content)&&t.linkLevel--}return t.pos+=n[0].length,!0}const eS=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,tS=/^&([a-z][a-z0-9]{1,31});/i;function iS(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(eS);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=If(o)?ya(o):ya(65533),a.markup=n[0],a.info="entity"}return t.pos+=n[0].length,!0}}else{const n=t.src.slice(i).match(tS);if(n){const o=ww(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 rS(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 sS(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 uc=[["text",Ox],["linkify",Fx],["newline",Ix],["escape",zx],["backticks",jx],["strikethrough",F3.tokenize],["emphasis",I3.tokenize],["link",Kx],["image",Vx],["autolink",Yx],["html_inline",Qx],["entity",iS]],cc=[["balance_pairs",rS],["strikethrough",F3.postProcess],["emphasis",I3.postProcess],["fragments_join",sS]];function Ka(){this.ruler=new Oi;for(let t=0;t<uc.length;t++)this.ruler.push(uc[t][0],uc[t][1]);this.ruler2=new Oi;for(let t=0;t<cc.length;t++)this.ruler2.push(cc[t][0],cc[t][1])}Ka.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};Ka.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()};Ka.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)};Ka.prototype.State=Wa;function nS(t){const e={};t=t||{},e.src_Any=k3.source,e.src_Cc=C3.source,e.src_Z=E3.source,e.src_P=Pf.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 Yh(t){return Array.prototype.slice.call(arguments,1).forEach(function(i){i&&Object.keys(i).forEach(function(r){t[r]=i[r]})}),t}function a0(t){return Object.prototype.toString.call(t)}function oS(t){return a0(t)==="[object String]"}function aS(t){return a0(t)==="[object Object]"}function lS(t){return a0(t)==="[object RegExp]"}function Fm(t){return a0(t)==="[object Function]"}function uS(t){return t.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const z3={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function cS(t){return Object.keys(t||{}).reduce(function(e,i){return e||z3.hasOwnProperty(i)},!1)}const hS={"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}}},dS="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]",fS="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function pS(t){return function(e,i){const r=e.slice(i);return t.test(r)?r.match(t)[0].length:0}}function Im(){return function(t,e){e.normalize(t)}}function Su(t){const e=t.re=nS(t.__opts__),i=t.__tlds__.slice();t.onCompile(),t.__tlds_replaced__||i.push(dS),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,aS(l)){lS(l.validate)?u.validate=pS(l.validate):Fm(l.validate)?u.validate=l.validate:n(a,l),Fm(l.normalize)?u.normalize=l.normalize:l.normalize?n(a,l):u.normalize=Im();return}if(oS(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:Im()};const o=Object.keys(t.__compiled__).filter(function(a){return a.length>0&&t.__compiled__[a]}).map(uS).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 j3(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 $i(t,e){if(!(this instanceof $i))return new $i(t,e);e||cS(t)&&(e=t,t={}),this.__opts__=Yh({},z3,e),this.__schemas__=Yh({},hS,t),this.__compiled__={},this.__tlds__=fS,this.__tlds_replaced__=!1,this.re={},Su(this)}$i.prototype.add=function(e,i){return this.__schemas__[e]=i,Su(this),this};$i.prototype.set=function(e){return this.__opts__=Yh(this.__opts__,e),this};$i.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)};$i.prototype.pretest=function(e){return this.re.pretest.test(e)};$i.prototype.testSchemaAt=function(e,i,r){return this.__compiled__[i.toLowerCase()]?this.__compiled__[i.toLowerCase()].validate(e,r,this):0};$i.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 j3(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};$i.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 j3(e,i[2],i.index+i[1].length,i.index+i[0].length+r);return this.__compiled__[s.schema].normalize(s,this),s};$i.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(),Su(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,Su(this),this)};$i.prototype.normalize=function(e){e.schema||(e.url=`http://${e.url}`),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:${e.url}`)};$i.prototype.onCompile=function(){};const Xn=2147483647,Br=36,Hf=1,ka=26,mS=38,gS=700,H3=72,$3=128,q3="-",vS=/^xn--/,bS=/[^\0-\x7F]/,_S=/[\x2E\u3002\uFF0E\uFF61]/g,yS={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},hc=Br-Hf,Rr=Math.floor,dc=String.fromCharCode;function Bs(t){throw new RangeError(yS[t])}function wS(t,e){const i=[];let r=t.length;for(;r--;)i[r]=e(t[r]);return i}function W3(t,e){const i=t.split("@");let r="";i.length>1&&(r=i[0]+"@",t=i[1]),t=t.replace(_S,".");const s=t.split("."),n=wS(s,e).join(".");return r+n}function K3(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 xS=t=>String.fromCodePoint(...t),SS=function(t){return t>=48&&t<58?26+(t-48):t>=65&&t<91?t-65:t>=97&&t<123?t-97:Br},zm=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},V3=function(t,e,i){let r=0;for(t=i?Rr(t/gS):t>>1,t+=Rr(t/e);t>hc*ka>>1;r+=Br)t=Rr(t/hc);return Rr(r+(hc+1)*t/(t+mS))},U3=function(t){const e=[],i=t.length;let r=0,s=$3,n=H3,o=t.lastIndexOf(q3);o<0&&(o=0);for(let a=0;a<o;++a)t.charCodeAt(a)>=128&&Bs("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=Br;;h+=Br){a>=i&&Bs("invalid-input");const d=SS(t.charCodeAt(a++));d>=Br&&Bs("invalid-input"),d>Rr((Xn-r)/c)&&Bs("overflow"),r+=d*c;const f=h<=n?Hf:h>=n+ka?ka:h-n;if(d<f)break;const p=Br-f;c>Rr(Xn/p)&&Bs("overflow"),c*=p}const u=e.length+1;n=V3(r-l,u,l==0),Rr(r/u)>Xn-s&&Bs("overflow"),s+=Rr(r/u),r%=u,e.splice(r++,0,s)}return String.fromCodePoint(...e)},G3=function(t){const e=[];t=K3(t);const i=t.length;let r=$3,s=0,n=H3;for(const l of t)l<128&&e.push(dc(l));const o=e.length;let a=o;for(o&&e.push(q3);a<i;){let l=Xn;for(const c of t)c>=r&&c<l&&(l=c);const u=a+1;l-r>Rr((Xn-s)/u)&&Bs("overflow"),s+=(l-r)*u,r=l;for(const c of t)if(c<r&&++s>Xn&&Bs("overflow"),c===r){let h=s;for(let d=Br;;d+=Br){const f=d<=n?Hf:d>=n+ka?ka:d-n;if(h<f)break;const p=h-f,b=Br-f;e.push(dc(zm(f+p%b,0))),h=Rr(p/b)}e.push(dc(zm(h,0))),n=V3(s,u,a===o),s=0,++a}++s,++r}return e.join("")},kS=function(t){return W3(t,function(e){return vS.test(e)?U3(e.slice(4).toLowerCase()):e})},CS=function(t){return W3(t,function(e){return bS.test(e)?"xn--"+G3(e):e})},Y3={version:"2.3.1",ucs2:{decode:K3,encode:xS},decode:U3,encode:G3,toASCII:CS,toUnicode:kS},AS={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},ES={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"]}}},DS={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"]}}},MS={default:AS,zero:ES,commonmark:DS},TS=/^(vbscript|javascript|file|data):/,BS=/^data:image\/(gif|png|jpeg|webp);/;function RS(t){const e=t.trim().toLowerCase();return TS.test(e)?BS.test(e):!0}const X3=["http:","https:","mailto:"];function NS(t){const e=Of(t,!0);if(e.hostname&&(!e.protocol||X3.indexOf(e.protocol)>=0))try{e.hostname=Y3.toASCII(e.hostname)}catch{}return qa(Lf(e))}function LS(t){const e=Of(t,!0);if(e.hostname&&(!e.protocol||X3.indexOf(e.protocol)>=0))try{e.hostname=Y3.toUnicode(e.hostname)}catch{}return so(Lf(e),so.defaultChars+"%")}function tr(t,e){if(!(this instanceof tr))return new tr(t,e);e||Ff(t)||(e=t||{},t="default"),this.inline=new Ka,this.block=new o0,this.core=new zf,this.renderer=new yo,this.linkify=new $i,this.validateLink=RS,this.normalizeLink=NS,this.normalizeLinkText=LS,this.utils=Fw,this.helpers=r0({},Hw),this.options={},this.configure(t),e&&this.set(e)}tr.prototype.set=function(t){return r0(this.options,t),this};tr.prototype.configure=function(t){const e=this;if(Ff(t)){const i=t;if(t=MS[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};tr.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};tr.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};tr.prototype.use=function(t){const e=[this].concat(Array.prototype.slice.call(arguments,1));return t.apply(t,e),this};tr.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};tr.prototype.render=function(t,e){return e=e||{},this.renderer.render(this.parse(t,e),this.options,e)};tr.prototype.parseInline=function(t,e){const i=new this.core.State(t,this,e);return i.inlineMode=!0,this.core.process(i),i.tokens};tr.prototype.renderInline=function(t,e){return e=e||{},this.renderer.render(this.parseInline(t,e),this.options,e)};class re 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,re.prototype),this.position=s,s!=null&&n!=null&&(this.length=n-s),this.rawMessage=e}}var OS=/([A-Z])/g,PS=t=>t.replace(OS,"-$1").toLowerCase(),FS={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},IS=/[&><"']/g,hi=t=>String(t).replace(IS,e=>FS[e]),su=t=>t.type==="ordgroup"||t.type==="color"?t.body.length===1?su(t.body[0]):t:t.type==="font"?su(t.body):t,zS=new Set(["mathord","textord","atom"]),ps=t=>zS.has(su(t).type),jS=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"},Xh={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 HS(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 $S(t){if(t.default!==void 0)return t.default;var e=Array.isArray(t.type)?t.type[0]:t.type;return HS(e)}function qS(t,e,i,r){var s=i[e];t[e]=s!==void 0?r.processor?r.processor(s):s:$S(r)}let $f=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(Xh)){var r=Xh[i];r&&qS(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 re("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=jS(e.url);if(i==null)return!1;e.protocol=i}var r=typeof this.trust=="function"?this.trust(e):this.trust;return!!r}};class Ds{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 Er[WS[this.id]]}sub(){return Er[KS[this.id]]}fracNum(){return Er[VS[this.id]]}fracDen(){return Er[US[this.id]]}cramp(){return Er[GS[this.id]]}text(){return Er[YS[this.id]]}isTight(){return this.size>=2}}var qf=0,ku=1,Jn=2,ns=3,Ca=4,Zi=5,oo=6,xi=7,Er=[new Ds(qf,0,!1),new Ds(ku,0,!0),new Ds(Jn,1,!1),new Ds(ns,1,!0),new Ds(Ca,2,!1),new Ds(Zi,2,!0),new Ds(oo,3,!1),new Ds(xi,3,!0)],WS=[Ca,Zi,Ca,Zi,oo,xi,oo,xi],KS=[Zi,Zi,Zi,Zi,xi,xi,xi,xi],VS=[Jn,ns,Ca,Zi,oo,xi,oo,xi],US=[ns,ns,Zi,Zi,xi,xi,xi,xi],GS=[ku,ku,ns,ns,Zi,Zi,xi,xi],YS=[qf,ku,Jn,ns,Jn,ns,Jn,ns],Be={DISPLAY:Er[qf],TEXT:Er[Jn],SCRIPT:Er[Ca],SCRIPTSCRIPT:Er[oo]},Jh=[{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 XS(t){for(var e=0;e<Jh.length;e++)for(var i=Jh[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 nu=[];Jh.forEach(t=>t.blocks.forEach(e=>nu.push(...e)));function J3(t){for(var e=0;e<nu.length;e+=2)if(t>=nu[e]&&t<=nu[e+1])return!0;return!1}var Ht=t=>t+" "+t,jn=80,JS=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"},ZS=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"},e9=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"},t9=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"},i9=function(e){var i=e/2;return"M400000 "+e+" H0 L"+i+" 0 l65 45 L145 "+(e-80)+" H400000z"},r9=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"},s9=function(e,i,r){i=1e3*i;var s="";switch(e){case"sqrtMain":s=JS(i,jn);break;case"sqrtSize1":s=ZS(i,jn);break;case"sqrtSize2":s=QS(i,jn);break;case"sqrtSize3":s=e9(i,jn);break;case"sqrtSize4":s=t9(i,jn);break;case"sqrtTall":s=r9(i,jn,r)}return s},n9=function(e,i){switch(e){case"⎜":return Ht("M291 0 H417 V"+i+" H291z");case"∣":return Ht("M145 0 H188 V"+i+" H145z");case"∥":return Ht("M145 0 H188 V"+i+" H145z")+Ht("M367 0 H410 V"+i+" H367z");case"⎟":return Ht("M457 0 H583 V"+i+" H457z");case"⎢":return Ht("M319 0 H403 V"+i+" H319z");case"⎥":return Ht("M263 0 H347 V"+i+" H263z");case"⎪":return Ht("M384 0 H504 V"+i+" H384z");case"⏐":return Ht("M312 0 H355 V"+i+" H312z");case"‖":return Ht("M257 0 H300 V"+i+" H257z")+Ht("M478 0 H521 V"+i+" H478z");default:return""}},jm={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:Ht("M40 281 V428 H0 V94 H40 V241 H400000 v40z"),leftbracketunder:Ht("M0 0 h120 V290 H399995 v120 H0z"),leftbracketover:Ht("M0 440 h120 V150 H399995 v-120 H0z"),leftmapsto:Ht("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:Ht("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:Ht("M399960 241 V94 h40 V428 h-40 V281 H0 v-40z"),rightbracketunder:Ht("M399995 0 h-120 V290 H0 v120 H400000z"),rightbracketover:Ht("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`},o9=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 a9(t){return"toText"in t}class wo{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(a9(e))return e.toText();throw new Error("Expected MathDomNode with toText, got "+e.constructor.name)}).join("")}}var Zh={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},l9={ex:!0,em:!0,mu:!0},Z3=function(e){return typeof e!="string"&&(e=e.unit),e in Zh||e in l9||e==="ex"},wt=function(e,i){var r;if(e.unit in Zh)r=Zh[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 re("Invalid unit: '"+e.unit+"'");s!==i&&(r*=s.sizeMultiplier/i.sizeMultiplier)}return Math.min(e.number*r,i.maxSize)},oe=function(e){return+e.toFixed(4)+"em"},Ws=function(e){return e.filter(i=>i).join(" ")},Wf=function(e){var i="";for(var r of Object.keys(e)){var s=e[r];s!==void 0&&(i+=PS(r)+":"+s+";")}return i},Q3=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)}},ev=function(e){var i=document.createElement(e);i.className=Ws(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},u9=/[\s"'>/=\x00-\x1f]/,tv=function(e){var i="<"+e;this.classes.length&&(i+=' class="'+hi(Ws(this.classes))+'"');var r=Wf(this.style);r&&(i+=' style="'+hi(r)+'"');for(var s of Object.keys(this.attributes)){if(u9.test(s))throw new re("Invalid attribute name '"+s+"'");i+=" "+s+'="'+hi(this.attributes[s])+'"'}i+=">";for(var n=0;n<this.children.length;n++)i+=this.children[n].toMarkup();return i+="</"+e+">",i};class xo{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,Q3.call(this,e,r,s),this.children=i||[]}setAttribute(e,i){this.attributes[e]=i}hasClass(e){return this.classes.includes(e)}toNode(){return ev.call(this,"span")}toMarkup(){return tv.call(this,"span")}}class l0{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,Q3.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 ev.call(this,"a")}toMarkup(){return tv.call(this,"a")}}class c9{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="'+hi(this.src)+'"'+(' alt="'+hi(this.alt)+'"'),i=Wf(this.style);return i&&(e+=' style="'+hi(i)+'"'),e+="'/>",e}}var h9={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class qi{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=XS(this.text.charCodeAt(0));u&&this.classes.push(u+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=h9[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=oe(this.italic)),this.classes.length>0&&(i=i||document.createElement("span"),i.className=Ws(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+=hi(Ws(this.classes)),i+='"');var r="";this.italic>0&&(r+="margin-right:"+oe(this.italic)+";"),r+=Wf(this.style),r&&(e=!0,i+=' style="'+hi(r)+'"');var s=hi(this.text);return e?(i+=">",i+=s,i+="</span>",i):s}}class us{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+'="'+hi(this.attributes[i])+'"';e+=">";for(var r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e+="</svg>",e}}class Ks{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",jm[this.pathName]),i}toMarkup(){return this.alternate?'<path d="'+hi(this.alternate)+'"/>':'<path d="'+hi(jm[this.pathName])+'"/>'}}class Qh{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+'="'+hi(this.attributes[i])+'"';return e+="/>",e}}function d9(t){if(t instanceof qi)return t;throw new Error("Expected symbolNode but got "+String(t)+".")}function f9(t){if(t instanceof xo)return t;throw new Error("Expected span<HtmlDomNode> but got "+String(t)+".")}var p9=t=>t instanceof xo||t instanceof l0||t instanceof wo,Nr={"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]}},ml={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]},Hm={Å:"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 m9(t,e){Nr[t]=e}function Kf(t,e,i){if(!Nr[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),s=Nr[e][r];if(!s&&t[0]in Hm&&(r=Hm[t[0]].charCodeAt(0),s=Nr[e][r]),!s&&i==="text"&&J3(r)&&(s=Nr[e][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var fc={};function g9(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!fc[e]){var i=fc[e]={cssEmPerMu:ml.quad[e]/18};for(var r in ml)ml.hasOwnProperty(r)&&(i[r]=ml[r][e])}return fc[e]}var ft={math:{},text:{}};function g(t,e,i,r,s,n){ft[t][s]={font:e,group:i,replace:r},n&&r&&(ft[t][r]=ft[t][s])}var v="math",Z="text",y="main",T="ams",mt="accent-token",we="bin",Ei="close",So="inner",De="mathord",Ft="op-token",Ki="open",Va="punct",B="rel",ms="spacing",F="textord";g(v,y,B,"≡","\\equiv",!0);g(v,y,B,"≺","\\prec",!0);g(v,y,B,"≻","\\succ",!0);g(v,y,B,"∼","\\sim",!0);g(v,y,B,"⊥","\\perp");g(v,y,B,"⪯","\\preceq",!0);g(v,y,B,"⪰","\\succeq",!0);g(v,y,B,"≃","\\simeq",!0);g(v,y,B,"∣","\\mid",!0);g(v,y,B,"≪","\\ll",!0);g(v,y,B,"≫","\\gg",!0);g(v,y,B,"≍","\\asymp",!0);g(v,y,B,"∥","\\parallel");g(v,y,B,"⋈","\\bowtie",!0);g(v,y,B,"⌣","\\smile",!0);g(v,y,B,"⊑","\\sqsubseteq",!0);g(v,y,B,"⊒","\\sqsupseteq",!0);g(v,y,B,"≐","\\doteq",!0);g(v,y,B,"⌢","\\frown",!0);g(v,y,B,"∋","\\ni",!0);g(v,y,B,"∝","\\propto",!0);g(v,y,B,"⊢","\\vdash",!0);g(v,y,B,"⊣","\\dashv",!0);g(v,y,B,"∋","\\owns");g(v,y,Va,".","\\ldotp");g(v,y,Va,"⋅","\\cdotp");g(v,y,Va,"⋅","·");g(Z,y,F,"⋅","·");g(v,y,F,"#","\\#");g(Z,y,F,"#","\\#");g(v,y,F,"&","\\&");g(Z,y,F,"&","\\&");g(v,y,F,"ℵ","\\aleph",!0);g(v,y,F,"∀","\\forall",!0);g(v,y,F,"ℏ","\\hbar",!0);g(v,y,F,"∃","\\exists",!0);g(v,y,F,"∇","\\nabla",!0);g(v,y,F,"♭","\\flat",!0);g(v,y,F,"ℓ","\\ell",!0);g(v,y,F,"♮","\\natural",!0);g(v,y,F,"♣","\\clubsuit",!0);g(v,y,F,"℘","\\wp",!0);g(v,y,F,"♯","\\sharp",!0);g(v,y,F,"♢","\\diamondsuit",!0);g(v,y,F,"ℜ","\\Re",!0);g(v,y,F,"♡","\\heartsuit",!0);g(v,y,F,"ℑ","\\Im",!0);g(v,y,F,"♠","\\spadesuit",!0);g(v,y,F,"§","\\S",!0);g(Z,y,F,"§","\\S");g(v,y,F,"¶","\\P",!0);g(Z,y,F,"¶","\\P");g(v,y,F,"†","\\dag");g(Z,y,F,"†","\\dag");g(Z,y,F,"†","\\textdagger");g(v,y,F,"‡","\\ddag");g(Z,y,F,"‡","\\ddag");g(Z,y,F,"‡","\\textdaggerdbl");g(v,y,Ei,"⎱","\\rmoustache",!0);g(v,y,Ki,"⎰","\\lmoustache",!0);g(v,y,Ei,"⟯","\\rgroup",!0);g(v,y,Ki,"⟮","\\lgroup",!0);g(v,y,we,"∓","\\mp",!0);g(v,y,we,"⊖","\\ominus",!0);g(v,y,we,"⊎","\\uplus",!0);g(v,y,we,"⊓","\\sqcap",!0);g(v,y,we,"∗","\\ast");g(v,y,we,"⊔","\\sqcup",!0);g(v,y,we,"◯","\\bigcirc",!0);g(v,y,we,"∙","\\bullet",!0);g(v,y,we,"‡","\\ddagger");g(v,y,we,"≀","\\wr",!0);g(v,y,we,"⨿","\\amalg");g(v,y,we,"&","\\And");g(v,y,B,"⟵","\\longleftarrow",!0);g(v,y,B,"⇐","\\Leftarrow",!0);g(v,y,B,"⟸","\\Longleftarrow",!0);g(v,y,B,"⟶","\\longrightarrow",!0);g(v,y,B,"⇒","\\Rightarrow",!0);g(v,y,B,"⟹","\\Longrightarrow",!0);g(v,y,B,"↔","\\leftrightarrow",!0);g(v,y,B,"⟷","\\longleftrightarrow",!0);g(v,y,B,"⇔","\\Leftrightarrow",!0);g(v,y,B,"⟺","\\Longleftrightarrow",!0);g(v,y,B,"↦","\\mapsto",!0);g(v,y,B,"⟼","\\longmapsto",!0);g(v,y,B,"↗","\\nearrow",!0);g(v,y,B,"↩","\\hookleftarrow",!0);g(v,y,B,"↪","\\hookrightarrow",!0);g(v,y,B,"↘","\\searrow",!0);g(v,y,B,"↼","\\leftharpoonup",!0);g(v,y,B,"⇀","\\rightharpoonup",!0);g(v,y,B,"↙","\\swarrow",!0);g(v,y,B,"↽","\\leftharpoondown",!0);g(v,y,B,"⇁","\\rightharpoondown",!0);g(v,y,B,"↖","\\nwarrow",!0);g(v,y,B,"⇌","\\rightleftharpoons",!0);g(v,T,B,"≮","\\nless",!0);g(v,T,B,"","\\@nleqslant");g(v,T,B,"","\\@nleqq");g(v,T,B,"⪇","\\lneq",!0);g(v,T,B,"≨","\\lneqq",!0);g(v,T,B,"","\\@lvertneqq");g(v,T,B,"⋦","\\lnsim",!0);g(v,T,B,"⪉","\\lnapprox",!0);g(v,T,B,"⊀","\\nprec",!0);g(v,T,B,"⋠","\\npreceq",!0);g(v,T,B,"⋨","\\precnsim",!0);g(v,T,B,"⪹","\\precnapprox",!0);g(v,T,B,"≁","\\nsim",!0);g(v,T,B,"","\\@nshortmid");g(v,T,B,"∤","\\nmid",!0);g(v,T,B,"⊬","\\nvdash",!0);g(v,T,B,"⊭","\\nvDash",!0);g(v,T,B,"⋪","\\ntriangleleft");g(v,T,B,"⋬","\\ntrianglelefteq",!0);g(v,T,B,"⊊","\\subsetneq",!0);g(v,T,B,"","\\@varsubsetneq");g(v,T,B,"⫋","\\subsetneqq",!0);g(v,T,B,"","\\@varsubsetneqq");g(v,T,B,"≯","\\ngtr",!0);g(v,T,B,"","\\@ngeqslant");g(v,T,B,"","\\@ngeqq");g(v,T,B,"⪈","\\gneq",!0);g(v,T,B,"≩","\\gneqq",!0);g(v,T,B,"","\\@gvertneqq");g(v,T,B,"⋧","\\gnsim",!0);g(v,T,B,"⪊","\\gnapprox",!0);g(v,T,B,"⊁","\\nsucc",!0);g(v,T,B,"⋡","\\nsucceq",!0);g(v,T,B,"⋩","\\succnsim",!0);g(v,T,B,"⪺","\\succnapprox",!0);g(v,T,B,"≆","\\ncong",!0);g(v,T,B,"","\\@nshortparallel");g(v,T,B,"∦","\\nparallel",!0);g(v,T,B,"⊯","\\nVDash",!0);g(v,T,B,"⋫","\\ntriangleright");g(v,T,B,"⋭","\\ntrianglerighteq",!0);g(v,T,B,"","\\@nsupseteqq");g(v,T,B,"⊋","\\supsetneq",!0);g(v,T,B,"","\\@varsupsetneq");g(v,T,B,"⫌","\\supsetneqq",!0);g(v,T,B,"","\\@varsupsetneqq");g(v,T,B,"⊮","\\nVdash",!0);g(v,T,B,"⪵","\\precneqq",!0);g(v,T,B,"⪶","\\succneqq",!0);g(v,T,B,"","\\@nsubseteqq");g(v,T,we,"⊴","\\unlhd");g(v,T,we,"⊵","\\unrhd");g(v,T,B,"↚","\\nleftarrow",!0);g(v,T,B,"↛","\\nrightarrow",!0);g(v,T,B,"⇍","\\nLeftarrow",!0);g(v,T,B,"⇏","\\nRightarrow",!0);g(v,T,B,"↮","\\nleftrightarrow",!0);g(v,T,B,"⇎","\\nLeftrightarrow",!0);g(v,T,B,"△","\\vartriangle");g(v,T,F,"ℏ","\\hslash");g(v,T,F,"▽","\\triangledown");g(v,T,F,"◊","\\lozenge");g(v,T,F,"Ⓢ","\\circledS");g(v,T,F,"®","\\circledR");g(Z,T,F,"®","\\circledR");g(v,T,F,"∡","\\measuredangle",!0);g(v,T,F,"∄","\\nexists");g(v,T,F,"℧","\\mho");g(v,T,F,"Ⅎ","\\Finv",!0);g(v,T,F,"⅁","\\Game",!0);g(v,T,F,"‵","\\backprime");g(v,T,F,"▲","\\blacktriangle");g(v,T,F,"▼","\\blacktriangledown");g(v,T,F,"■","\\blacksquare");g(v,T,F,"⧫","\\blacklozenge");g(v,T,F,"★","\\bigstar");g(v,T,F,"∢","\\sphericalangle",!0);g(v,T,F,"∁","\\complement",!0);g(v,T,F,"ð","\\eth",!0);g(Z,y,F,"ð","ð");g(v,T,F,"╱","\\diagup");g(v,T,F,"╲","\\diagdown");g(v,T,F,"□","\\square");g(v,T,F,"□","\\Box");g(v,T,F,"◊","\\Diamond");g(v,T,F,"¥","\\yen",!0);g(Z,T,F,"¥","\\yen",!0);g(v,T,F,"✓","\\checkmark",!0);g(Z,T,F,"✓","\\checkmark");g(v,T,F,"ℶ","\\beth",!0);g(v,T,F,"ℸ","\\daleth",!0);g(v,T,F,"ℷ","\\gimel",!0);g(v,T,F,"ϝ","\\digamma",!0);g(v,T,F,"ϰ","\\varkappa");g(v,T,Ki,"┌","\\@ulcorner",!0);g(v,T,Ei,"┐","\\@urcorner",!0);g(v,T,Ki,"└","\\@llcorner",!0);g(v,T,Ei,"┘","\\@lrcorner",!0);g(v,T,B,"≦","\\leqq",!0);g(v,T,B,"⩽","\\leqslant",!0);g(v,T,B,"⪕","\\eqslantless",!0);g(v,T,B,"≲","\\lesssim",!0);g(v,T,B,"⪅","\\lessapprox",!0);g(v,T,B,"≊","\\approxeq",!0);g(v,T,we,"⋖","\\lessdot");g(v,T,B,"⋘","\\lll",!0);g(v,T,B,"≶","\\lessgtr",!0);g(v,T,B,"⋚","\\lesseqgtr",!0);g(v,T,B,"⪋","\\lesseqqgtr",!0);g(v,T,B,"≑","\\doteqdot");g(v,T,B,"≓","\\risingdotseq",!0);g(v,T,B,"≒","\\fallingdotseq",!0);g(v,T,B,"∽","\\backsim",!0);g(v,T,B,"⋍","\\backsimeq",!0);g(v,T,B,"⫅","\\subseteqq",!0);g(v,T,B,"⋐","\\Subset",!0);g(v,T,B,"⊏","\\sqsubset",!0);g(v,T,B,"≼","\\preccurlyeq",!0);g(v,T,B,"⋞","\\curlyeqprec",!0);g(v,T,B,"≾","\\precsim",!0);g(v,T,B,"⪷","\\precapprox",!0);g(v,T,B,"⊲","\\vartriangleleft");g(v,T,B,"⊴","\\trianglelefteq");g(v,T,B,"⊨","\\vDash",!0);g(v,T,B,"⊪","\\Vvdash",!0);g(v,T,B,"⌣","\\smallsmile");g(v,T,B,"⌢","\\smallfrown");g(v,T,B,"≏","\\bumpeq",!0);g(v,T,B,"≎","\\Bumpeq",!0);g(v,T,B,"≧","\\geqq",!0);g(v,T,B,"⩾","\\geqslant",!0);g(v,T,B,"⪖","\\eqslantgtr",!0);g(v,T,B,"≳","\\gtrsim",!0);g(v,T,B,"⪆","\\gtrapprox",!0);g(v,T,we,"⋗","\\gtrdot");g(v,T,B,"⋙","\\ggg",!0);g(v,T,B,"≷","\\gtrless",!0);g(v,T,B,"⋛","\\gtreqless",!0);g(v,T,B,"⪌","\\gtreqqless",!0);g(v,T,B,"≖","\\eqcirc",!0);g(v,T,B,"≗","\\circeq",!0);g(v,T,B,"≜","\\triangleq",!0);g(v,T,B,"∼","\\thicksim");g(v,T,B,"≈","\\thickapprox");g(v,T,B,"⫆","\\supseteqq",!0);g(v,T,B,"⋑","\\Supset",!0);g(v,T,B,"⊐","\\sqsupset",!0);g(v,T,B,"≽","\\succcurlyeq",!0);g(v,T,B,"⋟","\\curlyeqsucc",!0);g(v,T,B,"≿","\\succsim",!0);g(v,T,B,"⪸","\\succapprox",!0);g(v,T,B,"⊳","\\vartriangleright");g(v,T,B,"⊵","\\trianglerighteq");g(v,T,B,"⊩","\\Vdash",!0);g(v,T,B,"∣","\\shortmid");g(v,T,B,"∥","\\shortparallel");g(v,T,B,"≬","\\between",!0);g(v,T,B,"⋔","\\pitchfork",!0);g(v,T,B,"∝","\\varpropto");g(v,T,B,"◀","\\blacktriangleleft");g(v,T,B,"∴","\\therefore",!0);g(v,T,B,"∍","\\backepsilon");g(v,T,B,"▶","\\blacktriangleright");g(v,T,B,"∵","\\because",!0);g(v,T,B,"⋘","\\llless");g(v,T,B,"⋙","\\gggtr");g(v,T,we,"⊲","\\lhd");g(v,T,we,"⊳","\\rhd");g(v,T,B,"≂","\\eqsim",!0);g(v,y,B,"⋈","\\Join");g(v,T,B,"≑","\\Doteq",!0);g(v,T,we,"∔","\\dotplus",!0);g(v,T,we,"∖","\\smallsetminus");g(v,T,we,"⋒","\\Cap",!0);g(v,T,we,"⋓","\\Cup",!0);g(v,T,we,"⩞","\\doublebarwedge",!0);g(v,T,we,"⊟","\\boxminus",!0);g(v,T,we,"⊞","\\boxplus",!0);g(v,T,we,"⋇","\\divideontimes",!0);g(v,T,we,"⋉","\\ltimes",!0);g(v,T,we,"⋊","\\rtimes",!0);g(v,T,we,"⋋","\\leftthreetimes",!0);g(v,T,we,"⋌","\\rightthreetimes",!0);g(v,T,we,"⋏","\\curlywedge",!0);g(v,T,we,"⋎","\\curlyvee",!0);g(v,T,we,"⊝","\\circleddash",!0);g(v,T,we,"⊛","\\circledast",!0);g(v,T,we,"⋅","\\centerdot");g(v,T,we,"⊺","\\intercal",!0);g(v,T,we,"⋒","\\doublecap");g(v,T,we,"⋓","\\doublecup");g(v,T,we,"⊠","\\boxtimes",!0);g(v,T,B,"⇢","\\dashrightarrow",!0);g(v,T,B,"⇠","\\dashleftarrow",!0);g(v,T,B,"⇇","\\leftleftarrows",!0);g(v,T,B,"⇆","\\leftrightarrows",!0);g(v,T,B,"⇚","\\Lleftarrow",!0);g(v,T,B,"↞","\\twoheadleftarrow",!0);g(v,T,B,"↢","\\leftarrowtail",!0);g(v,T,B,"↫","\\looparrowleft",!0);g(v,T,B,"⇋","\\leftrightharpoons",!0);g(v,T,B,"↶","\\curvearrowleft",!0);g(v,T,B,"↺","\\circlearrowleft",!0);g(v,T,B,"↰","\\Lsh",!0);g(v,T,B,"⇈","\\upuparrows",!0);g(v,T,B,"↿","\\upharpoonleft",!0);g(v,T,B,"⇃","\\downharpoonleft",!0);g(v,y,B,"⊶","\\origof",!0);g(v,y,B,"⊷","\\imageof",!0);g(v,T,B,"⊸","\\multimap",!0);g(v,T,B,"↭","\\leftrightsquigarrow",!0);g(v,T,B,"⇉","\\rightrightarrows",!0);g(v,T,B,"⇄","\\rightleftarrows",!0);g(v,T,B,"↠","\\twoheadrightarrow",!0);g(v,T,B,"↣","\\rightarrowtail",!0);g(v,T,B,"↬","\\looparrowright",!0);g(v,T,B,"↷","\\curvearrowright",!0);g(v,T,B,"↻","\\circlearrowright",!0);g(v,T,B,"↱","\\Rsh",!0);g(v,T,B,"⇊","\\downdownarrows",!0);g(v,T,B,"↾","\\upharpoonright",!0);g(v,T,B,"⇂","\\downharpoonright",!0);g(v,T,B,"⇝","\\rightsquigarrow",!0);g(v,T,B,"⇝","\\leadsto");g(v,T,B,"⇛","\\Rrightarrow",!0);g(v,T,B,"↾","\\restriction");g(v,y,F,"‘","`");g(v,y,F,"$","\\$");g(Z,y,F,"$","\\$");g(Z,y,F,"$","\\textdollar");g(v,y,F,"%","\\%");g(Z,y,F,"%","\\%");g(v,y,F,"_","\\_");g(Z,y,F,"_","\\_");g(Z,y,F,"_","\\textunderscore");g(v,y,F,"∠","\\angle",!0);g(v,y,F,"∞","\\infty",!0);g(v,y,F,"′","\\prime");g(v,y,F,"△","\\triangle");g(v,y,F,"Γ","\\Gamma",!0);g(v,y,F,"Δ","\\Delta",!0);g(v,y,F,"Θ","\\Theta",!0);g(v,y,F,"Λ","\\Lambda",!0);g(v,y,F,"Ξ","\\Xi",!0);g(v,y,F,"Π","\\Pi",!0);g(v,y,F,"Σ","\\Sigma",!0);g(v,y,F,"Υ","\\Upsilon",!0);g(v,y,F,"Φ","\\Phi",!0);g(v,y,F,"Ψ","\\Psi",!0);g(v,y,F,"Ω","\\Omega",!0);g(v,y,F,"A","Α");g(v,y,F,"B","Β");g(v,y,F,"E","Ε");g(v,y,F,"Z","Ζ");g(v,y,F,"H","Η");g(v,y,F,"I","Ι");g(v,y,F,"K","Κ");g(v,y,F,"M","Μ");g(v,y,F,"N","Ν");g(v,y,F,"O","Ο");g(v,y,F,"P","Ρ");g(v,y,F,"T","Τ");g(v,y,F,"X","Χ");g(v,y,F,"¬","\\neg",!0);g(v,y,F,"¬","\\lnot");g(v,y,F,"⊤","\\top");g(v,y,F,"⊥","\\bot");g(v,y,F,"∅","\\emptyset");g(v,T,F,"∅","\\varnothing");g(v,y,De,"α","\\alpha",!0);g(v,y,De,"β","\\beta",!0);g(v,y,De,"γ","\\gamma",!0);g(v,y,De,"δ","\\delta",!0);g(v,y,De,"ϵ","\\epsilon",!0);g(v,y,De,"ζ","\\zeta",!0);g(v,y,De,"η","\\eta",!0);g(v,y,De,"θ","\\theta",!0);g(v,y,De,"ι","\\iota",!0);g(v,y,De,"κ","\\kappa",!0);g(v,y,De,"λ","\\lambda",!0);g(v,y,De,"μ","\\mu",!0);g(v,y,De,"ν","\\nu",!0);g(v,y,De,"ξ","\\xi",!0);g(v,y,De,"ο","\\omicron",!0);g(v,y,De,"π","\\pi",!0);g(v,y,De,"ρ","\\rho",!0);g(v,y,De,"σ","\\sigma",!0);g(v,y,De,"τ","\\tau",!0);g(v,y,De,"υ","\\upsilon",!0);g(v,y,De,"ϕ","\\phi",!0);g(v,y,De,"χ","\\chi",!0);g(v,y,De,"ψ","\\psi",!0);g(v,y,De,"ω","\\omega",!0);g(v,y,De,"ε","\\varepsilon",!0);g(v,y,De,"ϑ","\\vartheta",!0);g(v,y,De,"ϖ","\\varpi",!0);g(v,y,De,"ϱ","\\varrho",!0);g(v,y,De,"ς","\\varsigma",!0);g(v,y,De,"φ","\\varphi",!0);g(v,y,we,"∗","*",!0);g(v,y,we,"+","+");g(v,y,we,"−","-",!0);g(v,y,we,"⋅","\\cdot",!0);g(v,y,we,"∘","\\circ",!0);g(v,y,we,"÷","\\div",!0);g(v,y,we,"±","\\pm",!0);g(v,y,we,"×","\\times",!0);g(v,y,we,"∩","\\cap",!0);g(v,y,we,"∪","\\cup",!0);g(v,y,we,"∖","\\setminus",!0);g(v,y,we,"∧","\\land");g(v,y,we,"∨","\\lor");g(v,y,we,"∧","\\wedge",!0);g(v,y,we,"∨","\\vee",!0);g(v,y,F,"√","\\surd");g(v,y,Ki,"⟨","\\langle",!0);g(v,y,Ki,"∣","\\lvert");g(v,y,Ki,"∥","\\lVert");g(v,y,Ei,"?","?");g(v,y,Ei,"!","!");g(v,y,Ei,"⟩","\\rangle",!0);g(v,y,Ei,"∣","\\rvert");g(v,y,Ei,"∥","\\rVert");g(v,y,B,"=","=");g(v,y,B,":",":");g(v,y,B,"≈","\\approx",!0);g(v,y,B,"≅","\\cong",!0);g(v,y,B,"≥","\\ge");g(v,y,B,"≥","\\geq",!0);g(v,y,B,"←","\\gets");g(v,y,B,">","\\gt",!0);g(v,y,B,"∈","\\in",!0);g(v,y,B,"","\\@not");g(v,y,B,"⊂","\\subset",!0);g(v,y,B,"⊃","\\supset",!0);g(v,y,B,"⊆","\\subseteq",!0);g(v,y,B,"⊇","\\supseteq",!0);g(v,T,B,"⊈","\\nsubseteq",!0);g(v,T,B,"⊉","\\nsupseteq",!0);g(v,y,B,"⊨","\\models");g(v,y,B,"←","\\leftarrow",!0);g(v,y,B,"≤","\\le");g(v,y,B,"≤","\\leq",!0);g(v,y,B,"<","\\lt",!0);g(v,y,B,"→","\\rightarrow",!0);g(v,y,B,"→","\\to");g(v,T,B,"≱","\\ngeq",!0);g(v,T,B,"≰","\\nleq",!0);g(v,y,ms," ","\\ ");g(v,y,ms," ","\\space");g(v,y,ms," ","\\nobreakspace");g(Z,y,ms," ","\\ ");g(Z,y,ms," "," ");g(Z,y,ms," ","\\space");g(Z,y,ms," ","\\nobreakspace");g(v,y,ms,"","\\nobreak");g(v,y,ms,"","\\allowbreak");g(v,y,Va,",",",");g(v,y,Va,";",";");g(v,T,we,"⊼","\\barwedge",!0);g(v,T,we,"⊻","\\veebar",!0);g(v,y,we,"⊙","\\odot",!0);g(v,y,we,"⊕","\\oplus",!0);g(v,y,we,"⊗","\\otimes",!0);g(v,y,F,"∂","\\partial",!0);g(v,y,we,"⊘","\\oslash",!0);g(v,T,we,"⊚","\\circledcirc",!0);g(v,T,we,"⊡","\\boxdot",!0);g(v,y,we,"△","\\bigtriangleup");g(v,y,we,"▽","\\bigtriangledown");g(v,y,we,"†","\\dagger");g(v,y,we,"⋄","\\diamond");g(v,y,we,"⋆","\\star");g(v,y,we,"◃","\\triangleleft");g(v,y,we,"▹","\\triangleright");g(v,y,Ki,"{","\\{");g(Z,y,F,"{","\\{");g(Z,y,F,"{","\\textbraceleft");g(v,y,Ei,"}","\\}");g(Z,y,F,"}","\\}");g(Z,y,F,"}","\\textbraceright");g(v,y,Ki,"{","\\lbrace");g(v,y,Ei,"}","\\rbrace");g(v,y,Ki,"[","\\lbrack",!0);g(Z,y,F,"[","\\lbrack",!0);g(v,y,Ei,"]","\\rbrack",!0);g(Z,y,F,"]","\\rbrack",!0);g(v,y,Ki,"(","\\lparen",!0);g(v,y,Ei,")","\\rparen",!0);g(Z,y,F,"<","\\textless",!0);g(Z,y,F,">","\\textgreater",!0);g(v,y,Ki,"⌊","\\lfloor",!0);g(v,y,Ei,"⌋","\\rfloor",!0);g(v,y,Ki,"⌈","\\lceil",!0);g(v,y,Ei,"⌉","\\rceil",!0);g(v,y,F,"\\","\\backslash");g(v,y,F,"∣","|");g(v,y,F,"∣","\\vert");g(Z,y,F,"|","\\textbar",!0);g(v,y,F,"∥","\\|");g(v,y,F,"∥","\\Vert");g(Z,y,F,"∥","\\textbardbl");g(Z,y,F,"~","\\textasciitilde");g(Z,y,F,"\\","\\textbackslash");g(Z,y,F,"^","\\textasciicircum");g(v,y,B,"↑","\\uparrow",!0);g(v,y,B,"⇑","\\Uparrow",!0);g(v,y,B,"↓","\\downarrow",!0);g(v,y,B,"⇓","\\Downarrow",!0);g(v,y,B,"↕","\\updownarrow",!0);g(v,y,B,"⇕","\\Updownarrow",!0);g(v,y,Ft,"∐","\\coprod");g(v,y,Ft,"⋁","\\bigvee");g(v,y,Ft,"⋀","\\bigwedge");g(v,y,Ft,"⨄","\\biguplus");g(v,y,Ft,"⋂","\\bigcap");g(v,y,Ft,"⋃","\\bigcup");g(v,y,Ft,"∫","\\int");g(v,y,Ft,"∫","\\intop");g(v,y,Ft,"∬","\\iint");g(v,y,Ft,"∭","\\iiint");g(v,y,Ft,"∏","\\prod");g(v,y,Ft,"∑","\\sum");g(v,y,Ft,"⨂","\\bigotimes");g(v,y,Ft,"⨁","\\bigoplus");g(v,y,Ft,"⨀","\\bigodot");g(v,y,Ft,"∮","\\oint");g(v,y,Ft,"∯","\\oiint");g(v,y,Ft,"∰","\\oiiint");g(v,y,Ft,"⨆","\\bigsqcup");g(v,y,Ft,"∫","\\smallint");g(Z,y,So,"…","\\textellipsis");g(v,y,So,"…","\\mathellipsis");g(Z,y,So,"…","\\ldots",!0);g(v,y,So,"…","\\ldots",!0);g(v,y,So,"⋯","\\@cdots",!0);g(v,y,So,"⋱","\\ddots",!0);g(v,y,F,"⋮","\\varvdots");g(Z,y,F,"⋮","\\varvdots");g(v,y,mt,"ˊ","\\acute");g(v,y,mt,"ˋ","\\grave");g(v,y,mt,"¨","\\ddot");g(v,y,mt,"~","\\tilde");g(v,y,mt,"ˉ","\\bar");g(v,y,mt,"˘","\\breve");g(v,y,mt,"ˇ","\\check");g(v,y,mt,"^","\\hat");g(v,y,mt,"⃗","\\vec");g(v,y,mt,"˙","\\dot");g(v,y,mt,"˚","\\mathring");g(v,y,De,"","\\@imath");g(v,y,De,"","\\@jmath");g(v,y,F,"ı","ı");g(v,y,F,"ȷ","ȷ");g(Z,y,F,"ı","\\i",!0);g(Z,y,F,"ȷ","\\j",!0);g(Z,y,F,"ß","\\ss",!0);g(Z,y,F,"æ","\\ae",!0);g(Z,y,F,"œ","\\oe",!0);g(Z,y,F,"ø","\\o",!0);g(Z,y,F,"Æ","\\AE",!0);g(Z,y,F,"Œ","\\OE",!0);g(Z,y,F,"Ø","\\O",!0);g(Z,y,mt,"ˊ","\\'");g(Z,y,mt,"ˋ","\\`");g(Z,y,mt,"ˆ","\\^");g(Z,y,mt,"˜","\\~");g(Z,y,mt,"ˉ","\\=");g(Z,y,mt,"˘","\\u");g(Z,y,mt,"˙","\\.");g(Z,y,mt,"¸","\\c");g(Z,y,mt,"˚","\\r");g(Z,y,mt,"ˇ","\\v");g(Z,y,mt,"¨",'\\"');g(Z,y,mt,"˝","\\H");g(Z,y,mt,"◯","\\textcircled");var iv={"--":!0,"---":!0,"``":!0,"''":!0};g(Z,y,F,"–","--",!0);g(Z,y,F,"–","\\textendash");g(Z,y,F,"—","---",!0);g(Z,y,F,"—","\\textemdash");g(Z,y,F,"‘","`",!0);g(Z,y,F,"‘","\\textquoteleft");g(Z,y,F,"’","'",!0);g(Z,y,F,"’","\\textquoteright");g(Z,y,F,"“","``",!0);g(Z,y,F,"“","\\textquotedblleft");g(Z,y,F,"”","''",!0);g(Z,y,F,"”","\\textquotedblright");g(v,y,F,"°","\\degree",!0);g(Z,y,F,"°","\\degree");g(Z,y,F,"°","\\textdegree",!0);g(v,y,F,"£","\\pounds");g(v,y,F,"£","\\mathsterling",!0);g(Z,y,F,"£","\\pounds");g(Z,y,F,"£","\\textsterling",!0);g(v,T,F,"✠","\\maltese");g(Z,T,F,"✠","\\maltese");var $m='0123456789/@."';for(var pc=0;pc<$m.length;pc++){var qm=$m.charAt(pc);g(v,y,F,qm,qm)}var Wm='0123456789!@*()-=+";:?/.,';for(var mc=0;mc<Wm.length;mc++){var Km=Wm.charAt(mc);g(Z,y,F,Km,Km)}var Cu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var gc=0;gc<Cu.length;gc++){var gl=Cu.charAt(gc);g(v,y,De,gl,gl),g(Z,y,F,gl,gl)}g(v,T,F,"C","ℂ");g(Z,T,F,"C","ℂ");g(v,T,F,"H","ℍ");g(Z,T,F,"H","ℍ");g(v,T,F,"N","ℕ");g(Z,T,F,"N","ℕ");g(v,T,F,"P","ℙ");g(Z,T,F,"P","ℙ");g(v,T,F,"Q","ℚ");g(Z,T,F,"Q","ℚ");g(v,T,F,"R","ℝ");g(Z,T,F,"R","ℝ");g(v,T,F,"Z","ℤ");g(Z,T,F,"Z","ℤ");g(v,y,De,"h","ℎ");g(Z,y,De,"h","ℎ");var Me;for(var pi=0;pi<Cu.length;pi++){var xt=Cu.charAt(pi);Me=String.fromCharCode(55349,56320+pi),g(v,y,De,xt,Me),g(Z,y,F,xt,Me),Me=String.fromCharCode(55349,56372+pi),g(v,y,De,xt,Me),g(Z,y,F,xt,Me),Me=String.fromCharCode(55349,56424+pi),g(v,y,De,xt,Me),g(Z,y,F,xt,Me),Me=String.fromCharCode(55349,56580+pi),g(v,y,De,xt,Me),g(Z,y,F,xt,Me),Me=String.fromCharCode(55349,56684+pi),g(v,y,De,xt,Me),g(Z,y,F,xt,Me),Me=String.fromCharCode(55349,56736+pi),g(v,y,De,xt,Me),g(Z,y,F,xt,Me),Me=String.fromCharCode(55349,56788+pi),g(v,y,De,xt,Me),g(Z,y,F,xt,Me),Me=String.fromCharCode(55349,56840+pi),g(v,y,De,xt,Me),g(Z,y,F,xt,Me),Me=String.fromCharCode(55349,56944+pi),g(v,y,De,xt,Me),g(Z,y,F,xt,Me),pi<26&&(Me=String.fromCharCode(55349,56632+pi),g(v,y,De,xt,Me),g(Z,y,F,xt,Me),Me=String.fromCharCode(55349,56476+pi),g(v,y,De,xt,Me),g(Z,y,F,xt,Me))}Me="𝕜";g(v,y,De,"k",Me);g(Z,y,F,"k",Me);for(var nn=0;nn<10;nn++){var Ms=nn.toString();Me=String.fromCharCode(55349,57294+nn),g(v,y,De,Ms,Me),g(Z,y,F,Ms,Me),Me=String.fromCharCode(55349,57314+nn),g(v,y,De,Ms,Me),g(Z,y,F,Ms,Me),Me=String.fromCharCode(55349,57324+nn),g(v,y,De,Ms,Me),g(Z,y,F,Ms,Me),Me=String.fromCharCode(55349,57334+nn),g(v,y,De,Ms,Me),g(Z,y,F,Ms,Me)}var ed="ÐÞþ";for(var vc=0;vc<ed.length;vc++){var vl=ed.charAt(vc);g(v,y,De,vl,vl),g(Z,y,F,vl,vl)}var td={mathClass:"mathbf",textClass:"textbf",font:"Main-Bold"},Vm={mathClass:"mathnormal",textClass:"textit",font:"Math-Italic"},Um={mathClass:"boldsymbol",textClass:"boldsymbol",font:"Main-BoldItalic"},v9={mathClass:"mathscr",textClass:"textscr",font:"Script-Regular"},dn={mathClass:"",textClass:"",font:""},Gm={mathClass:"mathfrak",textClass:"textfrak",font:"Fraktur-Regular"},Ym={mathClass:"mathbb",textClass:"textbb",font:"AMS-Regular"},Xm={mathClass:"mathboldfrak",textClass:"textboldfrak",font:"Fraktur-Regular"},id={mathClass:"mathsf",textClass:"textsf",font:"SansSerif-Regular"},rd={mathClass:"mathboldsf",textClass:"textboldsf",font:"SansSerif-Bold"},Jm={mathClass:"mathitsf",textClass:"textitsf",font:"SansSerif-Italic"},sd={mathClass:"mathtt",textClass:"texttt",font:"Typewriter-Regular"},Zm=[td,td,Vm,Vm,Um,Um,v9,dn,dn,dn,Gm,Gm,Ym,Ym,Xm,Xm,id,id,rd,rd,Jm,Jm,dn,dn,sd,sd],b9=[td,dn,id,rd,sd],_9=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 Zm[s]}else if(120782<=r&&r<=120831){var n=Math.floor((r-120782)/10);return b9[n]}else{if(r===120485||r===120486)return Zm[0];if(120486<r&&r<120782)return dn;throw new re("Unsupported character: "+t)}},u0=function(e,i,r){if(ft[r][e]){var s=ft[r][e].replace;s&&(e=s)}return{value:e,metrics:Kf(e,i,r)}},bi=function(e,i,r,s,n){var o=u0(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 qi(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 qi(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},Vf=function(e,i,r,s){return s===void 0&&(s=[]),r.font==="boldsymbol"&&u0(e,"Main-Bold",i).metrics?bi(e,"Main-Bold",i,r,s.concat(["mathbf"])):e==="\\"||ft[i][e].font==="main"?bi(e,"Main-Regular",i,r,s):bi(e,"AMS-Regular",i,r,s.concat(["amsrm"]))},y9=function(e,i,r){return r!=="textord"&&u0(e,"Math-BoldItalic",i).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},c0=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 b=_9(n);f=b.font,p=b[s+"Class"]}if(f)return bi(n,f,s,i,o.concat(p));if(d){var _,x;if(d==="boldsymbol"){var S=y9(n,s,r);_=S.fontName,x=[S.fontClass]}else h?(_=nd[a].fontName,x=[a]):(_=bl(l,u,c),x=[l,u,c]);if(u0(n,_,s).metrics)return bi(n,_,s,i,o.concat(x));if(iv.hasOwnProperty(n)&&_.slice(0,10)==="Typewriter"){for(var E=[],D=0;D<n.length;D++)E.push(bi(n[D],_,s,i,o.concat(x)));return gs(E)}}if(r==="mathord")return bi(n,"Math-Italic",s,i,o.concat(["mathnormal"]));if(r==="textord"){var M=ft[s][n]&&ft[s][n].font;if(M==="ams"){var C=bl("amsrm",u,c);return bi(n,C,s,i,o.concat("amsrm",u,c))}else if(M==="main"||!M){var N=bl("textrm",u,c);return bi(n,N,s,i,o.concat(u,c))}else{var W=bl(M,u,c);return bi(n,W,s,i,o.concat(W,u,c))}}else throw new Error("unexpected type: "+r+" in makeOrd")},w9=(t,e)=>{if(Ws(t.classes)!==Ws(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},rv=t=>{for(var e=0;e<t.length-1;e++){var i=t[e],r=t[e+1];i instanceof qi&&r instanceof qi&&w9(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},Uf=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},ee=function(e,i,r,s){var n=new xo(e,i,r,s);return Uf(n),n},Vs=(t,e,i,r)=>new xo(t,e,i,r),ao=function(e,i,r){var s=ee([e],[],i);return s.height=Math.max(r||i.fontMetrics().defaultRuleThickness,i.minRuleThickness),s.style.borderBottomWidth=oe(s.height),s.maxFontSize=1,s},x9=function(e,i,r,s){var n=new l0(e,i,r,s);return Uf(n),n},gs=function(e){var i=new wo(e);return Uf(i),i},lo=function(e,i){return e instanceof wo?ee([],[e],i):e},S9=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}},Xe=function(e,i){for(var{children:r,depth:s}=S9(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=ee(["pstrut"],[]);u.style.height=oe(n);for(var c=[],h=s,d=s,f=s,p=0;p<r.length;p++){var b=r[p];if(b.type==="kern")f+=b.size;else{var _=b.elem,x=b.wrapperClasses||[],S=b.wrapperStyle||{},E=ee(x,[u,_],void 0,S);E.style.top=oe(-n-f-_.depth),b.marginLeft&&(E.style.marginLeft=b.marginLeft),b.marginRight&&(E.style.marginRight=b.marginRight),c.push(E),f+=_.height+_.depth}h=Math.min(h,f),d=Math.max(d,f)}var D=ee(["vlist"],c);D.style.height=oe(d);var M;if(h<0){var C=ee([],[]),N=ee(["vlist"],[C]);N.style.height=oe(-h);var W=ee(["vlist-s"],[new qi("​")]);M=[ee(["vlist-r"],[D,W]),ee(["vlist-r"],[N])]}else M=[ee(["vlist-r"],[D])];var q=ee(["vlist-t"],M);return M.length===2&&q.classes.push("vlist-t2"),q.height=d,q.depth=-h,q},sv=(t,e)=>{var i=ee(["mspace"],[],e),r=wt(t,e);return i.style.marginRight=oe(r),i},bl=(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},nd={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"}},nv={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},ov=function(e,i){var[r,s,n]=nv[e],o=new Ks(r),a=new us([o],{width:oe(s),height:oe(n),style:"width:"+oe(s),viewBox:"0 0 "+1e3*s+" "+1e3*n,preserveAspectRatio:"xMinYMin"}),l=Vs(["overlay"],[a],i);return l.height=n,l.style.height=oe(n),l.style.width=oe(s),l},_t={number:3,unit:"mu"},on={number:4,unit:"mu"},Zr={number:5,unit:"mu"},k9={mord:{mop:_t,mbin:on,mrel:Zr,minner:_t},mop:{mord:_t,mop:_t,mrel:Zr,minner:_t},mbin:{mord:on,mop:on,mopen:on,minner:on},mrel:{mord:Zr,mop:Zr,mopen:Zr,minner:Zr},mopen:{},mclose:{mop:_t,mbin:on,mrel:Zr,minner:_t},mpunct:{mord:_t,mop:_t,mrel:Zr,mopen:_t,mclose:_t,mpunct:_t,minner:_t},minner:{mord:_t,mop:_t,mbin:on,mrel:Zr,mopen:_t,mpunct:_t,minner:_t}},C9={mord:{mop:_t},mop:{mord:_t,mop:_t},mbin:{},mrel:{},mopen:{},mclose:{mop:_t},mpunct:{},minner:{mop:_t}},av={},Aa={},Ea={};function ge(t){for(var{type:e,names:i,htmlBuilder:r,mathmlBuilder:s}=t,n=0;n<i.length;++n)av[i[n]]=t;e&&(r&&(Aa[e]=r),s&&(Ea[e]=s))}function Ln(t){var{type:e,htmlBuilder:i,mathmlBuilder:r}=t;i&&(Aa[e]=i),r&&(Ea[e]=r)}var Au=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},Lt=function(e){return e.type==="ordgroup"?e.body:[e]},A9=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),E9=new Set(["rightmost","mrel","mclose","mpunct"]),D9={display:Be.DISPLAY,text:Be.TEXT,script:Be.SCRIPT,scriptscript:Be.SCRIPTSCRIPT},M9={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},qt=function(e,i,r,s){s===void 0&&(s=[null,null]);for(var n=[],o=0;o<e.length;o++){var a=Je(e[o],i);if(a instanceof wo){var l=a.children;n.push(...l)}else n.push(a)}if(rv(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(D9[c.style]))}var h=ee([s[0]||"leftmost"],[],i),d=ee([s[1]||"rightmost"],[],i),f=r==="root";return od(n,(p,b)=>{var _=b.classes[0],x=p.classes[0];_==="mbin"&&E9.has(x)?b.classes[0]="mord":x==="mbin"&&A9.has(_)&&(p.classes[0]="mord")},{node:h},d,f),od(n,(p,b)=>{var _,x,S=ld(b),E=ld(p),D=S&&E?p.hasClass("mtight")?(_=C9[S])==null?void 0:_[E]:(x=k9[S])==null?void 0:x[E]:null;if(D)return sv(D,u)},{node:h},d,f),n},od=function(e,i,r,s,n){s&&e.push(s);for(var o=0;o<e.length;o++){var a=e[o],l=lv(a);if(l){od(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=ee(["leftmost"])),r.insertAfter=(h=>d=>{e.splice(h+1,0,d),o++})(o)}s&&e.pop()},lv=function(e){return e instanceof wo||e instanceof l0||e instanceof xo&&e.hasClass("enclosing")?e:null},ad=function(e,i){var r=lv(e);if(r){var s=r.children;if(s.length){if(i==="right")return ad(s[s.length-1],"right");if(i==="left")return ad(s[0],"left")}}return e},ld=function(e,i){if(!e)return null;i&&(e=ad(e,i));var r=e.classes[0];return M9[r]||null},Da=function(e,i){var r=["nulldelimiter"].concat(e.baseSizingClasses());return ee(i.concat(r))},Je=function(e,i,r){if(!e)return ee();if(Aa[e.type]){var s=Aa[e.type](e,i);if(r&&i.size!==r.size){s=ee(i.sizingClasses(r),[s],i);var n=i.sizeMultiplier/r.sizeMultiplier;s.height*=n,s.depth*=n}return s}else throw new re("Got group of unknown type: '"+e.type+"'")};function _l(t,e){var i=ee(["base"],t,e),r=ee(["strut"]);return r.style.height=oe(i.height+i.depth),i.depth&&(r.style.verticalAlign=oe(-i.depth)),i.children.unshift(r),i}function ud(t,e){var i=null;t.length===1&&t[0].type==="tag"&&(i=t[0].tag,t=t[0].body);var r=qt(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(_l(o,e)),o=[])}else r[a].hasClass("newline")&&(o.pop(),o.length>0&&(n.push(_l(o,e)),o=[]),n.push(r[a]));o.length>0&&n.push(_l(o,e));var u;i?(u=_l(qt(i,e,!0),e),u.classes=["tag"],n.push(u)):s&&n.push(s);var c=ee(["katex-html"],n);if(c.setAttribute("aria-hidden","true"),u){var h=u.children[0];h.style.height=oe(c.height+c.depth),c.depth&&(h.style.verticalAlign=oe(-c.depth))}return c}function uv(t){return new wo(t)}class se{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=Ws(this.classes));for(var r=0;r<this.children.length;r++)if(this.children[r]instanceof Ot&&this.children[r+1]instanceof Ot){for(var s=this.children[r].toText()+this.children[++r].toText();this.children[r+1]instanceof Ot;)s+=this.children[++r].toText();e.appendChild(new Ot(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+=hi(this.attributes[i]),e+='"');this.classes.length>0&&(e+=' class ="'+hi(Ws(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 Ot=class{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return hi(this.toText())}toText(){return this.text}};class cv{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",oe(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+oe(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var T9=new Set(["\\imath","\\jmath"]),B9=new Set(["mrow","mtable"]),ir=function(e,i,r){return ft[i][e]&&ft[i][e].replace&&e.charCodeAt(0)!==55349&&!(iv.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=ft[i][e].replace),new Ot(e)},Gf=function(e){return e.length===1?e[0]:new se("mrow",e)},R9={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"},Yf=(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=R9[i];if(s)return typeof s=="function"?s(t):s;var n=t.text;if(T9.has(n))return null;if(ft[r][n]){var o=ft[r][n].replace;o&&(n=o)}var a=nd[i].fontName;return Kf(n,a,r)?nd[i].variant:null};function bc(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof Ot&&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 Ot&&i.text===","}else return!1}var Vi=function(e,i,r){if(e.length===1){var s=st(e[0],i);return r&&s instanceof se&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var n=[],o,a=0;a<e.length;a++){var l=st(e[a],i);if(l instanceof se&&o instanceof se){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(bc(l)&&o.type==="mn"){o.children.push(...l.children);continue}else if(l.type==="mn"&&bc(o))l.children=[...o.children,...l.children],n.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(o.type==="mn"||bc(o))){var u=l.children[0];u instanceof se&&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 Ot&&c.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var h=l.children[0];h instanceof Ot&&h.text.length>0&&(h.text=h.text.slice(0,1)+"̸"+h.text.slice(1),n.pop())}}}n.push(l),o=l}return n},Us=function(e,i,r){return Gf(Vi(e,i,r))},st=function(e,i){if(!e)return new se("mrow");if(Ea[e.type])return Ea[e.type](e,i);throw new re("Got group of unknown type: '"+e.type+"'")};function Qm(t,e,i,r,s){var n=Vi(t,i),o;n.length===1&&n[0]instanceof se&&B9.has(n[0].type)?o=n[0]:o=new se("mrow",n);var a=new se("annotation",[new Ot(e)]);a.setAttribute("encoding","application/x-tex");var l=new se("semantics",[o,a]),u=new se("math",[l]);u.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&u.setAttribute("display","block");var c=s?"katex":"katex-mathml";return ee([c],[u])}var N9=[[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]],eg=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],tg=function(e,i){return i.size<2?e:N9[e-1][i.size-1]};class es{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||es.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=eg[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 es(i)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:tg(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:eg[e-1]})}havingBaseStyle(e){e=e||this.style.text();var i=tg(es.BASESIZE,e);return this.size===i&&this.textSize===es.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!==es.BASESIZE?["sizing","reset-size"+this.size,"size"+es.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=g9(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}es.BASESIZE=6;var hv=function(e){return new es({style:e.displayMode?Be.DISPLAY:Be.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},dv=function(e,i){if(i.displayMode){var r=["katex-display"];i.leqno&&r.push("leqno"),i.fleqn&&r.push("fleqn"),e=ee(r,[e])}return e},L9=function(e,i,r){var s=hv(r),n;if(r.output==="mathml")return Qm(e,i,s,r.displayMode,!0);if(r.output==="html"){var o=ud(e,s);n=ee(["katex"],[o])}else{var a=Qm(e,i,s,r.displayMode,!1),l=ud(e,s);n=ee(["katex"],[a,l])}return dv(n,r)},O9=function(e,i,r){var s=hv(r),n=ud(e,s),o=ee(["katex"],[n]);return dv(o,r)},P9={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":"="},h0=function(e){var i=new se("mo",[new Ot(P9[e.replace(/^\\/,"")])]);return i.setAttribute("stretchy","true"),i},F9={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]},I9=new Set(["widehat","widecheck","widetilde","utilde"]),d0=function(e,i){function r(){var a=4e5,l=e.label.slice(1);if(I9.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 Ks(h),b=new us([p],{width:"100%",height:oe(d),viewBox:"0 0 "+a+" "+c,preserveAspectRatio:"none"});return{span:Vs([],[b],i),minWidth:0,height:d}}else{var _=[],x=F9[l];if(!x)throw new Error('No SVG data for "'+l+'".');var[S,E,D]=x,M=D/1e3,C=S.length,N,W;if(C===1){if(x.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+l+'".');N=["hide-tail"],W=[x[3]]}else if(C===2)N=["halfarrow-left","halfarrow-right"],W=["xMinYMin","xMaxYMin"];else if(C===3)N=["brace-left","brace-center","brace-right"],W=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
305
+ `+C+" children.");for(var q=0;q<C;q++){var K=new Ks(S[q]),V=new us([K],{width:"400em",height:oe(M),viewBox:"0 0 "+a+" "+D,preserveAspectRatio:W[q]+" slice"}),I=Vs([N[q]],[V],i);if(C===1)return{span:I,minWidth:E,height:M};I.style.height=oe(M),_.push(I)}return{span:ee(["stretchy"],_,i),minWidth:E,height:M}}}var{span:s,minWidth:n,height:o}=r();return s.height=o,s.style.height=oe(o),n>0&&(s.style.minWidth=oe(n)),s},z9=function(e,i,r,s,n){var o,a=e.height+e.depth+r+s;if(/fbox|color|angl/.test(i)){if(o=ee(["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 Qh({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(i)&&u.push(new Qh({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var c=new us(u,{width:"100%",height:oe(a)});o=Vs([],[c],n)}return o.height=a,o.style.height=oe(a),o},j9={bin:1,close:1,inner:1,open:1,punct:1,rel:1},H9={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};function $9(t){return t in j9}function Oe(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 f0(t){var e=p0(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 p0(t){return t&&(t.type==="atom"||H9.hasOwnProperty(t.type))?t:null}var fv=t=>{if(t instanceof qi)return t;if(p9(t)&&t.children.length===1)return fv(t.children[0])},pv=(t,e)=>{var i,r,s;t&&t.type==="supsub"?(r=Oe(t.base,"accent"),i=r.base,t.base=i,s=f9(Je(t,e)),t.base=r):(r=Oe(t,"accent"),i=r.base);var n=Je(i,e.havingCrampedStyle()),o=r.isShifty&&ps(i),a=0;if(o){var l,u;a=(l=(u=fv(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=d0(r,e),d=Xe({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"elem",elem:d,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+oe(2*a)+")",marginLeft:oe(2*a)}:void 0}]});else{var f,p;r.label==="\\vec"?(f=ov("vec",e),p=nv.vec[1]):(f=c0({type:"textord",mode:r.mode,text:r.label},e),f=d9(f),f.italic=0,p=f.width,c&&(h+=f.depth)),d=ee(["accent-body"],[f]);var b=r.label==="\\textcircled";b&&(d.classes.push("accent-full"),h=n.height);var _=a;b||(_-=p/2),d.style.left=oe(_),r.label==="\\textcircled"&&(d.style.top=".2em"),d=Xe({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:-h},{type:"elem",elem:d}]})}var x=ee(["mord","accent"],[d],e);return s?(s.children[0]=x,s.height=Math.max(x.height,s.height),s.classes[0]="mord",s):x},q9=(t,e)=>{var i=t.isStretchy?h0(t.label):new se("mo",[ir(t.label,t.mode)]),r=new se("mover",[st(t.base,e),i]);return r.setAttribute("accent","true"),r},W9=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));ge({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=Au(e[0]),r=!W9.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:pv,mathmlBuilder:q9});ge({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}}});ge({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=Je(t.base,e),r=d0(t,e),s=t.label==="\\utilde"?.12:0,n=Xe({positionType:"top",positionData:i.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:i}]});return ee(["mord","accentunder"],[n],e)},mathmlBuilder:(t,e)=>{var i=h0(t.label),r=new se("munder",[st(t.base,e),i]);return r.setAttribute("accentunder","true"),r}});var yl=t=>{var e=new se("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};ge({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=lo(Je(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=lo(Je(t.below,r,e),e),o.classes.push(n+"-arrow-pad"));var a=d0(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=Xe({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=Xe({positionType:"individualShift",children:[{type:"elem",elem:s,shift:u},{type:"elem",elem:a,shift:l,wrapperClasses:["svg-align"]}]});return ee(["mrel","x-arrow"],[c],e)},mathmlBuilder(t,e){var i=h0(t.label);i.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(t.body){var s=yl(st(t.body,e));if(t.below){var n=yl(st(t.below,e));r=new se("munderover",[i,n,s])}else r=new se("mover",[i,s])}else if(t.below){var o=yl(st(t.below,e));r=new se("munder",[i,o])}else r=yl(),r=new se("mover",[i,r]);return r}});function K9(t,e){var i=qt(t.body,e,!0);return ee([t.mclass],i,e)}function V9(t,e){var i,r=Vi(t.body,e);return t.mclass==="minner"?i=new se("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(i=r[0],i.type="mi"):i=new se("mi",r):(t.isCharacterBox?(i=r[0],i.type="mo"):i=new se("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}ge({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:Lt(s),isCharacterBox:ps(s)}},htmlBuilder:K9,mathmlBuilder:V9});var m0=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"};ge({type:"mclass",names:["\\@binrel"],numArgs:2,handler(t,e){var{parser:i}=t;return{type:"mclass",mode:i.mode,mclass:m0(e[0]),body:Lt(e[1]),isCharacterBox:ps(e[1])}}});ge({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=m0(s):o="mrel";var a={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:Lt(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:ps(l)}}});ge({type:"pmb",names:["\\pmb"],numArgs:1,allowedInText:!0,handler(t,e){var{parser:i}=t;return{type:"pmb",mode:i.mode,mclass:m0(e[0]),body:Lt(e[0])}},htmlBuilder(t,e){var i=qt(t.body,e,!0),r=ee([t.mclass],i,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(t,e){var i=Vi(t.body,e),r=new se("mstyle",i);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var U9={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},ig=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),rg=t=>t.type==="textord"&&t.text==="@",G9=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function Y9(t,e,i){var r=U9[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 X9(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 re("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var r=[],s=[r],n=0;n<e.length;n++){for(var o=e[n],a=ig(),l=0;l<o.length;l++)if(!rg(o[l]))a.body.push(o[l]);else{r.push(a),l+=1;var u=f0(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(G9(o[f],u)){d=!1,l=f;break}if(rg(o[f]))throw new re("Missing a "+u+" character to complete a CD arrow.",o[f]);c[h].body.push(o[f])}if(d)throw new re("Missing a "+u+" character to complete a CD arrow.",o[l])}else throw new re('Expected one of "<>AV=|." after @',o[l]);var p=Y9(u,c,t),b={type:"styling",body:[p],mode:"math",style:"display",resetFont:!0};r.push(b),a=ig()}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([])}}ge({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=lo(Je(t.label,i,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=oe(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var i=new se("mrow",[st(t.label,e)]);return i=new se("mpadded",[i]),i.setAttribute("width","0"),t.side==="left"&&i.setAttribute("lspace","-1width"),i.setAttribute("voffset","0.7em"),i=new se("mstyle",[i]),i.setAttribute("displaystyle","false"),i.setAttribute("scriptlevel","1"),i}});ge({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=lo(Je(t.fragment,e),e);return i.classes.push("cd-vert-arrow"),i},mathmlBuilder(t,e){return new se("mrow",[st(t.fragment,e)])}});ge({type:"textord",names:["\\@char"],numArgs:1,allowedInText:!0,handler(t,e){for(var{parser:i}=t,r=Oe(e[0],"ordgroup"),s=r.body,n="",o=0;o<s.length;o++){var a=Oe(s[o],"textord");n+=a.text}var l=parseInt(n),u;if(isNaN(l))throw new re("\\@char has non-numeric argument "+n);if(l<0||l>=1114111)throw new re("\\@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 J9=(t,e)=>{var i=qt(t.body,e.withColor(t.color),!1);return gs(i)},Z9=(t,e)=>{var i=Vi(t.body,e.withColor(t.color)),r=new se("mstyle",i);return r.setAttribute("mathcolor",t.color),r};ge({type:"color",names:["\\textcolor"],numArgs:2,allowedInText:!0,argTypes:["color","original"],handler(t,e){var{parser:i}=t,r=Oe(e[0],"color-token").color,s=e[1];return{type:"color",mode:i.mode,color:r,body:Lt(s)}},htmlBuilder:J9,mathmlBuilder:Z9});ge({type:"color",names:["\\color"],numArgs:1,allowedInText:!0,argTypes:["color"],handler(t,e){var{parser:i,breakOnTokenText:r}=t,s=Oe(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}}});ge({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&&Oe(s,"size").value}},htmlBuilder(t,e){var i=ee(["mspace"],[],e);return t.newLine&&(i.classes.push("newline"),t.size&&(i.style.marginTop=oe(wt(t.size,e)))),i},mathmlBuilder(t,e){var i=new se("mspace");return t.newLine&&(i.setAttribute("linebreak","newline"),t.size&&i.setAttribute("height",oe(wt(t.size,e)))),i}});var cd={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},mv=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new re("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},gv=(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)};ge({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(cd[r.text])return(i==="\\global"||i==="\\\\globallong")&&(r.text=cd[r.text]),Oe(e.parseFunction(),"internal");throw new re("Invalid token after macro prefix",r)}});ge({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 re("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 re('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==n+1)throw new re('Argument number "'+r.text+'" out of order');n++,a.push([])}else{if(r.text==="EOF")throw new re("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===cd[i]),{type:"internal",mode:e.mode}}});ge({type:"internal",names:["\\let","\\\\globallet"],numArgs:0,allowedInText:!0,primitive:!0,handler(t){var{parser:e,funcName:i}=t,r=mv(e.gullet.popToken());e.gullet.consumeSpaces();var s=Q9(e);return gv(e,r,s,i==="\\\\globallet"),{type:"internal",mode:e.mode}}});ge({type:"internal",names:["\\futurelet","\\\\globalfuture"],numArgs:0,allowedInText:!0,primitive:!0,handler(t){var{parser:e,funcName:i}=t,r=mv(e.gullet.popToken()),s=e.gullet.popToken(),n=e.gullet.popToken();return gv(e,r,n,i==="\\\\globalfuture"),e.gullet.pushToken(n),e.gullet.pushToken(s),{type:"internal",mode:e.mode}}});var Jo=function(e,i,r){var s=ft.math[e]&&ft.math[e].replace,n=Kf(s||e,i,r);if(!n)throw new Error("Unsupported symbol "+e+" and font size "+i+".");return n},Xf=function(e,i,r,s){var n=r.havingBaseStyle(i),o=ee(s.concat(n.sizingClasses(r)),[e],r),a=n.sizeMultiplier/r.sizeMultiplier;return o.height*=a,o.depth*=a,o.maxFontSize=n.sizeMultiplier,o},vv=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=oe(n),e.height-=n,e.depth+=n},ek=function(e,i,r,s,n,o){var a=bi(e,"Main-Regular",n,s),l=Xf(a,i,s,o);return vv(l,s,i),l},tk=function(e,i,r,s){return bi(e,"Size"+i+"-Regular",r,s)},bv=function(e,i,r,s,n,o){var a=tk(e,i,n,s),l=Xf(ee(["delimsizing","size"+i],[a],s),Be.TEXT,s,o);return r&&vv(l,s,Be.TEXT),l},_c=function(e,i,r){var s;i==="Size1-Regular"?s="delim-size1":s="delim-size4";var n=ee(["delimsizinginner",s],[ee([],[bi(e,i,r)])]);return{type:"elem",elem:n}},yc=function(e,i,r){var s=Nr["Size4-Regular"][e.charCodeAt(0)]?Nr["Size4-Regular"][e.charCodeAt(0)][4]:Nr["Size1-Regular"][e.charCodeAt(0)][4],n=new Ks("inner",n9(e,Math.round(1e3*i))),o=new us([n],{width:oe(s),height:oe(i),style:"width:"+oe(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*i),preserveAspectRatio:"xMinYMin"}),a=Vs([],[o],r);return a.height=i,a.style.height=oe(i),a.style.width=oe(s),{type:"elem",elem:a}},hd=.008,wl={type:"kern",size:-1*hd},ik=new Set(["|","\\lvert","\\rvert","\\vert"]),rk=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),_v=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"):ik.has(e)?(u="∣",h="vert",d=333):rk.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=Jo(a,f,n),b=p.height+p.depth,_=Jo(u,f,n),x=_.height+_.depth,S=Jo(c,f,n),E=S.height+S.depth,D=0,M=1;if(l!==null){var C=Jo(l,f,n);D=C.height+C.depth,M=2}var N=b+E+D,W=Math.max(0,Math.ceil((i-N)/(M*x))),q=N+W*M*x,K=s.fontMetrics().axisHeight;r&&(K*=s.sizeMultiplier);var V=q/2-K,I=[];if(h.length>0){var z=q-b-E,P=Math.round(q*1e3),j=o9(h,Math.round(z*1e3)),O=new Ks(h,j),G=oe(d/1e3),$=oe(P/1e3),ue=new us([O],{width:G,height:$,viewBox:"0 0 "+d+" "+P}),Y=Vs([],[ue],s);Y.height=P/1e3,Y.style.width=G,Y.style.height=$,I.push({type:"elem",elem:Y})}else{if(I.push(_c(c,f,n)),I.push(wl),l===null){var X=q-b-E+2*hd;I.push(yc(u,X,s))}else{var he=(q-b-E-D)/2+2*hd;I.push(yc(u,he,s)),I.push(wl),I.push(_c(l,f,n)),I.push(wl),I.push(yc(u,he,s))}I.push(wl),I.push(_c(a,f,n))}var H=s.havingBaseStyle(Be.TEXT),ne=Xe({positionType:"bottom",positionData:V,children:I});return Xf(ee(["delimsizing","mult"],[ne],H),Be.TEXT,s,o)},wc=80,xc=.08,Sc=function(e,i,r,s,n){var o=s9(e,s,r),a=new Ks(e,o),l=new us([a],{width:"400em",height:oe(i),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return Vs(["hide-tail"],[l],n)},sk=function(e,i){var r=i.havingBaseSizing(),s=kv("\\surd",e*r.sizeMultiplier,Sv,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+wc,e<1?n=1:e<1.4&&(n=.7),l=(1+o+xc)/n,u=(1+o)/n,a=Sc("sqrtMain",l,c,o,i),a.style.minWidth="0.853em",h=.833/n):s.type==="large"?(c=(1e3+wc)*aa[s.size],u=(aa[s.size]+o)/n,l=(aa[s.size]+o+xc)/n,a=Sc("sqrtSize"+s.size,l,c,o,i),a.style.minWidth="1.02em",h=1/n):(l=e+o+xc,u=e+o,c=Math.floor(1e3*e+o)+wc,a=Sc("sqrtTall",l,c,o,i),a.style.minWidth="0.742em",h=1.056),a.height=u,a.style.height=oe(l),{span:a,advanceWidth:h,ruleWidth:(i.fontMetrics().sqrtRuleThickness+o)*n}},yv=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),nk=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),wv=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),aa=[0,1.2,1.8,2.4,3],xv=function(e,i,r,s,n){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),yv.has(e)||wv.has(e))return bv(e,i,!1,r,s,n);if(nk.has(e))return _v(e,aa[i],!1,r,s,n);throw new re("Illegal delimiter: '"+e+"'")},ok=[{type:"small",style:Be.SCRIPTSCRIPT},{type:"small",style:Be.SCRIPT},{type:"small",style:Be.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],ak=[{type:"small",style:Be.SCRIPTSCRIPT},{type:"small",style:Be.SCRIPT},{type:"small",style:Be.TEXT},{type:"stack"}],Sv=[{type:"small",style:Be.SCRIPTSCRIPT},{type:"small",style:Be.SCRIPT},{type:"small",style:Be.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],lk=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.")},kv=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=Jo(e,lk(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]},dd=function(e,i,r,s,n,o){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var a;wv.has(e)?a=ok:yv.has(e)?a=Sv:a=ak;var l=kv(e,i,a,s);return l.type==="small"?ek(e,l.style,r,s,n,o):l.type==="large"?bv(e,l.size,r,s,n,o):_v(e,i,r,s,n,o)},kc=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 dd(e,h,!0,s,n,o)},sg={"\\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}},uk=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 ng(t){return"isMiddle"in t}function g0(t,e){var i=p0(t);if(i&&uk.has(i.text))return i;throw i?new re("Invalid delimiter '"+i.text+"' after '"+e.funcName+"'",t):new re("Invalid delimiter type '"+t.type+"'",t)}ge({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=g0(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:sg[t.funcName].size,mclass:sg[t.funcName].mclass,delim:i.text}},htmlBuilder:(t,e)=>t.delim==="."?ee([t.mclass]):xv(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(ir(t.delim,t.mode));var i=new se("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?i.setAttribute("fence","true"):i.setAttribute("fence","false"),i.setAttribute("stretchy","true");var r=oe(aa[t.size]);return i.setAttribute("minsize",r),i.setAttribute("maxsize",r),i}});function og(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}ge({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 re("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:g0(e[0],t).text,color:i}}});ge({type:"leftright",names:["\\left"],numArgs:1,primitive:!0,handler:(t,e)=>{var i=g0(e[0],t),r=t.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var n=Oe(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:i.text,right:n.delim,rightColor:n.color}},htmlBuilder:(t,e)=>{og(t);for(var i=qt(t.body,e,!0,["mopen","mclose"]),r=0,s=0,n=!1,o=0;o<i.length;o++){var a=i[o];ng(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=Da(e,["mopen"]):l=kc(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(ng(c)){var h=c.isMiddle;i[u]=kc(h.delim,r,s,h.options,t.mode,[])}}var d;if(t.right===".")d=Da(e,["mclose"]);else{var f=t.rightColor?e.withColor(t.rightColor):e;d=kc(t.right,r,s,f,t.mode,["mclose"])}return i.push(d),ee(["minner"],i,e)},mathmlBuilder:(t,e)=>{og(t);var i=Vi(t.body,e);if(t.left!=="."){var r=new se("mo",[ir(t.left,t.mode)]);r.setAttribute("fence","true"),i.unshift(r)}if(t.right!=="."){var s=new se("mo",[ir(t.right,t.mode)]);s.setAttribute("fence","true"),t.rightColor&&s.setAttribute("mathcolor",t.rightColor),i.push(s)}return Gf(i)}});ge({type:"middle",names:["\\middle"],numArgs:1,primitive:!0,handler:(t,e)=>{var i=g0(e[0],t);if(!t.parser.leftrightDepth)throw new re("\\middle without preceding \\left",i);return{type:"middle",mode:t.parser.mode,delim:i.text}},htmlBuilder:(t,e)=>{var i;return t.delim==="."?i=Da(e,[]):(i=xv(t.delim,1,e,t.mode,[]),i.isMiddle={delim:t.delim,options:e}),i},mathmlBuilder:(t,e)=>{var i=t.delim==="\\vert"||t.delim==="|"?ir("|","text"):ir(t.delim,t.mode),r=new se("mo",[i]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var ck=(t,e)=>{var i=lo(Je(t.body,e),e),r=t.label.slice(1),s=e.sizeMultiplier,n,o,a=ps(t.body);if(r==="sout")n=ee(["stretchy","sout"]),n.height=e.fontMetrics().defaultRuleThickness/s,o=-.5*e.fontMetrics().xHeight;else if(r==="phase"){var l=wt({number:.6,unit:"pt"},e),u=wt({number:.35,unit:"ex"},e),c=e.havingBaseSizing();s=s/c.sizeMultiplier;var h=i.height+i.depth+l+u;i.style.paddingLeft=oe(h/2+l);var d=Math.floor(1e3*h*s),f=i9(d),p=new us([new Ks("phase",f)],{width:"400em",height:oe(d/1e3),viewBox:"0 0 400000 "+d,preserveAspectRatio:"xMinYMin slice"});n=Vs(["hide-tail"],[p],e),n.style.height=oe(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 b,_,x=0;/box/.test(r)?(x=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),b=e.fontMetrics().fboxsep+(r==="colorbox"?0:x),_=b):r==="angl"?(x=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),b=4*x,_=Math.max(0,.25-i.depth)):(b=a?.2:0,_=b),n=z9(i,r,b,_,e),/fbox|boxed|fcolorbox/.test(r)?(n.style.borderStyle="solid",n.style.borderWidth=oe(x)):r==="angl"&&x!==.049&&(n.style.borderTopWidth=oe(x),n.style.borderRightWidth=oe(x)),o=i.depth+_,t.backgroundColor&&(n.style.backgroundColor=t.backgroundColor,t.borderColor&&(n.style.borderColor=t.borderColor))}var S;if(t.backgroundColor)S=Xe({positionType:"individualShift",children:[{type:"elem",elem:n,shift:o},{type:"elem",elem:i,shift:0}]});else{var E=/cancel|phase/.test(r)?["svg-align"]:[];S=Xe({positionType:"individualShift",children:[{type:"elem",elem:i,shift:0},{type:"elem",elem:n,shift:o,wrapperClasses:E}]})}return/cancel/.test(r)&&(S.height=i.height,S.depth=i.depth),/cancel/.test(r)&&!a?ee(["mord","cancel-lap"],[S],e):ee(["mord"],[S],e)},hk=(t,e)=>{var i,r=new se(t.label.includes("colorbox")?"mpadded":"menclose",[st(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: "+oe(s)+" solid "+t.borderColor)}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return t.backgroundColor&&r.setAttribute("mathbackground",t.backgroundColor),r};ge({type:"enclose",names:["\\colorbox"],numArgs:2,allowedInText:!0,argTypes:["color","hbox"],handler(t,e,i){var{parser:r,funcName:s}=t,n=Oe(e[0],"color-token").color,o=e[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:n,body:o}},htmlBuilder:ck,mathmlBuilder:hk});ge({type:"enclose",names:["\\fcolorbox"],numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"],handler(t,e,i){var{parser:r,funcName:s}=t,n=Oe(e[0],"color-token").color,o=Oe(e[1],"color-token").color,a=e[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:o,borderColor:n,body:a}}});ge({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]}}});ge({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}}});ge({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}}});ge({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 Cv={};function Kr(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)Cv[i[l]]=a;n&&(Aa[e]=n),o&&(Ea[e]=o)}var Av={};function k(t,e){Av[t]=e}class Ti{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 Ti(e.loc.lexer,e.loc.start,i.loc.end):e&&e.loc}}class Hi{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 Hi(i,Ti.range(this,e))}}function ag(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 v0=t=>{var e=t.parser.settings;if(!e.displayMode)throw new re("{"+t.envName+"} can be used only in display mode.")},dk=new Set(["gather","gather*"]);function Jf(t){if(!t.includes("ed"))return!t.includes("*")}function Zs(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 re("Invalid \\arraystretch: "+f)}t.gullet.beginGroup();var p=[],b=[p],_=[],x=[],S=l!=null?[]:void 0;function E(){l&&t.gullet.macros.set("\\@eqnsw","1",!0)}function D(){S&&(t.gullet.macros.get("\\df@tag")?(S.push(t.subparse([new Hi("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):S.push(!!l&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(E(),x.push(ag(t));;){var M=t.parseExpression(!1,u?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup();var C={type:"ordgroup",mode:t.mode,body:M};i&&(C={type:"styling",mode:t.mode,style:i,resetFont:!0,body:[C]}),p.push(C);var N=t.fetch().text;if(N==="&"){if(h&&p.length===h){if(u||a)throw new re("Too many tab characters: &",t.nextToken);t.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}t.consume()}else if(N==="\\end"){D(),p.length===1&&C.type==="styling"&&C.body.length===1&&C.body[0].type==="ordgroup"&&C.body[0].body.length===0&&(b.length>1||!c)&&b.pop(),x.length<b.length+1&&x.push([]);break}else if(N==="\\\\"){t.consume();var W=void 0;t.gullet.future().text!==" "&&(W=t.parseSizeGroup(!0)),_.push(W?W.value:null),D(),x.push(ag(t)),p=[],b.push(p),E()}else throw new re("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:b,cols:n,rowGaps:_,hskipBeforeAndAfter:r,hLinesBeforeRow:x,colSeparationType:a,tags:S,leqno:d}}function Zf(t){return t.slice(0,1)==="d"?"display":"text"}var Vr=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(Be.SCRIPT).sizeMultiplier;d=.2778*(f/i.sizeMultiplier)}var p=e.colSeparationType==="CD"?wt({number:3,unit:"ex"},i):12*h,b=3*h,_=e.arraystretch*p,x=.7*_,S=.3*_,E=0;function D(ze){for(var et=0;et<ze.length;++et)et>0&&(E+=.25),u.push({pos:E,isDashed:ze[et]})}for(D(o[0]),r=0;r<e.body.length;++r){var M=e.body[r],C=x,N=S;a<M.length&&(a=M.length);var W={cells:new Array(M.length),height:0,depth:0,pos:0};for(s=0;s<M.length;++s){var q=Je(M[s],i);N<q.depth&&(N=q.depth),C<q.height&&(C=q.height),W.cells[s]=q}var K=e.rowGaps[r],V=0;K&&(V=wt(K,i),V>0&&(V+=S,N<V&&(N=V),V=0)),e.addJot&&r<e.body.length-1&&(N+=b),W.height=C,W.depth=N,E+=C,W.pos=E,E+=N+V,l[r]=W,D(o[r+1])}var I=E/2+i.fontMetrics().axisHeight,z=e.cols||[],P=[],j,O,G=[];if(e.tags&&e.tags.some(ze=>ze))for(r=0;r<n;++r){var $=l[r],ue=$.pos-I,Y=e.tags[r],X=void 0;Y===!0?X=ee(["eqn-num"],[],i):Y===!1?X=ee([],[],i):X=ee([],qt(Y,i,!0),i),X.depth=$.depth,X.height=$.height,G.push({type:"elem",elem:X,shift:ue})}for(s=0,O=0;s<a||O<z.length;++s,++O){for(var he,H=z[O],ne=!0;((pe=H)==null?void 0:pe.type)==="separator";){var pe;if(ne||(j=ee(["arraycolsep"],[]),j.style.width=oe(i.fontMetrics().doubleRuleSep),P.push(j)),H.separator==="|"||H.separator===":"){var ce=H.separator==="|"?"solid":"dashed",ie=ee(["vertical-separator"],[],i);ie.style.height=oe(E),ie.style.borderRightWidth=oe(c),ie.style.borderRightStyle=ce,ie.style.margin="0 "+oe(-c/2);var _e=E-I;_e&&(ie.style.verticalAlign=oe(-_e)),P.push(ie)}else throw new re("Invalid separator type: "+H.separator);O++,H=z[O],ne=!1}if(!(s>=a)){var qe=void 0;if(s>0||e.hskipBeforeAndAfter){var nt,Wt;qe=(nt=(Wt=H)==null?void 0:Wt.pregap)!=null?nt:d,qe!==0&&(j=ee(["arraycolsep"],[]),j.style.width=oe(qe),P.push(j))}var Mt=[];for(r=0;r<n;++r){var Re=l[r],Kt=Re.cells[s];if(Kt){var mr=Re.pos-I;Kt.depth=Re.depth,Kt.height=Re.height,Mt.push({type:"elem",elem:Kt,shift:mr})}}var Ui=Xe({positionType:"individualShift",children:Mt}),le=ee(["col-align-"+(((he=H)==null?void 0:he.align)||"c")],[Ui]);if(P.push(le),s<a-1||e.hskipBeforeAndAfter){var te,$e;qe=(te=($e=H)==null?void 0:$e.postgap)!=null?te:d,qe!==0&&(j=ee(["arraycolsep"],[]),j.style.width=oe(qe),P.push(j))}}}var ve=ee(["mtable"],P);if(u.length>0){for(var Ke=ao("hline",i,c),Ze=ao("hdashline",i,c),lt=[{type:"elem",elem:ve,shift:0}];u.length>0;){var ht=u.pop(),ni=ht.pos-I;ht.isDashed?lt.push({type:"elem",elem:Ze,shift:ni}):lt.push({type:"elem",elem:Ke,shift:ni})}ve=Xe({positionType:"individualShift",children:lt})}if(G.length===0)return ee(["mord"],[ve],i);var fe=Xe({positionType:"individualShift",children:G}),Ne=ee(["tag"],[fe],i);return gs([ve,Ne])},fk={c:"center ",l:"left ",r:"right "},Ur=function(e,i){for(var r=[],s=new se("mtd",[],["mtr-glue"]),n=new se("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 se("mtd",[st(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 se("mtr",l))}var c=new se("mtable",r),h=e.arraystretch===.5?.1:.16+e.arraystretch-1+(e.addJot?.09:0);c.setAttribute("rowspacing",oe(h));var d="",f="";if(e.cols&&e.cols.length>0){var p=e.cols,b="",_=!1,x=0,S=p.length;p[0].type==="separator"&&(d+="top ",x=1),p[p.length-1].type==="separator"&&(d+="bottom ",S-=1);for(var E=x;E<S;E++){var D=p[E];D.type==="align"?(f+=fk[D.align],_&&(b+="none "),_=!0):D.type==="separator"&&_&&(b+=D.separator==="|"?"solid ":"dashed ",_=!1)}c.setAttribute("columnalign",f.trim()),/[sd]/.test(b)&&c.setAttribute("columnlines",b.trim())}if(e.colSeparationType==="align"){for(var M=e.cols||[],C="",N=1;N<M.length;N++)C+=N%2?"0em ":"1em ";c.setAttribute("columnspacing",C.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 W="",q=e.hLinesBeforeRow;d+=q[0].length>0?"left ":"",d+=q[q.length-1].length>0?"right ":"";for(var K=1;K<q.length-1;K++)W+=q[K].length===0?"none ":q[K][0]?"dashed ":"solid ";return/[sd]/.test(W)&&c.setAttribute("rowlines",W.trim()),d!==""&&(c=new se("menclose",[c]),c.setAttribute("notation",d.trim())),e.arraystretch&&e.arraystretch<1&&(c=new se("mstyle",[c]),c.setAttribute("scriptlevel","1")),c},Ev=function(e,i){e.envName.includes("ed")||v0(e);var r=[],s=e.envName==="split",n=Zs(e.parser,{cols:r,addJot:!0,autoTag:s?void 0:Jf(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=Oe(i[0].body[c],"textord");u+=h.text}o=Number(u),a=o*2}var d=!a;n.body.forEach(function(_){for(var x=1;x<_.length;x+=2){var S=Oe(_[x],"styling"),E=Oe(S.body[0],"ordgroup");E.body.unshift(l)}if(d)a<_.length&&(a=_.length);else{var D=_.length/2;if(o<D)throw new re("Too many math in a row: "+("expected "+o+", but got "+D),_[0])}});for(var f=0;f<a;++f){var p="r",b=0;f%2===1?p="l":f>0&&d&&(b=1),r[f]={type:"align",align:p,pregap:b,postgap:0}}return n.colSeparationType=d?"align":"alignat",n};Kr({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var i=p0(e[0]),r=i?[e[0]]:Oe(e[0],"ordgroup").body,s=r.map(function(o){var a=f0(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 re("Unknown column alignment: "+l,o)}),n={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return Zs(t.parser,n,Zf(t.envName))},htmlBuilder:Vr,mathmlBuilder:Ur});Kr({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 re("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),r.cols=[{type:"align",align:i}]}}var n=Zs(t.parser,r,Zf(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:Vr,mathmlBuilder:Ur});Kr({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},i=Zs(t.parser,e,"script");return i.colSeparationType="small",i},htmlBuilder:Vr,mathmlBuilder:Ur});Kr({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var i=p0(e[0]),r=i?[e[0]]:Oe(e[0],"ordgroup").body,s=r.map(function(a){var l=f0(a),u=l.text;if("lc".includes(u))return{type:"align",align:u};throw new re("Unknown column alignment: "+u,a)});if(s.length>1)throw new re("{subarray} can contain only one column");var n={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5},o=Zs(t.parser,n,"script");if(o.body.length>0&&o.body[0].length>1)throw new re("{subarray} can contain only one column");return o},htmlBuilder:Vr,mathmlBuilder:Ur});Kr({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=Zs(t.parser,e,Zf(t.envName));return{type:"leftright",mode:t.mode,body:[i],left:t.envName.includes("r")?".":"\\{",right:t.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:Vr,mathmlBuilder:Ur});Kr({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Ev,htmlBuilder:Vr,mathmlBuilder:Ur});Kr({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){dk.has(t.envName)&&v0(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:Jf(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return Zs(t.parser,e,"display")},htmlBuilder:Vr,mathmlBuilder:Ur});Kr({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Ev,htmlBuilder:Vr,mathmlBuilder:Ur});Kr({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){v0(t);var e={autoTag:Jf(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return Zs(t.parser,e,"display")},htmlBuilder:Vr,mathmlBuilder:Ur});Kr({type:"array",names:["CD"],props:{numArgs:0},handler(t){return v0(t),X9(t.parser)},htmlBuilder:Vr,mathmlBuilder:Ur});k("\\nonumber","\\gdef\\@eqnsw{0}");k("\\notag","\\nonumber");ge({type:"text",names:["\\hline","\\hdashline"],numArgs:0,allowedInText:!0,allowedInMath:!0,handler(t,e){throw new re(t.funcName+" valid only within array environment")}});var lg=Cv;ge({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 re("Invalid environment name",s);for(var n="",o=0;o<s.body.length;++o)n+=Oe(s.body[o],"textord").text;if(r==="\\begin"){if(!lg.hasOwnProperty(n))throw new re("No such environment: "+n,s);var a=lg[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=Oe(i.parseFunction(),"environment");if(f.name!==n)throw new re("Mismatch: \\begin{"+n+"} matched by \\end{"+f.name+"}",d);return h}return{type:"environment",mode:i.mode,name:n,nameGroup:s}}});var pk=(t,e)=>{var i=t.font,r=e.withFont(i);return Je(t.body,r)},mk=(t,e)=>{var i=t.font,r=e.withFont(i);return st(t.body,r)},ug={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};ge({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=Au(e[0]),n=r in ug?ug[r]:r;return{type:"font",mode:i.mode,font:n.slice(1),body:s}},htmlBuilder:pk,mathmlBuilder:mk});ge({type:"mclass",names:["\\boldsymbol","\\bm"],numArgs:1,handler:(t,e)=>{var{parser:i}=t,r=e[0];return{type:"mclass",mode:i.mode,mclass:m0(r),body:[{type:"font",mode:i.mode,font:"boldsymbol",body:r}],isCharacterBox:ps(r)}}});ge({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 gk=(t,e)=>{var i=e.style,r=i.fracNum(),s=i.fracDen(),n;n=e.havingStyle(r);var o=Je(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=Je(t.denom,n,e),c,h,d;t.hasBarLine?(t.barSize?(h=wt(t.barSize,e),c=ao("frac-line",e,h)):c=ao("frac-line",e),h=c.height,d=c.height):(c=null,h=0,d=e.fontMetrics().defaultRuleThickness);var f,p,b;i.size===Be.DISPLAY.size?(f=e.fontMetrics().num1,h>0?p=3*d:p=7*d,b=e.fontMetrics().denom1):(h>0?(f=e.fontMetrics().num2,p=d):(f=e.fontMetrics().num3,p=3*d),b=e.fontMetrics().denom2);var _;if(c){var S=e.fontMetrics().axisHeight;f-o.depth-(S+.5*h)<p&&(f+=p-(f-o.depth-(S+.5*h))),S-.5*h-(u.height-b)<p&&(b+=p-(S-.5*h-(u.height-b)));var E=-(S-.5*h);_=Xe({positionType:"individualShift",children:[{type:"elem",elem:u,shift:b},{type:"elem",elem:c,shift:E},{type:"elem",elem:o,shift:-f}]})}else{var x=f-o.depth-(u.height-b);x<p&&(f+=.5*(p-x),b+=.5*(p-x)),_=Xe({positionType:"individualShift",children:[{type:"elem",elem:u,shift:b},{type:"elem",elem:o,shift:-f}]})}n=e.havingStyle(i),_.height*=n.sizeMultiplier/e.sizeMultiplier,_.depth*=n.sizeMultiplier/e.sizeMultiplier;var D;i.size===Be.DISPLAY.size?D=e.fontMetrics().delim1:i.size===Be.SCRIPTSCRIPT.size?D=e.havingStyle(Be.SCRIPT).fontMetrics().delim2:D=e.fontMetrics().delim2;var M,C;return t.leftDelim==null?M=Da(e,["mopen"]):M=dd(t.leftDelim,D,!0,e.havingStyle(i),t.mode,["mopen"]),t.continued?C=ee([]):t.rightDelim==null?C=Da(e,["mclose"]):C=dd(t.rightDelim,D,!0,e.havingStyle(i),t.mode,["mclose"]),ee(["mord"].concat(n.sizingClasses(e)),[M,ee(["mfrac"],[_]),C],e)},vk=(t,e)=>{var i=new se("mfrac",[st(t.numer,e),st(t.denom,e)]);if(!t.hasBarLine)i.setAttribute("linethickness","0px");else if(t.barSize){var r=wt(t.barSize,e);i.setAttribute("linethickness",oe(r))}if(t.leftDelim!=null||t.rightDelim!=null){var s=[];if(t.leftDelim!=null){var n=new se("mo",[new Ot(t.leftDelim.replace("\\",""))]);n.setAttribute("fence","true"),s.push(n)}if(s.push(i),t.rightDelim!=null){var o=new se("mo",[new Ot(t.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),s.push(o)}return Gf(s)}return i},Dv=(t,e)=>{if(!e)return t;var i={type:"styling",mode:t.mode,style:e,body:[t]};return i};ge({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"),Dv({type:"genfrac",mode:i.mode,numer:s,denom:n,continued:u,hasBarLine:o,leftDelim:a,rightDelim:l,barSize:null},c)},htmlBuilder:gk,mathmlBuilder:vk});ge({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 cg=["display","text","script","scriptscript"],hg=function(e){var i=null;return e.length>0&&(i=e,i=i==="."?null:i),i};ge({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=Au(e[0]),o=n.type==="atom"&&n.family==="open"?hg(n.text):null,a=Au(e[1]),l=a.type==="atom"&&a.family==="close"?hg(a.text):null,u=Oe(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=Oe(f.body[0],"textord");d=cg[Number(p.text)]}}else f=Oe(f,"textord"),d=cg[Number(f.text)];return Dv({type:"genfrac",mode:i.mode,numer:r,denom:s,continued:!1,hasBarLine:c,barSize:h,leftDelim:o,rightDelim:l},d)}});ge({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:Oe(e[0],"size").value,token:s}}});ge({type:"genfrac",names:["\\\\abovefrac"],numArgs:3,argTypes:["math","size","math"],handler:(t,e)=>{var{parser:i,funcName:r}=t,s=e[0],n=Oe(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 Mv=(t,e)=>{var i=e.style,r,s;t.type==="supsub"?(r=t.sup?Je(t.sup,e.havingStyle(i.sup()),e):Je(t.sub,e.havingStyle(i.sub()),e),s=Oe(t.base,"horizBrace")):s=Oe(t,"horizBrace");var n=Je(s.base,e.havingBaseStyle(Be.DISPLAY)),o=d0(s,e),a;if(s.isOver?a=Xe({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:.1},{type:"elem",elem:o,wrapperClasses:["svg-align"]}]}):a=Xe({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=ee(["minner",s.isOver?"mover":"munder"],[a],e);s.isOver?a=Xe({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:r}]}):a=Xe({positionType:"bottom",positionData:l.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:l}]})}return ee(["minner",s.isOver?"mover":"munder"],[a],e)},bk=(t,e)=>{var i=h0(t.label);return new se(t.isOver?"mover":"munder",[st(t.base,e),i])};ge({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:Mv,mathmlBuilder:bk});ge({type:"href",names:["\\href"],numArgs:2,argTypes:["url","original"],allowedInText:!0,handler:(t,e)=>{var{parser:i}=t,r=e[1],s=Oe(e[0],"url").url;return i.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:i.mode,href:s,body:Lt(r)}:i.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var i=qt(t.body,e,!1);return x9(t.href,[],i,e)},mathmlBuilder:(t,e)=>{var i=Us(t.body,e);return i instanceof se||(i=new se("mrow",[i])),i.setAttribute("href",t.href),i}});ge({type:"href",names:["\\url"],numArgs:1,argTypes:["url"],allowedInText:!0,handler:(t,e)=>{var{parser:i}=t,r=Oe(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:Lt(a)}}});ge({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:Lt(e[0])}},htmlBuilder(t,e){var i=qt(t.body,e.withFont(""),!1);return gs(i)},mathmlBuilder(t,e){return new se("mrow",Vi(t.body,e.withFont("")))}});ge({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=Oe(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 re("\\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:Lt(o)}:i.formatUnsupportedCmd(r)},htmlBuilder:(t,e)=>{var i=qt(t.body,e,!1),r=["enclosing"];t.attributes.class&&r.push(...t.attributes.class.trim().split(/\s+/));var s=ee(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)=>Us(t.body,e)});ge({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:Lt(e[0]),mathml:Lt(e[1])}},htmlBuilder:(t,e)=>{var i=qt(t.html,e,!1);return gs(i)},mathmlBuilder:(t,e)=>Us(t.mathml,e)});var Cc=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 re("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(i[1]+i[2]),unit:i[3]};if(!Z3(r))throw new re("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};ge({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=Oe(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=Cc(d);break;case"height":n=Cc(d);break;case"totalheight":o=Cc(d);break;default:throw new re("Invalid key: '"+h[0]+"' in \\includegraphics.")}}}var f=Oe(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=wt(t.height,e),r=0;t.totalheight.number>0&&(r=wt(t.totalheight,e)-i);var s=0;t.width.number>0&&(s=wt(t.width,e));var n={height:oe(i+r)};s>0&&(n.width=oe(s)),r>0&&(n.verticalAlign=oe(-r));var o=new c9(t.src,t.alt,n);return o.height=i,o.depth=r,o},mathmlBuilder:(t,e)=>{var i=new se("mglyph",[]);i.setAttribute("alt",t.alt);var r=wt(t.height,e),s=0;if(t.totalheight.number>0&&(s=wt(t.totalheight,e)-r,i.setAttribute("valign",oe(-s))),i.setAttribute("height",oe(r+s)),t.width.number>0){var n=wt(t.width,e);i.setAttribute("width",oe(n))}return i.setAttribute("src",t.src),i}});ge({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=Oe(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 sv(t.dimension,e)},mathmlBuilder(t,e){var i=wt(t.dimension,e);return new cv(i)}});ge({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=ee([],[Je(t.body,e)]),i=ee(["inner"],[i],e)):i=ee(["inner"],[Je(t.body,e)]);var r=ee(["fix"],[]),s=ee([t.alignment],[i,r],e),n=ee(["strut"]);return n.style.height=oe(s.height+s.depth),s.depth&&(n.style.verticalAlign=oe(-s.depth)),s.children.unshift(n),s=ee(["thinbox"],[s],e),ee(["mord","vbox"],[s],e)},mathmlBuilder:(t,e)=>{var i=new se("mpadded",[st(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}});ge({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}}});ge({type:"text",names:["\\)","\\]"],numArgs:0,allowedInText:!0,allowedInMath:!1,handler(t,e){throw new re("Mismatched "+t.funcName)}});var dg=(t,e)=>{switch(e.style.size){case Be.DISPLAY.size:return t.display;case Be.TEXT.size:return t.text;case Be.SCRIPT.size:return t.script;case Be.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};ge({type:"mathchoice",names:["\\mathchoice"],numArgs:4,primitive:!0,handler:(t,e)=>{var{parser:i}=t;return{type:"mathchoice",mode:i.mode,display:Lt(e[0]),text:Lt(e[1]),script:Lt(e[2]),scriptscript:Lt(e[3])}},htmlBuilder:(t,e)=>{var i=dg(t,e),r=qt(i,e,!1);return gs(r)},mathmlBuilder:(t,e)=>{var i=dg(t,e);return Us(i,e)}});var Tv=(t,e,i,r,s,n,o)=>{t=ee([],[t]);var a=i&&ps(i),l,u;if(e){var c=Je(e,r.havingStyle(s.sup()),r);u={elem:c,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-c.depth)}}if(i){var h=Je(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=Xe({positionType:"bottom",positionData:f,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:oe(-n)},{type:"kern",size:l.kern},{type:"elem",elem:t},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:oe(n)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else if(l){var p=t.height-o;d=Xe({positionType:"top",positionData:p,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:oe(-n)},{type:"kern",size:l.kern},{type:"elem",elem:t}]})}else if(u){var b=t.depth+o;d=Xe({positionType:"bottom",positionData:b,children:[{type:"elem",elem:t},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:oe(n)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else return t;var _=[d];if(l&&n!==0&&!a){var x=ee(["mspace"],[],r);x.style.marginRight=oe(n),_.unshift(x)}return ee(["mop","op-limits"],_,r)},Bv=new Set(["\\smallint"]),Rv=(t,e)=>{var i,r,s=!1,n;t.type==="supsub"?(i=t.sup,r=t.sub,n=Oe(t.base,"op"),s=!0):n=Oe(t,"op");var o=e.style,a=!1;o.size===Be.DISPLAY.size&&n.symbol&&!Bv.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=bi(n.name,c,"math",e,["mop","op-symbol",a?"large-op":"small-op"]),u=l.italic,h.length>0){var d=ov(h+"Size"+(a?"2":"1"),e);l=Xe({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=qt(n.body,e,!0);f.length===1&&f[0]instanceof qi?(l=f[0],l.classes[0]="mop"):l=ee(["mop"],f,e)}else{for(var p=[],b=1;b<n.name.length;b++)p.push(Vf(n.name[b],n.mode,e));l=ee(["mop"],p,e)}var _=0,x=0;if((l instanceof qi||n.name==="\\oiint"||n.name==="\\oiiint")&&!n.suppressBaseShift){var S;_=(l.height-l.depth)/2-e.fontMetrics().axisHeight,x=(S=l.italic)!=null?S:0}return s?Tv(l,i,r,e,o,x,_):(_&&(l.style.position="relative",l.style.top=oe(_)),l)},_k=(t,e)=>{var i;if(t.symbol)i=new se("mo",[ir(t.name,t.mode)]),Bv.has(t.name)&&i.setAttribute("largeop","false");else if(t.body)i=new se("mo",Vi(t.body,e));else{i=new se("mi",[new Ot(t.name.slice(1))]);var r=new se("mo",[ir("⁡","text")]);t.parentIsSupSub?i=new se("mrow",[i,r]):i=uv([i,r])}return i},yk={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};ge({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=yk[s]),{type:"op",mode:i.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:Rv,mathmlBuilder:_k});ge({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:Lt(r)}}});var wk={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};ge({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}}});ge({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}}});ge({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=wk[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}}});var Nv=(t,e)=>{var i,r,s=!1,n;t.type==="supsub"?(i=t.sup,r=t.sub,n=Oe(t.base,"operatorname"),s=!0):n=Oe(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=qt(a,e.withFont("mathrm"),!0),u=0;u<l.length;u++){var c=l[u];c instanceof qi&&(c.text=c.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=ee(["mop"],l,e)}else o=ee(["mop"],[],e);return s?Tv(o,i,r,e,e.style,0,0):o},xk=(t,e)=>{for(var i=Vi(t.body,e.withFont("mathrm")),r=!0,s=0;s<i.length;s++){var n=i[s];if(!(n instanceof cv))if(n instanceof se)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 Ot?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 Ot(a)]}var l=new se("mi",i);l.setAttribute("mathvariant","normal");var u=new se("mo",[ir("⁡","text")]);return t.parentIsSupSub?new se("mrow",[l,u]):uv([l,u])};ge({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:Lt(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:Nv,mathmlBuilder:xk});k("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Ln({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?gs(qt(t.body,e,!1)):ee(["mord"],qt(t.body,e,!0),e)},mathmlBuilder(t,e){return Us(t.body,e,!0)}});ge({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=Je(t.body,e.havingCrampedStyle()),r=ao("overline-line",e),s=e.fontMetrics().defaultRuleThickness,n=Xe({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:3*s},{type:"elem",elem:r},{type:"kern",size:s}]});return ee(["mord","overline"],[n],e)},mathmlBuilder(t,e){var i=new se("mo",[new Ot("‾")]);i.setAttribute("stretchy","true");var r=new se("mover",[st(t.body,e),i]);return r.setAttribute("accent","true"),r}});ge({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:Lt(r)}},htmlBuilder:(t,e)=>{var i=qt(t.body,e.withPhantom(),!1);return gs(i)},mathmlBuilder:(t,e)=>{var i=Vi(t.body,e);return new se("mphantom",i)}});k("\\hphantom","\\smash{\\phantom{#1}}");ge({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=ee(["inner"],[Je(t.body,e.withPhantom())]),r=ee(["fix"],[]);return ee(["mord","rlap"],[i,r],e)},mathmlBuilder:(t,e)=>{var i=Vi(Lt(t.body),e),r=new se("mphantom",i),s=new se("mpadded",[r]);return s.setAttribute("width","0px"),s}});ge({type:"raisebox",names:["\\raisebox"],numArgs:2,argTypes:["size","hbox"],allowedInText:!0,handler(t,e){var{parser:i}=t,r=Oe(e[0],"size").value,s=e[1];return{type:"raisebox",mode:i.mode,dy:r,body:s}},htmlBuilder(t,e){var i=Je(t.body,e),r=wt(t.dy,e);return Xe({positionType:"shift",positionData:-r,children:[{type:"elem",elem:i}]})},mathmlBuilder(t,e){var i=new se("mpadded",[st(t.body,e)]),r=t.dy.number+t.dy.unit;return i.setAttribute("voffset",r),i}});ge({type:"internal",names:["\\relax"],numArgs:0,allowedInText:!0,allowedInArgument:!0,handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});ge({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=Oe(e[0],"size"),o=Oe(e[1],"size");return{type:"rule",mode:r.mode,shift:s&&Oe(s,"size").value,width:n.value,height:o.value}},htmlBuilder(t,e){var i=ee(["mord","rule"],[],e),r=wt(t.width,e),s=wt(t.height,e),n=t.shift?wt(t.shift,e):0;return i.style.borderRightWidth=oe(r),i.style.borderTopWidth=oe(s),i.style.bottom=oe(n),i.width=r,i.height=s+n,i.depth=-n,i.maxFontSize=s*1.125*e.sizeMultiplier,i},mathmlBuilder(t,e){var i=wt(t.width,e),r=wt(t.height,e),s=t.shift?wt(t.shift,e):0,n=e.color&&e.getColor()||"black",o=new se("mspace");o.setAttribute("mathbackground",n),o.setAttribute("width",oe(i)),o.setAttribute("height",oe(r));var a=new se("mpadded",[o]);return s>=0?a.setAttribute("height",oe(s)):(a.setAttribute("height",oe(s)),a.setAttribute("depth",oe(-s))),a.setAttribute("voffset",oe(s)),a}});function Lv(t,e,i){for(var r=qt(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 gs(r)}var fg=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],Sk=(t,e)=>{var i=e.havingSize(t.size);return Lv(t.body,i,e)};ge({type:"sizing",names:fg,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:fg.indexOf(r)+1,body:n}},htmlBuilder:Sk,mathmlBuilder:(t,e)=>{var i=e.havingSize(t.size),r=Vi(t.body,i),s=new se("mstyle",r);return s.setAttribute("mathsize",oe(i.sizeMultiplier)),s}});ge({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]&&Oe(i[0],"ordgroup");if(o)for(var a,l=0;l<o.body.length;++l){var u=o.body[l];if(a=f0(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=ee([],[Je(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 ee(["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=Xe({positionType:"firstBaseline",children:[{type:"elem",elem:i}]});return ee(["mord"],[s],e)},mathmlBuilder:(t,e)=>{var i=new se("mpadded",[st(t.body,e)]);return t.smashHeight&&i.setAttribute("height","0px"),t.smashDepth&&i.setAttribute("depth","0px"),i}});ge({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=Je(t.body,e.havingCrampedStyle());i.height===0&&(i.height=e.fontMetrics().xHeight),i=lo(i,e);var r=e.fontMetrics(),s=r.defaultRuleThickness,n=s;e.style.id<Be.TEXT.id&&(n=e.fontMetrics().xHeight);var o=s+n/4,a=i.height+i.depth+o+s,{span:l,ruleWidth:u,advanceWidth:c}=sk(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=oe(c);var f=Xe({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(Be.SCRIPTSCRIPT),b=Je(t.index,p,e),_=.6*(f.height-f.depth),x=Xe({positionType:"shift",positionData:-_,children:[{type:"elem",elem:b}]}),S=ee(["root"],[x]);return ee(["mord","sqrt"],[S,f],e)}else return ee(["mord","sqrt"],[f],e)},mathmlBuilder(t,e){var{body:i,index:r}=t;return r?new se("mroot",[st(i,e),st(r,e)]):new se("msqrt",[st(i,e)])}});var fd={display:Be.DISPLAY,text:Be.TEXT,script:Be.SCRIPT,scriptscript:Be.SCRIPTSCRIPT};function kk(t){return t in fd}ge({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(!kk(o))throw new Error("Unknown style: "+o);return{type:"styling",mode:s.mode,style:o,body:n}},htmlBuilder(t,e){var i=fd[t.style],r=e.havingStyle(i);return t.resetFont&&(r=r.withFont("")),Lv(t.body,r,e)},mathmlBuilder(t,e){var i=fd[t.style],r=e.havingStyle(i);t.resetFont&&(r=r.withFont(""));var s=Vi(t.body,r),n=new se("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 Ck=function(e,i){var r=e.base;if(r)if(r.type==="op"){var s=r.limits&&(i.style.size===Be.DISPLAY.size||r.alwaysHandleSupSub);return s?Rv:null}else if(r.type==="operatorname"){var n=r.alwaysHandleSupSub&&(i.style.size===Be.DISPLAY.size||r.limits);return n?Nv:null}else{if(r.type==="accent")return ps(r.base)?pv:null;if(r.type==="horizBrace"){var o=!e.sub;return o===r.isOver?Mv:null}else return null}else return null};Ln({type:"supsub",htmlBuilder(t,e){var i=Ck(t,e);if(i)return i(t,e);var{base:r,sup:s,sub:n}=t,o=Je(r,e),a,l,u=e.fontMetrics(),c=0,h=0,d=r&&ps(r);if(s){var f=e.havingStyle(e.style.sup());a=Je(s,f,e),d||(c=o.height-f.fontMetrics().supDrop*f.sizeMultiplier/e.sizeMultiplier)}if(n){var p=e.havingStyle(e.style.sub());l=Je(n,p,e),d||(h=o.depth+p.fontMetrics().subDrop*p.sizeMultiplier/e.sizeMultiplier)}var b;e.style===Be.DISPLAY?b=u.sup1:e.style.cramped?b=u.sup3:b=u.sup2;var _=e.sizeMultiplier,x=oe(.5/u.ptPerEm/_),S=null;if(l){var E=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");if(o instanceof qi||E){var D;S=oe(-((D=o.italic)!=null?D:0))}}var M;if(a&&l){c=Math.max(c,b,a.depth+.25*u.xHeight),h=Math.max(h,u.sub2);var C=u.defaultRuleThickness,N=4*C;if(c-a.depth-(l.height-h)<N){h=N-(c-a.depth)+l.height;var W=.8*u.xHeight-(c-a.depth);W>0&&(c+=W,h-=W)}var q=[{type:"elem",elem:l,shift:h,marginRight:x,marginLeft:S},{type:"elem",elem:a,shift:-c,marginRight:x}];M=Xe({positionType:"individualShift",children:q})}else if(l){h=Math.max(h,u.sub1,l.height-.8*u.xHeight);var K=[{type:"elem",elem:l,marginLeft:S,marginRight:x}];M=Xe({positionType:"shift",positionData:h,children:K})}else if(a)c=Math.max(c,b,a.depth+.25*u.xHeight),M=Xe({positionType:"shift",positionData:-c,children:[{type:"elem",elem:a,marginRight:x}]});else throw new Error("supsub must have either sup or sub.");var V=ld(o,"right")||"mord";return ee([V],[o,ee(["msupsub"],[M])],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=[st(t.base,e)];t.sub&&n.push(st(t.sub,e)),t.sup&&n.push(st(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===Be.DISPLAY||u&&u.type==="operatorname"&&u.alwaysHandleSupSub&&(e.style===Be.DISPLAY||u.limits)?o="munderover":o="msubsup"}else{var l=t.base;l&&l.type==="op"&&l.limits&&(e.style===Be.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||e.style===Be.DISPLAY)?o="munder":o="msub"}else{var a=t.base;a&&a.type==="op"&&a.limits&&(e.style===Be.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||e.style===Be.DISPLAY)?o="mover":o="msup"}return new se(o,n)}});Ln({type:"atom",htmlBuilder(t,e){return Vf(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var i=new se("mo",[ir(t.text,t.mode)]);if(t.family==="bin"){var r=Yf(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 Ov={mi:"italic",mn:"normal",mtext:"normal"};Ln({type:"mathord",htmlBuilder(t,e){return c0(t,e)},mathmlBuilder(t,e){var i=new se("mi",[ir(t.text,t.mode,e)]),r=Yf(t,e)||"italic";return r!==Ov[i.type]&&i.setAttribute("mathvariant",r),i}});Ln({type:"textord",htmlBuilder(t,e){return c0(t,e)},mathmlBuilder(t,e){var i=ir(t.text,t.mode,e),r=Yf(t,e)||"normal",s;return t.mode==="text"?s=new se("mtext",[i]):/[0-9]/.test(t.text)?s=new se("mn",[i]):t.text==="\\prime"?s=new se("mo",[i]):s=new se("mi",[i]),r!==Ov[s.type]&&s.setAttribute("mathvariant",r),s}});var Ac={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Ec={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Ln({type:"spacing",htmlBuilder(t,e){if(Ec.hasOwnProperty(t.text)){var i=Ec[t.text].className||"";if(t.mode==="text"){var r=c0(t,e);return r.classes.push(i),r}else return ee(["mspace",i],[Vf(t.text,t.mode,e)],e)}else{if(Ac.hasOwnProperty(t.text))return ee(["mspace",Ac[t.text]],[],e);throw new re('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var i;if(Ec.hasOwnProperty(t.text))i=new se("mtext",[new Ot(" ")]);else{if(Ac.hasOwnProperty(t.text))return new se("mspace");throw new re('Unknown type of space "'+t.text+'"')}return i}});var pg=()=>{var t=new se("mtd",[]);return t.setAttribute("width","50%"),t};Ln({type:"tag",mathmlBuilder(t,e){var i=new se("mtable",[new se("mtr",[pg(),new se("mtd",[Us(t.body,e)]),pg(),new se("mtd",[Us(t.tag,e)])])]);return i.setAttribute("width","100%"),i}});var mg={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},gg={"\\textbf":"textbf","\\textmd":"textmd"},Ak={"\\textit":"textit","\\textup":"textup"},vg=(t,e)=>{var i=t.font;if(i){if(mg[i])return e.withTextFontFamily(mg[i]);if(gg[i])return e.withTextFontWeight(gg[i]);if(i==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(Ak[i])};ge({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:Lt(s),font:r}},htmlBuilder(t,e){var i=vg(t,e),r=qt(t.body,i,!0);return ee(["mord","text"],r,i)},mathmlBuilder(t,e){var i=vg(t,e);return Us(t.body,i)}});ge({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=Je(t.body,e),r=ao("underline-line",e),s=e.fontMetrics().defaultRuleThickness,n=Xe({positionType:"top",positionData:i.height,children:[{type:"kern",size:s},{type:"elem",elem:r},{type:"kern",size:3*s},{type:"elem",elem:i}]});return ee(["mord","underline"],[n],e)},mathmlBuilder(t,e){var i=new se("mo",[new Ot("‾")]);i.setAttribute("stretchy","true");var r=new se("munder",[st(t.body,e),i]);return r.setAttribute("accentunder","true"),r}});ge({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=Je(t.body,e),r=e.fontMetrics().axisHeight,s=.5*(i.height-r-(i.depth+r));return Xe({positionType:"shift",positionData:s,children:[{type:"elem",elem:i}]})},mathmlBuilder(t,e){var i=new se("mpadded",[st(t.body,e)],["vcenter"]);return new se("mrow",[i])}});ge({type:"verb",names:["\\verb"],numArgs:0,allowedInText:!0,handler(t,e,i){throw new re("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var i=bg(t),r=[],s=e.havingStyle(e.style.text()),n=0;n<i.length;n++){var o=i[n];o==="~"&&(o="\\textasciitilde"),r.push(bi(o,"Typewriter-Regular",t.mode,s,["mord","texttt"]))}return ee(["mord","text"].concat(s.sizingClasses(e)),rv(r),s)},mathmlBuilder(t,e){var i=new Ot(bg(t)),r=new se("mtext",[i]);return r.setAttribute("mathvariant","monospace"),r}});var bg=t=>t.body.replace(/ /g,t.star?"␣":" "),js=av,Pv=`[ \r
306
+ ]`,Ek="\\\\[a-zA-Z@]+",Dk="\\\\[^\uD800-\uDFFF]",Mk="("+Ek+")"+Pv+"*",Tk=`\\\\(
307
+ |[ \r ]+
308
+ ?)[ \r ]*`,pd="[̀-ͯ]",Bk=new RegExp(pd+"+$"),Rk="("+Pv+"+)|"+(Tk+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(pd+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(pd+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+Mk)+("|"+Dk+")");class _g{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(Rk,"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 Hi("EOF",new Ti(this,i,i));var r=this.tokenRegex.exec(e);if(r===null||r.index!==i)throw new re("Unexpected character: '"+e[i]+"'",new Hi(e[i],new Ti(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 Hi(s,new Ti(this,i,this.tokenRegex.lastIndex))}}class Nk{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 re("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 Lk=Av;k("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});k("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}});k("\\@firstoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[0],numArgs:0}});k("\\@secondoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[1],numArgs:0}});k("\\@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}});k("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");k("\\TextOrMath",function(t){var e=t.consumeArgs(2);return t.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var yg={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};k("\\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 re("\\char` missing argument");r=e.text.charCodeAt(0)}else i=10;if(i){if(r=yg[e.text],r==null||r>=i)throw new re("Invalid base-"+i+" digit "+e.text);for(var s;(s=yg[t.future().text])!=null&&s<i;)r*=i,r+=s,t.popToken()}return"\\@char{"+r+"}"});var Qf=(t,e,i,r)=>{var s=t.consumeArg().tokens;if(s.length!==1)throw new re("\\newcommand's first argument must be a macro name");var n=s[0].text,o=t.isDefined(n);if(o&&!e)throw new re("\\newcommand{"+n+"} attempting to redefine "+(n+"; use \\renewcommand"));if(!o&&!i)throw new re("\\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 re("Invalid number of arguments: "+l);a=parseInt(l),s=t.consumeArg().tokens}return o&&r||t.macros.set(n,{tokens:s,numArgs:a}),""};k("\\newcommand",t=>Qf(t,!1,!0,!1));k("\\renewcommand",t=>Qf(t,!0,!1,!1));k("\\providecommand",t=>Qf(t,!0,!0,!0));k("\\message",t=>{var e=t.consumeArgs(1)[0];return console.log(e.reverse().map(i=>i.text).join("")),""});k("\\errmessage",t=>{var e=t.consumeArgs(1)[0];return console.error(e.reverse().map(i=>i.text).join("")),""});k("\\show",t=>{var e=t.popToken(),i=e.text;return console.log(e,t.macros.get(i),js[i],ft.math[i],ft.text[i]),""});k("\\bgroup","{");k("\\egroup","}");k("~","\\nobreakspace");k("\\lq","`");k("\\rq","'");k("\\aa","\\r a");k("\\AA","\\r A");k("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");k("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");k("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");k("ℬ","\\mathscr{B}");k("ℰ","\\mathscr{E}");k("ℱ","\\mathscr{F}");k("ℋ","\\mathscr{H}");k("ℐ","\\mathscr{I}");k("ℒ","\\mathscr{L}");k("ℳ","\\mathscr{M}");k("ℛ","\\mathscr{R}");k("ℭ","\\mathfrak{C}");k("ℌ","\\mathfrak{H}");k("ℨ","\\mathfrak{Z}");k("\\Bbbk","\\Bbb{k}");k("\\llap","\\mathllap{\\textrm{#1}}");k("\\rlap","\\mathrlap{\\textrm{#1}}");k("\\clap","\\mathclap{\\textrm{#1}}");k("\\mathstrut","\\vphantom{(}");k("\\underbar","\\underline{\\text{#1}}");k("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');k("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");k("\\ne","\\neq");k("≠","\\neq");k("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");k("∉","\\notin");k("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");k("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");k("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");k("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");k("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");k("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");k("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");k("⟂","\\perp");k("‼","\\mathclose{!\\mkern-0.8mu!}");k("∌","\\notni");k("⌜","\\ulcorner");k("⌝","\\urcorner");k("⌞","\\llcorner");k("⌟","\\lrcorner");k("©","\\copyright");k("®","\\textregistered");k("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');k("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');k("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');k("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');k("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");k("⋮","\\vdots");k("\\varGamma","\\mathit{\\Gamma}");k("\\varDelta","\\mathit{\\Delta}");k("\\varTheta","\\mathit{\\Theta}");k("\\varLambda","\\mathit{\\Lambda}");k("\\varXi","\\mathit{\\Xi}");k("\\varPi","\\mathit{\\Pi}");k("\\varSigma","\\mathit{\\Sigma}");k("\\varUpsilon","\\mathit{\\Upsilon}");k("\\varPhi","\\mathit{\\Phi}");k("\\varPsi","\\mathit{\\Psi}");k("\\varOmega","\\mathit{\\Omega}");k("\\substack","\\begin{subarray}{c}#1\\end{subarray}");k("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");k("\\boxed","\\fbox{$\\displaystyle{#1}$}");k("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");k("\\implies","\\DOTSB\\;\\Longrightarrow\\;");k("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");k("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");k("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var wg={",":"\\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"},Ok=new Set(["bin","rel"]);k("\\dots",function(t){var e="\\dotso",i=t.expandAfterFuture().text;return i in wg?e=wg[i]:(i.slice(0,4)==="\\not"||i in ft.math&&Ok.has(ft.math[i].group))&&(e="\\dotsb"),e});var e1={")":!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};k("\\dotso",function(t){var e=t.future().text;return e in e1?"\\ldots\\,":"\\ldots"});k("\\dotsc",function(t){var e=t.future().text;return e in e1&&e!==","?"\\ldots\\,":"\\ldots"});k("\\cdots",function(t){var e=t.future().text;return e in e1?"\\@cdots\\,":"\\@cdots"});k("\\dotsb","\\cdots");k("\\dotsm","\\cdots");k("\\dotsi","\\!\\cdots");k("\\dotsx","\\ldots\\,");k("\\DOTSI","\\relax");k("\\DOTSB","\\relax");k("\\DOTSX","\\relax");k("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");k("\\,","\\tmspace+{3mu}{.1667em}");k("\\thinspace","\\,");k("\\>","\\mskip{4mu}");k("\\:","\\tmspace+{4mu}{.2222em}");k("\\medspace","\\:");k("\\;","\\tmspace+{5mu}{.2777em}");k("\\thickspace","\\;");k("\\!","\\tmspace-{3mu}{.1667em}");k("\\negthinspace","\\!");k("\\negmedspace","\\tmspace-{4mu}{.2222em}");k("\\negthickspace","\\tmspace-{5mu}{.277em}");k("\\enspace","\\kern.5em ");k("\\enskip","\\hskip.5em\\relax");k("\\quad","\\hskip1em\\relax");k("\\qquad","\\hskip2em\\relax");k("\\tag","\\@ifstar\\tag@literal\\tag@paren");k("\\tag@paren","\\tag@literal{({#1})}");k("\\tag@literal",t=>{if(t.macros.get("\\df@tag"))throw new re("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});k("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");k("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");k("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");k("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");k("\\newline","\\\\\\relax");k("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var Fv=oe(Nr["Main-Regular"][84][1]-.7*Nr["Main-Regular"][65][1]);k("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+Fv+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");k("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+Fv+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");k("\\hspace","\\@ifstar\\@hspacer\\@hspace");k("\\@hspace","\\hskip #1\\relax");k("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");k("\\ordinarycolon",":");k("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");k("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');k("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');k("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');k("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');k("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');k("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');k("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');k("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');k("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');k("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');k("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');k("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');k("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');k("∷","\\dblcolon");k("∹","\\eqcolon");k("≔","\\coloneqq");k("≕","\\eqqcolon");k("⩴","\\Coloneqq");k("\\ratio","\\vcentcolon");k("\\coloncolon","\\dblcolon");k("\\colonequals","\\coloneqq");k("\\coloncolonequals","\\Coloneqq");k("\\equalscolon","\\eqqcolon");k("\\equalscoloncolon","\\Eqqcolon");k("\\colonminus","\\coloneq");k("\\coloncolonminus","\\Coloneq");k("\\minuscolon","\\eqcolon");k("\\minuscoloncolon","\\Eqcolon");k("\\coloncolonapprox","\\Colonapprox");k("\\coloncolonsim","\\Colonsim");k("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");k("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");k("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");k("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");k("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");k("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");k("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");k("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");k("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");k("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");k("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");k("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");k("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");k("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");k("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");k("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");k("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");k("\\nleqq","\\html@mathml{\\@nleqq}{≰}");k("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");k("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");k("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");k("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");k("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");k("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");k("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");k("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");k("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");k("\\imath","\\html@mathml{\\@imath}{ı}");k("\\jmath","\\html@mathml{\\@jmath}{ȷ}");k("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");k("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");k("⟦","\\llbracket");k("⟧","\\rrbracket");k("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");k("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");k("⦃","\\lBrace");k("⦄","\\rBrace");k("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");k("⦵","\\minuso");k("\\darr","\\downarrow");k("\\dArr","\\Downarrow");k("\\Darr","\\Downarrow");k("\\lang","\\langle");k("\\rang","\\rangle");k("\\uarr","\\uparrow");k("\\uArr","\\Uparrow");k("\\Uarr","\\Uparrow");k("\\N","\\mathbb{N}");k("\\R","\\mathbb{R}");k("\\Z","\\mathbb{Z}");k("\\alef","\\aleph");k("\\alefsym","\\aleph");k("\\Alpha","\\mathrm{A}");k("\\Beta","\\mathrm{B}");k("\\bull","\\bullet");k("\\Chi","\\mathrm{X}");k("\\clubs","\\clubsuit");k("\\cnums","\\mathbb{C}");k("\\Complex","\\mathbb{C}");k("\\Dagger","\\ddagger");k("\\diamonds","\\diamondsuit");k("\\empty","\\emptyset");k("\\Epsilon","\\mathrm{E}");k("\\Eta","\\mathrm{H}");k("\\exist","\\exists");k("\\harr","\\leftrightarrow");k("\\hArr","\\Leftrightarrow");k("\\Harr","\\Leftrightarrow");k("\\hearts","\\heartsuit");k("\\image","\\Im");k("\\infin","\\infty");k("\\Iota","\\mathrm{I}");k("\\isin","\\in");k("\\Kappa","\\mathrm{K}");k("\\larr","\\leftarrow");k("\\lArr","\\Leftarrow");k("\\Larr","\\Leftarrow");k("\\lrarr","\\leftrightarrow");k("\\lrArr","\\Leftrightarrow");k("\\Lrarr","\\Leftrightarrow");k("\\Mu","\\mathrm{M}");k("\\natnums","\\mathbb{N}");k("\\Nu","\\mathrm{N}");k("\\Omicron","\\mathrm{O}");k("\\plusmn","\\pm");k("\\rarr","\\rightarrow");k("\\rArr","\\Rightarrow");k("\\Rarr","\\Rightarrow");k("\\real","\\Re");k("\\reals","\\mathbb{R}");k("\\Reals","\\mathbb{R}");k("\\Rho","\\mathrm{P}");k("\\sdot","\\cdot");k("\\sect","\\S");k("\\spades","\\spadesuit");k("\\sub","\\subset");k("\\sube","\\subseteq");k("\\supe","\\supseteq");k("\\Tau","\\mathrm{T}");k("\\thetasym","\\vartheta");k("\\weierp","\\wp");k("\\Zeta","\\mathrm{Z}");k("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");k("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");k("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");k("\\bra","\\mathinner{\\langle{#1}|}");k("\\ket","\\mathinner{|{#1}\\rangle}");k("\\braket","\\mathinner{\\langle{#1}\\rangle}");k("\\Bra","\\left\\langle#1\\right|");k("\\Ket","\\left|#1\\right\\rangle");var Iv=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}};k("\\bra@ket",Iv(!1));k("\\bra@set",Iv(!0));k("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");k("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");k("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");k("\\angln","{\\angl n}");k("\\blue","\\textcolor{##6495ed}{#1}");k("\\orange","\\textcolor{##ffa500}{#1}");k("\\pink","\\textcolor{##ff00af}{#1}");k("\\red","\\textcolor{##df0030}{#1}");k("\\green","\\textcolor{##28ae7b}{#1}");k("\\gray","\\textcolor{gray}{#1}");k("\\purple","\\textcolor{##9d38bd}{#1}");k("\\blueA","\\textcolor{##ccfaff}{#1}");k("\\blueB","\\textcolor{##80f6ff}{#1}");k("\\blueC","\\textcolor{##63d9ea}{#1}");k("\\blueD","\\textcolor{##11accd}{#1}");k("\\blueE","\\textcolor{##0c7f99}{#1}");k("\\tealA","\\textcolor{##94fff5}{#1}");k("\\tealB","\\textcolor{##26edd5}{#1}");k("\\tealC","\\textcolor{##01d1c1}{#1}");k("\\tealD","\\textcolor{##01a995}{#1}");k("\\tealE","\\textcolor{##208170}{#1}");k("\\greenA","\\textcolor{##b6ffb0}{#1}");k("\\greenB","\\textcolor{##8af281}{#1}");k("\\greenC","\\textcolor{##74cf70}{#1}");k("\\greenD","\\textcolor{##1fab54}{#1}");k("\\greenE","\\textcolor{##0d923f}{#1}");k("\\goldA","\\textcolor{##ffd0a9}{#1}");k("\\goldB","\\textcolor{##ffbb71}{#1}");k("\\goldC","\\textcolor{##ff9c39}{#1}");k("\\goldD","\\textcolor{##e07d10}{#1}");k("\\goldE","\\textcolor{##a75a05}{#1}");k("\\redA","\\textcolor{##fca9a9}{#1}");k("\\redB","\\textcolor{##ff8482}{#1}");k("\\redC","\\textcolor{##f9685d}{#1}");k("\\redD","\\textcolor{##e84d39}{#1}");k("\\redE","\\textcolor{##bc2612}{#1}");k("\\maroonA","\\textcolor{##ffbde0}{#1}");k("\\maroonB","\\textcolor{##ff92c6}{#1}");k("\\maroonC","\\textcolor{##ed5fa6}{#1}");k("\\maroonD","\\textcolor{##ca337c}{#1}");k("\\maroonE","\\textcolor{##9e034e}{#1}");k("\\purpleA","\\textcolor{##ddd7ff}{#1}");k("\\purpleB","\\textcolor{##c6b9fc}{#1}");k("\\purpleC","\\textcolor{##aa87ff}{#1}");k("\\purpleD","\\textcolor{##7854ab}{#1}");k("\\purpleE","\\textcolor{##543b78}{#1}");k("\\mintA","\\textcolor{##f5f9e8}{#1}");k("\\mintB","\\textcolor{##edf2df}{#1}");k("\\mintC","\\textcolor{##e0e5cc}{#1}");k("\\grayA","\\textcolor{##f6f7f7}{#1}");k("\\grayB","\\textcolor{##f0f1f2}{#1}");k("\\grayC","\\textcolor{##e3e5e6}{#1}");k("\\grayD","\\textcolor{##d6d8da}{#1}");k("\\grayE","\\textcolor{##babec2}{#1}");k("\\grayF","\\textcolor{##888d93}{#1}");k("\\grayG","\\textcolor{##626569}{#1}");k("\\grayH","\\textcolor{##3b3e40}{#1}");k("\\grayI","\\textcolor{##21242c}{#1}");k("\\kaBlue","\\textcolor{##314453}{#1}");k("\\kaGreen","\\textcolor{##71B307}{#1}");var zv={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class Pk{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 Nk(Lk,i.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new _g(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 Hi("EOF",r.loc)),this.pushTokens(s),new Hi("",Ti.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 re("Extra }",n)}else if(n.text==="EOF")throw new re("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 re("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 re("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 re("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 re("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 re("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 re("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 Hi(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 _g(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)||js.hasOwnProperty(e)||ft.math.hasOwnProperty(e)||ft.text.hasOwnProperty(e)||zv.hasOwnProperty(e)}isExpandable(e){var i=this.macros.get(e);return i!=null?typeof i=="string"||typeof i=="function"||!i.unexpandable:js.hasOwnProperty(e)&&!js[e].primitive}}var xg=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,xl=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),Dc={"́":{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"}},Sg={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};let jv=class Hv{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 Pk(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 re("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 Hi("}")),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(Hv.endOfExpression.has(s.text)||i&&s.text===i||e&&js[s.text]&&js[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 re("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 re("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 re("Limit controls must follow a math operator",n);this.consume()}else if(n.text==="^"){if(r)throw new re("Double superscript",n);r=this.handleSupSubscript("superscript")}else if(n.text==="_"){if(s)throw new re("Double subscript",n);s=this.handleSupSubscript("subscript")}else if(n.text==="'"){if(r)throw new re("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(xl[n.text]){var l=xg.test(n.text),u=[];for(u.push(new Hi(xl[n.text])),this.consume();;){var c=this.fetch().text;if(!xl[c]||xg.test(c)!==l)break;u.unshift(new Hi(xl[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=js[s];if(!n)return null;if(this.consume(),i&&i!=="atom"&&!n.allowedInArgument)throw new re("Got function '"+s+"' with no arguments"+(i?" as "+i:""),r);if(this.mode==="text"&&!n.allowedInText)throw new re("Can't use function '"+s+"' in text mode",r);if(this.mode==="math"&&n.allowedInMath===!1)throw new re("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=js[e];if(a&&a.handler)return a.handler(o,i,r);throw new re("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 re("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 re("A primitive argument cannot be optional");var o=this.parseGroup(e);if(o==null)throw new re("Expected group as "+e,this.fetch());return o}case"original":case void 0:return this.parseArgumentGroup(r);default:throw new re("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 re("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 re("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 re("Invalid size: '"+i.text+"'",i);var n={number:+(s[1]+s[2]),unit:s[3]};if(!Z3(n))throw new re("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:Ti.range(r,l),body:a,semisimple:s==="\\begingroup"||void 0}}else if(n=this.parseFunction(i,e)||this.parseSymbol(),n==null&&s[0]==="\\"&&!zv.hasOwnProperty(s)){if(this.settings.throwOnError)throw new re("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:Ti.range(s,a),text:"---"}),i-=2):(e.splice(r,2,{type:"textord",mode:"text",loc:Ti.range(s,o),text:"--"}),i-=1)}(n==="'"||n==="`")&&o.text===n&&(e.splice(r,2,{type:"textord",mode:"text",loc:Ti.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 re(`\\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}}Sg.hasOwnProperty(i[0])&&!ft[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=Sg[i[0]]+i.slice(1));var n=Bk.exec(i);n&&(i=i.substring(0,n.index),i==="i"?i="ı":i==="j"&&(i="ȷ"));var o;if(ft[this.mode][i]){this.settings.strict&&this.mode==="math"&&ed.includes(i)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+i[0]+'" used in math mode',e);var a=ft[this.mode][i].group,l=Ti.range(e),u;$9(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&&(J3(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:Ti.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(!Dc[h])throw new re("Unknown accent ' "+h+"'",e);var d=Dc[h][this.mode]||Dc[h].text;if(!d)throw new re("Accent "+h+" unsupported in "+this.mode+" mode",e);o={type:"accent",mode:this.mode,loc:Ti.range(e),label:d,isStretchy:!1,isShifty:!0,base:o}}return o}};jv.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var t1=function(e,i){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var r=new jv(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 re("\\tag works only in display equations");s=[{type:"tag",mode:"text",body:s,tag:r.subparse([new Hi("\\df@tag")])}]}return s},$v=function(e,i,r){i.textContent="";var s=i1(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."),$v=function(){throw new re("KaTeX doesn't work in quirks mode.")});var Fk=function(e,i){var r=i1(e,i).toMarkup();return r},Ik=function(e,i){var r=new $f(i);return t1(e,r)},qv=function(e,i,r){if(r.throwOnError||!(e instanceof re))throw e;var s=ee(["katex-error"],[new qi(i)]);return s.setAttribute("title",e.toString()),s.setAttribute("style","color:"+r.errorColor),s},i1=function(e,i){var r=new $f(i);try{var s=t1(e,r);return L9(s,e,r)}catch(n){return qv(n,e,r)}},zk=function(e,i){var r=new $f(i);try{var s=t1(e,r);return O9(s,e,r)}catch(n){return qv(n,e,r)}},jk="0.17.0",Hk={Span:xo,Anchor:l0,SymbolNode:qi,SvgNode:us,PathNode:Ks,LineNode:Qh},$k={version:jk,render:$v,renderToString:Fk,ParseError:re,SETTINGS_SCHEMA:Xh,__parse:Ik,__renderToDomTree:i1,__renderToHTMLTree:zk,__setFontMetrics:m9,__defineSymbol:g,__defineFunction:ge,__defineMacro:k,__domTree:Hk};const qk=Object.freeze({throwOnError:!1,strict:"ignore"}),ou=(t,e)=>{let i=0;for(let r=e-1;r>=0&&t[r]==="\\";r-=1)i+=1;return i%2===1},Wk=(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)||ou(t,r))&&!(i==="$"&&(t[r+1]==="$"||/\d/.test(t[r+1]||""))))return r}return-1},Kk=t=>{const e=/^\/api\/(?:evidence|yatsu\/blob)\/([0-9a-f]{64})$/i.exec(String(t||""));return(e==null?void 0:e[1])||null},Vk=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]!=="$"&&!ou(e.src,r)?(s="$",n="$"):e.src.startsWith("\\(",r)&&!ou(e.src,r)&&(s="\\(",n="\\)"),!s||/\s/.test(e.src[r+s.length]||""))return!1;const o=Wk(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]),b=p.lastIndexOf(l);if(b>=0&&!ou(p,b)&&p.slice(b+l.length).trim()===""){f===i?u[0]=p.slice(0,b):u.push(p.slice(0,b)),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"]})},Uk=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:Kk(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})},Gk=new tr({linkify:!0,html:!1}).use(Vk).use(Uk),Yk=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 Xk(t){const e=t==null?"":String(t);return Yk(Gk.parse(e,{}))}function mR(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 Wv=t=>/^(?:https?:|mailto:|#|\/)/i.test(String(t||""))?String(t):null,Bi=(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}},wn=(t,e)=>{var i;return((i=t==null?void 0:t.attrGet)==null?void 0:i.call(t,e))??null},kg=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},zo=new Map,Jk=512,Zk=(t,e)=>{const i=`${e?"d":"i"}\0${t}`;if(zo.has(i))return zo.get(i);let r=null;try{r=$k.renderToString(t,{...qk,displayMode:e})}catch{r=null}return zo.size>=Jk&&zo.clear(),zo.set(i,r),r},Kv=(t,e,i,r={})=>{const s=Zk(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}})},Cg=(t,e,i,r)=>{const s=Bi(e,r.lineBase);if(e.type==="link_open"){const n=Wv(wn(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",Bi(l,i.lineBase),l.content));else if(l.type==="prose_math_inline")n().push(Kv(t,l,!1,Bi(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,Bi(l,i.lineBase));n().push(u??t("span",{...Bi(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,Bi(l,i.lineBase));n().push(u??t("a",{...Bi(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=Wv(wn(l,"src"));n().push(u?t("img",{...Bi(l,i.lineBase),className:"doc-image",src:u,alt:l.content||wn(l,"alt")||"",title:wn(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(Cg(t,u.token,u.children,i))}for(;s.length>1;){const l=s.pop();n().push(Cg(t,l.token,l.children,i))}return r},Ag=(t,e,i,r)=>{const s=Bi(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:wn(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:kg(wn(e,"style"))},i);case"td_open":return t("td",{...s,style:kg(wn(e,"style"))},i);default:return i}};function eC(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",{...Bi(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(Kv(i,l,!0,Bi(l,e.lineBase)));else if(l.type==="prose_time_anchor"){const u=(a=e.renderTimeAnchor)==null?void 0:a.call(e,l.meta,l,Bi(l,e.lineBase));n().push(u??i("span",{...Bi(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",Bi(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(Ag(i,u.token,u.children,e))}for(;s.length>1;){const l=s.pop();n().push(Ag(i,l.token,l.children,e))}return r}function tC({children:t,className:e="",lineBase:i=0,softBreak:r,renderSpecRef:s,renderEvidence:n,renderTimeAnchor:o}){const a=A.useMemo(()=>{try{return Xk(t)}catch{return null}},[t]),l=a?eC(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?A.createElement(c,p,...d):A.createElement(c,p,h,...d)}})(),lineBase:i,softBreak:r,renderSpecRef:s,renderEvidence:n,renderTimeAnchor:o}):A.createElement("p",null,t==null?"":String(t));return A.createElement("div",{className:e},l)}function Vv({children:t,className:e="",softBreak:i,renderSpecRef:r,renderEvidence:s,renderTimeAnchor:n}){const o=r||((l,u,c)=>A.createElement("span",{className:"doc-ref","data-spec-id":l,...c},l)),a=s||((l,u,c)=>A.createElement("a",{className:"doc-evidence",href:l.src,"data-evidence-hash":l.hash,...c},l.alt||l.hash));return A.createElement(tC,{className:`rich-text${e?` ${e}`:""}`,softBreak:i,renderSpecRef:o,renderEvidence:a,renderTimeAnchor:n},t)}const Eg=t=>{const e=document.createRange();return e.selectNode(t),e};function iC(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=Eg(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=Eg(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("")}const uo=t=>gi(`/api/evidence/${t}`);function rC({src:t,alt:e,onClose:i}){return ui(!0,i),m.jsx("div",{className:"lightbox",onClick:i,children:m.jsx("img",{src:t,alt:e})})}function sC({hash:t}){const e=He(),[i,r]=A.useState(null);return A.useEffect(()=>{let s=!0;return fetch(uo(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 nC({hash:t,collapsed:e=!1}){const i=He(),[r,s]=A.useState(null);if(A.useEffect(()=>{let o=!0;return fetch(uo(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 oC({hash:t,alt:e}){const[i,r]=A.useState(!1);return m.jsxs(m.Fragment,{children:[m.jsx("img",{className:"an-image",src:uo(t),alt:e,loading:"lazy",onClick:()=>r(!0)}),i&&m.jsx(rC,{src:uo(t),alt:e,onClose:()=>r(!1)})]})}function aC({exit:t}){return m.jsx(Pe,{name:t?"minimize":"maximize",size:15})}function gR({target:t,className:e=""}){const i=He(),[r,s]=A.useState(!1);A.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(aC,{exit:r})})}function lC({e:t,alt:e="",collapsed:i=!1}){const r=He();return t.state==="miss"?m.jsx("div",{className:"eval-noimg",children:r("nodeView.eval.miss")}):t.kind==="transcript"?m.jsx(sC,{hash:t.hash}):t.kind==="data"?m.jsx(nC,{hash:t.hash,collapsed:i}):t.kind==="video"?m.jsx("video",{className:"eval-video",src:uo(t.hash),controls:!0,preload:"metadata",playsInline:!0}):m.jsx(oC,{hash:t.hash,alt:e})}const Sl=new Map;function uC(t){const[e,i]=A.useState(()=>Sl.get(t)??null);return A.useEffect(()=>{if(Sl.has(t)){i(Sl.get(t));return}let r=!0;return fetch(uo(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"};Sl.set(t,o),r&&i(o)}).catch(()=>{r&&i({kind:"image",state:"miss"})}),()=>{r=!1}},[t]),e}function cC({hash:t,alt:e=""}){const i=uC(t);return i?m.jsx(lC,{e:{hash:t,...i},alt:e}):null}function hC(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 au(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 md=A.forwardRef(function({value:e,className:i="",...r},s){const n=A.useRef(null);return A.useImperativeHandle(s,()=>n.current),A.useLayoutEffect(()=>{const o=n.current;if(!o)return;const a=getComputedStyle(o);hC(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})});function dC({className:t="",preview:e=null,editor:i,footer:r,...s}){return m.jsxs("div",{className:`composer-surface ${t}`.trim(),...s,children:[e,m.jsx("div",{className:"composer-editor",children:i}),m.jsx("div",{className:"composer-footer",children:r})]})}const fC={command:"terminal",read:"eye",write:"pencil",search:"search",tool:"command"};function pC({sessionId:t,active:e}){const i=He(),[r,s]=A.useState(null),[n,o]=A.useState(!1),[a,l]=A.useState(()=>new Set);if(A.useEffect(()=>{if(e)return s(null),H5(t,s)},[t,e]),A.useEffect(()=>{r!=null&&r.workingNote||o(!1)},[r==null?void 0:r.workingNote]),A.useEffect(()=>l(new Set),[r==null?void 0:r.turnId,r==null?void 0:r.workingNote]),!(r!=null&&r.workingNote))return null;const u=c=>l(h=>{const d=new Set(h);return d.has(c)?d.delete(c):d.add(c),d});return m.jsxs("div",{className:"m-execution-trace",children:[m.jsxs("button",{type:"button",className:"m-execution-entry",onClick:()=>o(!0),"aria-label":i("session.executionOpen"),children:[m.jsx(Pe,{name:"list-checks",size:15}),m.jsx("span",{children:r.workingNote}),m.jsx(Pe,{name:"chevron-right",size:15})]}),n&&m.jsxs(Yn,{title:i("session.executionTitle"),closeLabel:i("session.executionClose"),className:"execution-trace-modal",onClose:()=>o(!1),children:[m.jsx("div",{className:"execution-note",children:r.workingNote}),m.jsx("ol",{className:"execution-steps",children:r.steps.length?r.steps.map(c=>{const h=!!c.detail,d=h&&a.has(c.id),f=`execution-step-${c.id}`,p=m.jsxs(m.Fragment,{children:[m.jsx(Pe,{name:fC[c.kind]||"command",size:16}),m.jsx("span",{className:"execution-step-label",children:c.label}),m.jsx("span",{className:"execution-step-state",children:i(c.state==="running"?"session.executionRunning":"session.executionDone")}),h&&m.jsx(Pe,{name:d?"chevron-down":"chevron-right",size:15})]});return m.jsxs("li",{className:`execution-step ${c.state}${d?" expanded":""}`,children:[h?m.jsx("button",{type:"button",className:"execution-step-toggle",onClick:()=>u(c.id),"aria-expanded":d,"aria-controls":f,children:p}):m.jsx("div",{className:"execution-step-row",children:p}),d&&m.jsx("div",{id:f,className:"execution-step-detail",children:c.detail})]},c.id)}):m.jsx("li",{className:"execution-empty",children:i("session.executionEmpty")})})]})]})}const lu=t=>new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),mC=t=>new Date(t).toLocaleDateString([],{month:"short",day:"numeric"}),Dg=t=>new Date(t).toDateString(),Mg=t=>typeof t=="number"?t:Date.parse(t),Mc=new Map;function Eu({children:t,className:e=""}){return m.jsx(Vv,{className:e,softBreak:"break",renderSpecRef:(i,r,s)=>{const n=Ut("spec",i);return m.jsx("a",{className:"doc-link",href:n,...s,onClick:o=>f5(o,n),children:i})},renderEvidence:(i,r,s)=>m.jsx("span",{className:"rich-evidence",...s,children:m.jsx(cC,{hash:i.hash,alt:i.alt||"evidence"})}),children:t})}function Tg(t,e,i){return`${t}:${e}:${i}`}function Tc(t,e){return`${t}:${e}`}const gC=/\n*— from session (?:"(.*?)" \(([^\s)]+)\)|(\S+))(?: on machine \S+)?\. To reply: spex session send (?:--ssh \S+ )?\S+ "<your reply>"\s*$/;function Uv(t){const e=gC.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 vC(t,e){const i=[];let r=null;const s=(n,o=!1)=>{r&&i.push({...r,to:n,open:o}),r=null};for(const n of t){const o=n.display||n.status;if(n.kind==="status"&&o==="working"&&!n.note){r??(r={kind:"seam",ts:n.ts,from:Mg(n.ts)});continue}s(Mg(n.ts)),n.kind==="sent"?i.push({kind:"quote",ts:n.ts,from:n.from,...Uv(n.text)}):o==="error"||o==="corrupt"?i.push({kind:"event",ts:n.ts,status:o,text:n.note}):i.push({kind:"say",ts:n.ts,status:o,text:n.note})}return r&&s(Math.max(r.from+1,e),!0),i}const bC=t=>t.length>700||(t.match(/\n/g)||[]).length>10;function gd({who:t,ts:e,text:i,className:r=""}){const s=He(),[n,o]=A.useState(!1),a=!n&&bC(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:lu(e)})]}),m.jsx("div",{className:"m-ev-text",children:m.jsx(Eu,{children:i})}),a&&m.jsx("button",{type:"button",className:"m-quote-more",onClick:()=>o(!0),children:s("mobile.more")})]})}function _C({tool:t,open:e,onToggle:i}){const r=K7(t.input),{lead:s,trail:n}=V7(r),o=t.outputLines||0,a=!!t.output,l=a?"button":"div";return m.jsxs("div",{className:"tc-tool",children:[m.jsxs(l,{...a?{type:"button",onClick:i,"aria-expanded":e}:{},className:`tc-tool-row${a?" is-openable":""}`,children:[m.jsx("span",{className:"tc-tool-verb",children:_3(t.name)}),s&&m.jsx("span",{className:"tc-tool-target",children:s}),n&&m.jsx("span",{className:"tc-tool-trail",children:n}),o>0&&m.jsxs("span",{className:"tc-tool-size",children:[o," lines"]}),a&&m.jsx("span",{className:"tc-tool-caret","aria-hidden":"true",children:e?"▾":"▸"})]}),e&&a&&m.jsx("pre",{className:"tc-tool-out",children:t.output})]})}function yC({tools:t,openIds:e,onToggle:i}){if(!(t!=null&&t.length))return null;const r=o=>m.jsx(_C,{tool:o,open:e.has(o.id),onToggle:()=>i(o.id)},o.id);if(t.length<y3)return m.jsx("div",{className:"tc-tools",children:t.map(r)});const s=`run:${t[0].id}`,n=e.has(s);return m.jsx("div",{className:"tc-tools",children:m.jsxs("div",{className:"tc-tool",children:[m.jsxs("button",{type:"button",className:"tc-tool-row is-openable is-run","aria-expanded":n,onClick:()=>i(s),children:[m.jsxs("span",{className:"tc-tool-verb",children:[t.length," tool uses"]}),m.jsx("span",{className:"tc-tool-trail",children:w3(t)}),m.jsx("span",{className:"tc-tool-caret","aria-hidden":"true",children:n?"▾":"▸"})]}),n&&m.jsx("div",{className:"tc-tool-kids",children:t.map(r)})]})})}function wC(t){const e=[];let i=[];const r=()=>{var l;if(!i.length)return;const s=i.reduce((u,c)=>{var h;return u+(((h=c.tools)==null?void 0:h.length)||0)},0);let n=i.length-1;for(;n>0&&!i[n].text;)n-=1;const o=(l=i[n])!=null&&l.text?i[n]:null,a=o?i.slice(0,n):i;e.push({kind:"work",work:a,answer:o,calls:s,folded:s>=y3&&a.length>0}),i=[]};for(const s of t){if(s.role==="user"){r(),e.push({kind:"ask",turn:s});continue}i.push(s)}return r(),e}function Bc({turn:t,openIds:e,onToggle:i}){return m.jsxs("div",{className:"tc-say",children:[t.text&&m.jsx("div",{className:"tc-say-text",children:m.jsx(Eu,{children:t.text})}),m.jsx(yC,{tools:t.tools,openIds:e,onToggle:i})]})}function xC({segment:t,openIds:e,onToggle:i}){var o,a,l;const r=`seg:${((o=t.work[0])==null?void 0:o.id)||((a=t.work[0])==null?void 0:a.at)||((l=t.answer)==null?void 0:l.at)}`,s=e.has(r),n=w3(t.work.flatMap(u=>u.tools||[]));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":s,onClick:()=>i(r),children:[m.jsx("span",{className:"tc-work-caret","aria-hidden":"true",children:s?"▾":"▸"}),m.jsxs("span",{className:"tc-work-lead",children:[t.calls," tool uses"]}),n&&m.jsx("span",{className:"tc-work-detail",children:n})]}),s&&m.jsx("div",{className:"tc-work-body",children:t.work.map((u,c)=>m.jsx(Bc,{turn:u,openIds:e,onToggle:i},`t${c}`))})]}):t.work.map((u,c)=>m.jsx(Bc,{turn:u,openIds:e,onToggle:i},`t${c}`)),t.answer&&m.jsx(Bc,{turn:t.answer,openIds:e,onToggle:i})]})}function SC({data:t}){var s;const[e,i]=A.useState(()=>new Set),r=n=>i(o=>{const a=new Set(o);return a.has(n)?a.delete(n):a.add(n),a});return(s=t==null?void 0:t.turns)!=null&&s.length?m.jsxs("div",{className:"tc-flow",children:[wC(t.turns).map((n,o)=>{if(n.kind!=="ask")return m.jsx(xC,{segment:n,openIds:e,onToggle:r},`w${o}`);const{text:a,envelope:l}=Uv(n.turn.text||"");return m.jsx(gd,{className:"tc-ask",who:(l==null?void 0:l.label)||null,text:a},`a${o}`)}),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"})}const kC=(t,e)=>t!=null&&t.length===e.length&&(t.length===0||JSON.stringify(t[t.length-1])===JSON.stringify(e[e.length-1])),CC='button, summary, a, input, textarea, select, option, label, [role], [contenteditable]:not([contenteditable="false"])',AC=new Set(["Backspace","Delete","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"]),Cr=Object.freeze({NORMAL:0,WORD:1,LINE:2}),b0=()=>typeof Highlight<"u"&&typeof CSS<"u"&&!!CSS.highlights,EC=()=>{b0()&&CSS.highlights.delete("timeline-sel")},DC=()=>b0()&&typeof document.caretRangeFromPoint=="function",MC=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()},Bg=t=>!b0()||!t||t.collapsed?!1:(CSS.highlights.set("timeline-sel",new Highlight(t)),!0),TC=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},BC=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 TC(t)},Du=(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},Rg=(t,e,i)=>{const r=Du(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},Ng=(t,e,i)=>{const r=Du(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},RC=(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===Cr.NORMAL?o.setEnd(n.startContainer,n.startOffset):o.setEnd(n.endContainer,n.endOffset),o};function NC({state:t,active:e,inputRef:i,draft:r,setDraft:s,sending:n,send:o,sendErr:a,onRestore:l,actionOutcome:u,onComposerPress:c}){const h=He(),d=t!=="live";return m.jsxs("footer",{className:`m-composer is-${t}`,"data-footer-state":t,children:[a&&m.jsx("div",{className:"m-senderr",children:a}),m.jsxs("div",{className:"m-composer-line",children:[m.jsx(md,{ref:i,className:"m-input","data-focus-sink":e&&!d?"":void 0,rows:1,placeholder:h("mobile.inputPlaceholder"),value:r,disabled:d,onMouseDownCapture:c,onChange:f=>s(f.target.value),onKeyDown:f=>{!d&&f.key==="Enter"&&!f.shiftKey&&!au(f)&&(f.preventDefault(),f.stopPropagation(),o())}}),m.jsx("button",{className:"m-send",disabled:d||!r.trim()||n,onClick:o,children:h("mobile.send")})]}),d&&m.jsxs("div",{className:"m-coldline",children:[m.jsx("span",{children:h(t==="archived"?"session.archivedReadOnly":"session.offlineReadOnly")}),l&&m.jsx("button",{type:"button",className:"m-coldline-action",disabled:(u==null?void 0:u.phase)==="pending",onClick:l,children:h(t==="archived"?"session.shelfRestore":"session.relaunch")})]}),d&&u&&m.jsx("div",{className:`si-action-outcome ${u.phase}`,role:u.phase==="failed"?"alert":"status",children:u.message})]})}function LC({s:t,sessions:e=[],active:i=!0,footerState:r="live",onRestore:s,actionOutcome:n}){var mr,Ui;const o=He(),a=a_(),[l,u]=A.useState(null),[c,h]=A.useState(null),[d,f]=A.useState(""),[p,b]=A.useState(!1),[_,x]=A.useState(null),[S,E]=A.useState(null),[D,M]=A.useState(()=>new Set),[C,N]=A.useState(()=>new Map),[W,q]=A.useState(()=>Date.now()),K=A.useRef(null),V=A.useRef(null),I=A.useRef(null),z=A.useRef(null),P=A.useRef(null),j=A.useRef(null),O=A.useRef(Date.now()),G=A.useRef(!0),$=A.useCallback(()=>$5(t.id).then(le=>{q(Date.now()),le&&u(te=>kC(te,le.events)?te:le.events)}),[t.id]);A.useEffect(()=>{i&&(u(null),h(null),E(null),M(new Set),N(new Map),O.current=Date.now(),q(O.current),G.current=!0,$(),q5(t.id).then(le=>{le&&h(le)}))},[t.id,$,i]),A.useEffect(()=>{if(!i||a||document.visibilityState==="hidden")return;const le=requestAnimationFrame(()=>{const te=I.current;i&&!a&&document.visibilityState!=="hidden"&&(te==null?void 0:te.offsetParent)!==null&&getComputedStyle(te).visibility!=="hidden"&&document.activeElement!==te&&te.focus()});return()=>cancelAnimationFrame(le)},[t.id,i,a]),A.useEffect(()=>{if(!i||r==="archived")return;const le=setInterval($,8e3);return()=>clearInterval(le)},[$,i,r]),A.useEffect(()=>{i&&r!=="archived"&&$()},[t.status,t.note,$,i,r]);const ue=A.useMemo(()=>vC(l||[],O.current),[l]),Y=A.useCallback(async(le,te)=>{const $e=Tg(t.id,le.from,le.to),ve=Mc.get($e);if(ve){N(ht=>new Map(ht).set(te,{...ve,transcriptKey:$e}));return}const Ke={state:"loading",transcriptKey:$e};Mc.set($e,Ke),N(ht=>new Map(ht).set(te,Ke));const Ze=await W5(t.id,le.from,le.to),lt=Ze.ok?{state:"ready",data:Ze.data,transcriptKey:$e}:{state:"error",error:Ze.error,transcriptKey:$e};Mc.set($e,lt),N(ht=>{const ni=ht.get(te);return(ni==null?void 0:ni.transcriptKey)===$e?new Map(ht).set(te,lt):ht})},[t.id]);A.useEffect(()=>{if(!(!i||!l))for(const le of ue){if(le.kind!=="seam")continue;const te=Tc(t.id,le.from);if(!D.has(te))continue;const $e=Tg(t.id,le.from,le.to),ve=C.get(te);(ve==null?void 0:ve.transcriptKey)===$e||(ve==null?void 0:ve.state)==="loading"||Y(le,te)}},[i,l,ue,D,Y,t.id,C]);const X=A.useCallback(()=>{const le=K.current;le&&G.current&&(le.scrollTop=le.scrollHeight)},[]),he=()=>{const le=K.current;le&&(G.current=le.scrollHeight-le.scrollTop-le.clientHeight<48)};A.useLayoutEffect(X,[l,X]),A.useLayoutEffect(()=>{if(!i||typeof ResizeObserver!="function")return;const le=V.current;if(!le)return;const te=new ResizeObserver(X);return te.observe(le),()=>te.disconnect()},[i,X]);const H=()=>{P.current=null,EC(),MC(K.current),E(null)},ne=A.useCallback(async le=>{clearTimeout(j.current),E(null);const te=await BC(le);return E(te?"copied":"failed"),te&&(j.current=setTimeout(()=>E(null),1200)),te},[]);A.useEffect(()=>()=>clearTimeout(j.current),[]);const pe=le=>{const te=K.current,$e=le.target;if(le.button!==0||!te||!($e instanceof Element)||!DC())return;const ve=$e.closest(CC);if(ve&&te.contains(ve))return;if($e===te){const lt=te.getBoundingClientRect();if(le.clientX-lt.left-te.clientLeft>=te.clientWidth||le.clientY-lt.top-te.clientTop>=te.clientHeight)return}H(),le.preventDefault();const Ke=le.detail===2?Cr.WORD:le.detail>=3?Cr.LINE:Cr.NORMAL,Ze=Ke===Cr.WORD?Rg(te,le.clientX,le.clientY):Ke===Cr.LINE?Ng(te,le.clientX,le.clientY):Du(te,le.clientX,le.clientY);Ze&&(z.current={mode:Ke,anchor:Ze.cloneRange(),x:le.clientX,y:le.clientY},Ke!==Cr.NORMAL&&(P.current=Ze,Bg(Ze)))};A.useEffect(()=>{if(!i)return;const le=ve=>{const Ke=z.current,Ze=K.current;if(!Ke||!Ze||(ve.preventDefault(),Ke.mode===Cr.NORMAL&&Math.hypot(ve.clientX-Ke.x,ve.clientY-Ke.y)<3))return;const lt=Ke.mode===Cr.WORD?Rg(Ze,ve.clientX,ve.clientY):Ke.mode===Cr.LINE?Ng(Ze,ve.clientX,ve.clientY):Du(Ze,ve.clientX,ve.clientY);if(!lt||!Ke.anchor.startContainer.isConnected)return;const ht=RC(Ke.anchor,lt,Ke.mode);P.current=ht,Bg(ht)},te=()=>{z.current=null},$e=ve=>{const Ke=P.current,Ze=I.current;if(!Ke||Ke.collapsed||!Ze)return;const lt=ve.ctrlKey||ve.metaKey,ht=ve.key.toLowerCase();if(ve.key==="Escape"){H();return}if(lt&&ht==="c"){if(document.activeElement!==Ze||Ze.selectionStart!==Ze.selectionEnd)return;ve.preventDefault(),ve.stopPropagation(),ne(iC(Ke,K.current));return}if(document.activeElement!==Ze)return;const ni=ve.key.length===1&&!lt&&!ve.altKey,fe=lt&&!ve.altKey&&["a","v","x","y","z"].includes(ht),Ne=ve.isComposing||ve.key==="Process"||ve.key==="Dead";(ni||fe||Ne||AC.has(ve.key))&&H()};return document.addEventListener("mousemove",le,!0),document.addEventListener("mouseup",te,!0),document.addEventListener("keydown",$e,!0),()=>{z.current=null,H(),document.removeEventListener("mousemove",le,!0),document.removeEventListener("mouseup",te,!0),document.removeEventListener("keydown",$e,!0)}},[i,ne]);const ce=()=>H(),ie=async()=>{const le=d.trim();if(!le||p)return;b(!0),x(null);const te=await K5(t.id,le,{replyVia:"note"});b(!1),te.ok?(f(""),$()):x(te.error||o("mobile.sendFailed"))},_e=le=>{if(!le)return o("mobile.you");const te=e.find($e=>$e.id===le);return te?jr(te):le.slice(0,8)},qe=le=>{const te=Tc(t.id,le.from),$e=new Set(D);if($e.has(te)){$e.delete(te),M($e);return}$e.add(te),M($e),Y(le,te)},nt=[];let Wt=null;const Mt=(le,te)=>{Dg(le)!==Wt&&(Wt=Dg(le),nt.push(m.jsxs("div",{className:"m-day",children:[m.jsx("div",{className:"m-gut",children:mC(le)}),m.jsx("div",{className:"m-day-rule"})]},`d${te}`)))},Re=le=>m.jsx("div",{className:"m-gut",children:m.jsx("time",{children:lu(le)})}),Kt=t.created||(c==null?void 0:c.created)||((mr=l==null?void 0:l[0])==null?void 0:mr.ts);c!=null&&c.prompt&&(Kt&&Mt(Kt,"p"),nt.push(m.jsxs("div",{className:"m-ev m-ev-prompt",children:[Kt?Re(Kt):m.jsx("div",{className:"m-gut"}),m.jsx(gd,{ts:Kt,text:c.prompt})]},"prompt")));for(const[le,te]of ue.entries())if(Mt(te.ts,le),te.kind==="quote")nt.push(m.jsxs("div",{className:"m-ev m-ev-sent",children:[Re(te.ts),m.jsx(gd,{who:te.from?((Ui=te.envelope)==null?void 0:Ui.label)||_e(te.from):null,ts:te.ts,text:te.text})]},le));else if(te.kind==="say")nt.push(m.jsxs("div",{className:"m-ev m-ev-say",children:[Re(te.ts),m.jsxs("article",{className:"m-say",children:[m.jsxs("div",{className:"m-say-head",children:[m.jsxs("span",{className:"m-say-chip",style:{color:or[te.status]},children:[m.jsx("span",{className:"m-ev-glyph",children:wu[te.status]||"·"}),m.jsx("span",{className:"m-ev-word",children:o(`status.${te.status}`)})]}),te.text&&!b0()&&m.jsx("button",{type:"button",className:"m-copy-note",onClick:()=>ne(te.text),children:o("mobile.copy")}),m.jsx("time",{className:"m-tin",children:lu(te.ts)})]}),te.text&&m.jsx("div",{className:"m-ev-note",children:m.jsx(Eu,{children:te.text})})]})]},le));else if(te.kind==="event")nt.push(m.jsxs("div",{className:"m-ev m-ev-line",children:[Re(te.ts),m.jsxs("div",{className:"m-line",children:[m.jsx("span",{className:"m-ev-glyph",style:{color:or[te.status]},children:wu[te.status]||"·"}),m.jsx("span",{className:"m-ev-word",style:{color:or[te.status]},children:o(`status.${te.status}`)}),te.text&&m.jsx("div",{className:"m-line-text m-ev-note",children:m.jsx(Eu,{children:te.text})}),m.jsx("time",{className:"m-tin",children:lu(te.ts)})]})]},le));else{const $e=Tc(t.id,te.from),ve=C.get($e),Ke=D.has($e),Ze=te.open&&r==="live",lt=Ze?`${o("status.working")} · ${vm(W-te.from)}`:te.open?o("status.working"):`${o("mobile.worked")} ${vm(te.to-te.from)}`,ht=(ve==null?void 0:ve.state)==="ready"?ve.data.turns.reduce((ni,fe)=>{var Ne;return ni+(((Ne=fe.tools)==null?void 0:Ne.length)||0)},0):0;nt.push(m.jsxs("div",{className:"m-ev m-ev-seam",children:[m.jsx("div",{className:"m-gut",children:m.jsx("span",{className:`m-seam-dot${Ze?" is-live":""}`,"aria-hidden":"true",children:"●"})}),m.jsxs("div",{className:"m-seam",children:[m.jsxs("button",{type:"button",className:"m-seam-row","aria-expanded":Ke,onClick:()=>qe(te),children:[m.jsx("span",{className:"m-seam-caret","aria-hidden":"true"}),m.jsx("span",{className:"m-seam-lead",children:lt}),(ve==null?void 0:ve.state)==="ready"&&m.jsxs("span",{className:"m-seam-detail",children:[ve.data.turns.length," turns · ",ht," tool uses"]}),m.jsx("span",{className:"m-seam-line","aria-hidden":"true"})]}),Ke&&m.jsxs("div",{className:"m-seam-inset",children:[(ve==null?void 0:ve.state)==="loading"&&m.jsx("div",{className:"m-transcript-state",children:"transcript 加载中…"}),(ve==null?void 0:ve.state)==="error"&&m.jsxs("div",{className:"m-transcript-state is-error",children:["transcript 已不可用:",ve.error]}),(ve==null?void 0:ve.state)==="ready"&&m.jsx(SC,{data:ve.data})]})]})]},le))}return m.jsxs("div",{className:"tl-chat",children:[m.jsx("div",{className:"m-timeline","data-selectable":!0,ref:K,onScroll:he,onMouseDown:pe,children:m.jsxs("div",{className:"m-col",ref:V,children:[l===null?m.jsx("div",{className:"m-empty",children:o("common.loading")}):nt.length===0?m.jsx("div",{className:"m-empty",children:o("mobile.noEvents")}):nt,m.jsxs("div",{className:"m-ev m-ev-trace",children:[m.jsx("div",{className:"m-gut"}),m.jsx(pC,{sessionId:t.id,active:i})]})]})}),S&&m.jsx("div",{className:`m-copy-status ${S}`,role:"status","aria-live":"polite","aria-atomic":"true",children:o(`mobile.${S==="copied"?"copied":"copyFailed"}`)}),m.jsx(NC,{state:r,active:i,inputRef:I,draft:d,setDraft:f,sending:p,send:ie,sendErr:_,onRestore:s,actionOutcome:n,onComposerPress:ce})]})}let vd=[],Gv=[];(()=>{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?Gv:vd).push(i=i+t[e])})();function OC(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>=Gv[r])e=r+1;else return!0;if(e==i)return!1}}function Lg(t){return t>=127462&&t<=127487}const Og=8205;function PC(t,e,i=!0,r=!0){return(i?Yv:FC)(t,e,r)}function Yv(t,e,i){if(e==t.length)return e;e&&Xv(t.charCodeAt(e))&&Jv(t.charCodeAt(e-1))&&e--;let r=Rc(t,e);for(e+=Pg(r);e<t.length;){let s=Rc(t,e);if(r==Og||s==Og||i&&OC(s))e+=Pg(s),r=s;else if(Lg(s)){let n=0,o=e-2;for(;o>=0&&Lg(Rc(t,o));)n++,o-=2;if(n%2==0)break;e+=2}else break}return e}function FC(t,e,i){for(;e>1;){let r=Yv(t,e-2,i);if(r<e)return r;e--}return 0}function Rc(t,e){let i=t.charCodeAt(e);if(!Jv(i)||e+1==t.length)return i;let r=t.charCodeAt(e+1);return Xv(r)?(i-55296<<10)+(r-56320)+65536:i}function Xv(t){return t>=56320&&t<57344}function Jv(t){return t>=55296&&t<56320}function Pg(t){return t<65536?1:2}let Ye=class Zv{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]=co(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),Dr.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]=co(this,e,i);let r=[];return this.decompose(e,i,r,0),Dr.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 la(this),n=new la(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 la(this,e)}iterRange(e,i=this.length){return new Qv(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 eb(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]?Zv.empty:e.length<=32?new Et(e):Dr.from(Et.split(e,[]))}};class Et extends Ye{constructor(e,i=IC(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 zC(s,a,r,o);s=a+1,r++}}decompose(e,i,r,s){let n=e<=0&&i>=this.length?this:new Et(Fg(this.text,e,i),Math.min(i,this.length)-Math.max(0,e));if(s&1){let o=r.pop(),a=uu(n.text,o.text.slice(),0,n.length);if(a.length<=32)r.push(new Et(a,o.length+n.length));else{let l=a.length>>1;r.push(new Et(a.slice(0,l)),new Et(a.slice(l)))}}else r.push(n)}replace(e,i,r){if(!(r instanceof Et))return super.replace(e,i,r);[e,i]=co(this,e,i);let s=uu(this.text,uu(r.text,Fg(this.text,0,e)),i),n=this.length+r.length-(i-e);return s.length<=32?new Et(s,n):Dr.from(Et.split(s,[]),n)}sliceString(e,i=this.length,r=`
316
+ `){[e,i]=co(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 Et(r,s)),r=[],s=-1);return s>-1&&i.push(new Et(r,s)),i}}class Dr extends Ye{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]=co(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 Dr(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]=co(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 Dr))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 Et(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 Dr)for(let b of f.children)h(b);else f.lines>o&&(l>o||!l)?(d(),a.push(f)):f instanceof Et&&l&&(p=c[c.length-1])instanceof Et&&f.lines+p.lines<=32?(l+=f.lines,u+=f.length+1,c[c.length-1]=new Et(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]:Dr.from(c,u)),u=-1,l=c.length=0)}for(let f of e)h(f);return d(),a.length==1?a[0]:new Dr(a,i)}}Ye.empty=new Et([""],0);function IC(t){let e=-1;for(let i of t)e+=i.length+1;return e}function uu(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 Fg(t,e,i){return uu(t,[""],e,i)}class la{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 Et?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 Et?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 Et){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 Et?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 Qv{constructor(e,i,r){this.value="",this.done=!1,this.cursor=new la(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 eb{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"&&(Ye.prototype[Symbol.iterator]=function(){return this.iter()},la.prototype[Symbol.iterator]=Qv.prototype[Symbol.iterator]=eb.prototype[Symbol.iterator]=function(){return this});class zC{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 co(t,e,i){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,i))]}function Lr(t,e,i=!0,r=!0){return PC(t,e,i,r)}function jC(t){return t>=56320&&t<57344}function HC(t){return t>=55296&&t<56320}function $C(t,e){let i=t.charCodeAt(e);if(!HC(i)||e+1==t.length)return i;let r=t.charCodeAt(e+1);return jC(r)?(i-55296<<10)+(r-56320)+65536:i}function qC(t){return t<65536?1:2}const bd=/\r\n?|\n/;var zi=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(zi||(zi={}));class os{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 os(e)}composeDesc(e){return this.empty?e:e.empty?this:tb(this,e)}mapDesc(e,i=!1){return e.empty?this:yd(this,e,i)}mapPos(e,i=-1,r=zi.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!=zi.Simple&&u>=e&&(r==zi.TrackDel&&s<e&&u>e||r==zi.TrackBefore&&s<e||r==zi.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 os(e)}static create(e){return new os(e)}}class Bt extends os{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(Ye.empty);r.push(o?e.slice(n,n+o):Ye.empty)}n+=o}return new Bt(i,r)}compose(e){return this.empty?e:e.empty?this:tb(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 os.create(this.sections)}filter(e){let i=[],r=[],s=[],n=new Ma(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&&Hs(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 Bt(i,r),filtered:os.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 Bt(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 Bt){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"?Ye.of(f.split(r||bd)):f:Ye.empty,b=p.length;if(h==d&&b==0)return;h<o&&l(),h>o&&li(s,h-o,-1),li(s,d-h,b),Hs(n,s,p),o=d}}return u(e),l(!a),a}static empty(e){return new Bt(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(Ye.empty);r[s]=Ye.of(n.slice(1)),i.push(n[0],r[s].length)}}}return new Bt(i,r)}static createSet(e,i){return new Bt(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 Hs(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(Ye.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=Ye.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 Ma(t),a=new Ma(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&&Hs(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&&Hs(n,s,o.text),l=o.i,o.forward(o.len-c)}else{if(o.done&&a.done)return n?Bt.createSet(s,n):os.create(s);throw new Error("Mismatched change set lengths")}}}function tb(t,e,i=!1){let r=[],s=i?[]:null,n=new Ma(t),o=new Ma(e);for(let a=!1;;){if(n.done&&o.done)return s?Bt.createSet(r,s):os.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&&Hs(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&&Hs(s,r,o.text)}else o.ins==-1?(li(r,n.off?0:n.len,l,a),s&&Hs(s,r,n.textBit(l))):(li(r,n.off?0:n.len,o.off?0:o.ins,a),s&&!o.off&&Hs(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 Ma{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?Ye.empty:e[i]}textBit(e){let{inserted:i}=this.set,r=this.i-2>>1;return r>=i.length&&!e?Ye.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 Os{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 Os(r,s,this.flags,this.goalColumn)}extend(e,i=e,r=0){if(e<=this.anchor&&i>=this.anchor)return xe.range(e,i,void 0,void 0,r);let s=Math.abs(e-this.anchor)>Math.abs(i-this.anchor)?e:i;return xe.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 xe.range(e.anchor,e.head)}static create(e,i,r,s){return new Os(e,i,r,s)}}class xe{constructor(e,i){this.ranges=e,this.mainIndex=i}map(e,i=-1){return e.empty?this:xe.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 xe([this.main],0)}addRange(e,i=!0){return xe.create([e].concat(this.ranges),i?0:this.mainIndex+1)}replaceRange(e,i=this.mainIndex){let r=this.ranges.slice();return r[i]=e,xe.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 xe(e.ranges.map(i=>Os.fromJSON(i)),e.main)}static single(e,i=e){return new xe([xe.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 xe.normalized(e.slice(),i);r=n.to}return new xe(e,i)}static cursor(e,i=0,r,s){return Os.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?Os.create(i,e,o|32,r):Os.create(e,i,o,r)}static undirectionalRange(e,i){return Os.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?xe.range(l,a):xe.range(a,l))}}return new xe(e,i)}}function ib(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let r1=0;class Ce{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 Ce(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 cu([],this,0,e)}compute(e,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new cu(e,this,1,i)}computeN(e,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new cu(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 cu{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?!Ig(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 b=Tu(d,p);if(this.dependencies.every(_=>_ instanceof Ce?d.facet(_)===h.facet(_):_ instanceof rr?d.field(_,!1)==h.field(_,!1):!0)||(a?Ig(f=r(h),b,s):s(f=r(h),b)))return h.values[o]=b,0}else f=r(h);return h.values[o]=f,1}}}get extension(){return this}}function Ig(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)ua(t,r)&1&&(i=!0);return i}function WC(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=Tu(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)ua(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 kl=Ce.define({static:!0});class rr{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 rr(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(kl).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(kl),o=s.facet(kl),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,kl.of({field:this,create:e})]}get extension(){return this}}const fn={lowest:4,low:3,default:2,high:1,highest:0};function jo(t){return e=>new rb(e,t)}const On={highest:jo(fn.highest),high:jo(fn.high),default:jo(fn.default),low:jo(fn.low),lowest:jo(fn.lowest)};class rb{constructor(e,i){this.inner=e,this.prec=i}get extension(){return this}}class ko{of(e){return new xd(this,e)}reconfigure(e){return ko.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 Mu{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 KC(e,i,o))d instanceof rr?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,b=c&&c[d]||[];if(f.every(_=>_.type==0))if(a[p.id]=l.length<<1|1,s1(b,f))l.push(r.facet(p));else{let _=p.combine(f.map(x=>x.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(x=>_.dynamicSlot(x)));a[p.id]=u.length<<1,u.push(_=>WC(_,p,f))}}let h=u.map(d=>d(a));return new Mu(e,o,h,a,l,n)}}function KC(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 rb)n(o.inner,o.prec);else if(o instanceof rr)r[a].push(o),o.provides&&n(o.provides,a);else if(o instanceof cu)r[a].push(o),o.facet.extensions&&n(o.facet.extensions,fn.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,fn.default),r.reduce((o,a)=>o.concat(a))}function ua(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 Tu(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const sb=Ce.define(),Sd=Ce.define({combine:t=>t.some(e=>e),static:!0}),nb=Ce.define({combine:t=>t.length?t[0]:void 0,static:!0}),ob=Ce.define(),ab=Ce.define(),lb=Ce.define(),ub=Ce.define({combine:t=>t.length?t[0]:!1});class Co{constructor(e,i){this.type=e,this.value=i}static define(){return new VC}}class VC{of(e){return new Co(this,e)}}class UC{constructor(e){this.map=e}of(e){return new ct(this,e)}}class ct{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 ct(this.type,i)}is(e){return this.type==e}static define(e={}){return new UC(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}}ct.reconfigure=ct.define();ct.appendConfig=ct.define();class ci{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&&ib(r,i.newLength),n.some(a=>a.type==ci.time)||(this.annotations=n.concat(ci.time.of(Date.now())))}static create(e,i,r,s,n,o){return new ci(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(ci.userEvent);return!!(i&&(i==e||i.length>e.length&&i.slice(0,e.length)==e&&i[e.length]=="."))}}ci.time=Co.define();ci.userEvent=Co.define();ci.addToHistory=Co.define();ci.remote=Co.define();function GC(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 cb(t,e,i){var r;let s,n,o;return i?(s=e.changes,n=Bt.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:ct.mapEffects(t.effects,s).concat(ct.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=Zn(e.annotations);return e.userEvent&&(s=s.concat(ci.userEvent.of(e.userEvent))),{changes:e.changes instanceof Bt?e.changes:Bt.of(e.changes||[],i,t.facet(nb)),selection:r&&(r instanceof xe?r:xe.single(r.anchor,r.head)),effects:Zn(e.effects),annotations:s,scrollIntoView:!!e.scrollIntoView}}function hb(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=cb(r,kd(t,e[n],o?r.changes.newLength:t.doc.length),o)}let s=ci.create(t,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return XC(i?YC(s):s)}function YC(t){let e=t.startState,i=!0;for(let s of e.facet(ob)){let n=s(t);if(n===!1){i=!1;break}Array.isArray(n)&&(i=i===!0?n:GC(i,n))}if(i!==!0){let s,n;if(i===!1)n=t.changes.invertedDesc,s=Bt.empty(e.doc.length);else{let o=t.changes.filter(i);s=o.changes,n=o.filtered.mapDesc(o.changes).invertedDesc}t=ci.create(e,s,t.selection&&t.selection.map(n),ct.mapEffects(t.effects,n),t.annotations,t.scrollIntoView)}let r=e.facet(ab);for(let s=r.length-1;s>=0;s--){let n=r[s](t);n instanceof ci?t=n:Array.isArray(n)&&n.length==1&&n[0]instanceof ci?t=n[0]:t=hb(e,Zn(n),!1)}return t}function XC(t){let e=t.startState,i=e.facet(lb),r=t;for(let s=i.length-1;s>=0;s--){let n=i[s](t);n&&Object.keys(n).length&&(r=cb(r,kd(e,n,t.changes.newLength),!0))}return r==t?t:ci.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const JC=[];function Zn(t){return t==null?JC:Array.isArray(t)?t:[t]}var ss=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(ss||(ss={}));const ZC=/[\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 QC(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()||ZC.test(i)))return!0}return!1}function eA(t){return e=>{if(!/\S/.test(e))return ss.Space;if(QC(e))return ss.Word;for(let i=0;i<t.length;i++)if(e.indexOf(t[i])>-1)return ss.Word;return ss.Other}}class Ve{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++)ua(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 ua(this,r),Tu(this,r)}update(...e){return hb(this,e,!0)}applyTransaction(e){let i=this.config,{base:r,compartments:s}=i;for(let a of e.effects)a.is(ko.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(ct.reconfigure)?(i=null,r=a.value):a.is(ct.appendConfig)&&(i=null,r=Zn(r).concat(a.value));let n;i?n=e.startState.values.slice():(i=Mu.resolve(r,s,this),n=new Ve(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 Ve(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:xe.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=Zn(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=ct.mapEffects(o,c).concat(ct.mapEffects(Zn(l.effects),h))}return{changes:s,selection:xe.create(n,i.mainIndex),effects:o}}changes(e=[]){return e instanceof Bt?e:Bt.of(e,this.doc.length,this.facet(Ve.lineSeparator))}toText(e){return Ye.of(e.split(this.facet(Ve.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:(ua(this,i),Tu(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 rr&&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 Ve.create({doc:e.doc,selection:xe.fromJSON(e.selection),extensions:i.extensions?s.concat([i.extensions]):s})}static create(e={}){let i=Mu.resolve(e.extensions||[],new Map),r=e.doc instanceof Ye?e.doc:Ye.of((e.doc||"").split(i.staticFacet(Ve.lineSeparator)||bd)),s=e.selection?e.selection instanceof xe?e.selection:xe.single(e.selection.anchor,e.selection.head):xe.single(0);return ib(s,r.length),i.staticFacet(Sd)||(s=s.asSingle()),new Ve(i,r,s,i.dynamicSlots.map(()=>null),(n,o)=>o.create(n),null)}get tabSize(){return this.facet(Ve.tabSize)}get lineBreak(){return this.facet(Ve.lineSeparator)||`
319
+ `}get readOnly(){return this.facet(ub)}phrase(e,...i){for(let r of this.facet(Ve.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(sb))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 eA(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=Lr(i,o,!1);if(n(i.slice(l,o))!=ss.Word)break;o=l}for(;a<s;){let l=Lr(i,a);if(n(i.slice(a,l))!=ss.Word)break;a=l}return o==a?null:xe.range(o+r,a+r)}}Ve.allowMultipleSelections=Sd;Ve.tabSize=Ce.define({combine:t=>t.length?t[0]:4});Ve.lineSeparator=nb;Ve.readOnly=ub;Ve.phrases=Ce.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])}});Ve.languageData=sb;Ve.changeFilter=ob;Ve.transactionFilter=ab;Ve.transactionExtender=lb;ko.reconfigure=ct.define();function tA(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 An{eq(e){return this==e}range(e,i=e){return Ad.create(e,i,this)}}An.prototype.startSide=An.prototype.endSide=0;An.prototype.point=!1;An.prototype.mapMode=zi.TrackDel;function n1(t,e){return t==e||t.constructor==e.constructor&&t.eq(e)}let Ad=class db{constructor(e,i,r){this.from=e,this.to=i,this.value=r}static create(e,i,r){return new db(e,i,r)}};function Ed(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}let iA=class fb{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 fb(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 pb(this,null,-1).goto(0),l=0,u=[],c=new hr;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 Ta.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,i=0){return Ta.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=zg(o,a,r),u=new Ho(o,l,n),c=new Ho(a,l,n);r.iterGaps((h,d,f)=>jg(u,h,c,d,f,s)),r.empty&&r.length==0&&jg(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=zg(n,o),l=new Ho(n,a,0).goto(r),u=new Ho(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 Ho(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 hr;for(let s of e instanceof Ad?[e]:i?rA(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 rA(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 hr{finishChunk(e){this.chunks.push(new iA(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 hr)).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 zg(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 pb{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 Ta{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 pb(o,i,r,n));return s.length==1?s[0]:new Ta(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--)Nc(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--)Nc(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(),Nc(this.heap,0)}}}function Nc(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 Ho{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=Ta.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){Cl(this.active,e),Cl(this.activeTo,e),Cl(this.activeRank,e),this.minActive=Hg(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++;Al(this.active,i,r),Al(this.activeTo,i,s),Al(this.activeRank,i,n),e&&Al(e,i,this.cursor.from),this.minActive=Hg(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&&Cl(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 jg(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 Cl(t,e){for(let i=e,r=t.length-1;i<r;i++)t[i]=t[i+1];t.pop()}function Al(t,e,i){for(let r=t.length-1;r>=e;r--)t[r+1]=t[r];t[e]=i}function Hg(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=Lr(t,s)}return t.length}const Md="ͼ",$g=typeof Symbol>"u"?"__"+Md:Symbol.for(Md),Td=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),qg=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class cs{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(b=>o.map(_=>b.replace(/&/,_))).reduce((b,_)=>b.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,b=>"-"+b.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=qg[$g]||1;return qg[$g]=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 nA(e,n),s.mount(Array.isArray(i)?i:[i],e)}}let Wg=new Map;class nA{constructor(e,i){let r=e.ownerDocument||e,s=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let n=Wg.get(r);if(n)return e[Td]=n;this.sheet=new s.CSSStyleSheet,Wg.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 Gs={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:"'"},Ba={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},oA=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 ii=0;ii<10;ii++)Gs[48+ii]=Gs[96+ii]=String(ii);for(var ii=1;ii<=24;ii++)Gs[ii+111]="F"+ii;for(var ii=65;ii<=90;ii++)Gs[ii]=String.fromCharCode(ii+32),Ba[ii]=String.fromCharCode(ii);for(var Lc in Gs)Ba.hasOwnProperty(Lc)||(Ba[Lc]=Gs[Lc]);function lA(t){var e=oA&&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?Ba:Gs)[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 _i=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Bd=typeof document<"u"?document:{documentElement:{style:{}}};const Rd=/Edge\/(\d+)/.exec(_i.userAgent),mb=/MSIE \d/.test(_i.userAgent),Nd=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(_i.userAgent),_0=!!(mb||Nd||Rd),Kg=!_0&&/gecko\/(\d+)/i.test(_i.userAgent),Oc=!_0&&/Chrome\/(\d+)/.exec(_i.userAgent),Vg="webkitFontSmoothing"in Bd.documentElement.style,Ld=!_0&&/Apple Computer/.test(_i.vendor),Ug=Ld&&(/Mobile\/\w+/.test(_i.userAgent)||_i.maxTouchPoints>2);var ye={mac:Ug||/Mac/.test(_i.platform),windows:/Win/.test(_i.platform),linux:/Linux|X11/.test(_i.platform),ie:_0,ie_version:mb?Bd.documentMode||6:Nd?+Nd[1]:Rd?+Rd[1]:0,gecko:Kg,gecko_version:Kg?+(/Firefox\/(\d+)/.exec(_i.userAgent)||[0,0])[1]:0,chrome:!!Oc,chrome_version:Oc?+Oc[1]:0,ios:Ug,android:/Android\b/.test(_i.userAgent),webkit:Vg,webkit_version:Vg?+(/\bAppleWebKit\/(\d+)/.exec(_i.userAgent)||[0,0])[1]:0,safari:Ld,safari_version:Ld?+(/\bVersion\/(\d+(\.\d+)?)/.exec(_i.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 Bu=Object.create(null);function a1(t,e,i){if(t==e)return!0;t||(t=Bu),e||(e=Bu);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 uA(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 Gg(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 cA(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 Qs{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 Ni=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(Ni||(Ni={}));class We extends An{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 Ua(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 En(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}=gb(e,i);r=(n?i?-3e8:-1:5e8)-1,s=(o?i?2e8:1:-6e8)+1}return new En(e,r,s,i,e.widget||null,!0)}static line(e){return new Ga(e)}static set(e,i=!1){return je.of(e,i)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}We.none=je.empty;class Ua extends We{constructor(e){let{start:i,end:r}=gb(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||Bu}eq(e){return this==e||e instanceof Ua&&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)}}Ua.prototype.point=!1;class Ga extends We{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Ga&&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)}}Ga.prototype.mapMode=zi.TrackBefore;Ga.prototype.point=!0;class En extends We{constructor(e,i,r,s,n,o){super(i,r,n,e),this.block=s,this.isReplace=o,this.mapMode=s?i<=0?zi.TrackBefore:zi.TrackAfter:zi.TrackDel}get type(){return this.startSide!=this.endSide?Ni.WidgetRange:this.startSide<=0?Ni.WidgetBefore:Ni.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof En&&hA(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)}}En.prototype.point=!0;function gb(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 hA(t,e){return t==e||!!(t&&e&&t.compare(e))}function Qn(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 Ra extends An{constructor(e,i,r){super(),this.tagName=e,this.attributes=i,this.rank=r}eq(e){return e==this||e instanceof Ra&&this.tagName==e.tagName&&a1(this.attributes,e.attributes)}static create(e){return new Ra(e.tagName,e.attributes||Bu,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,i=!1){return je.of(e,i)}}Ra.prototype.startSide=Ra.prototype.endSide=-1;function Na(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 ca(t,e){if(!e.anchorNode)return!1;try{return Od(t,e.anchorNode)}catch{return!1}}function hu(t){return t.nodeType==3?La(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function ha(t,e,i,r){return i?Yg(t,e,i,r,-1)||Yg(t,e,i,r,1):!1}function Ys(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function Ru(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function Yg(t,e,i,r,s){for(;;){if(t==i&&e==r)return!0;if(e==(s<0?0:hs(t))){if(t.nodeName=="DIV")return!1;let n=t.parentNode;if(!n||n.nodeType!=1)return!1;e=Ys(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?hs(t):0}else return!1}}function hs(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Nu(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 dA(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 vb(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 fA(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,b=1;if(f)d=dA(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 S=c.getBoundingClientRect();({scaleX:p,scaleY:b}=vb(c,S)),d={left:S.left,right:S.left+c.clientWidth*p,top:S.top,bottom:S.top+c.clientHeight*b}}let _=0,x=0;if(s=="nearest")e.top<d.top+o?(x=e.top-(d.top+o),i>0&&e.bottom>d.bottom+x&&(x=e.bottom-d.bottom+o)):e.bottom>d.bottom-o&&(x=e.bottom-d.bottom+o,i<0&&e.top-x<d.top&&(x=e.top-(d.top+o)));else{let S=e.bottom-e.top,E=d.bottom-d.top;x=(s=="center"&&S<=E?e.top+S/2-E/2:s=="start"||s=="center"&&i<0?e.top-o:e.bottom-E+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,_||x)if(f)u.scrollBy(_,x);else{let S=0,E=0;if(x){let D=c.scrollTop;c.scrollTop+=x/b,E=(c.scrollTop-D)*b}if(_){let D=c.scrollLeft;c.scrollLeft+=_/p,S=(c.scrollLeft-D)*p}e={left:e.left-S,top:e.top-E,right:e.right-S,bottom:e.bottom-E},S&&Math.abs(S-_)<1&&(r="nearest"),E&&Math.abs(E-x)<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 bb(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 pA{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?hs(i):0),r,Math.min(e.focusOffset,r?hs(r):0))}set(e,i,r,s){this.anchorNode=e,this.anchorOffset=i,this.focusNode=r,this.focusOffset=s}}function _b(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 yb(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 hn=null;ye.safari&&ye.safari_version>=26&&(hn=!1);function wb(t){if(t.setActive)return t.setActive();if(hn)return t.focus(hn);let e=_b(t);t.focus(hn==null?{get preventScroll(){return hn={preventScroll:!0},!0}}:void 0),hn||(hn=!1,yb(e))}let Xg;function La(t,e,i=e){let r=Xg||(Xg=document.createRange());return r.setEnd(t,i),r.setStart(t,e),r}function eo(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 mA(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function gA(t,e){let i=e.focusNode,r=e.focusOffset;if(!i||e.anchorNode!=i||e.anchorOffset!=r)return!1;for(r=Math.min(r,hs(i));;)if(r){if(i.nodeType!=1)return!1;let s=i.childNodes[r-1];s.contentEditable=="false"?r--:(i=s,r=hs(i))}else{if(i==t)return!0;r=Ys(i),i=i.parentNode}}function xb(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 Sb(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=hs(i)}else if(i.parentNode&&!Ru(i))r=Ys(i),i=i.parentNode;else return null}}function kb(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&&!Ru(i))r=Ys(i)+1,i=i.parentNode;else return null}}class lr{constructor(e,i,r=!0){this.node=e,this.offset=i,this.precise=r}static before(e,i){return new lr(e.parentNode,Ys(e),i)}static after(e,i){return new lr(e.parentNode,Ys(e)+1,i)}}var Pt=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Pt||(Pt={}));const Dn=Pt.LTR,l1=Pt.RTL;function Cb(t){let e=[];for(let i=0;i<t.length;i++)e.push(1<<+t[i]);return e}const vA=Cb("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),bA=Cb("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Pd=Object.create(null),wr=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),i=t.charCodeAt(1);Pd[e]=i,Pd[i]=-e}function Ab(t){return t<=247?vA[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?bA[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const _A=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Or{get dir(){return this.level%2?l1:Dn}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 Eb(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||!Eb(r.inner,s.inner))return!1}return!0}const rt=[];function yA(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=Ab(t.charCodeAt(u));d==512?d=c:d==8&&h==4&&(d=16),rt[u]=d==4?2:d,d&7&&(h=d),c=d}for(let u=o,c=l,h=l;u<a;u++){let d=rt[u];if(d==128)u<a-1&&c==rt[u+1]&&c&24?d=rt[u]=c:rt[u]=256;else if(d==64){let f=u+1;for(;f<a&&rt[f]==64;)f++;let p=u&&c==8||f<i&&rt[f]==8?h==1?1:8:256;for(let b=u;b<f;b++)rt[b]=p;u=f-1}else d==8&&h==1&&(rt[u]=1);c=d,d&7&&(h=d)}}}function wA(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 b=a-3;b>=0;b-=3)if(wr[b+1]==-f){let _=wr[b+2],x=_&2?s:_&4?_&1?n:s:0;x&&(rt[h]=rt[wr[b]]=x),a=b;break}}else{if(wr.length==189)break;wr[a++]=h,wr[a++]=d,wr[a++]=l}else if((p=rt[h])==2||p==1){let b=p==s;l=b?0:1;for(let _=a-3;_>=0;_-=3){let x=wr[_+2];if(x&2)break;if(b)wr[_+2]|=2;else{if(x&4)break;wr[_+2]|=4}}}}}function xA(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=rt[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(rt[c]==256)c++;else break;let h=n==1,d=(c<e?rt[c]:r)==1,f=h==d?h?1:2:r;for(let p=c,b=s,_=b?i[b-1].to:t;p>l;)p==_&&(p=i[--b].from,_=b?i[b-1].to:t),rt[--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 b=rt[l];b!=a&&(c=!1,h=b==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 b=n[u];if(!c)for(let _=b.to,x=u+1;;){if(_==i)break e;if(x<n.length&&n[x].from==_)_=n[x++].to;else{if(rt[_]==a)break e;break}}if(u++,d)d.push(b);else{b.from>l&&o.push(new Or(l,b.from,f));let _=b.direction==Dn!=!(f%2);Id(t,_?r+1:r,s,b.inner,b.from,b.to,o),l=b.to}p=b.to}else{if(p==i||(c?rt[p]!=a:rt[p]==a))break;p++}d?Fd(t,l,p,r+1,s,d,o):l<p&&o.push(new Or(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 b=rt[l-1];b!=a&&(c=!1,h=b==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 b=n[--u];if(!c)for(let _=b.from,x=u;;){if(_==e)break e;if(x&&n[x-1].to==_)_=n[--x].from;else{if(rt[_-1]==a)break e;break}}if(d)d.push(b);else{b.to<l&&o.push(new Or(b.to,l,f));let _=b.direction==Dn!=!(f%2);Id(t,_?r+1:r,s,b.inner,b.from,b.to,o),l=b.from}p=b.from}else{if(p==e||(c?rt[p-1]!=a:rt[p-1]==a))break;p--}d?Fd(t,p,l,r+1,s,d,o):p<l&&o.push(new Or(p,l,f)),l=p}}function Id(t,e,i,r,s,n,o){let a=e%2?2:1;yA(t,s,n,r,a),wA(t,s,n,r,a),xA(s,n,r,a),Fd(t,s,n,e,i,r,o)}function SA(t,e,i){if(!t)return[new Or(0,0,e==l1?1:0)];if(e==Dn&&!i.length&&!_A.test(t))return Db(t.length);if(i.length)for(;t.length>rt.length;)rt[rt.length]=256;let r=[],s=e==Dn?0:1;return Id(t,s,s,i,0,t.length,r),r}function Db(t){return[new Or(0,t,0)]}let Mb="";function kA(t,e,i,r,s){var n;let o=r.head-t.from,a=Or.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=Lr(t.text,o,l.forward(s,i));(c<l.from||c>l.to)&&(c=u),Mb=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?xe.cursor(h.side(!s,i)+t.from,h.forward(s,i)?1:-1,h.level):xe.cursor(c+t.from,l.forward(s,i)?-1:1,l.level)}function CA(t,e,i){for(let r=e;r<i;r++){let s=Ab(t.charCodeAt(r));if(s==1)return Dn;if(s==2||s==4)return l1}return Dn}const Tb=Ce.define(),Bb=Ce.define(),Rb=Ce.define(),Nb=Ce.define(),zd=Ce.define(),Lb=Ce.define(),Ob=Ce.define(),u1=Ce.define(),c1=Ce.define(),Pb=Ce.define({combine:t=>t.some(e=>e)}),AA=Ce.define({combine:t=>t.some(e=>e)}),Fb=Ce.define();class to{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 to(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 to(xe.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const El=ct.define({map:(t,e)=>t.map(e)}),Ib=ct.define();function Pr(t,e,i){let r=t.facet(Nb);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 is=Ce.define({combine:t=>t.length?t[0]:!0});let EA=0;const Wn=Ce.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 $r{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(Wn.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Wn.of({plugin:this,arg:e}))}static define(e,i){const{eventHandlers:r,eventObservers:s,provide:n,decorations:o}=i||{};return new $r(EA++,e,r,s,a=>{let l=[];return o&&l.push(y0.of(u=>{let c=u.plugin(a);return c?o(c):We.none})),n&&l.push(n(a)),l})}static fromClass(e,i){return $r.define((r,s)=>new e(r,s),i)}}class Pc{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(Pr(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){Pr(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){Pr(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const zb=Ce.define(),h1=Ce.define(),y0=Ce.define(),jb=Ce.define(),d1=Ce.define(),Ya=Ce.define(),Hb=Ce.define();function Jg(t,e){let i=t.state.facet(Hb);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=CA(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 b={from:u,to:c,direction:f,inner:[]};h.push(b),h=b.inner}}}}),s}const $b=Ce.define();function qb(t){let e=0,i=0,r=0,s=0;for(let n of t.state.facet($b)){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 Zo=Ce.define();class Qi{constructor(e,i,r,s){this.fromA=e,this.toA=i,this.fromB=r,this.toB=s}join(e){return new Qi(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 Qi(c,d,u,h))}return r}}class Lu{constructor(e,i,r){this.view=e,this.state=i,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=Bt.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 Qi(n,o,a,l))),this.changedRanges=s}static create(e,i,r){return new Lu(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 DA=[];class kt{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 DA}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&&uA(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=Ys(this.dom),s=this.length?e>0:i>0;return new lr(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 x0)return e;return null}static get(e){return e.cmTile}}class w0 extends kt{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=Zg(s);else i.insertBefore(a.dom,s);r=a.dom}for(s=r?r.nextSibling:i.firstChild,n&&s&&(n.written=!0);s;)s=Zg(s);this.length=o}}function Zg(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class x0 extends w0{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=kt.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 as)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 as extends w0{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 as(i||document.createElement(e.tagName),e);return i||(r.flags|=4),r}}class ho extends w0{constructor(e,i){super(e),this.attrs=i}isLine(){return!0}static start(e,i,r){let s=new ho(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],b=f+p.length;b>=h&&(p.isComposite()?l(p,h-f):(!o||o.isHidden&&(i>0&&!(o.flags&32)||r&&TA(o,p)))&&(b>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=b}}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):MA(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 lr(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 lr(l.dom,0);l==r.tile&&(a=!0)}}return new lr(this.dom,0)}}function MA(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let i=hu(e);return i[i.length-1]||null}function TA(t,e){let i=t.coordsIn(0,1),r=e.coordsIn(0,1);return i&&r&&r.top<i.bottom}class Ri extends w0{constructor(e,i){super(e),this.mark=i}get domAttrs(){return this.mark.attrs}static of(e,i){let r=new Ri(i||document.createElement(e.tagName),e);return i||(r.flags|=4),r}}class gn extends kt{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?ye.chrome||ye.gecko||(e?(n--,a=1):o<s&&(o++,a=-1)):i<0?n--:o<s&&o++;let l=La(this.dom,n,o).getClientRects();if(!l.length)return null;let u=l[(a?a<0:i>=0)?0:l.length-1];return ye.safari&&!a&&u.width==0&&(u=Array.prototype.find.call(l,c=>c.width)||u),r==null?u:Nu(u,(a?a>0:i<0)==r)}static of(e,i){let r=new gn(i||document.createTextNode(e),e);return i||(r.flags|=2),r}}class Mn extends kt{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 Nu(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 Nu(o,!a)}}get overrideDOMText(){if(!this.length)return Ye.empty;let{root:e}=this;if(!e)return Ye.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 Mn(n,r,e,s)}}class Ou extends kt{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 Ye.empty}coordsIn(e,i,r){let s=this.dom.getBoundingClientRect();return r==null?s:Nu(s,i>0==r)}}class BA{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 RA{constructor(e,i,r,s){this.from=e,this.to=i,this.wrapper=r,this.rank=s}}class NA{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 gn(a.dom,a.text+e);l.parent=o}else o.append(s||gn.of(e,(n=this.cache.find(gn))===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)?Fc(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 Ri&&u.mark.eq(l.mark))u.dom!=l.dom&&u.setDOM(Fc(l.dom)),s=u;else{if(this.cache.reused.get(l)){let h=kt.get(l.dom);h&&h.setDOM(Fc(l.dom))}let c=Ri.of(l.mark,l.dom);s.append(c),s=c}this.cache.reused.set(l,2)}let n=kt.get(e.text);n&&this.cache.reused.set(n,2);let o=new gn(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=Wb);let s=ho.start(e,i||((r=this.cache.find(ho))===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 Ri&&a.mark.eq(o))s=a,i--;else{let l=Ri.of(o,(r=this.cache.find(Ri,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||!Qg(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(ye.ios&&Qg(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Ic,0,32)||new Mn(Ic.toDOM(),0,Ic,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 RA(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 as&&s.wrapper.eq(r.wrapper))i=s;else{let n=as.of(r.wrapper,(e=this.cache.find(as,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(Ou,void 0,1);return r&&(r.flags=i),r||new Ou(i)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class LA{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 Pu=[Mn,ho,gn,Ri,Ou,as,x0];for(let t=0;t<Pu.length;t++)Pu[t].bucket=t;class OA{constructor(e){this.view=e,this.buckets=Pu.map(()=>[]),this.index=Pu.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 Mn(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 PA{constructor(e,i,r,s,n){this.view=e,this.decorations=s,this.disallowBlockEffectsFor=n,this.openWidget=!1,this.openMarks=0,this.cache=new OA(e),this.text=new LA(e.state.doc),this.builder=new NA(this.cache,new x0(e,e.contentDOM),je.iter(r)),this.cache.reused.set(i,2),this.old=new BA(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=zA(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?Mn.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 Ou)this.cache.add(o);else if(o instanceof Ri)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 Ri&&s.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?s.length&&(s.length=n=0):o instanceof Ri&&(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 En){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?fo.block:fo.inline),p=FA(u),b=this.cache.findWidget(f,l-a,p)||Mn.of(f,this.view,l-a,p);u.block?(u.startSide>0&&s.addLineStartIfNotCovered(r),s.addBlockWidget(b)):(s.ensureLine(r),s.addInlineWidget(b,c,h))}r=null}else r=IA(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=kt.get(s);if(s==this.view.contentDOM)break;n instanceof Ri?i.push(n):n!=null&&n.isLine()?r=n:n instanceof as||(s.nodeName=="DIV"&&!r&&s!=this.view.contentDOM?r=new ho(s,Wb):r||i.push(Ri.of(new Ua({tagName:s.nodeName.toLowerCase(),attributes:cA(s)}),s)))}return{line:r,marks:i}}}function Qg(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 FA(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 Wb={class:"cm-line"};function IA(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 zA(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 Ri&&e.push(r.mark)}return e}function Fc(t){let e=kt.get(t);return e&&e.setDOM(t.cloneNode()),t}class fo extends Qs{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}}fo.inline=new fo("span");fo.block=new fo("div");const Ic=new class extends Qs{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class e2{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=We.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 x0(e,e.contentDOM),this.updateInner([new Qi(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:!GA(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let n=s>-1?HA(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){let{from:c,to:h}=this.hasComposition;r=new Qi(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,(ye.ie||ye.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=WA(o,this.decorations,e.changes);l.length&&(r=Qi.extendWithRanges(r,l));let u=VA(a,this.blockWrappers,e.changes);return u.length&&(r=Qi.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 PA(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);i&&kt.get(i.text)&&a.cache.reused.set(kt.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=ye.chrome||ye.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 zc&&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(Ib)&&(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(is)||r.tabIndex>-1)&&ca(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)),ye.gecko&&l.empty&&!this.hasComposition&&jA(u)){let d=document.createTextNode("");this.view.observer.ignore(()=>u.node.insertBefore(d,u.node.childNodes[u.offset]||null)),u=c=new lr(d,0),a=!0}let h=this.view.observer.selectionRange;(a||!h.focusNode||(!ha(u.node,u.offset,h.anchorNode,h.anchorOffset)||!ha(c.node,c.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,l))&&(this.view.observer.ignore(()=>{ye.android&&ye.chrome&&r.contains(h.focusNode)&&UA(h.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let d=Na(this.view.root);if(d)if(l.empty){if(ye.gecko){let f=$A(u.node,u.offset);if(f&&f!=3){let p=(f==1?Sb:kb)(u.node,u.offset);p&&(u=new lr(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 lr(h.anchorNode,h.anchorOffset),this.impreciseHead=c.precise?null:new lr(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,i){return this.hasComposition&&i.empty&&ha(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=Na(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=hs(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&&!kt.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 zc?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=Lr(n.text,o);if(a==o)return null;let l=La(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==Pt.LTR,u=0,c=(h,d,f)=>{for(let p=0;p<h.children.length&&!(d>s);p++){let b=h.children[p],_=d+b.length,x=b.dom.getBoundingClientRect(),{height:S}=x;if(f&&!p&&(u+=x.top-f.top),b instanceof as)_>r&&c(b,d,x);else if(d>=r&&(u>0&&i.push(-u),i.push(S+u),u=0,o)){let E=b.dom.lastChild,D=E?hu(E):[];if(D.length){let M=D[D.length-1],C=l?M.right-x.left:x.right-M.left;C>a&&(a=C,this.minWidth=n,this.minWidthFrom=d,this.minWidthTo=_)}}f&&p==h.children.length-1&&(u+=f.bottom-x.bottom),d=_+b.breakAfter}};return c(this.tile,0,null),i}textDirectionAt(e){let{tile:i}=this.tile.resolveBlock(e,1);return getComputedStyle(i.dom).direction=="rtl"?Pt.RTL:Pt.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=hu(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=hu(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(We.replace({widget:new zc(a),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!n)break;r=n.to+1}return We.set(e)}updateDeco(){let e=1,i=this.view.state.facet(y0).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(jb).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(Fb))try{if(u(this.view,e.range,e))return!0}catch(c){Pr(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=qb(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(fA(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==Pt.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=_b(u.dom);u.dom.scrollIntoView({block:"nearest"}),yb(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 jA(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 Kb(t,e){let i=t.observer.selectionRange;if(!i.focusNode)return null;let r=Sb(i.focusNode,i.focusOffset),s=kb(i.focusNode,i.focusOffset),n=r||s;if(s&&r&&s.node!=r.node){let a=kt.get(s.node);if(!a||a.isText()&&a.text!=s.node.nodeValue)n=s;else if(t.docView.lastCompositionAfterCursor){let l=kt.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 HA(t,e,i){let r=Kb(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 Qi(l.mapPos(n),l.mapPos(o),n,o),text:s}}function $A(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 qA=class{constructor(){this.changes=[]}compareRange(e,i){Qn(e,i,this.changes)}comparePoint(e,i){Qn(e,i,this.changes)}boundChange(e){Qn(e,e,this.changes)}};function WA(t,e,i){let r=new qA;return je.compare(t,e,i,r),r.changes}class KA{constructor(){this.changes=[]}compareRange(e,i){Qn(e,i,this.changes)}comparePoint(){}boundChange(e){Qn(e,e,this.changes)}}function VA(t,e,i){let r=new KA;return je.compare(t,e,i,r),r.changes}function UA(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 GA(t,e){let i=!1;return e&&t.iterChangedRanges((r,s)=>{r<e.to&&s>e.from&&(i=!0)}),i}class zc extends Qs{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 YA(t,e,i=1){let r=t.charCategorizer(e),s=t.doc.lineAt(e),n=e-s.from;if(s.length==0)return xe.cursor(e);n==0?i=1:n==s.length&&(i=-1);let o=n,a=n;i<0?o=Lr(s.text,n,!1):a=Lr(s.text,n);let l=r(s.text.slice(o,a));for(;o>0;){let u=Lr(s.text,o,!1);if(r(s.text.slice(u,o))!=l)break;o=u}for(;a<s.length;){let u=Lr(s.text,a);if(r(s.text.slice(a,u))!=l)break;a=u}return xe.undirectionalRange(o+s.from,a+s.from)}function XA(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 JA(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==Ni.Text&&(s.type!=n.type||(i<0?n.from<e:n.to>e)))&&(s=n)}}return s||r}return r}function ZA(t,e,i,r){let s=JA(t,e.head,e.assoc||-1),n=!r||s.type!=Ni.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==Pt.LTR)?o.right-1:o.left+1,y:(n.top+n.bottom)/2});if(l!=null)return xe.cursor(l,i?-1:1)}return xe.cursor(i?s.to:s.from,i?-1:1)}function t2(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=kA(s,n,o,a,i),c=Mb;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 QA(t,e,i){let r=t.state.charCategorizer(e),s=r(i);return n=>{let o=r(n);return s==ss.Space&&(s=o),s==o}}function eE(t,e,i,r){let s=e.head,n=i?1:-1;if(s==(i?t.state.doc.length:0))return xe.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 b=a+(f+p)*n,_=Hd(t,{x:h,y:b},!1,n);if(i?b>l.bottom:b<l.top)return xe.cursor(_.pos,_.assoc);let x=t.coordsAtPos(_.pos,_.assoc),S=x?(x.top+x.bottom)/2:0;if(!x||(i?S>a:S<a))return xe.cursor(_.pos,_.assoc,void 0,o)}}function da(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 Vb(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=da(t,s.from,0);o!=s.from&&(n=xe.cursor(o,-1))}else{let o=da(t,s.from,-1),a=da(t,s.to,1);(o!=s.from||a!=s.to)&&(s.undirectional?n=xe.undirectionalRange(s.from,s.to):n=xe.range(s.from==s.anchor?o:a,s.from==s.head?o:a))}n&&(i||(i=e.ranges.slice()),i[r]=n)}return i?xe.create(i,e.mainIndex):e}function jc(t,e,i){let r=da(t.state.facet(Ya).map(s=>s(t)),i.from,e.head>i.from?-1:1);return r==i.from?i:xe.cursor(r,r<i.from?1:-1)}class Mr{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 Mr(0,1);if(l>t.viewState.docHeight)return new Mr(t.state.doc.length,-1);if(u=t.elementAtHeight(l),r==null)break;if(u.type==Ni.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==Ni.Text){let h=XA(t,s,u,o,a);return new Mr(h,h==u.from?1:-1)}}if(u.type!=Ni.Text)return l<(u.top+u.bottom)/2?new Mr(u.from,1):new Mr(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 tE(t,o,a,t.textDirectionAt(u.from)).scanTile(c,u.from)}class tE{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[Or.find(s,e-r.from,-1,i)].level==this.baseDir}dirAt(e,i){let{line:r,spans:s}=this.bidiSpansAt(e);return s[Or.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,b=s+n>>1;t:if(o.has(b)){for(let S=1;S<p;S++){let E=b+S;if(E>=n&&(E-=p),!o.has(E)){b=E;break t}}break e}o.add(b);let _=i(b),x=0;if(_)for(let S=0;S<_.length;S++){let E=_[S];if(!(E.width==0&&_.length>1))if(E.bottom<this.y)(!l||l.bottom<E.bottom)&&(l=E),x=1;else if(E.top>this.y)(!u||u.top>E.top)&&(u=E),x=-1;else{let D=E.left>this.x?this.x-E.left:E.right<this.x?this.x-E.right:0,M=Math.abs(D);M<h&&(c=b,h=M,d=E),D&&(x=D<0==(this.baseDir==Pt.LTR)?-1:1)}}x==-1&&(!a||this.baseDirAt(e[b],1))?n=b:x==1&&(!a||this.baseDirAt(e[b+1],-1))&&(s=b+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:b}=d;if(l&&l.bottom>(p+p+b)/3)return this.y=l.bottom-1,this.scan(e,i,!0);if(u&&u.top<(p+b+b)/3)return this.y=u.top+1,this.scan(e,i,!0)}let f=(a?this.dirAt(e[c],1):this.baseDir)==Pt.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=Lr(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 La(e.dom,o,a).getClientRects()});return s.after?new Mr(r[s.i+1],-1):new Mr(r[s.i],1)}scanTile(e,i){if(!e.length)return new Mr(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:La(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 Mr(r[s.i+1],-1):new Mr(o,1)}}const $n="￿";class iE{constructor(e,i){this.points=e,this.view=i,this.text="",this.lineSeparator=i.state.facet(Ve.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=$n}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=kt.get(s),a=s.nextSibling;if(a==i){o!=null&&o.breakAfter&&!a&&r!=this.view.contentDOM&&this.lineBreak();break}let l=kt.get(a);(o&&l?o.breakAfter:(o?o.breakAfter:Ru(s))||Ru(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=kt.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+(rE(e,r.node,r.offset)?i:0))}}function rE(t,e,i){for(;;){if(!e||i<hs(e))return!1;if(e==t)return!0;i=Ys(e)+1,e=e.parentNode}}function sE(t,e){let i;for(;!(t==e||!t);t=t.nextSibling){let r=kt.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 i2{constructor(e,i){this.node=e,this.offset=i,this.pos=-1}}class nE{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=Ub(e.docView.tile,i,r,0))){let l=n||o?[]:aE(e),u=new iE(l,e);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=lE(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((ye.ios||ye.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,b=h.to-f;(p==0||p==1||d==0)&&(b==0||b==-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(xe.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=xe.create([xe.cursor(u,f)])}else this.newSel=xe.single(c,u)}}}function Ub(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 Ub(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 Gb(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||ye.android&&e.text.length<l-a)&&(u=n.to,c="end");let h=s.doc.sliceString(a,l,$n),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:Ye.of(e.text.slice(n.from-a,d).split($n))}:(f=Yb(h,e.text,u-a,c))&&(ye.chrome&&o==13&&f.toB==f.from+2&&e.text.slice(f.from,f.toB)==$n+$n&&f.toB--,i={from:a+f.from,to:a+f.toA,insert:Ye.of(e.text.slice(f.from,f.toB).split($n))})}else r&&(!t.hasFocus&&s.facet(is)||Fu(r,n))&&(r=null);if(!i&&!r)return!1;if((ye.mac||ye.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=xe.single(r.main.anchor-1,r.main.head-1)),i={from:i.from,to:i.to,insert:Ye.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)}:ye.chrome&&i&&i.from==i.to&&i.from==n.head&&i.insert.toString()==`
323
+ `&&t.lineWrapping&&(r&&(r=xe.single(r.main.anchor-1,r.main.head-1)),i={from:n.from,to:n.to,insert:Ye.of([" "])}),i)return f1(t,i,r,o);if(r&&!Fu(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=Vb(s.facet(Ya).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(ye.ios&&t.inputState.flushIOSKey(e))return!0;let s=t.state.selection.main;if(ye.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&&eo(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)&&eo(t.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&eo(t.contentDOM,"Delete",46)))return!0;let n=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let o,a=()=>o||(o=oE(t,e,i));return t.state.facet(Lb).some(l=>l(t,e.from,e.to,n,a))||t.dispatch(a()),!0}function oE(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=da(s.facet(Ya).map(h=>h(t)),u,l);e.from==c&&(o=c)}if(o>-1)r={changes:e,selection:xe.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&&Kb(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 b=p.to-f,_=b-c.length;if(t.state.sliceDoc(_,b)!=c||b>=h.from&&_<=h.to)return{range:p};let x=s.changes({from:_,to:b,insert:e.insert}),S=p.to-n.to;return{changes:x,range:u?xe.range(Math.max(0,u.anchor+S),Math.max(0,u.head+S)):p.map(x)}})}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 Yb(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 i2(i,r)),(s!=i||n!=r)&&e.push(new i2(s,n))),e}function lE(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?xe.single(i+e,r+e):null}function Fu(t,e){return e.head==t.main.head&&e.anchor==t.main.anchor}class uE{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,ye.safari&&e.contentDOM.addEventListener("input",()=>null),ye.gecko&&CE(e.contentDOM.ownerDocument)}handleEvent(e){!bE(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=hE(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&&Jb.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),ye.android&&ye.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(ye.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(Xb.some(i=>i.keyCode==e.keyCode)&&!e.ctrlKey||dE.indexOf(e.key)>-1&&e.ctrlKey)){let i={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};return i.shiftKey&&ye.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&cE(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,eo(this.view.contentDOM,i.key,i.keyCode,i.mods))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:ye.safari&&!ye.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 cE(t){return t.visualViewport?t.visualViewport.height*t.visualViewport.scale/t.document.documentElement.clientHeight<.85:!1}function r2(t,e){return(i,r)=>{try{return e.call(t,r,i)}catch(s){Pr(i.state,s)}}}function hE(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(r2(r.value,l))}if(o)for(let a in o){let l=o[a];l&&i(a).observers.push(r2(r.value,l))}}for(let r in dr)i(r).handlers.push(dr[r]);for(let r in ki)i(r).observers.push(ki[r]);return e}const Xb=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],dE="dthko",Jb=[16,17,18,20,91,92,224,225],Dl=6;function Ml(t){return Math.max(0,t)*.7+8}function fE(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class pE{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=bb(e.contentDOM),this.atoms=e.state.facet(Ya).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(Ve.allowMultipleSelections)&&mE(e,i),this.dragging=vE(e,i)&&e6(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&&fE(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=qb(this.view);e.clientX-l.left<=s+Dl?i=-Ml(s-e.clientX):e.clientX+l.right>=o-Dl&&(i=Ml(e.clientX-o)),e.clientY-l.top<=n+Dl?r=-Ml(n-e.clientY):e.clientY+l.bottom>=a-Dl&&(r=Ml(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=Vb(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 mE(t,e){let i=t.state.facet(Tb);return i.length?i[0](e):ye.mac?e.metaKey:e.ctrlKey}function gE(t,e){let i=t.state.facet(Bb);return i.length?i[0](e):ye.mac?!e.altKey:!e.ctrlKey}function vE(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let r=Na(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 bE(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=kt.get(i))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(e))return!1;return!0}const dr=Object.create(null),ki=Object.create(null),Zb=ye.ie&&ye.ie_version<15||ye.ios&&ye.webkit_version<604;function _E(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(),Qb(t,i.value)},50)}function S0(t,e,i){for(let r of t.facet(e))i=r(i,t);return i}function Qb(t,e){e=S0(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:xe.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:xe.cursor(l.from+u.length)}}):r=i.replaceSelection(n);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}ki.scroll=t=>{let e=t.inputState;e.lastScrollTop=t.scrollDOM.scrollTop,e.lastScrollLeft=t.scrollDOM.scrollLeft,ye.ios&&!e.touchActive&&(e.lastIOSMomentumScroll=Date.now())};ki.wheel=ki.mousewheel=t=>{t.inputState.lastWheelEvent=Date.now()};dr.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);ki.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")};ki.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};ki.touchend=(t,e)=>{t.inputState.touchActive=!1};dr.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(Rb))if(i=r(t,e),i)break;if(!i&&e.button==0&&(i=wE(t,e)),i){let r=!t.hasFocus;t.inputState.startMouseSelection(new pE(t,e,i,r)),r&&t.observer.ignore(()=>{wb(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 s2(t,e,i,r){if(r==1)return xe.cursor(e,i);if(r==2)return YA(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++,xe.undirectionalRange(o,a)}}const yE=ye.ie&&ye.ie_version<=11;let n2=null,o2=0,a2=0;function e6(t){if(!yE)return t.detail;let e=n2,i=a2;return n2=t,a2=Date.now(),o2=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(o2+1)%3:1}function wE(t,e){let i=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),r=e6(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=s2(t,l.pos,l.assoc,r);if(i.pos!=l.pos&&!o){let h=s2(t,i.pos,i.assoc,r),d=Math.min(h.from,c.from),f=Math.max(h.to,c.to);c=d<c.from?xe.range(d,f,c.assoc):xe.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=xE(s,l.pos))?u:a?s.addRange(c):xe.create([c])}}}function xE(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 xe.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}dr.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=xe.undirectionalRange(n,o))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=i,e.dataTransfer&&(e.dataTransfer.setData("Text",S0(t.state,c1,t.state.sliceDoc(i.from,i.to))),e.dataTransfer.effectAllowed="copyMove"),!1};dr.dragend=t=>(t.inputState.draggedContent=null,!1);function l2(t,e,i,r){if(i=S0(t.state,u1,i),!i)return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:n}=t.inputState,o=r&&n&&gE(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}dr.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&&l2(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 l2(t,e,r,!0),!0}return!1};dr.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let i=Zb?null:e.clipboardData;return i?(Qb(t,i.getData("text/plain")||i.getData("text/uri-list")),!0):(_E(t),!1)};function SE(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 kE(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:S0(t,c1,e.join(t.lineBreak)),ranges:i,linewise:r}}let $d=null;dr.copy=dr.cut=(t,e)=>{if(!ca(t.contentDOM,t.observer.selectionRange))return!1;let{text:i,ranges:r,linewise:s}=kE(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=Zb?null:e.clipboardData;return n?(n.clearData(),n.setData("text/plain",i),!0):(SE(t,i),!1)};const t6=Co.define();function i6(t,e){let i=[];for(let r of t.facet(Ob)){let s=r(t,e);s&&i.push(s)}return i.length?t.update({effects:i,annotations:t6.of(!0)}):null}function r6(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=i6(t.state,e);i?t.dispatch(i):t.update([])}},10)}ki.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),r6(t)};ki.blur=t=>{t.observer.clearSelectionRange(),r6(t)};ki.compositionstart=ki.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};ki.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,ye.chrome&&ye.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};ki.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};dr.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(ye.chrome&&ye.android&&(s=Xb.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 ye.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),ye.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>ki.compositionend(t,e),20),!1};const u2=new Set;function CE(t){u2.has(t)||(u2.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const c2=["pre-wrap","normal","pre-line","break-spaces"];let po=!1;function h2(){po=!1}class AE{constructor(e){this.lineWrapping=e,this.doc=Ye.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 c2.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=c2.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 EE{constructor(e,i){this.from=e,this.heights=i,this.index=0}get more(){return this.index<this.heights.length}}class ar{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"?Ni.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 En?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 ar(this.from,this.length+e.length,this.top,this.height+e.height,i)}}var ot=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(ot||(ot={}));const du=.001;class Si{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)>du&&(po=!0),this.height=e)}replace(e,i,r){return Si.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,ot.ByPosNoHeight,r.setDoc(i),0,0),f=d.to>=u?d:n.lineAt(u,ot.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,ot.ByPosNoHeight,r,0,0));c+=d.from-l,l=d.from;let p=p1.build(r.setDoc(o),e,c,h);n=Iu(n,n.replace(l,u,p))}return n.updateHeight(r,0)}static empty(){return new Ii(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 ME(Si.of(e.slice(0,i)),o,Si.of(e.slice(r)))}}function Iu(t,e){return t==e?t:(t.constructor!=e.constructor&&(po=!0),e)}Si.prototype.size=1;const DE=We.replace({});class s6 extends Si{constructor(e,i,r){super(e,i),this.deco=r,this.spaceAbove=0}mainBlock(e,i){return new ar(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 ar(s,0,r,this.spaceAbove,DE):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,ot.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 Ii extends s6{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 ar(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 Ii||s instanceof ei&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof ei?s=new Ii(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):Si.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 ei extends Si{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 ar(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 ar(c,h,r+a*u,a,0)}}lineAt(e,i,r,s,n){if(i==ot.ByHeight)return this.blockAt(e,r,s,n);if(i==ot.ByPosNoHeight){let{from:f,to:p}=r.doc.lineAt(e);return new ar(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 ar(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 ar(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 ei?r[r.length-1]=new ei(n.length+s):r.push(null,new ei(s-1))}if(e>0){let n=r[0];n instanceof ei?r[0]=new ei(e+n.length):r.unshift(new ei(e-1),null)}return Si.of(r)}decomposeLeft(e,i){i.push(new ei(e-1),null)}decomposeRight(e,i){i.push(null,new ei(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 ei(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)>=du&&(l=-2);let f=new Ii(c,h,d);f.outdated=!1,o.push(f),a+=c+1}a<=n&&o.push(null,new ei(n-a).updateHeight(e,a));let u=Si.of(o);return(l<0||Math.abs(u.height-this.height)>=du||Math.abs(l-this.heightMetrics(e,i).perLine)>=du)&&(po=!0),Iu(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 ME extends Si{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==ot.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==ot.ByPosNoHeight?ot.ByPosNoHeight:ot.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,ot.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&&d2(n,o-1),i<this.length){let a=n.length;this.decomposeRight(i,n),d2(n,a)}return Si.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?Si.of(this.break?[e,null,i]:[e,i]):(this.left=Iu(this.left,e),this.right=Iu(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 d2(t,e){let i,r;t[e]==null&&(i=t[e-1])instanceof ei&&(r=t[e+1])instanceof ei&&t.splice(e-1,3,new ei(i.length+1+r.length))}const TE=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 Ii?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Ii(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 s6(o,s,r)):(o||n||s>=TE)&&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 Ii(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,i){let r=new ei(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 Ii)return e;let i=new Ii(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 Ii)&&!this.isCovered?this.nodes.push(new Ii(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 Ii&&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 BE(t,e,i){let r=new RE;return je.compare(t,e,i,r,0),r.changes}class RE{constructor(){this.changes=[]}compareRange(){}comparePoint(e,i,r,s){(e<i||r&&r.heightRelevant||s&&s.heightRelevant)&&Qn(e,i,this.changes,5)}}function NE(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 LE(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 OE(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class Hc{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 We.replace({widget:new PE(this.displaySize*(i?e.scaleY:e.scaleX),i)}).range(this.from,this.to)}}class PE extends Qs{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 f2{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=p2,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Pt.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let r=i.facet(h1).some(s=>typeof s!="function"&&s.class=="cm-lineWrapping");this.heightOracle=new AE(r),this.stateDeco=m2(i),this.heightMap=Si.empty().applyChanges(this.stateDeco,Ye.empty,this.heightOracle.setDoc(i.doc),[new Qi(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=We.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 Tl(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?p2: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(Qo(e,this.scaler))})}update(e,i=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=m2(this.state);let s=e.changedRanges,n=Qi.extendWithRanges(s,BE(r,this.stateDeco,e?e.changes:Bt.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);h2(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),n),(this.heightMap.height!=o||po)&&(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(AA)&&(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"?Pt.RTL:Pt.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:M,scaleY:C}=vb(i,a);(M>.005&&Math.abs(this.scaleX-M)>.005||C>.005&&Math.abs(this.scaleY-C)>.005)&&(this.scaleX=M,this.scaleY=C,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=bb(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=xb(this.scrollParent||e.win);let b=(this.printing?OE:NE)(i,this.paddingTop),_=b.top-this.pixelViewport.top,x=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let S=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(S!=this.inView&&(this.inView=S,S&&(l=!0)),!this.inView&&!this.scrollTarget&&!LE(e.dom))return 0;let E=a.width;if((this.contentDOMWidth!=E||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,u|=16),l){let M=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(M)&&(o=!0),o||s.lineWrapping&&Math.abs(E-this.contentDOMWidth)>s.charWidth){let{lineHeight:C,charWidth:N,textHeight:W}=e.docView.measureTextSize();o=C>0&&s.refresh(n,C,N,W,Math.max(5,E/N),M),o&&(e.docView.minWidth=0,u|=16)}_>0&&x>0?c=Math.max(_,x):_<0&&x<0&&(c=Math.min(_,x)),h2();for(let C of this.viewports){let N=C.from==this.viewport.from?M:e.docView.measureVisibleLineHeights(C);this.heightMap=(o?Si.empty().applyChanges(this.stateDeco,Ye.empty,this.heightOracle,[new Qi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new EE(C.from,N))}po&&(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 Tl(s.lineAt(o-r*1e3,ot.ByHeight,n,0,0).from,s.lineAt(a+(1-r)*1e3,ot.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,ot.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 Tl(s.lineAt(d-1e3/2,ot.ByHeight,n,0,0).from,s.lineAt(d+c+1e3/2,ot.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 Tl(this.heightMap.lineAt(r,ot.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,ot.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,ot.ByPos,this.heightOracle,0,0),{bottom:n}=this.heightMap.lineAt(i,ot.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 Hc(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!=Pt.LTR&&!r)return[];let a=[],l=(c,h,d,f)=>{if(h-c<n)return;let p=this.state.selection.main,b=[p.from];p.empty||b.push(p.to);for(let x of b)if(x>c&&x<h){l(c,x-10,d,f),l(x+10,h,d,f);return}let _=IE(e,x=>x.from>=d.from&&x.to<=d.to&&Math.abs(x.from-c)<n&&Math.abs(x.to-h)<n&&!b.some(S=>x.from<S&&x.to>S));if(!_){if(h<d.to&&i&&r&&i.visibleRanges.some(E=>E.from<=h&&E.to>=h)){let E=i.moveToLineBoundary(xe.cursor(h),!1,!0).head;E>c&&(h=E)}let x=this.gapSize(d,c,h,f),S=r||x<2e6?x:2e6;_=new Hc(c,h,x,S)}a.push(_)},u=c=>{if(c.length<o||c.type!=Ni.Text)return;let h=FE(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 b=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,_,x;if(d!=null){let S=Rl(h,d),E=((this.visibleBottom-this.visibleTop)/2+b)/c.height;_=S-E,x=S+E}else _=(this.visibleTop-c.top-b)/c.height,x=(this.visibleBottom-c.top+b)/c.height;f=Bl(h,_),p=Bl(h,x)}else{let b=h.total*this.heightOracle.charWidth,_=s*this.heightOracle.charWidth,x=0;if(b>2e6)for(let C of e)C.from>=c.from&&C.from<c.to&&C.size!=C.displaySize&&C.from*this.heightOracle.charWidth+x<this.pixelViewport.left&&(x=C.size-C.displaySize);let S=this.pixelViewport.left+x,E=this.pixelViewport.right+x,D,M;if(d!=null){let C=Rl(h,d),N=((E-S)/2+_)/b;D=C-N,M=C+N}else D=(S-_)/b,M=(E+_)/b;f=Bl(h,D),p=Bl(h,M)}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=Rl(s,r)-Rl(s,i);return this.heightOracle.lineWrapping?e.height*n:s.total*this.heightOracle.charWidth*n}updateLineGaps(e){Hc.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=We.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)||Qo(this.heightMap.lineAt(e,ot.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)||Qo(this.heightMap.lineAt(this.scaler.fromDOM(e),ot.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 Qo(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 Tl{constructor(e,i){this.from=e,this.to=i}}function FE(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 Bl({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 Rl(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 IE(t,e){for(let i of t)if(e(i))return i}const p2={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};function m2(t){let e=t.facet(y0).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,ot.ByPos,e,0,0).top,c=i.lineAt(l,ot.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 Qo(t,e){if(e.scale==1)return t;let i=e.toDOM(t.top),r=e.toDOM(t.bottom);return new ar(t.from,t.length,i,r-i,Array.isArray(t._content)?t._content.map(s=>Qo(s,e)):t._content)}const Nl=Ce.define({combine:t=>t.join(" ")}),qd=Ce.define({combine:t=>t.indexOf(!0)>-1}),Wd=cs.newName(),n6=cs.newName(),o6=cs.newName(),a6={"&light":"."+n6,"&dark":"."+o6};function Kd(t,e,i){return new cs(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 zE=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"}},a6),jE={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},$c=ye.ie&&ye.ie_version<=11;class HE{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new pA,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);(ye.ie&&ye.ie_version<=11||ye.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&&ye.android&&e.constructor.EDIT_CONTEXT!==!1&&!(ye.chrome&&ye.chrome_version<126)&&(this.editContext=new qE(e),e.state.facet(is)&&(e.contentDOM.editContext=this.editContext.editContext)),$c&&(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(is)?r.root.activeElement!=this.dom:!ca(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}(ye.ie&&ye.ie_version<=11||ye.android&&ye.chrome)&&!r.state.selection.main.empty&&s.focusNode&&ha(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,i=Na(e.root);if(!i)return!1;let r=ye.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&$E(this.view,i)||i;if(!r||this.selectionRange.eq(r))return!1;let s=ca(this.dom,r);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&gA(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,jE),$c&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),$c&&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&&eo(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&&ca(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 nE(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=Gb(this.view,i);return this.view.state==r&&(i.domChanged||i.newSel&&!Fu(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=g2(i,e.previousSibling||e.target.previousSibling,-1),s=g2(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(is)!=e.state.facet(is)&&(e.view.contentDOM.editContext=e.state.facet(is)?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 g2(t,e,i){for(;e;){let r=kt.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 v2(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 ha(o.node,o.offset,s,n)&&([i,r,s,n]=[s,n,i,r]),{anchorNode:i,anchorOffset:r,focusNode:s,focusOffset:n}}function $E(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return v2(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?v2(t,i):null}class qE{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=Yb(e.state.sliceDoc(a,l),r.text,(u?s.from:s.to)-a,u?"end":null);if(!c){let d=xe.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));Fu(d,s)||e.dispatch({selection:d,userEvent:"select"});return}let h={from:c.from+a,to:c.toA+a,insert:Ye.of(r.text.slice(c.from,c.toB).split(`
324
+ `))};if((ye.mac||ye.android)&&h.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(h={from:a,to:l,insert:Ye.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,xe.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(We.mark({attributes:{style:c}}).range(l,u))}}}e.dispatch({effects:Ib.of(We.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=Na(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 Ae{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||mA(e.parent)||document,this.viewState=new f2(this,e.state||Ve.create(e)),e.scrollTo&&e.scrollTo.is(El)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Wn).map(s=>new Pc(s));for(let s of this.plugins)s.update(this);this.observer=new HE(this),this.inputState=new uE(this),this.inputState.ensureHandlers(this.plugins),this.docView=new e2(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 ci?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(t6))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=i6(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(Ve.phrases)!=this.state.facet(Ve.phrases))return this.setState(n);s=Lu.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:b}=this.state.facet(Ae.cursorScrollMargin);h=new to(f.empty?f:xe.cursor(f.head,f.head>f.anchor?-1:1),"nearest","nearest",b,p)}for(let f of d.effects)f.is(El)&&(h=f.value.clip(this.state))}this.viewState.update(s,h),this.bidiCache=zu.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),i=this.docView.update(s),this.state.facet(Zo)!=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(Nl)!=s.state.facet(Nl)&&(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){Pr(this.state,f,"update listener")}(l||c)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),c&&!Gb(this,c)&&u.force&&eo(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 f2(this,e),this.plugins=e.facet(Wn).map(r=>new Pc(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new e2(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(Wn),r=e.state.facet(Wn);if(i!=r){let s=[];for(let n of r){let o=i.indexOf(n);if(o<0)s.push(new Pc(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){Pr(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(xb(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 Pr(this.state,p),b2}}),h=Lu.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]!=b2)try{let p=u[f];p.write&&p.write(c[f],this)}catch(p){Pr(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)&&!(ye.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)?o6:n6)+" "+this.state.facet(Nl)}updateAttrs(){let e=_2(this,zb,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),i={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(is)?"true":"false",class:"cm-content",style:`${ye.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(i["aria-readonly"]="true"),_2(this,h1,i);let r=this.observer.ignore(()=>{let s=Gg(this.contentDOM,this.contentAttrs,i),n=Gg(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(Ae.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(Zo);let e=this.state.facet(Ae.cspNonce);cs.mount(this.root,this.styleModules.concat(zE).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 jc(this,e,t2(this,e,i,r))}moveByGroup(e,i){return jc(this,e,t2(this,e,i,r=>QA(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 xe.cursor(n.side(i,s)+e.from,n.forward(!i,s)?1:-1)}moveToLineBoundary(e,i,r=!0){return ZA(this,e,i,r)}moveVertically(e,i,r){return jc(this,e,eE(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[Or.find(s,e-r.from,-1,i)];return this.docView.coordsAt(e,i,n.dir==Pt.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(Pb)||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>WE)return Db(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||Eb(n.isolates,r=Jg(this,e))))return n.order;r||(r=Jg(this,e));let s=SA(e.text,i,r);return this.bidiCache.push(new zu(e.from,e.to,i,r,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||ye.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{wb(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 El.of(new to(typeof e=="number"?xe.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 El.of(new to(xe.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 $r.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return $r.define(()=>({}),{eventObservers:e})}static theme(e,i){let r=cs.newName(),s=[Nl.of(r),Zo.of(Kd(`.${r}`,e))];return i&&i.dark&&s.push(qd.of(!0)),s}static baseTheme(e){return On.lowest(Zo.of(Kd("."+Wd,e,a6)))}static findFromDOM(e){var i;let r=e.querySelector(".cm-content"),s=r&&kt.get(r)||kt.get(e);return((i=s==null?void 0:s.root)===null||i===void 0?void 0:i.view)||null}}Ae.styleModule=Zo;Ae.inputHandler=Lb;Ae.clipboardInputFilter=u1;Ae.clipboardOutputFilter=c1;Ae.scrollHandler=Fb;Ae.focusChangeEffect=Ob;Ae.perLineTextDirection=Pb;Ae.exceptionSink=Nb;Ae.updateListener=zd;Ae.editable=is;Ae.mouseSelectionStyle=Rb;Ae.dragMovesSelection=Bb;Ae.clickAddsSelectionRange=Tb;Ae.decorations=y0;Ae.blockWrappers=jb;Ae.outerDecorations=d1;Ae.atomicRanges=Ya;Ae.bidiIsolatedRanges=Hb;Ae.cursorScrollMargin=Ce.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}}});Ae.scrollMargins=$b;Ae.darkTheme=qd;Ae.cspNonce=Ce.define({combine:t=>t.length?t[0]:""});Ae.contentAttributes=h1;Ae.editorAttributes=zb;Ae.lineWrapping=Ae.contentAttributes.of({class:"cm-lineWrapping"});Ae.announce=ct.define();const WE=4096,b2={};class zu{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:Pt.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 zu(i.mapPos(o.from,1),i.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function _2(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 KE=ye.mac?"mac":ye.windows?"win":ye.linux?"linux":"key";function VE(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 Ll(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 UE=On.default(Ae.domEventHandlers({keydown(t,e){return ZE(YE(e.state),t,e,"editor")}})),GE=Ce.define({enables:UE}),y2=new WeakMap;function YE(t){let e=t.facet(GE),i=y2.get(e);return i||y2.set(e,i=JE(e.reduce((r,s)=>r.concat(s),[]))),i}let Ps=null;const XE=4e3;function JE(t,e=KE){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(x=>VE(x,e));for(let x=1;x<p.length;x++){let S=p.slice(0,x).join(" ");s(S,!0),f[S]||(f[S]={preventDefault:!0,stopPropagation:!1,run:[E=>{let D=Ps={view:E,prefix:S,scope:o};return setTimeout(()=>{Ps==D&&(Ps=null)},XE),!0}]})}let b=p.join(" ");s(b,!1);let _=f[b]||(f[b]={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 ZE(t,e,i,r){Vd=e;let s=lA(e),n=$C(s,0),o=qC(n)==s.length&&s!=" ",a="",l=!1,u=!1,c=!1;Ps&&Ps.view==i&&Ps.scope==r&&(a=Ps.prefix+" ",Jb.indexOf(e.keyCode)<0&&(u=!0,Ps=null));let h=new Set,d=_=>{if(_){for(let x of _.run)if(!h.has(x)&&(h.add(x),x(i)))return _.stopPropagation&&(c=!0),!0;_.preventDefault&&(_.stopPropagation&&(c=!0),u=!0)}return!1},f=t[r],p,b;return f&&(d(f[a+Ll(s,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(ye.windows&&e.ctrlKey&&e.altKey)&&!(ye.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(p=Gs[e.keyCode])&&p!=s?(d(f[a+Ll(p,e,!0)])||e.shiftKey&&(b=Ba[e.keyCode])!=s&&b!=p&&d(f[a+Ll(b,e,!1)]))&&(l=!0):o&&e.shiftKey&&d(f[a+Ll(s,e,!0)])&&(l=!0),!l&&d(f._any)&&(l=!0)),u&&(l=!0),l&&c&&e.stopPropagation(),Vd=null,l}function bR(){return eD}const QE=We.line({class:"cm-activeLine"}),eD=$r.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(QE.range(s.from)),e=s.from)}return We.set(i)}},{decorations:t=>t.decorations});class fr extends An{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}fr.prototype.elementClass="";fr.prototype.toDOM=void 0;fr.prototype.mapMode=zi.TrackBefore;fr.prototype.startSide=fr.prototype.endSide=-1;fr.prototype.point=!0;const fu=Ce.define(),tD=Ce.define(),iD={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>je.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},fa=Ce.define();function l6(t){return[u6(),fa.of({...iD,...t})]}const w2=Ce.define({combine:t=>t.some(e=>e)});function u6(t){return[rD]}const rD=$r.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(fa).map(e=>new S2(t,e)),this.fixed=!t.state.facet(w2);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(w2)!=!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(fu),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==Ni.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==Ni.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(fa),i=t.state.facet(fa),r=t.docChanged||t.heightChanged||t.viewportChanged||!je.eq(t.startState.facet(fu),t.state.facet(fu),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 S2(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=>Ae.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==Pt.LTR?{left:r,right:s}:{right:r,left:s}})});function x2(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 c6(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(tD)){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 S2{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=x2(i.markers(e)),i.initialSpacer&&(this.spacer=new c6(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=x2(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 c6{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":""),nD(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 nD(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 oD=Ce.define(),aD=Ce.define(),Kn=Ce.define({combine(t){return tA(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 qc extends fr{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Wc(t,e){return t.state.facet(Kn).formatNumber(e,t.state)}const lD=fa.compute([Kn],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(oD)},lineMarker(e,i,r){return r.some(s=>s.toDOM)?null:new qc(Wc(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(Kn)!=e.state.facet(Kn),initialSpacer(e){return new qc(Wc(e,k2(e.state.doc.lines)))},updateSpacer(e,i){let r=Wc(i.view,k2(i.view.state.doc.lines));return r==e.number?e:new qc(r)},domEventHandlers:t.facet(Kn).domEventHandlers,side:"before"}));function uD(t={}){return[Kn.of(t),u6(),lD]}function k2(t){let e=9;for(;e<t;)e=e*10+9;return e}const cD=new class extends fr{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},hD=fu.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(cD.range(s)))}return je.of(e)});function _R(){return hD}const dD=1024;let fD=0,Kc=class{constructor(e,i){this.from=e,this.to=i}};class it{constructor(e={}){this.id=fD++,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=Wi.match(e)),i=>{let r=e(i);return r===void 0?null:[this,r]}}}it.closedBy=new it({deserialize:t=>t.split(" ")});it.openedBy=new it({deserialize:t=>t.split(" ")});it.group=new it({deserialize:t=>t.split(" ")});it.isolate=new it({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});it.contextHash=new it({perNode:!0});it.lookAhead=new it({perNode:!0});it.mounted=new it({perNode:!0});class pa{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[it.mounted.id]}}const pD=Object.create(null);class Wi{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):pD,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new Wi(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(it.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(it.group),n=-1;n<(s?s.length:0);n++){let o=i[n<0?r.name:s[n]];if(o)return o}}}}Wi.none=new Wi("",Object.create(null),0,8);class h6{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 Wi(r.name,s,r.id,r.flags):r)}return new h6(i)}}const Ol=new WeakMap,C2=new WeakMap;var Dt;(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"})(Dt||(Dt={}));class si{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=pa.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=Ol.get(this)||this.topNode,n=new Yd(s);return n.moveTo(e,i),Ol.set(this,n._tree),n}get topNode(){return new Li(this,0,0,null)}resolve(e,i=0){let r=Oa(Ol.get(this)||this.topNode,e,i,!1);return Ol.set(this,r),r}resolveInner(e,i=0){let r=Oa(C2.get(this)||this.topNode,e,i,!0);return C2.set(this,r),r}resolveStack(e,i=0){return vD(this,e,i)}iterate(e){let{enter:i,leave:r,from:s=0,to:n=this.length}=e,o=e.mode||0,a=(o&Dt.IncludeAnonymous)>0;for(let l=this.cursor(o|Dt.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(Wi.none,this.children,this.positions,0,this.children.length,0,this.length,(i,r,s)=>new si(this.type,i,r,s,this.propValues),e.makeTree||((i,r,s)=>new si(Wi.none,i,r,s)))}static build(e){return bD(e)}}si.empty=new si(Wi.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 Xs{constructor(e,i,r){this.buffer=e,this.length=i,this.set=r}get type(){return Wi.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&&!(d6(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 Xs(n,o,this.set)}}function d6(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 Oa(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 Li&&t.index<0?null:t.parent;if(!o)return t;t=o}let n=r?0:Dt.IgnoreOverlays;if(r)for(let o=t,a=o.parent;a;o=a,a=o.parent)o instanceof Li&&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 f6{cursor(e=0){return new Yd(this,e)}getChild(e,i=null,r=null){let s=A2(this,e,i,r);return s.length?s[0]:null}getChildren(e,i=null,r=null){return A2(this,e,i,r)}resolve(e,i=0){return Oa(this,e,i,!1)}resolveInner(e,i=0){return Oa(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 Li extends f6{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&Dt.EnterBracketed&&c instanceof si&&(d=pa.get(c))&&!d.overlay&&d.bracketed&&r>=h&&r<=h+c.length)&&!d6(s,r,h,h+c.length))){if(c instanceof Xs){if(n&Dt.ExcludeBuffers)continue;let f=c.findChild(0,c.buffer.length,i,r-h,s);if(f>-1)return new Fr(new mD(o,c,e,h),null,f)}else if(n&Dt.IncludeAnonymous||!c.type.isAnonymous||v1(c)){let f;if(!(n&Dt.IgnoreMounts)&&(f=pa.get(c))&&!f.overlay)return new Li(f.tree,h,e,o);let p=new Li(c,h,e,o);return n&Dt.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(i<0?c.children.length-1:0,i,r,s,n)}}}if(n&Dt.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&Dt.IgnoreOverlays)&&(s=pa.get(this._tree))&&s.overlay){let n=e-this.from,o=r&Dt.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 Li(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 A2(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 mD{constructor(e,i,r,s){this.parent=e,this.buffer=i,this.index=r,this.start=s}}class Fr extends f6{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 Fr(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&Dt.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 Fr(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 Fr(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 Fr(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 si(this.type,e,i,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function p6(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 Li&&i.index<0?null:i.parent,s=t.slice();return r?s[e]=r:s.splice(e,1),new gD(s,i)}class gD{constructor(e,i){this.heads=e,this.node=i}get next(){return p6(this.heads)}}function vD(t,e,i){let r=t.resolveInner(e,i),s=null;for(let n=r instanceof Li?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=pa.get(n.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new Li(o.tree,o.overlay[0].from+n.from,-1,n);(s||(s=[r])).push(Oa(a,e,i,!1))}}return s?p6(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&~Dt.EnterBracketed,e instanceof Li)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 Li?(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&Dt.ExcludeBuffers?!1:this.enterChild(1,e,i):this.yield(this._tree.enter(e,i,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Dt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Dt.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&Dt.IncludeAnonymous||a instanceof Xs||!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 Fr(this.buffer,i,this.stack[s]);return this.bufferNode=new Fr(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 Xs||!e.type.isAnonymous||v1(e))}function bD(t){var e;let{buffer:i,nodeSet:r,maxBufferLength:s=dD,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(M,C,N,W,q,K){let{id:V,start:I,end:z,size:P}=a,j=c,O=u;if(P<0)if(a.next(),P==-1){let X=n[V];N.push(X),W.push(I-M);return}else if(P==-3){u=V;return}else if(P==-4){c=V;return}else throw new RangeError(`Unrecognized record size: ${P}`);let G=l[V],$,ue,Y=I-M;if(z-I<=s&&(ue=_(a.pos-C,q))){let X=new Uint16Array(ue.size-ue.skip),he=a.pos-ue.size,H=X.length;for(;a.pos>he;)H=x(ue.start,X,H);$=new Xs(X,z-ue.start,r),Y=ue.start-M}else{let X=a.pos-P;a.next();let he=[],H=[],ne=V>=o?V:-1,pe=0,ce=z;for(;a.pos>X;)ne>=0&&a.id==ne&&a.size>=0?(a.end<=ce-s&&(p(he,H,I,pe,a.end,ce,ne,j,O),pe=he.length,ce=a.end),a.next()):K>2500?d(I,X,he,H):h(I,X,he,H,ne,K+1);if(ne>=0&&pe>0&&pe<he.length&&p(he,H,I,pe,I,ce,ne,j,O),he.reverse(),H.reverse(),ne>-1&&pe>0){let ie=f(G,O);$=b1(G,he,H,0,he.length,0,z-I,ie,ie)}else $=b(G,he,H,z-I,j-z,O)}N.push($),W.push(Y)}function d(M,C,N,W){let q=[],K=0,V=-1;for(;a.pos>C;){let{id:I,start:z,end:P,size:j}=a;if(j>4)a.next();else{if(V>-1&&z<V)break;V<0&&(V=P-s),q.push(I,z,P),K++,a.next()}}if(K){let I=new Uint16Array(K*4),z=q[q.length-2];for(let P=q.length-3,j=0;P>=0;P-=3)I[j++]=q[P],I[j++]=q[P+1]-z,I[j++]=q[P+2]-z,I[j++]=j;N.push(new Xs(I,q[2]-z,r)),W.push(z-M)}}function f(M,C){return(N,W,q)=>{let K=0,V=N.length-1,I,z;if(V>=0&&(I=N[V])instanceof si){if(!V&&I.type==M&&I.length==q)return I;(z=I.prop(it.lookAhead))&&(K=W[V]+I.length+z)}return b(M,N,W,q,K,C)}}function p(M,C,N,W,q,K,V,I,z){let P=[],j=[];for(;M.length>W;)P.push(M.pop()),j.push(C.pop()+N-q);M.push(b(r.types[V],P,j,K-q,I-K,z)),C.push(q-N)}function b(M,C,N,W,q,K,V){if(K){let I=[it.contextHash,K];V=V?[I].concat(V):[I]}if(q>25){let I=[it.lookAhead,q];V=V?[I].concat(V):[I]}return new si(M,C,N,W,V)}function _(M,C){let N=a.fork(),W=0,q=0,K=0,V=N.end-s,I={size:0,start:0,skip:0};e:for(let z=N.pos-M;N.pos>z;){let P=N.size;if(N.id==C&&P>=0){I.size=W,I.start=q,I.skip=K,K+=4,W+=4,N.next();continue}let j=N.pos-P;if(P<0||j<z||N.start<V)break;let O=N.id>=o?4:0,G=N.start;for(N.next();N.pos>j;){if(N.size<0)if(N.size==-3||N.size==-4)O+=4;else break e;else N.id>=o&&(O+=4);N.next()}q=G,W+=P,K+=O}return(C<0||W==M)&&(I.size=W,I.start=q,I.skip=K),I.size>4?I:void 0}function x(M,C,N){let{id:W,start:q,end:K,size:V}=a;if(a.next(),V>=0&&W<o){let I=N;if(V>4){let z=a.pos-(V-4);for(;a.pos>z;)N=x(M,C,N)}C[--N]=I,C[--N]=K-M,C[--N]=q-M,C[--N]=W}else V==-3?u=W:V==-4&&(c=W);return N}let S=[],E=[];for(;a.pos>0;)h(t.start||0,t.bufferStart||0,S,E,-1,0);let D=(e=t.length)!==null&&e!==void 0?e:S.length?E[0]+S[0].length:0;return new si(l[t.topID],S.reverse(),E.reverse(),D)}const E2=new WeakMap;function pu(t,e){if(!t.isAnonymous||e instanceof Xs||e.type!=t)return 1;let i=E2.get(e);if(i==null){i=1;for(let r of e.children){if(r.type!=t||!(r instanceof si)){i=1;break}i+=pu(t,r)}E2.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+=pu(t,e[p]);let c=Math.ceil(u*1.5/8),h=[],d=[];function f(p,b,_,x,S){for(let E=_;E<x;){let D=E,M=b[E],C=pu(t,p[E]);for(E++;E<x;E++){let N=pu(t,p[E]);if(C+N>=c)break;C+=N}if(E==D+1){if(C>c){let N=p[D];f(N.children,N.positions,0,N.children.length,b[D]+S);continue}h.push(p[D])}else{let N=b[E-1]+p[E-1].length-M;h.push(b1(t,p,b,D,E,M,N,null,l))}d.push(M+S-n)}}return f(e,i,r,s,0),(a||l)(h,d,o)}class wR{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 Fr?this.setBuffer(e.context.buffer,e.index,i):e instanceof Li&&this.map.set(e.tree,i)}get(e){return e instanceof Fr?this.getBuffer(e.context.buffer,e.index):e instanceof Li?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 xn{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 xn(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 xn(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 _D{startParse(e,i,r){return typeof e=="string"&&(e=new yD(e)),r=r?r.length?r.map(s=>new Kc(s.from,s.to)):[new Kc(0,0)]:[new Kc(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 yD{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 it({perNode:!0});let wD=0;class Ji{constructor(e,i,r,s){this.name=e,this.set=i,this.base=r,this.modified=s,this.id=wD++}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 Ji&&(i=e),i!=null&&i.base)throw new Error("Can not derive from a modified tag");let s=new Ji(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 ju(e);return r=>r.modified.indexOf(i)>-1?r:ju.get(r.base||r,r.modified.concat(i).sort((s,n)=>s.id-n.id))}}let xD=0;class ju{constructor(e){this.name=e,this.instances=[],this.id=xD++}static get(e,i){if(!i.length)return e;let r=i[0].instances.find(a=>a.base==e&&SD(i,a.modified));if(r)return r;let s=[],n=new Ji(e.name,s,e,i);for(let a of i)a.instances.push(n);let o=kD(i);for(let a of e.set)if(!a.modified.length)for(let l of o)s.push(ju.get(a,l));return n}}function SD(t,e){return t.length==e.length&&t.every((i,r)=>i==e[r])}function kD(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 CD(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 Pa(r,o,l>0?n.slice(0,l):null);e[u]=c.sort(e[u])}}return m6.add(e)}const m6=new it({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 Pa(s.tags,s.mode,s.context);i?i.next=n:r=n,i=n}return r}});class Pa{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}}Pa.empty=new Pa([],2,null);function g6(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 AD(t,e){let i=null;for(let r of t){let s=r.style(e);s&&(i=i?i+" "+s:s)}return i}function v6(t,e,i,r=0,s=t.length){let n=new ED(r,Array.isArray(e)?e:[e],i);n.highlightRange(t.cursor(),r,s,"",n.highlighters),n.flush(s)}class ED{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=DD(e)||Pa.empty,h=AD(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(it.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)),b=e.firstChild();for(let _=0,x=a;;_++){let S=_<d.overlay.length?d.overlay[_]:null,E=S?S.from+a:l,D=Math.max(i,x),M=Math.min(r,E);if(D<M&&b)for(;e.from<M&&(this.highlightRange(e,D,M,s,n),this.startSpan(Math.min(M,e.to),u),!(e.to>=E||!e.nextSibling())););if(!S||E>r)break;x=S.to+a,x>i&&(this.highlightRange(f.cursor(),Math.max(i,S.from+a),Math.min(r,x),"",p),this.startSpan(Math.min(r,x),u))}b&&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 DD(t){let e=t.type.prop(m6);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const de=Ji.define,Pl=de(),Rs=de(),D2=de(Rs),M2=de(Rs),Ns=de(),Fl=de(Ns),Vc=de(Ns),Ar=de(),an=de(Ar),xr=de(),Sr=de(),Xd=de(),$o=de(Xd),Il=de(),Se={comment:Pl,lineComment:de(Pl),blockComment:de(Pl),docComment:de(Pl),name:Rs,variableName:de(Rs),typeName:D2,tagName:de(D2),propertyName:M2,attributeName:de(M2),className:de(Rs),labelName:de(Rs),namespace:de(Rs),macroName:de(Rs),literal:Ns,string:Fl,docString:de(Fl),character:de(Fl),attributeValue:de(Fl),number:Vc,integer:de(Vc),float:de(Vc),bool:de(Ns),regexp:de(Ns),escape:de(Ns),color:de(Ns),url:de(Ns),keyword:xr,self:de(xr),null:de(xr),atom:de(xr),unit:de(xr),modifier:de(xr),operatorKeyword:de(xr),controlKeyword:de(xr),definitionKeyword:de(xr),moduleKeyword:de(xr),operator:Sr,derefOperator:de(Sr),arithmeticOperator:de(Sr),logicOperator:de(Sr),bitwiseOperator:de(Sr),compareOperator:de(Sr),updateOperator:de(Sr),definitionOperator:de(Sr),typeOperator:de(Sr),controlOperator:de(Sr),punctuation:Xd,separator:de(Xd),bracket:$o,angleBracket:de($o),squareBracket:de($o),paren:de($o),brace:de($o),content:Ar,heading:an,heading1:de(an),heading2:de(an),heading3:de(an),heading4:de(an),heading5:de(an),heading6:de(an),contentSeparator:de(Ar),list:de(Ar),quote:de(Ar),emphasis:de(Ar),strong:de(Ar),link:de(Ar),monospace:de(Ar),strikethrough:de(Ar),inserted:de(),deleted:de(),changed:de(),invalid:de(),meta:Il,documentMeta:de(Il),annotation:de(Il),processingInstruction:de(Il),definition:Ji.defineModifier("definition"),constant:Ji.defineModifier("constant"),function:Ji.defineModifier("function"),standard:Ji.defineModifier("standard"),local:Ji.defineModifier("local"),special:Ji.defineModifier("special")};for(let t in Se){let e=Se[t];e instanceof Ji&&(e.name=t)}g6([{tag:Se.link,class:"tok-link"},{tag:Se.heading,class:"tok-heading"},{tag:Se.emphasis,class:"tok-emphasis"},{tag:Se.strong,class:"tok-strong"},{tag:Se.keyword,class:"tok-keyword"},{tag:Se.atom,class:"tok-atom"},{tag:Se.bool,class:"tok-bool"},{tag:Se.url,class:"tok-url"},{tag:Se.labelName,class:"tok-labelName"},{tag:Se.inserted,class:"tok-inserted"},{tag:Se.deleted,class:"tok-deleted"},{tag:Se.literal,class:"tok-literal"},{tag:Se.string,class:"tok-string"},{tag:Se.number,class:"tok-number"},{tag:[Se.regexp,Se.escape,Se.special(Se.string)],class:"tok-string2"},{tag:Se.variableName,class:"tok-variableName"},{tag:Se.local(Se.variableName),class:"tok-variableName tok-local"},{tag:Se.definition(Se.variableName),class:"tok-variableName tok-definition"},{tag:Se.special(Se.variableName),class:"tok-variableName2"},{tag:Se.definition(Se.propertyName),class:"tok-propertyName tok-definition"},{tag:Se.typeName,class:"tok-typeName"},{tag:Se.namespace,class:"tok-namespace"},{tag:Se.className,class:"tok-className"},{tag:Se.macroName,class:"tok-macroName"},{tag:Se.propertyName,class:"tok-propertyName"},{tag:Se.operator,class:"tok-operator"},{tag:Se.comment,class:"tok-comment"},{tag:Se.meta,class:"tok-meta"},{tag:Se.invalid,class:"tok-invalid"},{tag:Se.punctuation,class:"tok-punctuation"}]);var Uc;const Vn=new it;function MD(t){return Ce.define({combine:t?e=>e.concat(t):void 0})}const TD=new it;class ur{constructor(e,i,r=[],s=""){this.data=e,this.name=s,Ve.prototype.hasOwnProperty("tree")||Object.defineProperty(Ve.prototype,"tree",{get(){return Fa(this)}}),this.parser=i,this.extension=[Tn.of(this),Ve.languageData.of((n,o,a)=>{let l=T2(n,o,a),u=l.type.prop(Vn);if(!u)return[];let c=n.facet(u),h=l.type.prop(TD);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 T2(e,i,r).type.prop(Vn)==this.data}findRegions(e){let i=e.facet(Tn);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(Vn)==this.data){r.push({from:o,to:o+n.length});return}let a=n.prop(it.mounted);if(a){if(a.tree.prop(Vn)==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 si&&s(u,n.positions[l]+o)}};return s(Fa(e),0),r}get allowsNesting(){return!0}}ur.setState=ct.define();function T2(t,e,i){let r=t.facet(Tn),s=Fa(t).topNode;if(!r||r.allowsNesting)for(let n=s;n;n=n.enter(e,i,Dt.ExcludeBuffers|Dt.EnterBracketed))n.type.isTop&&(s=n);return s}class Jd extends ur{constructor(e,i,r){super(e,i,[],r),this.parser=i}static define(e){let i=MD(e.languageData);return new Jd(i,e.parser.configure({props:[Vn.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 Fa(t){let e=t.field(ur.state,!1);return e?e.tree:si.empty}class BD{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 qo=null;class Hu{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 Hu(e,i,[],si.empty,0,r,[],null)}startParse(){return this.parser.startParse(new BD(this.state.doc),this.fragments)}work(e,i){return i!=null&&i>=this.state.doc.length&&(i=void 0),this.tree!=si.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(xn.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(xn.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let i=qo;qo=this;try{return e()}finally{qo=i}}withoutTempSkipped(e){for(let i;i=this.tempSkipped.pop();)e=B2(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=xn.applyChanges(r,l),s=si.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 Hu(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=B2(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 _D{createParse(i,r,s){let n=s[0].from,o=s[s.length-1].to;return{parsedPos:n,advance(){let l=qo;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 si(Wi.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 qo}}function B2(t,e,i){return xn.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class mo{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 mo(i)}static init(e){let i=Math.min(3e3,e.doc.length),r=Hu.create(e.facet(Tn).parser,e,{from:0,to:i});return r.work(20,i)||r.takeTree(),new mo(r)}}ur.state=rr.define({create:mo.init,update(t,e){for(let i of e.effects)if(i.is(ur.setState))return i.value;return e.startState.facet(Tn)!=e.state.facet(Tn)?mo.init(e.state):t.apply(e)}});let b6=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(b6=t=>{let e=-1,i=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const Gc=typeof navigator<"u"&&(!((Uc=navigator.scheduling)===null||Uc===void 0)&&Uc.isInputPending)?()=>navigator.scheduling.isInputPending():null,RD=$r.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(ur.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(ur.state);(i.tree!=i.context.tree||!i.context.isDone(e.doc.length))&&(this.working=b6(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(ur.state);if(n.tree==n.context.tree&&n.context.isDone(s+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!Gc?Math.max(25,e.timeRemaining()-5):1e9),a=n.context.treeLen<s&&r.doc.length>s+1e3,l=n.context.work(()=>Gc&&Gc()||Date.now()>o,s+(a?0:1e5));this.chunkBudget-=Date.now()-i,(l||this.chunkBudget<=0)&&(n.context.takeTree(),this.view.dispatch({effects:ur.setState.of(new mo(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=>Pr(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()}}}),Tn=Ce.define({combine(t){return t.length?t[0]:null},enables:t=>[ur.state,RD,Ae.contentAttributes.compute([t],e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}})]});class SR{constructor(e,i=[]){this.language=e,this.support=i,this.extension=[e,i]}}const kR=Ce.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}}),CR=new it;function ND(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 AR({closing:t,align:e=!0,units:i=1}){return r=>LD(r,e,i,t)}function LD(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?ND(t):null;return l?a?t.column(l.from):t.column(l.to):t.baseIndent+(a?0:t.unit*i)}const ER=t=>t.baseIndent;function DR({except:t,units:e=1}={}){return i=>{let r=t&&t.test(i.textAfter);return i.baseIndent+(r?0:e*i.unit)}}const MR=new it;function TR(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 k0{constructor(e,i){this.specs=e;let r;function s(a){let l=cs.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 ur?a=>a.prop(Vn)==o.data:o?a=>a==o:void 0,this.style=g6(e.map(a=>({tag:a.tag,class:a.class||s(Object.assign({},a,{tag:null}))})),{all:n}).style,this.module=r?new cs(r):null,this.themeType=i.themeType}static define(e,i){return new k0(e,i||{})}}const Zd=Ce.define(),OD=Ce.define({combine(t){return t.length?[t[0]]:null}});function mu(t){let e=t.facet(Zd);return e.length?e:t.facet(OD)}function PD(t,e){let i=[zD],r;return t instanceof k0&&(t.module&&i.push(Ae.styleModule.of(t.module)),r=t.themeType),r?i.push(Zd.computeN([Ae.darkTheme],s=>s.facet(Ae.darkTheme)==(r=="dark")?[t]:[])):i.push(Zd.of(t)),i}function FD(t,e,i){let r=mu(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 ID{constructor(e){this.markCache=Object.create(null),this.tree=Fa(e.state),this.decorations=this.buildDeco(e,mu(e.state)),this.decoratedTo=e.viewport.to}update(e){let i=Fa(e.state),r=mu(e.state),s=r!=mu(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 We.none;let r=new hr;for(let{from:s,to:n}of e.visibleRanges)v6(this.tree,i,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=We.mark({class:l})))},s,n);return r.finish()}}const zD=On.high($r.fromClass(ID,{decorations:t=>t.decorations})),jD=Object.create(null),R2=[Wi.none],N2=[],L2=Object.create(null),HD=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"]])HD[t]=$D(jD,e);function Yc(t,e){N2.indexOf(t)>-1||(N2.push(t),console.warn(e))}function $D(t,e){let i=[];for(let a of e.split(" ")){let l=[];for(let u of a.split(".")){let c=t[u]||Se[u];c?typeof c=="function"?l.length?l=l.map(c):Yc(u,`Modifier ${u} used at start of tag`):l.length?Yc(u,`Tag ${u} used as modifier`):l=Array.isArray(c)?c:[c]:Yc(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=L2[s];if(n)return n.id;let o=L2[s]=Wi.define({id:R2.length,name:r,props:[CD({[r]:i})]});return R2.push(o),o.id}Pt.RTL,Pt.LTR;class Nt{constructor(e,i,r,s){this.fromA=e,this.toA=i,this.fromB=r,this.toB=s}offset(e,i=e){return new Nt(this.fromA+e,this.toA+e,this.fromB+i,this.toB+i)}}function Bn(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 Nt(e,i,s,n)];if(l>u){let h=t.slice(e,i).indexOf(r.slice(s,n));if(h>-1)return[new Nt(e,e+h,s,s),new Nt(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 Nt(e,e,s,s+h),new Nt(i,i,s+h+l,n)]}if(l==1||u==1)return[new Nt(e,i,s,n)];let c=w6(t,e,i,r,s,n);if(c){let[h,d,f]=c;return Bn(t,e,h,r,s,d).concat(Bn(t,h+f,i,r,d+f,n))}return qD(t,e,i,r,s,n)}let ea=1e9,ta=0,_1=!1;function qD(t,e,i,r,s,n){let o=i-e,a=n-s;if(ea<1e9&&Math.min(o,a)>ea*16||ta>0&&Date.now()>ta)return Math.min(o,a)>ea*64?[new Nt(e,i,s,n)]:O2(t,e,i,r,s,n);let l=Math.ceil((o+a)/2);Xc.reset(l),Jc.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?Jc:null,d=h?null:Xc;for(let f=0;f<l;f++){if(f>ea||ta>0&&!(f&63)&&Date.now()>ta)return O2(t,e,i,r,s,n);let p=Xc.advance(f,o,a,l,h,!1,u)||Jc.advance(f,o,a,l,d,!0,c);if(p)return WD(t,e,i,e+p[0],r,s,n,s+p[1])}return[new Nt(e,i,s,n)]}class _6{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 Xc=new _6,Jc=new _6;function WD(t,e,i,r,s,n,o,a){let l=!1;return!go(t,r)&&++r==i&&(l=!0),!go(s,a)&&++a==o&&(l=!0),l?[new Nt(e,i,n,o)]:Bn(t,e,r,s,n,a).concat(Bn(t,r,i,s,a,o))}function y6(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=y6(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-(go(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=y6(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-(go(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;;){go(t,c)||c++;let h=c+o;if(go(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),b=w1(t,e,c,r,s,s+f),_=d.length+p+b;(!u||u[2]<_)&&(u=[c-b,s+f-b,_])}c=h}if(a<0)return u;o=o>>1}}function w6(t,e,i,r,s,n){let o=i-e,a=n-s;if(o<a){let l=w6(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 O2(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 Nt(e,i,s,n)];let[u,c,h]=l;return Bn(t,e,u,r,s,c).concat(Bn(t,u+h,i,r,c+h,n))}function x6(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 Nt(r.fromA,s.toA,r.fromB,s.toB),t.splice(i--,1))}}function KD(t,e,i){for(;;){x6(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 Nt(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 Nt(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 Nt(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 Nt(n.fromA+h,n.toA+h,n.fromB+h,n.toB+h),r=!0)}if(!r)break}return i}function VD(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=F2(e,n.fromA,u),d=P2(e,n.toA,c),f=n.fromA-h,p=d-n.toA;if((!o||!a)&&f&&p){let b=Math.max(o,a),[_,x,S]=o?[e,n.fromA,n.toA]:[i,n.fromB,n.toB];b>f&&e.slice(h,n.fromA)==_.slice(S-f,S)?(n=t[s]=new Nt(h,h+o,n.fromB-f,n.toB-f),h=n.fromA,d=P2(e,n.toA,l-n.toA)):b>p&&e.slice(n.toA,d)==_.slice(x,x+p)&&(n=t[s]=new Nt(d-o,d,n.fromB+p,n.toB+p),d=n.toA,h=F2(e,n.fromA,n.fromA-r)),f=n.fromA-h,p=d-n.toA}if(f||p)n=t[s]=new Nt(n.fromA-f,n.toA+p,n.fromB-f,n.toB+p);else if(o){if(!a){let b=z2(e,n.fromA,n.toA),_,x=b<0?-1:I2(e,n.toA,n.fromA);b>-1&&(_=b-n.fromA)<=c&&e.slice(n.fromA,b)==e.slice(n.toA,n.toA+_)?n=t[s]=n.offset(_):x>-1&&(_=n.toA-x)<=u&&e.slice(n.fromA-_,n.fromA)==e.slice(x,n.toA)&&(n=t[s]=n.offset(-_))}}else{let b=z2(i,n.fromB,n.toB),_,x=b<0?-1:I2(i,n.toB,n.fromB);b>-1&&(_=b-n.fromB)<=c&&i.slice(n.fromB,b)==i.slice(n.toB,n.toB+_)?n=t[s]=n.offset(_):x>-1&&(_=n.toB-x)<=u&&i.slice(n.fromB-_,n.fromB)==i.slice(x,n.toB)&&(n=t[s]=n.offset(-_))}}r=n.toA}return x6(t,3),t}let Sn;try{Sn=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function S6(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function k6(t,e){if(e==t.length)return 0;let i=t.charCodeAt(e);return i<192?S6(i)?1:0:Sn?!E6(i)||e==t.length-1?Sn.test(String.fromCharCode(i))?1:0:Sn.test(t.slice(e,e+2))?2:0:0}function C6(t,e){if(!e)return 0;let i=t.charCodeAt(e-1);return i<192?S6(i)?1:0:Sn?!D6(i)||e==1?Sn.test(String.fromCharCode(i))?1:0:Sn.test(t.slice(e-2,e))?2:0:0}const A6=8;function P2(t,e,i){if(e==t.length||!C6(t,e))return e;for(let r=e,s=e+i,n=0;n<A6;n++){let o=k6(t,r);if(!o||r+o>s)return r;r+=o}return e}function F2(t,e,i){if(!e||!k6(t,e))return e;for(let r=e,s=e-i,n=0;n<A6;n++){let o=C6(t,r);if(!o||r-o<s)return r;r-=o}return e}function I2(t,e,i){for(;e!=i;e--)if(t.charCodeAt(e-1)==10)return e;return-1}function z2(t,e,i){for(;e!=i;e++)if(t.charCodeAt(e)==10)return e;return-1}const E6=t=>t>=55296&&t<=56319,D6=t=>t>=56320&&t<=57343;function go(t,e){return!e||e==t.length||!E6(t.charCodeAt(e-1))||!D6(t.charCodeAt(e))}function UD(t,e,i){var r;let s=i==null?void 0:i.override;return s?s(t,e):(ea=((r=i==null?void 0:i.scanLimit)!==null&&r!==void 0?r:1e9)>>1,ta=i!=null&&i.timeout?Date.now()+i.timeout:0,_1=!1,KD(t,e,Bn(t,0,t.length,e,0,e.length)))}function M6(){return!_1}function T6(t,e,i){return VD(UD(t,e,i),t,e)}const wi=Ce.define({combine:t=>t[0]}),ef=ct.define(),B6=Ce.define(),di=rr.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(B6))t=i(t,e);return t}});let R6=t=>({state:e,dispatch:i})=>{let r=e.field(di,!1),s=e.facet(wi);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:Ae.scrollIntoView(xe.range(u,l))})),!0};const GD=R6(1),YD=R6(-1);class ls{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 ls(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=T6(e.toString(),i.toString(),r);return N6(s,e,i,0,0,M6())}static updateA(e,i,r,s,n){return W2(q2(e,s,!0,r.length),e,i,r,n)}static updateB(e,i,r,s,n){return W2(q2(e,s,!1,i.length),e,i,r,n)}}function j2(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 H2(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 N6(t,e,i,r,s,n){let o=[];for(let a=0;a<t.length;a++){let l=t[a],[u,c]=j2(l.fromA+r,l.fromB+s,e,i),[h,d]=H2(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],[b,_]=j2(p.fromA+r,p.fromB+s,e,i);if(b>h+1&&_>d+1)break;f.push(p.offset(-u+r,-c+s)),[h,d]=H2(p.toA+r,p.toB+s,e,i),a++}o.push(new ls(f,u,Math.max(u,h),c,Math.max(c,d),n))}return o}const zl=1e3;function $2(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 q2(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>zl&&([u,h]=$2(t,n-zl,i,!0)),o<e.length-zl&&([c,d]=$2(t,o+zl,i,!1));let f=l-a-(o-n),p,[b,_]=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+b,diffB:p.diffB+_}:s.push({fromA:u,toA:c,fromB:h,toB:d,diffA:b,diffB:_})}),s}function W2(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,b=T6(i.sliceString(h,f),r.sliceString(d,p),s);for(let _ of N6(b,i,r,h,d,M6()))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 L6={scanLimit:500},C0=$r.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=U2(t))}update(t){(t.docChanged||t.viewportChanged||XD(t.startState,t.state)||JD(t.startState,t.state))&&({deco:this.deco,gutter:this.gutter}=U2(t.view))}},{decorations:t=>t.deco}),jl=On.low(l6({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(C0))===null||e===void 0?void 0:e.gutter)||je.empty}}));function XD(t,e){return t.field(di,!1)!=e.field(di,!1)}function JD(t,e){return t.facet(wi)!=e.facet(wi)}const K2=We.line({class:"cm-changedLine"}),O6=We.mark({class:"cm-changedText"}),ZD=We.mark({tagName:"ins",class:"cm-insertedLine"}),QD=We.mark({tagName:"del",class:"cm-deletedLine"}),V2=new class extends fr{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function eM(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,K2),s.add(o,a,i?QD:ZD),n&&n.add(o,o,V2);for(let u=e.iterRange(o,a-1),c=o;!u.next().done;){if(u.lineBreak){c++,s.add(c,c,K2),n&&n.add(c,c,V2);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),b=Math.max(c,f),_=Math.min(h,p);if(b<_&&s.add(b,_,O6),p<h)l++;else break}c=h}}}function U2(t){let e=t.state.field(di),{side:i,highlightChanges:r,markGutter:s,overrideChunk:n}=t.state.facet(wi),o=i=="a",a=new hr,l=s?new hr: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))&&eM(h,t.state.doc,o,r,a,l)}return{deco:a.finish(),gutter:l&&l.finish()}}class Hl extends Qs{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 $u=ct.define({map:(t,e)=>t.map(e)}),ia=rr.define({create:()=>We.none,update:(t,e)=>{for(let i of e.effects)if(i.is($u))return i.value;return t.map(e.changes)},provide:t=>Ae.decorations.from(t)}),$l=.01;function G2(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 tM(t,e,i){let r=new hr,s=new hr,n=t.state.field(ia).iter(),o=e.state.field(ia).iter(),a=0,l=0,u=0,c=0,h=t.viewport,d=e.viewport;for(let _=0;;_++){let x=_<i.length?i[_]:null,S=x?x.fromA:t.state.doc.length,E=x?x.fromB:e.state.doc.length;if(a<S){let D=t.lineBlockAt(a).top+u,M=e.lineBlockAt(l).top+c,C=D-M;C<-$l?(u-=C,r.add(a,a,We.widget({widget:new Hl(-C),block:!0,side:-1}))):C>$l&&(c+=C,s.add(l,l,We.widget({widget:new Hl(C),block:!0,side:-1})))}if(S>a+1e3&&a<h.from&&S>h.from&&l<d.from&&E>d.from){let D=Math.min(h.from-a,d.from-l);a+=D,l+=D,_--}else if(x)a=x.toA,l=x.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<$l?r.add(t.state.doc.length,t.state.doc.length,We.widget({widget:new Hl(-f),block:!0,side:1})):f>$l&&s.add(e.state.doc.length,e.state.doc.length,We.widget({widget:new Hl(f),block:!0,side:1}));let p=r.finish(),b=s.finish();G2(p,t.state.field(ia))||t.dispatch({effects:$u.of(p)}),G2(b,e.state.field(ia))||e.dispatch({effects:$u.of(b)})}const tf=ct.define({map:(t,e)=>e.mapPos(t)});class iM extends Qs{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(wi);o&&o().dispatch({effects:tf.of(rM(s,e.state.field(di),n=="a"))})}),i}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function rM(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=rr.define({create(t){return We.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(di)!=e.startState.field(di,!1)){let i=e.state.facet(wi).side=="a",r=[];for(let s of e.state.field(di))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=>Ae.decorations.from(t)});function rf({margin:t=3,minSize:e=4}){return sM.init(i=>nM(i,t,e))}function nM(t,e,i){let r=new hr,s=t.facet(wi).side=="a",n=t.field(di),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,We.replace({widget:new iM(h),block:!0})),!l)break;o=t.doc.lineAt(Math.min(t.doc.length,s?l.toA:l.toB)).number}return r.finish()}const oM=Ae.styleModule.of(new cs({".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"}})),P6=Ae.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"}}),Y2=new ko,ql=new ko;class aM{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||L6;let i=[On.low(C0),P6,oM,ia,Ae.updateListener.of(h=>{this.measuring<0&&(h.heightChanged||h.viewportChanged)&&!h.transactions.some(d=>d.effects.some(f=>f.is($u)))&&this.measure()})],r=[wi.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&r.push(jl);let s=Ve.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],Ae.editorAttributes.of({class:"cm-merge-a"}),ql.of(r),i]}),n=[wi.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(jl);let o=Ve.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],Ae.editorAttributes.of({class:"cm-merge-b"}),ql.of(n),i]});this.chunks=ls.build(s.doc,o.doc,this.diffConf);let a=[di.init(()=>this.chunks),Y2.of(e.collapseUnchanged?rf(e.collapseUnchanged):[])];s=s.update({effects:ct.appendConfig.of(a)}).state,o=o.update({effects:ct.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 Ae({state:s,parent:u,root:e.root,dispatchTransactions:h=>this.dispatch(h,this.a)}),this.b=new Ae({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),Bt.empty(e[0].startState.doc.length));this.chunks=i==this.a?ls.updateA(this.chunks,r.newDoc,this.b.state.doc,s,this.diffConf):ls.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(wi),l=r?e.gutter!==!1:a.markGutter,u=i?e.highlightChanges!==!1:a.highlightChanges;n.push(ql.reconfigure([wi.of({side:"a",sibling:()=>this.b,highlightChanges:u,markGutter:l}),l?jl:[]])),o.push(ql.reconfigure([wi.of({side:"b",sibling:()=>this.a,highlightChanges:u,markGutter:l}),l?jl:[]]))}if(s){let a=Y2.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(){tM(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=X2(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=X2(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 X2(t){let e=t.nextSibling;return t.remove(),e}const lM=new class extends fr{constructor(){super(...arguments),this.elementClass="cm-deletedLineGutter"}},uM=On.low(l6({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(C0))===null||e===void 0?void 0:e.gutter)||je.empty},widgetMarker:(t,e)=>e instanceof F6?lM:null}));function cM(t){var e;let i=typeof t.original=="string"?Ye.of(t.original.split(/\r?\n/)):t.original,r=t.diffConfig||L6;return[On.low(C0),pM,P6,Ae.editorAttributes.of({class:"cm-merge-b"}),B6.of((s,n)=>{let o=n.effects.find(a=>a.is(x1));return o&&(s=ls.updateA(s,o.value.doc,n.startState.doc,o.value.changes,r)),n.docChanged&&(s=ls.updateB(s,n.state.field(vo),n.newDoc,n.changes,r)),s}),wi.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?bM:void 0,side:"b"}),vo.init(()=>i),t.gutter!==!1?uM:[],t.collapseUnchanged?rf(t.collapseUnchanged):[],di.init(s=>ls.build(i,s.doc,r))]}const x1=ct.define(),vo=rr.define({create:()=>Ye.empty,update(t,e){for(let i of e.effects)i.is(x1)&&(t=i.value.doc);return t}}),J2=new WeakMap;class F6 extends Qs{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 hM(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(wi),h=document.createElement("div");if(h.className="cm-deletedChunk",c){let D=h.appendChild(document.createElement("div"));D.className="cm-chunkButtons";let M=N=>{N.preventDefault(),dM(o,o.posAtDOM(h))},C=N=>{N.preventDefault(),fM(o,o.posAtDOM(h))};if(typeof c=="function")D.appendChild(c("accept",M)),D.appendChild(c("reject",C));else{let N=D.appendChild(document.createElement("button"));N.name="accept",N.textContent=t.phrase("Accept"),N.onmousedown=M;let W=D.appendChild(document.createElement("button"));W.name="reject",W.textContent=t.phrase("Reject"),W.onmousedown=C}}if(i||e.fromA>=e.toA)return h;let d=o.state.field(vo).sliceString(e.fromA,e.endA),f=l&&t.facet(Tn),p=S(),b=e.changes,_=0,x=!1;function S(){let D=h.appendChild(document.createElement("div"));return D.className="cm-deletedLine",D.appendChild(document.createElement("del"))}function E(D,M,C){for(let N=D;N<M;){if(d.charAt(N)==`
325
+ `){p.firstChild||p.appendChild(document.createElement("br")),p=S(),N++;continue}let W=M,q=C+(x?" cm-deletedText":""),K=!1,V=d.indexOf(`
326
+ `,N);if(V>-1&&V<M&&(W=V),a&&_<b.length){let I=Math.max(0,x?b[_].toA:b[_].fromA);I<=W&&(W=I,x&&_++,K=!0)}if(W>N){let I=document.createTextNode(d.slice(N,W));if(q){let z=p.appendChild(document.createElement("span"));z.className=q,z.appendChild(I)}else p.appendChild(I);N=W}K&&(x=!x)}}if(f&&e.toA-e.fromA<=u){let D=f.parser.parse(d),M=0;v6(D,{style:C=>FD(t,C)},(C,N,W)=>{C>M&&E(M,C,""),E(C,N,W),M=N}),E(M,d.length,"")}else E(0,d.length,"");return p.firstChild||p.appendChild(document.createElement("br")),h},n=We.widget({block:!0,side:-1,widget:new F6(s)});return J2.set(e.changes,n),n}function dM(t,e){let{state:i}=t,r=e??i.selection.main.head,s=t.state.field(di).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(vo);s.fromB!=s.toB&&s.toA<=o.length&&(n+=t.state.lineBreak);let a=Bt.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 fM(t,e){let{state:i}=t,r=e??i.selection.main.head,s=i.field(di).find(a=>a.fromB<=r&&a.endB>=r);if(!s)return!1;let o=i.field(vo).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 Z2(t){let e=new hr;for(let i of t.field(di)){let r=t.facet(wi).overrideChunk&&I6(t,i);e.add(i.fromB,i.fromB,hM(t,i,!!r))}return e.finish()}const pM=rr.define({create:t=>Z2(t),update(t,e){return e.state.field(di,!1)!=e.startState.field(di,!1)?Z2(e.state):t},provide:t=>Ae.decorations.from(t)}),Q2=new WeakMap;function I6(t,e){let i=Q2.get(e);if(i!==void 0)return i;i=null;let r=t.field(vo),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(We.widget({widget:new mM(d),side:-1}).range(c+h.fromB))}h.fromB<h.toB&&a.push(O6.range(c+h.fromB,c+h.toB))}l<e.endA-e.fromA-n*2&&(i=a)}return Q2.set(e,i),i}class mM extends Qs{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 gM=new class extends fr{constructor(){super(...arguments),this.elementClass="cm-inlineChangedLineGutter"}},vM=We.line({class:"cm-inlineChangedLine"});function bM(t,e,i,r){let s=I6(t,e),n=0;if(!s)return!1;for(let o=t.doc.lineAt(e.fromB);;){for(r&&r.add(o.from,o.from,gM),i.add(o.from,o.from,vM);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 Zc(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 z6(e).children}function z6(t){const e=[];for(const r of t.dirs.values()){let s=z6(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 _M(t){const e=String(t||"").split("/"),i=e.pop()||"";return{dir:e.join("/"),name:i,dirSegments:e}}const yM=k0.define([{tag:[Se.keyword,Se.modifier,Se.controlKeyword],color:"var(--magenta)"},{tag:[Se.function(Se.variableName),Se.function(Se.propertyName)],color:"var(--blue)"},{tag:[Se.string,Se.special(Se.string)],color:"var(--green)"},{tag:[Se.comment,Se.lineComment,Se.blockComment],color:"var(--muted)",fontStyle:"italic"},{tag:[Se.number,Se.bool,Se.null],color:"var(--orange)"},{tag:[Se.typeName,Se.className,Se.tagName],color:"var(--yellow)"},{tag:[Se.propertyName,Se.attributeName],color:"var(--cyan)"},{tag:[Se.operator,Se.punctuation],color:"var(--ink)"},{tag:[Se.invalid],color:"var(--red)"}]),wM=Ae.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}),xM=new Set(["js","jsx","mjs","cjs","ts","tsx","mts","cts"]);async function SM(t){const e=(t.split(".").pop()||"").toLowerCase();if(!xM.has(e))return[];try{const{javascript:i}=await Js(async()=>{const{javascript:r}=await import("./index-BmOx7kVX.js");return{javascript:r}},__vite__mapDeps([0,1,2,3,4]),import.meta.url);return i({jsx:e.endsWith("sx"),typescript:e.startsWith("t")||e.startsWith("mt")||e.startsWith("ct")})}catch{return[]}}function kM(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 CM(t){return uD({formatNumber:e=>t[e-1]?String(t[e-1]):""})}function Qc(t,e,i){return[Ve.readOnly.of(!0),Ae.editable.of(!1),CM(t),PD(yM),e,i?Ae.lineWrapping:[],wM]}const Hn=t=>t?`${t.scope}:${t.file.path}`:"",AM=(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)},EM=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 DM({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=He(),p=A.useRef(null),b=A.useRef(null),[_,x]=A.useState(e.patch||""),S=A.useMemo(()=>kM(_),[_]);A.useEffect(()=>{if(!s||_||!e.path)return;let C=!0;return ji(`${Ko(t,"diff")}?scope=${i}&path=${encodeURIComponent(e.path)}`,{cache:"no-store"}).then(N=>N.json()).then(N=>{var q,K,V,I,z;const W=i==="working"?(V=(K=(q=N==null?void 0:N.working)==null?void 0:q.files)==null?void 0:K[0])==null?void 0:V.patch:(z=(I=N==null?void 0:N.files)==null?void 0:I[0])==null?void 0:z.patch;C&&typeof W=="string"&&x(W)}).catch(()=>{}),()=>{C=!1}},[t,e.path,s,_,i]),A.useEffect(()=>{if(!s||!p.current||!_)return;let C=!0;return(async()=>{const W=await SM(e.path);if(!(!C||!p.current))if(n==="split"){const q=new aM({a:{doc:S.oldText,extensions:Qc(S.oldNumbers,W,o)},b:{doc:S.newText,extensions:Qc(S.newNumbers,W,o)},parent:p.current,orientation:"a-b",highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:10,minSize:12},diffConfig:{scanLimit:5e3,timeout:100}});b.current=q,c(e.path,q)}else{const q=new Ae({parent:p.current,state:Ve.create({doc:S.newText,extensions:[...Qc(S.newNumbers,W,o),cM({original:S.oldText,highlightChanges:!0,syntaxHighlightDeletions:!0,mergeControls:!1,collapseUnchanged:{margin:10,minSize:12},diffConfig:{scanLimit:5e3,timeout:100}})]})});b.current=q,c(e.path,q)}})(),()=>{var W;C=!1,(W=b.current)==null||W.destroy(),b.current=null,c(e.path,null)}},[e.path,n,s,S,c,_,o]);const E=C=>{var z,P,j,O,G,$;if(C.button!==0)return;const N=(P=(z=C.target).closest)==null?void 0:P.call(z,".cm-line");if(!N||!((j=p.current)!=null&&j.contains(N)))return;const W=N.closest(".cm-editor"),q=n==="split"?W===((G=(O=b.current)==null?void 0:O.a)==null?void 0:G.dom)?b.current.a:($=b.current)==null?void 0:$.b:b.current;if(!q)return;const K=q.state.doc.lineAt(q.posAtDOM(N,0)).number,I=(n==="split"&&q===b.current.a?S.oldNumbers:S.newNumbers)[K-1];I&&a(I,I)},{dirSegments:D,name:M}=_M(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(j6,{segments:D}),m.jsx("strong",{children:M})]}),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:E}),r.length>0&&m.jsx("div",{className:"diff-comments",children:r.map(C=>m.jsxs("div",{className:`diff-comment${C.sentAt?" sent":""}`,children:[m.jsxs("span",{className:"diff-comment-line",children:["L",C.lineStart,C.lineEnd!==C.lineStart?`-L${C.lineEnd}`:""]}),m.jsx("span",{className:"diff-comment-body",children:C.body}),C.sentAt&&m.jsx(Pe,{name:"check",size:12}),m.jsx(yi,{icon:"pencil",size:12,label:f("session.diffEdit"),onClick:()=>l(C)}),m.jsx(yi,{icon:"trash",size:12,label:f("session.diffRetract"),onClick:()=>u(C)})]},C.id))})]})}function j6({segments:t}){const e=A.useRef(null),[i,r]=A.useState(!1);return A.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 H6({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(A.Fragment,{children:[m.jsxs("button",{type:"button",className:"ft-row ft-dir",style:{paddingLeft:6+e*11},"aria-expanded":h,"data-tip":c,onClick:()=>o(c),children:[m.jsx("span",{className:"ft-caret",children:h?"▾":"▸"}),m.jsx("span",{className:"ft-label",children:l.name.includes("/")?m.jsxs(m.Fragment,{children:[m.jsx(j6,{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(H6,{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},"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 MM({sessionId:t}){var $,ue,Y,X,he;const e=He(),{lang:i}=w4(),r=A.useRef(new Map),[s,n]=A.useState({phase:"loading",data:null,error:null}),[o,a]=A.useState(null),[l,u]=A.useState(""),[c,h]=A.useState("split"),[d,f]=A.useState(!1),[p,b]=A.useState(""),[_,x]=A.useState(()=>new Set),S=A.useCallback((H,ne)=>{ne?r.current.set(H,ne):r.current.delete(H)},[]),E=()=>{n(H=>({...H,phase:"loading"})),ji(Ko(t,"diff"),{cache:"no-store"}).then(async H=>{var pe;const ne=await H.json().catch(()=>({}));if(H.status===409){n({phase:"unavailable",data:null,error:null,detail:(ne==null?void 0:ne.error)||""});return}if(!H.ok)throw new Error((ne==null?void 0:ne.error)||`HTTP ${H.status}`);n({phase:"ready",data:ne,error:null}),b(ce=>AM(ne,ce)?ce:Hn(EM(ne))),x(new Set([...sf(Zc(ne.files||[])),...sf(Zc(((pe=ne.working)==null?void 0:pe.files)||[]))]))}).catch(H=>n({phase:"error",data:null,error:H}))};A.useEffect(()=>(E(),()=>{r.current.clear()}),[t]);const D=(($=s.data)==null?void 0:$.files)||[],M=((Y=(ue=s.data)==null?void 0:ue.working)==null?void 0:Y.files)||[],C=[...D.map(H=>({scope:"branch",file:H})),...M.map(H=>({scope:"working",file:H}))],N=((X=s.data)==null?void 0:X.comments)||[],W=N.filter(H=>!H.sentAt).length,q=C.find(H=>Hn(H)===p)||C[0]||null,K=Math.max(0,C.findIndex(H=>Hn(H)===p)),V=A.useCallback(H=>x(ne=>{const pe=new Set(ne);return pe.delete(H)||pe.add(H),pe}),[]),I=H=>{const ne=H>0?GD:YD,pe=r.current.get(p);pe&&ne(c==="split"?pe.b:pe)||C.length<2||b(Hn(C[(K+H+C.length)%C.length]))},z=async()=>{if(!o||!l.trim())return;const H=C.find(pe=>pe.file.path===o.filePath)||q;if(!H)return;(await ji(Ko(t,"diff-comments"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...o,filePath:o.filePath||H.file.path,body:l,diffIdentity:H.file.diffIdentity})})).ok&&(a(null),u(""),E())},P=async H=>{(await ji(`${Ko(t,"diff-comments")}/${encodeURIComponent(H.id)}`,{method:"DELETE"})).ok&&(a(pe=>(pe==null?void 0:pe.id)===H.id?null:pe),E())},j=async()=>{(await ji(Ko(t,"diff-comments","send"),{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"})).ok&&E()};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:((he=s.error)==null?void 0:he.message)||String(s.error)})});const O=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")}),G=(H,ne)=>ne.length>0&&m.jsxs(A.Fragment,{children:[m.jsx("div",{className:"diff-file-group",children:e(H==="branch"?"session.diffGroupCommitted":"session.diffGroupUncommitted",{n:ne.length})}),m.jsx(H6,{nodes:Zc(ne),depth:0,prefix:"",scope:H,selected:p,openDirs:_,onToggleDir:V,onSelect:b})]},H);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(Pe,{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(H=>!H),children:e("session.diffWrap")}),W>0&&m.jsx("span",{className:"diff-unsent",children:e("session.diffUnsent",{n:W})}),m.jsx(yi,{icon:"send",size:14,label:e("session.diffSend"),disabled:!W,onClick:j})]}),m.jsxs("code",{className:"diff-oids",children:[s.data.head," → ",s.data.base]}),!C.length&&O,C.length>0&&m.jsxs("div",{className:"diff-review-body",children:[m.jsx("nav",{className:"diff-file-panel","aria-label":e("session.diffFiles"),children:[G("branch",D),G("working",M)]}),m.jsxs("div",{className:"diff-files",children:[!D.length&&m.jsx("div",{className:"diff-scope-note",children:O}),q&&m.jsx(DM,{sessionId:t,file:q.file,scope:q.scope,open:!0,mode:c,wrap:d,comments:N.filter(H=>H.filePath===q.file.path),onView:(H,ne)=>S(Hn(q),ne),onNext:()=>I(1),onPrevious:()=>I(-1),onComment:(H,ne)=>{H!=null&&(a({filePath:q.file.path,lineStart:H,lineEnd:ne}),u(""))},onEdit:H=>{a(H),u(H.body)},onRetract:P},`${Hn(q)}:${q.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||(q==null?void 0:q.file.path),":L",o.lineStart]}),m.jsx("textarea",{autoFocus:!0,value:l,onChange:H=>u(H.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:z,children:e("session.diffCommentSave")})]})]})]})}const $6=new Map,S1=t=>$6.get(t)||null;async function TM(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(gi("/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&&($6.set(o.id,o),a.id=o.id,a.session=o),a}catch{return{ok:!1}}}let vn=null,Wl=null;const BM=()=>vn?Promise.resolve(vn):(Wl||(Wl=x4().then(t=>(vn=t,t)).catch(t=>{throw Wl=null,t})),Wl),e4=t=>Array.isArray(t==null?void 0:t.launchers)?t.launchers:[],RM=()=>{try{return localStorage.getItem("si.launcher")||""}catch{return""}},t4=(t,e,i=RM())=>{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 NM(){const t=e4(vn),[e,i]=A.useState(t),[r,s]=A.useState(()=>t4(t,vn==null?void 0:vn.default)),n=o=>{s(o);try{localStorage.setItem("si.launcher",o)}catch{}};return A.useEffect(()=>{BM().then(o=>{const a=e4(o);a.length&&(i(a),s(l=>t4(a,o.default,l)))}).catch(()=>{})},[]),{launchers:e,launcher:r,pickLauncher:n}}function LM(){const[t,e]=A.useState([]);return A.useEffect(()=>{V5().then(i=>{Array.isArray(i)&&e(i)}).catch(()=>{})},[]),t}const qu={merged:{color:"#859900"},active:{color:"#cb4b16"},drift:{color:"#b58900"},pending:{color:"#93a1a1"}},OM={added:"+",edited:"~",deleted:"✕",moved:"→"},BR=["merged","active","drift","pending"];function RR(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 NR(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 i4=["◆","▲","●","■","★","✦","⬟","⬢","❖","◈","✸","⟡","✚","❂","◐","◑","⬣","▰","✶","⬤","✹","◇","⊛","✺"],r4=["circle","rounded","square","hex"];function PM(t){const e=U5(t);return{seed:t,glyph:i4[(e>>>9)%i4.length],shape:r4[(e>>>17)%r4.length],...G5(t)}}function k1({seed:t,status:e,title:i,size:r=16}){const s=PM(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 q6(t){var e;return jr(t)||((e=t==null?void 0:t.id)==null?void 0:e.slice(0,8))||""}function nf({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=He(),h=a?null:i0(t),d=a?c("sessionPicker.newSession"):q6(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(Pe,{name:"plus",size:13})}):m.jsx(k1,{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 FM({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=He(),d=A.useRef(null),[f,p]=A.useState(""),[b,_]=A.useState(0),x=A.useMemo(()=>{const D=f.trim().toLocaleLowerCase(),M=t.filter(C=>!D||[q6(C),A4(C),C.id].some(N=>N==null?void 0:N.toLocaleLowerCase().includes(D)));return s?[...M,{id:"new",__new:!0}]:M},[s,f,t]);A.useEffect(()=>{_(D=>Math.min(D,Math.max(x.length-1,0)))},[x.length]),A.useEffect(()=>{var D;c&&((D=d.current)==null||D.focus())},[c]);const S=D=>{i==null||i(D),D!=="new"&&p("")},E=D=>{if(D.key==="ArrowDown")D.preventDefault(),_(M=>x.length?(M+1)%x.length:0);else if(D.key==="ArrowUp")D.preventDefault(),_(M=>x.length?(M-1+x.length)%x.length:0);else if(D.key==="Enter"){D.preventDefault();const M=x[b];M&&S(M.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:E}),m.jsx("div",{className:"session-picker-list",role:"listbox","aria-label":a||h("sessionPicker.label"),children:x.length?x.map((D,M)=>D.__new?m.jsx(nf,{newSession:!0,active:M===b,selected:e==="new",onPick:S,onOpen:r,onHover:()=>_(M),compact:u},"new"):m.jsx(nf,{session:D,active:M===b,selected:e===D.id,onPick:S,onOpen:r,onHover:()=>_(M),compact:u},D.id)):m.jsx("div",{className:"session-picker-empty",children:h("sessionPicker.empty")})})]})}const IM=/\[\[(\.?[\p{L}\p{N}_-]+)\]\]/gu,W6=t=>(t||"").replace(/^\.spec\//,"").replace(/\/spec\.md$/,"");function zM(t,e,i){const r=e.toLowerCase(),s=[];for(const n of t){const o=n.id.toLowerCase(),a=W6(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 jM(t,e){const i=e.toLowerCase(),r=u=>jr(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 HM(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 ra(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 K6(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 $M(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=K6(i,s);return n.length?{items:n,index:0,start:r,end:e,query:s}:null}const qM=t=>t&&t[0].toUpperCase()+t.slice(1),WM={user:"(user)",project:"(project)",skill:"[skill]","built-in":"built-in",ui:"[ui]",preset:"[preset]",review:"[review]"};function KM({menu:t,up:e,head:i,onPick:r,onHover:s}){const n=He();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:["/",ra(o.name,t.query)]}),m.jsx("span",{className:"slash-desc",children:qM(o.description??o.desc)}),m.jsx("span",{className:`slash-src src-${l}`,children:WM[l]||l})]},`${l}:${o.name}`)})]})}function V6(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=zM(i,n,r);return o.length?{kind:"mention",items:o,index:0,start:s-1,end:e,query:n}:null}return null}function Wu(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=HM(r,n.slice(4));return a.length?{kind:"launcher",items:a,index:0,start:s,end:e,query:n.slice(4)}:null}const o=jM(i,n);return o.length?{kind:"session",items:o,index:0,start:s,end:e,query:n}:null}return null}function U6({menu:t,up:e,fixedStyle:i,onPick:r,onHover:s}){const n=He(),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(nf,{session:u.session,compact:!0,active:c===t.index,onPick:()=>r(u),onHover:()=>s(c),className:"mention-item",name:m.jsxs(m.Fragment,{children:["@",ra(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=qu[u.status])==null?void 0:h.color)||qu.pending.color}}),m.jsx("span",{className:"mention-id",children:o?m.jsxs(m.Fragment,{children:["@new:",ra(u.label,t.query)]}):a?m.jsxs(m.Fragment,{children:["@",ra(u.label,t.query)]}):ra(u.id,t.query)}),m.jsx("span",{className:"mention-path",children:a?u.sub:W6(u.path)})]},u.id)})]})}function LR({inputRef:t,value:e,setValue:i,specs:r=[],sessions:s=[],launchers:n=[],focusId:o=null,up:a=!1,fixedAbove:l=null}){const[u,c]=A.useState(null),[h,d]=A.useState(null),f=A.useRef(null),p=M=>`${M.value}\0${M.selectionStart}`,b=M=>{var I;if(!M){c(null),d(null);return}const C=p(M);if(f.current===C){c(null),d(null);return}f.current=null;const N=M.selectionStart,W=V6(M.value,N,r,o)||Wu(M.value,N,s,n);if(c(W),!W||!l){d(null);return}const q=M.getBoundingClientRect(),K=(I=M.closest(l))==null?void 0:I.getBoundingClientRect(),V=(K==null?void 0:K.top)??q.top;d({left:`${q.left}px`,width:`${q.width}px`,right:"auto",bottom:`${Math.max(8,window.innerHeight-V+8)}px`})};A.useEffect(()=>{const M=t.current;n.length&&M&&document.activeElement===M&&b(M)},[n]);const _=M=>c(C=>C&&{...C,index:(C.index+M+C.items.length)%C.items.length}),x=M=>{if(!M||!u)return;f.current=null;const C=e.slice(0,u.start);if(u.kind==="session"&&M.id==="new"){const q="@new:",K=C+q+e.slice(u.end),V=C.length+q.length;i(K),c(Wu(K,V,s,n)),requestAnimationFrame(()=>{const I=t.current;I&&(I.focus(),I.setSelectionRange(V,V))});return}const N=u.kind==="session"?`@${M.id} `:u.kind==="launcher"?`@new:${M.id} `:`[[${M.id}]] `;i(C+N+e.slice(u.end)),c(null),d(null);const W=C.length+N.length;requestAnimationFrame(()=>{const q=t.current;q&&(q.focus(),q.setSelectionRange(W,W))})};return{menu:u,sync:b,onKeyDown:M=>u?M.key==="ArrowDown"?(M.preventDefault(),M.stopPropagation(),_(1),!0):M.key==="ArrowUp"?(M.preventDefault(),M.stopPropagation(),_(-1),!0):M.key==="Enter"||M.key==="Tab"?(M.preventDefault(),M.stopPropagation(),x(u.items[u.index]),!0):M.key==="Escape"?(M.preventDefault(),M.stopPropagation(),t.current&&(f.current=p(t.current)),c(null),d(null),!0):!1:!1,close:()=>{f.current=null,c(null),d(null)},menuEl:u?m.jsx(U6,{menu:u,up:a,fixedStyle:h,onPick:x,onHover:M=>c(C=>C&&{...C,index:M})}):null}}function OR(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 PR({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 VM=[{id:"claude",label:"Claude Code",Glyph:Y5},{id:"codex",label:"Codex",Glyph:X5},{id:"opencode",label:"opencode",Glyph:J5},{id:"pi",label:"pi",Glyph:Z5}],Kl=Object.fromEntries(VM.map(t=>[t.id,t])),Vl=new Map;async function UM(t){if(Vl.has(t))return Vl.get(t);const e=ji(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(()=>Vl.delete(t));return Vl.set(t,e),e}const FR=t=>{const e=typeof t=="string"&&/^\d+$/.test(t)?Number(t):Number.NaN;return Number.isSafeInteger(e)&&e>0?e:1};function GM(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 IR(t,e,i,{enabled:r=!0,refreshKey:s=null,pollMs:n=15e3,view:o=null}={}){const[a,l]=A.useState(null),[u,c]=A.useState(null),[h,d]=A.useState(r),f=A.useRef(0),p=A.useCallback(async({quiet:_=!1}={})=>{if(!r)return null;const x=++f.current;_||d(!0),c(null);const S=new URLSearchParams({q:String(e||""),page:String(i)});o&&S.set("view",o);try{const E=await UM(`/api/${t}?${S}`);return x===f.current&&l(D=>D&&E&&D.revision===E.revision?D:E),E}catch(E){return x===f.current&&c(E instanceof Error?E.message:String(E)),null}finally{x===f.current&&d(!1)}},[t,r,i,e,o]),b=A.useRef(null);return A.useEffect(()=>{if(!r){d(!1);return}const _=`${t}\0${e}\0${i}\0${o||""}`,x=_!==b.current;b.current=_,x&&l(null),p({quiet:!x});const S=n>0?setInterval(()=>p({quiet:!0}),n):null;return()=>{S&&clearInterval(S)}},[t,e,i,o,r,p,n,s]),{data:a,error:u,loading:h,reload:p}}const Ul=8,s4=t=>[...(t==null?void 0:t.querySelectorAll('[role="menuitem"]:not(:disabled)'))||[]];function C1({x:t,y:e,anchorKey:i,label:r,keyboard:s=!1,children:n}){const o=A.useRef(null),[a,l]=A.useState({left:t,top:e,visibility:"hidden"});A.useLayoutEffect(()=>{var h;const c=(h=o.current)==null?void 0:h.getBoundingClientRect();c&&l({left:Math.max(Ul,Math.min(t,window.innerWidth-c.width-Ul)),top:Math.max(Ul,Math.min(e,window.innerHeight-c.height-Ul)),visibility:"visible"})},[t,e,i]),A.useEffect(()=>{var c;s&&a.visibility==="visible"&&((c=s4(o.current)[0])==null||c.focus())},[s,a.visibility,i]);const u=A.useCallback(c=>{const h=s4(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:ga,children:n})}function Ku({children:t}){return m.jsx("div",{className:"sess-menu-group",role:"group",children:t})}function G6(){return m.jsx("div",{className:"sess-menu-sep",role:"separator"})}function Mi({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(Pe,{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 zR=t=>({kind:"graph-node",nodeId:t}),jR=t=>({kind:"spec",nodeId:t}),HR=t=>({kind:"session",sessionId:t}),$R=t=>({kind:"issue",issueId:t}),qR=(t,e)=>({kind:"review-list",page:t,query:e}),WR=(t,e=null)=>({kind:"eval",nodeId:t,scenario:e}),of=(t,e,i)=>({kind:"session-eval",sessionId:t,nodeId:e,scenario:i}),YM=t=>({kind:"hash",hash:t});function Xa(t){if(!t)return Ut("graph");if(t.kind==="hash")return t.hash;if(t.kind==="graph-node")return Ut("graph",t.nodeId);if(t.kind==="spec")return Ut("spec",t.nodeId);if(t.kind==="session")return Ut("sessions",t.sessionId);if(t.kind==="session-surface")return t.surface==="evals"?Ut("evals",null,{q:bp(t.sessionId)}):Ut("sessions",t.sessionId,{surface:t.surface});if(t.kind==="session-eval"){const e=t.nodeId&&t.scenario?`${t.nodeId}/${t.scenario}`:null;return Ut("evals",e,{q:e?`scope:${t.sessionId}`:bp(t.sessionId)})}return t.kind==="issue"?Ut("issues",t.issueId):t.kind==="review-list"?Ut(t.page,null,t.query?{q:t.query}:null):t.kind==="eval"?t.scenario?Ut("evals",`${t.nodeId}/${t.scenario}`):Ut("evals",null,{q:l_(t.nodeId)}):Ut("graph")}function XM(t){const{page:e,param:i,query:r}=bf(Xa(t));return{page:e,param:i,query:r}}const JM=(t,e=window.location.href)=>new URL(Xa(t),e).href;function ZM(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 QM(t){var e;try{if((e=navigator.clipboard)!=null&&e.writeText)return await navigator.clipboard.writeText(t),!0}catch{}return ZM(t)}const eT=t=>QM(JM(t));function KR(t,e=null){return t==="issues"?Ut("issues"):e?Xa(of(e)):Ut("evals")}function VR(t,{onOpenSession:e}={}){if(t)if(t.kind==="session")e?e(t.sessionId):_n("sessions",t.sessionId);else{const{page:i,param:r,query:s}=bf(Xa(t));_n(i,r,{query:s})}}const n4={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"}}},tT=(t,e)=>{var r;const i=t==="issue"?e==="open"?"open":"closed":e||"empty";return((r=n4[t])==null?void 0:r[i])||n4.eval.empty};function Un({kind:t,state:e,showLabel:i=!1,size:r=16,className:s="",title:n}){const o=He(),a=tT(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(Pe,{name:a.icon,size:r})}),i&&m.jsx("span",{className:"review-state-label",children:l})]})}function UR(t,e){const i={...t,...e};for(const[r,s]of Object.entries(i))(s==null||s==="")&&delete i[r];return i}const iT=t=>t&&typeof t=="object"?t.hasData?t.filtered:t.dataset:t,Y6=(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]},rT=(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}),A1=(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,sT=(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"},eh=t=>[...(t==null?void 0:t.querySelectorAll('[role="menuitemradio"]'))||[]].filter(e=>e.getClientRects().length>0),th=(t,e)=>{const i=t[e];if(i){for(const r of t)r.tabIndex=r===i?0:-1;i.focus()}};function X6(){const[t,e]=A.useState(!1),i=A.useRef(null),r=A.useRef(null),s=A.useRef(null),n=A.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 ui(t,()=>o(!0)),A.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]),A.useEffect(()=>{if(!t)return;const d=requestAnimationFrame(()=>{const f=eh(r.current),p=f.findIndex(_=>_.getAttribute("aria-checked")==="true"),b=n.current==="last"?f.length-1:n.current==="first"?0:p>=0?p:0;th(f,b)});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=eh(r.current),p=f.indexOf(document.activeElement);d.preventDefault(),d.stopPropagation(),th(f,A1(p,f.length,d.key))},onItemFocus:d=>{const f=eh(r.current);th(f,f.indexOf(d.currentTarget))}}}function GR({label:t,value:e="",options:i=[],onChange:r,mobile:s=!1,clearLabel:n}){const o=X6(),a=Y6(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(Pe,{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(Pe,{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 nT({label:t,groups:e=[],clearLabel:i,compact:r=!1,className:s=""}){const n=He(),o=A.useId(),a=e.map(d=>({...d,options:Y6(d.options,d.value,d.clearLabel===null?null:d.clearLabel||i)})).filter(d=>d.options.length),l=a.some(d=>!d.mobileOnly),u=rT(a),c=X6();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(yi,{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(Pe,{name:"filter",size:14}),m.jsx("span",{children:t}),h(u.desktop,"for-desktop"),h(u.mobile,"for-mobile"),m.jsx(Pe,{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(Pe,{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 YR({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 Gl=t=>{const e=String(t??"").trim();return e?`${e} `:""};function oT({value:t="",onSubmit:e,placeholder:i,label:r,keys:s=[],suggest:n={}}){const[o,a]=A.useState(()=>Gl(t)),[l,u]=A.useState(-1),[c,h]=A.useState(-1),d=A.useRef(null),f=A.useRef(null),p=A.useId(),b=A.useRef(null),_=C=>requestAnimationFrame(()=>{const N=d.current;N&&(C&&N.focus(),N.setSelectionRange(N.value.length,N.value.length))});A.useEffect(()=>{a(Gl(t)),u(-1),h(-1),_(b.current!==null&&b.current!==t),b.current=t},[t]);const x=l>=0?u_(o,l,s,n):{start:0,end:0,items:[]},S=x.items.length>0;ui(S,()=>u(-1));const E=()=>{f.current&&d.current&&(f.current.scrollLeft=d.current.scrollLeft)};A.useEffect(E);const D=C=>{u(-1),h(-1);const N=C.trim();a(Gl(N)||Gl(t)),_(!0),e(N)},M=C=>{const N=`${o.slice(0,x.start)}${C.insert}${o.slice(x.end)}`;if(a(N),C.type==="value"){D(N);return}const W=x.start+C.insert.length;u(W),h(-1),requestAnimationFrame(()=>{var q,K;(q=d.current)==null||q.focus(),(K=d.current)==null||K.setSelectionRange(W,W)})};return m.jsxs("form",{className:"rl-query rq",role:"search",onSubmit:C=>{C.preventDefault(),D(o)},children:[m.jsxs("div",{className:"rq-wrap",children:[m.jsx("div",{className:"rq-hl","aria-hidden":"true",ref:f,children:c_(o).map((C,N)=>C.ws||C.key==null||!s.includes(C.key)?m.jsx("span",{children:C.raw},N):m.jsxs("span",{className:"rq-tok",children:[m.jsx("span",{className:"rq-tok-key",children:C.raw.slice(0,C.key.length+1)}),m.jsx("span",{className:"rq-tok-val",children:C.raw.slice(C.key.length+1)})]},N))}),m.jsx("input",{ref:d,role:"combobox","aria-expanded":S,"aria-controls":p,"aria-autocomplete":"list","aria-activedescendant":S&&c>=0?`${p}-o${c}`:void 0,value:o,spellCheck:!1,autoComplete:"off",placeholder:i,"aria-label":r,onChange:C=>{a(C.target.value),u(C.target.selectionStart??C.target.value.length),h(-1)},onScroll:E,onKeyDown:C=>{S&&(C.key==="ArrowDown"||C.key==="ArrowUp"?(C.preventDefault(),h(A1(c,x.items.length,C.key))):C.key==="Enter"&&c>=0&&(C.preventDefault(),M(x.items[c])))},onBlur:()=>u(-1)})]}),S&&m.jsx("div",{className:"rl-menu rq-list",role:"listbox",id:p,"aria-label":r,children:x.items.map((C,N)=>m.jsxs("div",{id:`${p}-o${N}`,role:"option","aria-selected":N===c,className:`rq-opt ${N===c?"active":""}`,onPointerDown:W=>{W.preventDefault(),M(C)},children:[m.jsx("span",{className:"rq-opt-token",children:C.insert.trim()}),C.label&&C.label!==C.value&&m.jsx("span",{className:"rq-opt-label",children:C.label})]},C.insert))}),m.jsx("button",{type:"submit",className:"rl-query-submit","data-tip":r,"aria-label":r,children:m.jsx(Pe,{name:"search",size:16})})]})}function XR({value:t="",onChange:e,placeholder:i,searchLabel:r,filterLabel:s,groups:n,clearLabel:o,clearSearchLabel:a,summary:l,trailing:u=null}){const c=He(),h=m.jsxs("div",{className:"rf-compact",role:"search",children:[m.jsx("span",{className:"rf-search-icon",children:m.jsx(Pe,{name:"search",size:13})}),m.jsx("input",{value:t,onChange:f=>e(f.target.value),placeholder:i,"aria-label":r}),t&&m.jsx(yi,{icon:"x",size:12,className:"rf-clear",label:a,onClick:()=>e("")}),m.jsx(nT,{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 aT({page:t,pageCount:e,prev:i,next:r,hrefFor:s}){const n=He();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"),GM(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 lT({menu:t,onClose:e}){const i=He();if(A.useEffect(()=>{if(t)return window.addEventListener("click",e),window.addEventListener("contextmenu",e,!0),()=>{window.removeEventListener("click",e),window.removeEventListener("contextmenu",e,!0)}},[t,e]),ui(!!t,e),!t)return null;const r=s=>n=>{n.stopPropagation(),e(),s()};return m.jsxs(C1,{x:t.x,y:t.y,anchorKey:t.href,label:i("reviewList.rowMenu"),children:[m.jsx(Mi,{icon:"plus",onClick:r(()=>{const s=d5(t.href);Za(s.page,s.param,s.query)}),children:i("tabs.openInNewTab")}),m.jsx(Mi,{icon:"copy",onClick:r(()=>eT(YM(t.href))),children:i("reviewList.copyAddress")})]})}function JR({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=He(),[b,_]=A.useState(null),[x,S]=A.useState(null),E=A.useId(),D=A.useRef({});D.current={rows:c,cur:b},_f(K=>{if(K.metaKey||K.ctrlKey||K.altKey||!sT(K.target,K.key))return!1;const V=D.current.rows.filter(P=>P.href);if(!V.length)return!1;if(K.key==="Enter"){const P=V.find(j=>j.key===D.current.cur);return P?(K.preventDefault(),window.location.hash=P.href,!0):!1}K.preventDefault();const I=V.findIndex(P=>P.key===D.current.cur),z=I<0?K.key==="j"?0:V.length-1:Math.max(0,Math.min(V.length-1,I+(K.key==="j"?1:-1)));return _(V[z].key),!0}),A.useEffect(()=>{var K;(K=document.querySelector(".lp-row.cur"))==null||K.scrollIntoView({block:"nearest"})},[b]);const M=iT(h),C=Math.max(0,o.findIndex(K=>K.active)),N=a==="tabs",W=`${E}-panel`,q=K=>`${E}-tab-${K}`;return m.jsxs(Jl,{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(oT,{...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:N?"tablist":"group","aria-label":r,...N?{"aria-orientation":"horizontal"}:{},children:o.map((K,V)=>m.jsxs("button",{type:"button",role:N?"tab":void 0,"aria-selected":N?K.active:void 0,"aria-pressed":N?void 0:K.active,"aria-controls":N?W:void 0,id:N?q(V):void 0,tabIndex:N?V===C?0:-1:void 0,className:`rl-section ${K.active?"active":""}`,onClick:K.onSelect,onKeyDown:I=>{var j,O;if(!N||!["ArrowLeft","ArrowRight","Home","End"].includes(I.key))return;const z=[...I.currentTarget.closest('[role="tablist"]').querySelectorAll('[role="tab"]')],P=A1(z.indexOf(I.currentTarget),z.length,I.key);I.preventDefault(),I.stopPropagation(),(j=z[P])==null||j.focus(),(O=z[P])==null||O.click()},children:[m.jsx("span",{children:K.label}),m.jsx("span",{className:"rl-section-count",children:K.count}),K.countSuffix&&m.jsxs("span",{className:"rl-section-suffix","data-tip":K.countSuffix.text,children:[m.jsx("span",{className:"sr-only",children:K.countSuffix.text}),m.jsx("span",{className:"rl-section-suffix-full","aria-hidden":"true",children:K.countSuffix.text}),m.jsx("span",{className:"rl-section-suffix-compact","aria-hidden":"true",children:K.countSuffix.compact})]})]},K.key))}),m.jsxs("div",{className:"rl-facets",children:[l,u]})]}),m.jsxs("div",{className:"lp-rows",role:N?"tabpanel":"region",id:W,"aria-busy":i||void 0,"aria-labelledby":N?q(C):void 0,"aria-label":N?void 0:r,children:[c.length===0&&m.jsx("div",{className:"lp-empty",children:i?p("common.loading"):M}),c.map(K=>m.jsxs("div",{className:`lp-row ${K.href?"":"inert"} ${K.cls||""} ${b===K.key?"cur":""}`,children:[K.href&&m.jsx("a",{className:"lp-row-link",href:K.href,onClick:V=>f5(V,K.href),onContextMenu:V=>{V.preventDefault(),S({x:V.clientX,y:V.clientY,href:K.href})},children:m.jsx("span",{className:"sr-only",children:K.label||K.key})}),K.content]},K.key))]})]}),d&&m.jsx(aT,{...d})]}),f,m.jsx(lT,{menu:x,onClose:()=>S(null)})]})}function ZR({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(Jl,{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(Jl,{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(Jl,{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(Pe,{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 QR({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 eN({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 uT(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 cT(t){const e=uT(t);return e?t.fresh?e==="cross"?"fail":"pass":e==="cross"?"staleFail":"stalePass":"empty"}function hT(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?cT(s):"missing"}})}function dT(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 fT=t=>t.fail>0?"fail":t.staleFail>0?"staleFail":t.stalePass>0?"stalePass":t.empty>0?"empty":"pass";function tN({scenarios:t,evals:e,summary:i=null,href:r}){const s=He(),n=i?null:hT(t,e),o=(i==null?void 0:i.total)??n.length;if(!o)return null;const a=i?fT(i):dT(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(Pe,{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 Wo({kind:t,state:e,cls:i,n:r,label:s}){return m.jsxs("span",{className:`ovc ${i}`,"data-tip":s,children:[m.jsx(Un,{kind:t,state:e,title:s,size:11}),r]})}function iN({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 rN({state:t,title:e}){return t?m.jsx(Un,{kind:"eval",state:t,title:e,className:`score-badge ${t}`,size:14}):null}function o4({label:t,cmd:e}){const i=He(),[r,s]=A.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 pT({session:t,socket:e,onClose:i}){const r=He();if(ui(!!t,i),!t)return null;const s=`spex session attach ${t.id}`,n=`tmux -L ${e} attach -t ${t.id}`;return m.jsx(Yn,{title:r("sessionWindow.attachTitle",{name:jr(t)}),closeLabel:r("common.close"),className:"sess-rename-modal sess-attach-modal",onClose:i,children:m.jsxs("div",{className:"sess-attach",children:[m.jsx(o4,{label:r("sessionWindow.attachSpex"),cmd:s}),m.jsx(o4,{label:r("sessionWindow.attachTmux"),cmd:n})]})})}function mT({menu:t,closeRequest:e=null,onCloseRequestDone:i,onClose:r,onChanged:s,onLock:n,onError:o,onMultiSelect:a,onDetach:l}){const u=He(),[c,h]=A.useState(null),[d,f]=A.useState(null),[p,b]=A.useState(null),[_,x]=A.useState(null),[S,E]=A.useState("spexcode"),[D,M]=A.useState(""),[C,N]=A.useState({adapter:"claude",thread:"",tmux:"",worktree:"",branch:""}),[W,q]=A.useState(!1),K=A.useRef(null);A.useEffect(()=>{x4().then(ce=>{ce!=null&&ce.tmuxSocket&&E(ce.tmuxSocket)}).catch(()=>{})},[]),A.useEffect(()=>{if(!t)return;const ce=ie=>{var _e,qe;(qe=(_e=ie.target)==null?void 0:_e.closest)!=null&&qe.call(_e,'.sess-menu, [aria-haspopup="menu"]')||r()};return window.addEventListener("mousedown",ce,!0),()=>window.removeEventListener("mousedown",ce,!0)},[t,r]),ui(!!t,r),ui(!!c,()=>h(null)),ui(!!d,()=>f(null)),ui(!!p,()=>b(null)),A.useEffect(()=>{c&&requestAnimationFrame(()=>{var ce;return(ce=K.current)==null?void 0:ce.select()})},[c]);const V=ce=>{ce.stopPropagation();const{id:ie}=t.session;r(),Za("sessions",ie)},I=ce=>{ce.stopPropagation(),n==null||n(t.session),r()},z=ce=>{var ie;ce.stopPropagation(),M((((ie=t.session.raw)==null?void 0:ie.name)??t.session.name)||""),h(t.session),r()},P=ce=>{ce.stopPropagation(),a==null||a(t.session),r()},j=ce=>{ce.stopPropagation(),l==null||l(t.session),r()},O=ce=>{ce.stopPropagation(),x(t.session),r()},G=ce=>{ce.stopPropagation();const{id:ie}=t.session;r(),ji(`/api/sessions/${ie}/resume`,{method:"POST"}).then(async _e=>{if(_e.ok)return;const qe=await _e.json().catch(()=>null);o==null||o((qe==null?void 0:qe.error)||`session resume refused (HTTP ${_e.status})`)}).catch(_e=>o==null?void 0:o(_e instanceof Error?_e.message:String(_e))).finally(()=>s==null?void 0:s())},$=ce=>{ce.stopPropagation(),f(t.session),r()},ue=ce=>{ce.stopPropagation();const{id:ie}=t.session;N({adapter:"claude",thread:"",tmux:ie,worktree:"",branch:""}),b(t.session),r()},Y=ce=>ie=>N(_e=>({..._e,[ce]:ie.target.value})),X=async ce=>{if(ce.preventDefault(),!(W||!p)){q(!0);try{const ie=await ji(`/api/sessions/${p.id}/quarantine`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...C,thread:C.thread.trim()||null})}),_e=await ie.json().catch(()=>null);if(!ie.ok||(_e==null?void 0:_e.ok)===!1){o==null||o((_e==null?void 0:_e.error)||`session quarantine refused (HTTP ${ie.status})`);return}b(null)}catch(ie){o==null||o(ie instanceof Error?ie.message:String(ie))}finally{q(!1),s==null||s()}}},he=d||e,H=()=>{f(null),i==null||i()},ne=()=>{const{id:ce}=he;H(),ji(`/api/sessions/${ce}/close`,{method:"POST"}).then(async ie=>{const _e=await ie.json().catch(()=>null);(!ie.ok||(_e==null?void 0:_e.ok)===!1)&&(o==null||o((_e==null?void 0:_e.error)||`session close refused (HTTP ${ie.status})`))}).catch(ie=>o==null?void 0:o(ie instanceof Error?ie.message:String(ie))).finally(()=>s==null?void 0:s())},pe=async ce=>{if(ce.preventDefault(),!W){q(!0);try{const ie=await ji(`/api/sessions/${c.id}/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:D})}),_e=await ie.json().catch(()=>null);(!ie.ok||(_e==null?void 0:_e.ok)===!1)&&(s==null||s())}catch{}finally{q(!1),h(null)}}};return m.jsxs(m.Fragment,{children:[t&&m.jsxs(C1,{x:t.x,y:t.y,anchorKey:t.session.id,label:u("sessionWindow.menuLabel"),children:[m.jsxs(Ku,{children:[m.jsx(Mi,{icon:"plus",onClick:V,children:u("tabs.openInNewTab")}),m.jsx(Mi,{icon:"lock",onClick:I,children:u("sessionWindow.lock")}),m.jsx(Mi,{icon:"pencil",onClick:z,children:u("sessionWindow.rename")}),m.jsx(Mi,{icon:"list-checks",onClick:P,children:u("sessionWindow.select")}),t.session.parent&&m.jsx(Mi,{icon:"corner-up-left",onClick:j,children:u("sessionWindow.detach")}),t.session.liveness!=="offline"&&t.session.status!=="queued"&&m.jsx(Mi,{icon:"terminal",onClick:O,children:u("sessionWindow.attach")}),t.session.archived&&m.jsx(Mi,{icon:"star-filled",onClick:G,children:u("sessionWindow.resume")}),t.session.status==="corrupt"&&m.jsx(Mi,{icon:"archive",onClick:ue,children:u("sessionWindow.quarantine")})]}),m.jsx(G6,{}),m.jsx(Ku,{children:m.jsx(Mi,{icon:"trash",danger:!0,onClick:$,children:u("sessionWindow.close")})})]}),m.jsx(pT,{session:_,socket:S,onClose:()=>x(null)}),c&&m.jsx(Yn,{title:u("sessionWindow.renameTitle",{name:jr(c)}),closeLabel:u("common.close"),className:"sess-rename-modal",onClose:()=>h(null),children:m.jsxs("form",{className:"sess-rename",onSubmit:pe,children:[m.jsx("input",{ref:K,className:"sess-rename-input",value:D,autoFocus:!0,placeholder:u("sessionWindow.renamePlaceholder"),onChange:ce=>M(ce.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:W,children:u("common.save")})]})]})}),he&&m.jsx(Yn,{title:u("sessionWindow.closeTitle",{name:jr(he)}),closeLabel:u("common.close"),className:"sess-rename-modal",onClose:H,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:H,children:u("common.cancel")}),m.jsx("button",{type:"button",className:"sess-rename-btn danger",onClick:ne,autoFocus:!0,children:u("sessionWindow.close")})]})]})}),p&&m.jsx(Yn,{title:u("sessionWindow.quarantineTitle"),closeLabel:u("common.close"),className:"sess-rename-modal",onClose:()=>b(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:C.adapter,onChange:Y("adapter"),autoFocus:!0})]}),m.jsxs("label",{children:[m.jsx("span",{children:u("sessionWindow.quarantineThread")}),m.jsx("input",{className:"sess-rename-input",value:C.thread,onChange:Y("thread")})]}),m.jsxs("label",{children:[m.jsx("span",{children:u("sessionWindow.quarantineTmux")}),m.jsx("input",{className:"sess-rename-input",value:C.tmux,onChange:Y("tmux")})]}),m.jsxs("label",{children:[m.jsx("span",{children:u("sessionWindow.quarantineWorktree")}),m.jsx("input",{className:"sess-rename-input",value:C.worktree,onChange:Y("worktree")})]}),m.jsxs("label",{children:[m.jsx("span",{children:u("sessionWindow.quarantineBranch")}),m.jsx("input",{className:"sess-rename-input",value:C.branch,onChange:Y("branch")})]}),m.jsxs("div",{className:"sess-rename-actions",children:[m.jsx("button",{type:"button",className:"sess-rename-btn",onClick:()=>b(null),children:u("common.cancel")}),m.jsx("button",{type:"submit",className:"sess-rename-btn",disabled:W,children:u("sessionWindow.quarantineConfirm")})]})]})})]})}const gT=({size:t=12})=>m.jsx(Pe,{name:"lock",size:t});function vT(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])=>`${OM[i]}${r}`).join(" ")}function bT({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 _T({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 a4({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(bT,{guides:t.guides,expandable:t.expandable,kin:t.kin}):null,p=t.expandable?{expanded:t.expanded,rollup:t.rollup,kin:t.kin}:null,b=`sess-tree-row si-tree-row${s?" dragging":""}${n?" drop-target":""}${l?" si-session-drag-ghost":""}`,_=`si-item${h&&!i?" on":""}${d?" picked":""}`,x=m.jsx(m.Fragment,{children:m.jsx(yT,{s:c,locked:!1,showAvatar:!1,lead:f})}),S={"--ov":Q5(c.id),"--sess-fold-indent":`${t.depth*14}px`,...u};return m.jsxs("div",{className:b,"data-session-depth":t.depth,style:S,...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"}),x]}),p&&m.jsx(_T,{...p,inert:l,onToggle:o})]})}function sN(){const[t,e]=A.useState(()=>new Set),i=s=>e(n=>{const o=new Set(n);return o.has(s)?o.delete(s):o.add(s),o}),r=A.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 yT({s:t,locked:e,showAvatar:i=!0,lead:r=null}){const s=He(),n=vT(t.ops),o=i0(t),a=jr(t),l=s(`status.${o.status}`);return m.jsxs(m.Fragment,{children:[r,i&&m.jsx(k1,{seed:t.id,status:o.status,title:`${A4(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(Pe,{name:"issue-opened",size:13})}),e&&m.jsx("span",{className:"sess-lock","data-tip":s("sessionWindow.lockedTitle"),children:m.jsx(gT,{})})]})}function wT({item:t,baseClass:e,onToggle:i}){const r=He(),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 nN({sessions:t=[],activeId:e=null,onPick:i,onOpenSession:r,onNew:s}){const n=He(),[o,a]=A.useState(!1);ui(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(k1,{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(FM,{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 cr={expanded:new Set,offlineOpen:!1};const af=new Set,E1=t=>{cr=t,af.forEach(e=>e())},xT=t=>(af.add(t),()=>af.delete(t)),J6=()=>A.useSyncExternalStore(xT,()=>cr,()=>cr),ih=t=>{if(!t)return;const e=new Set(cr.expanded);e.has(t)?e.delete(t):e.add(t),E1({...cr,expanded:e})},ST=(t=[])=>{const e=new Set(cr.expanded);t.filter(Boolean).forEach(i=>e.add(i)),!(e.size===cr.expanded.size&&[...e].every(i=>cr.expanded.has(i)))&&E1({...cr,expanded:e})},kT=t=>{const e=!!t;e!==cr.offlineOpen&&E1({...cr,offlineOpen:e})};function CT({ids:t,onCancel:e,onClosed:i,onError:r}){const s=He(),[n,o]=A.useState(!1);ui(n,()=>o(!1));const a=()=>{o(!1),Promise.all(t.map(l=>ji(`/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(yi,{icon:"trash",size:14,className:"si-selaction danger",label:s("sessionSelect.close"),disabled:!t.length,onClick:()=>o(!0)}),m.jsx(yi,{icon:"x",size:14,className:"si-selaction",label:s("common.cancel"),onClick:e})]}),n&&m.jsx(Yn,{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 AT=6,l4="is-dragging";function u4(){const t=e=>{e.stopPropagation(),e.preventDefault()};window.addEventListener("click",t,!0),window.setTimeout(()=>window.removeEventListener("click",t,!0),0)}function lf(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 Z6(t,{threshold:e=AT,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(l4)},u=()=>{const f=a;l(),a=!1,f&&(u4(),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(l4),i==null||i(p)}r==null||r(p)}function h(f){const p=a;l(),a=!1,p&&(u4(),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 ET(t,e,{min:i,max:r,dir:s=1}={}){const[n,o]=A.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=A.useRef(null),l=A.useCallback(c=>{c.preventDefault(),a.current={x:c.clientX,w:n};const h=f=>{const p=a.current;if(!p)return;const b=Math.max(i,Math.min(r,p.w+(f.clientX-p.x)*s));o(b)},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=A.useCallback(()=>{o(e);try{localStorage.removeItem(t)}catch{}},[e,t]);return[n,l,u]}const ma={key:"spex.dockWidth",initial:204,min:180,max:460},c4=["spex.ftWidth","spex.siListWidth"];try{if(localStorage.getItem(ma.key)==null)for(const t of c4){const e=parseInt(localStorage.getItem(t),10);if(Number.isFinite(e)){localStorage.setItem(ma.key,String(e));break}}c4.forEach(t=>localStorage.removeItem(t))}catch{}function DT(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 rh=.75;function MT({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=He(),{expanded:p,offlineOpen:b}=J6(),[_,x]=A.useState(!1),[S,E]=A.useState(()=>new Set),[D,M]=A.useState(null),C=A.useRef(null),N=A.useRef(null),[W,q,K]=ET(ma.key,ma.initial,ma),V=A.useMemo(()=>Nf(t,Y=>p.has(Y),{zoneFolded:Y=>Y==="offline"&&!b,keepVisible:Y=>Y.id===e}),[t,p,b,e]);_f(Y=>{const X=DT(V,e,Y);if(!X)return!1;if(Y.preventDefault(),Y.stopPropagation(),X.type==="move")n==null||n(X.id);else if(X.type==="expand"){const he=V.find(H=>H.type==="row"&&H.s.id===X.id);he&&!he.expanded&&ih(X.id)}else if(X.type==="collapse"){const he=V.find(H=>H.type==="row"&&H.s.id===X.id);he!=null&&he.expanded&&ih(X.id)}return!0},30);const I=A.useCallback(async(Y,X)=>{const he=t.find(H=>H.id===Y);if(!(!he||(he.parent||null)===X))try{const H=await ji("/api/sessions/reparent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({children:[Y],parent:X})}),ne=await H.json().catch(()=>null);if(!H.ok||(ne==null?void 0:ne.ok)===!1)throw new Error((ne==null?void 0:ne.error)||`session parent update refused (HTTP ${H.status})`);X&&ST([X]),l==null||l()}catch(H){c==null||c(H instanceof Error?H.message:String(H))}},[t,l,c]),z=A.useCallback((Y,X)=>{const he=lf(Y.x,Y.y,"[data-session-drop-id]");if(he){const H=he.dataset.sessionDropId;return H===X.id||H===X.parent||G7(t,H).includes(X.id)?void 0:H}return X.parent&&lf(Y.x,Y.y,"[data-session-root-drop]")?null:void 0},[t]),P=A.useCallback((Y,X)=>{if(Y.button!==0||_)return;const H=Y.currentTarget.getBoundingClientRect(),ne={id:X.id,parent:X.parent||null,width:H.width,height:H.height,offsetX:Y.clientX-H.left,offsetY:Y.clientY-H.top,x:Y.clientX,y:Y.clientY,target:void 0,started:!1},pe=ie=>{ne.x=ie.x,ne.y=ie.y,ne.target=z(ie,ne),M({...ne})},ce=()=>{document.body.classList.remove("is-session-dragging"),M(null),C.current=null};C.current=Z6(Y,{onStart:ie=>{ne.started=!0,document.body.classList.add("is-session-dragging"),pe(ie)},onMove:pe,onDrop:ie=>{const _e=z(ie,ne);ce(),_e!==void 0&&I(ne.id,_e)},onCancel:ce})},[I,z,_]);A.useEffect(()=>()=>{var Y;return(Y=C.current)==null?void 0:Y.call(C)},[]),A.useEffect(()=>{h&&(x(!0),E(new Set([h.id])),d==null||d())},[h,d]);const j=()=>{x(!1),E(new Set)},O=Y=>E(X=>{const he=new Set(X);return he.has(Y)?he.delete(Y):he.add(Y),he}),G=()=>{j(),l==null||l()},$=D?V.find(Y=>Y.type==="row"&&Y.s.id===D.id):null,ue=!!(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:N,style:{width:W},onMouseDownCapture:ga,"aria-hidden":r?"true":void 0,children:[_?m.jsx(CT,{ids:[...S],onCancel:j,onClosed:G,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(Pe,{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(Pe,{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(Pe,{name:"search",size:14})})})]}),m.jsxs("div",{className:"si-session-scroll","data-session-scroll":!0,children:[ue&&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(Pe,{name:"corner-up-left",size:14}),m.jsx("span",{children:f("session.rootDrop")})]}),V.map(Y=>{var he;if(Y.type==="zone")return m.jsx(wT,{item:Y,baseClass:"si-zone",onToggle:()=>Y.zone==="offline"?kT(!b):void 0},`zone-${Y.zone}`);const X=Y.s;return _&&S.has(X.id),m.jsx(a4,{item:Y,activeId:e,selecting:_,picked:S,dragging:(D==null?void 0:D.id)===X.id,dropTarget:(D==null?void 0:D.target)===X.id,onToggleFold:()=>ih(X.id),rowProps:{"data-sid":X.id,"aria-grabbed":(D==null?void 0:D.id)===X.id||void 0,onMouseDown:H=>P(H,X),onClick:H=>_?O(X.id):n==null?void 0:n(X.id,{hold:h5(H)}),onDoubleClick:()=>{_||n==null||n(X.id,{hold:!0})},onContextMenu:H=>{H.preventDefault(),H.stopPropagation(),_||u==null||u({x:H.clientX,y:H.clientY,session:X})},"data-tip":(he=X.ops)!=null&&he.length?f("session.opsTitle"):f("session.lockTitle")}},X.id)})]}),$&&m.jsx(a4,{item:$,activeId:e,selecting:_,picked:S,inert:!0,style:{width:D.width,"--si-session-drag-ghost-scale":rh,left:D.x-D.offsetX*rh,top:D.y-D.offsetY*rh}})]}),m.jsx("div",{className:"si-resizer",onMouseDownCapture:ga,onMouseDown:q,onDoubleClick:K,role:"separator","aria-orientation":"vertical","aria-label":f("session.resizeList")})]})}const TT=[{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 h4(t,e={}){return t!=null&&t.archived?[]:TT.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 BT(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 pn="terminal",Qr="conversation",sa="diff",Vu="resource:",RT="spexcode.session-surface.v1",NT=new Set([pn,Qr]),uf=new Set;let Q6=null;const e5=(t=e_)=>`${RT}.${t||"root"}`,cf=()=>({defaultSurface:pn,sessions:{}}),Uu=t=>NT.has(t),Ia=t=>typeof t=="string"&&t.startsWith(Vu)&&t.length>Vu.length,LT=t=>Uu(t)||t===sa||Ia(t),hf=t=>Ia(t)?t.slice(Vu.length):null,d4=t=>`${Vu}${t}`,Ls=(t,e,i)=>`${t}:${e}:${i}`;function OT(t){const e=cf();return!t||typeof t!="object"||(Uu(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])=>Uu(i))))),e}function A0(){try{const t=localStorage.getItem(e5());return t?OT(JSON.parse(t)):cf()}catch{return Q6||cf()}}function t5(t){Q6=t;try{localStorage.setItem(e5(),JSON.stringify(t))}catch{}for(const e of uf)e(t);return t}function i5(t){if(!Uu(t))throw new Error(`Invalid session base surface: ${t}`);return t}function oN(){return A0().defaultSurface}function Yl(t){const e=A0();return e.sessions[t]||e.defaultSurface}function aN(t){const e=A0();return t5({...e,defaultSurface:i5(t)}).defaultSurface}function PT(t,e){if(!t)throw new Error("A session id is required to set its base surface");const i=A0();return t5({...i,sessions:{...i.sessions,[t]:i5(e)}}).sessions[t]}function FT(t){return uf.add(t),()=>uf.delete(t)}const r5=[{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.tabHold",keys:["Alt+Shift+KeyP"],rebind:!1,desc:"legend.shell.tabHold"},{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"}],IT={ArrowUp:"↑",ArrowDown:"↓",ArrowLeft:"←",ArrowRight:"→",Enter:"⏎",Escape:"esc"," ":"␣","-":"−"},zT={Alt:"⌥",Ctrl:"⌃",Meta:"⌘",Shift:"⇧"},jT={Slash:"/",Backslash:"\\",Comma:",",Period:".",Semicolon:";",Quote:"'",Backquote:"`",Minus:"−",Equal:"=",BracketLeft:"[",BracketRight:"]",Space:"␣"},f4=t=>IT[t]||jT[t]||t.replace(/^Key([A-Z])$/,"$1").replace(/^Digit(\d)$/,"$1"),HT=t=>{if(typeof t!="string"||!t)return"";if(!t.includes("+"))return f4(t);const e=t.split("+"),i=e.pop();return e.map(r=>zT[r]||`${r}+`).join("")+f4(i)},$T=Object.fromEntries(r5.map(t=>[t.id,t])),lN=t=>{var e;return((e=$T[t])==null?void 0:e.sequence)||[]},qT=(t,e=null)=>t!=null&&t.rebind?e||t.keys||[]:t!=null&&t.sequence?[t.sequence.join("")]:(t==null?void 0:t.keys)||[],D1="spex.keybindings.v1",s5=Object.fromEntries(r5.map(t=>[t.id,t]));function WT(){try{return JSON.parse(localStorage.getItem(D1))||{}}catch{return{}}}let bn=WT();function M1(t){var i;const e=bn[t];return e&&e.keys||((i=s5[t])==null?void 0:i.keys)||[]}function uN(t){return!!bn[t]}function KT(t,e){return M1(t).includes(e)}function VT(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 UT(t,e){return M1(t).includes(VT(e))||!e.altKey&&!e.ctrlKey&&!e.metaKey&&KT(t,e.key)}function GT(...t){const e=[];for(const i of t){const r=HT(qT(s5[i],M1(i))[0]);r&&!e.includes(r)&&e.push(r)}return e.join(" · ")}function YT(t,...e){const i=GT(...e);return i?`${t} (${i})`:t}function cN(t,e){bn={...bn,[t]:{...bn[t],...e}},localStorage.setItem(D1,JSON.stringify(bn))}function hN(){bn={},localStorage.removeItem(D1)}const XT=/<!-- spexcode-selection (\{.*?\}) -->/g,T1=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 JT(t){if(!T1(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 ZT(t){const e=typeof t=="string"?t:"",i=[];return{text:e.replace(XT,(s,n)=>{try{const o=JSON.parse(n);if(T1(o))i.push(o);else return s}catch{return s}return""}).replace(/\n{3,}/g,`
330
+
331
+ `).trim(),selections:i}}function QT(t,e=[]){const i=typeof t=="string"?t.trim():"",r=e.filter(T1).map(JT);return[i,...r].filter(Boolean).join(`
332
+
333
+ `)}function eB({selection:t,onRemove:e=null,className:i=""}){const r=He();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(Pe,{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(yi,{icon:"x",size:12,className:"selection-attachment-remove",label:r("session.removeCodeSelection"),onClick:e})]})}const tB=t=>{try{const e=new URL(t);return`${e.hostname.replace(/^\[|\]$/g,"")}:${e.port}${e.pathname==="/"?"":e.pathname}`}catch{return t}},iB=t=>{const e=String(t||"").indexOf("/");return e>0?{node:t.slice(0,e),scenario:t.slice(e+1)}:{node:t||"",scenario:""}};function df(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))}))||S1(t.param),u=l?jr(l):t.param.slice(0,8),c=(a=t.query)==null?void 0:a.surface;if(Ia(c)){const h=hf(c),d=[...((l==null?void 0:l.files)||[]).map(f=>({id:Ls(l.id,"file",f),label:f.split("/").filter(Boolean).pop()||f})),...((l==null?void 0:l.web)||[]).map(f=>({id:Ls(l.id,"web",f.key),label:tB(f.url)}))].find(f=>f.id===h);return(d==null?void 0:d.label)||h}return u}return s(`tabs.${t.page}`)}function rB({tab:t,specs:e,sessions:i}){const r=t.page==="spec"?t.param:t.page==="evals"&&t.param?iB(t.param).node:null;if(r){const s=e==null?void 0:e.find(n=>n.id===r);return!s||!qu[s.status]?null:m.jsx("i",{className:"tab-dot",style:{background:qu[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))}))||S1(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&&or[s.status];return n?m.jsx("i",{className:"tab-dot",style:{background:n}}):null}return null}function sB({tab:t}){const e=UB(t.page)?VB(t.page):null;return e?m.jsx(Pe,{name:e,size:13,className:"tab-kind-icon"}):null}function nB(t,e){const{page:i,param:r}=t||{};return i==="spec"||i==="file"||i==="sessions"&&r||(i==="evals"||i==="issues")&&r?df(t,e):e.t(`place.${i}`)}function oB({specs:t,sessions:e,route:i,trailing:r=null,onSessionContextMenu:s=null}){const n=He(),[o,a]=A.useState([]),[l,u]=A.useState(!1),c=A.useRef(null),h=A.useCallback(O=>{var ue;const G=Ge(O);a(Y=>{if(Y.some(he=>he.key===G))return Y;const X=d.current.findIndex(he=>Ge(he)===G);return[...Y,{key:G,tab:O,index:X}]});const $=(ue=window.matchMedia)!=null&&ue.call(window,"(prefers-reduced-motion: reduce)").matches?0:150;window.setTimeout(()=>a(Y=>Y.filter(X=>X.key!==G)),$)},[]),d=A.useRef([]),{tabs:f,activeKey:p,open:b,close:_,closeOthers:x,move:S}=p5({onCloseStart:h});d.current=f,A.useEffect(()=>{const O=c.current;if(!O||typeof ResizeObserver>"u")return;const G=()=>{const ue=f.length*80>O.clientWidth;u(Y=>Y===ue?Y:ue)};G();const $=new ResizeObserver(G);return $.observe(O),()=>$.disconnect()},[f.length]);const E=t_(),{splitTo:D}=yf(),M=i_(),[C,N]=A.useState(null),[W,q]=A.useState(null),K=A.useRef(null);A.useEffect(()=>()=>{var O;return(O=K.current)==null?void 0:O.call(K)},[]),A.useEffect(()=>{if(!W)return;const O=G=>{var $,ue;(ue=($=G.target)==null?void 0:$.closest)!=null&&ue.call($,".sess-menu")||q(null)};return window.addEventListener("click",O),window.addEventListener("contextmenu",O,!0),()=>{window.removeEventListener("click",O),window.removeEventListener("contextmenu",O,!0)}},[W]),ui(!!W,()=>q(null));const V=(O,G)=>{const $=d.current,ue=lf(O.x,O.y,".tab");if(ue){const H=$.findIndex(ie=>Ge(ie)===ue.dataset.tabKey);if(H<0)return;const ne=ue.getBoundingClientRect(),ce=O.x>ne.left+ne.width/2?$[H+1]?Ge($[H+1]):null:ue.dataset.tabKey;return mf($,G,ce)===$?void 0:ce}const Y=c.current;if(!Y||!$.length)return;const X=Y.getBoundingClientRect();if(O.x<X.left||O.x>X.right||O.y<X.top||O.y>X.bottom)return;const he=Math.max(...[...Y.querySelectorAll(".tab")].map(H=>H.getBoundingClientRect().right));if(!(O.x<he))return mf($,G,null)===$?void 0:null},I=(O,G)=>{const $=Ge(G),ue=Y=>{const X=V(Y,$);X!==void 0&&S($,X),N(he=>he&&he.key===$&&he.before===X?he:{key:$,before:X})};K.current=Z6(O,{onStart:ue,onMove:ue,onDrop:Y=>{const X=V(Y,$);N(null),K.current=null,X!==void 0&&S($,X)},onCancel:()=>{N(null),K.current=null}})},z=Ut(i.page,i.param,i.query),P=[...M.values()].filter(O=>O.document===z).sort((O,G)=>(G.priority??0)-(O.priority??0)||O.id.localeCompare(G.id)),j=[...f];return o.filter(O=>!f.some(G=>Ge(G)===O.key)).sort((O,G)=>O.index-G.index).forEach(O=>j.splice(Math.max(0,Math.min(O.index,j.length)),0,O.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:nB(i,{specs:t,sessions:e,names:E,t:n})}),j.map((O,G)=>{const $=Ge(O),ue=o.some(H=>H.key===$)&&!f.some(H=>Ge(H)===$),Y=$===p,X=df(O,{specs:t,sessions:e,names:E,t:n}),he=`${(C==null?void 0:C.key)===$?" tab-moving":""}${(C==null?void 0:C.before)===$?" tab-drop-before":""}${C&&C.before===null&&G===f.length-1?" tab-drop-after":""}`;return m.jsxs("div",{"data-tab-key":$,className:`tab${Y?" on":""}${O.pinned?"":" slot"}${ue?" tab-closing":""}${he}`,role:"tab","aria-selected":Y,"aria-grabbed":(C==null?void 0:C.key)===$||void 0,"aria-hidden":ue?"true":void 0,onMouseDown:H=>{ue||I(H,O)},onDoubleClick:H=>{!O.pinned&&!H.target.closest(".tab-x")&&Za(O.page,O.param,O.query)},onContextMenu:H=>{if(ue)return;H.preventDefault();const ne=O.page==="sessions"&&O.param&&O.param!=="new"?(e==null?void 0:e.find(pe=>{var ce;return pe.id===O.param||((ce=pe.id)==null?void 0:ce.startsWith(O.param))}))||S1(O.param):null;ne&&s?(q(null),s({x:H.clientX,y:H.clientY,session:ne})):q({x:H.clientX,y:H.clientY,tab:O,key:$})},onAuxClick:H=>{!ue&&H.button===1&&(H.preventDefault(),_(O))},children:[m.jsxs("button",{type:"button",className:"tab-face","data-tip":X,"aria-label":X,onClick:H=>{ue||(H.altKey?D(O):b(O))},children:[m.jsx(sB,{tab:O}),m.jsx(rB,{tab:O,specs:t,sessions:e}),m.jsx("span",{className:"tab-label",children:X})]}),m.jsx("button",{type:"button",className:"tab-x",onClick:()=>{ue||_(O)},"aria-label":n("tabs.close"),children:m.jsx(Pe,{name:"x",size:11})})]},$)})]}),(P.length>0||r)&&m.jsxs("div",{className:"tabstrip-actions",role:"toolbar","aria-label":n("documentActions.aria"),children:[P.map(O=>{const G=O.disabled&&O.disabledReason||O.label;return m.jsxs("div",{className:"document-action",children:[O.node||m.jsx(yi,{icon:O.icon,size:14,label:G,className:`document-action-button${O.pressed?" on":""}${O.disabled?" disabled":""}`,"data-action":O.id,"aria-pressed":O.pressed,"aria-haspopup":O.haspopup?"menu":void 0,disabled:O.disabled,onClick:O.onClick}),O.menu]},O.key||`${O.document}:${O.id}`)}),r]}),W&&m.jsxs(C1,{x:W.x,y:W.y,anchorKey:W.key,label:n("tabs.menuLabel"),children:[m.jsxs(Ku,{children:[m.jsx(Mi,{icon:"x",danger:!0,onClick:O=>{O.stopPropagation(),q(null),_(W.tab)},children:n("tabs.menuClose")}),m.jsx(Mi,{icon:"circle-minus",danger:!0,onClick:O=>{O.stopPropagation(),q(null),x(W.tab)},children:n("tabs.menuCloseOthers")})]}),m.jsx(G6,{}),m.jsx(Ku,{children:m.jsx(Mi,{icon:"panel-right",onClick:O=>{O.stopPropagation(),q(null),D(W.tab)},children:n("tabs.menuSplit")})})]})]})}const aB=170;function lB(t,e=aB){const[i,r]=A.useState(!1),[s,n]=A.useState(!1),o=A.useRef(t);return A.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 ln=t=>{var e;return((e=t==null?void 0:t.capabilities)==null?void 0:e.headless)===!0},sh=t=>!(t!=null&&t.archived)&&(t==null?void 0:t.liveness)==="online",Gu=t=>{if(typeof(t==null?void 0:t.closedAt)!="string")return null;const e=Date.parse(t.closedAt);return Number.isFinite(e)?e:null},p4=t=>[...t].sort((e,i)=>{const r=Gu(e),s=Gu(i);return r==null&&s==null?e.id.localeCompare(i.id):r==null?1:s==null?-1:s-r||e.id.localeCompare(i.id)}),nh=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 uB({sessions:t,onOpenSession:e,onClose:i}){const{lang:r,t:s}=w4(),[n,o]=A.useState(""),a=A.useRef(null),l=A.useRef([]);ui(!0,i);const u=A.useMemo(()=>{const S=n.trim().toLocaleLowerCase(r);return S?t.filter(E=>[jr(E),E.label,E.id,E.node].filter(Boolean).some(D=>String(D).toLocaleLowerCase(r).includes(S))):t},[t,n,r]),c=A.useMemo(()=>{const S=[];for(const E of u){const D=nh(Gu(E)),M=S[S.length-1];(M==null?void 0:M.key)===D?M.rows.push(E):S.push({key:D,rows:[E]})}return S},[u]),h=nh(Date.now()),d=new Date;d.setDate(d.getDate()-1);const f=nh(d),p=S=>S==="unknown"?s("session.archiveUnknownDate"):S===h?s("session.archiveToday"):S===f?s("session.archiveYesterday"):new Intl.DateTimeFormat(r,{year:"numeric",month:"long",day:"numeric"}).format(new Date(`${S}T12:00:00`)),b=S=>{const E=Gu(S);return E==null?"":new Intl.DateTimeFormat(r,{hour:"2-digit",minute:"2-digit"}).format(E)},_=c.flatMap(S=>S.rows);A.useEffect(()=>{var S;(S=a.current)==null||S.focus()},[]);const x=S=>{var M;if(S.key!=="ArrowDown"&&S.key!=="ArrowUp")return;S.preventDefault();const E=l.current.findIndex(C=>C===document.activeElement),D=Math.max(0,Math.min(_.length-1,E+(S.key==="ArrowDown"?1:-1)));(M=l.current[D])==null||M.focus()};return m.jsx("div",{className:"si-archive-backdrop","data-archive-backdrop":!0,onKeyDown:x,onMouseDown:S=>{S.target===S.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(Pe,{name:"search",size:15}),m.jsx("input",{ref:a,value:n,onChange:S=>o(S.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(S=>m.jsxs("section",{className:"si-archive-group","data-archive-day":S.key,children:[m.jsx("h2",{className:"si-archive-date",children:p(S.key)}),S.rows.map(E=>m.jsxs("button",{ref:D=>{l.current[_.indexOf(E)]=D},type:"button",className:"si-archive-page-row","data-sid":E.id,onClick:()=>e(E.id),children:[m.jsx("span",{className:"si-archive-row-title",children:jr(E)}),m.jsx("span",{className:"si-archive-row-node",children:E.node||E.label}),m.jsx("time",{dateTime:E.closedAt||void 0,children:b(E)}),m.jsx(Pe,{name:"chevron-right",size:14})]},E.id))]},S.key))]})]})})}const cB=()=>m.jsx(Pe,{name:"paperclip",size:15}),hB=()=>m.jsx(Pe,{name:"loader",size:15,className:"si-attach-busy"}),Xl=1,ff=1024,dB=1024,fB=1024,pf=ff*dB,m4=pf*fB;let pB=0;const mB=()=>{var t,e;return((e=(t=globalThis.crypto)==null?void 0:t.randomUUID)==null?void 0:e.call(t))||`attachment-${Date.now()}-${++pB}`},gB=["███████╗██████╗ ███████╗██╗ ██╗ ██████╗ ██████╗ ██████╗ ███████╗","██╔════╝██╔══██╗██╔════╝╚██╗██╔╝██╔════╝██╔═══██╗██╔══██╗██╔════╝","███████╗██████╔╝█████╗ ╚███╔╝ ██║ ██║ ██║██║ ██║█████╗ ","╚════██║██╔═══╝ ██╔══╝ ██╔██╗ ██║ ██║ ██║██║ ██║██╔══╝ ","███████║██║ ███████╗██╔╝ ██╗╚██████╗╚██████╔╝██████╔╝███████╗","╚══════╝╚═╝ ╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝"].join(`
334
+ `);function n5(){return m.jsx("pre",{className:"si-hero","aria-label":"SpexCode",children:gB})}function g4({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 Yu=t=>t.split("/").filter(Boolean).pop()||t,vB=t=>/\.(?:md|markdown)$/i.test(t);function bB({path:t,text:e}){return vB(t)?m.jsx(Vv,{className:"si-file-markdown",children:e}):m.jsx("pre",{className:"si-file-text",children:e})}function _B({path:t,html:e}){return m.jsx("iframe",{className:"si-file-html",srcDoc:e,title:Yu(t)})}const oh=t=>{try{const e=new URL(t);return`${e.hostname.replace(/^\[|\]$/g,"")}:${e.port}${e.pathname==="/"?"":e.pathname}`}catch{return t}},yB=(t,e)=>`${o_}/web/${encodeURIComponent(t)}/${encodeURIComponent(e)}/`;function wB({options:t,onOpen:e}){const i=He();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(Pe,{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 xB({document:t,action:e}){return n_(t,e),null}function SB({document:t,actions:e}){return e.map(i=>m.jsx(xB,{document:t,action:i},i.id))}function kB({tab:t,active:e=!1,focusRequest:i=0,onEscape:r}){const s=He(),[n,o]=A.useState({phase:"loading"}),a=A.useRef(null),l=A.useRef(e),u=A.useRef(r);return l.current=e,u.current=r,A.useEffect(()=>{if(t.kind!=="file")return;let c=!1,h=null;const d=gi(`/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 b=await f.json().catch(()=>null);throw new Error((b==null?void 0:b.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 b=await f.text();c||o({phase:p==="html"?"html":"text",text:b})}}).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]),A.useEffect(()=>{if(t.kind!=="web")return;const c=a.current;if(!c)return;let h=null;const d=b=>{var E;if(!(b.key==="Escape"||b.altKey&&!b.metaKey&&!b.ctrlKey))return;const x=new KeyboardEvent("keydown",{key:b.key,code:b.code,altKey:b.altKey,ctrlKey:b.ctrlKey,metaKey:b.metaKey,shiftKey:b.shiftKey,bubbles:!0,cancelable:!0}),S=!window.dispatchEvent(x);b.key==="Escape"?(b.preventDefault(),S||(E=u.current)==null||E.call(u)):S&&b.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 b;return(b=c.contentWindow)==null?void 0:b.focus()})};return c.addEventListener("load",p),f(),()=>{c.removeEventListener("load",p),h==null||h.removeEventListener("keydown",d,!0)}},[t.kind,t.revision]),A.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:yB(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(Pe,{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(bB,{path:t.value,text:n.text}),n.phase==="html"&&m.jsx(_B,{path:t.value,html:n.text}),n.phase==="image"&&m.jsx("img",{src:n.url,alt:Yu(t.value)})]})}function o5(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 CB({summary:t}){const e=He(),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(Pe,{name:"loader",size:12,className:"si-eval-spinner"})}):!i&&t.phase==="dormant"?m.jsx("span",{className:"si-eval-wait",children:m.jsx(Un,{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(Wo,{kind:"eval",state:"pass",cls:"st-pass secondary",n:t.pass,label:e("session.evalPass",{n:t.pass})}),t.fail>0&&m.jsx(Wo,{kind:"eval",state:"fail",cls:"st-fail secondary",n:t.fail,label:e("session.evalFail",{n:t.fail})}),t.review>0&&m.jsx(Wo,{kind:"eval",state:"review",cls:"st-review secondary",n:t.review,label:e("session.evalReview",{n:t.review})}),t.blind>0&&m.jsx(Wo,{kind:"eval",state:"missing",cls:"st-empty blind",n:t.blind,label:e("session.evalBlind",{n:t.blind})}),t.unknown>0&&m.jsx(Wo,{kind:"eval",state:"missing",cls:"st-empty blind",n:t.unknown,label:e("session.evalUnknown",{n:t.unknown})}),t.phase==="updating"&&m.jsx(Pe,{name:"loader",size:11,className:"si-eval-spinner si-eval-phase"}),t.phase==="dormant"&&m.jsx(Un,{kind:"eval",state:"missing",title:e("session.evalDormantLast"),className:"si-eval-phase",size:11}),(t.phase==="disconnected"||t.phase==="error")&&m.jsx(Un,{kind:"eval",state:"missing",title:e("session.evalUnavailable"),className:"si-eval-phase",size:11})]}):m.jsx("span",{className:"si-eval-wait",children:m.jsx(Un,{kind:"eval",state:"missing",title:e("session.evalUnavailable"),size:12})})}function AB({launchers:t,launcher:e,pickLauncher:i}){const r=He(),[s,n]=A.useState(!1);ui(s,()=>n(!1));const o=t.find(u=>u.name===e),l=(Kl[(o==null?void 0:o.harness)||"claude"]||Kl.claude).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=Kl[u.harness]||Kl.claude,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(Pe,{name:"check",size:13,className:"si-launcher-check"})]}),u.cmd?m.jsx("span",{className:"si-launcher-cmd",children:u.cmd}):null]},u.name)})})]})]})}function a5({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:b=!1,surface:_=null,route:x=null}){const S=He(),E=Ju(),{notify:D}=r_(),{lockGraphTo:M}=yf(),{dock:C}=S4(),[N,W,q]=lB(C),[K,V]=A.useState(""),[I,z]=A.useState([]),[P,j]=A.useState(null),[O,G]=A.useState(null),[$,ue]=A.useState(null),[Y,X]=A.useState([]),[he,H]=A.useState({}),{launchers:ne,launcher:pe,pickLauncher:ce}=NM(),[ie,_e]=A.useState(null),[qe,nt]=A.useState(!1),[Wt,Mt]=A.useState(0),[Re,Kt]=A.useState(0),[mr,Ui]=A.useState(null),[le,te]=A.useState([]),[$e,ve]=A.useState([]),{tabs:Ke}=p5(),[Ze,lt]=A.useState(()=>new Set),[ht,ni]=A.useState(()=>new Set),[fe,Ne]=A.useState(0),[ze,et]=A.useState(!1),Gr=A.useRef(null),en=A.useRef(null),Qa=A.useRef({}),N1=A.useRef(null),L1=A.useRef("new"),O1=A.useRef(null),el=A.useRef(null);A.useEffect(()=>FT(()=>Ne(w=>w+1)),[]);const Yr=A.useRef(null),vs=A.useRef([]),E0=A.useRef(new Map),Fn=A.useRef(!1);A.useEffect(()=>{!ie||ie.phase==="pending"||ie.phase==="sending"||(D(ie.message,{kind:ie.phase==="delivered"?"success":"error"}),_e(null))},[ie,D]);const D0=w=>{vs.current=w,te(w)},Xr=(w,R)=>D0(vs.current.map(L=>L.id===w?{...L,...R}:L)),Ao=w=>le.some(R=>R.target===w&&(R.phase==="queued"||R.phase==="uploading")),bs=()=>{Yr.current&&window.clearTimeout(Yr.current),Yr.current=null,nt(!1),_e(w=>(w==null?void 0:w.owner)==="command"?null:w)},[gr,m5]=A.useState(null),[_s,P1]=A.useState(null),Eo=A.useCallback(()=>{if(el.current)return el.current;const w=fetch(gi("/api/sessions/archive-index")).then(async R=>{if(!R.ok)throw new Error(`archive index refused (HTTP ${R.status})`);const L=await R.json(),J=p4(Array.isArray(L)?L.map(Q=>({...Q,archived:!0})):[]);return m5(J),J}).catch(R=>(_e({owner:"panel",phase:"failed",message:R instanceof Error?R.message:String(R)}),[])).finally(()=>{el.current=null});return el.current=w,w},[]);A.useEffect(()=>{r&&gr===null&&Eo()},[r,gr,Eo]);const F1=A.useRef(null);A.useEffect(()=>{const w=new Set(t.map(L=>L.id)),R=F1.current;F1.current=w,r&&gr!==null&&R&&[...R].some(L=>!w.has(L))&&Eo()},[r,t,gr,Eo]);const Do=A.useMemo(()=>{const w=new Map(t.map(R=>[R.id,R]));for(const R of gr||[])w.has(R.id)||w.set(R.id,R);return _s&&!w.has(_s.id)&&w.set(_s.id,_s),[...w.values()]},[t,gr,_s]),M0=A.useRef(new Set);for(const w of Do)M0.current.add(w.id);const[vr,T0]=A.useState(null);A.useEffect(()=>{vr&&t.some(w=>w.id===vr.id)&&T0(null)},[t,vr]),A.useEffect(()=>{vr&&(gr!=null&&gr.some(w=>w.id===vr.id))&&T0(null)},[gr,vr]);const oi=A.useMemo(()=>!vr||Do.some(w=>w.id===vr.id)?Do:[...Do,vr],[Do,vr]);A.useEffect(()=>{_s&&t.some(w=>w.id===_s.id)&&P1(null)},[t,_s]);const g5=A.useMemo(()=>p4(oi.filter(w=>w.archived)),[oi]),B0=A.useMemo(()=>new Set(["new",...oi.map(w=>w.id)]),[oi]),ke=B0.has(n)||n!=="new"&&M0.current.has(n)?n:"new",sr=ke!=="new",{expanded:I1,offlineOpen:z1}=J6(),j1=A.useMemo(()=>Nf(t||[],w=>I1.has(w),{zoneFolded:w=>w==="offline"&&!z1,keepVisible:w=>w.id===ke}),[t,I1,z1,ke]),v5=A.useMemo(()=>["new",...j1.filter(w=>w.type==="row").map(w=>w.s.id)],[j1]),H1=A.useRef(new Set);A.useEffect(()=>{!r||n==="new"||B0.has(n)||!M0.current.has(n)||H1.current.has(n)||(H1.current.add(n),fetch(gi(`/api/sessions/${encodeURIComponent(n)}`)).then(async w=>{if(!w.ok){o("new");return}const R=await w.json();T0({...R,archived:R.archived===!0,liveness:R.archived===!0?"offline":R.liveness})}).catch(w=>{_e({owner:"panel",phase:"failed",message:w instanceof Error?w.message:String(w)}),o("new")}))},[r,n,B0,o]);const b5=(i==null?void 0:i.id)||null,gt=oi.find(w=>w.id===ke),[_5,R0]=A.useState(!1);A.useEffect(()=>{b&&R0(!0)},[b]);const $1=ln(gt),q1=(gt==null?void 0:gt.liveness)==="offline",y5=!!(gt!=null&&gt.archived),W1=q1||y5,Mo=LT(_)?_:null,w5=Ia(Mo)?hf(Mo):null,ys=$1||W1?Qr:Mo||Yl(ke),tl=ys===Qr,ws=ys===sa,x5=w=>{const R=oi.find(L=>L.id===w);return ln(R)?Qr:Yl(w)},N0=h4(gt,{}).some(w=>w.name==="command"),xs=o5(sr?gt==null?void 0:gt.evalSummary:null,p,!!gt),S5=bm(gt),K1=gt?[...(gt.files||[]).map(w=>({id:Ls(ke,"file",w),sessionId:ke,kind:"file",value:w,label:Yu(w),revision:0})),...(gt.web||[]).map(w=>({id:Ls(ke,"web",w.key),sessionId:ke,kind:"web",key:w.key,value:w.url,label:oh(w.url),revision:0}))]:[],Ss=sr?w5:null,vt=$e.find(w=>w.id===Ss)||K1.find(w=>w.id===Ss)||null,V1=K1.filter(w=>!Ke.some(R=>{var L;return R.page==="sessions"&&R.param===ke&&((L=R.query)==null?void 0:L.surface)===d4(w.id)})),k5=w=>{Kt(R=>R+1),bs()},U1=w=>{ve(R=>R.some(L=>L.id===w.id)?R:[...R,w]),lt(R=>{if(!R.has(w.id))return R;const L=new Set(R);return L.delete(w.id),L}),k5(),et(!1),E.open({page:"sessions",param:w.sessionId,query:{surface:d4(w.id)}})},C5=w=>ve(R=>R.map(L=>L.id===w.id?{...L,revision:L.revision+1}:L)),G1=w=>_e({owner:"panel",phase:"failed",message:w instanceof Error?w.message:String(w)}),A5=async(w,R)=>{const L=gi(`/api/sessions/${encodeURIComponent(w)}/files/download?path=${encodeURIComponent(R)}`);try{const J=await fetch(L,{method:"HEAD"});if(!J.ok){const be=await J.json().catch(()=>null);throw new Error((be==null?void 0:be.error)||S("session.fileDownloadFailed",{status:J.status}))}const Q=document.createElement("a");Q.href=L,Q.download=Yu(R),Q.style.display="none",document.body.appendChild(Q),Q.click(),Q.remove()}catch(J){G1(J)}},E5=async w=>{var R;try{if(!((R=navigator.clipboard)!=null&&R.writeText))throw new Error(S("session.fileCopyUnavailable"));await navigator.clipboard.writeText(w)}catch(L){G1(L)}};A.useEffect(()=>{const w=new Map;for(const J of t)for(const Q of J.web||[]){const be={id:Ls(J.id,"web",Q.key),sessionId:J.id,kind:"web",key:Q.key,value:Q.url,label:oh(Q.url),revision:0};w.set(be.id,be)}const R=O1.current;if(O1.current=w,!R)return;const L=[...w].filter(([J])=>!R.has(J)).map(([,J])=>J);L.length&&lt(J=>new Set([...J,...L.map(Q=>Q.id)]))},[t]),A.useEffect(()=>{const w=new Set;for(const R of t){for(const L of R.files||[])w.add(Ls(R.id,"file",L));for(const L of R.web||[])w.add(Ls(R.id,"web",L.key))}ve(R=>R.filter(L=>w.has(L.id)))},[t]),A.useEffect(()=>{const w=new Set(Ke.filter(R=>{var L;return R.page==="sessions"&&Ia((L=R.query)==null?void 0:L.surface)}).map(R=>hf(R.query.surface)));Ss&&w.add(Ss),ve(R=>R.filter(L=>w.has(L.id)))},[Ke,Ss]),A.useEffect(()=>{!Ss||!vt||ve(w=>w.some(R=>R.id===Ss)?w:[...w,vt])},[Ss,vt]);const il=A.useMemo(()=>{const w=[];for(const R of t)for(const L of R.web||[]){const J={id:Ls(R.id,"web",L.key),sessionId:R.id,kind:"web",key:L.key,value:L.url,label:oh(L.url),revision:0};Ze.has(J.id)&&w.push(J)}return w},[t,Ze]);vp(il.length?{id:"session-resource-unread",side:"right",priority:20,kind:"standard",text:S("session.unreadResources",{n:il.length}),tooltip:S("session.unreadResources",{n:il.length}),onClick:()=>U1(il[0])}:null),ui(ze,()=>et(!1)),A.useEffect(()=>{if(!ze)return;const w=R=>{var L,J;(J=(L=R.target)==null?void 0:L.closest)!=null&&J.call(L,'.document-action-menu, [data-action="resource-picker"]')||et(!1)};return window.addEventListener("mousedown",w,!0),()=>window.removeEventListener("mousedown",w,!0)},[ze]),ui(ws,()=>E.open({page:"sessions",param:ke,query:null},{replace:!0}));const br=he[ke]||"",ks=w=>H(R=>({...R,[ke]:typeof w=="function"?w(R[ke]||""):w})),L0=w=>{w!=="new"&&(bs(),j(null),J1(R=>R.has(w)?R:new Set(R).add(w)),o(w))},O0=(w,R,L=!1)=>{w!=="new"&&(L0(w),R===Qr?ni(J=>J.has(w)?J:new Set(J).add(w)):Mt(J=>J+1),(L||w===ke)&&E.open({page:"sessions",param:w,query:{surface:R}},{replace:!0}))};A.useEffect(()=>{const w=(gt==null?void 0:gt.harness)||"claude";fetch(gi(`/api/slash-commands?harness=${w}`)).then(R=>R.json()).then(R=>{Array.isArray(R)&&X(R)}).catch(()=>{})},[gt==null?void 0:gt.harness]);const Y1=LM();A.useEffect(()=>{Yr.current&&window.clearTimeout(Yr.current),Yr.current=null,nt(!1),_e(null),j(null)},[ke]),A.useEffect(()=>{N0||bs()},[N0]),A.useEffect(()=>()=>{Yr.current&&window.clearTimeout(Yr.current)},[]);const[X1,J1]=A.useState(()=>new Set);A.useEffect(()=>{J1(w=>{const R=new Set([...w].filter(L=>{const J=oi.find(Q=>Q.id===L);return J&&!ln(J)&&sh(J)}));for(const L of oi)!ln(L)&&sh(L)&&R.add(L.id);if(ke!=="new"){const L=t.find(J=>J.id===ke);L&&ln(L)&&R.add(ke)}return R.size===w.size&&[...R].every(L=>w.has(L))?w:R})},[oi,ke]),A.useEffect(()=>{ni(w=>{const R=new Set(oi.map(Q=>Q.id)),L=new Set([...w].filter(Q=>R.has(Q))),J=ke==="new"?null:oi.find(Q=>Q.id===ke);return J&&(!sh(J)||ln(J)||tl)&&L.add(J.id),L.size===w.size&&[...L].every(Q=>w.has(Q))?w:L})},[oi,ke,tl,fe]),A.useEffect(()=>{if(a==null)return;o("new");const w=ZT(a);V(w.text),z(w.selections),j(null),l==null||l(),requestAnimationFrame(()=>{const R=Gr.current;R&&(R.focus(),R.setSelectionRange(a.length,a.length))})},[a]),A.useEffect(()=>{if(!r)return;const w=setTimeout(()=>{var R,L;ke==="new"?(R=Gr.current)==null||R.focus():qe&&((L=en.current)==null||L.focus())},0);return()=>clearTimeout(w)},[r,ke,qe]);const D5=w=>w.replace(IM,(R,L)=>{const J=e.find(Q=>Q.id===L);return J?`[[${J.id}]] (${J.path})`:R}),P0=()=>{const w=QT(K,I);w&&(V(""),z([]),TM(w,pe).then(R=>{var L,J,Q,be,Ee,Le;R.ok&&R.id?(P1({id:R.id,...R.session||{},label:((L=R.session)==null?void 0:L.label)||w.split(/\s+/).slice(0,8).join(" ")||R.id,title:((J=R.session)==null?void 0:J.title)||((Q=R.session)==null?void 0:Q.label)||w.split(/\s+/).slice(0,8).join(" ")||R.id,status:((be=R.session)==null?void 0:be.status)||"queued",liveness:((Ee=R.session)==null?void 0:Ee.liveness)||"offline",archived:!1,capabilities:((Le=R.session)==null?void 0:Le.capabilities)||{headless:!0}}),R1("sessions",R.id,null),E.open({page:"sessions",param:R.id,query:null}),f==null||f()):R.ok||D(R.error||S("session.launchFailed"),{kind:"error"})}))},M5=(w,R)=>{const L=V6(w,R,e,b5);if(L)return L;const J=Wu(w,R,oi,ne);if(J)return J;if(ke==="new"){const be=$M(w,R,Y1);return be?{kind:"config",...be}:null}const Q=w.match(/^\/(\S*)$/);if(Q){const be=q0.map(Le=>({name:Le.name,description:S(Le.descKey),ui:!0,color:Le.color})),Ee=K6(BT(be,Y1,Y),Q[1]);return Ee.length?{kind:"slash",items:Ee,index:0,start:0,end:w.length,query:Q[1]}:null}return null},To=w=>j(w?M5(w.value,w.selectionStart):null),T5=w=>j(R=>R&&{...R,index:(R.index+w+R.items.length)%R.items.length}),F0=w=>{if(!w||!P)return;if(P.kind==="slash"){if(w.ui){const fi=q0.find(It=>It.name===w.name);ks(""),j(null),fi==null||fi.run("command");return}const Qe=`/${w.name} `,dt=br.slice(0,P.start);ks(dt+Qe+br.slice(P.end)),j(null);const Ue=dt.length+Qe.length;requestAnimationFrame(()=>{const fi=en.current;fi&&(fi.focus(),fi.setSelectionRange(Ue,Ue))});return}if(P.kind==="config"){const Qe=[K.slice(0,P.start).trim(),K.slice(P.end).trim()].filter(Boolean).join(" "),dt=`/${w.name}${Qe?` ${Qe}`:""} `;V(dt),j(null),requestAnimationFrame(()=>{const Ue=Gr.current;Ue&&(Ue.focus(),Ue.setSelectionRange(dt.length,dt.length))});return}const R=(P.kind==="mention"||P.kind==="session"||P.kind==="launcher")&&ke!=="new",L=R?en:Gr,J=R?br:K,Q=R?ks:V,be=J.slice(0,P.start);if(P.kind==="session"&&w.id==="new"){const Qe=be+"@new:"+J.slice(P.end),dt=be.length+5;Q(Qe),j(Wu(Qe,dt,oi,ne)),requestAnimationFrame(()=>{const Ue=L.current;Ue&&(Ue.focus(),Ue.setSelectionRange(dt,dt))});return}const Ee=P.kind==="session"?`@${w.id} `:P.kind==="launcher"?`@new:${w.id} `:`[[${w.id}]] `;Q(be+Ee+J.slice(P.end)),j(null);const Le=be.length+Ee.length;requestAnimationFrame(()=>{const Qe=L.current;Qe&&(Qe.focus(),Qe.setSelectionRange(Le,Le))})},Z1=(w,R)=>m.jsx(KM,{menu:P,up:w,head:R,onPick:F0,onHover:L=>j(J=>J&&{...J,index:L})}),Q1=w=>m.jsx(U6,{menu:P,up:w,onPick:F0,onHover:R=>j(L=>L&&{...L,index:R})}),I0=w=>{const R=en.current;if(!R)return;const L=R.selectionStart??br.length,J=R.selectionEnd??L,Q=br.slice(0,L)+w+br.slice(J),be=L+w.length;ks(Q),requestAnimationFrame(()=>{const Ee=en.current;Ee&&(Ee.focus(),Ee.setSelectionRange(be,be),To(Ee))})},ep=async()=>{const w=br;if(!w.trim()||ke==="new")return;const R=q0.find(Ee=>w.trim()===`/${Ee.name}`);if(R){ks(""),j(null),R.run("command");return}const L=D5(w);if((ie==null?void 0:ie.owner)==="command"&&ie.phase==="sending")return;const J=Qa.current[ke]||crypto.randomUUID();Qa.current[ke]=J,_e({owner:"command",phase:"sending",message:S("session.outcomeSending")});const Q=new AbortController,be=window.setTimeout(()=>Q.abort(),s_);try{const Ee=await fetch(gi(`/api/sessions/${ke}/input`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:"command",text:L,deliveryId:J}),signal:Q.signal}),Le=await Ee.json().catch(()=>null);if(!Ee.ok){if(Le!=null&&Le.deliveryPending){_e({owner:"command",phase:"queued",message:S("session.outcomeQueued")});return}_e({owner:"command",phase:"failed",message:(Le==null?void 0:Le.error)||S("session.deliveryFailed",{status:Ee.status})});return}if((Le==null?void 0:Le.delivery)==="queued"){_e({owner:"command",phase:"queued",message:S("session.outcomeQueued")});return}ks(dt=>dt===w?"":dt),delete Qa.current[ke];const Qe=(Le==null?void 0:Le.mentionSummary)||((Le==null?void 0:Le.delivery)==="deferred"?S("session.outcomeAccepted"):S("session.outcomeDelivered"));_e({owner:"command",phase:"delivered",message:Qe}),Yr.current=window.setTimeout(()=>bs(),650)}catch(Ee){if(Q.signal.aborted){_e({owner:"command",phase:"failed",message:S("session.outcomeUnconfirmed")});return}_e({owner:"command",phase:"failed",message:Ee instanceof Error?Ee.message:String(Ee)})}finally{window.clearTimeout(be)}},rl=async w=>{const R=await w.json().catch(()=>null);return(R==null?void 0:R.error)||`upload failed (HTTP ${w.status})`},B5=(w,R)=>(w==null?void 0:w.size)===R&&Number.isSafeInteger(w.chunkBytes)&&w.chunkBytes>0&&Number.isSafeInteger(w.concurrency)&&w.concurrency>0&&Number.isSafeInteger(w.requestTimeoutMs)&&w.requestTimeoutMs>0&&Number.isSafeInteger(w.retryLimit)&&w.retryLimit>=0&&Number.isSafeInteger(w.retryDelayMs)&&w.retryDelayMs>=0&&Number.isSafeInteger(w.offset)&&w.offset>=0&&w.offset<=R,R5=(w,R)=>new Promise((L,J)=>{if(R.signal.aborted){J(new Error("upload cancelled"));return}const Q=window.setTimeout(()=>{R.signal.removeEventListener("abort",be),L()},w),be=()=>{window.clearTimeout(Q),J(new Error("upload cancelled"))};R.signal.addEventListener("abort",be,{once:!0})}),tp=async(w,R,L,J)=>{const Q=new AbortController,be=()=>Q.abort();L.signal.addEventListener("abort",be,{once:!0});const Ee=window.setTimeout(()=>Q.abort(),J);try{return await fetch(w,{...R,signal:Q.signal})}catch(Le){throw!L.signal.aborted&&Q.signal.aborted?new Error("upload request timed out"):Le}finally{window.clearTimeout(Ee),L.signal.removeEventListener("abort",be)}},N5=async(w,R,L)=>{let J=0;for(;;)try{return await w()}catch(Q){if(L.signal.aborted||J>=R.retryLimit)throw Q;J+=1,await R5(R.retryDelayMs,L)}},ip=(w,R,L,J)=>{const Q=w.current;R=(Q==null?void 0:Q.value)??R;const be=Q?Q.selectionStart:R.length,Ee=Q?Q.selectionEnd:R.length,Le=R.slice(0,be),Qe=(Le&&!/\s$/.test(Le)?" ":"")+J+" ";L(Le+Qe+R.slice(Ee)),requestAnimationFrame(()=>{if(!Q)return;Q.focus();const dt=Le.length+Qe.length;Q.setSelectionRange(dt,dt)})},z0=async(w,R=null)=>{const L=vs.current.find(Q=>Q.id===w);if(!L||L.phase==="cancelled")return null;Xr(w,{phase:"uploading",error:null});const J=new AbortController;E0.current.set(w,J);try{let Q=L.transferId,be=null;if(Q){const Ue=await fetch(gi(`/api/uploads/${Q}`),{signal:J.signal});if(Ue.ok)be=await Ue.json();else if(Ue.status!==404)throw new Error(await rl(Ue))}if(!be){const Ue=await fetch(gi("/api/uploads"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:L.file.name||"pasted",size:L.file.size}),signal:J.signal});if(!Ue.ok)throw new Error(await rl(Ue));if(be=await Ue.json(),Q=be==null?void 0:be.id,!Q)throw new Error("upload did not return a transfer id");Xr(w,{transferId:Q})}if(!B5(be,L.file.size))throw new Error("upload transfer metadata is invalid");R==null||R(be.concurrency);let Ee=be.offset;for(Xr(w,{offset:Ee});Ee<L.file.size;){const Ue=L.file.slice(Ee,Math.min(L.file.size,Ee+be.chunkBytes)),fi=await N5(async()=>{const Bo=await tp(gi(`/api/uploads/${Q}`),{method:"PATCH",headers:{"content-type":"application/offset+octet-stream","upload-offset":String(Ee)},body:Ue},J,be.requestTimeoutMs);if(Bo.status>=500)throw new Error(await rl(Bo));return Bo},be,J),It=await fi.json().catch(()=>null);if(fi.status===409&&Number.isSafeInteger(It==null?void 0:It.offset)&&It.offset>=0&&It.offset<=L.file.size){Ee=It.offset,Xr(w,{offset:Ee});continue}if(!fi.ok)throw new Error((It==null?void 0:It.error)||`upload failed (HTTP ${fi.status})`);if(!Number.isSafeInteger(It==null?void 0:It.offset)||It.offset<=Ee||It.offset>L.file.size)throw new Error("upload did not advance its committed offset");Ee=It.offset,Xr(w,{offset:Ee})}const Le=await tp(gi(`/api/uploads/${Q}/complete`),{method:"POST"},J,be.requestTimeoutMs);if(!Le.ok)throw new Error(await rl(Le));const Qe=await Le.json().catch(()=>null);if(!(Qe!=null&&Qe.path))throw new Error("upload did not return a path");const dt=vs.current.find(Ue=>Ue.id===w);return(dt==null?void 0:dt.phase)==="cancelled"?void 0:(L.target==="new"?ip(Gr,K,V,Qe.path):ip(en,br,ks,Qe.path),Xr(w,{phase:"complete",offset:L.file.size,path:Qe.path}),be.concurrency)}catch(Q){R==null||R(null),J.signal.aborted?Xr(w,{phase:"cancelled",offset:0,transferId:null,error:null}):Xr(w,{phase:"failed",error:Q instanceof Error?Q.message:String(Q)})}finally{E0.current.delete(w)}return null},rp=async w=>{if(!Fn.current){Fn.current=!0;try{const[R,...L]=w;let J;const Q=new Promise(Ue=>{J=Ue}),be=R?z0(R,J):Promise.resolve(Xl),Ee=R?await Q:Xl,Le=Math.min(Math.max(0,(Ee||Xl)-Xl),L.length);if(Le===0){await be;for(const Ue of L)await z0(Ue);return}let Qe=0;const dt=Array.from({length:Le},async()=>{for(;Qe<L.length;){const Ue=L[Qe];Qe+=1,await z0(Ue)}});await Promise.all([be,...dt])}finally{Fn.current=!1}}},L5=w=>{Fn.current||rp([w])},sp=async w=>{var L;const R=vs.current.find(J=>J.id===w);R&&((L=E0.current.get(w))==null||L.abort(),R.transferId&&await fetch(gi(`/api/uploads/${R.transferId}`),{method:"DELETE"}).catch(()=>{}),Xr(w,{phase:"cancelled",offset:0,transferId:null,error:null}))},np=w=>{const R=vs.current.find(L=>L.id===w);R&&(R.phase!=="complete"&&R.phase!=="cancelled"&&sp(w),D0(vs.current.filter(L=>L.id!==w)))},j0=async(w,R)=>{const L=[...w||[]];if(!L.length||Fn.current)return;const J=L.map(Q=>({id:mB(),target:R,file:Q,phase:"queued",offset:0,transferId:null,error:null}));D0([...vs.current,...J]),await rp(J.map(Q=>Q.id))},op=w=>w<ff?`${w} B`:w<pf?`${Math.round(w/ff)} KB`:w<m4?`${(w/pf).toFixed(1)} MB`:`${(w/m4).toFixed(2)} GB`,ap=w=>{const R=le.filter(L=>L.target===w);return R.length?m.jsx("div",{className:`si-attach-queue ${w==="command"?"command":"new"}`,"aria-live":"polite",children:R.map(L=>{const J=L.phase==="queued"||L.phase==="uploading",Q=L.phase==="queued"?S("session.attachQueued"):L.phase==="uploading"?`${op(L.offset)} / ${op(L.file.size)}`:L.phase==="complete"?S("session.attachDone"):L.phase==="cancelled"?S("session.attachCancelled"):L.error;return m.jsxs("div",{className:`si-attach-row ${L.phase}`,onAnimationEnd:be=>{be.target===be.currentTarget&&be.animationName==="si-attach-complete-out"&&np(L.id)},children:[m.jsxs("span",{className:"si-attach-name",title:L.file.name,children:[m.jsx(Pe,{name:"paperclip",size:12}),L.file.name]}),m.jsx("progress",{className:"si-attach-progress",value:L.offset,max:L.file.size,"aria-label":`${L.file.name}: ${Q}`}),m.jsx("span",{className:"si-attach-status",role:L.phase==="failed"?"alert":"status",children:Q}),L.phase==="failed"&&m.jsx(yi,{icon:"rotate-ccw",size:13,className:"si-attach-action",label:S("session.attachRetry"),disabled:Fn.current,onClick:()=>L5(L.id)}),(J||L.phase==="failed")&&m.jsx(yi,{icon:"x",size:13,className:"si-attach-action",label:S("session.attachCancel"),onClick:()=>{sp(L.id)}}),(L.phase==="complete"||L.phase==="cancelled")&&m.jsx(yi,{icon:"x",size:13,className:"si-attach-action",label:S("session.attachDismiss"),onClick:()=>np(L.id)})]},L.id)})}):null},O5=()=>I.length?m.jsx("div",{className:"si-code-selection-queue","aria-label":S("session.codeSelectionAttachments"),children:I.map((w,R)=>m.jsx(eB,{selection:w,onRemove:()=>z(L=>L.filter((J,Q)=>Q!==R))},`${w.path}:${w.startLine}:${w.endLine}:${R}`))}):null,lp=(w,R)=>{var J;const L=(J=w.clipboardData)==null?void 0:J.files;L&&L.length&&(w.preventDefault(),j0(L,R))},up=(w,R)=>{var L;w.preventDefault(),Ui(null),j0((L=w.dataTransfer)==null?void 0:L.files,R)},cp=(w,R)=>{var L;[...((L=w.dataTransfer)==null?void 0:L.types)||[]].includes("Files")&&(w.preventDefault(),Ui(R))},hp=w=>{var R;L1.current=w,(R=N1.current)==null||R.click()},H0=async(w,R,L="panel",J={})=>{_e({owner:L,phase:"pending",message:S("session.outcomeWorking")});let Q=!0;try{const be=await fetch(gi(`/api/sessions/${ke}/${w}`),R?{method:"POST",headers:{"content-type":"application/json",...J},body:JSON.stringify(R)}:{method:"POST",headers:J}),Ee=await be.json().catch(()=>null);(!be.ok||(Ee==null?void 0:Ee.ok)===!1)&&(Q=!1,_e({owner:L,phase:"failed",message:(Ee==null?void 0:Ee.error)||`session ${w} refused (HTTP ${be.status})`}))}catch(be){Q=!1,_e({owner:L,phase:"failed",message:be instanceof Error?be.message:String(be)})}return Q&&_e(null),await(f==null?void 0:f()),Q&&L==="command"&&bs(),Q},dp=async()=>{const w=await H0("resume");return w&&await Eo(),w},$0=h4(gt,{command:()=>{qe?bs():nt(!0)},eval:()=>{sr&&E.open(XM(of(ke)))},relaunch:dp,stop:w=>H0("stop",void 0,w),close:w=>H0("close",void 0,w)}),q0=$0.filter(w=>w.typed!==!1&&w.enabled),tn=Number.isInteger(xs.total)?S("session.evalDoorSummary",xs):"",W0=xs.phase==="ready"?tn:xs.phase==="updating"?S("session.evalUpdating",{summary:tn}):xs.phase==="disconnected"?S("session.evalDisconnected",{summary:tn}):xs.phase==="dormant"?tn?S("session.evalDormantKnown",{summary:tn}):S("session.evalDormant"):xs.phase==="loading"?S("session.evalLoading"):tn?S("session.evalFailedKnown",{summary:tn}):S("session.evalUnavailable"),P5=k4()&&sr&&$0.some(w=>w.name==="eval");vp(P5?{id:"session-eval",side:"right",priority:25,tooltip:W0,node:m.jsxs("a",{className:"si-eval-door","data-action":"eval",href:Xa(of(ke)),"data-tip":W0,"aria-label":W0,children:[m.jsx(Pe,{name:"evals",size:14}),m.jsx(CB,{summary:xs})]})}:null);const F5=sr?Ut("sessions",ke,Mo?{surface:Mo}:null):null,I5=$1||W1?[Qr]:[Qr,pn,sa],sl=ys===sa?Yl(ke):ys,z5=sr?[{id:"resource-picker",icon:"folder-open",label:S("session.addResourceTab"),priority:100,pressed:ze,haspopup:!0,onClick:()=>et(w=>(w||G(null),!w)),menuKey:ze?V1.map(w=>w.id).join(","):"",menu:ze?m.jsx(wB,{options:V1,onOpen:U1}):null},...!vt&&I5.length>1?[{id:"surface-switcher",icon:sl===pn?"message-square":"terminal",label:S(sl===pn?"session.switchToConversation":"session.switchToTerminal"),priority:80,menuKey:`${sl}:${ws?"diff":"base"}`,onClick:()=>{et(!1);const w=sl===pn?Qr:pn;PT(ke,w),O0(ke,w,!0)}},{id:"diff-switcher",icon:"git-compare",label:S(ws?"session.diffClose":"session.diffScope"),priority:79,pressed:ws,menuKey:ws?"diff":"base",onClick:()=>{et(!1),O0(ke,ws?Yl(ke):sa,!0)}}]:[],...$0.filter(w=>w.button&&!vt&&(ys==="terminal"||w.name!=="merge")).map(w=>({id:w.name,icon:w.icon,label:w.enabled?YT(S(w.titleKey),...w.shortcut?[w.shortcut]:[]):S(w.disabledTitleKey),disabled:!w.enabled,disabledReason:w.enabled?void 0:S(w.disabledTitleKey),pressed:w.pressed?qe:void 0,onClick:()=>{var R;return(R=w.run)==null?void 0:R.call(w)},priority:w.anchor==="right"?-10:50})),...vt?[{id:"refresh-resource",icon:"rotate-ccw",label:S("session.refreshResourceTab",{name:vt.label}),priority:40,onClick:()=>C5(vt)},...vt.kind==="file"?[{id:"download-resource",icon:"download",label:S("session.downloadFile"),priority:39,onClick:()=>{A5(vt.sessionId,vt.value)}},{id:"copy-resource",icon:"copy",label:vt.value,priority:38,onClick:()=>{E5(vt.value)}}]:[]]:[]]:[],fp=A.useRef({});return fp.current={active:ke,submit:P0,menu:P,navMenu:T5,accept:F0,setMenu:j,open:r,searchOpen:s,commandOpen:qe,commandAvailable:N0,setCommandOpen:nt,closeCommandBox:bs,sessionOrder:v5},_f(w=>((L=>{var nl,mp,ol,gp;const{active:J,submit:Q,menu:be,navMenu:Ee,accept:Le,setMenu:Qe,open:dt,searchOpen:Ue,commandOpen:fi,commandAvailable:It,setCommandOpen:Bo,closeCommandBox:pp,sessionOrder:Ro}=fp.current;if(!(!dt||Ue)&&!((mp=(nl=L.target)==null?void 0:nl.closest)!=null&&mp.call(nl,"[data-focus-overlay]"))&&!((L.key==="Enter"||L.key===" ")&&((gp=(ol=L.target)==null?void 0:ol.closest)!=null&&gp.call(ol,"button, a[href]")))){if(UT("shell.commandBox",L)&&!L.metaKey&&!L.ctrlKey&&J!=="new"){L.preventDefault(),L.stopPropagation(),It&&(fi?pp():Bo(!0));return}if(!(L.altKey&&!L.metaKey&&!L.ctrlKey&&["KeyN","KeyF"].includes(L.code))){if(be){if(L.key==="ArrowDown"){L.preventDefault(),L.stopPropagation(),Ee(1);return}if(L.key==="ArrowUp"){L.preventDefault(),L.stopPropagation(),Ee(-1);return}if((L.key==="Enter"||L.key==="Tab")&&!au(L)){L.preventDefault(),L.stopPropagation(),Le(be.items[be.index]);return}if(L.key==="Escape"){L.preventDefault(),L.stopPropagation(),Qe(null);return}}if(fi&&L.key==="Escape"){L.preventDefault(),L.stopPropagation(),pp();return}if(L.key==="ArrowUp"||L.key==="ArrowDown"){if(h_(L.target))return;L.preventDefault(),L.stopPropagation();let K0=Ro.indexOf(J);K0<0&&(K0=0);const V0=Math.max(0,Math.min(Ro.length-1,K0+(L.key==="ArrowDown"?1:-1)));Ro[V0]!==J&&(c?c(Ro[V0]):o(Ro[V0]));return}}}})(w),w.cancelBubble),10,{allowTyping:!0}),m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"si-page",children:[N&&m.jsx(MT,{closing:W,opening:q,sessions:t,activeId:ke,onSelect:(w,R)=>c?c(w,R):w==="new"?o("new"):L0(w),archiveActive:b,onArchive:h,onSearch:d,reload:f,onContextMenu:G,selectRequest:$,onSelectRequestConsumed:()=>ue(null),onError:w=>_e({owner:"panel",phase:"failed",message:w})}),m.jsxs("div",{className:"si-document",children:[x&&m.jsx(oB,{specs:e,sessions:t,route:x,onSessionContextMenu:w=>{et(!1),G(w)}}),m.jsxs("div",{className:"si-panel",onMouseDownCapture:ga,children:[m.jsx("input",{ref:N1,type:"file",multiple:!0,style:{display:"none"},onChange:w=>{j0(w.target.files,L1.current),w.target.value=""}}),m.jsxs("section",{className:`si-content${ke==="new"?" is-new":" is-session"}`,children:[ke==="new"&&m.jsxs("div",{className:"si-new-center",children:[m.jsx(n5,{}),m.jsxs("div",{className:mr==="new"?"si-inputwrap dragover":"si-inputwrap",onDragOver:w=>cp(w,"new"),onDragLeave:()=>Ui(null),onDrop:w=>up(w,"new"),children:[m.jsx(md,{ref:Gr,className:"si-input","data-focus-sink":!0,rows:1,value:K,onKeyDown:w=>{w.key!=="Enter"||w.shiftKey||au(w)||(w.preventDefault(),w.stopPropagation(),P0())},onChange:w=>{V(w.target.value),To(w.target)},onSelect:w=>To(w.target),onPaste:w=>lp(w,"new"),onBlur:()=>j(null),placeholder:S("session.inputPlaceholder"),spellCheck:!1}),m.jsx("button",{type:"button",className:"si-attach","data-tip":S("session.attachTitle"),onClick:()=>hp("new"),disabled:Ao("new"),children:Ao("new")?m.jsx(hB,{}):m.jsx(cB,{})}),m.jsx(yi,{icon:"send",size:14,className:"si-launch",label:S("session.launchSend"),disabled:!K.trim(),onMouseDown:ga,onClick:P0}),P&&(P.kind==="mention"||P.kind==="session"||P.kind==="launcher")&&Q1(!1),P&&P.kind==="config"&&Z1(!1,P.query?`/${P.query}`:S("session.menuPresets"))]}),O5(),ap("new"),ne.length?m.jsx(AB,{launchers:ne,launcher:pe,pickLauncher:ce}):null,m.jsxs("div",{className:"si-hint",children:[S("session.hint.before"),m.jsx("code",{children:"[["}),S("session.hint.mid"),m.jsx("code",{children:"/"}),S("session.hint.after")]})]}),m.jsxs("div",{className:"si-session-wrap","aria-hidden":!sr,style:{display:"flex",flexDirection:"column",flex:1,minWidth:0,minHeight:0,position:sr?"relative":"absolute",inset:sr?void 0:0,visibility:sr?"visible":"hidden",pointerEvents:sr?"auto":"none"},children:[m.jsx(SB,{document:F5,actions:z5}),m.jsxs("div",{className:`si-term-body${tl?" is-conversation":""}${ws?" is-diff":""}${vt?" is-resource":""}`,id:vt?`si-resource-panel-${vt.id}`:`si-${ys}-panel-${ke}`,"aria-label":(vt==null?void 0:vt.label)||S(tl?"session.tabConversation":"session.tabTerminal"),style:{position:"relative"},children:[[...new Set([...X1,...ht])].map(w=>{const R=oi.find(Ee=>Ee.id===w);if(!R)return null;const L=ln(R),J=w===ke&&!vt,Q=J&&ys==="terminal",be=J&&(L||ys===Qr);return m.jsxs("div",{children:[!L&&X1.has(w)&&m.jsx("div",{className:"si-term-layer",style:{position:"absolute",inset:0,visibility:Q?"visible":"hidden",pointerEvents:Q?"auto":"none"},children:m.jsx($7,{sessionId:w,active:r&&Q,focused:r&&Q&&!qe,writable:r&&Q,focusRequest:w===ke?Wt:0})}),(L||ht.has(w))&&m.jsx("div",{className:"si-term-layer",style:{position:"absolute",inset:0,visibility:be?"visible":"hidden",pointerEvents:be?"auto":"none"},children:m.jsx(LC,{s:R,sessions:oi,active:r&&be,footerState:bm(R),onRestore:w===ke&&R.status!=="retired"?dp:void 0,actionOutcome:w===ke&&(ie==null?void 0:ie.owner)==="panel"?ie:null})})]},w)}),ws&&m.jsx(MM,{sessionId:ke}),$e.map(w=>{const R=(vt==null?void 0:vt.id)===w.id;return m.jsx("div",{className:"si-resource-layer",style:{position:"absolute",inset:0,visibility:R?"visible":"hidden",pointerEvents:R?"auto":"none"},children:m.jsx(kB,{tab:w,active:r&&R,focusRequest:R?Re:0,onEscape:()=>O0(w.sessionId,x5(w.sessionId),!0)})},w.id)}),(ie==null?void 0:ie.owner)==="panel"&&S5==="live"&&m.jsx("div",{className:"si-action-outcome-float",children:m.jsx(g4,{outcome:ie})}),qe&&!q1&&m.jsxs("div",{className:"si-command-layer",role:"dialog","aria-label":S("session.commandBox"),children:[m.jsx("button",{type:"button",className:"si-command-dismiss",tabIndex:-1,"aria-label":S("session.commandClose"),onMouseDown:bs}),m.jsx(dC,{className:`si-command-box${mr==="command"?" dragover":""}`,onDragOver:w=>cp(w,"command"),onDragLeave:()=>Ui(null),onDrop:w=>up(w,"command"),editor:m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"fv-tawrap",children:[m.jsx(md,{ref:en,className:"si-command-input",rows:1,value:br,"data-focus-sink":!0,onChange:w=>{delete Qa.current[ke],ks(w.target.value),To(w.target)},onSelect:w=>To(w.target),onPaste:w=>lp(w,"command"),onBlur:()=>j(null),onKeyDown:w=>{w.key==="Enter"&&!w.shiftKey&&!au(w)&&(w.preventDefault(),w.stopPropagation(),ep())},placeholder:S("session.commandPlaceholder"),spellCheck:!1}),P&&P.kind==="slash"&&Z1(!0,P.query?`/${P.query}`:S("session.menuCommands")),P&&(P.kind==="mention"||P.kind==="session"||P.kind==="launcher")&&Q1(!0)]}),ap("command")]}),footer:m.jsxs("div",{className:"si-command-tools",children:[m.jsxs("span",{className:"si-command-title",children:[m.jsx(Pe,{name:"command",size:12}),S("session.commandBox")]}),m.jsx("button",{type:"button",className:"fv-trigger-btn","data-tip":S("thread.mentionActor"),"aria-label":S("thread.mentionActor"),onClick:()=>I0("@"),children:"@"}),m.jsx("button",{type:"button",className:"fv-trigger-btn","data-tip":S("thread.mentionNode"),"aria-label":S("thread.mentionNode"),onClick:()=>I0("[["),children:"[["}),m.jsx("button",{type:"button",className:"fv-trigger-btn","data-tip":S("session.menuCommands"),"aria-label":S("session.menuCommands"),onClick:()=>I0("/"),children:"/"}),m.jsx(yi,{icon:Ao("command")?"loader":"paperclip",size:14,iconClassName:Ao("command")?"si-attach-busy":void 0,className:"si-command-tool",label:S("session.attachTitle"),disabled:Ao("command"),onClick:()=>hp("command")}),(ie==null?void 0:ie.owner)==="command"&&m.jsx(g4,{outcome:ie}),m.jsx(yi,{icon:"send",size:14,className:"si-command-send",label:S("session.commandSend"),disabled:!br.trim()||(ie==null?void 0:ie.owner)==="command"&&ie.phase==="sending",onClick:ep})]})})]})]})]})]})]})]})]}),_5&&m.jsx(uB,{sessions:g5,onOpenSession:w=>{R0(!1),c==null||c(w),L0(w)},onClose:()=>{R0(!1),b&&E.open({page:"sessions",param:ke==="new"?null:ke,query:null})}}),m.jsx(mT,{menu:O,onClose:()=>G(null),onChanged:f,onError:w=>{var L;const R=(L=O==null?void 0:O.session)==null?void 0:L.id;if(R&&R!==ke){o(R),requestAnimationFrame(()=>_e({owner:"panel",phase:"failed",message:w}));return}_e({owner:"panel",phase:"failed",message:w})},onLock:w=>{M(w.source,{toggle:!1}),u()},onMultiSelect:w=>ue(w),onDetach:w=>{ji("/api/sessions/reparent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({children:[w.id],parent:null})}).then(()=>f==null?void 0:f())}})]})}const dN=Object.freeze(Object.defineProperty({__proto__:null,LaunchHero:n5,default:a5,sessionEvalDisplay:o5},Symbol.toStringTag,{value:"Module"}));function EB({param:t,query:e}){const{specs:i,sessions:r,boardLive:s}=wf(),{reload:n}=C4(),{palette:o}=S4(),{openPalette:a,takeCompose:l,watchCompose:u}=yf(),c=Ju(),h=A.useCallback((_,{hold:x=!1}={})=>{if(_==="new")return c.open({page:"sessions",param:_,query:null});const S={page:"sessions",param:_,query:null};if(x)R1(S.page,S.param,S.query);else return tR(_,E=>c.open(E));return c.open(S)},[c]),d=t&&t!=="new"?t:"new",[f,p]=A.useState(null),b=k4();return A.useEffect(()=>{typeof(e==null?void 0:e.seed)=="string"&&e.seed.length&&p(e.seed)},[e==null?void 0:e.seed]),A.useEffect(()=>{if(!b)return;const _=()=>{const x=l();x!=null&&p(x)};return _(),u(_)},[b,l,u]),m.jsx(a5,{sessions:r,specs:i,focusNode:null,open:b,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 DB=/^[a-z][a-z0-9-]*$/,MB=t=>t&&typeof t=="object"&&!Array.isArray(t);function ah(t){if(typeof t!="string"||!DB.test(t))throw new TypeError(`view name must be lowercase kebab-case: ${String(t)}`)}const TB=new Set([Symbol.for("react.lazy"),Symbol.for("react.memo"),Symbol.for("react.forward_ref")]),BB=t=>typeof t=="function"||t&&typeof t=="object"&&TB.has(t.$$typeof);function v4(t){if(!t||typeof t!="object"||!BB(t.component))throw new TypeError("view definition requires a component function or React component");return Object.freeze({...t})}function RB(t={}){const e=new Map,i=new Map,r=new Map;for(const[l,u]of Object.entries(t))ah(l),e.set(l,v4(u)),i.set(l,"core");const s=(l,u,c="runtime")=>{if(ah(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,v4(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(ah(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(!MB(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 NB(t){return{id:"dashboard-settings",views:{settings:{component:t,surface:"workspace",document:!0,resident:!0,icon:"settings",className:"view-settings"}}}}const lh="spexcode.chunk-reload";function Pn(t){return A.lazy(async()=>{for(let e=0;;e++)try{const i=await t();try{sessionStorage.removeItem(lh)}catch{}return i}catch(i){if(e<2){await new Promise(s=>setTimeout(s,250));continue}let r=!0;try{r=sessionStorage.getItem(lh)==="1"}catch{}if(r)throw i;try{sessionStorage.setItem(lh,"1")}catch{}location.reload(),await new Promise(()=>{})}})}const l5=Pn(()=>Js(()=>import("./GraphView-5dgjv4t6.js"),__vite__mapDeps([5,1,2,3,6,7,8,9,4,10]),import.meta.url)),LB=Pn(()=>Js(()=>import("./SpecView-qZMzQH75.js"),__vite__mapDeps([11,1,2,6,7,3,8,4]),import.meta.url)),OB=Pn(()=>Js(()=>import("./FileView-Cf5bY14h.js"),__vite__mapDeps([12,1,2,8,3,4]),import.meta.url)),PB=Pn(()=>Js(()=>import("./EvalsPage-BBzomD1v.js"),__vite__mapDeps([13,1,2,7,3,4]),import.meta.url)),FB=Pn(()=>Js(()=>import("./IssuesPage-B_knZkH6.js"),__vite__mapDeps([14,1,2,6,7,3,8,4]),import.meta.url)),IB=Pn(()=>Js(()=>import("./Settings-louVIHfW.js"),__vite__mapDeps([15,1,2,3,4]),import.meta.url)),zB=Pn(()=>Js(()=>import("./EmptyView-CX3NC0Nq.js"),__vite__mapDeps([16,1,2,3]),import.meta.url));function jB({param:t,query:e}){return t==null?m.jsx(l5,{page:"spec",param:t,query:e}):m.jsx(LB,{param:t,query:e})}function HB({param:t,query:e}){const{specs:i,sessions:r,issuesStamp:s}=wf(),{reload:n}=C4(),o=Ju(),a=l=>o.open({page:"sessions",param:l,query:null});return m.jsx(PB,{param:t,query:e,specs:i,sessions:r,issuesStamp:s,reloadBoard:n,onOpenSession:a})}function $B({param:t,query:e}){const{specs:i,sessions:r,issuesStamp:s}=wf(),n=Ju(),o=a=>n.open({page:"sessions",param:a,query:null});return m.jsx(FB,{param:t,query:e,specs:i,sessions:r,issuesStamp:s,onOpenSession:o})}function qB(){return m.jsx(IB,{})}const WB=Object.freeze({graph:{component:l5,surface:"workspace",document:!1,icon:"graph",className:"view-graph"},spec:{component:jB,surface:"workspace",document:!0,resident:!0,icon:"graph",className:"view-spec"},file:{component:OB,surface:"workspace",document:(t,e)=>e!=null,icon:"files",className:"view-file"},sessions:{component:EB,surface:"workspace",document:(t,e)=>e!=null&&e!=="new",icon:"sessions",className:"view-sessions"},evals:{component:HB,surface:"workspace",document:!0,resident:!0,icon:"evals",className:"view-evals"},issues:{component:$B,surface:"workspace",document:!0,resident:!0,icon:"issues",className:"view-issues"},empty:{component:zB,surface:"workspace",document:!1,className:"view-empty"}}),Rn=RB(WB),fN=Rn.routeContract,KB=t=>Rn.registerPlugin(t);KB(NB(qB));const pN=t=>Rn.get(t)||Rn.get("sessions"),VB=t=>{var e;return((e=Rn.get(t))==null?void 0:e.icon)||null},u5=(t,e=null)=>{const i=Rn.get(t);return typeof(i==null?void 0:i.document)=="function"?i.document(t,e):!!(i!=null&&i.document)},UB=(t,e=null)=>{var i;return!!((i=Rn.get(t))!=null&&i.resident)&&e==null},Ir=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:")},Xu=t=>Ir(t)?"file":t==null?void 0:t.page,B1=new Set(["spec","evals","issues","settings"]),Ja=t=>(t==null?void 0:t.page)==="sessions"&&(t!=null&&t.param)&&!Ir(t)?{...t,query:null}:B1.has(t==null?void 0:t.page)?{...t,param:null,query:null}:t,Ge=t=>{const e=Ja(t);return Ut(e.page,e.param,e.query)};function GB(t,e=()=>!0){const i=t.filter(n=>e(n.page,n.param??null)).map(n=>{const o={page:n.page,param:n.param??null,query:n.query??null},a=Ja(o),l=n.held===!0;return{page:o.page,param:o.param,query:o.query,...l?{held:!0}:{},pinned:Ir(a)?!0:B1.has(a.page)?l:n.pinned!=null?n.pinned!==!1:n.preview!==!0}}),r=[],s=new Map;for(const n of i){const o=Ge(n),a=s.get(o);if(a){a.pinned||(a.pinned=n.pinned),a.held||(a.held=n.held);continue}s.set(o,n),r.push(n)}return r}function YB(t,e,i="slot",r=void 0){const s={page:e.page,param:e.param??null,query:e.query??null},n=Ja(s),o=Ge(n),a=t.find(c=>Ge(c)===o);if(a){const c=n.page==="sessions"&&!Ir(n)&&JSON.stringify(a.query||null)!==JSON.stringify(n.query||null),h=B1.has(n.page)&&(a.param!==s.param||JSON.stringify(a.query||null)!==JSON.stringify(s.query||null));return i!=="pin"&&!c&&!h?t:t.map(d=>Ge(d)===o?{...d,...c||h?{param:s.param,query:s.query}:{},...i==="pin"?{pinned:!0,held:!0}:{}}:d)}const l={page:s.page,param:s.param??null,query:s.query??null,pinned:Ir(n)||i==="pin",...i==="pin"&&!Ir(n)?{held:!0}:{}};if(Ir(n))return[...t,l];const u=t.findIndex(c=>!c.pinned&&Xu(c)===Xu(n)&&(r===void 0||Ge(c)===r));return i==="pin"||u<0?[...t,l]:t.map((c,h)=>h===u?l:c)}function mf(t,e,i=null){const r=t.findIndex(o=>Ge(o)===e);if(r<0)return t;const s=t.filter((o,a)=>a!==r),n=i==null?s.length:s.findIndex(o=>Ge(o)===i);return n<0||n===r?t:[...s.slice(0,n),t[r],...s.slice(n)]}function XB(t,e,i,r=[]){const s=Xu(Ja(t));if(Ir(t)){const c=e.find(h=>h.page==="sessions"&&h.param===t.param&&!Ir(h));if(c)return c}const n=c=>{for(const h of r){const d=e.find(f=>Ge(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=>Xu(c)===s,u=n(a)||o(l)||o(a);return u||(Ir(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 gf="spexcode.tabs",JB=()=>{try{const t=JSON.parse(localStorage.getItem(gf)||"[]");if(!Array.isArray(t))return[];const e=t.filter(r=>r&&typeof r.page=="string"),i=GB(e,u5);return JSON.stringify(i)!==JSON.stringify(e)&&localStorage.setItem(gf,JSON.stringify(i)),i}catch{return[]}},ZB=t=>{try{localStorage.setItem(gf,JSON.stringify(t))}catch{}};let c5=null;const vf=new Set,vi=()=>c5??(c5=JB()),na=t=>{const e=t;if(e===vi())return e;c5=e,ZB(e);for(const i of[...vf])i(e);return e};let io=[];const QB=t=>{if(io[0]===t)return;const e=new Set(vi().map(Ge));io=[t,...io.filter(i=>i!==t&&e.has(i))]};let Gn=null,Fs=null;function eR(t){return Fs=t,()=>{Fs===t&&(Fs=null)}}function mN(t,...e){var i;return(i=Fs==null?void 0:Fs[t])==null?void 0:i.call(Fs,...e)}const h5=t=>t.button===0&&!t.shiftKey&&!t.altKey&&(t.ctrlKey||t.metaKey);function R1(t,e=null,i=null){const r=Ge(Ja({page:t,param:e,query:i}));Gn=r;const s=vi();s.some(n=>Ge(n)===r)&&(na(s.map(n=>Ge(n)===r?{...n,pinned:!0,held:!0}:n)),Gn=null)}function Za(t,e=null,i=null){R1(t,e,i),_n(t,e,{query:i})}const d5=t=>{const{page:e,param:i,query:r}=bf(t);return{page:e,param:i,query:Object.keys(r||{}).length?r:null}};function f5(t,e){if(!h5(t))return!1;t.preventDefault();const i=d5(e);return Za(i.page,i.param,i.query),!0}function gN(t){const e=vi().filter(t),i=e[e.length-1];return i?(_n(i.page,i.param,{query:i.query}),!0):!1}function tR(t,e){if(!t)return!1;const i=vi().find(s=>s.page==="sessions"&&s.param===t),r={page:"sessions",param:t,query:null};return e==null||e(i?{...r}:r),!!i}function p5({onCloseStart:t}={}){const e=d_(),[i,r]=A.useState(vi),s=A.useRef(void 0),n=A.useRef(t);A.useEffect(()=>{n.current=t},[t]),A.useEffect(()=>(vf.add(r),r(vi()),()=>{vf.delete(r)}),[]),A.useEffect(()=>{const h=Ge(e),d=s.current;if(Gn&&Gn!==h&&(Gn=null),!u5(e.page,e.param)){s.current=h;return}const f=Gn===h?"pin":"slot";na(YB(vi(),e,f,d)),QB(h),s.current=h},[e.page,e.param,e.query]);const o=Ge(e),a=A.useCallback(h=>_n(h.page,h.param,{query:h.query}),[]),l=A.useCallback(h=>{var _;const d=Ge(h),f=vi(),p=f.findIndex(x=>Ge(x)===d);if(p<0)return;(_=n.current)==null||_.call(n,h);const b=f.filter((x,S)=>S!==p);if(na(b),io=io.filter(x=>x!==d),d===o){const x=XB(h,b,p,io);_n(x.page,x.param,{query:x.query})}},[o]),u=A.useCallback(h=>{const d=Ge(h),f=vi();f.filter(p=>Ge(p)!==d).forEach(p=>{var b;return(b=n.current)==null?void 0:b.call(n,p)}),na(f.filter(p=>Ge(p)===d)),d!==o&&_n(h.page,h.param,{query:h.query})},[o]),c=A.useCallback((h,d)=>{na(mf(vi(),h,d))},[]);return A.useEffect(()=>eR({closeActive:()=>{const h=vi().find(d=>Ge(d)===o);h&&l(h)},move:h=>{const d=vi(),f=d.findIndex(p=>Ge(p)===o);f<0||d.length<2||a(d[(f+h+d.length)%d.length])},hold:()=>{const h=vi().find(d=>Ge(d)===o);return h&&!h.pinned&&Za(h.page,h.param,h.query),h||null},active:()=>vi().find(h=>Ge(h)===o)||null}),[o,a,l]),A.useMemo(()=>({tabs:i,activeKey:o,open:a,close:l,closeOthers:u,move:c}),[i,o,a,l,u,c])}export{KT as $,ih as A,a4 as B,C1 as C,ma as D,mT as E,Z6 as F,lf as G,W6 as H,dR as I,jr as J,A4 as K,or as L,HR as M,lB as N,IR as O,hT as P,Xa as Q,WR as R,qu as S,Un as T,$R as U,OM as V,r5 as W,qT as X,M1 as Y,HT as Z,nB as _,Ku as a,R1 as a$,mN as a0,oB as a1,XM as a2,NM as a3,RR as a4,BR as a5,rN as a6,pN as a7,Kl as a8,fN as a9,YR as aA,JR as aB,nT as aC,GR as aD,cT as aE,QR as aF,eN as aG,ZR as aH,gR as aI,lC as aJ,X6 as aK,FR as aL,KR as aM,LR as aN,IM as aO,dC as aP,PR as aQ,OR as aR,XR as aS,qR as aT,mR as aU,tC as aV,cC as aW,iN as aX,Wo as aY,bm as aZ,QT as a_,k1 as aa,sN as ab,wT as ac,bT as ad,yT as ae,_T as af,UR as ag,md as ah,au as ai,of as aj,LC as ak,TM as al,NR as am,tN as an,FM as ao,nN as ap,gT as aq,lN as ar,Ae as as,Ve as at,uD as au,bR as av,_R as aw,PD as ax,k0 as ay,Se as az,Mi as b,eB as b0,hR as b1,KM as b2,K6 as b3,B7 as b4,oN as b5,pn as b6,Qr as b7,pm as b8,M7 as b9,Qs as bA,Ce as bB,An as bC,SR as bD,Jd as bE,CR as bF,ER as bG,DR as bH,AR as bI,MR as bJ,TR as bK,TD as bL,MD as bM,wR as bN,dN as bO,D7 as ba,cR as bb,aN as bc,cN as bd,uN as be,hN as bf,_D as bg,h6 as bh,Wi as bi,dD as bj,it as bk,si as bl,Dt as bm,CD as bn,Fa as bo,ci as bp,Ye as bq,ct as br,kR as bs,Co as bt,xe as bu,We as bv,rr as bw,On as bx,GE as by,zi as bz,G6 as c,eT as d,jR as e,gN as f,zR as g,QM as h,VB as i,YM as j,f5 as k,UT as l,h5 as m,VR as n,J6 as o,Za as p,ST as q,G7 as r,GT as s,Uh as t,ET as u,kT as v,YT as w,Nf as x,DT as y,tR as z};