tmex-cli 0.16.1 → 0.16.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -60
- package/dist/runtime/server.js +972 -330
- package/package.json +1 -1
- package/resources/fe-dist/assets/DevicePage-DtByPprm.js +24 -0
- package/resources/fe-dist/assets/{DevicesPage-sJHXbS_f.js → DevicesPage-WMW0FcaU.js} +1 -1
- package/resources/fe-dist/assets/{FilePage-7FFd1YcW.js → FilePage-C3yjgRDh.js} +1 -1
- package/resources/fe-dist/assets/SettingsPage-CKZEPwEq.js +39 -0
- package/resources/fe-dist/assets/agent-tab-B77EotmX.js +38 -0
- package/resources/fe-dist/assets/{api-DV7-9Pvt.js → api-DZDjPn8l.js} +1 -1
- package/resources/fe-dist/assets/{arc-PDHKfnGP.js → arc-DNrUdLWP.js} +1 -1
- package/resources/fe-dist/assets/{architectureDiagram-3BPJPVTR-BiPHTh1e.js → architectureDiagram-3BPJPVTR-B5DYf-5o.js} +1 -1
- package/resources/fe-dist/assets/{blockDiagram-GPEHLZMM-DP_BRHKg.js → blockDiagram-GPEHLZMM-DSgjcUbw.js} +1 -1
- package/resources/fe-dist/assets/{c4Diagram-AAUBKEIU-D16QYgyT.js → c4Diagram-AAUBKEIU-DKjqulHT.js} +1 -1
- package/resources/fe-dist/assets/{card-DmfNw0hd.js → card-DWQzPt-3.js} +1 -1
- package/resources/fe-dist/assets/channel-CpZANba-.js +1 -0
- package/resources/fe-dist/assets/{chunk-2J33WTMH-DOjtL7ww.js → chunk-2J33WTMH-DHQ_-AlN.js} +1 -1
- package/resources/fe-dist/assets/{chunk-4BX2VUAB-BbT67ZXa.js → chunk-4BX2VUAB-C7sszhBq.js} +1 -1
- package/resources/fe-dist/assets/{chunk-55IACEB6-CnnXwmY_.js → chunk-55IACEB6-BkPT2okv.js} +1 -1
- package/resources/fe-dist/assets/{chunk-727SXJPM-TyUdLEW5.js → chunk-727SXJPM-BsD5c54G.js} +1 -1
- package/resources/fe-dist/assets/{chunk-AQP2D5EJ-BMpK4dqa.js → chunk-AQP2D5EJ-Dx3mc4xO.js} +1 -1
- package/resources/fe-dist/assets/{chunk-FMBD7UC4-Dx0HVCZZ.js → chunk-FMBD7UC4-CyZO-UAp.js} +1 -1
- package/resources/fe-dist/assets/{chunk-ND2GUHAM-BQCoMEti.js → chunk-ND2GUHAM-DNxRBeA7.js} +1 -1
- package/resources/fe-dist/assets/{chunk-QZHKN3VN-ilmf5OgK.js → chunk-QZHKN3VN-DsPa138W.js} +1 -1
- package/resources/fe-dist/assets/classDiagram-4FO5ZUOK-BW09ep_0.js +1 -0
- package/resources/fe-dist/assets/classDiagram-v2-Q7XG4LA2-BW09ep_0.js +1 -0
- package/resources/fe-dist/assets/{copy-Ct5TNzGp.js → copy-DwXKDgGT.js} +1 -1
- package/resources/fe-dist/assets/{cose-bilkent-S5V4N54A-CpWhM7Za.js → cose-bilkent-S5V4N54A-C1d180_v.js} +1 -1
- package/resources/fe-dist/assets/{dagre-BM42HDAG-CWJttTzC.js → dagre-BM42HDAG-Bv8hvnH7.js} +1 -1
- package/resources/fe-dist/assets/{diagram-2AECGRRQ-BD8ny_Yg.js → diagram-2AECGRRQ-DfbJBHI6.js} +1 -1
- package/resources/fe-dist/assets/{diagram-5GNKFQAL-CeHcPWRz.js → diagram-5GNKFQAL-COnOrAiu.js} +1 -1
- package/resources/fe-dist/assets/{diagram-KO2AKTUF-tVlrBE8C.js → diagram-KO2AKTUF-BOtU5EdV.js} +1 -1
- package/resources/fe-dist/assets/{diagram-LMA3HP47-DGUn-oQn.js → diagram-LMA3HP47-B-WcT-Mc.js} +1 -1
- package/resources/fe-dist/assets/{diagram-OG6HWLK6-xKCd1kwA.js → diagram-OG6HWLK6-BptGbu0F.js} +1 -1
- package/resources/fe-dist/assets/en_US-BihUhDmr.js +1 -0
- package/resources/fe-dist/assets/{erDiagram-TEJ5UH35-C6M5qkGl.js → erDiagram-TEJ5UH35-H06uoCHU.js} +1 -1
- package/resources/fe-dist/assets/{files-tab-BWkYfaye.js → files-tab-C841Mmn_.js} +1 -1
- package/resources/fe-dist/assets/{flowDiagram-I6XJVG4X-D0MZDHnB.js → flowDiagram-I6XJVG4X-QOk_IVWN.js} +1 -1
- package/resources/fe-dist/assets/{ganttDiagram-6RSMTGT7-YeduSSa_.js → ganttDiagram-6RSMTGT7-Q7s2jHyi.js} +1 -1
- package/resources/fe-dist/assets/{gitGraphDiagram-PVQCEYII-Nem1Mvvg.js → gitGraphDiagram-PVQCEYII-Q7tAtx1u.js} +1 -1
- package/resources/fe-dist/assets/{index-iee3U_rD.js → index-C2v9tHtI.js} +1 -1
- package/resources/fe-dist/assets/{index-B3ddLSja.js → index-Dc3Fwpho.js} +63 -63
- package/resources/fe-dist/assets/index-j9kTGUS5.css +1 -0
- package/resources/fe-dist/assets/{infoDiagram-5YYISTIA-Bh6bbh_V.js → infoDiagram-5YYISTIA-B9n7MrtF.js} +1 -1
- package/resources/fe-dist/assets/{ishikawaDiagram-YF4QCWOH-CsZHu48j.js → ishikawaDiagram-YF4QCWOH-oZeau8IS.js} +1 -1
- package/resources/fe-dist/assets/ja_JP-f5sXmz8W.js +1 -0
- package/resources/fe-dist/assets/{journeyDiagram-JHISSGLW-CPgnovXt.js → journeyDiagram-JHISSGLW-ClXjUmc1.js} +1 -1
- package/resources/fe-dist/assets/{kanban-definition-UN3LZRKU-D4OAuDsS.js → kanban-definition-UN3LZRKU-Cwn4VzH2.js} +1 -1
- package/resources/fe-dist/assets/{linear-CcA4wV7f.js → linear-BNOQBDiB.js} +1 -1
- package/resources/fe-dist/assets/{markdown-preview-CBGlxpTs.js → markdown-preview-BsYVAcJ1.js} +3 -3
- package/resources/fe-dist/assets/{mermaid.core-D-CshtYr.js → mermaid.core-C3nmuA6R.js} +5 -5
- package/resources/fe-dist/assets/{mindmap-definition-RKZ34NQL-DBpI1nMC.js → mindmap-definition-RKZ34NQL-BKstxajf.js} +1 -1
- package/resources/fe-dist/assets/{pieDiagram-4H26LBE5-D4kh0_Y0.js → pieDiagram-4H26LBE5-D_2bHoC9.js} +1 -1
- package/resources/fe-dist/assets/{quadrantDiagram-W4KKPZXB-DNw3oGHQ.js → quadrantDiagram-W4KKPZXB-D6K_QmUy.js} +1 -1
- package/resources/fe-dist/assets/{requirementDiagram-4Y6WPE33-DqtMaND0.js → requirementDiagram-4Y6WPE33-B1SWUDkA.js} +1 -1
- package/resources/fe-dist/assets/{sankeyDiagram-5OEKKPKP-D-m9Pyie.js → sankeyDiagram-5OEKKPKP-DPmalO0b.js} +1 -1
- package/resources/fe-dist/assets/{send-DaOB9hLq.js → send-J45szXFM.js} +1 -1
- package/resources/fe-dist/assets/{sequenceDiagram-3UESZ5HK-CjrimNJf.js → sequenceDiagram-3UESZ5HK-C08DcZug.js} +1 -1
- package/resources/fe-dist/assets/{stateDiagram-AJRCARHV-BT5d8Z8W.js → stateDiagram-AJRCARHV-K9bVAVhg.js} +1 -1
- package/resources/fe-dist/assets/stateDiagram-v2-BHNVJYJU-DTGkSC6X.js +1 -0
- package/resources/fe-dist/assets/{terminal-settings-panel-DDhlnbRH.js → terminal-settings-panel-tZuaqdqz.js} +2 -2
- package/resources/fe-dist/assets/{timeline-definition-PNZ67QCA-BeocAFDX.js → timeline-definition-PNZ67QCA-DG0FtOvK.js} +1 -1
- package/resources/fe-dist/assets/{transfer-toast-DXl4RHsV.js → transfer-toast-D72q4082.js} +1 -1
- package/resources/fe-dist/assets/{triangle-alert-FQRTtbTP.js → triangle-alert-CagsqsWp.js} +1 -1
- package/resources/fe-dist/assets/{vennDiagram-CIIHVFJN-CYlmUB5_.js → vennDiagram-CIIHVFJN-CKBEKUkA.js} +1 -1
- package/resources/fe-dist/assets/{wardley-L42UT6IY-CTyaodt9.js → wardley-L42UT6IY-DTlpnptg.js} +1 -1
- package/resources/fe-dist/assets/{wardleyDiagram-YWT4CUSO-DNlEcEwQ.js → wardleyDiagram-YWT4CUSO-CnwEikRb.js} +1 -1
- package/resources/fe-dist/assets/{xychartDiagram-2RQKCTM6-7Zi-6P-I.js → xychartDiagram-2RQKCTM6-uaYRX4Ue.js} +1 -1
- package/resources/fe-dist/assets/{zap-BFIAXPXd.js → zap-DcJ8Gp1I.js} +1 -1
- package/resources/fe-dist/assets/zh_CN-CPdvelFW.js +1 -0
- package/resources/fe-dist/index.html +2 -2
- package/resources/gateway-drizzle/0012_naive_lizard.sql +8 -0
- package/resources/gateway-drizzle/0013_bored_blindfold.sql +1 -0
- package/resources/gateway-drizzle/0014_lucky_killraven.sql +1 -0
- package/resources/gateway-drizzle/meta/_journal.json +21 -0
- package/resources/fe-dist/assets/DevicePage-Ccz8gNji.js +0 -24
- package/resources/fe-dist/assets/SettingsPage-FrEtqZyI.js +0 -39
- package/resources/fe-dist/assets/agent-tab-9THUj7Cf.js +0 -38
- package/resources/fe-dist/assets/channel-Dzz9b4fW.js +0 -1
- package/resources/fe-dist/assets/classDiagram-4FO5ZUOK-BB9_4XLL.js +0 -1
- package/resources/fe-dist/assets/classDiagram-v2-Q7XG4LA2-BB9_4XLL.js +0 -1
- package/resources/fe-dist/assets/en_US-CjVU4anP.js +0 -1
- package/resources/fe-dist/assets/index-CuFTSN9i.css +0 -1
- package/resources/fe-dist/assets/ja_JP-Bq-BwOH_.js +0 -1
- package/resources/fe-dist/assets/stateDiagram-v2-BHNVJYJU-kSh9IuUW.js +0 -1
- package/resources/fe-dist/assets/zh_CN-BuxyXhCT.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var se=Object.defineProperty;var ie=(e,t,n)=>t in e?se(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var h=(e,t,n)=>ie(e,typeof t!="symbol"?t+"":t,n);import{Y as P,u as k,j as c,$ as nt,B as M,X as A,a as oe,c as re,r as w,a0 as le,a1 as V,e as ae,o as ht,a2 as ce,a3 as de,a4 as he,a5 as ue,a6 as me,K as _,P as fe,a7 as pe,a8 as ge,a9 as ye,aa as be,ab as xe,ac as Se,ad as Ce,T as we,ae as Te,af as E,ag as Ee,ah as ut,ai as mt,aj as Re,N as ve,O as Me,Q as _e,ak as Ae,R as De,al as He,U as Ne,am as ke}from"./index-
|
|
1
|
+
var se=Object.defineProperty;var ie=(e,t,n)=>t in e?se(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var h=(e,t,n)=>ie(e,typeof t!="symbol"?t+"":t,n);import{Y as P,u as k,j as c,$ as nt,B as M,X as A,a as oe,c as re,r as w,a0 as le,a1 as V,e as ae,o as ht,a2 as ce,a3 as de,a4 as he,a5 as ue,a6 as me,K as _,P as fe,a7 as pe,a8 as ge,a9 as ye,aa as be,ab as xe,ac as Se,ad as Ce,T as we,ae as Te,af as E,ag as Ee,ah as ut,ai as mt,aj as Re,N as ve,O as Me,Q as _e,ak as Ae,R as De,al as He,U as Ne,am as ke}from"./index-Dc3Fwpho.js";import{g as Ie,h as ft,i as Be,w as Le,a as Fe,b as Oe,c as pt,d as $e,k as Bt}from"./selection-clipboard-D3gUQQ7L.js";import{K as Lt}from"./send-J45szXFM.js";const Ke=[{id:"paste",type:"action",action:"paste",label:""},{id:"enter",type:"send",label:"Enter",payload:"\r"},{id:"shift-tab",type:"send",label:"SHIFT-TAB",payload:"\x1B[Z"},{id:"esc",type:"send",label:"ESC",payload:"\x1B"},{id:"ctrl-c",type:"send",label:"CTRL-C",payload:""},{id:"ctrl-d",type:"send",label:"CTRL-D",payload:""},{id:"arrow-up",type:"send",label:"↑",payload:"\x1B[A"},{id:"arrow-down",type:"send",label:"↓",payload:"\x1B[B"},{id:"arrow-left",type:"send",label:"←",payload:"\x1B[D"},{id:"arrow-right",type:"send",label:"→",payload:"\x1B[C"},{id:"shift-enter",type:"send",label:"SHIFT-Enter",payload:"\x1B[13;2u"},{id:"backspace",type:"send",label:"Backspace",payload:"\b"}];/**
|
|
2
2
|
* @license lucide-react v0.564.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -19,7 +19,7 @@ var se=Object.defineProperty;var ie=(e,t,n)=>t in e?se(e,t,{enumerable:!0,config
|
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
20
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
21
|
*/const Ue=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],Ge=P("rotate-ccw",Ue);function Ve(e){return`rgb(${e.r} ${e.g} ${e.b})`}const ze=new Map([[9622,4],[9623,8],[9624,1],[9625,13],[9626,9],[9627,7],[9628,11],[9629,2],[9630,6],[9631,14]]),We=new Map([[9617,.25],[9618,.5],[9619,.75]]);function Xe(e){return e>=9600&&e<=9631}function z(e){const t=e.getContext("2d");if(!t)throw new Error("2d canvas context unavailable");return t}class qe{constructor(t){h(this,"kind","canvas");h(this,"mainCanvas");h(this,"selectionCanvas");h(this,"cursorCanvas");h(this,"mainContext");h(this,"selectionContext");h(this,"cursorContext");h(this,"theme");h(this,"fontFamily");h(this,"fontSize");h(this,"cellDimensions",{width:9,height:17});h(this,"deviceCellWidth",9);h(this,"deviceCellHeight",17);h(this,"deviceFontSize",13);h(this,"textTopGap",0);h(this,"textBaselineY",0);h(this,"glyphBoxHeight",0);h(this,"dpr",1);h(this,"cols",0);h(this,"rows",0);h(this,"lastCursor",null);h(this,"frameCount",0);h(this,"lastDrawnRows",[]);h(this,"colorCache",new Map);h(this,"fontCache",new Map);h(this,"cursorBlinkVisible",!0);h(this,"cursorBlinkTimer",null);this.theme=t.theme,this.fontFamily=t.fontFamily,this.fontSize=t.fontSize,t.screenElement.style.position="relative",t.screenElement.style.overflow="hidden",this.mainCanvas=document.createElement("canvas"),this.selectionCanvas=document.createElement("canvas"),this.cursorCanvas=document.createElement("canvas");for(const[n,s]of[[this.mainCanvas,"main"],[this.selectionCanvas,"selection"],[this.cursorCanvas,"cursor"]])n.dataset.layer=s,n.style.position="absolute",n.style.inset="0",n.style.width="100%",n.style.height="100%",n.style.pointerEvents="none",t.screenElement.appendChild(n);this.mainContext=z(this.mainCanvas),this.selectionContext=z(this.selectionCanvas),this.cursorContext=z(this.cursorCanvas)}setTheme(t){this.theme=t,this.colorCache.clear()}render(t){this.frameCount+=1,this.lastDrawnRows=[],this.cellDimensions=t.cellDimensions;const n=this.resize(t.meta.cols,t.meta.rows);this.drawSelection(t.selectionRects??[],t.selectionColor??this.theme.selectionBackground);const s=n||t.forceFull===!0?"full":t.meta.dirty;if(s==="clean"){this.drawCursor(t.meta);return}const o=s==="full",i=o?t.rows:t.rows.filter(l=>l.dirty);let r;if(o)r=t.rows;else{const l=new Set;for(const a of i)l.add(a.y-1),l.add(a.y),l.add(a.y+1);r=t.rows.filter(a=>l.has(a.y))}for(const l of r)this.drawRowBackground(l,t.meta.colors);for(const l of r)this.drawRowForeground(l,t.meta.colors);for(const l of i)this.lastDrawnRows.push(l.y);this.drawCursor(t.meta)}getDebugState(){return{kind:this.kind,frameCount:this.frameCount,lastDrawnRows:[...this.lastDrawnRows]}}dispose(){this.mainCanvas.remove(),this.selectionCanvas.remove(),this.cursorCanvas.remove(),this.colorCache.clear(),this.fontCache.clear(),this.lastCursor=null,this.stopCursorBlink()}startCursorBlink(){this.cursorBlinkTimer||(this.cursorBlinkTimer=setInterval(()=>{this.cursorBlinkVisible=!this.cursorBlinkVisible,this.cursorCanvas.style.opacity=this.cursorBlinkVisible?"1":"0"},1e3))}stopCursorBlink(){this.cursorBlinkTimer&&(clearInterval(this.cursorBlinkTimer),this.cursorBlinkTimer=null),this.cursorBlinkVisible=!0,this.cursorCanvas.style.opacity="1"}resize(t,n){const s=Math.max(1,t),o=Math.max(1,n),i=Math.max(1,globalThis.devicePixelRatio??1),r=Math.max(1,Math.round(this.cellDimensions.width*i)),l=Math.max(1,Math.round(this.cellDimensions.height*i));if(this.cols===s&&this.rows===o&&this.dpr===i&&this.deviceCellWidth===r&&this.deviceCellHeight===l)return!1;this.cols=s,this.rows=o,this.dpr=i,this.deviceCellWidth=r,this.deviceCellHeight=l,this.deviceFontSize=this.fontSize*i,this.mainContext.font=`${this.deviceFontSize}px ${this.fontFamily}`;const a=this.mainContext.measureText("Mg|qyÅ");let d=a.fontBoundingBoxAscent,m=a.fontBoundingBoxDescent;Number.isFinite(d)&&Number.isFinite(m)&&d>0||(d=this.deviceFontSize*.8,m=this.deviceFontSize*.2),this.glyphBoxHeight=d+m,this.textTopGap=Math.round((l-this.glyphBoxHeight)/2),this.textBaselineY=Math.round(this.textTopGap+d);const g=s*r,x=o*l;for(const y of[this.mainCanvas,this.selectionCanvas,this.cursorCanvas])y.width=g,y.height=x,y.style.width=`${g/i}px`,y.style.height=`${x/i}px`;for(const y of[this.mainContext,this.selectionContext,this.cursorContext])y.setTransform(1,0,0,1,0,0),y.textBaseline="alphabetic",y.imageSmoothingEnabled=!1;return!0}drawSelection(t,n){if(this.selectionContext.clearRect(0,0,this.selectionCanvas.width,this.selectionCanvas.height),t.length!==0){this.selectionContext.fillStyle=n;for(const s of t)this.selectionContext.fillRect(s.x*this.deviceCellWidth,s.row*this.deviceCellHeight,s.width*this.deviceCellWidth,this.deviceCellHeight)}}drawRowBackground(t,n){const s=t.y*this.deviceCellHeight,o=this.cols*this.deviceCellWidth,i=this.toCss(n.background);this.mainContext.clearRect(0,s,o,this.deviceCellHeight),this.mainContext.fillStyle=i,this.mainContext.fillRect(0,s,o,this.deviceCellHeight);for(const r of t.cells){if(r.widthKind==="spacer-tail"||r.widthKind==="spacer-head")continue;const l=r.style.inverse?r.fgColor??n.foreground:r.bgColor??n.background;if(l.r!==n.background.r||l.g!==n.background.g||l.b!==n.background.b){const a=r.x*this.deviceCellWidth,d=r.widthKind==="wide"?this.deviceCellWidth*2:this.deviceCellWidth;this.mainContext.fillStyle=this.toCss(l),this.mainContext.fillRect(a,s,d,this.deviceCellHeight)}}}drawRowForeground(t,n){const s=t.y*this.deviceCellHeight,o=Math.max(1,Math.round(this.dpr));for(const i of t.cells){if(i.widthKind==="spacer-tail"||i.widthKind==="spacer-head"||!i.text||i.style.invisible)continue;const r=i.x*this.deviceCellWidth,l=i.style.inverse?i.bgColor??n.background:i.fgColor??n.foreground,a=i.widthKind==="wide"?this.deviceCellWidth*2:this.deviceCellWidth;this.mainContext.fillStyle=this.toCss(l);const d=i.codepoints.length===1&&Xe(i.codepoints[0])?i.codepoints[0]:null;d!==null?this.drawBlockElement(d,r,s,a,this.deviceCellHeight):(this.mainContext.font=this.resolveFont(i.style),this.mainContext.fillText(i.text,r,s+this.textBaselineY));const m=s+this.textTopGap,g=s+this.textTopGap+this.glyphBoxHeight;i.style.underline>0&&this.mainContext.fillRect(r,Math.min(Math.round(g-o),s+this.deviceCellHeight-o),Math.max(a-o,o),o),i.style.strikethrough&&this.mainContext.fillRect(r,Math.round(s+this.textTopGap+this.glyphBoxHeight/2),Math.max(a-o,o),o),i.style.overline&&this.mainContext.fillRect(r,Math.max(s,Math.round(m)),Math.max(a-o,o),o)}}drawBlockElement(t,n,s,o,i){const r=this.mainContext,l=C=>Math.round(o*C/8),a=C=>Math.round(i*C/8),d=(C,p,b,I)=>{r.fillRect(n+C,s+p,b-C,I-p)};if(t===9600){d(0,0,o,a(4));return}if(t>=9601&&t<=9608){d(0,a(8-(t-9600)),o,i);return}if(t>=9609&&t<=9615){d(0,0,l(9616-t),i);return}if(t===9616){d(l(4),0,o,i);return}const m=We.get(t);if(m!==void 0){const C=r.globalAlpha;r.globalAlpha=C*m,d(0,0,o,i),r.globalAlpha=C;return}if(t===9620){d(0,0,o,a(1));return}if(t===9621){d(l(7),0,o,i);return}const g=ze.get(t)??0,x=l(4),y=a(4);g&1&&d(0,0,x,y),g&2&&d(x,0,o,y),g&4&&d(0,y,x,i),g&8&&d(x,y,o,i)}drawCursor(t){const n=t.colors,s=t.cursor,o=this.lastCursor;if(this.cursorContext.clearRect(0,0,this.cursorCanvas.width,this.cursorCanvas.height),!s.visible||s.x===null||s.y===null){this.lastCursor=null,this.stopCursorBlink();return}const i=s.x*this.deviceCellWidth,r=s.y*this.deviceCellHeight,l=s.wideTail?this.deviceCellWidth*2:this.deviceCellWidth,a=Math.max(1,Math.round(this.dpr)),d=n.cursor??n.foreground,m=this.toCss(d);this.cursorContext.fillStyle=m,this.cursorContext.strokeStyle=m,this.cursorContext.globalAlpha=.7,this.cursorContext.fillRect(i,r+this.deviceCellHeight-2*a,Math.max(l-a,a),2*a),this.cursorContext.globalAlpha=1,this.startCursorBlink(),this.lastCursor={x:s.x,y:s.y,style:s.style},o&&(o.x!==this.lastCursor.x||o.y!==this.lastCursor.y||o.style!==this.lastCursor.style)&&this.lastDrawnRows.push(o.y)}resolveFont(t){const n=this.deviceFontSize,s=[t.italic?"italic":"normal",t.bold?"700":"400",`${n}px`,this.fontFamily].join("|"),o=this.fontCache.get(s);if(o)return o;const i=`${t.italic?"italic ":""}${t.bold?"700 ":""}${n}px ${this.fontFamily}`;return this.fontCache.set(s,i),i}toCss(t){const n=`${t.r},${t.g},${t.b}`,s=this.colorCache.get(n);if(s)return s;const o=Ve(t);return this.colorCache.set(n,o),o}}const W=/https?:\/\/[^\s"'`<>()[\]{}]+/g,Qe=/[.,;:!?]+$/;function Ze(e){let t="";const n=[],s=e.colChars.length;for(let o=0;o<s;o+=1){const i=e.colChars[o];if(!(i===null||i===""))for(let r=0;r<i.length;r+=1)t+=i[r],n.push(o)}return{text:t,colOf:n}}function Je(e){let t="";const n=[],s=[];for(let r=0;r<e.length;r+=1){const l=Ze(e[r]);for(let a=0;a<l.text.length;a+=1)t+=l.text[a],n.push(r),s.push(l.colOf[a])}const o=[];W.lastIndex=0;let i=W.exec(t);for(;i!==null;){const r=i[0].replace(Qe,"");if(r.length>0){const l=i.index,a=l+r.length-1;let d=l;for(let m=l;m<=a;m+=1)(m===a||n[m+1]!==n[m])&&(o.push({lineIndex:n[d],startCol:s[d],endCol:s[m],url:r}),d=m+1)}i=W.exec(t)}return o}const D=0,tn=-2,en=1,nn=2,sn=3,on=10,rn=11,ln=12,an=13,cn=14,dn=15,hn=16,un=17,mn=1,fn=2,pn=1,gn=2,yn=3,bn=4,xn=5,Sn=6,Cn=1,wn=2,Tn=3,En=4;function st(e){if(e.disposed||e.renderStateHandle===0)throw new Error("render state resources already disposed")}function Rn(e){switch(e){case 2:return"full";case 1:return"partial";default:return"clean"}}function vn(e){switch(e){case 0:return"bar";case 2:return"underline";case 3:return"block-hollow";default:return"block"}}function Mn(e){switch(e){case 1:return"wide";case 2:return"spacer-tail";case 3:return"spacer-head";default:return"narrow"}}function H(e,t){return{r:e.view().getUint8(t),g:e.view().getUint8(t+1),b:e.view().getUint8(t+2)}}function gt(e,t){const n=e.bindings.allocStruct("GhosttyColorRgb");try{const s=t(n.ptr);if(s===tn)return null;if(s!==D)throw new Error(`ghostty optional color read failed with result ${s}`);return H(e.bindings,n.ptr)}finally{n.free()}}function v(e,t){const n=e.bindings.allocU8();try{const s=t(n);if(typeof s=="number"&&s!==D)throw new Error(`ghostty bool read failed with result ${s}`);return e.bindings.readU8(n)!==0}finally{e.bindings.freeU8(n)}}function B(e,t){const n=e.bindings.allocBytes(2);try{const s=t(n);if(typeof s=="number"&&s!==D)throw new Error(`ghostty u16 read failed with result ${s}`);return e.bindings.view().getUint16(n,!0)}finally{e.bindings.freeBytes(n,2)}}function _n(e,t){const n=e.bindings.allocBytes(4);try{const s=t(n);if(typeof s=="number"&&s!==D)throw new Error(`ghostty u32 read failed with result ${s}`);return e.bindings.view().getUint32(n,!0)}finally{e.bindings.freeBytes(n,4)}}function tt(e,t){const n=e.bindings.allocBytes(4);try{const s=t(n);if(typeof s=="number"&&s!==D)throw new Error(`ghostty enum read failed with result ${s}`);return e.bindings.view().getInt32(n,!0)}finally{e.bindings.freeBytes(n,4)}}function yt(e,t){const n=e.bindings.allocBytes(8);try{const s=t(n);if(typeof s=="number"&&s!==D)throw new Error(`ghostty u64 read failed with result ${s}`);return e.bindings.readU64(n)}finally{e.bindings.freeBytes(n,8)}}function An(e){const t=e.bindings.allocStruct("GhosttyStyle");try{e.bindings.setField(t.view,"GhosttyStyle","size",e.bindings.typeSize("GhosttyStyle")),e.bindings.getRenderStateRowCellValue(e.rowCellsHandle,gn,t.ptr);const n=s=>e.bindings.field("GhosttyStyle",s).offset;return{bold:t.view.getUint8(n("bold"))!==0,italic:t.view.getUint8(n("italic"))!==0,faint:t.view.getUint8(n("faint"))!==0,blink:t.view.getUint8(n("blink"))!==0,inverse:t.view.getUint8(n("inverse"))!==0,invisible:t.view.getUint8(n("invisible"))!==0,strikethrough:t.view.getUint8(n("strikethrough"))!==0,overline:t.view.getUint8(n("overline"))!==0,underline:t.view.getInt32(n("underline"),!0)}}finally{t.free()}}function Dn(e){const t=_n(e,s=>e.bindings.getRenderStateRowCellValueResult(e.rowCellsHandle,yn,s));if(t===0)return[];const n=e.bindings.allocBytes(t*4);try{e.bindings.getRenderStateRowCellValue(e.rowCellsHandle,bn,n);const s=[];for(let o=0;o<t;o+=1)s.push(e.bindings.view().getUint32(n+o*4,!0));return s}finally{e.bindings.freeBytes(n,t*4)}}function Hn(e){if(e.length===0)return"";try{return String.fromCodePoint(...e)}catch{return""}}function Nn(e){let t="";for(const n of e)if(!(n.widthKind==="spacer-tail"||n.widthKind==="spacer-head")){if(n.text){t+=n.text;continue}n.widthKind==="narrow"&&(t+=" ")}return t}function kn(e){const t=e.bindings.allocStruct("GhosttyRenderStateColors");try{e.bindings.setField(t.view,"GhosttyRenderStateColors","size",e.bindings.typeSize("GhosttyRenderStateColors")),e.bindings.getRenderStateColors(e.renderStateHandle,t.ptr);const n=e.bindings.field("GhosttyRenderStateColors","palette").offset,s=[];for(let r=0;r<256;r+=1){const l=t.ptr+n+r*3;s.push(H(e.bindings,l))}const o=t.view.getUint8(e.bindings.field("GhosttyRenderStateColors","cursor_has_value").offset)!==0,i=v(e,r=>e.bindings.getRenderStateValueResult(e.renderStateHandle,cn,r));return{cols:B(e,r=>e.bindings.getRenderStateValueResult(e.renderStateHandle,en,r)),rows:B(e,r=>e.bindings.getRenderStateValueResult(e.renderStateHandle,nn,r)),dirty:Rn(tt(e,r=>e.bindings.getRenderStateValueResult(e.renderStateHandle,sn,r))),colors:{background:H(e.bindings,t.ptr+e.bindings.field("GhosttyRenderStateColors","background").offset),foreground:H(e.bindings,t.ptr+e.bindings.field("GhosttyRenderStateColors","foreground").offset),cursor:o?H(e.bindings,t.ptr+e.bindings.field("GhosttyRenderStateColors","cursor").offset):null,palette:s},cursor:{style:vn(tt(e,r=>e.bindings.getRenderStateValueResult(e.renderStateHandle,on,r))),visible:v(e,r=>e.bindings.getRenderStateValueResult(e.renderStateHandle,rn,r)),blinking:v(e,r=>e.bindings.getRenderStateValueResult(e.renderStateHandle,ln,r)),passwordInput:v(e,r=>e.bindings.getRenderStateValueResult(e.renderStateHandle,an,r)),x:i?B(e,r=>e.bindings.getRenderStateValueResult(e.renderStateHandle,dn,r)):null,y:i?B(e,r=>e.bindings.getRenderStateValueResult(e.renderStateHandle,hn,r)):null,wideTail:i?v(e,r=>e.bindings.getRenderStateValueResult(e.renderStateHandle,un,r)):!1}}}finally{t.free()}}function In(e,t){const n=yt(e,i=>e.bindings.getRenderStateRowValueResult(e.rowIteratorHandle,fn,i));e.bindings.bindRenderStateRowCells(e.rowIteratorHandle,e.rowCellsHandle);const s=[];let o=0;for(;e.bindings.nextRenderStateRowCell(e.rowCellsHandle);){const i=yt(e,d=>e.bindings.getRenderStateRowCellValueResult(e.rowCellsHandle,pn,d)),r=Dn(e),l=Mn(tt(e,d=>e.bindings.getRawCellValueResult(i,Tn,d))),a={x:o,text:Hn(r),codepoints:r,widthKind:l,hasText:v(e,d=>e.bindings.getRawCellValueResult(i,En,d)),style:An(e),fgColor:gt(e,d=>e.bindings.getRenderStateRowCellValueResult(e.rowCellsHandle,Sn,d)),bgColor:gt(e,d=>e.bindings.getRenderStateRowCellValueResult(e.rowCellsHandle,xn,d))};s.push(a),o+=1}return{y:t,dirty:v(e,i=>e.bindings.getRenderStateRowValueResult(e.rowIteratorHandle,mn,i)),wrap:v(e,i=>e.bindings.getRawRowValueResult(n,Cn,i)),wrapContinuation:v(e,i=>e.bindings.getRawRowValueResult(n,wn,i)),text:Nn(s),cells:s}}function Bn(e){return{bindings:e,renderStateHandle:e.createRenderState(),rowIteratorHandle:e.createRenderStateRowIterator(),rowCellsHandle:e.createRenderStateRowCells(),snapshotVersion:0,disposed:!1,cachedMeta:null}}function Ln(e,t){st(e),e.bindings.updateRenderState(e.renderStateHandle,t),e.bindings.bindRenderStateRowIterator(e.renderStateHandle,e.rowIteratorHandle),e.snapshotVersion+=1,e.cachedMeta=null}function $t(e){return st(e),e.cachedMeta||(e.cachedMeta=kn(e)),e.cachedMeta}function*Fn(e){st(e);const t=$t(e);e.bindings.bindRenderStateRowIterator(e.renderStateHandle,e.rowIteratorHandle);let n=0;for(;n<t.rows&&e.bindings.nextRenderStateRowIterator(e.rowIteratorHandle);)yield In(e,n),n+=1}function bt(e){e.disposed||(e.disposed=!0,e.rowCellsHandle!==0&&(e.bindings.freeRenderStateRowCells(e.rowCellsHandle),e.rowCellsHandle=0),e.rowIteratorHandle!==0&&(e.bindings.freeRenderStateRowIterator(e.rowIteratorHandle),e.rowIteratorHandle=0),e.renderStateHandle!==0&&(e.bindings.freeRenderState(e.renderStateHandle),e.renderStateHandle=0),e.cachedMeta=null)}const On={colChars:[],contentCols:0,wrappedToNext:!1};function $n(e){for(let t=e.length-1;t>=0;t-=1){const n=e[t];if(n!==null&&n!==""&&n!==" ")return t+1}return 0}function xt(e,t=!1){const n=[];for(const s of e){if(s.widthKind==="spacer-tail"){n.push(null);continue}if(s.widthKind==="spacer-head"){n.push("");continue}n.push(s.text||" ")}return{colChars:n,contentCols:$n(n),wrappedToNext:t}}function Kn(e,t){return Math.max(0,Math.min(Math.max(e.colChars.length-1,0),Math.floor(t)))}function it(e,t){let n=Kn(e,t);for(;n>0&&e.colChars[n]===null;)n-=1;return n}function X(e,t){let n=t;for(;n>0&&e.colChars[n]===null;)n-=1;return e.colChars[n]||""}function St(e,t){let n=t;for(;n+1<e.colChars.length&&e.colChars[n+1]===null;)n+=1;return n}function jn(e,t){return e.line<t.line?{start:e,end:t}:e.line>t.line?{start:t,end:e}:e.col<=t.col?{start:e,end:t}:{start:t,end:e}}function Yn(e,t,n){if(n.colChars.length===0)return{start:{line:e,col:0},end:{line:e,col:0}};const s=it(n,t),o=l=>/[\p{L}\p{N}_-]/u.test(l);if(!o(X(n,s)))return{start:{line:e,col:s},end:{line:e,col:s}};let i=s,r=s;for(;i>0&&o(X(n,i-1));)i-=1;for(;r+1<n.colChars.length&&o(X(n,r+1));)r+=1;return{start:{line:e,col:i},end:{line:e,col:r}}}function Kt(e,t){const n=Math.max(t.contentCols-1,0);return{start:{line:e,col:0},end:{line:e,col:n}}}function jt(e,t,n){const s=n(e.line);switch(t){case"word":return Yn(e.line,e.col,s);case"line":return Kt(e.line,s);default:{const o=it(s,e.col);return{start:{line:e.line,col:o},end:{line:e.line,col:o}}}}}function Yt(){return{anchor:null,focus:null,mode:"character"}}function Ct(e){return!!(e.anchor&&e.focus)}function Pn(){return Yt()}function Un(e,t,n){const s=jt(t,t.mode,n);return{anchor:s.start,focus:s.end,mode:t.mode}}function wt(e,t,n){return e.anchor?e.mode==="line"?{...e,focus:Kt(t.line,n(t.line)).end}:e.mode==="word"?{...e,focus:jt(t,"word",n).end}:{...e,focus:{line:t.line,col:it(n(t.line),t.col)}}:e}function Pt(e){return!e.anchor||!e.focus?null:jn(e.anchor,e.focus)}function Gn(e,t,n){const s=e.wrappedToNext?e.colChars.length-1:e.contentCols-1,o=Math.min(n,s);let i=Math.max(0,t);for(;i>0&&e.colChars[i]===null;)i-=1;if(i>o)return"";let r="";for(let l=i;l<=o;l+=1)r+=e.colChars[l]??"";return r}function Vn(e,t){const n=Pt(e);if(!n)return null;let s="";for(let o=n.start.line;o<=n.end.line;o+=1){const i=t(o),r=o===n.start.line?n.start.col:0,l=o===n.end.line?n.end.col:i.colChars.length-1;s+=Gn(i,r,l),o<n.end.line&&!i.wrappedToNext&&(s+=`
|
|
22
|
-
`)}return s}function zn(e,t,n,s){const o=Pt(e);if(!o)return[];const i=t+n-1,r=[];for(let l=Math.max(o.start.line,t);l<=Math.min(o.end.line,i);l+=1){const a=l-t;if(l===o.start.line&&l===o.end.line){const m=s==null?void 0:s(l),g=m?St(m,o.end.col):o.end.col;r.push({row:a,x:o.start.col,width:g-o.start.col+1});continue}if(l===o.start.line){const m=s?Math.max(s(l).colChars.length-o.start.col,0):Number.MAX_SAFE_INTEGER;r.push({row:a,x:o.start.col,width:m});continue}if(l===o.end.line){const m=s==null?void 0:s(l),g=m?St(m,o.end.col):o.end.col;r.push({row:a,x:0,width:g+1});continue}const d=s?s(l).colChars.length:Number.MAX_SAFE_INTEGER;r.push({row:a,x:0,width:d})}return r}const Tt=80,N=24,q=9,Q=17,Et=1.2,Wn=48,As="ghostty-official",$=9,K=1e3,j=1002,Y=1003,Z=1007,L=1047,F=1049,Xn=[$,K,j,Y],Rt=1,vt=3,Mt=2,qn=4,Qn=5;class Zn{constructor(t){this.content=t}translateToString(t){return t?this.content.replace(/\s+$/u,""):this.content}}class Jn{constructor(){h(this,"active",{baseY:0,viewportY:0,length:N,getLine:t=>{const n=t-this.active.viewportY,s=this.visibleLines[n];return typeof s=="string"?new Zn(s):null}});h(this,"visibleLines",Array.from({length:N},()=>""))}setViewport(t,n,s,o){this.active.viewportY=t,this.active.baseY=n,this.active.length=s,this.visibleLines=o}}const ts={deleteContentBackward:"Backspace",deleteContentForward:"Delete",insertLineBreak:"Enter",insertParagraph:"Enter"};function es(e){return!(e.key.length===1&&!e.ctrlKey&&!e.altKey&&!e.metaKey)}function ns(e,t){const n=e.slice(0,t).map(s=>s.text);for(;n.length<t;)n.push("");return n}function O(e){return Bt({shiftKey:!!e.shiftKey,ctrlKey:!!e.ctrlKey,altKey:!!e.altKey,metaKey:!!e.metaKey,getModifierState:()=>!1})}class ss{constructor(){h(this,"terminal",null)}activate(t){this.terminal=t instanceof U?t:null}fit(){const t=this.proposeDimensions();!this.terminal||!t||this.terminal.resize(t.cols,t.rows)}proposeDimensions(){var t;return((t=this.terminal)==null?void 0:t.measureSizeFromElement())??null}dispose(){this.terminal=null}}class U{constructor(t,n,s,o,i,r){h(this,"buffer",new Jn);h(this,"_core",{_renderService:{dimensions:{css:{cell:{width:q,height:Q}}}}});h(this,"options");h(this,"element",null);h(this,"textarea",null);h(this,"cols",Tt);h(this,"rows",N);h(this,"bindings");h(this,"terminalHandle");h(this,"keyEncoderHandle");h(this,"mouseEncoderHandle");h(this,"renderState");h(this,"dataListeners",new Set);h(this,"selectionListeners",new Set);h(this,"linkListeners",new Set);h(this,"linkCursorActive",!1);h(this,"lastNotifiedSelectionText",null);h(this,"addons",new Set);h(this,"screenElement",null);h(this,"renderer",null);h(this,"renderRaf",null);h(this,"forceFullNext",!1);h(this,"lastCursor",null);h(this,"disposed",!1);h(this,"disableStdin");h(this,"customKeyEventHandler",()=>!0);h(this,"imeIsComposing",!1);h(this,"lastCompositionCommit",null);h(this,"selectionState",Yt());h(this,"lineCache",new Map);h(this,"lastViewportOffset",0);h(this,"lastViewportRows",N);h(this,"lastRenderedRows",[]);h(this,"pointerDrag",{active:!1,moved:!1,mode:"character",lastClientX:null,lastClientY:null});h(this,"autoScrollTimer",null);h(this,"domEventDisposers",[]);h(this,"copyShortcutSuppressed",!1);h(this,"scrollbarThumb",null);h(this,"scrollbarFadeTimer",null);h(this,"scrollbarVisible",!1);h(this,"focused",!0);h(this,"pressedMouseButtons",new Set);h(this,"wheelPixelDelta",0);h(this,"mouseDragActive",!1);this.bindings=t,this.terminalHandle=n,this.keyEncoderHandle=s,this.mouseEncoderHandle=o,this.renderState=i,this.options=r,this.disableStdin=!!r.disableStdin}static async create(t){const n=await Ie(),s=n.createTerminal(Tt,N,t.scrollback);let o=0,i=0,r=null;try{return n.setTerminalTheme(s,t.theme),o=n.createKeyEncoder(),i=n.createMouseEncoder(),r=Bn(n),new U(n,s,o,i,r,t)}catch(l){throw r&&bt(r),o!==0&&n.freeKeyEncoder(o),i!==0&&n.freeMouseEncoder(i),n.freeTerminal(s),l}}open(t){if(this.disposed||this.element)return;const n=document.createElement("div");n.className="xterm",n.style.position="absolute",n.style.inset="0",n.style.overflow="hidden",n.style.width="100%",n.style.height="100%",n.style.backgroundColor=this.options.theme.background,n.style.color=this.options.theme.foreground,n.style.fontFamily=this.options.fontFamily,n.style.fontSize=`${this.options.fontSize}px`,n.style.lineHeight=String(this.options.lineHeight??Et);const s=document.createElement("div");s.className="xterm-viewport",s.style.width="100%",s.style.height="100%",s.style.overflow="hidden",s.style.position="relative";const o=document.createElement("div");o.className="xterm-screen",o.style.width="100%",o.style.height="100%",o.style.position="relative",o.style.userSelect="none",o.style.webkitUserSelect="none",o.style.backgroundColor=this.options.theme.background;const i=document.createElement("div");i.className="xterm-helper-textarea",i.setAttribute("aria-label","Terminal Input"),i.setAttribute("role","textbox"),i.setAttribute("contenteditable","true"),i.setAttribute("autocorrect","off"),i.setAttribute("autocapitalize","off"),i.setAttribute("spellcheck","false"),i.style.position="absolute",i.style.opacity="1",i.style.pointerEvents="none",i.style.left="0",i.style.top="0",i.style.minWidth="1px",i.style.minHeight="1px",i.style.whiteSpace="pre",i.style.border="0",i.style.padding="0",i.style.margin="0",i.style.color=this.options.theme.foreground,i.style.backgroundColor="transparent",i.style.caretColor="transparent",i.style.overflow="visible",i.style.outline="none",i.style.boxShadow="none",i.style.fontFamily=this.options.fontFamily,i.style.fontSize=`${this.options.fontSize}px`,i.style.userSelect="text",i.style.webkitUserSelect="text";const r=document.createElement("div");r.className="xterm-scrollbar-track",r.style.position="absolute",r.style.top="0",r.style.right="0",r.style.width="8px",r.style.height="100%",r.style.backgroundColor="transparent",r.style.pointerEvents="none";const l=document.createElement("div");l.className="xterm-scrollbar-thumb",l.style.position="absolute",l.style.top="0",l.style.right="0",l.style.width="6px",l.style.marginRight="1px",l.style.borderRadius="3px",l.style.backgroundColor="rgba(128, 128, 128, 0.5)",l.style.pointerEvents="none",l.style.transition="opacity 0.15s ease",l.style.opacity="0",r.appendChild(l),s.appendChild(o),n.appendChild(s),n.appendChild(i),n.appendChild(r),t.appendChild(n),this.element=n,this.screenElement=o,this.textarea=i,this.scrollbarThumb=l,this.renderer=new qe({screenElement:o,theme:this.options.theme,fontFamily:this.options.fontFamily,fontSize:this.options.fontSize}),this.syncInputState(),this.bindDomEvents(),this.updateCellDimensions();const a=this.measureSizeFromElement();a?this.resize(a.cols,a.rows):this.render()}loadAddon(t){t.activate(this),this.addons.add(t)}onData(t){return this.dataListeners.add(t),{dispose:()=>{this.dataListeners.delete(t)}}}attachCustomKeyEventHandler(t){this.customKeyEventHandler=t}onSelectionChange(t){return this.selectionListeners.add(t),{dispose:()=>{this.selectionListeners.delete(t)}}}onLinkActivated(t){return this.linkListeners.add(t),{dispose:()=>{this.linkListeners.delete(t)}}}hasSelection(){return Ct(this.selectionState)}getSelection(){return this.getSelectionText()??""}clearSelection(){this.disposed||this.clearSelectionState()}startTouchSelection(t,n,s="word"){return this.disposed?!1:this.beginSelectionAt(t,n,s)}updateTouchSelection(t,n){this.disposed||this.updateSelectionDrag(t,n)}endTouchSelection(){this.disposed||!this.pointerDrag.active||(this.stopAutoScroll(),this.pointerDrag.active=!1,this.render())}write(t){if(this.disposed)return;const n=this.isAltScreenActive();this.bindings.writeVt(this.terminalHandle,t);const s=this.isAltScreenActive();n&&!s&&this.clearMouseTrackingModes(),this.scheduleRender()}clearMouseTrackingModes(){if(!this.disposed){for(const t of Xn)this.bindings.setTerminalMode(this.terminalHandle,t,!1);this.bindings.resetMouseEncoder(this.mouseEncoderHandle),this.pressedMouseButtons.clear(),this.mouseDragActive=!1}}isAltScreenActive(){return this.isModeEnabled(L)||this.isModeEnabled(F)}reset(){this.disposed||(this.lineCache.clear(),this.clearSelectionState(!1),this.bindings.resetTerminal(this.terminalHandle),this.scheduleRender())}refresh(){this.disposed||this.render()}forceFullRepaint(){this.disposed||(this.forceFullNext=!0,this.renderRaf!==null&&(cancelAnimationFrame(this.renderRaf),this.renderRaf=null),this.render())}resize(t,n){if(this.disposed)return;const s=Math.max(2,Math.floor(t)),o=Math.max(2,Math.floor(n));this.cols=s,this.rows=o,this.clearSelectionState(!1),this.bindings.resizeTerminal(this.terminalHandle,s,o,this.cellDimensions()),this.bindings.resetMouseEncoder(this.mouseEncoderHandle),this.scheduleRender()}scrollLines(t){this.disposed||t===0||(this.bindings.scrollViewportDelta(this.terminalHandle,t),this.render())}scrollToTop(){this.disposed||(this.bindings.scrollViewportTop(this.terminalHandle),this.render())}scrollToBottom(){this.disposed||(this.bindings.scrollViewportBottom(this.terminalHandle),this.render())}exportModeSnapshot(){return{mouseX10:this.isModeEnabled($),mouseNormal:this.isModeEnabled(K),mouseButton:this.isModeEnabled(j),mouseAny:this.isModeEnabled(Y),mouseUtf8:this.isModeEnabled(1005),mouseSgr:this.isModeEnabled(1006),mouseSgrPixels:this.isModeEnabled(1016),mouseUrxvt:this.isModeEnabled(1015),altScroll:this.isModeEnabled(Z),altScreen1047:this.isModeEnabled(L),altScreen1049:this.isModeEnabled(F)}}restoreModeSnapshot(t){this.bindings.setTerminalMode(this.terminalHandle,$,t.mouseX10),this.bindings.setTerminalMode(this.terminalHandle,K,t.mouseNormal),this.bindings.setTerminalMode(this.terminalHandle,j,t.mouseButton),this.bindings.setTerminalMode(this.terminalHandle,Y,t.mouseAny),this.bindings.setTerminalMode(this.terminalHandle,1005,t.mouseUtf8),this.bindings.setTerminalMode(this.terminalHandle,1006,t.mouseSgr),this.bindings.setTerminalMode(this.terminalHandle,1016,t.mouseSgrPixels),this.bindings.setTerminalMode(this.terminalHandle,1015,t.mouseUrxvt),this.bindings.setTerminalMode(this.terminalHandle,Z,t.altScroll),this.bindings.setTerminalMode(this.terminalHandle,L,t.altScreen1047),this.bindings.setTerminalMode(this.terminalHandle,F,t.altScreen1049),this.bindings.resetMouseEncoder(this.mouseEncoderHandle)}handleViewportGesture(t){if(this.disposed||t.deltaY===0)return!1;const n=this.gestureToLines(t);if(n===0)return!1;const s=this.getInputRoutingState();if(s.mouseReporting){const o=n<0?qn:Qn;let i=!1;for(let r=0;r<Math.abs(n);r+=1)i=this.emitMouseInput({action:"press",button:o,clientX:t.clientX,clientY:t.clientY,mods:O(t),anyButtonPressed:this.pressedMouseButtons.size>0})||i;return i}return s.altScroll?this.emitAltScrollInput(n):(this.scrollLines(n),!0)}paste(t){if(this.disposed||this.disableStdin||!t)return;const n=this.bindings.encodePaste(this.terminalHandle,t);n&&this.emitData(n)}focus(){var t;(t=this.textarea)==null||t.focus({preventScroll:!0})}getCursorViewportRect(){if(this.disposed)return null;const t=this.screenElement,n=this.lastCursor;if(!t||!n||!n.visible||n.y===null||this.textarea===null||document.activeElement!==this.textarea)return null;const{height:s}=this.cellDimensions();if(s<=0)return null;const o=t.getBoundingClientRect().top+n.y*s;return{top:o,bottom:o+s}}getRendererKind(){var t;return((t=this.renderer)==null?void 0:t.kind)??"unknown"}setTheme(t){var n;this.bindings.setTerminalTheme(this.terminalHandle,t),this.options.theme=t,this.element&&(this.element.style.backgroundColor=t.background,this.element.style.color=t.foreground),this.screenElement&&(this.screenElement.style.backgroundColor=t.background),(n=this.renderer)==null||n.setTheme(t),this.scheduleRender()}setDisableStdin(t){this.disableStdin=t,this.syncInputState()}measureSizeFromElement(){const t=this.element;if(!t)return null;const n=t.getBoundingClientRect(),{width:s,height:o}=this.cellDimensions();return n.width===0||n.height===0||s<=0||o<=0?null:{cols:Math.max(2,Math.floor(n.width/s)),rows:Math.max(2,Math.floor(n.height/o))}}dispose(){var t,n;if(!this.disposed){this.disposed=!0,this.renderRaf!==null&&(cancelAnimationFrame(this.renderRaf),this.renderRaf=null),this.stopAutoScroll(),this.updateSelectionTextProbe(null),this.clearDomEventListeners(),this.scrollbarFadeTimer&&(clearTimeout(this.scrollbarFadeTimer),this.scrollbarFadeTimer=null);for(const s of this.addons)s.dispose();this.addons.clear(),(t=this.renderer)==null||t.dispose(),this.renderer=null,(n=this.element)==null||n.remove(),this.element=null,this.screenElement=null,this.textarea=null,this.scrollbarThumb=null,bt(this.renderState),this.bindings.freeMouseEncoder(this.mouseEncoderHandle),this.bindings.freeKeyEncoder(this.keyEncoderHandle),this.bindings.freeTerminal(this.terminalHandle)}}cellDimensions(){return this._core._renderService.dimensions.css.cell}syncInputState(){this.textarea&&(this.textarea.readOnly=this.disableStdin,this.textarea.tabIndex=this.disableStdin?-1:0,this.disableStdin&&document.activeElement===this.textarea&&this.textarea.blur())}bindDomEvents(){const t=this.element,n=this.textarea;if(!t||!n)return;t.addEventListener("click",()=>{this.disableStdin||this.focus()});const s=this.screenElement??t;s.addEventListener("mousedown",i=>{if(i instanceof MouseEvent){if(this.showScrollbarTransient(),this.disableStdin||this.focus(),this.getInputRoutingState().mouseReporting){const r=this.mouseButtonFromEvent(i);if(r===null)return;this.clearSelectionState(),this.pressedMouseButtons.add(r),this.mouseDragActive=!0,this.emitMouseInput({action:"press",button:r,clientX:i.clientX,clientY:i.clientY,mods:O(i),anyButtonPressed:!0}),i.preventDefault();return}if(i.button===0&&ft(i)){const r=this.linkAtClient(i.clientX,i.clientY);if(r){this.emitLinkActivated(r),i.preventDefault();return}}i.button===0&&(this.mouseDragActive=!0,this.beginPointerSelection(i),i.preventDefault())}}),s.addEventListener("mousemove",i=>{if(!(!(i instanceof MouseEvent)||this.mouseDragActive)){if(this.showScrollbarTransient(),this.getInputRoutingState().mouseReporting){this.setLinkCursor(!1);return}this.setLinkCursor(ft(i)&&this.linkAtClient(i.clientX,i.clientY)!==null)}}),s.addEventListener("mouseleave",()=>{this.setLinkCursor(!1)}),t.addEventListener("wheel",i=>{this.showScrollbarTransient(),this.handleViewportGesture({source:"wheel",deltaY:i.deltaY,deltaMode:i.deltaMode,clientX:i.clientX,clientY:i.clientY,shiftKey:i.shiftKey,ctrlKey:i.ctrlKey,altKey:i.altKey,metaKey:i.metaKey})&&i.preventDefault()},{passive:!1});const o=typeof window<"u"&&typeof window.addEventListener=="function"?window:null;if(o){const i=l=>{if(this.mouseDragActive){if(this.getInputRoutingState().mouseReporting){this.emitMouseInput({action:"motion",button:this.mouseButtonFromButtons(l.buttons),clientX:l.clientX,clientY:l.clientY,mods:O(l),anyButtonPressed:this.pressedMouseButtons.size>0||l.buttons>0});return}this.updatePointerSelection(l)}},r=l=>{if(this.mouseDragActive){if(this.mouseDragActive=!1,this.getInputRoutingState().mouseReporting){const a=this.mouseButtonFromEvent(l);a!==null&&this.pressedMouseButtons.delete(a),this.emitMouseInput({action:"release",button:a,clientX:l.clientX,clientY:l.clientY,mods:O(l),anyButtonPressed:this.pressedMouseButtons.size>0});return}this.finishPointerSelection(l)}};o.addEventListener("mousemove",i),o.addEventListener("mouseup",r),this.domEventDisposers.push(()=>{o.removeEventListener("mousemove",i),o.removeEventListener("mouseup",r)})}n.addEventListener("keydown",i=>{const r=this.getSelectionText();if(r&&Be(i)){i.preventDefault(),Le(r).catch(()=>{}),this.clearSelectionState(),this.copyShortcutSuppressed=!0,this.clearTextarea();return}if(!this.customKeyEventHandler(i)||this.disableStdin||this.imeIsComposing||i.keyCode===229||Fe(i)||!es(i))return;const l=this.encodeKeyboardEvent(i,i.repeat?"repeat":"press");l&&(i.preventDefault(),this.emitData(l),this.clearTextarea())}),n.addEventListener("keyup",i=>{if(this.copyShortcutSuppressed){const l=i.key.toLowerCase();if(l==="c"){i.preventDefault();return}if(l==="control"||l==="meta"||l==="os"){this.copyShortcutSuppressed=!1,i.preventDefault();return}}if(this.disableStdin||this.imeIsComposing)return;const r=this.encodeKeyboardEvent(i,"release");r&&(i.preventDefault(),this.emitData(r),this.clearTextarea())}),n.addEventListener("compositionstart",()=>{this.imeIsComposing=!0,this.lastCompositionCommit=null,this.syncTextareaPositionToCursor()}),n.addEventListener("compositionupdate",()=>{this.syncTextareaPositionToCursor()}),n.addEventListener("compositionend",i=>{this.imeIsComposing=!1;const r=i.data??"";r&&(this.lastCompositionCommit={data:r,at:Date.now()},this.emitData(r),this.clearTextarea())}),n.addEventListener("beforeinput",i=>{if(this.disableStdin||i.inputType==="insertFromPaste"||i.isComposing||this.imeIsComposing)return;const r=ts[i.inputType??""];if(r){i.preventDefault();const d=this.encodeSyntheticKey(r);d&&this.emitData(d),this.clearTextarea();return}const l=i.data??"";if(!l)return;const a=this.lastCompositionCommit;if(a&&a.data===l&&Date.now()-a.at<40){this.lastCompositionCommit=null,i.preventDefault(),this.clearTextarea();return}this.lastCompositionCommit=null,i.preventDefault(),this.emitData(l),this.clearTextarea()}),n.addEventListener("paste",i=>{var l;if(this.disableStdin)return;const r=((l=i.clipboardData)==null?void 0:l.getData("text/plain"))??"";r&&(i.preventDefault(),this.paste(r),this.clearTextarea())}),n.addEventListener("copy",i=>{const r=this.getSelectionText();r&&Oe(i,r)}),n.addEventListener("input",()=>{if(this.disableStdin||this.imeIsComposing)return;const i=n.textContent??"";if(!i){this.clearTextarea();return}const r=this.lastCompositionCommit;if(r&&r.data===i&&Date.now()-r.at<40){this.lastCompositionCommit=null,this.clearTextarea();return}this.lastCompositionCommit=null,this.emitData(i),this.clearTextarea()})}encodeKeyboardEvent(t,n){const s=pt(t.code);if(s===0)return null;const o=t.key.length===1&&!t.ctrlKey&&!t.metaKey?t.key:null;return this.bindings.encodeKeyEvent(this.keyEncoderHandle,this.terminalHandle,{action:n,keyCode:s,mods:Bt(t),composing:t.isComposing,utf8:o,unshiftedCodepoint:$e(t.code)})}encodeSyntheticKey(t){const n={code:t,key:t,shiftKey:!1,ctrlKey:!1,altKey:!1,metaKey:!1,repeat:!1,isComposing:!1,getModifierState:()=>!1};return this.encodeKeyboardEvent(n,"press")}getInputRoutingState(){const t=this.isModeEnabled($)||this.isModeEnabled(K)||this.isModeEnabled(j)||this.isModeEnabled(Y),n=this.isModeEnabled(L)||this.isModeEnabled(F);return{mouseReporting:t,altScroll:!t&&n&&this.isModeEnabled(Z)}}gestureToLines(t){const n=this.cellDimensions().height||Q;if(t.source==="wheel"){if(t.deltaMode===1)return this.wheelPixelDelta=0,t.deltaY>0?Math.ceil(t.deltaY):Math.floor(t.deltaY);if(t.deltaMode===2){this.wheelPixelDelta=0;const o=Math.max(1,this.rows),i=t.deltaY*o;return i>0?Math.ceil(i):Math.floor(i)}this.wheelPixelDelta+=t.deltaY;const s=this.wheelPixelDelta>0?Math.floor(this.wheelPixelDelta/n):Math.ceil(this.wheelPixelDelta/n);return s!==0&&(this.wheelPixelDelta-=s*n),s}return t.deltaY>0?Math.ceil(t.deltaY/n):Math.floor(t.deltaY/n)}isModeEnabled(t){return this.bindings.isTerminalModeEnabled(this.terminalHandle,t)}mouseButtonFromEvent(t){switch(t.button){case 0:return Rt;case 1:return vt;case 2:return Mt;default:return null}}mouseButtonFromButtons(t){return t&1?Rt:t&4?vt:t&2?Mt:null}pointerPositionFromClient(t,n){var r;const s=(r=this.screenElement)==null?void 0:r.getBoundingClientRect();if(!s)return null;const o=Math.max(1,s.width),i=Math.max(1,s.height);return{x:Math.max(0,Math.min(o-1,t-s.left)),y:Math.max(0,Math.min(i-1,n-s.top))}}emitMouseInput(t){var r;if(this.disableStdin)return!1;const n=this.pointerPositionFromClient(t.clientX,t.clientY);if(!n)return!1;const s=this.cellDimensions(),o=(r=this.screenElement)==null?void 0:r.getBoundingClientRect();if(!o)return!1;const i=this.bindings.encodeMouseEvent(this.mouseEncoderHandle,this.terminalHandle,{action:t.action,button:t.button,mods:t.mods,x:n.x,y:n.y,anyButtonPressed:t.anyButtonPressed,screenWidth:Math.max(1,Math.round(o.width)),screenHeight:Math.max(1,Math.round(o.height)),cellWidth:Math.max(1,Math.round(s.width||q)),cellHeight:Math.max(1,Math.round(s.height||Q))});return i?(this.emitData(i),!0):!1}emitAltScrollInput(t){const n=pt(t<0?"ArrowUp":"ArrowDown");if(n===0)return!1;let s=!1;for(let o=0;o<Math.abs(t);o+=1){const i=this.bindings.encodeKeyEvent(this.keyEncoderHandle,this.terminalHandle,{action:"press",keyCode:n,mods:0,composing:!1,utf8:null,unshiftedCodepoint:null});i&&(this.emitData(i),s=!0)}return s}emitData(t){for(const n of this.dataListeners)n(t)}clearTextarea(){this.textarea&&(this.textarea.textContent="")}syncTextareaPositionToCursor(){const t=this.textarea,n=this.screenElement;if(!t||!n)return;const{width:s,height:o}=this.cellDimensions();if(s<=0||o<=0||!this.lastCursor)return;const i=this.lastCursor.x??0,r=this.lastCursor.y??0,l=i*s,a=r*o;t.style.left=`${l}px`,t.style.top=`${a}px`,t.style.width=`${Math.max(1,s)}px`,t.style.height=`${Math.max(1,o)}px`,t.style.lineHeight=`${o}px`,t.style.fontFamily=this.options.fontFamily,t.style.fontSize=`${this.options.fontSize}px`}scheduleRender(){this.renderRaf===null&&(this.renderRaf=requestAnimationFrame(()=>{this.renderRaf=null,this.render()}))}render(){if(this.disposed||!this.screenElement||!this.renderer)return;const t=this.forceFullNext;this.forceFullNext=!1;const n=this.bindings.readScrollbar(this.terminalHandle),s=Math.max(1,n.len||this.rows);Ln(this.renderState,this.terminalHandle);const o=$t(this.renderState),i=Array.from(Fn(this.renderState));this.lastCursor=o.cursor,this.cols=Math.max(2,o.cols),this.rows=Math.max(2,o.rows||s),this.lastViewportOffset=n.offset,this.lastViewportRows=this.rows,this.lastRenderedRows=i;for(const m of i)this.lineCache.set(n.offset+m.y,xt(m.cells,m.wrap));const r=zn(this.selectionState,this.lastViewportOffset,this.lastViewportRows,m=>this.getLineModel(m)),l=this.getSelectionText();this.renderer.render({meta:o,rows:i,cellDimensions:this.cellDimensions(),selectionRects:r,selectionColor:this.options.theme.selectionBackground,forceFull:t});const a=ns(i,this.rows),d=Math.max(0,n.total-n.len);this.buffer.setViewport(n.offset,d,n.total,a),this.updateSelectionTextProbe(l),this.updateScrollbar(n)}updateScrollbar(t){var a;const n=this.scrollbarThumb;if(!n)return;const s=((a=this.screenElement)==null?void 0:a.clientHeight)??0;if(s===0||t.total<=t.len){n.style.opacity="0";return}const o=t.len/t.total,i=Math.max(20,o*s),l=t.offset/Math.max(1,t.total-t.len)*(s-i);n.style.height=`${i}px`,n.style.transform=`translateY(${l}px)`,n.style.opacity=this.scrollbarVisible?"1":"0"}showScrollbarTransient(){!this.focused||!this.scrollbarThumb||(this.scrollbarVisible=!0,this.scrollbarThumb.style.opacity="1",this.scrollbarFadeTimer&&clearTimeout(this.scrollbarFadeTimer),this.scrollbarFadeTimer=setTimeout(()=>{this.scrollbarVisible=!1,this.scrollbarThumb&&(this.scrollbarThumb.style.opacity="0")},3e3))}setFocused(t){this.focused=t,t||(this.scrollbarVisible=!1,this.scrollbarThumb&&(this.scrollbarThumb.style.opacity="0"),this.scrollbarFadeTimer&&(clearTimeout(this.scrollbarFadeTimer),this.scrollbarFadeTimer=null))}updateCellDimensions(){if(!this.element)return;const t=document.createElement("span");t.textContent="WWWWWWWWWW",t.style.position="absolute",t.style.visibility="hidden",t.style.whiteSpace="pre",t.style.fontFamily=this.options.fontFamily,t.style.fontSize=`${this.options.fontSize}px`,this.element.appendChild(t);const n=t.getBoundingClientRect();t.remove();const s=Math.max(1,globalThis.devicePixelRatio??1),o=n.width>0?n.width/10:q,i=this.options.fontSize*(this.options.lineHeight??Et);this._core._renderService.dimensions.css.cell.width=Math.max(1,Math.round(o*s))/s,this._core._renderService.dimensions.css.cell.height=Math.max(1,Math.round(i*s))/s}clearSelectionState(t=!0){this.selectionState=Pn(),this.pressedMouseButtons.clear(),this.wheelPixelDelta=0,this.pointerDrag={active:!1,moved:!1,mode:"character",lastClientX:null,lastClientY:null},this.copyShortcutSuppressed=!1,this.stopAutoScroll(),this.updateSelectionTextProbe(null),t&&this.screenElement&&this.renderer&&this.render()}beginSelectionAt(t,n,s){const o=this.hitTest(t,n);return o?(this.pointerDrag={active:!0,moved:!1,mode:s,lastClientX:t,lastClientY:n},this.selectionState=Un(this.selectionState,{...o,mode:s},i=>this.getLineModel(i)),this.updateAutoScroll(),this.render(),!0):!1}updateSelectionDrag(t,n){if(!this.pointerDrag.active)return;const s=this.hitTest(t,n);this.pointerDrag.lastClientX=t,this.pointerDrag.lastClientY=n,s&&(this.pointerDrag.moved=!0,this.selectionState=wt(this.selectionState,s,o=>this.getLineModel(o)),this.render()),this.updateAutoScroll()}beginPointerSelection(t){this.beginSelectionAt(t.clientX,t.clientY,this.selectionModeFromClickDetail(t.detail))}updatePointerSelection(t){this.updateSelectionDrag(t.clientX,t.clientY)}finishPointerSelection(t){var s,o,i,r;if(!this.pointerDrag.active||t.button!==0)return;this.pointerDrag.lastClientX=t.clientX,this.pointerDrag.lastClientY=t.clientY,this.stopAutoScroll();const n=this.pointerDrag.mode==="character"&&!this.pointerDrag.moved&&((s=this.selectionState.anchor)==null?void 0:s.line)===((o=this.selectionState.focus)==null?void 0:o.line)&&((i=this.selectionState.anchor)==null?void 0:i.col)===((r=this.selectionState.focus)==null?void 0:r.col);if(this.pointerDrag.active=!1,n){this.clearSelectionState();return}this.render()}selectionModeFromClickDetail(t){return t>=3?"line":t===2?"word":"character"}hitTest(t,n){var x;const s=(x=this.screenElement)==null?void 0:x.getBoundingClientRect();if(!s)return null;const{width:o,height:i}=this.cellDimensions();if(o<=0||i<=0)return null;const r=t-s.left,l=n-s.top,a=Math.max(this.cols-1,0),d=Math.max(this.lastViewportRows-1,0),m=Math.max(0,Math.min(a,Math.floor(r/o))),g=Math.max(0,Math.min(d,Math.floor(l/i)));return{line:this.lastViewportOffset+g,col:m}}getLineModel(t){const n=this.lineCache.get(t);if(n)return n;const s=t-this.lastViewportOffset,o=this.lastRenderedRows[s];return o?xt(o.cells,o.wrap):On}emitLinkActivated(t){for(const n of this.linkListeners)n(t)}setLinkCursor(t){this.linkCursorActive!==t&&(this.linkCursorActive=t,this.screenElement&&(this.screenElement.style.cursor=t?"pointer":""))}linkAtClient(t,n){const s=this.hitTest(t,n);return s?this.linkAtPoint(s.line,s.col):null}linkAtPoint(t,n){if(this.getLineModel(t).colChars.length===0)return null;let s=t;for(;this.getLineModel(s-1).wrappedToNext;)s-=1;let o=t;for(;this.getLineModel(o).wrappedToNext;)o+=1;const i=[];for(let l=s;l<=o;l+=1)i.push(this.getLineModel(l));const r=t-s;for(const l of Je(i))if(l.lineIndex===r&&n>=l.startCol&&n<=l.endCol)return l.url;return null}getSelectionText(){return Ct(this.selectionState)?Vn(this.selectionState,t=>this.getLineModel(t)):null}updateSelectionTextProbe(t){if(globalThis.__tmexE2eTerminalSelectionText=t,t!==this.lastNotifiedSelectionText){this.lastNotifiedSelectionText=t;for(const n of this.selectionListeners)n(t)}}updateAutoScroll(){var s;if(!this.pointerDrag.active||this.pointerDrag.lastClientY===null){this.stopAutoScroll();return}const t=(s=this.screenElement)==null?void 0:s.getBoundingClientRect();if(!t){this.stopAutoScroll();return}if(!(this.pointerDrag.lastClientY<t.top||this.pointerDrag.lastClientY>t.bottom)){this.stopAutoScroll();return}this.autoScrollTimer===null&&(this.autoScrollTimer=setInterval(()=>{this.stepAutoScroll()},Wn))}stepAutoScroll(){var o;if(!this.pointerDrag.active||this.pointerDrag.lastClientX===null||this.pointerDrag.lastClientY===null){this.stopAutoScroll();return}const t=(o=this.screenElement)==null?void 0:o.getBoundingClientRect();if(!t){this.stopAutoScroll();return}let n=0;if(this.pointerDrag.lastClientY<t.top?n=-1:this.pointerDrag.lastClientY>t.bottom&&(n=1),n===0){this.stopAutoScroll();return}this.bindings.scrollViewportDelta(this.terminalHandle,n),this.render();const s=this.hitTest(this.pointerDrag.lastClientX,this.pointerDrag.lastClientY);s&&(this.selectionState=wt(this.selectionState,s,i=>this.getLineModel(i)),this.pointerDrag.moved=!0,this.render())}stopAutoScroll(){this.autoScrollTimer!==null&&(clearInterval(this.autoScrollTimer),this.autoScrollTimer=null)}clearDomEventListeners(){for(;this.domEventDisposers.length>0;){const t=this.domEventDisposers.pop();t==null||t()}}}async function is(e){return U.create(e)}const os=new Set(["Control","Shift","Alt","Meta","CapsLock","NumLock","ScrollLock","Dead","Unidentified","OS","ContextMenu","Fn","FnLock","Hyper","Super"]),rs={Enter:{label:"Enter",raw:"\r"},Tab:{label:"Tab",raw:" "},Escape:{label:"ESC",raw:"\x1B"},Backspace:{label:"Backspace",raw:"\b"}," ":{label:"Space",raw:" "},ArrowUp:{label:"↑",csiFinal:"A"},ArrowDown:{label:"↓",csiFinal:"B"},ArrowRight:{label:"→",csiFinal:"C"},ArrowLeft:{label:"←",csiFinal:"D"},Home:{label:"Home",csiFinal:"H"},End:{label:"End",csiFinal:"F"},Delete:{label:"Delete",csiNum:3},Insert:{label:"Insert",csiNum:2},PageUp:{label:"PgUp",csiNum:5},PageDown:{label:"PgDn",csiNum:6}},ls={F1:"\x1BOP",F2:"\x1BOQ",F3:"\x1BOR",F4:"\x1BOS",F5:"\x1B[15~",F6:"\x1B[17~",F7:"\x1B[18~",F8:"\x1B[19~",F9:"\x1B[20~",F10:"\x1B[21~",F11:"\x1B[23~",F12:"\x1B[24~"},as={"[":"\x1B","\\":"","]":"","^":"",_:"","@":"\0","?":""};function cs(e){return 1+(e.shiftKey?1:0)+(e.altKey?2:0)+(e.ctrlKey?4:0)+(e.metaKey?8:0)}function ds(e){const t=[];return e.ctrlKey&&t.push("CTRL"),e.altKey&&t.push("ALT"),e.metaKey&&t.push("CMD"),e.shiftKey&&t.push("SHIFT"),t.length?`${t.join("-")}-`:""}function hs(e){const t=e.key;if(!t||os.has(t))return null;const n=cs(e),s=n!==1,o=ds(e);if(t==="Tab"&&e.shiftKey&&!e.ctrlKey&&!e.altKey&&!e.metaKey)return{label:"SHIFT-Tab",payload:"\x1B[Z"};if(t==="Enter"&&e.shiftKey&&!e.ctrlKey&&!e.altKey&&!e.metaKey)return{label:"SHIFT-Enter",payload:"\x1B[13;2u"};if(e.ctrlKey&&!e.altKey&&!e.metaKey&&/^[a-zA-Z]$/.test(t)){const l=t.toUpperCase();return{label:`CTRL-${l}`,payload:String.fromCharCode(l.charCodeAt(0)-64)}}const i=ls[t];if(i)return{label:o+t,payload:i};const r=rs[t];if(r){if("raw"in r){const a=e.altKey?`\x1B${r.raw}`:r.raw;return{label:o+r.label,payload:a}}if("csiFinal"in r){const a=s?`\x1B[1;${n}${r.csiFinal}`:`\x1B[${r.csiFinal}`;return{label:o+r.label,payload:a}}const l=s?`\x1B[${r.csiNum};${n}~`:`\x1B[${r.csiNum}~`;return{label:o+r.label,payload:l}}if(t.length===1){if(e.altKey&&!e.ctrlKey&&!e.metaKey)return{label:`ALT-${t.toUpperCase()}`,payload:`\x1B${t}`};if(e.ctrlKey){const l=as[t];return l!==void 0?{label:o+t,payload:l}:null}return{label:t,payload:t}}return null}function Ut(e){return e.replace(/\\(x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|.)/g,(t,n)=>{if(n[0]==="x"&&n.length===3||n[0]==="u"&&n.length===5)return String.fromCharCode(Number.parseInt(n.slice(1),16));switch(n){case"r":return"\r";case"n":return`
|
|
22
|
+
`)}return s}function zn(e,t,n,s){const o=Pt(e);if(!o)return[];const i=t+n-1,r=[];for(let l=Math.max(o.start.line,t);l<=Math.min(o.end.line,i);l+=1){const a=l-t;if(l===o.start.line&&l===o.end.line){const m=s==null?void 0:s(l),g=m?St(m,o.end.col):o.end.col;r.push({row:a,x:o.start.col,width:g-o.start.col+1});continue}if(l===o.start.line){const m=s?Math.max(s(l).colChars.length-o.start.col,0):Number.MAX_SAFE_INTEGER;r.push({row:a,x:o.start.col,width:m});continue}if(l===o.end.line){const m=s==null?void 0:s(l),g=m?St(m,o.end.col):o.end.col;r.push({row:a,x:0,width:g+1});continue}const d=s?s(l).colChars.length:Number.MAX_SAFE_INTEGER;r.push({row:a,x:0,width:d})}return r}const Tt=80,N=24,q=9,Q=17,Et=1.2,Wn=48,As="ghostty-official",$=9,K=1e3,j=1002,Y=1003,Z=1007,L=1047,F=1049,Xn=[$,K,j,Y],Rt=1,vt=3,Mt=2,qn=4,Qn=5;class Zn{constructor(t){this.content=t}translateToString(t){return t?this.content.replace(/\s+$/u,""):this.content}}class Jn{constructor(){h(this,"active",{baseY:0,viewportY:0,length:N,getLine:t=>{const n=t-this.active.viewportY,s=this.visibleLines[n];return typeof s=="string"?new Zn(s):null}});h(this,"visibleLines",Array.from({length:N},()=>""))}setViewport(t,n,s,o){this.active.viewportY=t,this.active.baseY=n,this.active.length=s,this.visibleLines=o}}const ts={deleteContentBackward:"Backspace",deleteContentForward:"Delete",insertLineBreak:"Enter",insertParagraph:"Enter"};function es(e){return!(e.key.length===1&&!e.ctrlKey&&!e.altKey&&!e.metaKey)}function ns(e,t){const n=e.slice(0,t).map(s=>s.text);for(;n.length<t;)n.push("");return n}function O(e){return Bt({shiftKey:!!e.shiftKey,ctrlKey:!!e.ctrlKey,altKey:!!e.altKey,metaKey:!!e.metaKey,getModifierState:()=>!1})}class ss{constructor(){h(this,"terminal",null)}activate(t){this.terminal=t instanceof U?t:null}fit(){const t=this.proposeDimensions();!this.terminal||!t||this.terminal.resize(t.cols,t.rows)}proposeDimensions(){var t;return((t=this.terminal)==null?void 0:t.measureSizeFromElement())??null}dispose(){this.terminal=null}}class U{constructor(t,n,s,o,i,r){h(this,"buffer",new Jn);h(this,"_core",{_renderService:{dimensions:{css:{cell:{width:q,height:Q}}}}});h(this,"options");h(this,"element",null);h(this,"textarea",null);h(this,"cols",Tt);h(this,"rows",N);h(this,"bindings");h(this,"terminalHandle");h(this,"keyEncoderHandle");h(this,"mouseEncoderHandle");h(this,"renderState");h(this,"dataListeners",new Set);h(this,"selectionListeners",new Set);h(this,"linkListeners",new Set);h(this,"linkCursorActive",!1);h(this,"lastNotifiedSelectionText",null);h(this,"addons",new Set);h(this,"screenElement",null);h(this,"renderer",null);h(this,"renderRaf",null);h(this,"forceFullNext",!1);h(this,"lastCursor",null);h(this,"disposed",!1);h(this,"disableStdin");h(this,"customKeyEventHandler",()=>!0);h(this,"imeIsComposing",!1);h(this,"lastCompositionCommit",null);h(this,"selectionState",Yt());h(this,"lineCache",new Map);h(this,"lastViewportOffset",0);h(this,"lastViewportRows",N);h(this,"lastRenderedRows",[]);h(this,"pointerDrag",{active:!1,moved:!1,mode:"character",lastClientX:null,lastClientY:null});h(this,"autoScrollTimer",null);h(this,"domEventDisposers",[]);h(this,"copyShortcutSuppressed",!1);h(this,"scrollbarThumb",null);h(this,"scrollbarFadeTimer",null);h(this,"scrollbarVisible",!1);h(this,"focused",!0);h(this,"pressedMouseButtons",new Set);h(this,"wheelPixelDelta",0);h(this,"mouseDragActive",!1);this.bindings=t,this.terminalHandle=n,this.keyEncoderHandle=s,this.mouseEncoderHandle=o,this.renderState=i,this.options=r,this.disableStdin=!!r.disableStdin}static async create(t){const n=await Ie(),s=n.createTerminal(Tt,N,t.scrollback);let o=0,i=0,r=null;try{return n.setTerminalTheme(s,t.theme),o=n.createKeyEncoder(),i=n.createMouseEncoder(),r=Bn(n),new U(n,s,o,i,r,t)}catch(l){throw r&&bt(r),o!==0&&n.freeKeyEncoder(o),i!==0&&n.freeMouseEncoder(i),n.freeTerminal(s),l}}open(t){if(this.disposed||this.element)return;const n=document.createElement("div");n.className="xterm",n.style.position="absolute",n.style.inset="0",n.style.overflow="hidden",n.style.width="100%",n.style.height="100%",n.style.backgroundColor=this.options.theme.background,n.style.color=this.options.theme.foreground,n.style.fontFamily=this.options.fontFamily,n.style.fontSize=`${this.options.fontSize}px`,n.style.lineHeight=String(this.options.lineHeight??Et);const s=document.createElement("div");s.className="xterm-viewport",s.style.width="100%",s.style.height="100%",s.style.overflow="hidden",s.style.position="relative";const o=document.createElement("div");o.className="xterm-screen",o.style.width="100%",o.style.height="100%",o.style.position="relative",o.style.userSelect="none",o.style.webkitUserSelect="none",o.style.backgroundColor=this.options.theme.background;const i=document.createElement("div");i.className="xterm-helper-textarea",i.setAttribute("aria-label","Terminal Input"),i.setAttribute("role","textbox"),i.setAttribute("contenteditable","true"),i.setAttribute("autocorrect","off"),i.setAttribute("autocapitalize","off"),i.setAttribute("spellcheck","false"),i.style.position="absolute",i.style.opacity="1",i.style.pointerEvents="none",i.style.left="0",i.style.top="0",i.style.minWidth="1px",i.style.minHeight="1px",i.style.whiteSpace="pre",i.style.border="0",i.style.padding="0",i.style.margin="0",i.style.color=this.options.theme.foreground,i.style.backgroundColor="transparent",i.style.caretColor="transparent",i.style.overflow="visible",i.style.outline="none",i.style.boxShadow="none",i.style.fontFamily=this.options.fontFamily,i.style.fontSize=`${this.options.fontSize}px`,i.style.userSelect="text",i.style.webkitUserSelect="text";const r=document.createElement("div");r.className="xterm-scrollbar-track",r.style.position="absolute",r.style.top="0",r.style.right="0",r.style.width="8px",r.style.height="100%",r.style.backgroundColor="transparent",r.style.pointerEvents="none";const l=document.createElement("div");l.className="xterm-scrollbar-thumb",l.style.position="absolute",l.style.top="0",l.style.right="0",l.style.width="6px",l.style.marginRight="1px",l.style.borderRadius="3px",l.style.backgroundColor="rgba(128, 128, 128, 0.5)",l.style.pointerEvents="none",l.style.transition="opacity 0.15s ease",l.style.opacity="0",r.appendChild(l),s.appendChild(o),n.appendChild(s),n.appendChild(i),n.appendChild(r),t.appendChild(n),this.element=n,this.screenElement=o,this.textarea=i,this.scrollbarThumb=l,this.renderer=new qe({screenElement:o,theme:this.options.theme,fontFamily:this.options.fontFamily,fontSize:this.options.fontSize}),this.syncInputState(),this.bindDomEvents(),this.updateCellDimensions();const a=this.measureSizeFromElement();a?this.resize(a.cols,a.rows):this.render()}loadAddon(t){t.activate(this),this.addons.add(t)}onData(t){return this.dataListeners.add(t),{dispose:()=>{this.dataListeners.delete(t)}}}attachCustomKeyEventHandler(t){this.customKeyEventHandler=t}onSelectionChange(t){return this.selectionListeners.add(t),{dispose:()=>{this.selectionListeners.delete(t)}}}onLinkActivated(t){return this.linkListeners.add(t),{dispose:()=>{this.linkListeners.delete(t)}}}hasSelection(){return Ct(this.selectionState)}getSelection(){return this.getSelectionText()??""}clearSelection(){this.disposed||this.clearSelectionState()}startTouchSelection(t,n,s="word"){return this.disposed?!1:this.beginSelectionAt(t,n,s)}updateTouchSelection(t,n){this.disposed||this.updateSelectionDrag(t,n)}endTouchSelection(){this.disposed||!this.pointerDrag.active||(this.stopAutoScroll(),this.pointerDrag.active=!1,this.render())}write(t){if(this.disposed)return;const n=this.isAltScreenActive();this.bindings.writeVt(this.terminalHandle,t);const s=this.isAltScreenActive();n&&!s&&this.clearMouseTrackingModes(),this.scheduleRender()}clearMouseTrackingModes(){if(!this.disposed){for(const t of Xn)this.bindings.setTerminalMode(this.terminalHandle,t,!1);this.bindings.resetMouseEncoder(this.mouseEncoderHandle),this.pressedMouseButtons.clear(),this.mouseDragActive=!1}}isAltScreenActive(){return this.isModeEnabled(L)||this.isModeEnabled(F)}reset(){this.disposed||(this.lineCache.clear(),this.clearSelectionState(!1),this.bindings.resetTerminal(this.terminalHandle),this.scheduleRender())}refresh(){this.disposed||this.render()}forceFullRepaint(){this.disposed||(this.forceFullNext=!0,this.renderRaf!==null&&(cancelAnimationFrame(this.renderRaf),this.renderRaf=null),this.render())}resize(t,n){if(this.disposed)return;const s=Math.max(2,Math.floor(t)),o=Math.max(2,Math.floor(n));s===this.cols&&o===this.rows||(this.cols=s,this.rows=o,this.clearSelectionState(!1),this.bindings.resizeTerminal(this.terminalHandle,s,o,this.cellDimensions()),this.bindings.resetMouseEncoder(this.mouseEncoderHandle),this.scheduleRender())}scrollLines(t){this.disposed||t===0||(this.bindings.scrollViewportDelta(this.terminalHandle,t),this.render())}scrollToTop(){this.disposed||(this.bindings.scrollViewportTop(this.terminalHandle),this.render())}scrollToBottom(){this.disposed||(this.bindings.scrollViewportBottom(this.terminalHandle),this.render())}exportModeSnapshot(){return{mouseX10:this.isModeEnabled($),mouseNormal:this.isModeEnabled(K),mouseButton:this.isModeEnabled(j),mouseAny:this.isModeEnabled(Y),mouseUtf8:this.isModeEnabled(1005),mouseSgr:this.isModeEnabled(1006),mouseSgrPixels:this.isModeEnabled(1016),mouseUrxvt:this.isModeEnabled(1015),altScroll:this.isModeEnabled(Z),altScreen1047:this.isModeEnabled(L),altScreen1049:this.isModeEnabled(F)}}restoreModeSnapshot(t){this.bindings.setTerminalMode(this.terminalHandle,$,t.mouseX10),this.bindings.setTerminalMode(this.terminalHandle,K,t.mouseNormal),this.bindings.setTerminalMode(this.terminalHandle,j,t.mouseButton),this.bindings.setTerminalMode(this.terminalHandle,Y,t.mouseAny),this.bindings.setTerminalMode(this.terminalHandle,1005,t.mouseUtf8),this.bindings.setTerminalMode(this.terminalHandle,1006,t.mouseSgr),this.bindings.setTerminalMode(this.terminalHandle,1016,t.mouseSgrPixels),this.bindings.setTerminalMode(this.terminalHandle,1015,t.mouseUrxvt),this.bindings.setTerminalMode(this.terminalHandle,Z,t.altScroll),this.bindings.setTerminalMode(this.terminalHandle,L,t.altScreen1047),this.bindings.setTerminalMode(this.terminalHandle,F,t.altScreen1049),this.bindings.resetMouseEncoder(this.mouseEncoderHandle)}handleViewportGesture(t){if(this.disposed||t.deltaY===0)return!1;const n=this.gestureToLines(t);if(n===0)return!1;const s=this.getInputRoutingState();if(s.mouseReporting){const o=n<0?qn:Qn;let i=!1;for(let r=0;r<Math.abs(n);r+=1)i=this.emitMouseInput({action:"press",button:o,clientX:t.clientX,clientY:t.clientY,mods:O(t),anyButtonPressed:this.pressedMouseButtons.size>0})||i;return i}return s.altScroll?this.emitAltScrollInput(n):(this.scrollLines(n),!0)}paste(t){if(this.disposed||this.disableStdin||!t)return;const n=this.bindings.encodePaste(this.terminalHandle,t);n&&this.emitData(n)}focus(){var t;(t=this.textarea)==null||t.focus({preventScroll:!0})}getCursorViewportRect(){if(this.disposed)return null;const t=this.screenElement,n=this.lastCursor;if(!t||!n||!n.visible||n.y===null||this.textarea===null||document.activeElement!==this.textarea)return null;const{height:s}=this.cellDimensions();if(s<=0)return null;const o=t.getBoundingClientRect().top+n.y*s;return{top:o,bottom:o+s}}getRendererKind(){var t;return((t=this.renderer)==null?void 0:t.kind)??"unknown"}setTheme(t){var n;this.bindings.setTerminalTheme(this.terminalHandle,t),this.options.theme=t,this.element&&(this.element.style.backgroundColor=t.background,this.element.style.color=t.foreground),this.screenElement&&(this.screenElement.style.backgroundColor=t.background),(n=this.renderer)==null||n.setTheme(t),this.scheduleRender()}setDisableStdin(t){this.disableStdin=t,this.syncInputState()}measureSizeFromElement(){const t=this.element;if(!t)return null;const n=t.getBoundingClientRect(),{width:s,height:o}=this.cellDimensions();return n.width===0||n.height===0||s<=0||o<=0?null:{cols:Math.max(2,Math.floor(n.width/s)),rows:Math.max(2,Math.floor(n.height/o))}}dispose(){var t,n;if(!this.disposed){this.disposed=!0,this.renderRaf!==null&&(cancelAnimationFrame(this.renderRaf),this.renderRaf=null),this.stopAutoScroll(),this.updateSelectionTextProbe(null),this.clearDomEventListeners(),this.scrollbarFadeTimer&&(clearTimeout(this.scrollbarFadeTimer),this.scrollbarFadeTimer=null);for(const s of this.addons)s.dispose();this.addons.clear(),(t=this.renderer)==null||t.dispose(),this.renderer=null,(n=this.element)==null||n.remove(),this.element=null,this.screenElement=null,this.textarea=null,this.scrollbarThumb=null,bt(this.renderState),this.bindings.freeMouseEncoder(this.mouseEncoderHandle),this.bindings.freeKeyEncoder(this.keyEncoderHandle),this.bindings.freeTerminal(this.terminalHandle)}}cellDimensions(){return this._core._renderService.dimensions.css.cell}syncInputState(){this.textarea&&(this.textarea.readOnly=this.disableStdin,this.textarea.tabIndex=this.disableStdin?-1:0,this.disableStdin&&document.activeElement===this.textarea&&this.textarea.blur())}bindDomEvents(){const t=this.element,n=this.textarea;if(!t||!n)return;t.addEventListener("click",()=>{this.disableStdin||this.focus()});const s=this.screenElement??t;s.addEventListener("mousedown",i=>{if(i instanceof MouseEvent){if(this.showScrollbarTransient(),this.disableStdin||this.focus(),this.getInputRoutingState().mouseReporting){const r=this.mouseButtonFromEvent(i);if(r===null)return;this.clearSelectionState(),this.pressedMouseButtons.add(r),this.mouseDragActive=!0,this.emitMouseInput({action:"press",button:r,clientX:i.clientX,clientY:i.clientY,mods:O(i),anyButtonPressed:!0}),i.preventDefault();return}if(i.button===0&&ft(i)){const r=this.linkAtClient(i.clientX,i.clientY);if(r){this.emitLinkActivated(r),i.preventDefault();return}}i.button===0&&(this.mouseDragActive=!0,this.beginPointerSelection(i),i.preventDefault())}}),s.addEventListener("mousemove",i=>{if(!(!(i instanceof MouseEvent)||this.mouseDragActive)){if(this.showScrollbarTransient(),this.getInputRoutingState().mouseReporting){this.setLinkCursor(!1);return}this.setLinkCursor(ft(i)&&this.linkAtClient(i.clientX,i.clientY)!==null)}}),s.addEventListener("mouseleave",()=>{this.setLinkCursor(!1)}),t.addEventListener("wheel",i=>{this.showScrollbarTransient(),this.handleViewportGesture({source:"wheel",deltaY:i.deltaY,deltaMode:i.deltaMode,clientX:i.clientX,clientY:i.clientY,shiftKey:i.shiftKey,ctrlKey:i.ctrlKey,altKey:i.altKey,metaKey:i.metaKey})&&i.preventDefault()},{passive:!1});const o=typeof window<"u"&&typeof window.addEventListener=="function"?window:null;if(o){const i=l=>{if(this.mouseDragActive){if(this.getInputRoutingState().mouseReporting){this.emitMouseInput({action:"motion",button:this.mouseButtonFromButtons(l.buttons),clientX:l.clientX,clientY:l.clientY,mods:O(l),anyButtonPressed:this.pressedMouseButtons.size>0||l.buttons>0});return}this.updatePointerSelection(l)}},r=l=>{if(this.mouseDragActive){if(this.mouseDragActive=!1,this.getInputRoutingState().mouseReporting){const a=this.mouseButtonFromEvent(l);a!==null&&this.pressedMouseButtons.delete(a),this.emitMouseInput({action:"release",button:a,clientX:l.clientX,clientY:l.clientY,mods:O(l),anyButtonPressed:this.pressedMouseButtons.size>0});return}this.finishPointerSelection(l)}};o.addEventListener("mousemove",i),o.addEventListener("mouseup",r),this.domEventDisposers.push(()=>{o.removeEventListener("mousemove",i),o.removeEventListener("mouseup",r)})}n.addEventListener("keydown",i=>{const r=this.getSelectionText();if(r&&Be(i)){i.preventDefault(),Le(r).catch(()=>{}),this.clearSelectionState(),this.copyShortcutSuppressed=!0,this.clearTextarea();return}if(!this.customKeyEventHandler(i)||this.disableStdin||this.imeIsComposing||i.keyCode===229||Fe(i)||!es(i))return;const l=this.encodeKeyboardEvent(i,i.repeat?"repeat":"press");l&&(i.preventDefault(),this.emitData(l),this.clearTextarea())}),n.addEventListener("keyup",i=>{if(this.copyShortcutSuppressed){const l=i.key.toLowerCase();if(l==="c"){i.preventDefault();return}if(l==="control"||l==="meta"||l==="os"){this.copyShortcutSuppressed=!1,i.preventDefault();return}}if(this.disableStdin||this.imeIsComposing)return;const r=this.encodeKeyboardEvent(i,"release");r&&(i.preventDefault(),this.emitData(r),this.clearTextarea())}),n.addEventListener("compositionstart",()=>{this.imeIsComposing=!0,this.lastCompositionCommit=null,this.syncTextareaPositionToCursor()}),n.addEventListener("compositionupdate",()=>{this.syncTextareaPositionToCursor()}),n.addEventListener("compositionend",i=>{this.imeIsComposing=!1;const r=i.data??"";r&&(this.lastCompositionCommit={data:r,at:Date.now()},this.emitData(r),this.clearTextarea())}),n.addEventListener("beforeinput",i=>{if(this.disableStdin||i.inputType==="insertFromPaste"||i.isComposing||this.imeIsComposing)return;const r=ts[i.inputType??""];if(r){i.preventDefault();const d=this.encodeSyntheticKey(r);d&&this.emitData(d),this.clearTextarea();return}const l=i.data??"";if(!l)return;const a=this.lastCompositionCommit;if(a&&a.data===l&&Date.now()-a.at<40){this.lastCompositionCommit=null,i.preventDefault(),this.clearTextarea();return}this.lastCompositionCommit=null,i.preventDefault(),this.emitData(l),this.clearTextarea()}),n.addEventListener("paste",i=>{var l;if(this.disableStdin)return;const r=((l=i.clipboardData)==null?void 0:l.getData("text/plain"))??"";r&&(i.preventDefault(),this.paste(r),this.clearTextarea())}),n.addEventListener("copy",i=>{const r=this.getSelectionText();r&&Oe(i,r)}),n.addEventListener("input",()=>{if(this.disableStdin||this.imeIsComposing)return;const i=n.textContent??"";if(!i){this.clearTextarea();return}const r=this.lastCompositionCommit;if(r&&r.data===i&&Date.now()-r.at<40){this.lastCompositionCommit=null,this.clearTextarea();return}this.lastCompositionCommit=null,this.emitData(i),this.clearTextarea()})}encodeKeyboardEvent(t,n){const s=pt(t.code);if(s===0)return null;const o=t.key.length===1&&!t.ctrlKey&&!t.metaKey?t.key:null;return this.bindings.encodeKeyEvent(this.keyEncoderHandle,this.terminalHandle,{action:n,keyCode:s,mods:Bt(t),composing:t.isComposing,utf8:o,unshiftedCodepoint:$e(t.code)})}encodeSyntheticKey(t){const n={code:t,key:t,shiftKey:!1,ctrlKey:!1,altKey:!1,metaKey:!1,repeat:!1,isComposing:!1,getModifierState:()=>!1};return this.encodeKeyboardEvent(n,"press")}getInputRoutingState(){const t=this.isModeEnabled($)||this.isModeEnabled(K)||this.isModeEnabled(j)||this.isModeEnabled(Y),n=this.isModeEnabled(L)||this.isModeEnabled(F);return{mouseReporting:t,altScroll:!t&&n&&this.isModeEnabled(Z)}}gestureToLines(t){const n=this.cellDimensions().height||Q;if(t.source==="wheel"){if(t.deltaMode===1)return this.wheelPixelDelta=0,t.deltaY>0?Math.ceil(t.deltaY):Math.floor(t.deltaY);if(t.deltaMode===2){this.wheelPixelDelta=0;const o=Math.max(1,this.rows),i=t.deltaY*o;return i>0?Math.ceil(i):Math.floor(i)}this.wheelPixelDelta+=t.deltaY;const s=this.wheelPixelDelta>0?Math.floor(this.wheelPixelDelta/n):Math.ceil(this.wheelPixelDelta/n);return s!==0&&(this.wheelPixelDelta-=s*n),s}return t.deltaY>0?Math.ceil(t.deltaY/n):Math.floor(t.deltaY/n)}isModeEnabled(t){return this.bindings.isTerminalModeEnabled(this.terminalHandle,t)}mouseButtonFromEvent(t){switch(t.button){case 0:return Rt;case 1:return vt;case 2:return Mt;default:return null}}mouseButtonFromButtons(t){return t&1?Rt:t&4?vt:t&2?Mt:null}pointerPositionFromClient(t,n){var r;const s=(r=this.screenElement)==null?void 0:r.getBoundingClientRect();if(!s)return null;const o=Math.max(1,s.width),i=Math.max(1,s.height);return{x:Math.max(0,Math.min(o-1,t-s.left)),y:Math.max(0,Math.min(i-1,n-s.top))}}emitMouseInput(t){var r;if(this.disableStdin)return!1;const n=this.pointerPositionFromClient(t.clientX,t.clientY);if(!n)return!1;const s=this.cellDimensions(),o=(r=this.screenElement)==null?void 0:r.getBoundingClientRect();if(!o)return!1;const i=this.bindings.encodeMouseEvent(this.mouseEncoderHandle,this.terminalHandle,{action:t.action,button:t.button,mods:t.mods,x:n.x,y:n.y,anyButtonPressed:t.anyButtonPressed,screenWidth:Math.max(1,Math.round(o.width)),screenHeight:Math.max(1,Math.round(o.height)),cellWidth:Math.max(1,Math.round(s.width||q)),cellHeight:Math.max(1,Math.round(s.height||Q))});return i?(this.emitData(i),!0):!1}emitAltScrollInput(t){const n=pt(t<0?"ArrowUp":"ArrowDown");if(n===0)return!1;let s=!1;for(let o=0;o<Math.abs(t);o+=1){const i=this.bindings.encodeKeyEvent(this.keyEncoderHandle,this.terminalHandle,{action:"press",keyCode:n,mods:0,composing:!1,utf8:null,unshiftedCodepoint:null});i&&(this.emitData(i),s=!0)}return s}emitData(t){for(const n of this.dataListeners)n(t)}clearTextarea(){this.textarea&&(this.textarea.textContent="")}syncTextareaPositionToCursor(){const t=this.textarea,n=this.screenElement;if(!t||!n)return;const{width:s,height:o}=this.cellDimensions();if(s<=0||o<=0||!this.lastCursor)return;const i=this.lastCursor.x??0,r=this.lastCursor.y??0,l=i*s,a=r*o;t.style.left=`${l}px`,t.style.top=`${a}px`,t.style.width=`${Math.max(1,s)}px`,t.style.height=`${Math.max(1,o)}px`,t.style.lineHeight=`${o}px`,t.style.fontFamily=this.options.fontFamily,t.style.fontSize=`${this.options.fontSize}px`}scheduleRender(){this.renderRaf===null&&(this.renderRaf=requestAnimationFrame(()=>{this.renderRaf=null,this.render()}))}render(){if(this.disposed||!this.screenElement||!this.renderer)return;const t=this.forceFullNext;this.forceFullNext=!1;const n=this.bindings.readScrollbar(this.terminalHandle),s=Math.max(1,n.len||this.rows);Ln(this.renderState,this.terminalHandle);const o=$t(this.renderState),i=Array.from(Fn(this.renderState));this.lastCursor=o.cursor,this.cols=Math.max(2,o.cols),this.rows=Math.max(2,o.rows||s),this.lastViewportOffset=n.offset,this.lastViewportRows=this.rows,this.lastRenderedRows=i;for(const m of i)this.lineCache.set(n.offset+m.y,xt(m.cells,m.wrap));const r=zn(this.selectionState,this.lastViewportOffset,this.lastViewportRows,m=>this.getLineModel(m)),l=this.getSelectionText();this.renderer.render({meta:o,rows:i,cellDimensions:this.cellDimensions(),selectionRects:r,selectionColor:this.options.theme.selectionBackground,forceFull:t});const a=ns(i,this.rows),d=Math.max(0,n.total-n.len);this.buffer.setViewport(n.offset,d,n.total,a),this.updateSelectionTextProbe(l),this.updateScrollbar(n)}updateScrollbar(t){var a;const n=this.scrollbarThumb;if(!n)return;const s=((a=this.screenElement)==null?void 0:a.clientHeight)??0;if(s===0||t.total<=t.len){n.style.opacity="0";return}const o=t.len/t.total,i=Math.max(20,o*s),l=t.offset/Math.max(1,t.total-t.len)*(s-i);n.style.height=`${i}px`,n.style.transform=`translateY(${l}px)`,n.style.opacity=this.scrollbarVisible?"1":"0"}showScrollbarTransient(){!this.focused||!this.scrollbarThumb||(this.scrollbarVisible=!0,this.scrollbarThumb.style.opacity="1",this.scrollbarFadeTimer&&clearTimeout(this.scrollbarFadeTimer),this.scrollbarFadeTimer=setTimeout(()=>{this.scrollbarVisible=!1,this.scrollbarThumb&&(this.scrollbarThumb.style.opacity="0")},3e3))}setFocused(t){this.focused=t,t||(this.scrollbarVisible=!1,this.scrollbarThumb&&(this.scrollbarThumb.style.opacity="0"),this.scrollbarFadeTimer&&(clearTimeout(this.scrollbarFadeTimer),this.scrollbarFadeTimer=null))}updateCellDimensions(){if(!this.element)return;const t=document.createElement("span");t.textContent="WWWWWWWWWW",t.style.position="absolute",t.style.visibility="hidden",t.style.whiteSpace="pre",t.style.fontFamily=this.options.fontFamily,t.style.fontSize=`${this.options.fontSize}px`,this.element.appendChild(t);const n=t.getBoundingClientRect();t.remove();const s=Math.max(1,globalThis.devicePixelRatio??1),o=n.width>0?n.width/10:q,i=this.options.fontSize*(this.options.lineHeight??Et);this._core._renderService.dimensions.css.cell.width=Math.max(1,Math.round(o*s))/s,this._core._renderService.dimensions.css.cell.height=Math.max(1,Math.round(i*s))/s}clearSelectionState(t=!0){this.selectionState=Pn(),this.pressedMouseButtons.clear(),this.wheelPixelDelta=0,this.pointerDrag={active:!1,moved:!1,mode:"character",lastClientX:null,lastClientY:null},this.copyShortcutSuppressed=!1,this.stopAutoScroll(),this.updateSelectionTextProbe(null),t&&this.screenElement&&this.renderer&&this.render()}beginSelectionAt(t,n,s){const o=this.hitTest(t,n);return o?(this.pointerDrag={active:!0,moved:!1,mode:s,lastClientX:t,lastClientY:n},this.selectionState=Un(this.selectionState,{...o,mode:s},i=>this.getLineModel(i)),this.updateAutoScroll(),this.render(),!0):!1}updateSelectionDrag(t,n){if(!this.pointerDrag.active)return;const s=this.hitTest(t,n);this.pointerDrag.lastClientX=t,this.pointerDrag.lastClientY=n,s&&(this.pointerDrag.moved=!0,this.selectionState=wt(this.selectionState,s,o=>this.getLineModel(o)),this.render()),this.updateAutoScroll()}beginPointerSelection(t){this.beginSelectionAt(t.clientX,t.clientY,this.selectionModeFromClickDetail(t.detail))}updatePointerSelection(t){this.updateSelectionDrag(t.clientX,t.clientY)}finishPointerSelection(t){var s,o,i,r;if(!this.pointerDrag.active||t.button!==0)return;this.pointerDrag.lastClientX=t.clientX,this.pointerDrag.lastClientY=t.clientY,this.stopAutoScroll();const n=this.pointerDrag.mode==="character"&&!this.pointerDrag.moved&&((s=this.selectionState.anchor)==null?void 0:s.line)===((o=this.selectionState.focus)==null?void 0:o.line)&&((i=this.selectionState.anchor)==null?void 0:i.col)===((r=this.selectionState.focus)==null?void 0:r.col);if(this.pointerDrag.active=!1,n){this.clearSelectionState();return}this.render()}selectionModeFromClickDetail(t){return t>=3?"line":t===2?"word":"character"}hitTest(t,n){var x;const s=(x=this.screenElement)==null?void 0:x.getBoundingClientRect();if(!s)return null;const{width:o,height:i}=this.cellDimensions();if(o<=0||i<=0)return null;const r=t-s.left,l=n-s.top,a=Math.max(this.cols-1,0),d=Math.max(this.lastViewportRows-1,0),m=Math.max(0,Math.min(a,Math.floor(r/o))),g=Math.max(0,Math.min(d,Math.floor(l/i)));return{line:this.lastViewportOffset+g,col:m}}getLineModel(t){const n=this.lineCache.get(t);if(n)return n;const s=t-this.lastViewportOffset,o=this.lastRenderedRows[s];return o?xt(o.cells,o.wrap):On}emitLinkActivated(t){for(const n of this.linkListeners)n(t)}setLinkCursor(t){this.linkCursorActive!==t&&(this.linkCursorActive=t,this.screenElement&&(this.screenElement.style.cursor=t?"pointer":""))}linkAtClient(t,n){const s=this.hitTest(t,n);return s?this.linkAtPoint(s.line,s.col):null}linkAtPoint(t,n){if(this.getLineModel(t).colChars.length===0)return null;let s=t;for(;this.getLineModel(s-1).wrappedToNext;)s-=1;let o=t;for(;this.getLineModel(o).wrappedToNext;)o+=1;const i=[];for(let l=s;l<=o;l+=1)i.push(this.getLineModel(l));const r=t-s;for(const l of Je(i))if(l.lineIndex===r&&n>=l.startCol&&n<=l.endCol)return l.url;return null}getSelectionText(){return Ct(this.selectionState)?Vn(this.selectionState,t=>this.getLineModel(t)):null}updateSelectionTextProbe(t){if(globalThis.__tmexE2eTerminalSelectionText=t,t!==this.lastNotifiedSelectionText){this.lastNotifiedSelectionText=t;for(const n of this.selectionListeners)n(t)}}updateAutoScroll(){var s;if(!this.pointerDrag.active||this.pointerDrag.lastClientY===null){this.stopAutoScroll();return}const t=(s=this.screenElement)==null?void 0:s.getBoundingClientRect();if(!t){this.stopAutoScroll();return}if(!(this.pointerDrag.lastClientY<t.top||this.pointerDrag.lastClientY>t.bottom)){this.stopAutoScroll();return}this.autoScrollTimer===null&&(this.autoScrollTimer=setInterval(()=>{this.stepAutoScroll()},Wn))}stepAutoScroll(){var o;if(!this.pointerDrag.active||this.pointerDrag.lastClientX===null||this.pointerDrag.lastClientY===null){this.stopAutoScroll();return}const t=(o=this.screenElement)==null?void 0:o.getBoundingClientRect();if(!t){this.stopAutoScroll();return}let n=0;if(this.pointerDrag.lastClientY<t.top?n=-1:this.pointerDrag.lastClientY>t.bottom&&(n=1),n===0){this.stopAutoScroll();return}this.bindings.scrollViewportDelta(this.terminalHandle,n),this.render();const s=this.hitTest(this.pointerDrag.lastClientX,this.pointerDrag.lastClientY);s&&(this.selectionState=wt(this.selectionState,s,i=>this.getLineModel(i)),this.pointerDrag.moved=!0,this.render())}stopAutoScroll(){this.autoScrollTimer!==null&&(clearInterval(this.autoScrollTimer),this.autoScrollTimer=null)}clearDomEventListeners(){for(;this.domEventDisposers.length>0;){const t=this.domEventDisposers.pop();t==null||t()}}}async function is(e){return U.create(e)}const os=new Set(["Control","Shift","Alt","Meta","CapsLock","NumLock","ScrollLock","Dead","Unidentified","OS","ContextMenu","Fn","FnLock","Hyper","Super"]),rs={Enter:{label:"Enter",raw:"\r"},Tab:{label:"Tab",raw:" "},Escape:{label:"ESC",raw:"\x1B"},Backspace:{label:"Backspace",raw:"\b"}," ":{label:"Space",raw:" "},ArrowUp:{label:"↑",csiFinal:"A"},ArrowDown:{label:"↓",csiFinal:"B"},ArrowRight:{label:"→",csiFinal:"C"},ArrowLeft:{label:"←",csiFinal:"D"},Home:{label:"Home",csiFinal:"H"},End:{label:"End",csiFinal:"F"},Delete:{label:"Delete",csiNum:3},Insert:{label:"Insert",csiNum:2},PageUp:{label:"PgUp",csiNum:5},PageDown:{label:"PgDn",csiNum:6}},ls={F1:"\x1BOP",F2:"\x1BOQ",F3:"\x1BOR",F4:"\x1BOS",F5:"\x1B[15~",F6:"\x1B[17~",F7:"\x1B[18~",F8:"\x1B[19~",F9:"\x1B[20~",F10:"\x1B[21~",F11:"\x1B[23~",F12:"\x1B[24~"},as={"[":"\x1B","\\":"","]":"","^":"",_:"","@":"\0","?":""};function cs(e){return 1+(e.shiftKey?1:0)+(e.altKey?2:0)+(e.ctrlKey?4:0)+(e.metaKey?8:0)}function ds(e){const t=[];return e.ctrlKey&&t.push("CTRL"),e.altKey&&t.push("ALT"),e.metaKey&&t.push("CMD"),e.shiftKey&&t.push("SHIFT"),t.length?`${t.join("-")}-`:""}function hs(e){const t=e.key;if(!t||os.has(t))return null;const n=cs(e),s=n!==1,o=ds(e);if(t==="Tab"&&e.shiftKey&&!e.ctrlKey&&!e.altKey&&!e.metaKey)return{label:"SHIFT-Tab",payload:"\x1B[Z"};if(t==="Enter"&&e.shiftKey&&!e.ctrlKey&&!e.altKey&&!e.metaKey)return{label:"SHIFT-Enter",payload:"\x1B[13;2u"};if(e.ctrlKey&&!e.altKey&&!e.metaKey&&/^[a-zA-Z]$/.test(t)){const l=t.toUpperCase();return{label:`CTRL-${l}`,payload:String.fromCharCode(l.charCodeAt(0)-64)}}const i=ls[t];if(i)return{label:o+t,payload:i};const r=rs[t];if(r){if("raw"in r){const a=e.altKey?`\x1B${r.raw}`:r.raw;return{label:o+r.label,payload:a}}if("csiFinal"in r){const a=s?`\x1B[1;${n}${r.csiFinal}`:`\x1B[${r.csiFinal}`;return{label:o+r.label,payload:a}}const l=s?`\x1B[${r.csiNum};${n}~`:`\x1B[${r.csiNum}~`;return{label:o+r.label,payload:l}}if(t.length===1){if(e.altKey&&!e.ctrlKey&&!e.metaKey)return{label:`ALT-${t.toUpperCase()}`,payload:`\x1B${t}`};if(e.ctrlKey){const l=as[t];return l!==void 0?{label:o+t,payload:l}:null}return{label:t,payload:t}}return null}function Ut(e){return e.replace(/\\(x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|.)/g,(t,n)=>{if(n[0]==="x"&&n.length===3||n[0]==="u"&&n.length===5)return String.fromCharCode(Number.parseInt(n.slice(1),16));switch(n){case"r":return"\r";case"n":return`
|
|
23
23
|
`;case"t":return" ";case"e":return"\x1B";case"0":return"\0";case"a":return"\x07";case"b":return"\b";case"f":return"\f";case"v":return"\v";case"\\":return"\\";default:return n}})}function et(e){let t="";for(const n of e){const s=n.codePointAt(0)??0;n==="\\"?t+="\\\\":n==="\r"?t+="\\r":n===`
|
|
24
24
|
`?t+="\\n":n===" "?t+="\\t":n==="\x1B"?t+="\\e":s<32||s>=127&&s<=159?t+=`\\x${s.toString(16).padStart(2,"0")}`:t+=n}return t}const us={CTRL:"⌃",CONTROL:"⌃",SHIFT:"⇧",ALT:"⌥",OPTION:"⌥",OPT:"⌥",CMD:"⌘",META:"⌘",SUPER:"⌘",WIN:"⌘",ENTER:"⏎",RETURN:"⏎",CR:"⏎",ESC:"⎋",ESCAPE:"⎋",TAB:"⇥",BACKSPACE:"⌫",BS:"⌫",DELETE:"⌦",DEL:"⌦",SPACE:"␣",UP:"↑",DOWN:"↓",LEFT:"←",RIGHT:"→"};function ms(e){return e&&e.split(/[-+]/).map(n=>{const s=n.trim().toUpperCase();return us[s]??n}).join("")}const fs={paste:Ot,toggleKeyboard:Lt,newAgentSession:nt,scrollToBottom:Ft};function ps({items:e,useIcons:t,onActivate:n,disabled:s=!1,preventFocusSteal:o=!1,className:i,rowTestId:r="editor-shortcuts-row",idPrefix:l="editor-shortcut"}){const{t:a}=k();return c.jsx("div",{className:A("shortcut-row flex items-center gap-1.5 py-2 overflow-x-auto scrollbar-thin",i),"data-testid":r,children:e.map(d=>{const m=d.type==="action",g=m&&d.action?fs[d.action]:null,x=m&&d.action?a(`settings.terminal.shortcuts.action.${d.action}`):"",y=d.label||et(d.payload??""),C=t?ms(y):y,p=m?d.label.trim()||x:y;return c.jsx(M,{type:"button",variant:"ghost",size:"sm",className:"terminal-shortcut-btn h-8 min-w-9 px-2.5 rounded-full font-mono text-[13px] font-medium tracking-wide shrink-0 [@media(any-pointer:coarse)]:h-9 [@media(any-pointer:coarse)]:min-w-10 [@media(any-pointer:coarse)]:px-3",title:p,"aria-label":p,"data-testid":`${l}-${d.id}`,onMouseDown:o?b=>b.preventDefault():void 0,onClick:n?()=>n(d):void 0,disabled:s,children:g?c.jsx(g,{className:"h-4 w-4"}):c.jsx("span",{children:C})},d.id)})})}const _t=["terminal-shortcuts"];async function Gt(e,t){try{return(await e.json()).error??t}catch{return t}}async function gs(){const e=await fetch("/api/settings/terminal-shortcuts");if(!e.ok)throw new Error(await Gt(e,"Failed to load terminal shortcuts"));return(await e.json()).settings}async function ys(e){const t=await fetch("/api/settings/terminal-shortcuts",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(await Gt(t,"Failed to save terminal shortcuts"));return(await t.json()).settings}const Vt=[{action:"paste",icon:Ot},{action:"toggleKeyboard",icon:Lt},{action:"newAgentSession",icon:nt},{action:"scrollToBottom",icon:Ft}];function At(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`sc-${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`}function Dt(e){return JSON.stringify([e.id,e.type,e.label,e.payload??null,e.action??null])}function J(e,t){return e.length!==t.length?!1:e.every((n,s)=>Dt(n)===Dt(t[s]))}function bs({action:e}){var s;const{t}=k(),n=((s=Vt.find(o=>o.action===e))==null?void 0:s.icon)??nt;return c.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 whitespace-nowrap rounded bg-muted px-1.5 py-0.5 text-muted-foreground text-xs",children:[c.jsx(n,{className:"h-3.5 w-3.5"}),t(`settings.terminal.shortcuts.action.${e}`)]})}function xs({item:e,onLabelChange:t,onPayloadChange:n,onRemove:s}){const{t:o}=k(),{attributes:i,listeners:r,setNodeRef:l,setActivatorNodeRef:a,transform:d,transition:m,isDragging:g}=Se({id:e.id}),x=e.type==="action",[y,C]=w.useState(()=>et(e.payload??""));return w.useEffect(()=>{C(et(e.payload??""))},[e.payload]),c.jsxs("div",{ref:l,style:{transform:Te.Translate.toString(d),transition:m},className:A("flex items-center gap-2 rounded-lg border border-border bg-background p-2.5",g&&"opacity-60 shadow-sm"),"data-testid":`shortcut-editor-row-${e.id}`,children:[c.jsx("button",{type:"button",ref:a,...i,...r,"aria-label":o("settings.terminal.shortcuts.dragHandle"),className:"shrink-0 cursor-grab touch-none text-muted-foreground hover:text-foreground",children:c.jsx(Ce,{className:"h-4 w-4"})}),x&&e.action?c.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[c.jsx(bs,{action:e.action}),c.jsx(_,{value:e.label,onChange:p=>t(e.id,p.target.value),placeholder:o(`settings.terminal.shortcuts.action.${e.action}`),className:"h-9 min-w-0 flex-1","data-testid":`shortcut-editor-label-${e.id}`})]}):c.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[c.jsx(_,{value:e.label,onChange:p=>t(e.id,p.target.value),placeholder:o("settings.terminal.shortcuts.labelPlaceholder"),className:"h-9 w-24 font-mono","data-testid":`shortcut-editor-label-${e.id}`}),c.jsx(_,{value:y,onChange:p=>C(p.target.value),onBlur:()=>n(e.id,Ut(y)),placeholder:o("settings.terminal.shortcuts.payloadPlaceholder"),spellCheck:!1,className:"h-9 min-w-0 flex-1 font-mono text-xs","data-testid":`shortcut-editor-payload-${e.id}`})]}),c.jsx(M,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>s(e.id),"aria-label":o("settings.terminal.shortcuts.delete"),"data-testid":`shortcut-editor-remove-${e.id}`,children:c.jsx(we,{className:"h-4 w-4"})})]})}function Ss(){const{t:e}=k(),t=oe(),{data:n,isLoading:s,isError:o,refetch:i}=re({queryKey:_t,queryFn:gs}),[r,l]=w.useState([]),[a,d]=w.useState(!1),[m,g]=w.useState(null),[x,y]=w.useState(!1),[C,p]=w.useState(!1),[b,I]=w.useState(""),[ot,rt]=w.useState("");w.useEffect(()=>{if(!n)return;if(m===null){l(n.items),d(n.useIcons),g({items:n.items,useIcons:n.useIcons});return}if(J(m.items,n.items)&&m.useIcons===n.useIcons)return;J(r,m.items)&&a===m.useIcons&&(l(n.items),d(n.useIcons),g({items:n.items,useIcons:n.useIcons}))},[n,m,r,a]);const zt=w.useMemo(()=>m?!J(r,m.items)||a!==m.useIcons:!1,[r,a,m]),Wt=le(V(xe,{activationConstraint:{distance:8}}),V(be,{activationConstraint:{delay:250,tolerance:5}}),V(ye,{coordinateGetter:ge})),lt=ae({mutationFn:()=>ys({items:r,useIcons:a}),onSuccess:f=>{t.setQueryData(_t,f),l(f.items),d(f.useIcons),g({items:f.items,useIcons:f.useIcons}),ht.success(e("settings.terminal.shortcuts.saved"))},onError:f=>{ht.error(f instanceof Error?f.message:e("settings.terminal.shortcuts.saveFailed"))}}),Xt=f=>{const{active:S,over:R}=f;!R||S.id===R.id||l(T=>{const ct=T.findIndex(G=>G.id===S.id),dt=T.findIndex(G=>G.id===R.id);return ct<0||dt<0?T:pe(T,ct,dt)})},qt=(f,S)=>l(R=>R.map(T=>T.id===f?{...T,label:S}:T)),Qt=(f,S)=>l(R=>R.map(T=>T.id===f?{...T,payload:S}:T)),Zt=f=>l(S=>S.filter(R=>R.id!==f)),at=(f,S)=>{S&&l(R=>[...R,{id:At(),type:"send",label:f||S,payload:S}])},Jt=f=>l(S=>[...S,{id:At(),type:"action",action:f,label:""}]),te=()=>{l(Ke.map(f=>({...f}))),d(!1)},ee=f=>{f.preventDefault(),f.stopPropagation();const S=hs({key:f.key,ctrlKey:f.ctrlKey,shiftKey:f.shiftKey,altKey:f.altKey,metaKey:f.metaKey});S&&(at(S.label,S.payload),y(!1))},ne=()=>{const f=Ut(ot);f&&(at(b.trim(),f),I(""),rt(""))};return o&&!m?c.jsxs("div",{className:"space-y-2","data-testid":"terminal-shortcuts-error",children:[c.jsx("p",{className:"text-destructive text-sm",children:e("settings.terminal.shortcuts.loadFailed")}),c.jsx(M,{type:"button",variant:"outline",size:"sm",onClick:()=>i(),children:e("settings.terminal.shortcuts.retry")})]}):s&&!m?c.jsx("p",{className:"text-muted-foreground text-sm",children:e("settings.terminal.shortcuts.loading")}):c.jsxs("div",{className:"space-y-5","data-testid":"terminal-shortcuts-editor",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("span",{className:"block font-medium text-sm",children:e("settings.terminal.shortcuts.preview")}),c.jsx("div",{className:"rounded-lg border border-border bg-muted/30 px-3","data-testid":"shortcut-preview",children:c.jsx(ps,{items:r,useIcons:a})})]}),c.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-border p-3",children:[c.jsxs("span",{className:"flex min-w-0 flex-col gap-0.5",children:[c.jsx("span",{className:"font-medium text-sm",children:e("settings.terminal.shortcuts.useIcons")}),c.jsx("span",{className:"text-muted-foreground text-xs",children:e("settings.terminal.shortcuts.useIconsDesc")})]}),c.jsx(ce,{checked:a,onCheckedChange:f=>d(f),"aria-label":e("settings.terminal.shortcuts.useIcons"),"data-testid":"shortcut-use-icons"})]}),c.jsx(de,{sensors:Wt,collisionDetection:he,onDragEnd:Xt,children:c.jsx(ue,{items:r.map(f=>f.id),strategy:me,children:c.jsx("div",{className:"space-y-2","data-testid":"shortcut-editor-list",children:r.map(f=>c.jsx(xs,{item:f,onLabelChange:qt,onPayloadChange:Qt,onRemove:Zt},f.id))})})}),c.jsxs("div",{className:"space-y-3 rounded-lg border border-dashed border-border p-4",children:[c.jsx("span",{className:"block font-medium text-sm",children:e("settings.terminal.shortcuts.addShortcut")}),c.jsx("button",{type:"button",onKeyDown:ee,onFocus:()=>y(!0),onBlur:()=>y(!1),className:A("w-full rounded-lg border px-3 py-2.5 text-center text-sm outline-none transition-colors",x?"border-primary bg-primary/5 text-foreground":"border-border text-muted-foreground"),"data-testid":"shortcut-capture-input",children:e(x?"settings.terminal.shortcuts.capturePrompt":"settings.terminal.shortcuts.captureHint")}),c.jsx("div",{className:"flex flex-wrap gap-1.5",children:Vt.map(({action:f,icon:S})=>c.jsxs(M,{type:"button",variant:"outline",size:"sm",onClick:()=>Jt(f),"data-testid":`shortcut-add-action-${f}`,children:[c.jsx(S,{className:"h-3.5 w-3.5"}),e(`settings.terminal.shortcuts.action.${f}`)]},f))}),c.jsx("button",{type:"button",className:"text-muted-foreground text-xs underline underline-offset-2",onClick:()=>p(f=>!f),children:e("settings.terminal.shortcuts.advanced")}),C&&c.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[c.jsx(_,{value:b,onChange:f=>I(f.target.value),placeholder:e("settings.terminal.shortcuts.labelPlaceholder"),className:"h-9 w-24 font-mono","data-testid":"shortcut-manual-label"}),c.jsx(_,{value:ot,onChange:f=>rt(f.target.value),placeholder:e("settings.terminal.shortcuts.payloadPlaceholder"),spellCheck:!1,className:"h-9 min-w-0 flex-1 font-mono text-xs","data-testid":"shortcut-manual-payload"}),c.jsxs(M,{type:"button",variant:"outline",size:"sm",onClick:ne,"data-testid":"shortcut-manual-add",children:[c.jsx(fe,{className:"h-3.5 w-3.5"}),e("settings.terminal.shortcuts.add")]})]})]}),c.jsxs("div",{className:"flex items-center justify-between gap-2 pt-1",children:[c.jsxs(M,{type:"button",variant:"ghost",size:"sm",onClick:te,"data-testid":"shortcut-reset",children:[c.jsx(Ge,{className:"h-3.5 w-3.5"}),e("settings.terminal.shortcuts.reset")]}),c.jsx(M,{type:"button",variant:"default",size:"default",onClick:()=>lt.mutate(),disabled:!zt||lt.isPending,"data-testid":"shortcut-save",children:e("settings.terminal.shortcuts.save")})]})]})}const u="\x1B",Cs=[`${u}[1;32m feat/terminal-font${u}[0m ${u}[39m~/projects/tmex${u}[0m`,`${u}[39m// 渲染中文与彩色代码块:字号 / 字体 / 行高 实时预览${u}[0m`,`${u}[35mexport const${u}[0m ${u}[36mgreeting${u}[0m = ${u}[33m"你好,世界 🌏"${u}[0m;`,`${u}[35mfunction${u}[0m ${u}[34mfib${u}[0m(${u}[36mn${u}[0m: ${u}[32mnumber${u}[0m) {`,` ${u}[35mreturn${u}[0m n ${u}[31m<${u}[0m ${u}[33m2${u}[0m ${u}[31m?${u}[0m n ${u}[31m:${u}[0m ${u}[34mfib${u}[0m(n${u}[31m-${u}[0m${u}[33m1${u}[0m) ${u}[31m+${u}[0m ${u}[34mfib${u}[0m(n${u}[31m-${u}[0m${u}[33m2${u}[0m);`,"}",`${u}[32m+ 新增${u}[0m ${u}[31m- 删除${u}[0m ${u}[33m~ 修改${u}[0m ${u}[36m通过测试 ✓${u}[0m`,`${u}[1;34m dir/${u}[0m ${u}[32m file.ts${u}[0m ${u}[33m README.md${u}[0m ${u}[35m config${u}[0m`,`${u}[39m$${u}[0m bun run ${u}[36mbuild:fonts${u}[0m ${u}[32m✓${u}[0m ${u}[39m14MB${u}[0m`,`${u}[7m NORMAL ${u}[0m ${u}[39m UTF-8 LF TypeScript${u}[0m`].join(`\r
|
|
25
25
|
`);function ws({className:e}){const t=E(a=>a.terminalFontId),n=E(a=>a.terminalFontSize),s=E(a=>a.terminalLineHeight),o=E(a=>a.theme),i=w.useRef(null),r=w.useRef(null);w.useEffect(()=>{let a=!1,d=null;return(async()=>{await Ee(t,n);const m=i.current;if(a||!m)return;if(d=await is({fontFamily:Re(t),fontSize:n,lineHeight:s,scrollback:100,theme:o==="light"?ut:mt,disableStdin:!0}),a){d.dispose();return}d.open(m);const g=new ss;d.loadAddon(g),r.current=g,g.fit(),d.write(Cs)})(),()=>{a=!0,r.current=null,d==null||d.dispose()}},[t,n,s,o]),w.useEffect(()=>{const a=i.current;if(!a)return;const d=new ResizeObserver(()=>{var m;return(m=r.current)==null?void 0:m.fit()});return d.observe(a),()=>d.disconnect()},[]);const l=Math.ceil(n*s*12);return c.jsx("div",{className:A("relative w-full overflow-hidden rounded-md border",e),style:{height:`${l}px`,backgroundColor:o==="light"?ut.background:mt.background},children:c.jsx("div",{ref:i,className:"absolute inset-0"})})}const Ht=8,Nt=28,kt=1,It=2,Ts=[{value:"lift",labelKey:"terminal.keyboardBehavior.modeLift",descKey:"terminal.keyboardBehavior.modeLiftDesc"},{value:"resize",labelKey:"terminal.keyboardBehavior.modeResize",descKey:"terminal.keyboardBehavior.modeResizeDesc"},{value:"follow",labelKey:"terminal.keyboardBehavior.modeFollow",descKey:"terminal.keyboardBehavior.modeFollowDesc"}];function Ds({showPreview:e=!0,showShortcuts:t=!0}){const{t:n}=k(),s=E(p=>p.terminalFontSize),o=E(p=>p.setTerminalFontSize),i=E(p=>p.terminalLineHeight),r=E(p=>p.setTerminalLineHeight),l=E(p=>p.terminalFontId),a=E(p=>p.setTerminalFontId),d=E(p=>p.keyboardBehaviorMode),m=E(p=>p.setKeyboardBehaviorMode),[g,x]=w.useState(String(s)),[y,C]=w.useState(String(i));return w.useEffect(()=>{x(String(s))},[s]),w.useEffect(()=>{C(String(i))},[i]),c.jsxs("div",{className:"space-y-6",children:[c.jsx("p",{className:"text-muted-foreground text-sm",children:n("settings.terminal.description")}),e&&c.jsxs("div",{className:"space-y-2",children:[c.jsx("span",{className:"block text-sm font-medium",children:n("settings.terminal.preview")}),c.jsx(ws,{})]}),c.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-medium",htmlFor:"terminal-font-size",children:n("settings.terminal.fontSize")}),c.jsx(_,{id:"terminal-font-size","data-testid":"terminal-font-size",type:"number",min:Ht,max:Nt,step:1,value:g,onChange:p=>{x(p.target.value);const b=Number(p.target.value);Number.isFinite(b)&&b>=Ht&&b<=Nt&&o(b)},className:"min-h-10"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-medium",htmlFor:"terminal-line-height",children:n("settings.terminal.lineHeight")}),c.jsx(_,{id:"terminal-line-height","data-testid":"terminal-line-height",type:"number",min:kt,max:It,step:.1,value:y,onChange:p=>{C(p.target.value);const b=Number(p.target.value);Number.isFinite(b)&&b>=kt&&b<=It&&r(b)},className:"min-h-10"})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"block text-sm font-medium",htmlFor:"terminal-font-family",children:n("settings.terminal.fontFamily")}),c.jsxs(ve,{value:l,onValueChange:p=>{p&&a(p)},children:[c.jsx(Me,{id:"terminal-font-family","data-testid":"terminal-font-family",className:"min-h-10 w-full",children:c.jsx(_e,{children:Ae(l).displayName})}),c.jsx(De,{children:He.map(p=>c.jsx(Ne,{value:p.id,children:p.displayName},p.id))})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("span",{className:"block text-sm font-medium",children:n("terminal.keyboardBehavior.title")}),c.jsx("p",{className:"text-muted-foreground text-xs",children:n("terminal.keyboardBehavior.description")}),c.jsx("div",{className:"flex flex-col gap-2",children:Ts.map(p=>{const b=d===p.value;return c.jsxs("button",{type:"button",onClick:()=>m(p.value),"aria-pressed":b,"data-testid":`keyboard-behavior-option-${p.value}`,className:A("flex items-start gap-3 rounded-lg border p-3 text-left transition-colors",b?"border-primary bg-primary/5":"border-border hover:bg-muted/50"),children:[c.jsx("span",{className:A("mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border",b?"border-primary bg-primary text-primary-foreground":"border-muted-foreground/40"),children:b&&c.jsx(ke,{className:"h-3.5 w-3.5"})}),c.jsxs("span",{className:"flex min-w-0 flex-col gap-0.5",children:[c.jsx("span",{className:"text-sm font-medium",children:n(p.labelKey)}),c.jsx("span",{className:"text-muted-foreground text-xs leading-snug",children:n(p.descKey)})]})]},p.value)})})]}),c.jsx("p",{className:"text-muted-foreground text-xs",children:n("settings.terminal.savedInBrowser")}),t&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"h-px bg-border"}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("span",{className:"block font-medium text-sm",children:n("settings.terminal.shortcuts.title")}),c.jsx("p",{className:"text-muted-foreground text-xs",children:n("settings.terminal.shortcuts.savedOnServer")}),c.jsx(Ss,{})]})]})]})}export{Ft as A,Ot as C,ss as F,_s as R,ps as S,Ds as T,As as a,Ss as b,is as c,Ge as d,gs as f,_t as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as l,D as pt,V as Wt,W as Pt,X as Bt,c as gt,l as S,I as Vt,N as Ft,Y as ft,d as J,C as zt,$ as Gt,z as Ot}from"./mermaid.core-
|
|
1
|
+
import{_ as l,D as pt,V as Wt,W as Pt,X as Bt,c as gt,l as S,I as Vt,N as Ft,Y as ft,d as J,C as zt,$ as Gt,z as Ot}from"./mermaid.core-C3nmuA6R.js";import{d as ot}from"./arc-DNrUdLWP.js";import"./index-Dc3Fwpho.js";var tt=(function(){var e=l(function(k,s,d,h){for(d=d||{},h=k.length;h--;d[k[h]]=s);return d},"o"),t=[6,11,13,14,15,17,19,20,23,24],n=[1,12],i=[1,13],r=[1,14],o=[1,15],c=[1,16],a=[1,19],p=[1,20],y={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:l(function(s,d,h,g,m,u,w){var v=u.length-1;switch(m){case 1:return u[v-1];case 3:g.setDirection("LR");break;case 4:g.setDirection("TD");break;case 5:this.$=[];break;case 6:u[v-1].push(u[v]),this.$=u[v-1];break;case 7:case 8:this.$=u[v];break;case 9:case 10:this.$=[];break;case 11:g.getCommonDb().setDiagramTitle(u[v].substr(6)),this.$=u[v].substr(6);break;case 12:this.$=u[v].trim(),g.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=u[v].trim(),g.getCommonDb().setAccDescription(this.$);break;case 15:g.addSection(u[v].substr(8)),this.$=u[v].substr(8);break;case 18:g.addTask(u[v],0,""),this.$=u[v];break;case 19:g.addEvent(u[v].substr(2)),this.$=u[v];break}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(t,[2,5],{5:6}),e(t,[2,2]),e(t,[2,3]),e(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:n,15:i,17:r,19:o,20:c,21:17,22:18,23:a,24:p},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:n,15:i,17:r,19:o,20:c,21:17,22:18,23:a,24:p},e(t,[2,8]),e(t,[2,9]),e(t,[2,11]),{16:[1,22]},{18:[1,23]},e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,7]),e(t,[2,12]),e(t,[2,13])],defaultActions:{},parseError:l(function(s,d){if(d.recoverable)this.trace(s);else{var h=new Error(s);throw h.hash=d,h}},"parseError"),parse:l(function(s){var d=this,h=[0],g=[],m=[null],u=[],w=this.table,v="",M=0,R=0,P=2,V=1,L=u.slice.call(arguments,1),_=Object.create(this.lexer),C={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(C.yy[F]=this.yy[F]);_.setInput(s,C.yy),C.yy.lexer=_,C.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var z=_.yylloc;u.push(z);var q=_.options&&_.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function X(A){h.length=h.length-2*A,m.length=m.length-A,u.length=u.length-A}l(X,"popStack");function O(){var A;return A=g.pop()||_.lex()||V,typeof A!="number"&&(A instanceof Array&&(g=A,A=g.pop()),A=d.symbols_[A]||A),A}l(O,"lex");for(var $,N,b,T,E={},H,I,B,D;;){if(N=h[h.length-1],this.defaultActions[N]?b=this.defaultActions[N]:(($===null||typeof $>"u")&&($=O()),b=w[N]&&w[N][$]),typeof b>"u"||!b.length||!b[0]){var K="";D=[];for(H in w[N])this.terminals_[H]&&H>P&&D.push("'"+this.terminals_[H]+"'");_.showPosition?K="Parse error on line "+(M+1)+`:
|
|
2
2
|
`+_.showPosition()+`
|
|
3
3
|
Expecting `+D.join(", ")+", got '"+(this.terminals_[$]||$)+"'":K="Parse error on line "+(M+1)+": Unexpected "+($==V?"end of input":"'"+(this.terminals_[$]||$)+"'"),this.parseError(K,{text:_.match,token:this.terminals_[$]||$,line:_.yylineno,loc:z,expected:D})}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+N+", token: "+$);switch(b[0]){case 1:h.push($),m.push(_.yytext),u.push(_.yylloc),h.push(b[1]),$=null,R=_.yyleng,v=_.yytext,M=_.yylineno,z=_.yylloc;break;case 2:if(I=this.productions_[b[1]][1],E.$=m[m.length-I],E._$={first_line:u[u.length-(I||1)].first_line,last_line:u[u.length-1].last_line,first_column:u[u.length-(I||1)].first_column,last_column:u[u.length-1].last_column},q&&(E._$.range=[u[u.length-(I||1)].range[0],u[u.length-1].range[1]]),T=this.performAction.apply(E,[v,R,M,C.yy,b[1],m,u].concat(L)),typeof T<"u")return T;I&&(h=h.slice(0,-1*I*2),m=m.slice(0,-1*I),u=u.slice(0,-1*I)),h.push(this.productions_[b[1]][0]),m.push(E.$),u.push(E._$),B=w[h[h.length-2]][h[h.length-1]],h.push(B);break;case 3:return!0}}return!0},"parse")},x=(function(){var k={EOF:1,parseError:l(function(d,h){if(this.yy.parser)this.yy.parser.parseError(d,h);else throw new Error(d)},"parseError"),setInput:l(function(s,d){return this.yy=d||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:l(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var d=s.match(/(?:\r\n?|\n).*/g);return d?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:l(function(s){var d=s.length,h=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-d),this.offset-=d;var g=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),h.length-1&&(this.yylineno-=h.length-1);var m=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:h?(h.length===g.length?this.yylloc.first_column:0)+g[g.length-h.length].length-h[0].length:this.yylloc.first_column-d},this.options.ranges&&(this.yylloc.range=[m[0],m[0]+this.yyleng-d]),this.yyleng=this.yytext.length,this},"unput"),more:l(function(){return this._more=!0,this},"more"),reject:l(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:l(function(s){this.unput(this.match.slice(s))},"less"),pastInput:l(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:l(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:l(function(){var s=this.pastInput(),d=new Array(s.length+1).join("-");return s+this.upcomingInput()+`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{aU as Gt,s as Wt,g as Kt,q as Ht,p as Xt,a as Yt,b as Zt,_ as S,D as St,I as Jt,d as rt,al as Qt,V as $t,W as te,X as ee,e as ne,z as se,F as ie,G as re}from"./mermaid.core-D-CshtYr.js";import"./index-B3ddLSja.js";const kt=(t,n)=>Gt(t,"a",-n),_t=1e-10;function st(t,n){const s=ae(t),e=s.filter(c=>oe(c,t));let i=0,r=0;const o=[];if(e.length>1){const c=Et(e);for(let u=0;u<e.length;++u){const a=e[u];a.angle=Math.atan2(a.x-c.x,a.y-c.y)}e.sort((u,a)=>a.angle-u.angle);let f=e[e.length-1];for(let u=0;u<e.length;++u){const a=e[u];r+=(f.x+a.x)*(a.y-f.y);const y={x:(a.x+f.x)/2,y:(a.y+f.y)/2};let d=null;for(let m=0;m<a.parentIndex.length;++m)if(f.parentIndex.includes(a.parentIndex[m])){const x=t[a.parentIndex[m]],M=Math.atan2(a.x-x.x,a.y-x.y),E=Math.atan2(f.x-x.x,f.y-x.y);let _=E-M;_<0&&(_+=2*Math.PI);const w=E-_/2;let g=W(y,{x:x.x+x.radius*Math.sin(w),y:x.y+x.radius*Math.cos(w)});g>x.radius*2&&(g=x.radius*2),(d==null||d.width>g)&&(d={circle:x,width:g,p1:a,p2:f,large:g>x.radius,sweep:!0})}d!=null&&(o.push(d),i+=lt(d.circle.radius,d.width),f=a)}}else{let c=t[0];for(let u=1;u<t.length;++u)t[u].radius<c.radius&&(c=t[u]);let f=!1;for(let u=0;u<t.length;++u)if(W(t[u],c)>Math.abs(c.radius-t[u].radius)){f=!0;break}f?i=r=0:(i=c.radius*c.radius*Math.PI,o.push({circle:c,p1:{x:c.x,y:c.y+c.radius},p2:{x:c.x-_t,y:c.y+c.radius},width:c.radius*2,large:!0,sweep:!0}))}return r/=2,n&&(n.area=i+r,n.arcArea=i,n.polygonArea=r,n.arcs=o,n.innerPoints=e,n.intersectionPoints=s),i+r}function oe(t,n){return n.every(s=>W(t,s)<s.radius+_t)}function ae(t){const n=[];for(let s=0;s<t.length;++s)for(let e=s+1;e<t.length;++e){const i=Tt(t[s],t[e]);for(const r of i)r.parentIndex=[s,e],n.push(r)}return n}function lt(t,n){return t*t*Math.acos(1-n/t)-(t-n)*Math.sqrt(n*(2*t-n))}function W(t,n){return Math.sqrt((t.x-n.x)*(t.x-n.x)+(t.y-n.y)*(t.y-n.y))}function xt(t,n,s){if(s>=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Tt(t,n){const s=W(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const r=(e*e-i*i+s*s)/(2*s),o=Math.sqrt(e*e-r*r),c=t.x+r*(n.x-t.x)/s,f=t.y+r*(n.y-t.y)/s,u=-(n.y-t.y)*(o/s),a=-(n.x-t.x)*(o/s);return[{x:c+u,y:f-a},{x:c-u,y:f+a}]}function Et(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function le(t,n,s,e){e=e||{};const i=e.maxIterations||100,r=e.tolerance||1e-10,o=t(n),c=t(s);let f=s-n;if(o*c>0)throw"Initial bisect points must have opposite signs";if(o===0)return n;if(c===0)return s;for(let u=0;u<i;++u){f/=2;const a=n+f,y=t(a);if(y*o>=0&&(n=a),Math.abs(f)<r||y===0)return a}return n+f}function ct(t){const n=new Array(t);for(let s=0;s<t;++s)n[s]=0;return n}function Mt(t,n){return ct(t).map(()=>ct(n))}function tt(t,n){let s=0;for(let e=0;e<t.length;++e)s+=t[e]*n[e];return s}function ut(t){return Math.sqrt(tt(t,t))}function ht(t,n,s){for(let e=0;e<n.length;++e)t[e]=n[e]*s}function Q(t,n,s,e,i){for(let r=0;r<t.length;++r)t[r]=n*s[r]+e*i[r]}function zt(t,n,s){s=s||{};const e=s.maxIterations||n.length*200,i=s.nonZeroDelta||1.05,r=s.zeroDelta||.001,o=s.minErrorDelta||1e-6,c=s.minErrorDelta||1e-5,f=s.rho!==void 0?s.rho:1,u=s.chi!==void 0?s.chi:2,a=s.psi!==void 0?s.psi:-.5,y=s.sigma!==void 0?s.sigma:.5;let d;const m=n.length,x=new Array(m+1);x[0]=n,x[0].fx=t(n),x[0].id=0;for(let v=0;v<m;++v){const l=n.slice();l[v]=l[v]?l[v]*i:r,x[v+1]=l,x[v+1].fx=t(l),x[v+1].id=v+1}function M(v){for(let l=0;l<v.length;l++)x[m][l]=v[l];x[m].fx=v.fx}const E=(v,l)=>v.fx-l.fx,_=n.slice(),w=n.slice(),g=n.slice(),b=n.slice();for(let v=0;v<e;++v){if(x.sort(E),s.history){const p=x.map(h=>{const j=h.slice();return j.fx=h.fx,j.id=h.id,j});p.sort((h,j)=>h.id-j.id),s.history.push({x:x[0].slice(),fx:x[0].fx,simplex:p})}d=0;for(let p=0;p<m;++p)d=Math.max(d,Math.abs(x[0][p]-x[1][p]));if(Math.abs(x[0].fx-x[m].fx)<o&&d<c)break;for(let p=0;p<m;++p){_[p]=0;for(let h=0;h<m;++h)_[p]+=x[h][p];_[p]/=m}const l=x[m];if(Q(w,1+f,_,-f,l),w.fx=t(w),w.fx<x[0].fx)Q(b,1+u,_,-u,l),b.fx=t(b),b.fx<w.fx?M(b):M(w);else if(w.fx>=x[m-1].fx){let p=!1;if(w.fx>l.fx?(Q(g,1+a,_,-a,l),g.fx=t(g),g.fx<l.fx?M(g):p=!0):(Q(g,1-a*f,_,a*f,l),g.fx=t(g),g.fx<w.fx?M(g):p=!0),p){if(y>=1)break;for(let h=1;h<x.length;++h)Q(x[h],1-y,x[0],y,x[h]),x[h].fx=t(x[h])}}else M(w)}return x.sort(E),{fx:x[0].fx,x:x[0]}}function ce(t,n,s,e,i,r,o){const c=s.fx,f=tt(s.fxprime,n);let u=c,a=c,y=f,d=0;i=i||1,r=r||1e-6,o=o||.1;function m(x,M,E){for(let _=0;_<16;++_)if(i=(x+M)/2,Q(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),y=tt(e.fxprime,n),u>c+r*i*f||u>=E)M=i;else{if(Math.abs(y)<=-o*f)return i;y*(M-x)>=0&&(M=x),x=i,E=u}return 0}for(let x=0;x<10;++x){if(Q(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),y=tt(e.fxprime,n),u>c+r*i*f||x&&u>=a)return m(d,i,a);if(Math.abs(y)<=-o*f)return i;if(y>=0)return m(i,d,u);a=u,d=i,i*=2}return i}function ue(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const r=n.slice();let o,c,f=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),o=e.fxprime.slice(),ht(o,e.fxprime,-1);for(let a=0;a<u;++a){if(f=ce(t,o,e,i,f),s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),!f)ht(o,e.fxprime,-1);else{Q(r,1,i.fxprime,-1,e.fxprime);const y=tt(e.fxprime,e.fxprime),d=Math.max(0,tt(r,i.fxprime)/y);Q(o,d,o,-1,i.fxprime),c=e,e=i,i=c}if(ut(e.fxprime)<=1e-5)break}return s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),e}function At(t,n={}){n.maxIterations=n.maxIterations||500;const s=n.initialLayout||ge,e=n.lossFunction||et,i=he(t,n),r=s(i,n),o=Object.keys(r),c=[];for(const a of o)c.push(r[a].x),c.push(r[a].y);const u=zt(a=>{const y={};for(let d=0;d<o.length;++d){const m=o[d];y[m]={x:a[2*d],y:a[2*d+1],radius:r[m].radius}}return e(y,i)},c,n).x;for(let a=0;a<o.length;++a){const y=o[a];r[y].x=u[2*a],r[y].y=u[2*a+1]}return r}const Rt=1e-10;function ft(t,n,s){return Math.min(t,n)*Math.min(t,n)*Math.PI<=s+Rt?Math.abs(t-n):le(e=>xt(t,n,e)-s,0,t+n)}function he(t,n={}){const s=n.distinct,e=t.map(c=>Object.assign({},c));function i(c){return c.join(";")}if(s){const c=new Map;for(const f of e)for(let u=0;u<f.sets.length;u++){const a=String(f.sets[u]);c.set(a,f.size+(c.get(a)||0));for(let y=u+1;y<f.sets.length;y++){const d=String(f.sets[y]),m=`${a};${d}`,x=`${d};${a}`;c.set(m,f.size+(c.get(m)||0)),c.set(x,f.size+(c.get(x)||0))}}for(const f of e)f.sets.length<3&&(f.size=c.get(i(f.sets)))}const r=[],o=new Set;for(const c of e)if(c.sets.length===1)r.push(c.sets[0]);else if(c.sets.length===2){const f=c.sets[0],u=c.sets[1];o.add(i(c.sets)),o.add(i([u,f]))}r.sort((c,f)=>c===f?0:c<f?-1:1);for(let c=0;c<r.length;++c){const f=r[c];for(let u=c+1;u<r.length;++u){const a=r[u];o.has(i([f,a]))||e.push({sets:[f,a],size:0})}}return e}function fe(t,n,s){const e=Mt(n.length,n.length),i=Mt(n.length,n.length);return t.filter(r=>r.sets.length===2).forEach(r=>{const o=s[r.sets[0]],c=s[r.sets[1]],f=Math.sqrt(n[o].size/Math.PI),u=Math.sqrt(n[c].size/Math.PI),a=ft(f,u,r.size);e[o][c]=e[c][o]=a;let y=0;r.size+1e-10>=Math.min(n[o].size,n[c].size)?y=1:r.size<=1e-10&&(y=-1),i[o][c]=i[c][o]=y}),{distances:e,constraints:i}}function de(t,n,s,e){for(let r=0;r<n.length;++r)n[r]=0;let i=0;for(let r=0;r<s.length;++r){const o=t[2*r],c=t[2*r+1];for(let f=r+1;f<s.length;++f){const u=t[2*f],a=t[2*f+1],y=s[r][f],d=e[r][f],m=(u-o)*(u-o)+(a-c)*(a-c),x=Math.sqrt(m),M=m-y*y;d>0&&x<=y||d<0&&x>=y||(i+=2*M*M,n[2*r]+=4*M*(o-u),n[2*r+1]+=4*M*(c-a),n[2*f]+=4*M*(u-o),n[2*f+1]+=4*M*(a-c))}}return i}function ge(t,n={}){let s=ye(t,n);const e=n.lossFunction||et;if(t.length>=8){const i=xe(t,n),r=e(i,t),o=e(s,t);r+1e-8<o&&(s=i)}return s}function xe(t,n={}){const s=n.restarts||10,e=[],i={};for(const d of t)d.sets.length===1&&(i[d.sets[0]]=e.length,e.push(d));let{distances:r,constraints:o}=fe(t,e,i);const c=ut(r.map(ut))/r.length;r=r.map(d=>d.map(m=>m/c));const f=(d,m)=>de(d,m,r,o);let u=null;for(let d=0;d<s;++d){const m=ct(r.length*2).map(Math.random),x=ue(f,m,n);(!u||x.fx<u.fx)&&(u=x)}const a=u.x,y={};for(let d=0;d<e.length;++d){const m=e[d];y[m.sets[0]]={x:a[2*d]*c,y:a[2*d+1]*c,radius:Math.sqrt(m.size/Math.PI)}}if(n.history)for(const d of n.history)ht(d.x,c);return y}function ye(t,n){const s=n&&n.lossFunction?n.lossFunction:et,e={},i={};for(const y of t)if(y.sets.length===1){const d=y.sets[0];e[d]={x:1e10,y:1e10,rowid:e.length,size:y.size,radius:Math.sqrt(y.size/Math.PI)},i[d]=[]}t=t.filter(y=>y.sets.length===2);for(const y of t){let d=y.weight!=null?y.weight:1;const m=y.sets[0],x=y.sets[1];y.size+Rt>=Math.min(e[m].size,e[x].size)&&(d=0),i[m].push({set:x,size:y.size,weight:d}),i[x].push({set:m,size:y.size,weight:d})}const r=[];Object.keys(i).forEach(y=>{let d=0;for(let m=0;m<i[y].length;++m)d+=i[y][m].size*i[y][m].weight;r.push({set:y,size:d})});function o(y,d){return d.size-y.size}r.sort(o);const c={};function f(y){return y.set in c}function u(y,d){e[d].x=y.x,e[d].y=y.y,c[d]=!0}u({x:0,y:0},r[0].set);for(let y=1;y<r.length;++y){const d=r[y].set,m=i[d].filter(f),x=e[d];if(m.sort(o),m.length===0)throw"ERROR: missing pairwise overlap information";const M=[];for(var a=0;a<m.length;++a){const w=e[m[a].set],g=ft(x.radius,w.radius,m[a].size);M.push({x:w.x+g,y:w.y}),M.push({x:w.x-g,y:w.y}),M.push({y:w.y+g,x:w.x}),M.push({y:w.y-g,x:w.x});for(let b=a+1;b<m.length;++b){const v=e[m[b].set],l=ft(x.radius,v.radius,m[b].size),p=Tt({x:w.x,y:w.y,radius:g},{x:v.x,y:v.y,radius:l});M.push(...p)}}let E=1e50,_=M[0];for(const w of M){e[d].x=w.x,e[d].y=w.y;const g=s(e,t);g<E&&(E=g,_=w)}u(_,d)}return e}function et(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const o=t[e.sets[0]],c=t[e.sets[1]];i=xt(o.radius,c.radius,W(o,c))}else i=st(e.sets.map(o=>t[o]));const r=e.weight!=null?e.weight:1;s+=r*(i-e.size)*(i-e.size)}return s}function Dt(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const c=t[e.sets[0]],f=t[e.sets[1]];i=xt(c.radius,f.radius,W(c,f))}else i=st(e.sets.map(c=>t[c]));const r=e.weight!=null?e.weight:1,o=Math.log((i+1)/(e.size+1));s+=r*o*o}return s}function pe(t,n,s){if(s==null?t.sort((i,r)=>r.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,r=t[0].y;for(const o of t)o.x-=i,o.y-=r}if(t.length===2&&W(t[0],t[1])<Math.abs(t[1].radius-t[0].radius)&&(t[1].x=t[0].x+t[0].radius-t[1].radius-1e-10,t[1].y=t[0].y),t.length>1){const i=Math.atan2(t[1].x,t[1].y)-n,r=Math.cos(i),o=Math.sin(i);for(const c of t){const f=c.x,u=c.y;c.x=r*f-o*u,c.y=o*f+r*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const r=t[1].y/(1e-10+t[1].x);for(const o of t){var e=(o.x+r*o.y)/(1+r*r);o.x=2*e-o.x,o.y=2*e*r-o.y}}}}function me(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,r){const o=n(i),c=n(r);o.parent=c}for(let i=0;i<t.length;++i)for(let r=i+1;r<t.length;++r){const o=t[i].radius+t[r].radius;W(t[i],t[r])+1e-10<o&&s(t[r],t[i])}const e=new Map;for(let i=0;i<t.length;++i){const r=n(t[i]).parent.setid;e.has(r)||e.set(r,[]),e.get(r).push(t[i])}return t.forEach(i=>{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((r,o)=>Math.max(r,o[s]+o.radius),Number.NEGATIVE_INFINITY),i=t.reduce((r,o)=>Math.min(r,o[s]-o.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Ct(t,n,s){n==null&&(n=Math.PI/2);let e=Ft(t).map(u=>Object.assign({},u));const i=me(e);for(const u of i){pe(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let r=e.bounds;const o=(r.xRange.max-r.xRange.min)/50;function c(u,a,y){if(!u)return;const d=u.bounds;let m,x;if(a)m=r.xRange.max-d.xRange.min+o;else{m=r.xRange.max-d.xRange.max;const M=(d.xRange.max-d.xRange.min)/2-(r.xRange.max-r.xRange.min)/2;M<0&&(m+=M)}if(y)x=r.yRange.max-d.yRange.min+o;else{x=r.yRange.max-d.yRange.max;const M=(d.yRange.max-d.yRange.min)/2-(r.yRange.max-r.yRange.min)/2;M<0&&(x+=M)}for(const M of u)M.x+=m,M.y+=x,e.push(M)}let f=1;for(;f<i.length;)c(i[f],!0,!1),c(i[f+1],!1,!0),c(i[f+2],!0,!0),f+=3,r=dt(e);return Ot(e)}function Nt(t,n,s,e,i){const r=Ft(t);n-=2*e,s-=2*e;const{xRange:o,yRange:c}=dt(r);if(o.max===o.min||c.max===c.min)return console.log("not scaling solution: zero size detected"),t;let f,u;if(i){const m=Math.sqrt(i/Math.PI)*2;f=n/m,u=s/m}else f=n/(o.max-o.min),u=s/(c.max-c.min);const a=Math.min(u,f),y=(n-(o.max-o.min)*a)/2,d=(s-(c.max-c.min)*a)/2;return Ot(r.map(m=>({radius:a*m.radius,x:e+y+(m.x-o.min)*a,y:e+d+(m.y-c.min)*a,setid:m.setid})))}function Ot(t){const n={};for(const s of t)n[s.setid]=s;return n}function Ft(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function be(t={}){let n=!1,s=600,e=350,i=15,r=1e3,o=Math.PI/2,c=!0,f=null,u=!0,a=!0,y=null,d=null,m=!1,x=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},_=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],w=0,g=function(p){if(p in E)return E[p];var h=E[p]=_[w];return w+=1,w>=_.length&&(w=0),h},b=At,v=et;function l(p){let h=p.datum();const j=new Set;h.forEach(I=>{I.size==0&&I.sets.length==1&&j.add(I.sets[0])}),h=h.filter(I=>!I.sets.some(L=>j.has(L)));let k={},N={};if(h.length>0){let I=b(h,{lossFunction:v,distinct:m});c&&(I=Ct(I,o,d)),k=Nt(I,s,e,i,f),N=jt(k,h,M)}const X={};h.forEach(I=>{I.label&&(X[I.sets]=I.label)});function B(I){if(I.sets in X)return X[I.sets];if(I.sets.length==1)return""+I.sets[0]}p.selectAll("svg").data([k]).enter().append("svg");const U=p.select("svg");n?U.attr("viewBox",`0 0 ${s} ${e}`):U.attr("width",s).attr("height",e);const q={};let z=!1;U.selectAll(".venn-area path").each(function(I){const L=this.getAttribute("d");I.sets.length==1&&L&&!m&&(z=!0,q[I.sets[0]]=ke(L))});function A(I){return L=>{const G=I.sets.map(Z=>{let H=q[Z],J=k[Z];return H||(H={x:s/2,y:e/2,radius:1}),J||(J={x:s/2,y:e/2,radius:1}),{x:H.x*(1-L)+J.x*L,y:H.y*(1-L)+J.y*L,radius:H.radius*(1-L)+J.radius*L}});return wt(G,x)}}const D=U.selectAll(".venn-area").data(h,I=>I.sets),O=D.enter().append("g").attr("class",I=>`venn-area venn-${I.sets.length==1?"circle":"intersection"}${I.colour||I.color?" venn-coloured":""}`).attr("data-venn-sets",I=>I.sets.join("_")),P=O.append("path"),V=O.append("text").attr("class","label").text(I=>B(I)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(P.style("fill-opacity","0").filter(I=>I.sets.length==1).style("fill",I=>I.colour?I.colour:I.color?I.color:g(I.sets)).style("fill-opacity",".25"),V.style("fill",I=>I.colour||I.color?"#FFF":t.textFill?t.textFill:I.sets.length==1?g(I.sets):"#444"));function R(I){return typeof I.transition=="function"?I.transition("venn").duration(r):I}let T=p;z&&typeof T.transition=="function"?(T=R(p),T.selectAll("path").attrTween("d",A)):T.selectAll("path").attr("d",I=>wt(I.sets.map(L=>k[L])),x);const F=T.selectAll("text").filter(I=>I.sets in N).text(I=>B(I)).attr("x",I=>Math.floor(N[I.sets].x)).attr("y",I=>Math.floor(N[I.sets].y));u&&(z?"on"in F?F.on("end",ot(k,B)):F.each("end",ot(k,B)):F.each(ot(k,B)));const C=R(D.exit()).remove();typeof D.transition=="function"&&C.selectAll("path").attrTween("d",A);const Y=C.selectAll("text").attr("x",s/2).attr("y",e/2);return y!==null&&(V.style("font-size","0px"),F.style("font-size",y),Y.style("font-size","0px")),{circles:k,textCentres:N,nodes:D,enter:O,update:T,exit:C}}return l.wrap=function(p){return arguments.length?(u=p,l):u},l.useViewBox=function(){return n=!0,l},l.width=function(p){return arguments.length?(s=p,l):s},l.height=function(p){return arguments.length?(e=p,l):e},l.padding=function(p){return arguments.length?(i=p,l):i},l.distinct=function(p){return arguments.length?(m=p,l):m},l.colours=function(p){return arguments.length?(g=p,l):g},l.colors=function(p){return arguments.length?(g=p,l):g},l.fontSize=function(p){return arguments.length?(y=p,l):y},l.round=function(p){return arguments.length?(x=p,l):x},l.duration=function(p){return arguments.length?(r=p,l):r},l.layoutFunction=function(p){return arguments.length?(b=p,l):b},l.normalize=function(p){return arguments.length?(c=p,l):c},l.scaleToFit=function(p){return arguments.length?(f=p,l):f},l.styled=function(p){return arguments.length?(a=p,l):a},l.orientation=function(p){return arguments.length?(o=p,l):o},l.orientationOrder=function(p){return arguments.length?(d=p,l):d},l.lossFunction=function(p){return arguments.length?(v=p==="default"?et:p==="logRatio"?Dt:p,l):v},l}function ot(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,r=n(s)||"",o=r.split(/\s+/).reverse(),f=(r.length+o.length)/3;let u=o.pop(),a=[u],y=0;const d=1.1;e.textContent=null;const m=[];function x(g){const b=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return b.textContent=g,m.push(b),e.append(b),b}let M=x(u);for(;u=o.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>f&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=x(u),y++)}const E=.35-y*d/2,_=e.getAttribute("x"),w=e.getAttribute("y");m.forEach((g,b)=>{g.setAttribute("x",_),g.setAttribute("y",w),g.setAttribute("dy",`${E+b*d}em`)})}}function at(t,n,s){let e=n[0].radius-W(n[0],t);for(let i=1;i<n.length;++i){const r=n[i].radius-W(n[i],t);r<=e&&(e=r)}for(let i=0;i<s.length;++i){const r=W(s[i],t)-s[i].radius;r<=e&&(e=r)}return e}function Lt(t,n,s){const e=[];for(const a of t)e.push({x:a.x,y:a.y}),e.push({x:a.x+a.radius/2,y:a.y}),e.push({x:a.x-a.radius/2,y:a.y}),e.push({x:a.x,y:a.y+a.radius/2}),e.push({x:a.x,y:a.y-a.radius/2});let i=e[0],r=at(e[0],t,n);for(let a=1;a<e.length;++a){const y=at(e[a],t,n);y>=r&&(i=e[a],r=y)}const o=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,c={x:s?0:o[0],y:o[1]};let f=!0;for(const a of t)if(W(c,a)>a.radius){f=!1;break}for(const a of n)if(W(c,a)<a.radius){f=!1;break}if(f)return c;if(t.length==1)return{x:t[0].x,y:t[0].y};const u={};return st(t,u),u.arcs.length===0?{x:0,y:-1e3,disjoint:!0}:u.arcs.length==1?{x:u.arcs[0].circle.x,y:u.arcs[0].circle.y}:n.length?Lt(t,[]):Et(u.arcs.map(a=>a.p1))}function ve(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e<s.length;e++){const i=s[e],r=t[i];for(let o=e+1;o<s.length;++o){const c=s[o],f=t[c],u=W(r,f);u+f.radius<=r.radius+1e-10?n[c].push(i):u+r.radius<=f.radius+1e-10&&n[i].push(c)}}return n}function jt(t,n,s){const e={},i=ve(t);for(let r=0;r<n.length;++r){const o=n[r].sets,c={},f={};for(let d=0;d<o.length;++d){c[o[d]]=!0;const m=i[o[d]];for(let x=0;x<m.length;++x)f[m[x]]=!0}const u=[],a=[];for(let d in t)d in c?u.push(t[d]):d in f||a.push(t[d]);const y=Lt(u,a,s);e[o]=y,y.disjoint&&n[r].size>0&&console.log("WARNING: area "+o+" not represented on screen")}return e}function Ie(t,n,s){const e=[];return e.push(`
|
|
1
|
+
import{aU as Gt,s as Wt,g as Kt,q as Ht,p as Xt,a as Yt,b as Zt,_ as S,D as St,I as Jt,d as rt,al as Qt,V as $t,W as te,X as ee,e as ne,z as se,F as ie,G as re}from"./mermaid.core-C3nmuA6R.js";import"./index-Dc3Fwpho.js";const kt=(t,n)=>Gt(t,"a",-n),_t=1e-10;function st(t,n){const s=ae(t),e=s.filter(c=>oe(c,t));let i=0,r=0;const o=[];if(e.length>1){const c=Et(e);for(let u=0;u<e.length;++u){const a=e[u];a.angle=Math.atan2(a.x-c.x,a.y-c.y)}e.sort((u,a)=>a.angle-u.angle);let f=e[e.length-1];for(let u=0;u<e.length;++u){const a=e[u];r+=(f.x+a.x)*(a.y-f.y);const y={x:(a.x+f.x)/2,y:(a.y+f.y)/2};let d=null;for(let m=0;m<a.parentIndex.length;++m)if(f.parentIndex.includes(a.parentIndex[m])){const x=t[a.parentIndex[m]],M=Math.atan2(a.x-x.x,a.y-x.y),E=Math.atan2(f.x-x.x,f.y-x.y);let _=E-M;_<0&&(_+=2*Math.PI);const w=E-_/2;let g=W(y,{x:x.x+x.radius*Math.sin(w),y:x.y+x.radius*Math.cos(w)});g>x.radius*2&&(g=x.radius*2),(d==null||d.width>g)&&(d={circle:x,width:g,p1:a,p2:f,large:g>x.radius,sweep:!0})}d!=null&&(o.push(d),i+=lt(d.circle.radius,d.width),f=a)}}else{let c=t[0];for(let u=1;u<t.length;++u)t[u].radius<c.radius&&(c=t[u]);let f=!1;for(let u=0;u<t.length;++u)if(W(t[u],c)>Math.abs(c.radius-t[u].radius)){f=!0;break}f?i=r=0:(i=c.radius*c.radius*Math.PI,o.push({circle:c,p1:{x:c.x,y:c.y+c.radius},p2:{x:c.x-_t,y:c.y+c.radius},width:c.radius*2,large:!0,sweep:!0}))}return r/=2,n&&(n.area=i+r,n.arcArea=i,n.polygonArea=r,n.arcs=o,n.innerPoints=e,n.intersectionPoints=s),i+r}function oe(t,n){return n.every(s=>W(t,s)<s.radius+_t)}function ae(t){const n=[];for(let s=0;s<t.length;++s)for(let e=s+1;e<t.length;++e){const i=Tt(t[s],t[e]);for(const r of i)r.parentIndex=[s,e],n.push(r)}return n}function lt(t,n){return t*t*Math.acos(1-n/t)-(t-n)*Math.sqrt(n*(2*t-n))}function W(t,n){return Math.sqrt((t.x-n.x)*(t.x-n.x)+(t.y-n.y)*(t.y-n.y))}function xt(t,n,s){if(s>=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Tt(t,n){const s=W(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const r=(e*e-i*i+s*s)/(2*s),o=Math.sqrt(e*e-r*r),c=t.x+r*(n.x-t.x)/s,f=t.y+r*(n.y-t.y)/s,u=-(n.y-t.y)*(o/s),a=-(n.x-t.x)*(o/s);return[{x:c+u,y:f-a},{x:c-u,y:f+a}]}function Et(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function le(t,n,s,e){e=e||{};const i=e.maxIterations||100,r=e.tolerance||1e-10,o=t(n),c=t(s);let f=s-n;if(o*c>0)throw"Initial bisect points must have opposite signs";if(o===0)return n;if(c===0)return s;for(let u=0;u<i;++u){f/=2;const a=n+f,y=t(a);if(y*o>=0&&(n=a),Math.abs(f)<r||y===0)return a}return n+f}function ct(t){const n=new Array(t);for(let s=0;s<t;++s)n[s]=0;return n}function Mt(t,n){return ct(t).map(()=>ct(n))}function tt(t,n){let s=0;for(let e=0;e<t.length;++e)s+=t[e]*n[e];return s}function ut(t){return Math.sqrt(tt(t,t))}function ht(t,n,s){for(let e=0;e<n.length;++e)t[e]=n[e]*s}function Q(t,n,s,e,i){for(let r=0;r<t.length;++r)t[r]=n*s[r]+e*i[r]}function zt(t,n,s){s=s||{};const e=s.maxIterations||n.length*200,i=s.nonZeroDelta||1.05,r=s.zeroDelta||.001,o=s.minErrorDelta||1e-6,c=s.minErrorDelta||1e-5,f=s.rho!==void 0?s.rho:1,u=s.chi!==void 0?s.chi:2,a=s.psi!==void 0?s.psi:-.5,y=s.sigma!==void 0?s.sigma:.5;let d;const m=n.length,x=new Array(m+1);x[0]=n,x[0].fx=t(n),x[0].id=0;for(let v=0;v<m;++v){const l=n.slice();l[v]=l[v]?l[v]*i:r,x[v+1]=l,x[v+1].fx=t(l),x[v+1].id=v+1}function M(v){for(let l=0;l<v.length;l++)x[m][l]=v[l];x[m].fx=v.fx}const E=(v,l)=>v.fx-l.fx,_=n.slice(),w=n.slice(),g=n.slice(),b=n.slice();for(let v=0;v<e;++v){if(x.sort(E),s.history){const p=x.map(h=>{const j=h.slice();return j.fx=h.fx,j.id=h.id,j});p.sort((h,j)=>h.id-j.id),s.history.push({x:x[0].slice(),fx:x[0].fx,simplex:p})}d=0;for(let p=0;p<m;++p)d=Math.max(d,Math.abs(x[0][p]-x[1][p]));if(Math.abs(x[0].fx-x[m].fx)<o&&d<c)break;for(let p=0;p<m;++p){_[p]=0;for(let h=0;h<m;++h)_[p]+=x[h][p];_[p]/=m}const l=x[m];if(Q(w,1+f,_,-f,l),w.fx=t(w),w.fx<x[0].fx)Q(b,1+u,_,-u,l),b.fx=t(b),b.fx<w.fx?M(b):M(w);else if(w.fx>=x[m-1].fx){let p=!1;if(w.fx>l.fx?(Q(g,1+a,_,-a,l),g.fx=t(g),g.fx<l.fx?M(g):p=!0):(Q(g,1-a*f,_,a*f,l),g.fx=t(g),g.fx<w.fx?M(g):p=!0),p){if(y>=1)break;for(let h=1;h<x.length;++h)Q(x[h],1-y,x[0],y,x[h]),x[h].fx=t(x[h])}}else M(w)}return x.sort(E),{fx:x[0].fx,x:x[0]}}function ce(t,n,s,e,i,r,o){const c=s.fx,f=tt(s.fxprime,n);let u=c,a=c,y=f,d=0;i=i||1,r=r||1e-6,o=o||.1;function m(x,M,E){for(let _=0;_<16;++_)if(i=(x+M)/2,Q(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),y=tt(e.fxprime,n),u>c+r*i*f||u>=E)M=i;else{if(Math.abs(y)<=-o*f)return i;y*(M-x)>=0&&(M=x),x=i,E=u}return 0}for(let x=0;x<10;++x){if(Q(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),y=tt(e.fxprime,n),u>c+r*i*f||x&&u>=a)return m(d,i,a);if(Math.abs(y)<=-o*f)return i;if(y>=0)return m(i,d,u);a=u,d=i,i*=2}return i}function ue(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const r=n.slice();let o,c,f=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),o=e.fxprime.slice(),ht(o,e.fxprime,-1);for(let a=0;a<u;++a){if(f=ce(t,o,e,i,f),s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),!f)ht(o,e.fxprime,-1);else{Q(r,1,i.fxprime,-1,e.fxprime);const y=tt(e.fxprime,e.fxprime),d=Math.max(0,tt(r,i.fxprime)/y);Q(o,d,o,-1,i.fxprime),c=e,e=i,i=c}if(ut(e.fxprime)<=1e-5)break}return s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),e}function At(t,n={}){n.maxIterations=n.maxIterations||500;const s=n.initialLayout||ge,e=n.lossFunction||et,i=he(t,n),r=s(i,n),o=Object.keys(r),c=[];for(const a of o)c.push(r[a].x),c.push(r[a].y);const u=zt(a=>{const y={};for(let d=0;d<o.length;++d){const m=o[d];y[m]={x:a[2*d],y:a[2*d+1],radius:r[m].radius}}return e(y,i)},c,n).x;for(let a=0;a<o.length;++a){const y=o[a];r[y].x=u[2*a],r[y].y=u[2*a+1]}return r}const Rt=1e-10;function ft(t,n,s){return Math.min(t,n)*Math.min(t,n)*Math.PI<=s+Rt?Math.abs(t-n):le(e=>xt(t,n,e)-s,0,t+n)}function he(t,n={}){const s=n.distinct,e=t.map(c=>Object.assign({},c));function i(c){return c.join(";")}if(s){const c=new Map;for(const f of e)for(let u=0;u<f.sets.length;u++){const a=String(f.sets[u]);c.set(a,f.size+(c.get(a)||0));for(let y=u+1;y<f.sets.length;y++){const d=String(f.sets[y]),m=`${a};${d}`,x=`${d};${a}`;c.set(m,f.size+(c.get(m)||0)),c.set(x,f.size+(c.get(x)||0))}}for(const f of e)f.sets.length<3&&(f.size=c.get(i(f.sets)))}const r=[],o=new Set;for(const c of e)if(c.sets.length===1)r.push(c.sets[0]);else if(c.sets.length===2){const f=c.sets[0],u=c.sets[1];o.add(i(c.sets)),o.add(i([u,f]))}r.sort((c,f)=>c===f?0:c<f?-1:1);for(let c=0;c<r.length;++c){const f=r[c];for(let u=c+1;u<r.length;++u){const a=r[u];o.has(i([f,a]))||e.push({sets:[f,a],size:0})}}return e}function fe(t,n,s){const e=Mt(n.length,n.length),i=Mt(n.length,n.length);return t.filter(r=>r.sets.length===2).forEach(r=>{const o=s[r.sets[0]],c=s[r.sets[1]],f=Math.sqrt(n[o].size/Math.PI),u=Math.sqrt(n[c].size/Math.PI),a=ft(f,u,r.size);e[o][c]=e[c][o]=a;let y=0;r.size+1e-10>=Math.min(n[o].size,n[c].size)?y=1:r.size<=1e-10&&(y=-1),i[o][c]=i[c][o]=y}),{distances:e,constraints:i}}function de(t,n,s,e){for(let r=0;r<n.length;++r)n[r]=0;let i=0;for(let r=0;r<s.length;++r){const o=t[2*r],c=t[2*r+1];for(let f=r+1;f<s.length;++f){const u=t[2*f],a=t[2*f+1],y=s[r][f],d=e[r][f],m=(u-o)*(u-o)+(a-c)*(a-c),x=Math.sqrt(m),M=m-y*y;d>0&&x<=y||d<0&&x>=y||(i+=2*M*M,n[2*r]+=4*M*(o-u),n[2*r+1]+=4*M*(c-a),n[2*f]+=4*M*(u-o),n[2*f+1]+=4*M*(a-c))}}return i}function ge(t,n={}){let s=ye(t,n);const e=n.lossFunction||et;if(t.length>=8){const i=xe(t,n),r=e(i,t),o=e(s,t);r+1e-8<o&&(s=i)}return s}function xe(t,n={}){const s=n.restarts||10,e=[],i={};for(const d of t)d.sets.length===1&&(i[d.sets[0]]=e.length,e.push(d));let{distances:r,constraints:o}=fe(t,e,i);const c=ut(r.map(ut))/r.length;r=r.map(d=>d.map(m=>m/c));const f=(d,m)=>de(d,m,r,o);let u=null;for(let d=0;d<s;++d){const m=ct(r.length*2).map(Math.random),x=ue(f,m,n);(!u||x.fx<u.fx)&&(u=x)}const a=u.x,y={};for(let d=0;d<e.length;++d){const m=e[d];y[m.sets[0]]={x:a[2*d]*c,y:a[2*d+1]*c,radius:Math.sqrt(m.size/Math.PI)}}if(n.history)for(const d of n.history)ht(d.x,c);return y}function ye(t,n){const s=n&&n.lossFunction?n.lossFunction:et,e={},i={};for(const y of t)if(y.sets.length===1){const d=y.sets[0];e[d]={x:1e10,y:1e10,rowid:e.length,size:y.size,radius:Math.sqrt(y.size/Math.PI)},i[d]=[]}t=t.filter(y=>y.sets.length===2);for(const y of t){let d=y.weight!=null?y.weight:1;const m=y.sets[0],x=y.sets[1];y.size+Rt>=Math.min(e[m].size,e[x].size)&&(d=0),i[m].push({set:x,size:y.size,weight:d}),i[x].push({set:m,size:y.size,weight:d})}const r=[];Object.keys(i).forEach(y=>{let d=0;for(let m=0;m<i[y].length;++m)d+=i[y][m].size*i[y][m].weight;r.push({set:y,size:d})});function o(y,d){return d.size-y.size}r.sort(o);const c={};function f(y){return y.set in c}function u(y,d){e[d].x=y.x,e[d].y=y.y,c[d]=!0}u({x:0,y:0},r[0].set);for(let y=1;y<r.length;++y){const d=r[y].set,m=i[d].filter(f),x=e[d];if(m.sort(o),m.length===0)throw"ERROR: missing pairwise overlap information";const M=[];for(var a=0;a<m.length;++a){const w=e[m[a].set],g=ft(x.radius,w.radius,m[a].size);M.push({x:w.x+g,y:w.y}),M.push({x:w.x-g,y:w.y}),M.push({y:w.y+g,x:w.x}),M.push({y:w.y-g,x:w.x});for(let b=a+1;b<m.length;++b){const v=e[m[b].set],l=ft(x.radius,v.radius,m[b].size),p=Tt({x:w.x,y:w.y,radius:g},{x:v.x,y:v.y,radius:l});M.push(...p)}}let E=1e50,_=M[0];for(const w of M){e[d].x=w.x,e[d].y=w.y;const g=s(e,t);g<E&&(E=g,_=w)}u(_,d)}return e}function et(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const o=t[e.sets[0]],c=t[e.sets[1]];i=xt(o.radius,c.radius,W(o,c))}else i=st(e.sets.map(o=>t[o]));const r=e.weight!=null?e.weight:1;s+=r*(i-e.size)*(i-e.size)}return s}function Dt(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const c=t[e.sets[0]],f=t[e.sets[1]];i=xt(c.radius,f.radius,W(c,f))}else i=st(e.sets.map(c=>t[c]));const r=e.weight!=null?e.weight:1,o=Math.log((i+1)/(e.size+1));s+=r*o*o}return s}function pe(t,n,s){if(s==null?t.sort((i,r)=>r.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,r=t[0].y;for(const o of t)o.x-=i,o.y-=r}if(t.length===2&&W(t[0],t[1])<Math.abs(t[1].radius-t[0].radius)&&(t[1].x=t[0].x+t[0].radius-t[1].radius-1e-10,t[1].y=t[0].y),t.length>1){const i=Math.atan2(t[1].x,t[1].y)-n,r=Math.cos(i),o=Math.sin(i);for(const c of t){const f=c.x,u=c.y;c.x=r*f-o*u,c.y=o*f+r*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const r=t[1].y/(1e-10+t[1].x);for(const o of t){var e=(o.x+r*o.y)/(1+r*r);o.x=2*e-o.x,o.y=2*e*r-o.y}}}}function me(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,r){const o=n(i),c=n(r);o.parent=c}for(let i=0;i<t.length;++i)for(let r=i+1;r<t.length;++r){const o=t[i].radius+t[r].radius;W(t[i],t[r])+1e-10<o&&s(t[r],t[i])}const e=new Map;for(let i=0;i<t.length;++i){const r=n(t[i]).parent.setid;e.has(r)||e.set(r,[]),e.get(r).push(t[i])}return t.forEach(i=>{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((r,o)=>Math.max(r,o[s]+o.radius),Number.NEGATIVE_INFINITY),i=t.reduce((r,o)=>Math.min(r,o[s]-o.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Ct(t,n,s){n==null&&(n=Math.PI/2);let e=Ft(t).map(u=>Object.assign({},u));const i=me(e);for(const u of i){pe(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let r=e.bounds;const o=(r.xRange.max-r.xRange.min)/50;function c(u,a,y){if(!u)return;const d=u.bounds;let m,x;if(a)m=r.xRange.max-d.xRange.min+o;else{m=r.xRange.max-d.xRange.max;const M=(d.xRange.max-d.xRange.min)/2-(r.xRange.max-r.xRange.min)/2;M<0&&(m+=M)}if(y)x=r.yRange.max-d.yRange.min+o;else{x=r.yRange.max-d.yRange.max;const M=(d.yRange.max-d.yRange.min)/2-(r.yRange.max-r.yRange.min)/2;M<0&&(x+=M)}for(const M of u)M.x+=m,M.y+=x,e.push(M)}let f=1;for(;f<i.length;)c(i[f],!0,!1),c(i[f+1],!1,!0),c(i[f+2],!0,!0),f+=3,r=dt(e);return Ot(e)}function Nt(t,n,s,e,i){const r=Ft(t);n-=2*e,s-=2*e;const{xRange:o,yRange:c}=dt(r);if(o.max===o.min||c.max===c.min)return console.log("not scaling solution: zero size detected"),t;let f,u;if(i){const m=Math.sqrt(i/Math.PI)*2;f=n/m,u=s/m}else f=n/(o.max-o.min),u=s/(c.max-c.min);const a=Math.min(u,f),y=(n-(o.max-o.min)*a)/2,d=(s-(c.max-c.min)*a)/2;return Ot(r.map(m=>({radius:a*m.radius,x:e+y+(m.x-o.min)*a,y:e+d+(m.y-c.min)*a,setid:m.setid})))}function Ot(t){const n={};for(const s of t)n[s.setid]=s;return n}function Ft(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function be(t={}){let n=!1,s=600,e=350,i=15,r=1e3,o=Math.PI/2,c=!0,f=null,u=!0,a=!0,y=null,d=null,m=!1,x=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},_=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],w=0,g=function(p){if(p in E)return E[p];var h=E[p]=_[w];return w+=1,w>=_.length&&(w=0),h},b=At,v=et;function l(p){let h=p.datum();const j=new Set;h.forEach(I=>{I.size==0&&I.sets.length==1&&j.add(I.sets[0])}),h=h.filter(I=>!I.sets.some(L=>j.has(L)));let k={},N={};if(h.length>0){let I=b(h,{lossFunction:v,distinct:m});c&&(I=Ct(I,o,d)),k=Nt(I,s,e,i,f),N=jt(k,h,M)}const X={};h.forEach(I=>{I.label&&(X[I.sets]=I.label)});function B(I){if(I.sets in X)return X[I.sets];if(I.sets.length==1)return""+I.sets[0]}p.selectAll("svg").data([k]).enter().append("svg");const U=p.select("svg");n?U.attr("viewBox",`0 0 ${s} ${e}`):U.attr("width",s).attr("height",e);const q={};let z=!1;U.selectAll(".venn-area path").each(function(I){const L=this.getAttribute("d");I.sets.length==1&&L&&!m&&(z=!0,q[I.sets[0]]=ke(L))});function A(I){return L=>{const G=I.sets.map(Z=>{let H=q[Z],J=k[Z];return H||(H={x:s/2,y:e/2,radius:1}),J||(J={x:s/2,y:e/2,radius:1}),{x:H.x*(1-L)+J.x*L,y:H.y*(1-L)+J.y*L,radius:H.radius*(1-L)+J.radius*L}});return wt(G,x)}}const D=U.selectAll(".venn-area").data(h,I=>I.sets),O=D.enter().append("g").attr("class",I=>`venn-area venn-${I.sets.length==1?"circle":"intersection"}${I.colour||I.color?" venn-coloured":""}`).attr("data-venn-sets",I=>I.sets.join("_")),P=O.append("path"),V=O.append("text").attr("class","label").text(I=>B(I)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(P.style("fill-opacity","0").filter(I=>I.sets.length==1).style("fill",I=>I.colour?I.colour:I.color?I.color:g(I.sets)).style("fill-opacity",".25"),V.style("fill",I=>I.colour||I.color?"#FFF":t.textFill?t.textFill:I.sets.length==1?g(I.sets):"#444"));function R(I){return typeof I.transition=="function"?I.transition("venn").duration(r):I}let T=p;z&&typeof T.transition=="function"?(T=R(p),T.selectAll("path").attrTween("d",A)):T.selectAll("path").attr("d",I=>wt(I.sets.map(L=>k[L])),x);const F=T.selectAll("text").filter(I=>I.sets in N).text(I=>B(I)).attr("x",I=>Math.floor(N[I.sets].x)).attr("y",I=>Math.floor(N[I.sets].y));u&&(z?"on"in F?F.on("end",ot(k,B)):F.each("end",ot(k,B)):F.each(ot(k,B)));const C=R(D.exit()).remove();typeof D.transition=="function"&&C.selectAll("path").attrTween("d",A);const Y=C.selectAll("text").attr("x",s/2).attr("y",e/2);return y!==null&&(V.style("font-size","0px"),F.style("font-size",y),Y.style("font-size","0px")),{circles:k,textCentres:N,nodes:D,enter:O,update:T,exit:C}}return l.wrap=function(p){return arguments.length?(u=p,l):u},l.useViewBox=function(){return n=!0,l},l.width=function(p){return arguments.length?(s=p,l):s},l.height=function(p){return arguments.length?(e=p,l):e},l.padding=function(p){return arguments.length?(i=p,l):i},l.distinct=function(p){return arguments.length?(m=p,l):m},l.colours=function(p){return arguments.length?(g=p,l):g},l.colors=function(p){return arguments.length?(g=p,l):g},l.fontSize=function(p){return arguments.length?(y=p,l):y},l.round=function(p){return arguments.length?(x=p,l):x},l.duration=function(p){return arguments.length?(r=p,l):r},l.layoutFunction=function(p){return arguments.length?(b=p,l):b},l.normalize=function(p){return arguments.length?(c=p,l):c},l.scaleToFit=function(p){return arguments.length?(f=p,l):f},l.styled=function(p){return arguments.length?(a=p,l):a},l.orientation=function(p){return arguments.length?(o=p,l):o},l.orientationOrder=function(p){return arguments.length?(d=p,l):d},l.lossFunction=function(p){return arguments.length?(v=p==="default"?et:p==="logRatio"?Dt:p,l):v},l}function ot(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,r=n(s)||"",o=r.split(/\s+/).reverse(),f=(r.length+o.length)/3;let u=o.pop(),a=[u],y=0;const d=1.1;e.textContent=null;const m=[];function x(g){const b=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return b.textContent=g,m.push(b),e.append(b),b}let M=x(u);for(;u=o.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>f&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=x(u),y++)}const E=.35-y*d/2,_=e.getAttribute("x"),w=e.getAttribute("y");m.forEach((g,b)=>{g.setAttribute("x",_),g.setAttribute("y",w),g.setAttribute("dy",`${E+b*d}em`)})}}function at(t,n,s){let e=n[0].radius-W(n[0],t);for(let i=1;i<n.length;++i){const r=n[i].radius-W(n[i],t);r<=e&&(e=r)}for(let i=0;i<s.length;++i){const r=W(s[i],t)-s[i].radius;r<=e&&(e=r)}return e}function Lt(t,n,s){const e=[];for(const a of t)e.push({x:a.x,y:a.y}),e.push({x:a.x+a.radius/2,y:a.y}),e.push({x:a.x-a.radius/2,y:a.y}),e.push({x:a.x,y:a.y+a.radius/2}),e.push({x:a.x,y:a.y-a.radius/2});let i=e[0],r=at(e[0],t,n);for(let a=1;a<e.length;++a){const y=at(e[a],t,n);y>=r&&(i=e[a],r=y)}const o=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,c={x:s?0:o[0],y:o[1]};let f=!0;for(const a of t)if(W(c,a)>a.radius){f=!1;break}for(const a of n)if(W(c,a)<a.radius){f=!1;break}if(f)return c;if(t.length==1)return{x:t[0].x,y:t[0].y};const u={};return st(t,u),u.arcs.length===0?{x:0,y:-1e3,disjoint:!0}:u.arcs.length==1?{x:u.arcs[0].circle.x,y:u.arcs[0].circle.y}:n.length?Lt(t,[]):Et(u.arcs.map(a=>a.p1))}function ve(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e<s.length;e++){const i=s[e],r=t[i];for(let o=e+1;o<s.length;++o){const c=s[o],f=t[c],u=W(r,f);u+f.radius<=r.radius+1e-10?n[c].push(i):u+r.radius<=f.radius+1e-10&&n[i].push(c)}}return n}function jt(t,n,s){const e={},i=ve(t);for(let r=0;r<n.length;++r){const o=n[r].sets,c={},f={};for(let d=0;d<o.length;++d){c[o[d]]=!0;const m=i[o[d]];for(let x=0;x<m.length;++x)f[m[x]]=!0}const u=[],a=[];for(let d in t)d in c?u.push(t[d]):d in f||a.push(t[d]);const y=Lt(u,a,s);e[o]=y,y.disjoint&&n[r].size>0&&console.log("WARNING: area "+o+" not represented on screen")}return e}function Ie(t,n,s){const e=[];return e.push(`
|
|
2
2
|
M`,t,n),e.push(`
|
|
3
3
|
m`,-s,0),e.push(`
|
|
4
4
|
a`,s,s,0,1,0,s*2,0),e.push(`
|
package/resources/fe-dist/assets/{wardley-L42UT6IY-CTyaodt9.js → wardley-L42UT6IY-DTlpnptg.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var DN=Object.defineProperty;var MN=(t,e,r)=>e in t?DN(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var jr=(t,e,r)=>MN(t,typeof e!="symbol"?e+"":e,r);import{bA as er}from"./index-B3ddLSja.js";var xN=Object.create,hc=Object.defineProperty,FN=Object.getOwnPropertyDescriptor,Fh=Object.getOwnPropertyNames,GN=Object.getPrototypeOf,jN=Object.prototype.hasOwnProperty,s=(t,e)=>hc(t,"name",{value:e,configurable:!0}),UN=(t,e)=>function(){return t&&(e=(0,t[Fh(t)[0]])(t=0)),e},Y=(t,e)=>function(){return e||(0,t[Fh(t)[0]])((e={exports:{}}).exports,e),e.exports},Qr=(t,e)=>{for(var r in e)hc(t,r,{get:e[r],enumerable:!0})},Gh=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Fh(e))!jN.call(t,a)&&a!==r&&hc(t,a,{get:()=>e[a],enumerable:!(n=FN(e,a))||n.enumerable});return t},ff=(t,e,r)=>(Gh(t,e,"default"),r),jh=(t,e,r)=>(r=t!=null?xN(GN(t)):{},Gh(hc(r,"default",{value:t,enumerable:!0}),t)),Uh=t=>Gh(hc({},"__esModule",{value:!0}),t),df={};Qr(df,{AnnotatedTextEdit:()=>Tr,ChangeAnnotation:()=>fn,ChangeAnnotationIdentifier:()=>Xe,CodeAction:()=>Ep,CodeActionContext:()=>Ap,CodeActionKind:()=>$p,CodeActionTriggerKind:()=>Nl,CodeDescription:()=>Qd,CodeLens:()=>_p,Color:()=>ru,ColorInformation:()=>Vd,ColorPresentation:()=>Hd,Command:()=>un,CompletionItem:()=>cp,CompletionItemKind:()=>np,CompletionItemLabelDetails:()=>lp,CompletionItemTag:()=>ip,CompletionList:()=>up,CreateFile:()=>Ra,DeleteFile:()=>Aa,Diagnostic:()=>Sl,DiagnosticRelatedInformation:()=>nu,DiagnosticSeverity:()=>Jd,DiagnosticTag:()=>Zd,DocumentHighlight:()=>mp,DocumentHighlightKind:()=>hp,DocumentLink:()=>Sp,DocumentSymbol:()=>Rp,DocumentUri:()=>Kd,EOL:()=>mT,FoldingRange:()=>Xd,FoldingRangeKind:()=>Yd,FormattingOptions:()=>Cp,Hover:()=>fp,InlayHint:()=>Dp,InlayHintKind:()=>su,InlayHintLabelPart:()=>ou,InlineCompletionContext:()=>Up,InlineCompletionItem:()=>xp,InlineCompletionList:()=>Fp,InlineCompletionTriggerKind:()=>Gp,InlineValueContext:()=>Lp,InlineValueEvaluatableExpression:()=>Op,InlineValueText:()=>kp,InlineValueVariableLookup:()=>Pp,InsertReplaceEdit:()=>sp,InsertTextFormat:()=>ap,InsertTextMode:()=>op,Location:()=>Cl,LocationLink:()=>Wd,MarkedString:()=>Il,MarkupContent:()=>Ea,MarkupKind:()=>iu,OptionalVersionedTextDocumentIdentifier:()=>wl,ParameterInformation:()=>dp,Position:()=>ie,Range:()=>ee,RenameFile:()=>$a,SelectedCompletionInfo:()=>jp,SelectionRange:()=>bp,SemanticTokenModifiers:()=>Ip,SemanticTokenTypes:()=>wp,SemanticTokens:()=>Np,SignatureInformation:()=>pp,StringValue:()=>Mp,SymbolInformation:()=>vp,SymbolKind:()=>gp,SymbolTag:()=>yp,TextDocument:()=>Bp,TextDocumentEdit:()=>bl,TextDocumentIdentifier:()=>ep,TextDocumentItem:()=>rp,TextEdit:()=>rr,URI:()=>tu,VersionedTextDocumentIdentifier:()=>tp,WorkspaceChange:()=>hT,WorkspaceEdit:()=>au,WorkspaceFolder:()=>zp,WorkspaceSymbol:()=>Tp,integer:()=>qd,uinteger:()=>_l});var Kd,tu,qd,_l,ie,ee,Cl,Wd,ru,Vd,Hd,Yd,Xd,nu,Jd,Zd,Qd,Sl,un,rr,fn,Xe,Tr,bl,Ra,$a,Aa,au,hl,$d,hT,ep,tp,wl,rp,iu,Ea,np,ap,ip,sp,op,lp,cp,up,Il,fp,dp,pp,hp,mp,gp,yp,vp,Tp,Rp,$p,Nl,Ap,Ep,_p,Cp,Sp,bp,wp,Ip,Np,kp,Pp,Op,Lp,su,ou,Dp,Mp,xp,Fp,Gp,jp,Up,zp,mT,Bp,_y,_,mc=UN({"../../node_modules/.pnpm/vscode-languageserver-types@3.17.5/node_modules/vscode-languageserver-types/lib/esm/main.js"(){var t,e,r,n;(function(a){function i(o){return typeof o=="string"}s(i,"is"),a.is=i})(Kd||(Kd={})),(function(a){function i(o){return typeof o=="string"}s(i,"is"),a.is=i})(tu||(tu={})),(function(a){a.MIN_VALUE=-2147483648,a.MAX_VALUE=2147483647;function i(o){return typeof o=="number"&&a.MIN_VALUE<=o&&o<=a.MAX_VALUE}s(i,"is"),a.is=i})(qd||(qd={})),(function(a){a.MIN_VALUE=0,a.MAX_VALUE=2147483647;function i(o){return typeof o=="number"&&a.MIN_VALUE<=o&&o<=a.MAX_VALUE}s(i,"is"),a.is=i})(_l||(_l={})),(function(a){function i(c,l){return c===Number.MAX_VALUE&&(c=_l.MAX_VALUE),l===Number.MAX_VALUE&&(l=_l.MAX_VALUE),{line:c,character:l}}s(i,"create"),a.create=i;function o(c){let l=c;return _.objectLiteral(l)&&_.uinteger(l.line)&&_.uinteger(l.character)}s(o,"is"),a.is=o})(ie||(ie={})),(function(a){function i(c,l,u,f){if(_.uinteger(c)&&_.uinteger(l)&&_.uinteger(u)&&_.uinteger(f))return{start:ie.create(c,l),end:ie.create(u,f)};if(ie.is(c)&&ie.is(l))return{start:c,end:l};throw new Error(`Range#create called with invalid arguments[${c}, ${l}, ${u}, ${f}]`)}s(i,"create"),a.create=i;function o(c){let l=c;return _.objectLiteral(l)&&ie.is(l.start)&&ie.is(l.end)}s(o,"is"),a.is=o})(ee||(ee={})),(function(a){function i(c,l){return{uri:c,range:l}}s(i,"create"),a.create=i;function o(c){let l=c;return _.objectLiteral(l)&&ee.is(l.range)&&(_.string(l.uri)||_.undefined(l.uri))}s(o,"is"),a.is=o})(Cl||(Cl={})),(function(a){function i(c,l,u,f){return{targetUri:c,targetRange:l,targetSelectionRange:u,originSelectionRange:f}}s(i,"create"),a.create=i;function o(c){let l=c;return _.objectLiteral(l)&&ee.is(l.targetRange)&&_.string(l.targetUri)&&ee.is(l.targetSelectionRange)&&(ee.is(l.originSelectionRange)||_.undefined(l.originSelectionRange))}s(o,"is"),a.is=o})(Wd||(Wd={})),(function(a){function i(c,l,u,f){return{red:c,green:l,blue:u,alpha:f}}s(i,"create"),a.create=i;function o(c){const l=c;return _.objectLiteral(l)&&_.numberRange(l.red,0,1)&&_.numberRange(l.green,0,1)&&_.numberRange(l.blue,0,1)&&_.numberRange(l.alpha,0,1)}s(o,"is"),a.is=o})(ru||(ru={})),(function(a){function i(c,l){return{range:c,color:l}}s(i,"create"),a.create=i;function o(c){const l=c;return _.objectLiteral(l)&&ee.is(l.range)&&ru.is(l.color)}s(o,"is"),a.is=o})(Vd||(Vd={})),(function(a){function i(c,l,u){return{label:c,textEdit:l,additionalTextEdits:u}}s(i,"create"),a.create=i;function o(c){const l=c;return _.objectLiteral(l)&&_.string(l.label)&&(_.undefined(l.textEdit)||rr.is(l))&&(_.undefined(l.additionalTextEdits)||_.typedArray(l.additionalTextEdits,rr.is))}s(o,"is"),a.is=o})(Hd||(Hd={})),(function(a){a.Comment="comment",a.Imports="imports",a.Region="region"})(Yd||(Yd={})),(function(a){function i(c,l,u,f,d,p){const m={startLine:c,endLine:l};return _.defined(u)&&(m.startCharacter=u),_.defined(f)&&(m.endCharacter=f),_.defined(d)&&(m.kind=d),_.defined(p)&&(m.collapsedText=p),m}s(i,"create"),a.create=i;function o(c){const l=c;return _.objectLiteral(l)&&_.uinteger(l.startLine)&&_.uinteger(l.startLine)&&(_.undefined(l.startCharacter)||_.uinteger(l.startCharacter))&&(_.undefined(l.endCharacter)||_.uinteger(l.endCharacter))&&(_.undefined(l.kind)||_.string(l.kind))}s(o,"is"),a.is=o})(Xd||(Xd={})),(function(a){function i(c,l){return{location:c,message:l}}s(i,"create"),a.create=i;function o(c){let l=c;return _.defined(l)&&Cl.is(l.location)&&_.string(l.message)}s(o,"is"),a.is=o})(nu||(nu={})),(function(a){a.Error=1,a.Warning=2,a.Information=3,a.Hint=4})(Jd||(Jd={})),(function(a){a.Unnecessary=1,a.Deprecated=2})(Zd||(Zd={})),(function(a){function i(o){const c=o;return _.objectLiteral(c)&&_.string(c.href)}s(i,"is"),a.is=i})(Qd||(Qd={})),(function(a){function i(c,l,u,f,d,p){let m={range:c,message:l};return _.defined(u)&&(m.severity=u),_.defined(f)&&(m.code=f),_.defined(d)&&(m.source=d),_.defined(p)&&(m.relatedInformation=p),m}s(i,"create"),a.create=i;function o(c){var l;let u=c;return _.defined(u)&&ee.is(u.range)&&_.string(u.message)&&(_.number(u.severity)||_.undefined(u.severity))&&(_.integer(u.code)||_.string(u.code)||_.undefined(u.code))&&(_.undefined(u.codeDescription)||_.string((l=u.codeDescription)===null||l===void 0?void 0:l.href))&&(_.string(u.source)||_.undefined(u.source))&&(_.undefined(u.relatedInformation)||_.typedArray(u.relatedInformation,nu.is))}s(o,"is"),a.is=o})(Sl||(Sl={})),(function(a){function i(c,l,...u){let f={title:c,command:l};return _.defined(u)&&u.length>0&&(f.arguments=u),f}s(i,"create"),a.create=i;function o(c){let l=c;return _.defined(l)&&_.string(l.title)&&_.string(l.command)}s(o,"is"),a.is=o})(un||(un={})),(function(a){function i(u,f){return{range:u,newText:f}}s(i,"replace"),a.replace=i;function o(u,f){return{range:{start:u,end:u},newText:f}}s(o,"insert"),a.insert=o;function c(u){return{range:u,newText:""}}s(c,"del"),a.del=c;function l(u){const f=u;return _.objectLiteral(f)&&_.string(f.newText)&&ee.is(f.range)}s(l,"is"),a.is=l})(rr||(rr={})),(function(a){function i(c,l,u){const f={label:c};return l!==void 0&&(f.needsConfirmation=l),u!==void 0&&(f.description=u),f}s(i,"create"),a.create=i;function o(c){const l=c;return _.objectLiteral(l)&&_.string(l.label)&&(_.boolean(l.needsConfirmation)||l.needsConfirmation===void 0)&&(_.string(l.description)||l.description===void 0)}s(o,"is"),a.is=o})(fn||(fn={})),(function(a){function i(o){const c=o;return _.string(c)}s(i,"is"),a.is=i})(Xe||(Xe={})),(function(a){function i(u,f,d){return{range:u,newText:f,annotationId:d}}s(i,"replace"),a.replace=i;function o(u,f,d){return{range:{start:u,end:u},newText:f,annotationId:d}}s(o,"insert"),a.insert=o;function c(u,f){return{range:u,newText:"",annotationId:f}}s(c,"del"),a.del=c;function l(u){const f=u;return rr.is(f)&&(fn.is(f.annotationId)||Xe.is(f.annotationId))}s(l,"is"),a.is=l})(Tr||(Tr={})),(function(a){function i(c,l){return{textDocument:c,edits:l}}s(i,"create"),a.create=i;function o(c){let l=c;return _.defined(l)&&wl.is(l.textDocument)&&Array.isArray(l.edits)}s(o,"is"),a.is=o})(bl||(bl={})),(function(a){function i(c,l,u){let f={kind:"create",uri:c};return l!==void 0&&(l.overwrite!==void 0||l.ignoreIfExists!==void 0)&&(f.options=l),u!==void 0&&(f.annotationId=u),f}s(i,"create"),a.create=i;function o(c){let l=c;return l&&l.kind==="create"&&_.string(l.uri)&&(l.options===void 0||(l.options.overwrite===void 0||_.boolean(l.options.overwrite))&&(l.options.ignoreIfExists===void 0||_.boolean(l.options.ignoreIfExists)))&&(l.annotationId===void 0||Xe.is(l.annotationId))}s(o,"is"),a.is=o})(Ra||(Ra={})),(function(a){function i(c,l,u,f){let d={kind:"rename",oldUri:c,newUri:l};return u!==void 0&&(u.overwrite!==void 0||u.ignoreIfExists!==void 0)&&(d.options=u),f!==void 0&&(d.annotationId=f),d}s(i,"create"),a.create=i;function o(c){let l=c;return l&&l.kind==="rename"&&_.string(l.oldUri)&&_.string(l.newUri)&&(l.options===void 0||(l.options.overwrite===void 0||_.boolean(l.options.overwrite))&&(l.options.ignoreIfExists===void 0||_.boolean(l.options.ignoreIfExists)))&&(l.annotationId===void 0||Xe.is(l.annotationId))}s(o,"is"),a.is=o})($a||($a={})),(function(a){function i(c,l,u){let f={kind:"delete",uri:c};return l!==void 0&&(l.recursive!==void 0||l.ignoreIfNotExists!==void 0)&&(f.options=l),u!==void 0&&(f.annotationId=u),f}s(i,"create"),a.create=i;function o(c){let l=c;return l&&l.kind==="delete"&&_.string(l.uri)&&(l.options===void 0||(l.options.recursive===void 0||_.boolean(l.options.recursive))&&(l.options.ignoreIfNotExists===void 0||_.boolean(l.options.ignoreIfNotExists)))&&(l.annotationId===void 0||Xe.is(l.annotationId))}s(o,"is"),a.is=o})(Aa||(Aa={})),(function(a){function i(o){let c=o;return c&&(c.changes!==void 0||c.documentChanges!==void 0)&&(c.documentChanges===void 0||c.documentChanges.every(l=>_.string(l.kind)?Ra.is(l)||$a.is(l)||Aa.is(l):bl.is(l)))}s(i,"is"),a.is=i})(au||(au={})),hl=(t=class{constructor(i,o){this.edits=i,this.changeAnnotations=o}insert(i,o,c){let l,u;if(c===void 0?l=rr.insert(i,o):Xe.is(c)?(u=c,l=Tr.insert(i,o,c)):(this.assertChangeAnnotations(this.changeAnnotations),u=this.changeAnnotations.manage(c),l=Tr.insert(i,o,u)),this.edits.push(l),u!==void 0)return u}replace(i,o,c){let l,u;if(c===void 0?l=rr.replace(i,o):Xe.is(c)?(u=c,l=Tr.replace(i,o,c)):(this.assertChangeAnnotations(this.changeAnnotations),u=this.changeAnnotations.manage(c),l=Tr.replace(i,o,u)),this.edits.push(l),u!==void 0)return u}delete(i,o){let c,l;if(o===void 0?c=rr.del(i):Xe.is(o)?(l=o,c=Tr.del(i,o)):(this.assertChangeAnnotations(this.changeAnnotations),l=this.changeAnnotations.manage(o),c=Tr.del(i,l)),this.edits.push(c),l!==void 0)return l}add(i){this.edits.push(i)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(i){if(i===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}},s(t,"TextEditChangeImpl"),t),$d=(e=class{constructor(i){this._annotations=i===void 0?Object.create(null):i,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(i,o){let c;if(Xe.is(i)?c=i:(c=this.nextId(),o=i),this._annotations[c]!==void 0)throw new Error(`Id ${c} is already in use.`);if(o===void 0)throw new Error(`No annotation provided for id ${c}`);return this._annotations[c]=o,this._size++,c}nextId(){return this._counter++,this._counter.toString()}},s(e,"ChangeAnnotations"),e),hT=(r=class{constructor(i){this._textEditChanges=Object.create(null),i!==void 0?(this._workspaceEdit=i,i.documentChanges?(this._changeAnnotations=new $d(i.changeAnnotations),i.changeAnnotations=this._changeAnnotations.all(),i.documentChanges.forEach(o=>{if(bl.is(o)){const c=new hl(o.edits,this._changeAnnotations);this._textEditChanges[o.textDocument.uri]=c}})):i.changes&&Object.keys(i.changes).forEach(o=>{const c=new hl(i.changes[o]);this._textEditChanges[o]=c})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(i){if(wl.is(i)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");const o={uri:i.uri,version:i.version};let c=this._textEditChanges[o.uri];if(!c){const l=[],u={textDocument:o,edits:l};this._workspaceEdit.documentChanges.push(u),c=new hl(l,this._changeAnnotations),this._textEditChanges[o.uri]=c}return c}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let o=this._textEditChanges[i];if(!o){let c=[];this._workspaceEdit.changes[i]=c,o=new hl(c),this._textEditChanges[i]=o}return o}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new $d,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(i,o,c){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let l;fn.is(o)||Xe.is(o)?l=o:c=o;let u,f;if(l===void 0?u=Ra.create(i,c):(f=Xe.is(l)?l:this._changeAnnotations.manage(l),u=Ra.create(i,c,f)),this._workspaceEdit.documentChanges.push(u),f!==void 0)return f}renameFile(i,o,c,l){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let u;fn.is(c)||Xe.is(c)?u=c:l=c;let f,d;if(u===void 0?f=$a.create(i,o,l):(d=Xe.is(u)?u:this._changeAnnotations.manage(u),f=$a.create(i,o,l,d)),this._workspaceEdit.documentChanges.push(f),d!==void 0)return d}deleteFile(i,o,c){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let l;fn.is(o)||Xe.is(o)?l=o:c=o;let u,f;if(l===void 0?u=Aa.create(i,c):(f=Xe.is(l)?l:this._changeAnnotations.manage(l),u=Aa.create(i,c,f)),this._workspaceEdit.documentChanges.push(u),f!==void 0)return f}},s(r,"WorkspaceChange"),r),(function(a){function i(c){return{uri:c}}s(i,"create"),a.create=i;function o(c){let l=c;return _.defined(l)&&_.string(l.uri)}s(o,"is"),a.is=o})(ep||(ep={})),(function(a){function i(c,l){return{uri:c,version:l}}s(i,"create"),a.create=i;function o(c){let l=c;return _.defined(l)&&_.string(l.uri)&&_.integer(l.version)}s(o,"is"),a.is=o})(tp||(tp={})),(function(a){function i(c,l){return{uri:c,version:l}}s(i,"create"),a.create=i;function o(c){let l=c;return _.defined(l)&&_.string(l.uri)&&(l.version===null||_.integer(l.version))}s(o,"is"),a.is=o})(wl||(wl={})),(function(a){function i(c,l,u,f){return{uri:c,languageId:l,version:u,text:f}}s(i,"create"),a.create=i;function o(c){let l=c;return _.defined(l)&&_.string(l.uri)&&_.string(l.languageId)&&_.integer(l.version)&&_.string(l.text)}s(o,"is"),a.is=o})(rp||(rp={})),(function(a){a.PlainText="plaintext",a.Markdown="markdown";function i(o){const c=o;return c===a.PlainText||c===a.Markdown}s(i,"is"),a.is=i})(iu||(iu={})),(function(a){function i(o){const c=o;return _.objectLiteral(o)&&iu.is(c.kind)&&_.string(c.value)}s(i,"is"),a.is=i})(Ea||(Ea={})),(function(a){a.Text=1,a.Method=2,a.Function=3,a.Constructor=4,a.Field=5,a.Variable=6,a.Class=7,a.Interface=8,a.Module=9,a.Property=10,a.Unit=11,a.Value=12,a.Enum=13,a.Keyword=14,a.Snippet=15,a.Color=16,a.File=17,a.Reference=18,a.Folder=19,a.EnumMember=20,a.Constant=21,a.Struct=22,a.Event=23,a.Operator=24,a.TypeParameter=25})(np||(np={})),(function(a){a.PlainText=1,a.Snippet=2})(ap||(ap={})),(function(a){a.Deprecated=1})(ip||(ip={})),(function(a){function i(c,l,u){return{newText:c,insert:l,replace:u}}s(i,"create"),a.create=i;function o(c){const l=c;return l&&_.string(l.newText)&&ee.is(l.insert)&&ee.is(l.replace)}s(o,"is"),a.is=o})(sp||(sp={})),(function(a){a.asIs=1,a.adjustIndentation=2})(op||(op={})),(function(a){function i(o){const c=o;return c&&(_.string(c.detail)||c.detail===void 0)&&(_.string(c.description)||c.description===void 0)}s(i,"is"),a.is=i})(lp||(lp={})),(function(a){function i(o){return{label:o}}s(i,"create"),a.create=i})(cp||(cp={})),(function(a){function i(o,c){return{items:o||[],isIncomplete:!!c}}s(i,"create"),a.create=i})(up||(up={})),(function(a){function i(c){return c.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}s(i,"fromPlainText"),a.fromPlainText=i;function o(c){const l=c;return _.string(l)||_.objectLiteral(l)&&_.string(l.language)&&_.string(l.value)}s(o,"is"),a.is=o})(Il||(Il={})),(function(a){function i(o){let c=o;return!!c&&_.objectLiteral(c)&&(Ea.is(c.contents)||Il.is(c.contents)||_.typedArray(c.contents,Il.is))&&(o.range===void 0||ee.is(o.range))}s(i,"is"),a.is=i})(fp||(fp={})),(function(a){function i(o,c){return c?{label:o,documentation:c}:{label:o}}s(i,"create"),a.create=i})(dp||(dp={})),(function(a){function i(o,c,...l){let u={label:o};return _.defined(c)&&(u.documentation=c),_.defined(l)?u.parameters=l:u.parameters=[],u}s(i,"create"),a.create=i})(pp||(pp={})),(function(a){a.Text=1,a.Read=2,a.Write=3})(hp||(hp={})),(function(a){function i(o,c){let l={range:o};return _.number(c)&&(l.kind=c),l}s(i,"create"),a.create=i})(mp||(mp={})),(function(a){a.File=1,a.Module=2,a.Namespace=3,a.Package=4,a.Class=5,a.Method=6,a.Property=7,a.Field=8,a.Constructor=9,a.Enum=10,a.Interface=11,a.Function=12,a.Variable=13,a.Constant=14,a.String=15,a.Number=16,a.Boolean=17,a.Array=18,a.Object=19,a.Key=20,a.Null=21,a.EnumMember=22,a.Struct=23,a.Event=24,a.Operator=25,a.TypeParameter=26})(gp||(gp={})),(function(a){a.Deprecated=1})(yp||(yp={})),(function(a){function i(o,c,l,u,f){let d={name:o,kind:c,location:{uri:u,range:l}};return f&&(d.containerName=f),d}s(i,"create"),a.create=i})(vp||(vp={})),(function(a){function i(o,c,l,u){return u!==void 0?{name:o,kind:c,location:{uri:l,range:u}}:{name:o,kind:c,location:{uri:l}}}s(i,"create"),a.create=i})(Tp||(Tp={})),(function(a){function i(c,l,u,f,d,p){let m={name:c,detail:l,kind:u,range:f,selectionRange:d};return p!==void 0&&(m.children=p),m}s(i,"create"),a.create=i;function o(c){let l=c;return l&&_.string(l.name)&&_.number(l.kind)&&ee.is(l.range)&&ee.is(l.selectionRange)&&(l.detail===void 0||_.string(l.detail))&&(l.deprecated===void 0||_.boolean(l.deprecated))&&(l.children===void 0||Array.isArray(l.children))&&(l.tags===void 0||Array.isArray(l.tags))}s(o,"is"),a.is=o})(Rp||(Rp={})),(function(a){a.Empty="",a.QuickFix="quickfix",a.Refactor="refactor",a.RefactorExtract="refactor.extract",a.RefactorInline="refactor.inline",a.RefactorRewrite="refactor.rewrite",a.Source="source",a.SourceOrganizeImports="source.organizeImports",a.SourceFixAll="source.fixAll"})($p||($p={})),(function(a){a.Invoked=1,a.Automatic=2})(Nl||(Nl={})),(function(a){function i(c,l,u){let f={diagnostics:c};return l!=null&&(f.only=l),u!=null&&(f.triggerKind=u),f}s(i,"create"),a.create=i;function o(c){let l=c;return _.defined(l)&&_.typedArray(l.diagnostics,Sl.is)&&(l.only===void 0||_.typedArray(l.only,_.string))&&(l.triggerKind===void 0||l.triggerKind===Nl.Invoked||l.triggerKind===Nl.Automatic)}s(o,"is"),a.is=o})(Ap||(Ap={})),(function(a){function i(c,l,u){let f={title:c},d=!0;return typeof l=="string"?(d=!1,f.kind=l):un.is(l)?f.command=l:f.edit=l,d&&u!==void 0&&(f.kind=u),f}s(i,"create"),a.create=i;function o(c){let l=c;return l&&_.string(l.title)&&(l.diagnostics===void 0||_.typedArray(l.diagnostics,Sl.is))&&(l.kind===void 0||_.string(l.kind))&&(l.edit!==void 0||l.command!==void 0)&&(l.command===void 0||un.is(l.command))&&(l.isPreferred===void 0||_.boolean(l.isPreferred))&&(l.edit===void 0||au.is(l.edit))}s(o,"is"),a.is=o})(Ep||(Ep={})),(function(a){function i(c,l){let u={range:c};return _.defined(l)&&(u.data=l),u}s(i,"create"),a.create=i;function o(c){let l=c;return _.defined(l)&&ee.is(l.range)&&(_.undefined(l.command)||un.is(l.command))}s(o,"is"),a.is=o})(_p||(_p={})),(function(a){function i(c,l){return{tabSize:c,insertSpaces:l}}s(i,"create"),a.create=i;function o(c){let l=c;return _.defined(l)&&_.uinteger(l.tabSize)&&_.boolean(l.insertSpaces)}s(o,"is"),a.is=o})(Cp||(Cp={})),(function(a){function i(c,l,u){return{range:c,target:l,data:u}}s(i,"create"),a.create=i;function o(c){let l=c;return _.defined(l)&&ee.is(l.range)&&(_.undefined(l.target)||_.string(l.target))}s(o,"is"),a.is=o})(Sp||(Sp={})),(function(a){function i(c,l){return{range:c,parent:l}}s(i,"create"),a.create=i;function o(c){let l=c;return _.objectLiteral(l)&&ee.is(l.range)&&(l.parent===void 0||a.is(l.parent))}s(o,"is"),a.is=o})(bp||(bp={})),(function(a){a.namespace="namespace",a.type="type",a.class="class",a.enum="enum",a.interface="interface",a.struct="struct",a.typeParameter="typeParameter",a.parameter="parameter",a.variable="variable",a.property="property",a.enumMember="enumMember",a.event="event",a.function="function",a.method="method",a.macro="macro",a.keyword="keyword",a.modifier="modifier",a.comment="comment",a.string="string",a.number="number",a.regexp="regexp",a.operator="operator",a.decorator="decorator"})(wp||(wp={})),(function(a){a.declaration="declaration",a.definition="definition",a.readonly="readonly",a.static="static",a.deprecated="deprecated",a.abstract="abstract",a.async="async",a.modification="modification",a.documentation="documentation",a.defaultLibrary="defaultLibrary"})(Ip||(Ip={})),(function(a){function i(o){const c=o;return _.objectLiteral(c)&&(c.resultId===void 0||typeof c.resultId=="string")&&Array.isArray(c.data)&&(c.data.length===0||typeof c.data[0]=="number")}s(i,"is"),a.is=i})(Np||(Np={})),(function(a){function i(c,l){return{range:c,text:l}}s(i,"create"),a.create=i;function o(c){const l=c;return l!=null&&ee.is(l.range)&&_.string(l.text)}s(o,"is"),a.is=o})(kp||(kp={})),(function(a){function i(c,l,u){return{range:c,variableName:l,caseSensitiveLookup:u}}s(i,"create"),a.create=i;function o(c){const l=c;return l!=null&&ee.is(l.range)&&_.boolean(l.caseSensitiveLookup)&&(_.string(l.variableName)||l.variableName===void 0)}s(o,"is"),a.is=o})(Pp||(Pp={})),(function(a){function i(c,l){return{range:c,expression:l}}s(i,"create"),a.create=i;function o(c){const l=c;return l!=null&&ee.is(l.range)&&(_.string(l.expression)||l.expression===void 0)}s(o,"is"),a.is=o})(Op||(Op={})),(function(a){function i(c,l){return{frameId:c,stoppedLocation:l}}s(i,"create"),a.create=i;function o(c){const l=c;return _.defined(l)&&ee.is(c.stoppedLocation)}s(o,"is"),a.is=o})(Lp||(Lp={})),(function(a){a.Type=1,a.Parameter=2;function i(o){return o===1||o===2}s(i,"is"),a.is=i})(su||(su={})),(function(a){function i(c){return{value:c}}s(i,"create"),a.create=i;function o(c){const l=c;return _.objectLiteral(l)&&(l.tooltip===void 0||_.string(l.tooltip)||Ea.is(l.tooltip))&&(l.location===void 0||Cl.is(l.location))&&(l.command===void 0||un.is(l.command))}s(o,"is"),a.is=o})(ou||(ou={})),(function(a){function i(c,l,u){const f={position:c,label:l};return u!==void 0&&(f.kind=u),f}s(i,"create"),a.create=i;function o(c){const l=c;return _.objectLiteral(l)&&ie.is(l.position)&&(_.string(l.label)||_.typedArray(l.label,ou.is))&&(l.kind===void 0||su.is(l.kind))&&l.textEdits===void 0||_.typedArray(l.textEdits,rr.is)&&(l.tooltip===void 0||_.string(l.tooltip)||Ea.is(l.tooltip))&&(l.paddingLeft===void 0||_.boolean(l.paddingLeft))&&(l.paddingRight===void 0||_.boolean(l.paddingRight))}s(o,"is"),a.is=o})(Dp||(Dp={})),(function(a){function i(o){return{kind:"snippet",value:o}}s(i,"createSnippet"),a.createSnippet=i})(Mp||(Mp={})),(function(a){function i(o,c,l,u){return{insertText:o,filterText:c,range:l,command:u}}s(i,"create"),a.create=i})(xp||(xp={})),(function(a){function i(o){return{items:o}}s(i,"create"),a.create=i})(Fp||(Fp={})),(function(a){a.Invoked=0,a.Automatic=1})(Gp||(Gp={})),(function(a){function i(o,c){return{range:o,text:c}}s(i,"create"),a.create=i})(jp||(jp={})),(function(a){function i(o,c){return{triggerKind:o,selectedCompletionInfo:c}}s(i,"create"),a.create=i})(Up||(Up={})),(function(a){function i(o){const c=o;return _.objectLiteral(c)&&tu.is(c.uri)&&_.string(c.name)}s(i,"is"),a.is=i})(zp||(zp={})),mT=[`
|
|
1
|
+
var DN=Object.defineProperty;var MN=(t,e,r)=>e in t?DN(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var jr=(t,e,r)=>MN(t,typeof e!="symbol"?e+"":e,r);import{bB as er}from"./index-Dc3Fwpho.js";var xN=Object.create,hc=Object.defineProperty,FN=Object.getOwnPropertyDescriptor,Fh=Object.getOwnPropertyNames,GN=Object.getPrototypeOf,jN=Object.prototype.hasOwnProperty,s=(t,e)=>hc(t,"name",{value:e,configurable:!0}),UN=(t,e)=>function(){return t&&(e=(0,t[Fh(t)[0]])(t=0)),e},Y=(t,e)=>function(){return e||(0,t[Fh(t)[0]])((e={exports:{}}).exports,e),e.exports},Qr=(t,e)=>{for(var r in e)hc(t,r,{get:e[r],enumerable:!0})},Gh=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Fh(e))!jN.call(t,a)&&a!==r&&hc(t,a,{get:()=>e[a],enumerable:!(n=FN(e,a))||n.enumerable});return t},ff=(t,e,r)=>(Gh(t,e,"default"),r),jh=(t,e,r)=>(r=t!=null?xN(GN(t)):{},Gh(hc(r,"default",{value:t,enumerable:!0}),t)),Uh=t=>Gh(hc({},"__esModule",{value:!0}),t),df={};Qr(df,{AnnotatedTextEdit:()=>Tr,ChangeAnnotation:()=>fn,ChangeAnnotationIdentifier:()=>Xe,CodeAction:()=>Ep,CodeActionContext:()=>Ap,CodeActionKind:()=>$p,CodeActionTriggerKind:()=>Nl,CodeDescription:()=>Qd,CodeLens:()=>_p,Color:()=>ru,ColorInformation:()=>Vd,ColorPresentation:()=>Hd,Command:()=>un,CompletionItem:()=>cp,CompletionItemKind:()=>np,CompletionItemLabelDetails:()=>lp,CompletionItemTag:()=>ip,CompletionList:()=>up,CreateFile:()=>Ra,DeleteFile:()=>Aa,Diagnostic:()=>Sl,DiagnosticRelatedInformation:()=>nu,DiagnosticSeverity:()=>Jd,DiagnosticTag:()=>Zd,DocumentHighlight:()=>mp,DocumentHighlightKind:()=>hp,DocumentLink:()=>Sp,DocumentSymbol:()=>Rp,DocumentUri:()=>Kd,EOL:()=>mT,FoldingRange:()=>Xd,FoldingRangeKind:()=>Yd,FormattingOptions:()=>Cp,Hover:()=>fp,InlayHint:()=>Dp,InlayHintKind:()=>su,InlayHintLabelPart:()=>ou,InlineCompletionContext:()=>Up,InlineCompletionItem:()=>xp,InlineCompletionList:()=>Fp,InlineCompletionTriggerKind:()=>Gp,InlineValueContext:()=>Lp,InlineValueEvaluatableExpression:()=>Op,InlineValueText:()=>kp,InlineValueVariableLookup:()=>Pp,InsertReplaceEdit:()=>sp,InsertTextFormat:()=>ap,InsertTextMode:()=>op,Location:()=>Cl,LocationLink:()=>Wd,MarkedString:()=>Il,MarkupContent:()=>Ea,MarkupKind:()=>iu,OptionalVersionedTextDocumentIdentifier:()=>wl,ParameterInformation:()=>dp,Position:()=>ie,Range:()=>ee,RenameFile:()=>$a,SelectedCompletionInfo:()=>jp,SelectionRange:()=>bp,SemanticTokenModifiers:()=>Ip,SemanticTokenTypes:()=>wp,SemanticTokens:()=>Np,SignatureInformation:()=>pp,StringValue:()=>Mp,SymbolInformation:()=>vp,SymbolKind:()=>gp,SymbolTag:()=>yp,TextDocument:()=>Bp,TextDocumentEdit:()=>bl,TextDocumentIdentifier:()=>ep,TextDocumentItem:()=>rp,TextEdit:()=>rr,URI:()=>tu,VersionedTextDocumentIdentifier:()=>tp,WorkspaceChange:()=>hT,WorkspaceEdit:()=>au,WorkspaceFolder:()=>zp,WorkspaceSymbol:()=>Tp,integer:()=>qd,uinteger:()=>_l});var Kd,tu,qd,_l,ie,ee,Cl,Wd,ru,Vd,Hd,Yd,Xd,nu,Jd,Zd,Qd,Sl,un,rr,fn,Xe,Tr,bl,Ra,$a,Aa,au,hl,$d,hT,ep,tp,wl,rp,iu,Ea,np,ap,ip,sp,op,lp,cp,up,Il,fp,dp,pp,hp,mp,gp,yp,vp,Tp,Rp,$p,Nl,Ap,Ep,_p,Cp,Sp,bp,wp,Ip,Np,kp,Pp,Op,Lp,su,ou,Dp,Mp,xp,Fp,Gp,jp,Up,zp,mT,Bp,_y,_,mc=UN({"../../node_modules/.pnpm/vscode-languageserver-types@3.17.5/node_modules/vscode-languageserver-types/lib/esm/main.js"(){var t,e,r,n;(function(a){function i(o){return typeof o=="string"}s(i,"is"),a.is=i})(Kd||(Kd={})),(function(a){function i(o){return typeof o=="string"}s(i,"is"),a.is=i})(tu||(tu={})),(function(a){a.MIN_VALUE=-2147483648,a.MAX_VALUE=2147483647;function i(o){return typeof o=="number"&&a.MIN_VALUE<=o&&o<=a.MAX_VALUE}s(i,"is"),a.is=i})(qd||(qd={})),(function(a){a.MIN_VALUE=0,a.MAX_VALUE=2147483647;function i(o){return typeof o=="number"&&a.MIN_VALUE<=o&&o<=a.MAX_VALUE}s(i,"is"),a.is=i})(_l||(_l={})),(function(a){function i(c,l){return c===Number.MAX_VALUE&&(c=_l.MAX_VALUE),l===Number.MAX_VALUE&&(l=_l.MAX_VALUE),{line:c,character:l}}s(i,"create"),a.create=i;function o(c){let l=c;return _.objectLiteral(l)&&_.uinteger(l.line)&&_.uinteger(l.character)}s(o,"is"),a.is=o})(ie||(ie={})),(function(a){function i(c,l,u,f){if(_.uinteger(c)&&_.uinteger(l)&&_.uinteger(u)&&_.uinteger(f))return{start:ie.create(c,l),end:ie.create(u,f)};if(ie.is(c)&&ie.is(l))return{start:c,end:l};throw new Error(`Range#create called with invalid arguments[${c}, ${l}, ${u}, ${f}]`)}s(i,"create"),a.create=i;function o(c){let l=c;return _.objectLiteral(l)&&ie.is(l.start)&&ie.is(l.end)}s(o,"is"),a.is=o})(ee||(ee={})),(function(a){function i(c,l){return{uri:c,range:l}}s(i,"create"),a.create=i;function o(c){let l=c;return _.objectLiteral(l)&&ee.is(l.range)&&(_.string(l.uri)||_.undefined(l.uri))}s(o,"is"),a.is=o})(Cl||(Cl={})),(function(a){function i(c,l,u,f){return{targetUri:c,targetRange:l,targetSelectionRange:u,originSelectionRange:f}}s(i,"create"),a.create=i;function o(c){let l=c;return _.objectLiteral(l)&&ee.is(l.targetRange)&&_.string(l.targetUri)&&ee.is(l.targetSelectionRange)&&(ee.is(l.originSelectionRange)||_.undefined(l.originSelectionRange))}s(o,"is"),a.is=o})(Wd||(Wd={})),(function(a){function i(c,l,u,f){return{red:c,green:l,blue:u,alpha:f}}s(i,"create"),a.create=i;function o(c){const l=c;return _.objectLiteral(l)&&_.numberRange(l.red,0,1)&&_.numberRange(l.green,0,1)&&_.numberRange(l.blue,0,1)&&_.numberRange(l.alpha,0,1)}s(o,"is"),a.is=o})(ru||(ru={})),(function(a){function i(c,l){return{range:c,color:l}}s(i,"create"),a.create=i;function o(c){const l=c;return _.objectLiteral(l)&&ee.is(l.range)&&ru.is(l.color)}s(o,"is"),a.is=o})(Vd||(Vd={})),(function(a){function i(c,l,u){return{label:c,textEdit:l,additionalTextEdits:u}}s(i,"create"),a.create=i;function o(c){const l=c;return _.objectLiteral(l)&&_.string(l.label)&&(_.undefined(l.textEdit)||rr.is(l))&&(_.undefined(l.additionalTextEdits)||_.typedArray(l.additionalTextEdits,rr.is))}s(o,"is"),a.is=o})(Hd||(Hd={})),(function(a){a.Comment="comment",a.Imports="imports",a.Region="region"})(Yd||(Yd={})),(function(a){function i(c,l,u,f,d,p){const m={startLine:c,endLine:l};return _.defined(u)&&(m.startCharacter=u),_.defined(f)&&(m.endCharacter=f),_.defined(d)&&(m.kind=d),_.defined(p)&&(m.collapsedText=p),m}s(i,"create"),a.create=i;function o(c){const l=c;return _.objectLiteral(l)&&_.uinteger(l.startLine)&&_.uinteger(l.startLine)&&(_.undefined(l.startCharacter)||_.uinteger(l.startCharacter))&&(_.undefined(l.endCharacter)||_.uinteger(l.endCharacter))&&(_.undefined(l.kind)||_.string(l.kind))}s(o,"is"),a.is=o})(Xd||(Xd={})),(function(a){function i(c,l){return{location:c,message:l}}s(i,"create"),a.create=i;function o(c){let l=c;return _.defined(l)&&Cl.is(l.location)&&_.string(l.message)}s(o,"is"),a.is=o})(nu||(nu={})),(function(a){a.Error=1,a.Warning=2,a.Information=3,a.Hint=4})(Jd||(Jd={})),(function(a){a.Unnecessary=1,a.Deprecated=2})(Zd||(Zd={})),(function(a){function i(o){const c=o;return _.objectLiteral(c)&&_.string(c.href)}s(i,"is"),a.is=i})(Qd||(Qd={})),(function(a){function i(c,l,u,f,d,p){let m={range:c,message:l};return _.defined(u)&&(m.severity=u),_.defined(f)&&(m.code=f),_.defined(d)&&(m.source=d),_.defined(p)&&(m.relatedInformation=p),m}s(i,"create"),a.create=i;function o(c){var l;let u=c;return _.defined(u)&&ee.is(u.range)&&_.string(u.message)&&(_.number(u.severity)||_.undefined(u.severity))&&(_.integer(u.code)||_.string(u.code)||_.undefined(u.code))&&(_.undefined(u.codeDescription)||_.string((l=u.codeDescription)===null||l===void 0?void 0:l.href))&&(_.string(u.source)||_.undefined(u.source))&&(_.undefined(u.relatedInformation)||_.typedArray(u.relatedInformation,nu.is))}s(o,"is"),a.is=o})(Sl||(Sl={})),(function(a){function i(c,l,...u){let f={title:c,command:l};return _.defined(u)&&u.length>0&&(f.arguments=u),f}s(i,"create"),a.create=i;function o(c){let l=c;return _.defined(l)&&_.string(l.title)&&_.string(l.command)}s(o,"is"),a.is=o})(un||(un={})),(function(a){function i(u,f){return{range:u,newText:f}}s(i,"replace"),a.replace=i;function o(u,f){return{range:{start:u,end:u},newText:f}}s(o,"insert"),a.insert=o;function c(u){return{range:u,newText:""}}s(c,"del"),a.del=c;function l(u){const f=u;return _.objectLiteral(f)&&_.string(f.newText)&&ee.is(f.range)}s(l,"is"),a.is=l})(rr||(rr={})),(function(a){function i(c,l,u){const f={label:c};return l!==void 0&&(f.needsConfirmation=l),u!==void 0&&(f.description=u),f}s(i,"create"),a.create=i;function o(c){const l=c;return _.objectLiteral(l)&&_.string(l.label)&&(_.boolean(l.needsConfirmation)||l.needsConfirmation===void 0)&&(_.string(l.description)||l.description===void 0)}s(o,"is"),a.is=o})(fn||(fn={})),(function(a){function i(o){const c=o;return _.string(c)}s(i,"is"),a.is=i})(Xe||(Xe={})),(function(a){function i(u,f,d){return{range:u,newText:f,annotationId:d}}s(i,"replace"),a.replace=i;function o(u,f,d){return{range:{start:u,end:u},newText:f,annotationId:d}}s(o,"insert"),a.insert=o;function c(u,f){return{range:u,newText:"",annotationId:f}}s(c,"del"),a.del=c;function l(u){const f=u;return rr.is(f)&&(fn.is(f.annotationId)||Xe.is(f.annotationId))}s(l,"is"),a.is=l})(Tr||(Tr={})),(function(a){function i(c,l){return{textDocument:c,edits:l}}s(i,"create"),a.create=i;function o(c){let l=c;return _.defined(l)&&wl.is(l.textDocument)&&Array.isArray(l.edits)}s(o,"is"),a.is=o})(bl||(bl={})),(function(a){function i(c,l,u){let f={kind:"create",uri:c};return l!==void 0&&(l.overwrite!==void 0||l.ignoreIfExists!==void 0)&&(f.options=l),u!==void 0&&(f.annotationId=u),f}s(i,"create"),a.create=i;function o(c){let l=c;return l&&l.kind==="create"&&_.string(l.uri)&&(l.options===void 0||(l.options.overwrite===void 0||_.boolean(l.options.overwrite))&&(l.options.ignoreIfExists===void 0||_.boolean(l.options.ignoreIfExists)))&&(l.annotationId===void 0||Xe.is(l.annotationId))}s(o,"is"),a.is=o})(Ra||(Ra={})),(function(a){function i(c,l,u,f){let d={kind:"rename",oldUri:c,newUri:l};return u!==void 0&&(u.overwrite!==void 0||u.ignoreIfExists!==void 0)&&(d.options=u),f!==void 0&&(d.annotationId=f),d}s(i,"create"),a.create=i;function o(c){let l=c;return l&&l.kind==="rename"&&_.string(l.oldUri)&&_.string(l.newUri)&&(l.options===void 0||(l.options.overwrite===void 0||_.boolean(l.options.overwrite))&&(l.options.ignoreIfExists===void 0||_.boolean(l.options.ignoreIfExists)))&&(l.annotationId===void 0||Xe.is(l.annotationId))}s(o,"is"),a.is=o})($a||($a={})),(function(a){function i(c,l,u){let f={kind:"delete",uri:c};return l!==void 0&&(l.recursive!==void 0||l.ignoreIfNotExists!==void 0)&&(f.options=l),u!==void 0&&(f.annotationId=u),f}s(i,"create"),a.create=i;function o(c){let l=c;return l&&l.kind==="delete"&&_.string(l.uri)&&(l.options===void 0||(l.options.recursive===void 0||_.boolean(l.options.recursive))&&(l.options.ignoreIfNotExists===void 0||_.boolean(l.options.ignoreIfNotExists)))&&(l.annotationId===void 0||Xe.is(l.annotationId))}s(o,"is"),a.is=o})(Aa||(Aa={})),(function(a){function i(o){let c=o;return c&&(c.changes!==void 0||c.documentChanges!==void 0)&&(c.documentChanges===void 0||c.documentChanges.every(l=>_.string(l.kind)?Ra.is(l)||$a.is(l)||Aa.is(l):bl.is(l)))}s(i,"is"),a.is=i})(au||(au={})),hl=(t=class{constructor(i,o){this.edits=i,this.changeAnnotations=o}insert(i,o,c){let l,u;if(c===void 0?l=rr.insert(i,o):Xe.is(c)?(u=c,l=Tr.insert(i,o,c)):(this.assertChangeAnnotations(this.changeAnnotations),u=this.changeAnnotations.manage(c),l=Tr.insert(i,o,u)),this.edits.push(l),u!==void 0)return u}replace(i,o,c){let l,u;if(c===void 0?l=rr.replace(i,o):Xe.is(c)?(u=c,l=Tr.replace(i,o,c)):(this.assertChangeAnnotations(this.changeAnnotations),u=this.changeAnnotations.manage(c),l=Tr.replace(i,o,u)),this.edits.push(l),u!==void 0)return u}delete(i,o){let c,l;if(o===void 0?c=rr.del(i):Xe.is(o)?(l=o,c=Tr.del(i,o)):(this.assertChangeAnnotations(this.changeAnnotations),l=this.changeAnnotations.manage(o),c=Tr.del(i,l)),this.edits.push(c),l!==void 0)return l}add(i){this.edits.push(i)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(i){if(i===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}},s(t,"TextEditChangeImpl"),t),$d=(e=class{constructor(i){this._annotations=i===void 0?Object.create(null):i,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(i,o){let c;if(Xe.is(i)?c=i:(c=this.nextId(),o=i),this._annotations[c]!==void 0)throw new Error(`Id ${c} is already in use.`);if(o===void 0)throw new Error(`No annotation provided for id ${c}`);return this._annotations[c]=o,this._size++,c}nextId(){return this._counter++,this._counter.toString()}},s(e,"ChangeAnnotations"),e),hT=(r=class{constructor(i){this._textEditChanges=Object.create(null),i!==void 0?(this._workspaceEdit=i,i.documentChanges?(this._changeAnnotations=new $d(i.changeAnnotations),i.changeAnnotations=this._changeAnnotations.all(),i.documentChanges.forEach(o=>{if(bl.is(o)){const c=new hl(o.edits,this._changeAnnotations);this._textEditChanges[o.textDocument.uri]=c}})):i.changes&&Object.keys(i.changes).forEach(o=>{const c=new hl(i.changes[o]);this._textEditChanges[o]=c})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(i){if(wl.is(i)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");const o={uri:i.uri,version:i.version};let c=this._textEditChanges[o.uri];if(!c){const l=[],u={textDocument:o,edits:l};this._workspaceEdit.documentChanges.push(u),c=new hl(l,this._changeAnnotations),this._textEditChanges[o.uri]=c}return c}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let o=this._textEditChanges[i];if(!o){let c=[];this._workspaceEdit.changes[i]=c,o=new hl(c),this._textEditChanges[i]=o}return o}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new $d,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(i,o,c){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let l;fn.is(o)||Xe.is(o)?l=o:c=o;let u,f;if(l===void 0?u=Ra.create(i,c):(f=Xe.is(l)?l:this._changeAnnotations.manage(l),u=Ra.create(i,c,f)),this._workspaceEdit.documentChanges.push(u),f!==void 0)return f}renameFile(i,o,c,l){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let u;fn.is(c)||Xe.is(c)?u=c:l=c;let f,d;if(u===void 0?f=$a.create(i,o,l):(d=Xe.is(u)?u:this._changeAnnotations.manage(u),f=$a.create(i,o,l,d)),this._workspaceEdit.documentChanges.push(f),d!==void 0)return d}deleteFile(i,o,c){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let l;fn.is(o)||Xe.is(o)?l=o:c=o;let u,f;if(l===void 0?u=Aa.create(i,c):(f=Xe.is(l)?l:this._changeAnnotations.manage(l),u=Aa.create(i,c,f)),this._workspaceEdit.documentChanges.push(u),f!==void 0)return f}},s(r,"WorkspaceChange"),r),(function(a){function i(c){return{uri:c}}s(i,"create"),a.create=i;function o(c){let l=c;return _.defined(l)&&_.string(l.uri)}s(o,"is"),a.is=o})(ep||(ep={})),(function(a){function i(c,l){return{uri:c,version:l}}s(i,"create"),a.create=i;function o(c){let l=c;return _.defined(l)&&_.string(l.uri)&&_.integer(l.version)}s(o,"is"),a.is=o})(tp||(tp={})),(function(a){function i(c,l){return{uri:c,version:l}}s(i,"create"),a.create=i;function o(c){let l=c;return _.defined(l)&&_.string(l.uri)&&(l.version===null||_.integer(l.version))}s(o,"is"),a.is=o})(wl||(wl={})),(function(a){function i(c,l,u,f){return{uri:c,languageId:l,version:u,text:f}}s(i,"create"),a.create=i;function o(c){let l=c;return _.defined(l)&&_.string(l.uri)&&_.string(l.languageId)&&_.integer(l.version)&&_.string(l.text)}s(o,"is"),a.is=o})(rp||(rp={})),(function(a){a.PlainText="plaintext",a.Markdown="markdown";function i(o){const c=o;return c===a.PlainText||c===a.Markdown}s(i,"is"),a.is=i})(iu||(iu={})),(function(a){function i(o){const c=o;return _.objectLiteral(o)&&iu.is(c.kind)&&_.string(c.value)}s(i,"is"),a.is=i})(Ea||(Ea={})),(function(a){a.Text=1,a.Method=2,a.Function=3,a.Constructor=4,a.Field=5,a.Variable=6,a.Class=7,a.Interface=8,a.Module=9,a.Property=10,a.Unit=11,a.Value=12,a.Enum=13,a.Keyword=14,a.Snippet=15,a.Color=16,a.File=17,a.Reference=18,a.Folder=19,a.EnumMember=20,a.Constant=21,a.Struct=22,a.Event=23,a.Operator=24,a.TypeParameter=25})(np||(np={})),(function(a){a.PlainText=1,a.Snippet=2})(ap||(ap={})),(function(a){a.Deprecated=1})(ip||(ip={})),(function(a){function i(c,l,u){return{newText:c,insert:l,replace:u}}s(i,"create"),a.create=i;function o(c){const l=c;return l&&_.string(l.newText)&&ee.is(l.insert)&&ee.is(l.replace)}s(o,"is"),a.is=o})(sp||(sp={})),(function(a){a.asIs=1,a.adjustIndentation=2})(op||(op={})),(function(a){function i(o){const c=o;return c&&(_.string(c.detail)||c.detail===void 0)&&(_.string(c.description)||c.description===void 0)}s(i,"is"),a.is=i})(lp||(lp={})),(function(a){function i(o){return{label:o}}s(i,"create"),a.create=i})(cp||(cp={})),(function(a){function i(o,c){return{items:o||[],isIncomplete:!!c}}s(i,"create"),a.create=i})(up||(up={})),(function(a){function i(c){return c.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}s(i,"fromPlainText"),a.fromPlainText=i;function o(c){const l=c;return _.string(l)||_.objectLiteral(l)&&_.string(l.language)&&_.string(l.value)}s(o,"is"),a.is=o})(Il||(Il={})),(function(a){function i(o){let c=o;return!!c&&_.objectLiteral(c)&&(Ea.is(c.contents)||Il.is(c.contents)||_.typedArray(c.contents,Il.is))&&(o.range===void 0||ee.is(o.range))}s(i,"is"),a.is=i})(fp||(fp={})),(function(a){function i(o,c){return c?{label:o,documentation:c}:{label:o}}s(i,"create"),a.create=i})(dp||(dp={})),(function(a){function i(o,c,...l){let u={label:o};return _.defined(c)&&(u.documentation=c),_.defined(l)?u.parameters=l:u.parameters=[],u}s(i,"create"),a.create=i})(pp||(pp={})),(function(a){a.Text=1,a.Read=2,a.Write=3})(hp||(hp={})),(function(a){function i(o,c){let l={range:o};return _.number(c)&&(l.kind=c),l}s(i,"create"),a.create=i})(mp||(mp={})),(function(a){a.File=1,a.Module=2,a.Namespace=3,a.Package=4,a.Class=5,a.Method=6,a.Property=7,a.Field=8,a.Constructor=9,a.Enum=10,a.Interface=11,a.Function=12,a.Variable=13,a.Constant=14,a.String=15,a.Number=16,a.Boolean=17,a.Array=18,a.Object=19,a.Key=20,a.Null=21,a.EnumMember=22,a.Struct=23,a.Event=24,a.Operator=25,a.TypeParameter=26})(gp||(gp={})),(function(a){a.Deprecated=1})(yp||(yp={})),(function(a){function i(o,c,l,u,f){let d={name:o,kind:c,location:{uri:u,range:l}};return f&&(d.containerName=f),d}s(i,"create"),a.create=i})(vp||(vp={})),(function(a){function i(o,c,l,u){return u!==void 0?{name:o,kind:c,location:{uri:l,range:u}}:{name:o,kind:c,location:{uri:l}}}s(i,"create"),a.create=i})(Tp||(Tp={})),(function(a){function i(c,l,u,f,d,p){let m={name:c,detail:l,kind:u,range:f,selectionRange:d};return p!==void 0&&(m.children=p),m}s(i,"create"),a.create=i;function o(c){let l=c;return l&&_.string(l.name)&&_.number(l.kind)&&ee.is(l.range)&&ee.is(l.selectionRange)&&(l.detail===void 0||_.string(l.detail))&&(l.deprecated===void 0||_.boolean(l.deprecated))&&(l.children===void 0||Array.isArray(l.children))&&(l.tags===void 0||Array.isArray(l.tags))}s(o,"is"),a.is=o})(Rp||(Rp={})),(function(a){a.Empty="",a.QuickFix="quickfix",a.Refactor="refactor",a.RefactorExtract="refactor.extract",a.RefactorInline="refactor.inline",a.RefactorRewrite="refactor.rewrite",a.Source="source",a.SourceOrganizeImports="source.organizeImports",a.SourceFixAll="source.fixAll"})($p||($p={})),(function(a){a.Invoked=1,a.Automatic=2})(Nl||(Nl={})),(function(a){function i(c,l,u){let f={diagnostics:c};return l!=null&&(f.only=l),u!=null&&(f.triggerKind=u),f}s(i,"create"),a.create=i;function o(c){let l=c;return _.defined(l)&&_.typedArray(l.diagnostics,Sl.is)&&(l.only===void 0||_.typedArray(l.only,_.string))&&(l.triggerKind===void 0||l.triggerKind===Nl.Invoked||l.triggerKind===Nl.Automatic)}s(o,"is"),a.is=o})(Ap||(Ap={})),(function(a){function i(c,l,u){let f={title:c},d=!0;return typeof l=="string"?(d=!1,f.kind=l):un.is(l)?f.command=l:f.edit=l,d&&u!==void 0&&(f.kind=u),f}s(i,"create"),a.create=i;function o(c){let l=c;return l&&_.string(l.title)&&(l.diagnostics===void 0||_.typedArray(l.diagnostics,Sl.is))&&(l.kind===void 0||_.string(l.kind))&&(l.edit!==void 0||l.command!==void 0)&&(l.command===void 0||un.is(l.command))&&(l.isPreferred===void 0||_.boolean(l.isPreferred))&&(l.edit===void 0||au.is(l.edit))}s(o,"is"),a.is=o})(Ep||(Ep={})),(function(a){function i(c,l){let u={range:c};return _.defined(l)&&(u.data=l),u}s(i,"create"),a.create=i;function o(c){let l=c;return _.defined(l)&&ee.is(l.range)&&(_.undefined(l.command)||un.is(l.command))}s(o,"is"),a.is=o})(_p||(_p={})),(function(a){function i(c,l){return{tabSize:c,insertSpaces:l}}s(i,"create"),a.create=i;function o(c){let l=c;return _.defined(l)&&_.uinteger(l.tabSize)&&_.boolean(l.insertSpaces)}s(o,"is"),a.is=o})(Cp||(Cp={})),(function(a){function i(c,l,u){return{range:c,target:l,data:u}}s(i,"create"),a.create=i;function o(c){let l=c;return _.defined(l)&&ee.is(l.range)&&(_.undefined(l.target)||_.string(l.target))}s(o,"is"),a.is=o})(Sp||(Sp={})),(function(a){function i(c,l){return{range:c,parent:l}}s(i,"create"),a.create=i;function o(c){let l=c;return _.objectLiteral(l)&&ee.is(l.range)&&(l.parent===void 0||a.is(l.parent))}s(o,"is"),a.is=o})(bp||(bp={})),(function(a){a.namespace="namespace",a.type="type",a.class="class",a.enum="enum",a.interface="interface",a.struct="struct",a.typeParameter="typeParameter",a.parameter="parameter",a.variable="variable",a.property="property",a.enumMember="enumMember",a.event="event",a.function="function",a.method="method",a.macro="macro",a.keyword="keyword",a.modifier="modifier",a.comment="comment",a.string="string",a.number="number",a.regexp="regexp",a.operator="operator",a.decorator="decorator"})(wp||(wp={})),(function(a){a.declaration="declaration",a.definition="definition",a.readonly="readonly",a.static="static",a.deprecated="deprecated",a.abstract="abstract",a.async="async",a.modification="modification",a.documentation="documentation",a.defaultLibrary="defaultLibrary"})(Ip||(Ip={})),(function(a){function i(o){const c=o;return _.objectLiteral(c)&&(c.resultId===void 0||typeof c.resultId=="string")&&Array.isArray(c.data)&&(c.data.length===0||typeof c.data[0]=="number")}s(i,"is"),a.is=i})(Np||(Np={})),(function(a){function i(c,l){return{range:c,text:l}}s(i,"create"),a.create=i;function o(c){const l=c;return l!=null&&ee.is(l.range)&&_.string(l.text)}s(o,"is"),a.is=o})(kp||(kp={})),(function(a){function i(c,l,u){return{range:c,variableName:l,caseSensitiveLookup:u}}s(i,"create"),a.create=i;function o(c){const l=c;return l!=null&&ee.is(l.range)&&_.boolean(l.caseSensitiveLookup)&&(_.string(l.variableName)||l.variableName===void 0)}s(o,"is"),a.is=o})(Pp||(Pp={})),(function(a){function i(c,l){return{range:c,expression:l}}s(i,"create"),a.create=i;function o(c){const l=c;return l!=null&&ee.is(l.range)&&(_.string(l.expression)||l.expression===void 0)}s(o,"is"),a.is=o})(Op||(Op={})),(function(a){function i(c,l){return{frameId:c,stoppedLocation:l}}s(i,"create"),a.create=i;function o(c){const l=c;return _.defined(l)&&ee.is(c.stoppedLocation)}s(o,"is"),a.is=o})(Lp||(Lp={})),(function(a){a.Type=1,a.Parameter=2;function i(o){return o===1||o===2}s(i,"is"),a.is=i})(su||(su={})),(function(a){function i(c){return{value:c}}s(i,"create"),a.create=i;function o(c){const l=c;return _.objectLiteral(l)&&(l.tooltip===void 0||_.string(l.tooltip)||Ea.is(l.tooltip))&&(l.location===void 0||Cl.is(l.location))&&(l.command===void 0||un.is(l.command))}s(o,"is"),a.is=o})(ou||(ou={})),(function(a){function i(c,l,u){const f={position:c,label:l};return u!==void 0&&(f.kind=u),f}s(i,"create"),a.create=i;function o(c){const l=c;return _.objectLiteral(l)&&ie.is(l.position)&&(_.string(l.label)||_.typedArray(l.label,ou.is))&&(l.kind===void 0||su.is(l.kind))&&l.textEdits===void 0||_.typedArray(l.textEdits,rr.is)&&(l.tooltip===void 0||_.string(l.tooltip)||Ea.is(l.tooltip))&&(l.paddingLeft===void 0||_.boolean(l.paddingLeft))&&(l.paddingRight===void 0||_.boolean(l.paddingRight))}s(o,"is"),a.is=o})(Dp||(Dp={})),(function(a){function i(o){return{kind:"snippet",value:o}}s(i,"createSnippet"),a.createSnippet=i})(Mp||(Mp={})),(function(a){function i(o,c,l,u){return{insertText:o,filterText:c,range:l,command:u}}s(i,"create"),a.create=i})(xp||(xp={})),(function(a){function i(o){return{items:o}}s(i,"create"),a.create=i})(Fp||(Fp={})),(function(a){a.Invoked=0,a.Automatic=1})(Gp||(Gp={})),(function(a){function i(o,c){return{range:o,text:c}}s(i,"create"),a.create=i})(jp||(jp={})),(function(a){function i(o,c){return{triggerKind:o,selectedCompletionInfo:c}}s(i,"create"),a.create=i})(Up||(Up={})),(function(a){function i(o){const c=o;return _.objectLiteral(c)&&tu.is(c.uri)&&_.string(c.name)}s(i,"is"),a.is=i})(zp||(zp={})),mT=[`
|
|
2
2
|
`,`\r
|
|
3
3
|
`,"\r"],(function(a){function i(u,f,d,p){return new _y(u,f,d,p)}s(i,"create"),a.create=i;function o(u){let f=u;return!!(_.defined(f)&&_.string(f.uri)&&(_.undefined(f.languageId)||_.string(f.languageId))&&_.uinteger(f.lineCount)&&_.func(f.getText)&&_.func(f.positionAt)&&_.func(f.offsetAt))}s(o,"is"),a.is=o;function c(u,f){let d=u.getText(),p=l(f,(g,v)=>{let E=g.range.start.line-v.range.start.line;return E===0?g.range.start.character-v.range.start.character:E}),m=d.length;for(let g=p.length-1;g>=0;g--){let v=p[g],E=u.offsetAt(v.range.start),T=u.offsetAt(v.range.end);if(T<=m)d=d.substring(0,E)+v.newText+d.substring(T,d.length);else throw new Error("Overlapping edit");m=E}return d}s(c,"applyEdits"),a.applyEdits=c;function l(u,f){if(u.length<=1)return u;const d=u.length/2|0,p=u.slice(0,d),m=u.slice(d);l(p,f),l(m,f);let g=0,v=0,E=0;for(;g<p.length&&v<m.length;)f(p[g],m[v])<=0?u[E++]=p[g++]:u[E++]=m[v++];for(;g<p.length;)u[E++]=p[g++];for(;v<m.length;)u[E++]=m[v++];return u}s(l,"mergeSort")})(Bp||(Bp={})),_y=(n=class{constructor(i,o,c,l){this._uri=i,this._languageId=o,this._version=c,this._content=l,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(i){if(i){let o=this.offsetAt(i.start),c=this.offsetAt(i.end);return this._content.substring(o,c)}return this._content}update(i,o){this._content=i.text,this._version=o,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let i=[],o=this._content,c=!0;for(let l=0;l<o.length;l++){c&&(i.push(l),c=!1);let u=o.charAt(l);c=u==="\r"||u===`
|
|
4
4
|
`,u==="\r"&&l+1<o.length&&o.charAt(l+1)===`
|