@lvce-editor/editor-worker 19.13.0 → 19.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4189,6 +4189,9 @@ const isEqual$2 = (oldState, newState) => {
4189
4189
  if (!newState.focused) {
4190
4190
  return true;
4191
4191
  }
4192
+ if (!oldState.isSelecting && newState.isSelecting) {
4193
+ return false;
4194
+ }
4192
4195
  return oldState.focused === newState.focused && oldState.focus === newState.focus;
4193
4196
  };
4194
4197
 
@@ -7573,7 +7576,21 @@ const saveUntitledFile = async (uri, content, platform) => {
7573
7576
  return filePath;
7574
7577
  };
7575
7578
 
7579
+ const isPermissionDeniedError = error => {
7580
+ const errorCode = 'code' in error ? error.code : undefined;
7581
+ return errorCode === 'EACCES' || error.message.includes('EACCES:');
7582
+ };
7576
7583
  const showSaveErrorDialog = async error => {
7584
+ if (isPermissionDeniedError(error)) {
7585
+ await invoke$b('ElectronDialog.showMessageBox', {
7586
+ buttons: ['OK'],
7587
+ defaultId: 0,
7588
+ message: "You don't have permission to save changes to this file.",
7589
+ title: 'Unable to Save File',
7590
+ type: 'error'
7591
+ });
7592
+ return;
7593
+ }
7577
7594
  await invoke$b('ElectronDialog.showMessageBox', {
7578
7595
  buttons: ['OK'],
7579
7596
  defaultId: 0,
@@ -10696,7 +10713,7 @@ const getProblems = async () => {
10696
10713
  // or query the diagnostics for the problems view directtly from the extension host worker
10697
10714
  const keys = getKeys$2();
10698
10715
  const editors = keys.map(key => {
10699
- const numericKey = parseInt(key);
10716
+ const numericKey = Number(key);
10700
10717
  const editor = get$7(numericKey);
10701
10718
  return editor;
10702
10719
  });
@@ -1 +1 @@
1
- const t=t=>{const n=t.indexOf(".");return t.slice(n+1)};const n=()=>{const n=Object.create(null);const e={};return{clear(){for(const t of Object.keys(n)){delete n[t]}},diff(t,e,o){const{oldState:s,scheduledState:c}=n[t];const r=[];for(let t=0;t<e.length;t++){const n=e[t];if(!n(s,c)){r.push(o[t])}}return r},dispose(t){delete n[t]},get(t){return n[t]},getCommandIds(){const n=Object.keys(e);const o=n.map(t);return o},getKeys(){return Object.keys(n).map(Number)},registerCommands(t){Object.assign(e,t)},set(t,e,o,s){n[t]={newState:o,oldState:e,scheduledState:s??o}},wrapCommand(t){const e=async(e,...o)=>{const{newState:s,oldState:c}=n[e];const r=await t(s,...o);if(c===r||s===r){return}const i=n[e];const a={...i.newState,...r};n[e]={newState:a,oldState:i.oldState,scheduledState:a}};return e},wrapGetter(t){const e=(e,...o)=>{const{newState:s}=n[e];return t(s,...o)};return e},wrapLoadContent(t){const e=async(e,...o)=>{const{newState:s,oldState:c}=n[e];const r=await t(s,...o);const{error:i,state:a}=r;if(c===a||s===a){return{error:i}}const d=n[e];const l={...d.newState,...a};n[e]={newState:l,oldState:d.oldState,scheduledState:l};return{error:i}};return e}}};const e=()=>{globalThis.close()};class o extends Error{constructor(t){super(t);this.name="AssertionError"}}const s=1;const c=2;const r=3;const i=4;const a=5;const d=6;const l=7;const u=8;const f=t=>{switch(typeof t){case"number":return c;case"function":return d;case"string":return i;case"object":if(t===null){return l}if(Array.isArray(t)){return r}return s;case"boolean":return a;default:return u}};const h=t=>{const n=f(t);if(n!==s){throw new o("expected value to be of type object")}};const g=t=>{const n=f(t);if(n!==c){throw new o("expected value to be of type number")}};const m=t=>{const n=f(t);if(n!==r){throw new o("expected value to be of type array")}};const w=t=>{const n=f(t);if(n!==i){throw new o("expected value to be of type string")}};const p=t=>{const n=f(t);if(n!==a){throw new o("expected value to be of type boolean")}};const y=t=>{if(t.startsWith("Error: ")){return t.slice("Error: ".length)}if(t.startsWith("VError: ")){return t.slice("VError: ".length)}return t};const E=(t,n)=>{const e=y(`${t}`);if(n){return`${n}: ${e}`}return e};const x="\n";const I=(t,n=undefined)=>t.indexOf(x,n);const k=(t,n)=>{if(!n){return t}const e=I(t);const o=I(n);if(o===-1){return t}const s=t.slice(0,e);const c=n.slice(o);const r=y(n.slice(0,o));if(s.includes(r)){return s+c}return n};class S extends Error{constructor(t,n){const e=E(t,n);super(e);this.name="VError";if(t instanceof Error){this.stack=k(this.stack,t.stack)}if(t.codeFrame){this.codeFrame=t.codeFrame}if(t.code){this.code=t.code}}}const v=t=>t&&t instanceof MessagePort;const C=t=>t&&t.constructor&&t.constructor.name==="MessagePortMain";const b=t=>typeof OffscreenCanvas!=="undefined"&&t instanceof OffscreenCanvas;const M=(t,n)=>t?.constructor?.name===n;const A=t=>M(t,"Socket");const L=[v,C,b,A];const P=t=>{for(const n of L){if(n(t)){return true}}return false};const F=(t,n,e)=>{if(!t){return}if(e(t)){n.push(t);return}if(Array.isArray(t)){for(const o of t){F(o,n,e)}return}if(typeof t==="object"){for(const o of Object.values(t)){F(o,n,e)}return}};const W=t=>{const n=[];F(t,n,P);return n};const T=t=>{const n=(...n)=>{const e=t.getData(...n);t.dispatchEvent(new MessageEvent("message",{data:e}))};t.onMessage(n);const e=n=>{t.dispatchEvent(new Event("close"))};t.onClose(e)};class R extends EventTarget{constructor(t){super();this._rawIpc=t;T(this)}}const D="E_INCOMPATIBLE_NATIVE_MODULE";const O="E_MODULES_NOT_SUPPORTED_IN_ELECTRON";const B="ERR_MODULE_NOT_FOUND";const N="\n";const H=t=>t.join(N);const z=/^\s+at/;const U=/^\s*at async Promise.all \(index \d+\)$/;const $=t=>z.test(t)&&!U.test(t);const _=t=>{const n=t.findIndex($);if(n===-1){return{actualMessage:H(t),rest:[]}}let e=n-1;while(++e<t.length){if(!$(t[e])){break}}return{actualMessage:t[n-1],rest:t.slice(n,e)}};const Y=t=>t.split(N);const V=/^Error: The module '.*'$/;const j=/^\s* at/;const q=t=>V.test(t);const G=t=>j.test(t);const X=t=>{const n=Y(t);const e=n.findIndex(q);const o=e+n.slice(e).findIndex(G,e);const s=n.slice(e,o);const c=s.join(" ").slice("Error: ".length);return c};const Z=t=>t.includes("[ERR_MODULE_NOT_FOUND]");const Q=t=>{const n=Y(t);const e=n.findIndex(Z);const o=n[e];return{code:B,message:o}};const K=t=>{if(!t){return false}return t.includes("ERR_MODULE_NOT_FOUND")};const J=t=>{if(!t){return false}return t.includes("SyntaxError: Cannot use import statement outside a module")};const tt=/^innerError Error: Cannot find module '.*.node'/;const nt=/was compiled against a different Node.js version/;const et=t=>tt.test(t)&&nt.test(t);const ot=t=>{const n=X(t);return{code:D,message:`Incompatible native node module: ${n}`}};const st=()=>({code:O,message:`ES Modules are not supported in electron`});const ct=(t,n)=>{if(et(n)){return ot(n)}if(J(n)){return st()}if(K(n)){return Q(n)}const e=Y(n);const{actualMessage:o,rest:s}=_(e);return{code:"",message:o,stack:s}};class rt extends S{constructor(t,n="",e=""){if(n||e){const{code:o,message:s,stack:c}=ct(n,e);const r=new Error(s);r.code=o;r.stack=c;super(r,t)}else{super(t)}this.name="IpcError";this.stdout=n;this.stderr=e}}const it="ready";const at=t=>t.data;const dt=()=>{if(typeof WorkerGlobalScope==="undefined"){throw new TypeError("module is not in web worker scope")}return globalThis};const lt=t=>{t.postMessage(it)};class ut extends R{getData(t){return at(t)}send(t){this._rawIpc.postMessage(t)}sendAndTransfer(t){const n=W(t);this._rawIpc.postMessage(t,n)}dispose(){}onClose(t){}onMessage(t){this._rawIpc.addEventListener("message",t)}}const ft=t=>new ut(t);const ht=async t=>{const{promise:n,resolve:e}=Promise.withResolvers();t.addEventListener("message",e,{once:true});const o=await n;return o.data};const gt=async()=>{const t=dt();lt(t);const n=ft(t);const e=await ht(n);if(e.method!=="initialize"){throw new rt("unexpected first message")}const o=e.params[0];if(o==="message-port"){n.send({id:e.id,jsonrpc:"2.0",result:null});n.dispose();const t=e.params[1];return t}return globalThis};class mt extends R{getData(t){return at(t)}send(t){this._rawIpc.postMessage(t)}sendAndTransfer(t){const n=W(t);this._rawIpc.postMessage(t,n)}dispose(){if(this._rawIpc.close){this._rawIpc.close()}}onClose(t){}onMessage(t){this._rawIpc.addEventListener("message",t);this._rawIpc.start()}}const wt=t=>new mt(t);const pt={__proto__:null,listen:gt,wrap:wt};const yt=(t,n,e)=>{if("addEventListener"in t){t.addEventListener(n,e)}else{t.on(n,e)}};const Et=(t,n,e)=>{if("removeEventListener"in t){t.removeEventListener(n,e)}else{t.off(n,e)}};const xt=(t,n)=>{const{promise:e,resolve:o}=Promise.withResolvers();const s=Object.create(null);const c=e=>{for(const e of Object.keys(n)){Et(t,e,s[e])}o(e)};for(const[e,o]of Object.entries(n)){const n=t=>{c({event:t,type:o})};yt(t,e,n);s[e]=n}return e};const It=3;const kt=async({isMessagePortOpen:t,messagePort:n})=>{if(!v(n)){throw new rt("port must be of type MessagePort")}if(t){return n}const e=xt(n,{message:It});n.start();const{event:o,type:s}=await e;if(s!==It){throw new rt("Failed to wait for ipc message")}if(o.data!==it){throw new rt("unexpected first message")}return n};const St=t=>{t.start()};class vt extends R{getData=at;send(t){this._rawIpc.postMessage(t)}sendAndTransfer(t){const n=W(t);this._rawIpc.postMessage(t,n)}dispose(){this._rawIpc.close()}onMessage(t){this._rawIpc.addEventListener("message",t)}onClose(t){}}const Ct=t=>new vt(t);const bt={__proto__:null,create:kt,signal:St,wrap:Ct};class Mt extends Error{constructor(t){super(`Command not found ${t}`);this.name="CommandNotFoundError"}}const At=Object.create(null);const Lt=t=>{Object.assign(At,t)};const Pt=t=>At[t];const Ft=(t,...n)=>{const e=Pt(t);if(!e){throw new Mt(t)}return e(...n)};const Wt="2.0";const Tt=Object.create(null);const Rt=t=>Tt[t];const Dt=t=>{delete Tt[t]};class Ot extends Error{constructor(t){super(t);this.name="JsonRpcError"}}const Bt="\n";const Nt="DOMException";const Ht="ReferenceError";const zt="SyntaxError";const Ut="TypeError";const $t=(t,n)=>{if(n){switch(n){case Nt:return DOMException;case Ht:return ReferenceError;case zt:return SyntaxError;case Ut:return TypeError;default:return Error}}if(t.startsWith("TypeError: ")){return TypeError}if(t.startsWith("SyntaxError: ")){return SyntaxError}if(t.startsWith("ReferenceError: ")){return ReferenceError}return Error};const _t=(t,n,e)=>{const o=$t(t,n);if(o===DOMException&&e){return new o(t,e)}if(o===Error){const n=new Error(t);if(e&&e!=="VError"){n.name=e}return n}return new o(t)};const Yt=t=>t.join(Bt);const Vt=t=>t.split(Bt);const jt=()=>{const t=3;const n=Yt(Vt((new Error).stack||"").slice(t));return n};const qt=(t,n=undefined)=>t.indexOf(Bt,n);const Gt=t=>{let n=t.stack||t.data||t.message||"";if(n.startsWith(" at")){n=t.message+Bt+n}return n};const Xt=-32601;const Zt=-32001;const Qt=t=>{const n=jt();if(t&&t instanceof Error){if(typeof t.stack==="string"){t.stack=t.stack+Bt+n}return t}if(t&&t.code&&t.code===Xt){const e=new Ot(t.message);const o=Gt(t);e.stack=o+Bt+n;return e}if(t&&t.message){const e=_t(t.message,t.type,t.name);if(t.data){if(t.data.stack&&t.data.type&&t.message){e.stack=t.data.type+": "+t.message+Bt+t.data.stack+Bt+n}else if(t.data.stack){e.stack=t.data.stack}if(t.data.codeFrame){e.codeFrame=t.data.codeFrame}if(t.data.code){e.code=t.data.code}if(t.data.type){e.name=t.data.type}}else{if(t.stack){const n=e.stack||"";const o=qt(n);const s=Gt(t);e.stack=s+n.slice(o)}if(t.codeFrame){e.codeFrame=t.codeFrame}}return e}if(typeof t==="string"){return new Error(`JsonRpc Error: ${t}`)}return new Error(`JsonRpc Error: ${t}`)};const Kt=t=>{if("error"in t){const n=Qt(t.error);throw n}if("result"in t){return t.result}throw new Ot("unexpected response message")};const Jt=(...t)=>{console.warn(...t)};const tn=(t,n)=>{const e=Rt(t);if(!e){console.log(n);Jt(`callback ${t} may already be disposed`);return}e(n);Dt(t)};const nn="E_COMMAND_NOT_FOUND";const en=t=>{if(t&&t.type){return t.type}if(t&&t.constructor&&t.constructor.name){return t.constructor.name}return undefined};const on=t=>t.trim().startsWith("at ");const sn=t=>{const n=t.stack||"";const e=n.indexOf("\n");if(e!==-1&&!on(n.slice(0,e))){return n.slice(e+1)}return n};const cn=(t,n)=>{if(t&&t.code===nn){return{code:Xt,data:t.stack,message:t.message}}return{code:Zt,data:{code:n.code,codeFrame:n.codeFrame,name:n.name,stack:sn(n),type:en(n)},message:n.message}};const rn=(t,n)=>({error:n,id:t,jsonrpc:Wt});const an=(t,n,e,o)=>{const s=e(n);o(n,s);const c=cn(n,s);return rn(t,c)};const dn=(t,n)=>({id:t.id,jsonrpc:Wt,result:n??null});const ln=(t,n)=>{const e=n??null;return dn(t,e)};const un=(t,n)=>({error:{code:Zt,data:n,message:n.message},id:t,jsonrpc:Wt});const fn=async(t,n,e,o,s,c)=>{try{const o=c(t.method)?await e(t.method,n,...t.params):await e(t.method,...t.params);return ln(t,o)}catch(e){if(n.canUseSimpleErrorResponse){return un(t.id,e)}return an(t.id,e,o,s)}};const hn=t=>t;const gn=()=>{};const mn=()=>false;const wn=tn;const pn=t=>{if(t.length===1){const n=t[0];return{execute:n.execute,ipc:n.ipc,logError:n.logError||gn,message:n.message,preparePrettyError:n.preparePrettyError||hn,requiresSocket:n.requiresSocket||mn,resolve:n.resolve||wn}}return{execute:t[2],ipc:t[0],logError:t[5],message:t[1],preparePrettyError:t[4],requiresSocket:t[6],resolve:t[3]}};const yn=async(...t)=>{const n=pn(t);const{execute:e,ipc:o,logError:s,message:c,preparePrettyError:r,requiresSocket:i,resolve:a}=n;if("id"in c){if("method"in c){const t=await fn(c,o,e,r,s,i);try{o.send(t)}catch(t){const n=an(c.id,t,r,s);o.send(n)}return}a(c.id,c);return}if("method"in c){await fn(c,o,e,r,s,i);return}throw new Ot("unexpected message")};const En="2.0";const xn=(t,n)=>({jsonrpc:En,method:t,params:n});const In=(t,n,e)=>{const o={id:t,jsonrpc:En,method:n,params:e};return o};let kn=0;const Sn=()=>++kn;const vn=t=>{const n=Sn();const{promise:e,resolve:o}=Promise.withResolvers();t[n]=o;return{id:n,promise:e}};const Cn=async(t,n,e,o,s)=>{const{id:c,promise:r}=vn(t);const i=In(c,e,o);if(s&&n.sendAndTransfer){n.sendAndTransfer(i)}else{n.send(i)}const a=await r;return Kt(a)};const bn=t=>{const n=Object.create(null);t._resolve=(t,e)=>{const o=n[t];if(!o){console.warn(`callback ${t} may already be disposed`);return}o(e);delete n[t]};const e={async dispose(){await(t?.dispose())},invoke(e,...o){return Cn(n,t,e,o,false)},invokeAndTransfer(e,...o){return Cn(n,t,e,o,true)},ipc:t,send(n,...e){const o=xn(n,e);t.send(o)}};return e};const Mn=()=>false;const An=t=>t;const Ln=()=>{};const Pn=t=>{const n=t?.target?.requiresSocket||Mn;const e=t?.target?.execute||Ft;return yn(t.target,t.data,e,t.target._resolve,An,Ln,n)};const Fn=t=>{if("addEventListener"in t){t.addEventListener("message",Pn)}else if("on"in t){t.on("message",Pn)}};const Wn=async(t,n)=>{const e=await t.listen(n);if(t.signal){t.signal(e)}const o=t.wrap(e);return o};const Tn=async({commandMap:t,isMessagePortOpen:n=true,messagePort:e})=>{Lt(t);const o=await bt.create({isMessagePortOpen:n,messagePort:e});const s=bt.wrap(o);Fn(s);const c=bn(s);e.start();return c};const Rn=async({commandMap:t,isMessagePortOpen:n,send:e})=>{const{port1:o,port2:s}=new MessageChannel;await e(o);return Tn({commandMap:t,isMessagePortOpen:n,messagePort:s})};const Dn=t=>{let n;const e=()=>{if(!n){n=t()}return n};return{async dispose(){const t=await e();await t.dispose()},async invoke(t,...n){const o=await e();return o.invoke(t,...n)},async invokeAndTransfer(t,...n){const o=await e();return o.invokeAndTransfer(t,...n)},async send(t,...n){const o=await e();o.send(t,...n)}}};const On=async({commandMap:t,isMessagePortOpen:n,send:e})=>Dn(()=>Rn({commandMap:t,isMessagePortOpen:n,send:e}));const Bn=async({commandMap:t,messagePort:n})=>Tn({commandMap:t,messagePort:n});const Nn=async({commandMap:t})=>{Lt(t);const n=await Wn(pt);Fn(n);const e=bn(n);return e};const Hn=({commandMap:t})=>{const n=[];const e=(e,...o)=>{n.push([e,...o]);const s=t[e];if(!s){throw new Error(`command ${e} not found`)}return s(...o)};const o={invocations:n,invoke:e,invokeAndTransfer:e};return o};const zn=Object.create(null);const Un=(t,n)=>{zn[t]=n};const $n=t=>zn[t];const _n=t=>{delete zn[t]};const Yn=t=>({async dispose(){const n=$n(t);await n.dispose()},invoke(n,...e){const o=$n(t);return o.invoke(n,...e)},invokeAndTransfer(n,...e){const o=$n(t);return o.invokeAndTransfer(n,...e)},registerMockRpc(n){const e=Hn({commandMap:n});Un(t,e);e[Symbol.dispose]=()=>{_n(t)};return e},set(n){Un(t,n)}});const Vn=12;const jn=100;const qn="event.altKey";const Gn="event.button";const Xn="event.clientX";const Zn="event.clientY";const Qn="event.deltaMode";const Kn="event.deltaY";const Jn=1;const te=2;const ne=3;const ee=8;const oe=9;const se=255;const ce=12;const re=13;const ie=14;const ae=15;const de=16;const le=18;const ue=29;const fe=31;const he=32;const ge=34;const me=36;const we=38;const pe=39;const ye=40;const Ee=43;const xe=50;const Ie=52;const ke=54;const Se=58;const ve=59;const Ce=60;const be=68;const Me=87;const Ae=88;const Le=90;const Pe=92;const Fe=1;const We=2;const Te=3;const Re=4;const De=5;const Oe=6;const Be=7;const Ne=8;const He=1<<11>>>0;const ze=1<<10>>>0;const Ue=1<<9>>>0;const $e=3;const _e=22;const Ye=1;const Ve=0;const je=2;const qe=301;const Ge=55;const Xe=99;const Ze=44;const Qe=9006;const Ke=7009;const Je=300;const to=4561;const no=1;const eo="Viewlet.focusSelector";const oo="Viewlet.setCss";const so="Viewlet.setFocusContext";const co="Viewlet.setPatches";const ro=12;const{invoke:io,set:ao}=Yn(Ze);const lo={__proto__:null,invoke:io,set:ao};const{invoke:uo,set:fo}=Yn(Qe);const ho=(t,n)=>uo("Extensions.getLanguages",t,n);const{invoke:go,set:mo}=Yn(to);const wo=async(t,n)=>go("Open.openUrl",t,n);const{invoke:po,set:yo}=Yn(Ke);const{invoke:Eo,invokeAndTransfer:xo,set:Io}=Yn(no);const ko=async(t,n,e,o,s)=>{g(t);g(n);g(e);g(o);await Eo("ContextMenu.show2",t,n,e,o,s)};const So=async(t,n)=>{const e="HandleMessagePort.handleMessagePort";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToOpenerWorker",t,e,n)};const vo=async t=>Eo("FileSystem.readFile",t);const Co=async()=>Eo("Layout.handleWorkspaceRefresh");const bo=async(t,n=0)=>{const e="HandleMessagePort.handleMessagePort2";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker",t,e,n)};const Mo=async t=>{await Eo("ClipBoard.writeText",t)};const Ao=async()=>Eo("ClipBoard.readText");const Lo=(t,n,e)=>Eo("ExtensionHostManagement.activateByEvent",t,n,e);const Po=async t=>{const n="TextMeasurement.handleMessagePort";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToTextMeasurementWorker",t,n,0)};const Fo=async(t,n)=>{const e="Extensions.handleMessagePort";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker",t,e,n)};const Wo=async t=>await Eo("Preferences.get",t);const To=async(t,n,e)=>{await Eo("Main.openUri",t,n,e)};const Ro=async t=>{await xo("SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker",t,"HandleMessagePort.handleMessagePort2")};const Do={__proto__:null,activateByEvent:Lo,getPreference:Wo,handleWorkspaceRefresh:Co,invoke:Eo,invokeAndTransfer:xo,openUri:To,readClipBoardText:Ao,readFile:vo,sendMessagePortToExtensionHostWorker:bo,sendMessagePortToExtensionManagementWorker:Fo,sendMessagePortToOpenerWorker:So,sendMessagePortToSyntaxHighlightingWorker:Ro,sendMessagePortToTextMeasurementWorker:Po,set:Io,showContextMenu2:ko,writeClipBoardText:Mo};const{invoke:Oo,set:Bo}=Yn(Je);const No={__proto__:null,invoke:Oo,set:Bo};const Ho=t=>{let n;let e;const o=async()=>{const n=await e();Un(t,n)};const s=async()=>{if(!n){n=o()}await n};return{async invoke(n,...e){await s();const o=$n(t);return o.invoke(n,...e)},async invokeAndTransfer(n,...e){await s();const o=$n(t);return o.invokeAndTransfer(n,...e)},setFactory(t){e=t}}};const zo=async(t,n,e)=>{w(t);await Lo(t,n,e)};const Uo=t=>t;const $o=6;const _o=async(t,n,e)=>{const o=await Rn({commandMap:{},isMessagePortOpen:true,async send(e){await xo("IpcParent.create",{method:$o,name:t,port:e,raw:true,url:n})}});if(e){await o.invoke(e)}return o};const Yo=async()=>{const t="Color Picker Worker";const n="colorPickerWorkerMain.js";return _o(t,n)};const Vo={};const jo=()=>{if(!Vo.workerPromise){Vo.workerPromise=Yo()}return Vo.workerPromise};const qo=async(t,...n)=>{const e=await jo();return await e.invoke(t,...n)};const Go=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;await qo("ColorPicker.create",o,c,r,s,e,n);await qo("ColorPicker.loadContent",o);const i=await qo("ColorPicker.diff2",o);const a=await qo("ColorPicker.render2",o,i);return{...t,commands:a}};const Xo=n();const{getCommandIds:Zo,registerCommands:Qo,wrapGetter:Ko}=Xo;const Jo=t=>Xo.get(t);const ts=()=>{const t=Xo.getKeys();return t.map(String)};const ns=(t,n,e)=>{Xo.set(t,n,e)};const es=[];const os=41;const ss=9;const cs=0;const rs=16;const is=51;const as=11;const ds=38;const ls=52;const us=(t,n,e,o,s,c,r,i)=>{g(t);const a={additionalFocus:0,assetDir:i,charWidth:0,columnWidth:0,completionState:"",completionTriggerCharacters:[],completionUid:0,cursorInfos:[],cursorWidth:2,debugEnabled:false,decorations:[],deltaX:0,deltaY:0,diagnostics:[],diagnosticsEnabled:false,differences:[],embeds:[],finalDeltaY:0,finalY:0,focus:0,focused:false,focusKey:cs,fontFamily:"",fontSize:0,fontWeight:0,handleOffset:0,handleOffsetX:0,hasListener:false,height:c,highlightedLine:-1,id:t,incrementalEdits:es,initial:true,invalidStartIndex:0,isAutoClosingBracketsEnabled:false,isAutoClosingQuotesEnabled:false,isAutoClosingTagsEnabled:false,isMonospaceFont:false,isQuickSuggestionsEnabled:false,isSelecting:false,itemHeight:20,languageId:"",letterSpacing:0,lineCache:[],lineNumbers:false,lines:[],longestLineWidth:0,maxLineY:0,minimumSliderSize:20,minLineY:0,modified:false,numberOfLines:0,numberOfVisibleLines:0,platform:r,primarySelectionIndex:0,redoStack:[],rowHeight:0,savedSelections:[],scrollBarHeight:0,scrollBarWidth:0,selectionAnchorPosition:{columnIndex:0,rowIndex:0},selectionAutoMovePosition:{columnIndex:0,rowIndex:0},selectionInfos:[],selections:new Uint32Array,tabSize:0,textInfos:[],tokenizerId:0,uid:t,undoStack:[],uri:n,validLines:[],visualDecorations:[],widgets:[],width:s,x:e,y:o};ns(t,a,a)};const fs="compositionUpdate";const hs="contentEditableInput";const gs="delete";const ms="deleteHorizontalRight";const ws="deleteLeft";const ps="editorCut";const ys="editorPasteText";const Es="editorSnippet";const xs="editorType";const Is="editorTypeWithAutoClosing";const ks="format";const Ss="indentLess";const vs="indentMore";const Cs="insertLineBreak";const bs="lineComment";const Ms="rename";const As="toggleBlockComment";const Ls=Object.create(null);const Ps=(t,n)=>{Ls[t]=n};const Fs=t=>Ls[t];const Ws=t=>Fs(t);const Ts=async(t,n,e)=>{const o=Ws(n.id);if(e.length===1&&e[0].origin===xs&&o.handleEditorType){const n=await o.handleEditorType(t);return{...n}}if(e.length===1&&e[0].origin===ws&&o.handleEditorDeleteLeft){const n=await o.handleEditorDeleteLeft(t);return{...n}}return n};const Rs=async(t,n)=>{const e=t.widgets||[];if(e.length===0){return e}let o=t;for(const s of e){o=await Ts(t,s,n)}return o};const Ds=(t,n,e)=>{g(t);g(n);g(e);return Math.min(Math.max(t,n),e)};const Os="Link";const Bs="Function";const Ns="Parameter";const Hs="Type";const zs="VariableName";const Us="Class";const $s=1;const _s=2816;const Ys=2817;const Vs=2824;const js=2825;const qs=2956;const Gs=2857;const Xs=3072;const Zs=3073;const Qs=3077;const Ks=3088;const Js=1792;const tc=1793;const nc=512;const ec=513;const oc=769;const sc=1024;const cc=1536;const rc=1537;const ic=1544;const ac=1545;const dc=2048;const lc=2049;const uc=2056;const fc=2057;const hc=2064;const gc=2080;const mc=2081;const wc=2088;const pc=2089;const yc=2313;const Ec=2560;const xc=2561;const Ic=2569;const kc=2584;const Sc=256;const vc=257;const Cc=272;const bc=t=>{switch(t){case $s:return Os;case sc:case cc:case rc:case ic:case ac:case nc:case ec:case oc:return Hs;case Js:case tc:return Ns;case dc:case lc:case uc:case fc:case hc:case gc:case mc:case wc:case pc:case yc:case Ec:case xc:case Ic:case kc:return zs;case Sc:case vc:case Cc:return Us;case _s:case Ys:case Vs:case js:case qs:case Gs:case Xs:case Zs:case Qs:case Ks:return Bs;default:return`Unknown-${t}`}};const Mc=t=>structuredClone(t);const Ac=t=>Mc(t);const Lc={warned:[]};const Pc=t=>{const n=[];for(const e of t){h(e);n.push(e.type,e.length)}return n};const Fc=(t,n)=>{if(Lc.warned.includes(n)){return}Lc.warned.push(n);console.warn(`tokenizers without hasArrayReturn=false are deprecated (language ${t})`)};const Wc=(t,n,e,o,s)=>{try{const c=n(e,o);if(!c?.tokens||!c.state){throw new Error("invalid tokenization result")}if(!s){Fc(t,n);c.tokens=Pc(c.tokens)}return c}catch(t){console.error(t);return{lineState:o,tokens:[0,e.length]}}};const Tc={TopLevelContent:1};const Rc={Text:1};const Dc={[Rc.Text]:"Text"};const Oc={state:Tc.TopLevelContent};const Bc=true;const Nc=(t,n)=>({state:n.state,tokens:[Rc.Text,t.length]});const Hc={__proto__:null,State:Tc,TokenMap:Dc,TokenType:Rc,hasArrayReturn:Bc,initialLineState:Oc,tokenizeLine:Nc};const zc={enabled:false};const Uc=t=>{zc.enabled=t};const $c=()=>zc.enabled;const{invoke:_c,set:Yc}=No;const Vc={pending:Object.create(null),tokenizePaths:Object.create(null),tokenizers:Object.create(null)};const jc=t=>Object.hasOwn(Vc.tokenizers,t);const qc=(t,n)=>{Vc.tokenizers[t]=n};const Gc=t=>Vc.tokenizers[t];const Xc=(t,n)=>{Vc.tokenizePaths[t]=n};const Zc=t=>Vc.tokenizePaths[t]||"";const Qc=t=>{for(const n of t){if(n&&n.id&&n.tokenize){Xc(n.id,n.tokenize)}}};const Kc=t=>Object.hasOwn(Vc.pending,t);const Jc=Object.create(null);const tr=(t,n)=>{Jc[t]=n};const nr=t=>Jc[t]||{};const er=async(t,n)=>{if(!n){return}Xc(t,n);if($c()){const e=await _c("Tokenizer.load",t,n);tr(t,e);return}try{const e=await import(n);if(typeof e.tokenizeLine!=="function"){console.warn(`tokenizer.tokenizeLine should be a function in "${n}"`);return}if(!e.TokenMap||typeof e.TokenMap!=="object"||Array.isArray(e.TokenMap)){console.warn(`tokenizer.TokenMap should be an object in "${n}"`);return}tr(t,e.TokenMap);qc(t,e)}catch(t){console.error(t)}};const or=t=>{if(jc(t)){return Gc(t)}if(Kc(t)){return Hc}return Hc};const sr=Object.create(null);const cr=(t,n)=>{sr[t]=n};const rr=t=>sr[t]||Hc;const ir=(t,n,e,o,s,c,r)=>{const i=or(e);if(o!==n.length&&i&&i!==Hc){const a=o===0&&s===n.length;const d=n.slice(o,s);const l=Wc(t,i.tokenizeLine,d,c[e]||Ac(i.initialLineState),i.hasArrayReturn);c[e]=l;if(l.embeddedLanguage){const n=ir(t,d,l.embeddedLanguage,l.embeddedLanguageStart,l.embeddedLanguageEnd,c,r);if(n?.isFull){return n}}return{isFull:a,result:l,TokenMap:i.TokenMap}}r.push(e);c[e]=undefined;return{isFull:false,result:{},TokenMap:[]}};const ar=(t,n,e,o)=>{const s=[];const c=[];const r=Object.create(null);for(const i of o){const o=e[i+1];const a=n[i];if(o.embeddedLanguage){const{embeddedLanguage:n,embeddedLanguageEnd:e,embeddedLanguageStart:i}=o;if(a.length===0){const t={tokens:[]};o.embeddedResultIndex=c.length;c.push({isFull:true,result:t,TokenMap:[]})}else{o.embeddedResultIndex=c.length;c.push(ir(t,a,n,i,e,r,s))}}else{for(const t of Object.keys(r)){r[t]=undefined}}}return{embeddedResults:c,tokenizersToLoad:s}};const dr=(t,n,e)=>t<n?n:e;const lr=(t,n,e)=>{const{invalidStartIndex:o,languageId:s,lineCache:c,lines:r,tokenizerId:i}=t;const a=rr(i);const{hasArrayReturn:d,initialLineState:l,tokenizeLine:u}=a;const f=o;const h=dr(o,e,f);const g=[];const m=[];const w=[];for(let t=f;t<h;t++){const n=t===0?Ac(l):c[t];const e=r[t];const o=Wc(s,u,e,n,d);c[t+1]=o;if(o.embeddedLanguage){o.embeddedResultIndex=w.length;w.push(t)}}const p=c.slice(n+1,e+1);if(w.length>0){const{embeddedResults:n,tokenizersToLoad:e}=ar(s,r,c,w);t.invalidStartIndex=0;return{embeddedResults:n,tokenizersToLoad:e,tokens:p}}t.invalidStartIndex=Math.max(o,h);return{embeddedResults:m,tokenizersToLoad:g,tokens:p}};const ur=Object.create(null);const fr=async(t,n,e,o)=>{if($c()){if(o){const{id:o,invalidStartIndex:s,languageId:c,lines:r}=t;let i=true;let a=r;if(ur[o]===r){i=false;a=[]}else{ur[o]=r}const d={invalidStartIndex:s,languageId:c};return _c("GetTokensViewport.getTokensViewport",d,n,e,i,o,a)}return _c("GetTokensViewport.getTokensViewport",t,n,e,true,t.id,t.lines)}return lr(t,n,e)};const hr=async t=>{for(const n of t){const t=Zc(n);await er(n,t)}};const gr=".";const mr='"';const wr="";const pr="\n";const yr=" ";const Er="\t";const xr=(t,n,e)=>{if(n){return t.replaceAll(Er,()=>yr.repeat(e))}return t};const Ir=t=>t.includes(Er);const kr=(t,n,e)=>{const o=t.length;const s=e.length;t.length=o+s;for(let e=o-1;e>=n;e--){t[e+s]=t[e]}for(let o=0;o<s;o++){t[o+n]=e[o]}};const Sr=(t,n,e,o)=>{const s=t.splice(n,e);kr(t,n,o);return s};const vr=t=>t.join("\n");const Cr=/^\s+/;const br=t=>{const n=t.match(Cr);if(!n){return""}return n[0]};const Mr=(t,n)=>{h(t);m(n);const e=[...t.lines];let o=0;for(const s of n){const n=s.start.rowIndex+o;const c=s.end.rowIndex+o;const r=s.start.columnIndex;const i=s.end.columnIndex;const{deleted:a,inserted:d}=s;g(n);g(c);g(r);g(i);m(d);m(a);if(n===c){const o=e[n];if(d.length===0){const t=o.slice(0,r);const s=o.slice(i);e[n]=t+s}else if(d.length===1){let t=o.slice(0,r);if(r>o.length){t+=" ".repeat(r-o.length)}const s=o.slice(i);const c=d[0];e[n]=t+c+s}else{const s=o.slice(0,r)+d[0];const c=d.at(-1)+o.slice(i);Sr(e,n,a.length,[s,...d.slice(1,-1),c]);t.maxLineY=Math.min(t.numberOfVisibleLines,e.length)}}else{const o=e[n].slice(0,r)+d[0];if(d.length===1){const t=c>=e.length?"":e[c].slice(i);Sr(e,n,a.length,[o+t])}else{const t=d.slice(1,-1);const s=d.at(-1)+(c>=e.length?"":e[c].slice(i));Sr(e,n,a.length,[o,...t,s])}t.maxLineY=Math.min(t.numberOfVisibleLines,t.lines.length)}o+=d.length-a.length}return e};const Ar=(t,n)=>t.lines[n];const Lr=t=>vr(t.lines);const Pr=(t,n)=>{h(t);const e=n.start.rowIndex;const o=n.start.columnIndex;const s=Math.min(n.end.rowIndex,t.lines.length-1);const c=n.end.columnIndex;if(e===s){return[t.lines[e].slice(o,c)]}const r=[t.lines[e].slice(o),...t.lines.slice(e+1,s),t.lines[s].slice(0,c)];return r};const Fr=async(t,n,e)=>{h(t);g(n);g(e);let o=0;let s=0;const{lines:c}=t;const r=Math.min(n,t.lines.length);while(s<r){o+=c[s].length+1;s++}o+=e;return o};const Wr=(t,n,e)=>{h(t);g(n);g(e);let o=0;let s=0;const{lines:c}=t;const r=Math.min(n,t.lines.length);while(s<r){o+=c[s].length+1;s++}o+=e;return o};const Tr=(t,n)=>{const{lines:e}=t;let o=0;let s=0;let c=0;while(o<e.length&&c<n){c+=e[o].length+1;o++}if(c>n){o--;c-=e[o].length+1;s=n-c}else{s=c-n}return{columnIndex:s,rowIndex:o}};const Rr=10;const Dr=(t,n)=>{let e=0;let o=0;let s=0;const c=t.length;for(let r=0;r<c;r+=2){const c=t[r+1];o+=c;e=o;if(e>=n){e-=c;o-=c;s=r;break}}return{end:o,start:e,startIndex:s}};const Or=(t,n,e)=>{for(const[o,{end:s}]of t){if(o<e&&s>n){return true}}return false};const Br=(t,n)=>{for(const[e,o]of t){if(e<=n&&o.end>n){return o}}return undefined};const Nr=(t,n,e,o,s,c,r,i,a,d,l,u)=>{const f=[];const h=new Map;for(let t=0;t<o.length;t+=4){const n=o[t];const c=o[t+1];const r=o[t+2];const i=n-s;const a=i+c;if(i<e.length&&a>0){const t=bc(r);if(t){h.set(Math.max(0,i),{className:t,end:Math.min(e.length,a)})}}}const g=t[n.embeddedResultIndex];const m=g.result.tokens;const w=g.TokenMap;const p=m.length;let{end:y,start:E,startIndex:x}=Dr(m,l);const I=zr(E,d,a);for(let t=x;t<p;t+=2){const n=m[t];const o=m[t+1];const s=E+o;const i=Or(h,E,s);if(i){let t=E;while(t<s){const o=Br(h,t);let i;let a;let d;if(o){i=Math.min(s,o.end);a=e.slice(t,i);const c=w[n]||"Unknown";d=`Token ${c} ${o.className}`}else{let o=s;for(const[n]of h){if(n>t&&n<s){o=Math.min(o,n)}}i=o;a=e.slice(t,i);d=`Token ${w[n]||"Unknown"}`}const l=xr(a,c,r);f.push(l,d);t=i}}else{const t=e.slice(E,s);const o=`Token ${w[n]||"Unknown"}`;const i=xr(t,c,r);f.push(i,o)}E=s;y=s;if(y>=u){break}}return{difference:I,lineInfo:f}};const Hr=()=>({maxOffset:Infinity,minOffset:0});const zr=(t,n,e)=>{const o=t*n;const s=o-e;return s};const Ur=(t,n,e,o,s,c,r,i,a,d,l,u,f)=>{const h=[];const g=new Map;for(let n=0;n<o.length;n+=4){const e=o[n];const s=o[n+1];const r=o[n+2];const i=e-c;const a=i+s;if(i<t.length&&a>0){const n=bc(r);if(n){g.set(Math.max(0,i),{className:n,end:Math.min(t.length,a)})}}}const{tokens:m}=n;let{end:w,start:p,startIndex:y}=Dr(m,u);const E=zr(p,l,d);const x=m.length;for(let n=y;n<x;n+=2){const e=m[n];const o=m[n+1];const c=p+o;const a=Or(g,p,c);if(a){let n=p;while(n<c){const o=Br(g,n);let a;let d;let l;if(o){a=Math.min(c,o.end);d=t.slice(n,a);const r=s[e]||"Unknown";l=`Token ${r} ${o.className}`}else{let o=c;for(const[t]of g){if(t>n&&t<c){o=Math.min(o,t)}}a=o;d=t.slice(n,a);l=`Token ${s[e]||"Unknown"}`}const u=xr(d,r,i);h.push(u,l);n=a}}else{const n=t.slice(p,c);const o=`Token ${s[e]||"Unknown"}`;const a=xr(n,r,i);h.push(a,o)}p=c;w=c;if(w>=f){break}}return{difference:E,lineInfo:h}};const $r=(t,n,e,o,s,c,r,i,a,d,l)=>{const{maxOffset:u,minOffset:f}=Hr();if(e.length>0&&n.embeddedResultIndex!==undefined){const s=e[n.embeddedResultIndex];if(s?.isFull){return Nr(e,n,t,o,c,r,i,a,d,l,f,u)}}return Ur(t,n,e,o,s,c,r,i,a,d,l,f,u)};const _r=(t,n,e,o,s,c,r,i,a)=>{const d=[];const l=[];const{decorations:u,languageId:f,lines:h}=t;const g=nr(f);let m=c;const w=2;for(let t=o;t<s;t++){const s=h[t];const c=Ir(s);const f=[];for(let t=0;t<u.length;t+=4){const n=u[t];const e=u[t+1];const o=u[t+2];const c=u[t+3];if(n>=m&&n<m+s.length){f.push(n,e,o,c)}}const{difference:p,lineInfo:y}=$r(s,n[t-o],e,f,g,m,c,w,r,i,a);d.push(y);l.push(p);m+=s.length+1}return{differences:l,result:d}};const Yr=async(t,n)=>{const{charWidth:e,deltaX:o,lines:s,minLineY:c,numberOfVisibleLines:r,width:i}=t;const a=Math.min(c+r,s.length);let{embeddedResults:d,tokenizersToLoad:l,tokens:u}=await fr(t,c,a,n);for(let e=0;l.length>0&&e<Rr;e++){await hr(l);const e=await fr(t,c,a,n);({embeddedResults:d,tokenizersToLoad:l,tokens:u}=e)}const f=await Fr(t,c,0);const h=e;const{differences:g,result:m}=_r(t,u,d,c,a,f,i,o,h);return{differences:g,textInfos:m}};const Vr=(t,n,e,o)=>{const s=t/n*(e-o);if(!Number.isFinite(s)){return 0}return s};const jr=Vr;const qr=(t,n,e)=>{if(t>=n){return 0}return Math.max(Math.round(t**2/n),e)};const Gr=(t,n)=>{if(t>n){return 0}return t**2/n};const Xr=(t,n,e)=>{const o=n/2;if(e<=o){return{handleOffset:e,percent:0}}if(e<=t-o){return{handleOffset:o,percent:(e-o)/(t-n)}}return{handleOffset:n-t+e,percent:1}};const Zr={enabled:false};const Qr=t=>{Zr.enabled=t};const Kr=()=>Zr.enabled;const Jr=async(t,n)=>{h(t);g(n);const{deltaY:e,finalDeltaY:o,height:s,itemHeight:c,numberOfVisibleLines:r,scrollBarHeight:i}=t;const a=Ds(n,0,o);if(e===a){return t}const d=Math.floor(a/c);const l=d+r;const u=jr(a,o,s,i);const f={...t,deltaY:a,maxLineY:l,minLineY:d,scrollBarY:u};const m=Kr();const{differences:w,textInfos:p}=await Yr(f,m);const y={...f,differences:w,textInfos:p};return y};const ti=async(t,n)=>{if(!n.undoStack){return es}if(t.undoStack===n.undoStack){return es}const e=n.undoStack.at(-1);if(e&&e.length===1){const o=e[0];if(o.origin===xs){const{rowIndex:e}=o.start;const{lines:s}=n;const c=t.lines[e];const r=s[e];const i=await _c("TokenizeIncremental.tokenizeIncremental",n.uid,n.languageId,c,r,e,n.minLineY);if(i&&i.length===1){return i}}}return es};const ni=(t,n)=>t.matchAll(n).toArray();const ei=/(?:https?|ftps?|file):\/\/[^\s"']+|www\.[^\s"']+/g;const oi=/^(?:https?|ftp|ftps|file):\/\//;const si=/^www\./;const ci=".,;:!?";const ri={")":"(","]":"[","}":"{",">":"<"};const ii=(t,n)=>{const e=ri[n];let o=0;for(const s of t){if(s===e){o++}else if(s===n){o--}}return o<0};const ai=t=>{let n=t;while(n.length>0){const t=n.at(-1);if(!t){break}if(ci.includes(t)){n=n.slice(0,-1);continue}if(t in ri&&ii(n,t)){n=n.slice(0,-1);continue}break}return n};const di=t=>{const n=ni(t,ei);const e=[];for(const t of n){const n=ai(t[0]);if(oi.test(n)||si.test(n)){e.push({length:n.length,start:t.index??0})}}return e};const li=t=>{const n=[];const{lines:e}=t;let o=0;for(const t of e){const e=di(t);for(const t of e){const e=o+t.start;n.push(e,t.length,$s,0)}o+=t.length+1}return n};const ui=(t,n)=>{const{decorations:e,lines:o}=t;for(let t=0;t<e.length;t+=4){const s=e[t];const c=e[t+1];const r=e[t+2];if(r===$s&&n>=s&&n<s+c){let t=0;for(const n of o){const e=n.length+1;if(t+e>s){const e=s-t;const o=n.slice(e,e+c);return o}t+=e}}}return undefined};const fi=1;const hi=Object.create(null);const gi=(t,n)=>{g(t);g(n);if(!Object.hasOwn(hi,t)){hi[t]=[]}if(!hi[t].includes(n)){hi[t].push(n)}};const mi=(t,n)=>{g(t);g(n);if(Object.hasOwn(hi,t)){const e=hi[t].indexOf(n);if(e!==-1){hi[t].splice(e,1)}}};const wi=t=>{g(t);return hi[t]||[]};const pi=async(t,n,...e)=>{g(t);w(n);const o=wi(t);const s=o.map(async t=>{try{const o=$n(t);if(o){await o.invoke(n,...e)}}catch(n){console.warn(`Failed to notify listener ${t}:`,n)}});await Promise.all(s)};const yi=(t,n,e=t.columnWidth)=>{const o=n.x??t.x;const s=n.y??t.y;const c=n.width??t.width;const r=n.height??t.height;const i=Math.floor(r/t.itemHeight);const a=t.lines.length;const d=Math.max(a-i,0);const l=d*t.itemHeight;const u=Math.min(t.deltaY,l);const f=Math.floor(u/t.itemHeight);const h=Math.min(f+i,a);const g=a*t.rowHeight;const m=qr(r,g,t.minimumSliderSize);return{...t,columnWidth:e,deltaY:u,finalDeltaY:l,finalY:d,height:r,maxLineY:h,minLineY:f,numberOfVisibleLines:i,scrollBarHeight:m,width:c,x:o,y:s}};const Ei=t=>{if(!t){return[""]}return t.split("\n")};const{invoke:xi}=Do;const Ii=async t=>{try{await xi("Main.handleModifiedStatusChange",t,true)}catch{}};const ki=(t,n)=>{const e=t[n];const o=t[n+1];const s=t[n+2];const c=t[n+3];if(e>s||e===s&&o>=c){return[s,c,e,o,1]}return[e,o,s,c,0]};const Si=t=>{let n=0;for(const e of t){if(e===Er){n++}}return n};const vi=/^\p{ASCII}*$/u;const Ci=t=>vi.test(t);const bi=async(t,n)=>t.length*n;const Mi=async(t,n,e,o,s,c,r)=>{const i=await po("TextMeasurement.measureTextWidth",t,n,e,o,s,c,r);return i};const Ai=async(t,n,e,o,s,c,r)=>{if(c&&Ci(t)){return await bi(t,r)}return await Mi(t,n,e,o,s,c,r)};const Li=async(t,n,e,o,s,c,r,i,a,d,l,u=0)=>{if(!t){return 0}w(t);g(i);g(a);g(d);p(c);g(l);g(u);if(n===0){return 0}if(n*l>d){return d}const f=Ir(t);const h=xr(t,f,i);const m=Si(t.slice(0,n));const y=h.slice(0,n+m);const E=await Ai(y,e,o,s,r,c,l);return E-a+u};const Pi=(t,n,e)=>(t-n)*e;const Fi=t=>`${t}px`;const Wi=(t,n,e,o)=>new Uint32Array([t,n,e,o]);const Ti=t=>new Uint32Array(t);const Ri=t=>Ti(t.length);const Di=(t,n)=>{const e=Ri(t);for(let o=0;o<e.length;o+=4){const[s,c,r,i]=ki(t,o);n(e,o,s,c,r,i)}return e};const Oi=(t,n)=>{for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];n(o,s,c,r)}};const Bi=(t,n,e,o)=>{t[n]=t[n+2]=e;t[n+1]=t[n+3]=o};const Ni=(t,n,e,o)=>t===e&&n===o;const Hi=(t,n,e,o)=>t===e;const zi=(t,n)=>{for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];if(!n(o,s,c,r)){return false}}return true};const Ui=t=>zi(t,Ni);const $i=t=>zi(t,Hi);const _i=(t,n)=>{const e=Ti(t.length*4);let o=0;for(const s of t){const{end:t,start:c}=n(s);e[o++]=c.rowIndex;e[o++]=c.columnIndex;e[o++]=t.rowIndex;e[o++]=t.columnIndex}return e};const Yi=[];const Vi=(t,n)=>{if(!n){return Yi}const e=[];for(let n=0;n<t.length;n+=2){const o=t[n];const s=t[n+1];e.push(`${Fi(o)} ${Fi(s)}`)}return e};const ji=t=>{const n=[];for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];n.push(Fi(o),Fi(s),Fi(c),Fi(r))}return n};const qi=async t=>{const n=[];const e=[];const{charWidth:o,cursorWidth:s,differences:c,focused:r,fontFamily:i,fontSize:a,fontWeight:d,isMonospaceFont:l,letterSpacing:u,lines:f,maxLineY:h,minLineY:g,rowHeight:m,selections:w,tabSize:p,width:y}=t;const E=o;const x=s/2;for(let t=0;t<w.length;t+=4){const[o,s,r,I,k]=ki(w,t);if(r<g||o>h){continue}const S=r-g;const v=c[S];const C=f[r];const b=await Li(C,I,d,a,i,l,u,p,x,y,E,v);const M=Pi(r,g,m);if(Ni(o,s,r,I)&&b>0){n.push(b,M);continue}const A=Pi(o,g,m);const L=o-g;const P=c[L];if(o===r){const t=await Li(C,s,d,a,i,l,u,p,x,y,E,P);if(k){n.push(t,M)}else if(b>=0){n.push(b,M)}const o=b-t;e.push(t,A,o,m)}else{if(o>=g){const t=f[o];const c=await Li(t,s,d,a,i,l,u,p,x,y,E,P);const r=await Li(t,t.length,d,a,i,l,u,p,x,y,E,P);const h=Pi(o,g,m);const w=r-c;if(k){n.push(c,h)}e.push(c,h,w,m)}const t=Math.max(o+1,g);const w=Math.min(r,h);for(let n=t;n<w;n++){const t=f[n];const o=Pi(n,g,m);const s=n-g;const r=c[s];const h=await Li(t,t.length,d,a,i,l,u,p,x,y,E,r);e.push(0,o,h,m)}if(r<=h){const t=b;e.push(0,M,t,m);if(!k){n.push(t,M)}}}}return{cursorInfos:Vi(n,r),selectionInfos:ji(e)}};const Gi=t=>{const{inserted:n,start:e}=t;const o=e.rowIndex;const s=e.columnIndex;const c=n.length;if(c===1){const t={columnIndex:n.at(-1).length+s,rowIndex:o+c-1};return{end:t,start:t}}const r={columnIndex:s,rowIndex:o+c-1};return{end:r,start:r}};const Xi=(t,n)=>{h(t);return{...t,selections:n}};const Zi=(t,n)=>{h(t);m(n);const e=_i(n,Gi);return e};const Qi=(t,n)=>Jr(t,n);const Ki=(t,n)=>Qi(t,t.deltaY+n);const Ji=t=>t.origin===Is;const ta=(t,n)=>{const{autoClosingRanges:e=[]}=t;const o=[];const s=n[0];const c=s.start.rowIndex;const r=s.start.columnIndex;const i=s.end.rowIndex;const a=s.end.columnIndex;for(let t=0;t<e.length;t+=4){const n=e[t];const d=e[t+1];const l=e[t+2];const u=e[t+3];if(i===l&&a===u||c===n&&r>=d&&i===l&&a<=u){const t=s.inserted[0].length-s.deleted[0].length;o.push(n,d,l,u+t)}}if(Ji(s)){o.push(c,r+1,i,a+1)}return o};const na=(t,n)=>Xi(t,n);const ea=async(t,n,e=undefined)=>{h(t);m(n);if(n.length===0){return t}const o=Mr(t,n);const s={...t,lines:o};const c=e||Zi(s,n);const r=Math.min(t.invalidStartIndex,n[0].start.rowIndex);const i=ta(t,n);const a={...s,autoClosingRanges:i,invalidStartIndex:r,lines:o,modified:true,redoStack:[],selections:c,undoStack:[...t.undoStack,n]};const d=li(a);const l={...a,decorations:d};ns(t.uid,t,l);if(!t.modified){await Ii(t.uri)}try{await pi(fi,"handleEditorChanged",t.uid,t.uri,n)}catch(t){console.warn("Failed to notify editor change listeners:",t)}const u=await ti(t,l);const f=await Rs(l,n);const g={...l,...f,incrementalEdits:u};if(u!==es){return g}const w=Kr();const{differences:p,textInfos:y}=await Yr(g,w);return{...g,differences:p,textInfos:y}};const oa=async(t,n)=>{h(t);m(n);if(n.length===0){return t}const e=Mr(t,n);const o={...t,lines:e};const s=Zi(o,n);const c=Math.min(t.invalidStartIndex,n[0].start.rowIndex);const r={...o,invalidStartIndex:c,lines:e,selections:s};const i=await ti(t,r);const a={...r,incrementalEdits:i};if(i!==es){return a}const d=Kr();const{differences:l,textInfos:u}=await Yr(a,d);return{...a,differences:l,textInfos:u}};const sa=async(t,n)=>{const e=Mr(t,n);const o=n[0].start.rowIndex;const s={...t,invalidStartIndex:o,lines:e,redoStack:[],undoStack:[...t.undoStack,n]};const c=await ti(t,s);const r={...s,incrementalEdits:c};if(c!==es){return r}const i=Kr();const{differences:a,textInfos:d}=await Yr(r,i);return{...r,differences:a,textInfos:d}};const ca=t=>t.selections&&t.selections.length>0;const ra=(t,n,e,o,s,c)=>yi(t,{height:s,width:o,x:n,y:e},c);const ia=(t,n)=>{const e=Ei(n);const{itemHeight:o,minimumSliderSize:s,numberOfVisibleLines:c}=t;const r=e.length;const i=Math.min(c,r);const a=Math.max(r-c,0);const d=a*o;const l=e.length*t.rowHeight;const u=qr(t.height,l,s);return{...t,finalDeltaY:d,finalY:a,lines:e,maxLineY:i,scrollBarHeight:u}};const aa={cursorInfos:[],debugEnabled:false,decorations:[],deltaX:0,deltaY:0,diagnostics:[],differences:[],embeds:[],focused:false,hasListener:false,height:0,highlightedLine:-1,incrementalEdits:es,isSelecting:false,languageId:"",lineCache:[],lines:[],longestLineWidth:0,maxLineY:0,minLineY:0,redoStack:[],scrollBarHeight:0,selectionAnchorPosition:{columnIndex:0,rowIndex:0},selectionAutoMovePosition:{columnIndex:0,rowIndex:0},selectionInfos:[],selections:new Uint32Array,textInfos:[],tokenizerId:0,undoStack:[],uri:"",width:0,x:0,y:0};const da="ExtensionHostHover.execute";const la="ExtensionHost.executeTabCompletionProvider";const ua="ExtensionHostTextDocument.syncFull";const{invoke:fa,set:ha}=lo;const ga=t=>{w(t);return t.lastIndexOf(gr)};const ma=(t,n)=>t.lastIndexOf(gr,n);const wa=(t,n)=>{for(const e of t){if(e&&e.extensions&&Array.isArray(e.extensions)&&e.extensions.includes(n)){return e.id}}return""};const pa=(t,n)=>{for(const e of t){if(e&&e.fileNames&&Array.isArray(e.fileNames)&&e.fileNames.includes(n)){return e.id}}return""};const ya=(t,n)=>{w(t);const e=ga(t);const o=t.slice(e);const s=o.toLowerCase();const c=wa(n,s);if(c){return c}const r=t.toLowerCase();const i=ma(t,e-1);const a=t.slice(i);const d=wa(n,a);if(d){return d}const l=pa(n,r);if(l){return l}return"unknown"};const Ea=async(t,n)=>{g(t);w(n);const e=await ho(t,n);return e};const xa=async(t,n,e,o)=>await Ai("a",t,n,e,o,false,0);const Ia=async t=>{const n=await Wo(t);return n};const ka="onDiagnostic";const Sa="onHover";const va="onTabCompletion";const Ca=async({args:t,assetDir:n,editor:e,event:o,method:s,noProviderFoundMessage:c,noProviderFoundResult:r=undefined,platform:i})=>{const a=`${o}:${e.languageId}`;await zo(a,n,i);const d=await fa(s,e.uid,...t);return d};const ba=t=>({documentId:t.id||t.uid,languageId:t.languageId,text:Lr(t),uri:t.uri});const Ma=async t=>{const n=ba(t);return uo("Extensions.executeDiagnosticProvider",n)};const Aa=async t=>{const n=await Ma(t);if(n.length>0){return n}const{assetDir:e,platform:o}=t;return Ca({args:[],assetDir:e,editor:t,event:ka,method:"ExtensionHost.executeDiagnosticProvider",noProviderFoundMessage:"no diagnostic provider found",platform:o})};const La=t=>t.type;const Pa=async(t,n)=>{const e=[];const{charWidth:o,fontFamily:s,fontSize:c,fontWeight:r,isMonospaceFont:i,letterSpacing:a,lines:d,minLineY:l,rowHeight:u,tabSize:f,width:h}=t;for(const t of n){const{columnIndex:n,endColumnIndex:g,rowIndex:m}=t;const w=g-n;const p=w*o;const y=0;const E=0;const x=await Li(d[m],n,r,c,s,i,a,f,E,h,o,y);const I=Pi(m,l,u)-u;e.push({height:u,type:La(t),width:p,x:x,y:I})}return e};const Fa=(t,n)=>{const e=li(t);const o=[...e,...n];const s=[];for(let t=0;t<o.length;t+=4){s.push({length:o[t+1],modifiers:o[t+3],offset:o[t],type:o[t+2]})}s.sort((t,n)=>t.offset-n.offset);const c=[];for(const t of s){c.push(t.offset,t.length,t.type,t.modifiers)}return c};const Wa=async t=>{try{const n=Lr(t);await fa(ua,t.uri,t.id,t.languageId,n);const e=await Aa(t);const o=Jo(t.id);if(!o){return t}const s=await Pa(o.newState,e);const c=s.flatMap(t=>[t.offset,t.length,t.type,t.modifiers||0]);const r=Fa(o.newState,c);const i={...o.newState,decorations:r,diagnostics:e,visualDecorations:s};ns(t.id,o.oldState,i);await Eo("Editor.rerender",t.id);return i}catch(n){if(n&&n.message.includes("No diagnostic provider found")){return t}console.error(`Failed to update diagnostics: ${n}`);return t}};const Ta=async({assetDir:t,columnToReveal:n,completionTriggerCharacters:e,content:o,diagnosticsEnabled:s,fontFamily:c,fontSize:r,fontWeight:i,formatOnSave:a,height:d,hoverEnabled:l,id:u,isAutoClosingBracketsEnabled:f,isAutoClosingQuotesEnabled:h,isAutoClosingTagsEnabled:m,isMonospaceFont:p,isQuickSuggestionsEnabled:y,languageId:E,letterSpacing:x,lineNumbers:I,lineToReveal:k,links:S,platform:v,rowHeight:C,savedDeltaY:b,savedSelections:M,tabSize:A,uri:L,useFunctionalRendering:P,width:F,x:W,y:T})=>{g(u);w(o);const R=await xa(i,r,c,x);const D=await Ea(v,t);const O=ya(L,D);const B={assetDir:t,charWidth:R,columnWidth:0,completionState:"",completionTriggerCharacters:e,completionUid:0,cursorInfos:[],cursorWidth:2,decorations:[],deltaX:0,deltaY:0,diagnostics:[],diagnosticsEnabled:s,differences:[],finalDeltaY:0,finalY:0,focused:false,focusKey:cs,fontFamily:c,fontSize:r,fontWeight:i,handleOffset:0,handleOffsetX:0,hasListener:false,height:d,id:u,incrementalEdits:es,invalidStartIndex:0,isAutoClosingBracketsEnabled:f,isAutoClosingQuotesEnabled:h,isAutoClosingTagsEnabled:m,isMonospaceFont:p,isQuickSuggestionsEnabled:y,isSelecting:false,itemHeight:20,languageId:O,letterSpacing:x,lineCache:[],lineNumbers:I,lines:[],longestLineWidth:0,maxLineY:0,minimumSliderSize:20,minLineY:0,modified:false,numberOfVisiblelines:0,numberOfVisibleLines:0,platform:v,primarySelectionIndex:0,redoStack:[],rowHeight:C,savedSelections:M,scrollBarHeight:0,scrollBarWidth:0,selectionAnchorPosition:{columnIndex:0,rowIndex:0},selectionAutoMovePosition:{columnIndex:0,rowIndex:0},selectionInfos:[],selections:new Uint32Array,tabSize:A,textInfos:[],tokenizerId:0,uid:u,undoStack:[],uri:L,useFunctionalRendering:P,validLines:[],widgets:[],width:F,x:W,y:T};const N=ra(B,W,T,F,d,9);const H=ia(N,o);let z;if(k&&n){const t=k*C;z=await Jr(H,t)}else{z=await Jr(H,0)}const U=li(z);const $={...z,decorations:U};const _=Kr();const{differences:Y,textInfos:V}=await Yr($,_);const j={...$,differences:Y,focus:ro,focused:true,textInfos:V};ns(u,aa,j);await fa(ua,L,u,E,o);if(s){await Wa(j)}const q=await Ia("editor.completionsOnType");const G=Boolean(q);ns(u,aa,{...j,completionsOnType:G})};const Ra=(t,n)=>t.rowHeight===n.rowHeight&&t.deltaY===n.deltaY&&t.finalDeltaY===n.finalDeltaY&&t.height===n.height&&t.deltaX===n.deltaX&&t.longestLineWidth===n.longestLineWidth&&t.minimumSliderSize===n.minimumSliderSize&&t.width===n.width&&t.scrollBarHeight===n.scrollBarHeight;const Da=(t,n)=>{if(!n.focused){return true}return t.focused===n.focused&&t.focus===n.focus};const Oa=(t,n)=>t.cursorInfos===n.cursorInfos&&t.diagnostics===n.diagnostics&&t.highlightedLine===n.highlightedLine&&t.lineNumbers===n.lineNumbers&&t.loadError===n.loadError&&t.textInfos===n.textInfos&&t.differences===n.differences&&t.initial===n.initial&&t.selectionInfos===n.selectionInfos;const Ba=6;const Na=7;const Ha=11;const za=12;const Ua=13;const $a=(t,n)=>t.widgets===n.widgets;const _a=[Oa,Da,Da,Ra,$a];const Ya=[za,Ba,Na,Ha,Ua];const Va=(t,n)=>{const e=[];for(let o=0;o<_a.length;o++){const s=_a[o];if(!s(t,n)){e.push(Ya[o])}}return e};const ja=t=>{const{newState:n,oldState:e}=Jo(t);const o=Va(e,n);return o};const qa=t=>{const n=[];for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];if(e===0&&o!==0){n.push(o-1,s,o-1,s)}n.push(o,s,c,r)}return new Uint32Array(n)};const Ga=t=>{const{selections:n}=t;const e=qa(n);return{...t,selections:e}};const Xa=(t,n)=>{const e=[];for(let o=0;o<t.length;o+=4){const s=t[o];const c=t[o+1];const r=t[o+2];const i=t[o+3];e.push(s,c,r,i);if(o===t.length-4&&r<n){e.push(r+1,i,r+1,i)}}return new Uint32Array(e)};const Za=t=>{const{lines:n,selections:e}=t;const o=Xa(e,n.length);return{...t,selections:o}};const Qa=(t,n)=>{const e=[];for(const o of n){const n=Tr(t,o.startOffset);const s=Tr(t,o.endOffset);const c=Pr(t,{end:s,start:n});const r={deleted:c,end:s,inserted:Ei(o.inserted),origin:ks,start:n};if(r.inserted.length===0){r.inserted=[""]}e.push(r)}return e};const Ka=(...t)=>{console.warn(...t)};const Ja=(...t)=>{console.error(...t)};const td=(t,n)=>{if(!Array.isArray(n)){Ka("something is wrong with format on save",n);return t}if(n.length===0){return t}const e=Qa(t,n);return ea(t,e)};const nd=async(t,n)=>{h(t);m(n);return ea(t,n)};const ed=(t,n)=>{const e=[];for(const o of n){if(o.uri===t.uri){for(const n of o.edits){const o=Tr(t,n.offset);const s=Tr(t,n.offset+n.deleted);const c=Pr(t,{end:s,start:o});const r={deleted:c,end:s,inserted:[n.inserted],origin:Ms,start:o};e.push(r)}}}return e};const od=async(t,n)=>{h(t);m(n);const e=ed(t,n);if(e.length===0){return t}return ea(t,e)};const sd=t=>{if(!t.focused){return t}const n={...t,focused:false};return n};const cd=(t,n,e,o)=>{const s=[];const c=n.length;for(let r=0;r<c;r+=4){const[c,i,a,d]=ki(n,r);const l={columnIndex:i,rowIndex:c};const u={columnIndex:d,rowIndex:a};const f={end:u,start:l};s.push({deleted:Pr(t,f),end:u,inserted:e,origin:o,start:l})}return s};const rd=(t,n,e)=>{const{selections:o}=t;return cd(t,o,n,e)};const id=async(t,n,e,o,s,c,r,i,a,d)=>{for(let l=n;l<t.length;l++){const n=await Ai(t.slice(0,l),s,c,r,i,a,d);if(o-n<e/2){return l}}return t.length};const ad=()=>"Segmenter"in Intl;const dd=()=>{const t=new Intl.Segmenter;return{at(n,e){const o=t.segment(n);return o.containing(e)},getSegments:n=>t.segment(n),modelIndex(n,e){const o=t.segment(n);let s=0;for(const t of o){if(s>=e){return t.index}s++}return n.length},visualIndex(n,e){const o=t.segment(n);let s=0;for(const t of o){if(t.index>=e){return s}s++}return s}}};const ld=async(t,n,e,o,s,c,r,i)=>{const a=dd();const d=a.getSegments(t);const l=false;const u=0;for(const n of d){const a=await Ai(t.slice(0,n.index),s,c,r,i,l,u);if(o-a<e){return n.index}}return t.length};const ud=(t,n)=>{const e=Math.round(t/n);return e};const fd=(t,n,e)=>{let o=n;for(let s=0;s<n;s++){if(t[s]===Er){o-=e-1}}return o};const hd=async(t,n,e,o,s,c,r,i,a)=>{w(t);g(n);g(e);w(o);g(s);p(c);g(r);g(i);g(a);const d=ud(a,r);const l=Ir(t);const u=fd(t,d,i);const f=t.slice(0,u);const h=xr(f,l,i);const m=await Ai(h,n,e,o,s,c,r);const y=Ci(t);if(y){if(Math.abs(a-m)<r/2){return u}return await id(t,u,r,a,n,e,o,s,c,r)}return await ld(t,u,r,a,n,e,o,s)};const gd=async(t,n,e)=>{h(t);g(n);g(e);const{charWidth:o,deltaX:s,deltaY:c,fontFamily:r,fontSize:i,fontWeight:a,isMonospaceFont:d,letterSpacing:l,lines:u,rowHeight:f,tabSize:m,x:w,y:p}=t;const y=Math.floor((e-p+c)/f);if(y<0){return{columnIndex:0,rowIndex:0}}const E=n-w+s;const x=Ds(y,0,u.length-1);const I=u[x];const k=await hd(I,a,i,r,l,d,o,m,E);return{columnIndex:k,rowIndex:x}};const md=(t,n,e)=>{const{columnWidth:o,x:s}=t;const c=e*o+s;return c};const wd=(t,n)=>{const{rowHeight:e,y:o}=t;const s=(n+1)*e+o;return s};const pd={timeout:-1};const yd=async(t,n,e,o,s)=>{h(t);g(n);g(e);w(o);const c=md(t,n,e);const r=wd(t,n);const i=o;await Eo("Editor.showOverlayMessage",t,"Viewlet.send",t.uid,"showOverlayMessage",c,r,i);if(!s){const n=()=>{xd(t)};pd.timeout=setTimeout(n,3e3)}return t};const Ed=async(t,n,e,o)=>yd(t,n,e,o,true);const xd=async t=>{clearTimeout(pd.timeout);pd.timeout=-1;return t};const Id=String;const kd=t=>{switch(t){case"(":return")";case"[":return"]";case"{":return"}";default:return"???"}};const Sd=async(t,n)=>{try{const e=Wr(t,t.cursor);const o=await Eo("ExtensionHostBraceCompletion.executeBraceCompletionProvider",t,e,n);if(o){const e=kd(n);const o=n+e;const s=rd(t,[o],xs);return ea(t,s)}const s=rd(t,[n],xs);return ea(t,s)}catch(n){console.error(n);const e=Array.isArray(t.cursor)?t.cursor[0]:t.cursor;return Ed(t,e,Id(n))}};const vd=t=>{const{selections:n}=t;if(n.length===4&&n[0]===n[2]&&n[1]===n[3]){return t}const e=Ti(4);Bi(e,0,n[0],n[1]);return na(t,e)};const Cd=(t,n)=>{for(const[e,o]of t.entries()){if(o.id===n){return e}}return-1};const bd=(t,n)=>{const e=Cd(t,n);const o=[...t.slice(0,e),...t.slice(e+1)];return o};const Md=t=>t.id===Fe;const Ad=t=>{const{widgets:n}=t;const e=n.findIndex(Md);if(e===-1){return t}const o=bd(n,Fe);return{...t,focused:true,widgets:o}};const Ld=t=>t.id===De;const Pd=t=>{const{widgets:n}=t;const e=n.findIndex(Ld);if(e===-1){return t}const o=bd(n,De);return{...t,focused:true,widgets:o}};const Fd=async()=>{const t="Rename Worker";const n="renameWorkerMain.js";const e=await _o(t,n);await e.invoke("Rename.initialize");return e};const Wd={};const Td=()=>{if(!Wd.workerPromise){Wd.workerPromise=Fd()}return Wd.workerPromise};const Rd=async(t,...n)=>{const e=await Td();return await e.invoke(t,...n)};const Dd=t=>t.id===Be;const Od=async t=>{const{uid:n,widgets:e}=t;const o=e.findIndex(Dd);if(o===-1){return t}const s=e[o];await Rd("Rename.close",s.newState.uid);const c=Jo(n);const{newState:r}=c;return r};const Bd=t=>t.id===Ne;const Nd=t=>{const{widgets:n}=t;const e=n.findIndex(Bd);if(e===-1){return t}const o=bd(n,Ne);return{...t,widgets:o}};const Hd=(t,n)=>{for(const e of t){if(e.id===n){return true}}return false};const zd=async(t,n,e,o,s,c)=>{const{widgets:r}=e;if(Hd(r,t)){return e}const i=o();i.newState.editorUid=e.uid;const a=await s(i.newState,e.uid);a.editorUid=e.uid;const d={...i,newState:a};const l=[...r,d];const u=!c;const f={...e,additionalFocus:c?0:n,focus:c?n:ro,focused:u,widgets:l};return f};const Ud=()=>Math.random();const $d=()=>{const t=Ud();const n={id:We,newState:{commands:[],height:0,uid:t,width:0,x:0,y:0},oldState:{commands:[],height:0,uid:t,width:0,x:0,y:0}};return n};const _d=(t,n)=>Go(t,n);const Yd=async t=>zd(We,os,t,$d,_d);const Vd={compositionText:"",isComposing:false};const jd=(t,n)=>{Vd.isComposing=true;return t};const qd=(t,n)=>{const e=[];for(let o=0;o<t.length;o+=4){const s=t[o];const c=t[o+1];const r=t[o+2];const i=t[o+3];const a=c-Vd.compositionText.length;e.push({deleted:[Vd.compositionText],end:{columnIndex:i,rowIndex:r},inserted:[n],origin:fs,start:{columnIndex:a,rowIndex:s}})}return e};const Gd=(t,n)=>{const{selections:e}=t;const o=qd(e,n);Vd.compositionText=n;return ea(t,o)};const Xd=(t,n)=>{const{selections:e}=t;const o=qd(e,n);Vd.isComposing=false;Vd.compositionText="";return ea(t,o)};const Zd=async t=>{try{w(t);await Mo(t)}catch(t){throw new S(t,"Failed to write text to clipboard")}};const Qd=(t,n,e,o,s,c)=>{if(n){const n=t[s].length;return{end:{columnIndex:n,rowIndex:e},start:{columnIndex:0,rowIndex:e}}}return{end:{columnIndex:c,rowIndex:s},start:{columnIndex:o,rowIndex:e}}};const Kd=(t,n,e,o)=>t===e&&n===o;const Jd=async t=>{if(!ca(t)){return t}const{lines:n,selections:e}=t;const o=e[0];const s=e[1];const c=e[2];const r=e[3];const i=Kd(o,s,c,r);const a=Qd(n,i,o,s,c,r);const d=Pr(t,a);const l=vr(d);const u=i?"\n"+l:l;await Zd(u);return t};const tl=t=>{const{selections:n}=t;const e=[];for(let t=0;t<n.length;t+=4){const o=n[t];g(o);e.push(o)}const o=[...new Set(e)].toSorted((t,n)=>t-n);const s=o.map(n=>{const e={columnIndex:0,rowIndex:n};return{deleted:[""],end:e,inserted:[Ar(t,n),""],start:e}});const c=new Uint32Array(o.length*4);for(let t=0;t<o.length;t++){const n=o[t]+t+1;c[t*4]=n;c[t*4+1]=0;c[t*4+2]=n;c[t*4+3]=0}return ea(t,s,c)};const nl=t=>{const{selections:n}=t;const e=n[0];const o={columnIndex:0,rowIndex:e};const s=[{deleted:[""],end:o,inserted:[Ar(t,e),""],start:o}];return ea(t,s)};const el=(t,n,e,o)=>{if(n===0){if(t===0){return{columnIndex:0,rowIndex:0}}return{columnIndex:e[t-1].length,rowIndex:t-1}}const s=o(e[t],n);return{columnIndex:n-s,rowIndex:t}};const ol=(t,n,e,o)=>{t[n]=e;t[n+1]=o};const sl=(t,n,e,o)=>{t[n]=t[n+2]=e;t[n+1]=t[n+3]=o};const cl=(t,n,e,o,s,c)=>{if(o===0){if(e===0){t[n]=0;t[n+1]=0}else{t[n]=e-1;t[n+1]=s[e-1].length}}else{const r=c(s[e],o);t[n]=e;t[n+1]=o-r}};const rl=(t,n,e)=>{const o=new Uint32Array(t.length);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=ki(t,s);if(c===i&&r===a){if(c===0&&r===0){o[s]=0;o[s+1]=0;o[s+2]=0;o[s+3]=0}else{cl(o,s,c,r,n,e);cl(o,s+2,c,r,n,e)}}else{sl(o,s,t[s],t[s+1])}}return o};const il=(t,n)=>{const{lines:e,selections:o}=t;const s=rl(o,e,n);return na(t,s)};const al=(t,n)=>{if(!ad()){return 1}if(n>t.length){return 1}const e=dd();const o=e.at(t,n-1);if(!o){return 1}return n-o.index};const dl=()=>2;const ll=(t,n)=>{if(!ad()){return 1}const e=dd();const o=e.at(t,n);return o.segment.length};const ul=t=>t===yr||t===Er;const fl=(t,n)=>{if(t.length===0){return 0}for(let e=0;e<n;e++){if(!ul(t[e])){return n-e}}return n};const hl=(t,n)=>t.length-n;const gl=(t,n)=>{for(const e of n){const n=t.match(e);if(n){return n[0].length}}return 1};const ml=/(?<![A-Z])[A-Z]+\s*$/;const wl=/[\u{C0}-\u{17F}\w\-]+>?\s*$/u;const pl=/[a-zA-Z]+[^a-zA-Z\d]+\s*$/;const yl=/\s+$/;const El=/[^a-zA-Z\d]+\s*$/;const xl=[ml,wl,pl,yl,El];const Il=(t,n)=>{const e=t.slice(0,n);return gl(e,xl)};const kl=/^\s*[\u{C0}-\u{17F}\w]+/iu;const Sl=/^[^a-zA-Z\d]+\w*/;const vl=[kl,Sl];const Cl=(t,n)=>{const e=t.slice(n);return gl(e,vl)};const bl=/(?<![A-Z])[A-Z]{2}[a-z]+$/;const Ml=/(?=[A-Z]+)[A-Z][a-z]+$/;const Al=/[A-Z]+[a-z]+\d?\s*$/;const Ll=/[A-Z]+\d*\s*$/;const Pl=/[a-z]+\d*\s*$/;const Fl=/[A-Z]*[a-z]+_+\s*$/;const Wl=/(?<![A-Z])[A-Z]_+\s*$/;const Tl=/[a-z]+\s*$/;const Rl=/[^a-zA-Z\d\s]+\s*$/;const Dl=[bl,Ml,Al,Ll,Pl,Fl,Wl,Tl,Rl];const Ol=(t,n)=>{const e=t.slice(0,n);return gl(e,Dl)};const Bl=/^\s*[a-z]+\d?/;const Nl=/^\s*[A-Z]{2}[a-z\d]+/;const Hl=/^\s*[A-Z]+(?=[A-Z][a-z]+)/;const zl=/^\s*[A-Z]+[a-z]*\d*/;const Ul=/^\s*_+[a-z]*\d?/;const $l=/^\s*[^\da-zA-Z\s]+/;const _l=[Bl,Hl,zl,Ul,$l];const Yl=[Bl,Nl,Hl,zl,Ul,$l];const Vl=/[A-Z]/;const jl=(t,n)=>{const e=t.slice(n);if(Vl.test(t[n-1])){return gl(e,_l)}return gl(e,Yl)};const ql=t=>il(t,al);const Gl=(t,n,e)=>{const{rowIndex:o}=t;const{columnIndex:s}=t;if(s>=n[o].length){if(o>=n.length){return t}return{columnIndex:0,rowIndex:o+1}}const c=e(n[o],s);return{columnIndex:s+c,rowIndex:o}};const Xl=(t,n,e,o,s,c)=>{if(e>=s.length){return}const r=s[e];if(o>=r.length){t[n]=t[n+2]=e+1;t[n+1]=t[n+3]=0}else{const s=c(r,o);t[n]=t[n+2]=e;t[n+1]=t[n+3]=o+s}};const Zl=(t,n,e)=>{const o=new Uint32Array(t.length);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=ki(t,s);if(c===i&&r===a){Xl(o,s,c,r,n,e)}else{o[s]=o[s+2]=i;o[s+1]=o[s+3]=a}}return o};const Ql=(t,n)=>{const{lines:e,selections:o}=t;const s=Zl(o,e,n);return na(t,s)};const Kl=t=>Ql(t,ll);const Jl=(t,n,e,o,s,c)=>{Bi(t,n,s+1,c)};const tu=t=>Di(t,Jl);const nu=t=>{const{selections:n}=t;const e=tu(n);return na(t,e)};const eu=t=>Ql(t,hl);const ou=t=>il(t,fl);const su=(t,n,e)=>{h(t);g(n);g(e);const o=Wi(n,e,n,e);return na(t,o)};const cu=(t,n,e,o,s,c)=>{if(e===0){Bi(t,n,0,0)}else{Bi(t,n,e-1,o)}};const ru=t=>Di(t,cu);const iu=(t,n,e,o)=>{const{selections:s}=t;const c=ru(s);return na(t,c)};const au=t=>iu(t);const du=t=>il(t,Il);const lu=t=>il(t,Ol);const uu=t=>Ql(t,jl);const fu=t=>Ql(t,Cl);const hu=async t=>{const{lines:n,selections:e}=t;const o=new Set;const s=[];for(let t=0;t<e.length;t+=4){const[n]=ki(e,t);if(!o.has(n)){o.add(n);s.push(n)}}const c=new Uint32Array(s.length*4);const r=new Uint32Array(s.length*4);const i=[];for(let t=0;t<s.length;t++){const e=s[t];const o=n[e];const a=t*4;c[a]=e;c[a+1]=0;c[a+2]=e;c[a+3]=o.length;r[a]=e;r[a+1]=0;r[a+2]=e;r[a+3]=0;i.push(o)}const a=cd(t,c,[""],ps);await Zd(vr(i));return ea(t,a,r)};const gu=async t=>{const n=rd(t,[""],ps);const e=n.map(t=>vr(t.deleted)).filter(t=>t.length>0);const o=vr(e);await Zd(o);return ea(t,n)};const mu=async t=>{const{selections:n}=t;if(Ui(n)){return hu(t)}return gu(t)};const wu=t=>{const{lines:n}=t;const e=n.length-1;const o=n.at(-1).length;const s={columnIndex:0,rowIndex:0};const c={columnIndex:o,rowIndex:e};const r=[{deleted:Pr(t,{end:c,start:s}),end:c,inserted:[""],origin:gs,start:s}];return ea(t,r)};const pu=(t,n,e)=>{const o=[];const s=(n,s,c,r)=>{const i=el(n,s,t,e);const a={columnIndex:r,rowIndex:c};o.push({deleted:Pr({lines:t},{end:a,start:i}),end:a,inserted:[""],origin:ws,start:i})};Oi(n,s);return o};const yu=(t,n,e,o,s)=>{if(!Ni(n,e,o,s)){return false}if(e<1){return false}for(let o=0;o<t.length;o+=4){const s=t[o];const c=t[o+1];if(n===s&&e===c){return true}}return false};const Eu=(t,n)=>{for(let e=0;e<n.length;e+=4){const[o,s,c,r]=ki(n,e);if(!yu(t,o,s,c,r)){return false}}return true};const xu=t=>{const{lines:n,selections:e}=t;for(let t=0;t<e.length;t+=4){e[t+1]++;e[t+3]++}const o=pu(n,e,dl);return ea(t,o)};const Iu=(t,n)=>{const{autoClosingRanges:e=[],lines:o,selections:s}=t;if(Eu(e,s)){return xu(t)}if(Ui(s)){const e=pu(o,s,n);return ea(t,e)}const c=rd(t,[""],ws);return ea(t,c)};const ku=t=>Iu(t,fl);const Su=(t,n)=>{const{selections:e}=t;if(Ui(e)){const o=[];const{lines:s}=t;for(let c=0;c<e.length;c+=4){const[r,i]=ki(e,c);const a={columnIndex:i,rowIndex:r};const d=Gl(a,s,n);o.push({deleted:Pr(t,{end:d,start:a}),end:d,inserted:[""],origin:ms,start:a})}return o}const o=rd(t,[""],ms);return o};const vu=(t,n)=>{const e=Su(t,n);return ea(t,e)};const Cu=t=>vu(t,hl);const bu=t=>{const n=Iu(t,al);return n};const Mu=t=>vu(t,ll);const Au=t=>{const n=Iu(t,Il);return n};const Lu=t=>{const n=Iu(t,Ol);return n};const Pu=t=>vu(t,jl);const Fu=t=>vu(t,Cl);const Wu=async t=>{await Eo("SideBar.show","References",true);return t};const Tu=async t=>{const n={documentId:t.id||t.uid,languageId:t.languageId,text:Lr(t),uri:t.uri};return uo("Extensions.executeFormattingProvider",n)};const Ru="Failed to execute formatting provider: FormattingError:";const Du=t=>t&&t instanceof Error&&t.message.startsWith(Ru);const Ou="Failed to execute formatting provider: FormattingError:";const Bu=async t=>{try{const n=await Tu(t);return td(t,n)}catch(n){if(Du(n)){console.error("Formatting Error:",n.message.slice(Ou.length));return t}console.error(n);const e=String(n);await yd(t,0,0,e,true);return t}};const Nu=/^[\w\-]+/;const Hu=/[\w\-]+$/;const zu=(t,n)=>{const e=t.slice(0,n);const o=e.match(Hu);const s=t.slice(n);const c=s.match(Nu);let r=wr;if(o){r+=o[0]}if(c){r+=c[0]}return{word:r}};const Uu=(t,n)=>{const e=t.slice(0,n);const o=e.match(Hu);if(o){return o[0]}return wr};const $u=(t,n,e)=>{const{lines:o}=t;const s=o[n];return zu(s,e)};const _u=(t,n,e)=>{const{lines:o}=t;const s=o[n];return Uu(s,e)};const Yu=async(t,n)=>{const e=await Eo("ExtensionHostDefinition.executeDefinitionProvider",t,n);return e};const Vu={};const ju=/\{(PH\d+)\}/g;const qu=(t,n=Vu)=>{if(n===Vu){return t}const e=(t,e)=>n[e];return t.replaceAll(ju,e)};const Gu="Copy";const Xu="Cut";const Zu="Editor: Close Color Picker";const Qu="Editor: Copy Line Down";const Ku="Editor: Copy Line Up";const Ju="Editor: Format Document (forced)";const tf="Editor: Go To Definition";const nf="Editor: Go To Type Definition";const ef="Editor: Indent";const of="Editor: Open Color Picker";const sf="Editor: Select All Occurrences";const cf="Editor: Select Down";const rf="Editor: Select Inside String";const af="Editor: Select Next Occurrence";const df="Editor: Select Up";const lf="Show Hover";const uf="Editor: Sort Lines Ascending";const ff="Editor: Toggle Comment";const hf="Editor: Unindent";const gf="Enter Code";const mf="Escape to close";const wf="Find All Implementations";const pf="Find All References";const yf="Format Document";const Ef="Go to Definition";const xf="Go to Type Definition";const If="Move Line Down";const kf="Move Line Up";const Sf="No definition found";const vf="No definition found for '{PH1}'";const Cf="No type definition found";const bf="No type definition found for '{PH1}'";const Mf="Paste";const Af="Source Action";const Lf="Toggle Block Comment";const Pf=()=>qu(Ef);const Ff=()=>qu(Sf);const Wf=t=>qu(vf,{PH1:t});const Tf=t=>qu(bf,{PH1:t});const Rf=()=>qu(Cf);const Df=()=>qu(Af);const Of=()=>qu(mf);const Bf=()=>qu(gf);const Nf=()=>qu(xf);const Hf=()=>qu(pf);const zf=()=>qu(wf);const Uf=()=>qu(Xu);const $f=()=>qu(Gu);const _f=()=>qu(Mf);const Yf=()=>qu(Lf);const Vf=()=>qu(kf);const jf=()=>qu(If);const qf=()=>qu(yf);const Gf=()=>qu(lf);const Xf=()=>qu(Ju);const Zf=()=>qu(af);const Qf=()=>qu(sf);const Kf=()=>qu(tf);const Jf=()=>qu(nf);const th=()=>qu(rf);const nh=()=>qu(ef);const eh=()=>qu(hf);const oh=()=>qu(uf);const sh=()=>qu(ff);const ch=()=>qu(df);const rh=()=>qu(cf);const ih=()=>qu(of);const ah=()=>qu(Zu);const dh=()=>qu(Qu);const lh=()=>qu(Ku);const uh=async({editor:t,getErrorMessage:n,getLocation:e,getNoLocationFoundMessage:o,isNoProviderFoundError:s})=>{const{selections:c}=t;const r=c[0];const i=c[1];try{const n=await e(t,r,i);if(!n){const n=$u(t,r,i);const e=o(n);return yd(t,r,i,e,false)}if(typeof n.uri!=="string"||typeof n.startOffset!=="number"||typeof n.endOffset!=="number"){return t}const{uri:s}=n;if(s===t.uri){const e=Tr(t,n.startOffset);const o=new Uint32Array([e.rowIndex,e.columnIndex,e.rowIndex,e.columnIndex]);return na(t,o)}const c={endColumnIndex:n.endColumnIndex,endRowIndex:n.endRowIndex,startColumnIndex:n.startColumnIndex,startRowIndex:n.startRowIndex};await To(s,true,c);return t}catch(e){if(s(e)){const o=n(e);await yd(t,r,i,o,false);return t}const o=n(e);await yd(t,r,i,o,true);return t}};const fh=async(t,n,e)=>{const o=Wr(t,n,e);const s=await Yu(t,o);return s};const hh=t=>{if(t.word){return Wf(t.word)}return Ff()};const gh=String;const mh=t=>t?.message?.startsWith("Failed to execute definition provider: No definition provider found");const wh=async t=>uh({editor:t,getErrorMessage:gh,getLocation:fh,getNoLocationFoundMessage:hh,isNoProviderFoundError:mh});const ph=t=>{if(t.word){return Tf(t.word)}return Rf()};const yh=async(t,n)=>{const e=await Eo("ExtensionHostTypeDefinition.executeTypeDefinitionProvider",t,n);return e};const Eh=async(t,n,e)=>{const o=Wr(t,n,e);const s=await yh(t,o);return s};const xh=String;const Ih=t=>t?.message?.startsWith("Failed to execute type definition provider: No type definition provider found");const kh=async(t,n=true)=>uh({editor:t,getErrorMessage:xh,getLocation:Eh,getNoLocationFoundMessage:ph,isNoProviderFoundError:Ih});const Sh=t=>{switch(t){case De:return true;default:return false}};const vh=t=>{if(t.length===0){return t}return t.filter(Sh)};const Ch=async(t,n)=>{await wo(t,n)};const bh=async(t,n)=>{const{platform:e}=t;const{columnIndex:o,rowIndex:s}=n;const c=Wr(t,s,o);const r=ui(t,c);if(r){await Ch(r,e);return t}const i={...t,selections:new Uint32Array([s,o,s,o])};const a=await wh(i);return a};const Mh=async(t,n)=>{const{selections:e}=t;for(let o=0;o<e.length;o+=4){const[s,c,r,i]=ki(e,o);if(s===n.rowIndex&&c===n.columnIndex&&r===n.rowIndex&&i===n.columnIndex){const n=new Uint32Array(e.length-4);n.set(e.subarray(0,o),0);n.set(e.subarray(o+4),o);return na(t,n)}}const o=new Uint32Array(e.length+4);o.set(e,0);const s=e.length;o[s]=n.rowIndex;o[s+1]=n.columnIndex;o[s+2]=n.rowIndex;o[s+3]=n.columnIndex;return na(t,o)};const Ah=1;const Lh=2;const Ph=(t,n)=>{const e=vh(t.widgets);return{...t,focused:true,selectionAnchorPosition:n,selections:new Uint32Array([n.rowIndex,n.columnIndex,n.rowIndex,n.columnIndex]),widgets:e}};const Fh=t=>{switch(t){case Lh:return bh;case Ah:return Mh;default:return Ph}};const Wh=async(t,n,e,o)=>{h(t);g(n);g(e);g(o);const s=Fh(n);const c=await s(t,{columnIndex:o,rowIndex:e});return c};const Th=3;const Rh=async(t,n,e,o)=>{const{uid:s}=t;await ko(s,Th,e,o,{menuId:Th});return t};const Dh=/^[a-zA-Z\u{C0}-\u{17F}\d]+/u;const Oh=/[a-zA-Z\u{C0}-\u{17F}\d]+$/u;const Bh=(t,n,e)=>{const o=t.slice(0,e);const s=t.slice(e);const c=o.match(Oh);const r=s.match(Dh);const i=e-(c?c[0].length:0);const a=e+(r?r[0].length:0);const d=new Uint32Array([n,i,n,a]);return d};const Nh=(t,n,e)=>{const o=Ar(t,n);const s=Bh(o,n,e);return na(t,s)};const Hh=async(t,n,e,o)=>{const s=await gd(t,e,o);return Nh(t,s.rowIndex,s.columnIndex)};const zh=t=>{if(t.focused&&t.focus===ro){return t}return{...t,additionalFocus:0,focus:ro,focused:true}};const Uh=1;const $h=2;const _h=3;const Yh=(t,n)=>{if(t){return Lh}if(n){return Ah}return 0};const Vh=async(t,n,e,o)=>{h(t);g(n);g(e);g(o);const s=await gd(t,e,o);return Wh(t,n,s.rowIndex,s.columnIndex)};const jh=(t,n)=>new Uint32Array([n,0,n,t.length]);const qh=t=>{const{selections:n}=t;const e=n[t.primarySelectionIndex];const o=Ar(t,e);const s=jh(o,e);return na(t,s)};const Gh=(t,n,e,o)=>{h(t);g(e);g(o);return qh(t)};const Xh=0;const Zh=async(t,n,e,o,s,c,r)=>{if(n!==Xh){return t}const i=Yh(e,o);let a;switch(r){case $h:a=await Hh(t,i,s,c);break;case Uh:a=await Vh(t,i,s,c);break;case _h:a=Gh(t,i,s,c);break;default:return t}return{...a,isSelecting:true}};const Qh={editor:undefined,timeout:-1,x:0,y:0};const Kh=()=>Qh;const Jh=(t,n,e,o)=>{Qh.editor=t;Qh.timeout=n;Qh.x=e;Qh.y=o};const tg=async(t,n)=>{};const ng=async()=>{const{editor:t,x:n,y:e}=Kh();await gd(t,n,e);await tg()};const eg=300;const og=(t,n,e)=>{if(!t.hoverEnabled){return t}const o=Kh();if(o.timeout!==-1){clearTimeout(o.timeout)}const s=setTimeout(ng,eg);Jh(t,s,n,e);return t};const sg=(t,n)=>{let e=0;for(let o=0;o<t.length;o++){const s=t[o];e+=s.length;if(e>=n){return o}}return-1};const cg=async(t,n,e)=>{h(t);g(n);g(e);const o=await gd(t,n,e);const s=Wr(t,o.rowIndex,o.columnIndex);try{const n=await Yu(t,s);if(!n){return t}const e=Tr(t,n.startOffset);Tr(t,n.endOffset);const o=t.lineCache[e.rowIndex+1];if(!o){return t}const c=sg(o.tokens,e.columnIndex);if(c===-1){return t}return t}catch(n){if(n&&n.message.startsWith("Failed to execute definition provider: No definition provider found")){return t}throw n}};const rg=(t,n)=>new Uint32Array([n.startRowIndex,n.startColumnIndex,n.endRowIndex,n.endColumnIndex]);const ig=(t,n,e)=>{const o=rg(t,e);const s={end:{columnIndex:o[3],rowIndex:o[2]},start:{columnIndex:o[1],rowIndex:o[0]}};const c=[{deleted:Pr(t,s),end:s.end,inserted:[n],origin:hs,start:s.start}];return c};const ag=(t,n,e)=>{const o=ig(t,n,e);return ea(t,o)};const dg=(t,n)=>{const e=rg(t,n);return na(t,e)};const lg=t=>({...t,hasListener:false,isSelecting:false,selectionAutoMovePosition:{columnIndex:0,rowIndex:0}});const ug=async(t,n,e,o,s,c,r)=>t;const fg=(t,n)=>t;const hg=async(t,n,e)=>{await gd(t,n,e)};const gg=t=>{globalThis.requestAnimationFrame(t)};const mg=(t,n)=>t.selections!==n.selections||t.focused!==n.focused||t.minLineY!==n.minLineY||t.maxLineY!==n.maxLineY||t.differences!==n.differences||t.charWidth!==n.charWidth||t.cursorWidth!==n.cursorWidth||t.fontFamily!==n.fontFamily||t.fontSize!==n.fontSize||t.fontWeight!==n.fontWeight||t.isMonospaceFont!==n.isMonospaceFont||t.letterSpacing!==n.letterSpacing||t.lines!==n.lines||t.rowHeight!==n.rowHeight||t.tabSize!==n.tabSize||t.width!==n.width;const wg=(t,n)=>{if(t.textInfos!==n.textInfos||t.differences!==n.differences){return false}return t.lines!==n.lines||t.tokenizerId!==n.tokenizerId||t.minLineY!==n.minLineY||t.maxLineY!==n.maxLineY||t.decorations!==n.decorations||t.embeds!==n.embeds||t.deltaX!==n.deltaX||t.width!==n.width||t.highlightedLine!==n.highlightedLine||t.debugEnabled!==n.debugEnabled};const pg=async(t,n)=>{let e=n;if(wg(t,n)){const t=Kr();const{differences:o,textInfos:s}=await Yr(n,t);e={...n,differences:o,textInfos:s}}if(!mg(t,n)){return e}const{cursorInfos:o,selectionInfos:s}=await qi(e);return{...e,cursorInfos:o,selectionInfos:s}};const yg=-1;const Eg=0;const xg=1;const Ig=(t,n)=>{if(t.rowIndex>n.rowIndex){return xg}if(t.rowIndex===n.rowIndex){if(t.columnIndex>n.columnIndex){return xg}if(t.columnIndex<n.columnIndex){return yg}return Eg}return yg};const kg=(t,n)=>new Uint32Array([t.rowIndex,t.columnIndex,n.rowIndex,n.columnIndex]);const Sg=(t,n)=>new Uint32Array([n.rowIndex,n.columnIndex,n.rowIndex,n.columnIndex]);const vg=(t,n)=>new Uint32Array([t.rowIndex,t.columnIndex,n.rowIndex,n.columnIndex]);const Cg=(t,n)=>{switch(Ig(n,t)){case Eg:return Sg(t,n);case xg:return vg(t,n);case yg:return kg(t,n);default:throw new Error("unexpected comparison result")}};const bg=(t,n)=>{const e=t.selectionAnchorPosition;const o=Cg(e,n);return na(t,o)};const Mg=(t,n)=>{const{maxLineY:e,minLineY:o,rowHeight:s}=t;const c=e-o;if(n.rowIndex<o){const e=n.rowIndex;const o=n.rowIndex+c;const r=n.rowIndex*s;const i=t.selectionAnchorPosition;const a=new Uint32Array([n.rowIndex-1,n.columnIndex,i.rowIndex,i.columnIndex]);return{...t,deltaY:r,maxLineY:o,minLineY:e,selections:a}}if(n.rowIndex>e){const c=e-o;const r=n.rowIndex-c;const i=n.rowIndex;const a=r*s;const d=t.selectionAnchorPosition;const l=new Uint32Array([d.rowIndex,d.columnIndex,n.rowIndex+1,n.columnIndex]);return{...t,deltaY:a,maxLineY:i,minLineY:r,selections:l}}return t};const Ag=async t=>{const n=Jo(t);const e=n?.newState;if(!e||!e.hasListener||!e.isSelecting){return}const o=e.selectionAutoMovePosition;if(o.rowIndex===0){return}const s=Mg(e,o);if(e===s){return}const c=o.rowIndex<e.minLineY?-1:1;const r={...s,selectionAutoMovePosition:{columnIndex:o.columnIndex,rowIndex:o.rowIndex+c}};const i=await pg(e,r);ns(e.uid,e,i);gg(()=>Ag(t))};const Lg=async(t,n,e)=>{h(t);g(n);g(e);const o=await gd(t,n,e);const s=bg(t,o);if(!t.hasListener&&(o.rowIndex<t.minLineY||o.rowIndex>t.maxLineY)){gg(()=>Ag(t.uid));return{...s,hasListener:true,selectionAutoMovePosition:o}}return s};const Pg=async(t,n,e,o)=>{if(!t.isSelecting){return t}if(o){return hg(t,n,e)}return Lg(t,n,e)};const Fg=t=>({...t,hasListener:false,isSelecting:false,selectionAutoMovePosition:{columnIndex:0,rowIndex:0}});const Wg=(t,n,e)=>{if(e<=0){return 0}if(e<=t-n/2){return e/(t-n)}return 1};const Tg=(t,n)=>{const{handleOffsetX:e,longestLineWidth:o,width:s,x:c}=t;if(s>o){return{...t,deltaX:0,scrollBarWidth:0}}const r=20;const i=Ds(n,c,c+s);const a=i-c-e;const d=Gr(s,o);const l=o-s+r;const u=Wg(s,d,a);const f=Ds(u,0,1);const h=f*l;return{...t,deltaX:h}};const Rg=(t,n)=>{const{deltaX:e,longestLineWidth:o,width:s,x:c}=t;const r=n-c;const i=Gr(s,o);const a=s-i;const d=Vr(e,a,s,i);const l=r-d;if(l>=0&&l<i){return{...t,handleOffsetX:l}}const{handleOffset:u,percent:f}=Xr(s,i,r);const h=f*a;return{...t,deltaX:h,handleOffsetX:u}};const Dg=(t,n)=>{const{height:e,scrollBarHeight:o}=t;if(n<=e-o/2){return n/(e-o)}return 1};const Og=async(t,n)=>{const{finalDeltaY:e,handleOffset:o=0,y:s}=t;const c=n-s-o;const r=Dg(t,c);const i=r*e;const a=await Qi(t,i);return a};const Bg=Og;const Ng=async(t,n)=>{const{deltaY:e,finalDeltaY:o,height:s,scrollBarHeight:c,y:r}=t;const i=n-r;const a=jr(e,o,s,c);const d=i-a;if(d>=0&&d<c){return{...t,handleOffset:d}}const{handleOffset:l,percent:u}=Xr(s,c,i);const f=u*o;const h=await Qi(t,f);return{...h,handleOffset:l}};const Hg=(t,n)=>{};const zg={deltaY:0,touchOffsetY:0};const Ug=(t,n)=>{if(n.touches.length===0){return}const e=n.touches[0];zg.touchOffsetY=e.y;zg.deltaY=t.deltaY};const $g=(t,n)=>Ki(t,n);const _g=(t,n)=>Qi(t,n);const Yg=(t,n,e,o)=>{g(n);g(e);g(o);const{deltaX:s}=t;if(e===0){return $g(t,o)}const c=Ds(s+e,0,Infinity);return{...$g(t,o),deltaX:c}};const Vg=(t,n)=>{if(n.touches.length===0){return}const e=n.touches[0];const o=zg.deltaY+(zg.touchOffsetY-e.y);_g(t,o)};const jg=(t,n,e,o)=>Yg(t,n,e,o);const qg=t=>{const n=[];const e=[];for(let n=0;n<t.length;n+=4){const o=t[n];const s=t[n+2];for(let t=o;t<=s;t++){e.push(t)}}for(const t of e){n.push({deleted:[" "],end:{columnIndex:2,rowIndex:t},inserted:[""],origin:Ss,start:{columnIndex:0,rowIndex:t}})}return n};const Gg=t=>{const{selections:n}=t;const e=qg(n);return ea(t,e)};const Xg=t=>{const n=[];for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+2];for(let t=o;t<=s;t++){n.push(t)}}const e=Array.from(n,t=>({deleted:[""],end:{columnIndex:0,rowIndex:t},inserted:[" "],origin:vs,start:{columnIndex:0,rowIndex:t}}));return e};const Zg=t=>{const{selections:n}=t;const e=Xg(n);return ea(t,e)};const Qg=async t=>Eo("Languages.getLanguageConfiguration",{languageId:t.languageId,uri:t.uri});const Kg=t=>{if(t?.indentationRules?.increaseIndentPattern&&typeof t.indentationRules.increaseIndentPattern==="string"){const n=new RegExp(t.indentationRules.increaseIndentPattern);return n}return undefined};const Jg=(t,n)=>{if(!n){return false}return n.test(t)};const tm=(t,n,e)=>{const o=[];const s=[];const c=Kg(e);for(let e=0;e<n.length;e+=4){const[r,i,a,d]=ki(n,e);const l={columnIndex:i,rowIndex:r};const u={columnIndex:d,rowIndex:a};const f={end:u,start:l};if(Ni(r,i,a,d)){const n=t[r];const e=n.slice(0,i);const a=br(e);if(Jg(e,c)){o.push({deleted:Pr({lines:t},f),end:u,inserted:["",a+" ",a],origin:Cs,start:l});s.push(r+1,a.length+2,r+1,a.length+2)}else{o.push({deleted:Pr({lines:t},f),end:u,inserted:["",a],origin:Cs,start:l});s.push(r+1,a.length,r+1,a.length)}}else{o.push({deleted:Pr({lines:t},f),end:u,inserted:["",""],origin:Cs,start:l});s.push(r+1,0,r+1,0)}}return{changes:o,selectionChanges:new Uint32Array(s)}};const nm=async t=>{const{lines:n,selections:e}=t;const o=await Qg(t);const{changes:s,selectionChanges:c}=tm(n,e,o);return ea(t,s,c)};const em=2;const om=0;const sm=()=>{const t=Ud();const n={id:Fe,newState:{focused:true,focusSource:em,height:0,questions:[],uid:t,width:0,x:0,y:0},oldState:{focused:false,focusSource:om,height:0,questions:[],uid:t,width:0,x:0,y:0}};return n};const cm=async t=>{const n={...t,height:45,width:150,x:100,y:100};return n};const rm=async t=>{const n=true;return zd(Fe,ls,t,sm,cm,n)};const im=()=>{const t=Ud();const n={id:Te,newState:{commands:[],height:0,uid:t,width:0,x:0,y:0},oldState:{commands:[],height:0,uid:t,width:0,x:0,y:0}};return n};const{invoke:am,setFactory:dm}=Ho(qe);const lm=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Jo(n);const{languageId:a}=i;await am("Completions.create",o,c,r,s,e,n,a);await am("Completions.loadContent",o);const d=await am("Completions.diff2",o);const l=await am("Completions.render2",o,d);return{...t,commands:l}};const um=async t=>{const n=false;return zd(Te,ss,t,im,lm,n)};const fm=()=>{const t=Ud();const n={id:De,newState:{commands:[],editorUid:0,height:0,uid:t,width:0,x:0,y:0},oldState:{commands:[],editorUid:0,height:0,uid:t,width:0,x:0,y:0}};return n};const hm=async()=>{const t="Find Widget Worker";const n="findWidgetWorkerMain.js";return _o(t,n)};const gm=9002;const mm=async()=>{if($n(gm)){return}const t=await hm();Un(gm,t)};const wm=async(t,...n)=>{const e=$n(gm);return await e.invoke(t,...n)};const pm=async()=>{const t=$n(gm);_n(gm);if(t){await t.dispose()}};const ym=t=>{const n=Jo(t);if(!n){throw new Error(`editor ${t} not found`)}const{newState:e}=n;return e};const Em=async(t,n)=>{const{uid:e}=t;const o=ym(n);const{height:s,width:c,x:r,y:i}=o;await mm();await wm("FindWidget.create",e,r,i,c,s,n);await wm("FindWidget.loadContent",e);const a=await wm("FindWidget.diff2",e);const d=await wm("FindWidget.render2",e,a);return{...t,commands:d}};const xm=(t,n)=>Em(t,n);const Im=async t=>{const n=true;return zd(De,rs,t,fm,xm,n)};const km=async t=>Im(t);const Sm=t=>{const{selections:n}=t;const e=n[0];const o=n[1];const s=md(t,e,o);const c=wd(t,e);return{columnIndex:o,rowIndex:e,x:s,y:c}};const vm=()=>{const t=Ud();const n={id:Be,newState:{commands:[],height:0,uid:t,width:0,x:0,y:0},oldState:{commands:[],height:0,uid:t,width:0,x:0,y:0}};return n};const Cm=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Jo(n);const{languageId:a}=i;await Rd("Rename.create",o,c,r,s,e,n,a);await Rd("Rename.loadContent",o);const d=await Rd("Rename.diff2",o);const l=await Rd("Rename.render2",o,d);return{...t,commands:l}};const bm=async t=>{const{columnIndex:n,rowIndex:e}=Sm(t);const{word:o}=$u(t,e,n);if(!o){return t}const s=true;return zd(Be,as,t,vm,Cm,s)};const Mm=async t=>{const n=await Ca({args:[],editor:t,event:"onLanguage",method:"ExtensionHostOrganizeImports.execute"});return n};const Am=async t=>{const n=await Mm(t);return td(t,n)};const Lm=(t,n)=>{const e=Ei(n);const o=rd(t,e,ys);return ea(t,o)};const Pm=async t=>{const n=await Ao();w(n);return Lm(t,n)};const Fm=t=>{const{redoStack:n=[]}=t;if(n.length===0){return t}const e=n.at(-1);const o={...t,redoStack:n.slice(0,-1),undoStack:[...t.undoStack,e]};return oa(o,e)};const Wm=t=>{if(!t){return`Error: ${t}`}let{message:n}=t;while(t.cause){t=t.cause;n+=`: ${t}`}return n};const Tm=t=>{if(!t){return{codeFrame:undefined,message:t,stack:undefined,type:"Error"}}const n=Wm(t);if(t.codeFrame){return{codeFrame:t.codeFrame,message:n,stack:t.stack,type:t.constructor.name}}return{category:t.category,codeFrame:t.originalCodeFrame,message:n,stack:t.originalStack,stderr:t.stderr}};const Rm=/\((.*):(\d+):(\d+)\)$/;const Dm=/at (.*):(\d+):(\d+)$/;const Om=t=>{for(const n of t){if(Rm.test(n)||Dm.test(n)){return n}}return""};const Bm=async t=>{try{const n=Ei(t.stack);const e=Om(n);let o=e.match(Rm);if(!o){o=e.match(Dm)}if(!o){return t}const s=vr(n.slice(1));const c=Wm(t);return{message:c,stack:s,type:t.constructor.name}}catch(n){console.warn("ErrorHandling Error");console.warn(n);return t}};const Nm=async t=>{if(t&&t.message&&t.codeFrame){return Tm(t)}if(t&&t.stack){return Bm(t)}return t};const Hm=t=>{if(t&&t.type&&t.message&&t.codeFrame){return`${t.type}: ${t.message}\n\n${t.codeFrame}\n\n${t.stack}`}if(t&&t.message&&t.codeFrame){return`${t.message}\n\n${t.codeFrame}\n\n${t.stack}`}if(t&&t.type&&t.message){return`${t.type}: ${t.message}\n${t.stack}`}if(t&&t.stack){return t.stack}if(t===null){return null}return String(t)};const zm=async t=>{const n=await Nm(t);const e=Hm(n);console.error(e);return n};const Um=async t=>{try{await zm(t)}catch(n){console.warn("ErrorHandling error");console.warn(n);console.error(t)}};const $m=async t=>t;const _m=t=>t.startsWith("untitled:");const Ym=async(t,n)=>{await Eo("FileSystem.writeFile",t,n)};const Vm=async t=>{const n="Save File";const{canceled:e,filePath:o}=await go("Open.showSaveDialog",n,[],t);if(e){return""}return o};const jm=async(t,n,e)=>{const o=await Vm(e);if(!o){return}await Eo("FileSystem.writeFile",o,n);await Co();await Eo("Main.handleUriChange",t,o);return o};const qm=async t=>{await Eo("ElectronDialog.showMessageBox",{buttons:["OK"],defaultId:0,detail:t.message,message:"Saving the file failed.",title:"Failed to Save File",type:"error"})};const Gm=async t=>{try{const{platform:n,uri:e}=t;const o=await $m(t);const s=Lr(o);if(_m(e)){const t=await jm(e,s,n);if(t){return{...o,modified:false,uri:t}}return o}await Ym(e,s);return{...o,modified:false}}catch(n){const e=new S(n,`Failed to save file "${t.uri}"`);await Um(e);if(t.platform===je){try{await qm(e)}catch(t){await Um(t)}}return t}};const Xm=t=>{const{lines:n}=t;const e=0;const o=0;const s=n.length-1;const c=n.at(-1).length;const r=Wi(e,o,s,c);return na(t,r)};const Zm=(t,n,e)=>{const o=Ri(t);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=ki(t,s);cl(o,s+2,c,r,n,e);ol(o,s,i,a)}return o};const Qm=(t,n)=>{const{lines:e,selections:o}=t;const s=Zm(o,e,n);return na(t,s)};const Km=t=>{Qm(t,fl)};const Jm=/[a-zA-Z\d]/;const tw=t=>Jm.test(t);const nw=t=>tw(t)||t==="_";const ew=(t,n)=>{for(let e=n-1;e>=0;e--){if(!nw(t[e])){return e+1}}return 0};const ow=(t,n)=>{for(let e=n;e<t.length;e++){if(!nw(t[e])){return e}}return t.length};const sw=(t,n,e)=>{const o=t[n];const s=ew(o,e);const c=ow(o,e);const r=o.slice(s,c);return{end:c,start:s,word:r}};const cw=(t,n,e)=>{let o=0;if(!t[n+o].endsWith(e[o])){return false}while(++o<e.length-1){if(t[n+o]!==e[o]){return false}}return t[n+o].startsWith(e[o])};const rw=(t,n)=>{if(n.length===0){throw new Error("word length must be greater than zero")}const e=[];for(let o=0;o<t.length;o++){const s=t[o];let c=-n.length;while((c=s.indexOf(n,c+n.length))!==-1){e.push(o,c,o,c+n.length)}}return new Uint32Array(e)};const iw=(t,n)=>{const e=[];for(let o=0;o<t.length-n.length+1;o){if(cw(t,o,n)){e.push(o,t[o].length-n[0].length,o+n.length-1,n.at(-1).length);o+=n.length-1}else{o++}}return new Uint32Array(e)};const aw=(t,n)=>{if(n.length<4){throw new Error("selections must have at least one entry")}const e=0;const o=n[e];const s=n[e+1];const c=n[e+2];const r=n[e+3];if(o===c){if(s===r){const e=sw(t,c,r);if(e.start===e.end){return n}const o=rw(t,e.word);return o}const e=t[o];const i=e.slice(s,r);const a=rw(t,i);return a}const i=[];i.push(t[o].slice(s));for(let n=o+1;n<c-1;n++){i.push(t[n])}i.push(t[c].slice(0,r));const a=iw(t,i);return a};const dw=t=>{const{lines:n,selections:e}=t;const o=aw(n,e);return na(t,o)};const lw=(t,n,e)=>{const o=new Uint32Array(t.length);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=ki(t,s);const d=n[i];o[s]=c;o[s+1]=r;if(a>=d.length){o[s+2]=i+1;o[s+3]=0}else{const t=e(d,a);o[s+2]=i;o[s+3]=a+t}}return o};const uw=(t,n)=>{const{lines:e}=t;const{selections:o}=t;const s=lw(o,e,n);return na(t,s)};const fw=t=>uw(t,hl);const hw=t=>Qm(t,al);const gw=t=>uw(t,ll);const mw=(t,n)=>{const e=t.length-1;const o=new Uint32Array(n.length);for(let t=0;t<n.length;t+=4){const[s,c,r,i]=ki(n,t);o[t]=s;o[t+1]=c;o[t+2]=Math.min(r+1,e);o[t+3]=i}return o};const ww=t=>{const{lines:n,selections:e}=t;const o=mw(n,e);return na(t,o)};const pw=(t,n)=>{const e=new Uint32Array(n.length);for(let o=0;o<n.length;o+=4){const[s,c,r,i]=ki(n,o);if(s===r&&c===i){const n=s;let r=c;let a=i;const d=t[n];while(r>0&&d[r]!==mr){r--}r++;while(a<d.length&&d[a]!==mr){a++}e[o]=n;e[o+1]=r;e[o+2]=n;e[o+3]=a}else{e[o]=s;e[o+1]=c;e[o+2]=r;e[o+3]=i}}return e};const yw=t=>{const{selections:n}=t;const{lines:e}=t;const o=pw(e,n);return na(t,o)};const Ew=async(t,n)=>{const e=await Eo("ExtensionHostSelection.executeGrowSelection",t,n);if(e.length===0){return n}return new Uint32Array(e)};const xw=async t=>{const{selections:n}=t;const e=await Ew(t,n);return na(t,e)};const Iw=(t,n)=>{const e=n.length-4;const o=n[e];const s=n[e+1];const c=n[e+3];const r=t[o];const i=r.slice(s,c);const a=r.indexOf(i,c);if(a!==-1){const t=a+i.length;const e=new Uint32Array(n.length+4);e.set(n,0);const s=n.length;e[s]=o;e[s+1]=a;e[s+2]=o;e[s+3]=t;return{revealRange:e.length-4,selectionEdits:e}}for(let e=o+1;e<t.length;e++){const o=t[e];const s=o.indexOf(i);if(s!==-1){const t=s+i.length;const o=new Uint32Array(n.length+4);o.set(n,0);const c=n.length;o[c]=e;o[c+1]=s;o[c+2]=e;o[c+3]=t;return{revealRange:o.length-4,selectionEdits:o}}}let d=0;for(let e=0;e<=o;e++){const o=t[e];let s=-i.length;while((s=o.indexOf(i,s+i.length))!==-1){let t=n[d];while(t<e&&d<n.length){d+=4;t=n[d]}if(t===e){let t=n[d+3];while(t<s&&d<n.length){d+=4;t=n[t+3]}}t=n[d];const o=n[d+1];const c=n[d+3];const r=t===e&&o<=s&&s<=c;if(!r){if(t>e){d-=4}const o=s+i.length;d+=4;const c=new Uint32Array(n.length+4);c.set(n.subarray(0,d),0);c[d]=e;c[d+1]=s;c[d+2]=e;c[d+3]=o;c.set(n.subarray(d),d+4);return{revealRange:c.length-4,selectionEdits:c}}}}return undefined};const kw=t=>{const{lines:n}=t;const{selections:e}=t;if(Ui(e)){const t=new Uint32Array(e.length);for(let o=0;o<e.length;o+=4){const[s,c,r,i]=ki(e,o);const a=sw(n,s,c);t[o]=s;if(a.start===a.end){t[o+1]=c;t[o+2]=r;t[o+3]=i}else{t[o+1]=a.start;t[o+2]=s;t[o+3]=a.end}}return{revealRange:t.length-4,selectionEdits:t}}if($i(t.selections)){return Iw(t.lines,t.selections)}return undefined};const Sw=(t,n,e,o)=>e>=t&&o<=n;const vw=t=>{const n=kw(t);if(!n){return t}const{revealRange:e,selectionEdits:o}=n;const s=o[e];const c=o[e+2];if(Sw(t.minLineY,t.maxLineY,s,c)){return na(t,o)}return ea(t,[],o)};const Cw=t=>t;const bw=(t,n)=>{const e=new Uint32Array(n.length);for(let t=0;t<n.length;t+=4){const[o,s,c,r]=ki(n,t);e[t]=Math.max(o-1,0);e[t+1]=s;e[t+2]=c;e[t+3]=r}return e};const Mw=t=>{const{lines:n,selections:e}=t;const o=bw(n,e);return na(t,o)};const Aw=t=>Qm(t,Il);const Lw=t=>uw(t,Cl);const Pw=(t,n,e)=>{if(t.decorations.length===0&&n.length===0){return t}return{...t,decorations:n,diagnostics:e}};const Fw=async(t,n,e)=>{const{tokenizerId:o}=t;Xc(n,e);await er(n,e);const s=or(n);const c=o+1;cr(c,s);const r=ym(t.uid);if(!r){return t}const i=Kr();const{differences:a,textInfos:d}=await Yr(t,i);const l=ym(t.uid);if(!l){return t}const u={...l,differences:a,focused:true,textInfos:d};return{...u,invalidStartIndex:0,languageId:n,tokenizerId:c}};const Ww=(t,n)=>{const{maxLineY:e,minLineY:o,rowHeight:s}=t;const c=n[0];if(c<o){const e=c*s;return{...t,deltaY:e,maxLineY:c+1,minLineY:c,selections:n}}if(c>e){const e=c*s;return{...t,deltaY:e,maxLineY:c+1,minLineY:c,selections:n}}return{...t,selections:n}};const Tw=(t,n)=>{w(n);const e=t.lines.length-1;const o=t.lines.at(-1).length;const s={columnIndex:0,rowIndex:0};const c={columnIndex:o,rowIndex:e};const r=[{deleted:Pr(t,{end:c,start:s}),end:c,inserted:Ei(n),origin:xs,start:s}];return ea(t,r)};const Rw=()=>{const t=Ud();const n={id:Oe,newState:{commands:[],content:"",diagnostics:[],documentation:"",editorUid:0,height:0,lineInfos:[],uid:t,width:0,x:0,y:0},oldState:{commands:[],content:"",diagnostics:[],documentation:"",editorUid:0,height:0,lineInfos:[],uid:t,width:0,x:0,y:0}};return n};const Dw=async()=>{const t="Hover Worker";const n="hoverWorkerMain.js";const e="Hover.initialize";const o=await _o(t,n,e);return o};const Ow={};const Bw=()=>{if(!Ow.workerPromise){Ow.workerPromise=Dw()}return Ow.workerPromise};const Nw=async(t,...n)=>{const e=await Bw();return await e.invoke(t,...n)};const Hw=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Jo(n);const{languageId:a}=i;await Nw("Hover.create",o,c,r,s,e,n,a);await Nw("Hover.loadContent",o);const d=await Nw("Hover.diff2",o);const l=await Nw("Hover.render2",o,d);return{...t,commands:l}};const zw=async t=>{const n=false;return zd(Oe,is,t,Rw,Hw,n)};const Uw="EditorHover";const $w=async t=>{await Eo("Viewlet.openWidget",Uw);return t};const _w=()=>{const t=Ud();const n={id:Ne,newState:{commands:[],focusedIndex:0,height:0,maxHeight:0,sourceActions:[],uid:t,width:0,x:0,y:0},oldState:{commands:[],focusedIndex:0,height:0,maxHeight:0,sourceActions:[],uid:t,width:0,x:0,y:0}};return n};const Yw=async()=>{const t="Source Action Worker";const n="sourceActionWorkerMain.js";const e="SourceActions.initialize";const o=await _o(t,n,e);return o};const Vw={};const jw=()=>{if(!Vw.workerPromise){Vw.workerPromise=Yw()}return Vw.workerPromise};const qw=async(t,...n)=>{const e=await jw();return await e.invoke(t,...n)};const Gw=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Jo(n);const{languageId:a}=i;await qw("SourceActions.create",o,c,r,s,e,n,a);await qw("SourceActions.loadContent",o);const d=await qw("SourceActions.diff2",o);const l=await qw("SourceActions.render2",o,d);return{...t,commands:l}};const Xw=async t=>zd(Ne,ds,t,_w,Gw);const Zw=(t,n)=>t.localeCompare(n);const Qw=t=>{const n=[...t];n.sort(Zw);return n};const Kw="sort-lines-ascending";const Jw=(t,n)=>{const e=n[0];const o=n[2];const s=[];for(let c=0;c<n.length;c+=4){const r=n[c];const i=n[c+1];const a=n[c+2];const d=n[c+3];const l={columnIndex:i,rowIndex:r};const u={columnIndex:d,rowIndex:a};const f={end:u,start:l};const h=t.slice(e,o+1);const g=Qw(h);s.push({deleted:Pr({lines:t},f),end:u,inserted:g,origin:Kw,start:l})}return s};const tp=t=>{const{lines:n,selections:e}=t;const o=Jw(n,e);return ea(t,o)};const np=async(t,n)=>Ca({args:[n],editor:t,event:va,method:la,noProviderFoundMessage:"No tab completion provider found",noProviderFoundResult:undefined});const ep=t=>{const{selections:n}=t;const e=n[0];const o=n[1];const s=Wr(t,e,o);return s};const op=async t=>{const n=ep(t);const e=await np(t,n);return e};const sp=(t,n,e)=>{const o=Ei(e.inserted);const s=[];const c=[];for(let r=0;r<n.length;r+=4){const[i,a,d,l]=ki(n,r);if(o.length>1){const n=Ar({lines:t},i);const r=br(n);const u=[o[0],...o.slice(1).map(t=>r+t)];const f=[""];s.push({deleted:f,end:{columnIndex:l,rowIndex:d},inserted:u,origin:Es,start:{columnIndex:a-e.deleted,rowIndex:i}});const h=o.at(-1);c.push(d+o.length-f.length,l+h.length,d+o.length-f.length,l+h.length)}else{const t=o[0];const n=t.indexOf("$0");if(n===-1){const t=a-e.deleted;c.push(i,t,i,t);s.push({deleted:[""],end:{columnIndex:l,rowIndex:d},inserted:o,origin:Es,start:{columnIndex:a-e.deleted,rowIndex:i}})}else{const n=t.replace("$0","");const o=l+2;c.push(i,o,i,o);s.push({deleted:[""],end:{columnIndex:l,rowIndex:d},inserted:[n],origin:Es,start:{columnIndex:a-e.deleted,rowIndex:i}})}}}return{changes:s,selectionChanges:new Uint32Array(c)}};const cp=(t,n)=>{const{lines:e,selections:o}=t;const{changes:s,selectionChanges:c}=sp(e,o,n);return ea(t,s,c)};const rp=String;const ip=async t=>{try{const n=await op(t);if(!n){return t}return cp(t,n)}catch(n){await Um(n);const e=t.selections[0];const o=t.selections[1];return Ed(t,e,o,rp(n))}};const ap=async(t,n)=>{const{assetDir:e,platform:o}=t;try{await zo(`onLanguage:${t.languageId}`,e,o);const s=await fa(`ExtensionHostCommment.execute`,t.uid,n);if(s){return s}}catch{}const s=await Qg(t);if(!s?.comments?.blockComment){return undefined}return s.comments.blockComment};const dp=/^\s+/;const lp=/\s+$/;const up=(t,n,e)=>({deleted:[e],end:{columnIndex:n+e.length,rowIndex:t},inserted:[],origin:As,start:{columnIndex:n,rowIndex:t}});const fp=(t,n,e,o,s,c,r)=>{if(n===o){return[up(t,e,c),up(t,s-c.length,r)]}return[up(n,e,c),up(o,s,r)]};const hp=(t,n)=>{const{selections:e}=t;const[o]=e;const s=Ar(t,o);const c=t.lines.length;let r=o;let i=-1;const a=n[0];const d=n[1];while(r<c){const n=Ar(t,r);i=n.indexOf(d);if(i!==-1){break}r++}let l=-1;let u=o;while(u>=0){const n=Ar(t,u);l=n.indexOf(a);if(l!==-1){break}u--}const f=[];if(l!==-1&&i!==-1){f.push(...fp(o,u,l,r,i,a,d))}else{const t=s.match(dp);const n=s.match(lp);let e=0;let c=s.length;if(t){e+=t[0].length}if(n){c-=n[0].length}const r={deleted:[],end:{columnIndex:e,rowIndex:o},inserted:[a],origin:As,start:{columnIndex:e,rowIndex:o}};const i={deleted:[],end:{columnIndex:c+a.length,rowIndex:o},inserted:[d],origin:As,start:{columnIndex:c+a.length,rowIndex:o}};f.push(r,i)}return f};const gp=async t=>{const n=ep(t);const e=await ap(t,n);if(!e){return t}const o=hp(t,e);return sa(t,o)};const mp=async t=>{const n=await Qg(t);if(!n?.comments?.lineComment){return undefined}return n.comments.lineComment};const wp=/^\s+/;const pp=(t,n,e)=>{const o=n.match(wp);const s=o?o[0].length:0;if(n.slice(s).startsWith(e)){if(n[s+e.length]===" "){return{deleted:[e+" "],end:{columnIndex:s+e.length+1,rowIndex:t},inserted:[""],origin:bs,start:{columnIndex:s,rowIndex:t}}}return{deleted:[e],end:{columnIndex:s+e.length,rowIndex:t},inserted:[""],origin:bs,start:{columnIndex:s,rowIndex:t}}}return{deleted:[],end:{columnIndex:s,rowIndex:t},inserted:[`${e} `],origin:bs,start:{columnIndex:s,rowIndex:t}}};const yp=async t=>{const n=await mp(t);if(!n){return t}const e=t;const o=t.selections[0];const s=Ar(e,o);const c=[pp(o,s,n)];return ea(t,c)};const Ep=async t=>{try{const n=await yp(t);if(t!==n){return n}return gp(t)}catch(n){Ja(n);await yd(t,0,0,String(n),true);return t}};const xp=async(t,n)=>{const e=rd(t,[n],xs);const o=await ea(t,e);if(o.completionsOnType){const t=await um(o);return t}return o};const Ip="/";const kp="{";const Sp="}";const vp="(";const Cp=")";const bp="[";const Mp="]";const Ap="???";const Lp="'";const Pp='"';const Fp="`";const Wp=t=>{switch(t){case kp:return Sp;case vp:return Cp;case bp:return Mp;default:return Ap}};const Tp=(t,n)=>{const e=Wp(n);const o=n+e;const s=rd(t,[o],Is);const c=new Uint32Array([s[0].start.rowIndex,s[0].start.columnIndex+1,s[0].end.rowIndex,s[0].end.columnIndex+1]);return ea(t,s,c)};const Rp=t=>{const{selections:n}=t;const e=new Uint32Array([n[0],n[1]+1,n[2],n[3]+1]);return na(t,e)};const Dp=(t,n)=>{const{autoClosingRanges:e=[],selections:o}=t;if(Eu(e,o)){return Rp(t)}return xp(t,n)};const Op=(t,n)=>{const e=n+n;const o=rd(t,[e],Is);const s=new Uint32Array([o[0].start.rowIndex,o[0].start.columnIndex+1,o[0].end.rowIndex,o[0].end.columnIndex+1]);return ea(t,o,s)};const Bp=async(t,n)=>{const e=Wr(t,t.selections[0],t.selections[1]);const o=await Eo("ExtensionHostClosingTagCompletion.executeClosingTagProvider",t,e,n);if(!o){const e=rd(t,[n],xs);return ea(t,e)}const s=rd(t,[o.inserted],xs);return ea(t,s)};const Np=async(t,n)=>{const{isAutoClosingBracketsEnabled:e,isAutoClosingQuotesEnabled:o,isAutoClosingTagsEnabled:s}=t;switch(n){case Ip:if(s){return Bp(t,n)}break;case Sp:case Cp:case Mp:if(e){return Dp(t,n)}break;case kp:case vp:case bp:if(e){return Tp(t,n)}break;case Fp:case Pp:case Lp:if(o){return Op(t,n)}break}const c=xp(t,n);return c};const Hp=t=>{const n=t.end.columnIndex-t.deleted[0].length+t.inserted[0].length;return{deleted:t.inserted,end:{columnIndex:n,rowIndex:t.end.rowIndex},inserted:t.deleted,start:t.start}};const zp=t=>{const{undoStack:n}=t;if(n.length===0){return t}const e=n.at(-1);const o=e.map(Hp);const s={...t,redoStack:[...t.redoStack||[],e],undoStack:n.slice(0,-1)};return oa(s,o)};const Up=t=>t;const $p=t=>{switch(t){case We:case Te:case De:case Oe:case Be:case Ne:return true;default:return false}};const _p=(t,n,e)=>{const o=e(t);const{uid:s}=t.newState;const c=[];c.push(["Viewlet.createFunctionalRoot",n,s,$p(t.id)]);c.push(...o);if($p(t.id)){c.push(["Viewlet.appendToBody",s])}else{c.push(["Viewlet.send",s,"appendWidget"])}const r=c.findIndex(t=>t[2]==="focus"||t[0]==="Viewlet.focusSelector");if(r!==-1){const t=c[r];c.splice(r,1);c.push(t)}return c};const Yp=t=>{switch(t){case We:return qo;case Te:return am;case De:return wm;case Oe:return Nw;case Be:return Rd;case Ne:return qw;default:return undefined}};const Vp="Close";const jp=(t,n,e)=>{const o=t=>t.id===n;const s=t.widgets.findIndex(o);if(s===-1){return t}const c=t.widgets[s];const r={...c,newState:e,oldState:c.newState};const i=[...t.widgets.slice(0,s),r,...t.widgets.slice(s+1)];return{...t,widgets:i}};const qp=(t,n)=>{for(const e of ts()){const o=Jo(Number(e)).newState;const s=o.widgets||[];for(const e of s){if(e.id===n&&e.newState.uid===t){return o}}}return undefined};const Gp=(t,n)=>{if(t&&t.widgets){return t}const e=Jo(t);if(e&&e.newState&&e.newState.widgets){return e.newState}return qp(t,n)};const Xp=(t,n,e)=>{const o=t=>t.id===e;const s=n=>t==="close"||t==="handleClickButton"&&n.includes(Vp);const c=async(c,...r)=>{const i=Gp(c,e);if(!i){return c}const a=i.widgets.findIndex(o);if(a===-1){return i}const d=i.widgets[a];const l=d.newState;const{uid:u}=l;const f=Yp(e);await f(`${n}.${t}`,u,...r);const h=await f(`${n}.diff2`,u);const g=await f(`${n}.render2`,u,h);const m=Jo(i.uid).newState;if(s(r)){const t={...m,focused:true,widgets:bd(m.widgets,e)};ns(i.uid,m,t);return t}const w={...l,commands:g};const p=jp(m,e,w);ns(i.uid,m,p);return p};return c};const Zp=(t,n,e)=>{const o=Object.create(null);for(const s of t){o[s]=Xp(s,n,e)}return o};const Qp="Viewlet.appendToBody";const Kp="focus";const Jp="Viewlet.registerEventListeners";const ty="Viewlet.setSelectionByName";const ny="Viewlet.setValueByName";const ey="Viewlet.setFocusContext";const oy="setBounds";const sy="Viewlet.setBounds";const cy="Viewlet.setCss";const ry="Viewlet.setDom2";const iy="Viewlet.setUid";const ay=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const dy=[ry,cy,Qp,sy,Jp,ty,ny,ey,iy,"Viewlet.focusSelector"];const ly=t=>{const n=ay(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(dy.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const uy=t=>_p(t,"EditorCompletion",ly);const fy=t=>[["Viewlet.dispose",t.newState.uid]];const{close:hy,closeDetails:gy,focusFirst:my,focusIndex:wy,focusLast:py,focusNext:yy,focusPrevious:Ey,handleEditorBlur:xy,handleEditorClick:Iy,handleEditorDeleteLeft:ky,handleEditorType:Sy,handlePointerDown:vy,handleWheel:Cy,openDetails:by,selectCurrent:My,selectIndex:Ay,toggleDetails:Ly}=Zp(["handleEditorType","focusFirst","focusNext","focusPrevious","focusLast","handleEditorDeleteLeft","openDetails","focusIndex","handleEditorBlur","handleEditorClick","openDetails","selectCurrent","selectIndex","toggleDetails","closeDetails","handleWheel","close","handlePointerDown"],"Completions",Te);const Py={__proto__:null,add:uy,close:hy,closeDetails:gy,focusFirst:my,focusIndex:wy,focusLast:py,focusNext:yy,focusPrevious:Ey,handleEditorBlur:xy,handleEditorClick:Iy,handleEditorDeleteLeft:ky,handleEditorType:Sy,handlePointerDown:vy,handleWheel:Cy,openDetails:by,remove:fy,render:ly,selectCurrent:My,selectIndex:Ay,toggleDetails:Ly};const Fy=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const Wy=[ry,cy,Qp,sy,Jp,ty,ny,ey,iy,"Viewlet.focusSelector"];const Ty=t=>{const n=Fy(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(Wy.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const Ry=t=>_p(t,"FindWidget",Ty);const Dy=t=>[["Viewlet.dispose",t.newState.uid]];const{close:Oy,focusCloseButton:By,focusFind:Ny,focusNext:Hy,focusNextElement:zy,focusNextMatchButton:Uy,focusPrevious:$y,focusPreviousElement:_y,focusPreviousMatchButton:Yy,focusReplace:Vy,focusReplaceAllButton:jy,focusReplaceButton:qy,focusToggleReplace:Gy,handleBlur:Xy,handleClickButton:Zy,handleFocus:Qy,handleInput:Ky,handleReplaceFocus:Jy,handleReplaceInput:tE,handleToggleReplaceFocus:nE,replace:eE,replaceAll:oE,toggleMatchCase:sE,toggleMatchWholeWord:cE,togglePreserveCase:rE,toggleReplace:iE,toggleUseRegularExpression:aE}=Zp(["close","focusCloseButton","focusFind","focusNext","focusNextMatchButton","focusPrevious","focusPreviousMatchButton","focusReplace","focusReplaceAllButton","focusReplaceButton","focusToggleReplace","handleBlur","handleClickButton","handleFocus","handleInput","handleReplaceFocus","handleReplaceInput","handleToggleReplaceFocus","replace","replaceAll","toggleMatchCase","toggleMatchWholeWord","toggleReplace","toggleUseRegularExpression","focusNextElement","focusPreviousElement","togglePreserveCase"],"FindWidget",De);const dE={__proto__:null,add:Ry,close:Oy,focusCloseButton:By,focusFind:Ny,focusNext:Hy,focusNextElement:zy,focusNextMatchButton:Uy,focusPrevious:$y,focusPreviousElement:_y,focusPreviousMatchButton:Yy,focusReplace:Vy,focusReplaceAllButton:jy,focusReplaceButton:qy,focusToggleReplace:Gy,handleBlur:Xy,handleClickButton:Zy,handleFocus:Qy,handleInput:Ky,handleReplaceFocus:Jy,handleReplaceInput:tE,handleToggleReplaceFocus:nE,remove:Dy,render:Ty,replace:eE,replaceAll:oE,toggleMatchCase:sE,toggleMatchWholeWord:cE,togglePreserveCase:rE,toggleReplace:iE,toggleUseRegularExpression:aE};const lE=t=>({documentId:t.id||t.uid,languageId:t.languageId,text:Lr(t),uri:t.uri});const uE=async(t,n)=>{const e=lE(t);return uo("Extensions.executeHoverProvider",e,n)};const fE=async(t,n)=>{h(t);g(n);const e=await uE(t,n);if(e){return e}return Ca({args:[n],editor:t,event:Sa,method:da,noProviderFoundMessage:"No hover provider found"})};const hE=async(t,n)=>{h(t);g(n);const e=await fE(t,n);return e};const gE=async(t,n,e,o,s)=>100;const mE=(t,n,e)=>{const o=n.length;let s=0;let c=0;const r=[];for(let i=0;i<o;i+=2){const o=n[i];const a=n[i+1];s+=a;const d=t.slice(c,s);const l=`Token ${e[o]||"Unknown"}`;const u=d;r.push(u,l);c=s}return r};const wE=(t,n,e)=>{const o=[];const{hasArrayReturn:s,initialLineState:c,tokenizeLine:r,TokenMap:i}=n;let a=Ac(c);for(const n of t){const t=Wc(e,r,n,a,s);const{tokens:c}=t;const d=mE(n,c,i);o.push(d);a=t}console.error({lineInfos:o});return o};const pE=async(t,n,e)=>{await er(n,e);const o=or(n);const s=Ei(t);const c=wE(s,o,n);return c};const yE=(t,n)=>{if(t){return t}const e=n[0];const o=n[1];return{columnIndex:o,rowIndex:e}};const EE=(t,n,e)=>{const o=[];for(const e of t){if(e.rowIndex===n){o.push(e)}}return o};const xE="typescript";const IE=(t,n,e,o)=>{const s=md(t,n,e);const c=t.height-wd(t,n)+t.y+40;return{x:s,y:c}};const kE=async(t,n)=>{g(t);const e=Jo(t);const o=e.newState;const{selections:s}=o;const{columnIndex:c,rowIndex:r}=yE(n,s);const i=Wr(o,r,c);const a=await hE(o,i);if(!a){return undefined}const{displayString:d,displayStringLanguageId:l,documentation:u}=a;const f="";const h=await pE(d,l||xE,f);const m=_u(o,r,c);const w=c-m.length;await gE();const{x:p,y:y}=IE(o,r,w);const E=o.diagnostics||[];const x=EE(E,r);return{documentation:u,lineInfos:h,matchingDiagnostics:x,x:p,y:y}};const SE=async(t,n,e)=>{const o=await kE(t,e);if(!o){return n}const{documentation:s,lineInfos:c,matchingDiagnostics:r,x:i,y:a}=o;return{...n,diagnostics:r,documentation:s,lineInfos:c,x:i,y:a}};const vE=(t,n,e)=>t;const CE=(t,n,e)=>{const{x:o}=t;const s=100;const c=Math.max(n-o,s);return{...t,resizedWidth:c}};const bE=(t,n,e)=>t;const ME="CodeGeneratorInput";const AE="CodeGeneratorMessage";const LE="CodeGeneratorWidget";const PE="DiagnosticError";const FE="DiagnosticWarning";const WE="CompletionDetailCloseButton";const TE="CompletionDetailContent";const RE="Diagnostic";const DE="EditorCursor";const OE="EditorRow";const BE="EditorRowHighlighted";const NE="EditorSelection";const HE="HoverDisplayString";const zE="HoverDocumentation";const UE="HoverEditorRow";const $E="HoverProblem";const _E="HoverProblemDetail";const YE="HoverProblemMessage";const VE="IconClose";const jE="InputBox";const qE="MaskIcon";const GE="Viewlet";const XE=1;const ZE=2;const QE=9;const KE=10;const JE=11;const tx=12;const nx=13;const ex=14;const ox=15;const sx=18;const cx=19;const rx=20;const ix=21;const ax=22;const dx=23;const lx=26;const ux=27;const fx=28;const hx=29;const gx=30;const mx=31;const wx=32;const px=33;const yx=4;const Ex=6;const xx=8;const Ix=12;const kx=62;const Sx=t=>({childCount:0,text:t,type:Ix});const vx=t=>{const n=[{childCount:t.length/2,className:UE,type:yx}];for(let e=0;e<t.length;e+=2){const o=t[e];const s=t[e+1];n.push({childCount:1,className:s,type:xx},Sx(o))}return n};const Cx=t=>{const n=t.flatMap(vx);return n};const bx={childCount:1,className:YE,type:xx};const Mx={childCount:1,className:_E,type:xx};const Ax=(t,n,e)=>{const o=n?1:0;const s=e&&e.length>0?1:0;return t.length+o+s};const Lx=(t,n,e)=>{const o=[];o.push({childCount:Ax(t,n,e)+1,className:"Viewlet EditorHover",type:yx});if(e&&e.length>0){o.push({childCount:e.length*2,className:`${HE} ${$E}`,type:yx});for(const t of e){o.push(bx,Sx(t.message),Mx,Sx(`${t.source} (${t.code})`))}}if(t.length>0){const n=Cx(t);o.push({childCount:t.length,className:HE,type:yx},...n)}if(n){o.push({childCount:1,className:zE,type:yx},Sx(n))}o.push({childCount:0,className:"Sash SashVertical SashResize",onPointerDown:lx,type:yx});return o};const Px={apply(t,n){const e=Lx(n.lineInfos,n.documentation,n.diagnostics);return[ry,e]},isEqual:(t,n)=>t.lineInfos===n.lineInfos&&t.documentation===n.documentation&&t.diagnostics===n.diagnostics};const Fx={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[oy,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y};const Wx=[Px,Fx];const Tx=(t,n)=>{const e=[];for(const o of Wx){if(!o.isEqual(t,n)){e.push(o.apply(t,n))}}return e};const Rx=[ry,cy,Qp,sy,Jp,ty,ny,ey,iy,"Viewlet.focusSelector"];const Dx=t=>{const n=ay(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(Rx.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const Ox=t=>_p(t,"EditorRename",Dx);const Bx=t=>[["Viewlet.dispose",t.newState.uid]];const{accept:Nx,close:Hx,handleInput:zx}=Zp(["handleInput","close","accept"],"Rename",Be);const Ux={__proto__:null,accept:Nx,add:Ox,close:Hx,handleInput:zx,remove:Bx,render:Dx};const $x=t=>structuredClone(t);const _x=(t,n)=>{const e={...t,focusedIndex:n};return e};const Yx=t=>{const n=t.focusedIndex+1;return _x(t,n)};const Vx=t=>[["Viewlet.send",t.newState.uid,"dispose"]];const jx=[ry,cy,Qp,sy,Jp,ty,ny,ey,iy,"Viewlet.focusSelector"];const qx=t=>{const n=ay(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(jx.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const Gx=t=>_p(t,"EditorSourceActions",qx);const Xx=Vx;const{close:Zx,closeDetails:Qx,focusFirst:Kx,focusIndex:Jx,focusLast:tI,focusNext:nI,focusPrevious:eI,handleWheel:oI,selectCurrent:sI,selectIndex:cI,selectItem:rI,toggleDetails:iI}=Zp(["focusFirst","focusIndex","focusLast","focusNext","focusPrevious","selectCurrent","selectIndex","selectItem","toggleDetails","closeDetails","handleWheel","close"],"SourceActions",Ne);const aI={__proto__:null,add:Gx,close:Zx,closeDetails:Qx,focusFirst:Kx,focusIndex:Jx,focusLast:tI,focusNext:nI,focusPrevious:eI,handleWheel:oI,remove:Xx,render:qx,selectCurrent:sI,selectIndex:cI,selectItem:rI,toggleDetails:iI};const dI=async(t,n,e,o,s,...c)=>{const r=Yp(s);const i=e.slice(n.length+1);const a=t.widgets.find(t=>t.id===s);if(!a){return t}const{uid:d}=a.newState;g(d);await r(`${n}.${i}`,d,...c);const l=t=>t.id===s;const u=ym(t.uid);const f=u.widgets.findIndex(l);if(f===-1){return u}const h=await r(`${n}.diff2`,d);const m=await r(`${n}.render2`,d,h);const w=t.widgets.findIndex(l);if(w===-1){return u}const p=u.widgets[w];const y={...p.newState,commands:m};const E=jp(u,s,y);return E};const lI=(t,n)=>t.filter(t=>t.languageId===n);const uI=async t=>{if(!t){return[]}const{newState:n}=Jo(t);const{languageId:e}=n;const o=await Eo("GetEditorSourceActions.getEditorSourceActions");const s=lI(o,e);return s};const fI=/[\w\-]+$/;const hI=t=>{const{lines:n,selections:e}=t;const o=e[0];const s=e[1];const c=n[o];const r=c.slice(0,s);const i=r.match(fI);if(i){return i[0]}return""};const gI=async t=>{await Eo("Focus.setFocus",t)};const mI=async t=>{if(!t){return}await Eo("Focus.removeAdditionalFocus",t)};const wI=12;const pI=9;const yI=11;const EI=12;const xI=16;const II=38;const kI=43;const SI=46;const vI=47;const CI=48;const bI=49;const MI=50;const AI=52;const LI=t=>{const n=ym(t);return Sm(n)};const PI=t=>{const n=ym(t);return n.uri};const FI=t=>{const n=ym(t);return n.languageId};const WI=t=>{const n=ym(t);return ep(n)};const TI=(t,n,e)=>{const o=ym(t);const{word:s}=$u(o,n,e);return s};const RI=t=>{const n=ym(t);const e=hI(n);return e};const DI=(t,n,e)=>{const o=ym(t);const s=_u(o,n,e);return s};const OI=t=>{const n=ym(t);const{lines:e}=n;return e};const BI=t=>{const n=ym(t);const{selections:e}=n;return e};const NI=async(t,n)=>{const e=ym(t);const o={...e,selections:n};const s=await pg(e,o);ns(t,e,s)};const HI=async(t,n,e,o)=>{const s=ym(t);const c=Yp(n);const{widgets:r}=s;const i=r.findIndex(t=>t.id===n);if(i===-1){return}await c(`${e}.dispose`);const a=[...r.slice(0,i),...r.slice(i+1)];const d={...s,focused:true,widgets:a};const l=await pg(s,d);ns(t,s,l);await gI(EI);if(o){await mI(o)}};const zI=async t=>{await HI(t,De,"FindWidget",0)};const UI=async(t,n)=>{const e=ym(t);const o=await nd(e,n);const s=await pg(e,o);ns(t,e,s)};const $I=async t=>{const n=await uI(t);return n};const _I=async t=>{const n=ym(t);const{diagnostics:e}=n;return e};const YI=async(t,n)=>{await po("TextMeasurement.ensureFont",t,n)};const VI=()=>[{command:"Editor.closeSourceAction",key:ee,when:II},{command:"EditorSourceActions.focusNext",key:de,when:II},{command:"EditorSourceActions.focusPrevious",key:ie,when:II},{command:"EditorSourceActions.focusFirst",key:ce,when:II},{command:"EditorSourceActions.focusLast",key:se,when:II},{command:"EditorSourceActions.selectCurrent",key:ne,when:II},{command:"FindWidget.focusNext",key:ne,when:xI},{command:"FindWidget.preventDefaultBrowserFind",key:He|ge,when:xI},{command:"FindWidget.focusPrevious",key:ze|Ce,when:xI},{command:"FindWidget.focusNext",key:Ce,when:xI},{command:"FindWidget.focusToggleReplace",key:ze|te,when:xI},{command:"FindWidget.focusReplace",key:te,when:xI},{command:"FindWidget.focusPreviousMatchButton",key:te,when:kI},{command:"FindWidget.replaceAll",key:Ue|He|ne,when:kI},{command:"FindWidget.focusNextMatchButton",key:te,when:MI},{command:"FindWidget.focusReplace",key:ze|te,when:MI},{command:"FindWidget.focusPreviousMatchButton",key:ze|te,when:bI},{command:"FindWidget.focusCloseButton",key:te,when:bI},{command:"FindWidget.focusNextMatchButton",key:ze|te,when:CI},{command:"FindWidget.focusReplaceButton",key:te,when:CI},{command:"FindWidget.focusFind",key:ze|te,when:kI},{command:"FindWidget.focusReplaceAllButton",key:te,when:SI},{command:"FindWidget.focusCloseButton",key:ze|te,when:SI},{command:"FindWidget.focusReplaceButton",key:ze|te,when:vI},{command:"EditorCompletion.focusNext",key:de,when:pI},{command:"EditorCompletion.focusPrevious",key:ie,when:pI},{command:"EditorCompletion.selectCurrent",key:ne,when:pI},{command:"EditorCompletion.close",key:ee,when:pI},{command:"EditorCompletion.focusLast",key:se,when:pI},{command:"EditorCompletion.focusFirst",key:ce,when:pI},{command:"EditorCompletion.toggleDetails",key:He|oe,when:pI},{command:"Editor.cursorWordRight",key:He|ae,when:EI},{command:"Editor.cursorWordLeft",key:He|re,when:EI},{command:"Editor.deleteWordPartLeft",key:Ue|Jn,when:EI},{command:"Editor.deleteWordPartRight",key:Ue|le,when:EI},{command:"Editor.deleteWordLeft",key:He|Jn,when:EI},{command:"Editor.deleteWordRight",key:He|le,when:EI},{command:"Editor.selectNextOccurrence",key:He|he,when:EI},{command:"Editor.openColorPicker",key:He|we,when:EI},{command:"Editor.showSourceActions3",key:He|Me,when:EI},{command:"Editor.handleTab",key:te,when:EI},{command:"Editor.unindent",key:ze|te,when:EI},{command:"Editor.indentLess",key:He|Le,when:EI},{command:"Editor.closeFind",key:ee,when:xI},{command:"Editor.openFind2",key:He|ge,when:EI},{command:"Editor.openCodeGenerator",key:He|pe,when:EI},{command:"Editor.closeCodeGenerator",key:ee,when:AI},{command:"EditorCodeGenerator.accept",key:ne,when:AI},{command:"Editor.indentMore",key:He|Pe,when:EI},{command:"Editor.selectCharacterLeft",key:ze|re,when:EI},{command:"Editor.selectWordLeft",key:He|ze|re,when:EI},{command:"Editor.selectCharacterRight",key:ze|ae,when:EI},{command:"Editor.selectWordRight",key:He|ze|ae,when:EI},{command:"Editor.selectLine",key:He|ye,when:EI},{command:"Editor.deleteAllLeft",key:He|ze|Jn,when:EI},{command:"Editor.deleteAllRight",key:He|ze|le,when:EI},{command:"Editor.cancelSelection",key:ee,when:EI},{command:"Editor.undo",key:He|ke,when:EI},{command:"Editor.cursorLeft",key:re,when:EI},{command:"Editor.cursorRight",key:ae,when:EI},{command:"Editor.cursorUp",key:ie,when:EI},{command:"Editor.cursorDown",key:de,when:EI},{command:"Editor.deleteLeft",key:Jn,when:EI},{command:"Editor.deleteRight",key:le,when:EI},{command:"Editor.insertLineBreak",key:ne,when:EI},{command:"Editor.copyLineDown",key:He|ze|he,when:EI},{command:"Editor.moveLineDown",key:He|ze|de,when:EI},{command:"Editor.moveLineUp",key:He|ze|ie,when:EI},{command:"Editor.openCompletion",key:He|oe,when:EI},{command:"Editor.openRename",key:Se,when:EI},{command:"EditorRename.accept",key:ne,when:yI},{command:"Editor.closeRename",key:ee,when:yI},{command:"Editor.cursorHome",key:ce,when:EI},{command:"Editor.cursorEnd",key:se,when:EI},{command:"Editor.toggleComment",key:He|Ae,when:EI},{command:"Editor.copy",key:He|fe,when:EI},{command:"Editor.selectAll",key:He|ue,when:EI},{command:"Editor.showHover2",key:He|me,when:EI},{command:"Editor.cut",key:He|Ie,when:EI},{command:"Editor.paste",key:He|xe,when:EI},{command:"Editor.cursorWordPartLeft",key:Ue|re,when:EI},{command:"Editor.cursorWordPartRight",key:Ue|ae,when:EI},{command:"Editor.selectAllOccurrences",key:Ue|ve,when:EI},{command:"Editor.addCursorAbove",key:Ue|ze|ie,when:EI},{command:"Editor.addCursorBelow",key:Ue|ze|de,when:EI},{command:"Editor.findAllReferences",key:Ue|ze|be,when:EI},{command:"Editor.organizeImports",key:Ue|ze|Ee,when:EI},{command:"Editor.selectionGrow",key:He|ze|oe,when:wI}];const jI=()=>ts();const qI={CommandPalette:"Command Palette"};const GI=()=>qu(qI.CommandPalette);const XI={command:"",flags:Ye,id:"separator",label:""};const ZI=()=>[{command:"Editor.goToDefinition",flags:Ve,id:"go-to-definition",label:Pf()},{command:"Editor.goToTypeDefinition",flags:Ve,id:"go-to-type-definition",label:Nf()},XI,{args:["References",true],command:"SideBar.show",flags:Ve,id:"find-all-references",label:Hf()},{args:["Implementations",true],command:"SideBar.show",flags:Ve,id:"find-all-implementations",label:zf()},XI,{command:"Editor.format",flags:Ve,id:"format",label:qf()},{command:"Editor.showSourceActions2",flags:Ve,id:_e,label:Df()},XI,{command:"Editor.cut",flags:Ve,id:"cut",label:Uf()},{command:"Editor.copy",flags:Ve,id:"copy",label:$f()},{command:"Editor.paste",flags:Ve,id:"paste",label:_f()},XI,{command:"QuickPick.showEverything",flags:Ve,id:"commandPalette",label:GI()}];const QI=()=>[$e];const KI=t=>Aa(t);const JI=async()=>{const t=ts();const n=t.map(t=>{const n=parseInt(t);const e=Jo(n);return e});const e=n.map(t=>t.newState);const o=await Promise.all(e.map(KI));const s=o.flat();return s};const tk=()=>[{id:"Editor.format",label:qf()},{id:"Editor.showHover",label:Gf()},{id:"Editor.formatForced",label:Xf()},{id:"Editor.selectNextOccurrence",label:Zf()},{id:"Editor.selectAllOccurrences",label:Qf()},{id:"Editor.goToDefinition",label:Kf()},{id:"Editor.goToTypeDefinition",label:Jf()},{id:"Editor.selectInsideString",label:th()},{aliases:["Indent More","DeIndent"],id:"Editor.indent",label:nh()},{aliases:["Indent Less","DeIndent"],id:"Editor.unindent",label:eh()},{id:"Editor.sortLinesAscending",label:oh()},{id:"Editor.toggleComment",label:sh()},{id:"Editor.selectUp",label:ch()},{id:"Editor.selectDown",label:rh()},{id:"Editor.toggleBlockComment",label:Yf()},{id:"Editor.openColorPicker",label:ih()},{id:"Editor.closeColorPicker",label:ah()},{id:"Editor.copyLineDown",label:dh()},{id:"Editor.copyLineUp",label:lh()},{id:"Editor.moveLineDown",label:jf()},{id:"Editor.moveLineUp",label:Vf()},{id:"Editor.showSourceActions2",label:Df()}];const nk=t=>{const n=ym(t);const{selections:e}=n;return e};const ek=t=>{g(t);const n=ym(t);const{lines:e}=n;return e.join(pr)};const ok="insertText";const sk=(t,n,e)=>{switch(n){case ok:return Np(t,e);default:return t}};const ck=async(t,n)=>{const e=await Bn({commandMap:{},messagePort:t});if(n){Un(n,e)}};const rk=(t,n)=>cp(t,n);const ik=async t=>{const n=await op(t);if(!n){return t}return rk(t,n)};const ak=async()=>{await pm();await mm()};const dk=t=>{switch(t){case De:return{invoke:wm,name:"FindWidget"};default:return undefined}};const lk=async(t,n,e,o)=>{if(e?.newState){const s=`${n}:${e.newState.uid}`;const c=dk(e.id);if(c&&o&&Object.hasOwn(o,s)){const{invoke:n,name:r}=c;const i=o[s];await n(`${r}.create`,e.newState.uid,e.newState.x,e.newState.y,e.newState.width,e.newState.height,t);await n(`${r}.loadContent`,e.newState.uid,i);const a=await n(`${r}.diff2`,e.newState.uid);const d=await n(`${r}.render2`,e.newState.uid,a);return{restored:true,widget:{...e,newState:{...e.newState,commands:d}}}}}return{restored:false,widget:e}};const uk=async(t,n)=>{const e=[];for(const o of t){const t=parseInt(o);const s=Jo(t);if(!s?.newState||!Array.isArray(s.newState.widgets)){continue}const{widgets:c}=s.newState;const r=[];let i=false;for(const e of c){const s=await lk(t,o,e,n);r.push(s.widget);if(s.restored){i=true}}if(!i){e.push(s);continue}e.push({...s,newState:{...s.newState,widgets:r}})}return e};const fk=async(t,n,e)=>{if(!e?.newState){return}const o=dk(e.id);if(!o){return}const{invoke:s,name:c}=o;const{uid:r}=e.newState;const i=`${n}:${r}`;const a=await s(`${c}.saveState`,r);t[i]=a};const hk=async t=>{const n=Object.create(null);for(const e of t){const t=Jo(parseInt(e));if(!t?.newState||!Array.isArray(t.newState.widgets)){continue}const{widgets:o}=t.newState;for(const t of o){await fk(n,e,t)}}return n};const gk={isReloading:false};const mk=async()=>{if(gk.isReloading){return}gk.isReloading=true;try{const t=ts();const n=await hk(t);await ak();const e=await uk(t,n);for(const t of e){ns(t.newState.uid,t.oldState,t.newState)}await Eo(`Editor.rerender`)}finally{gk.isReloading=false}};const wk=async t=>{try{await Ro(t)}catch{await xo("SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker",t,"HandleMessagePort.handleMessagePort")}};const pk=async()=>{try{const t=await Rn({commandMap:{},send:wk});return t}catch(t){throw new S(t,`Failed to create syntax highlighting worker rpc`)}};const yk=async(t,n)=>{if(t){Uc(true);const t=await pk();Yc(t)}if(n){Qr(true)}};const Ek=async()=>{const t="Completion Worker";const n="completionWorkerMain.js";const e="Completions.initialize";const o=await _o(t,n,e);return o};const xk=async(t,n)=>{dm(Ek);await yk(t,n)};const Ik="editor.lineHeight";const kk="editor.fontSize";const Sk="editor.fontFamily";const vk="editor.letterSpacing";const Ck="editor.tabSize";const bk="editor.lineNumbers";const Mk="editor.diagnostics";const Ak="editor.quickSuggestions";const Lk="editor.autoClosingQuotes";const Pk="editor.autoclosingBrackets";const Fk="editor.fontWeight";const Wk=async()=>Boolean(await Ia(Pk));const Tk=async()=>Boolean(await Ia(Lk));const Rk=async()=>Boolean(await Ia(Ak));const Dk=async()=>true;const Ok=async()=>await Ia(Ik)||20;const Bk=async()=>await Ia(kk)||15;const Nk=async()=>await Ia(Sk)||"Fira Code";const Hk=async()=>await Ia(vk)??.5;const zk=async()=>await Ia(Ck)||2;const Uk=async()=>await Ia(bk)??false;const $k=async()=>[".","/"];const _k=async()=>await Ia(Mk)??false;const Yk=async()=>await Ia(Fk)??400;const Vk=async()=>{const[t,n,e,o,s,c,r,i,a,d,l,u,f]=await Promise.all([_k(),Nk(),Bk(),Yk(),Wk(),Tk(),Dk(),Rk(),Uk(),Ok(),zk(),Hk(),$k()]);return{completionTriggerCharacters:f,diagnosticsEnabled:t,fontFamily:n,fontSize:e,fontWeight:o,isAutoClosingBracketsEnabled:s,isAutoClosingQuotesEnabled:c,isAutoClosingTagsEnabled:r,isQuickSuggestionsEnabled:i,letterSpacing:u,lineNumbers:a,rowHeight:d,tabSize:l}};const jk=(t,n)=>{for(const e of t){if(e?.id===n){return e.tokenize||""}}return""};const qk=t=>{if(t instanceof Error){return t.message}return String(t)};const Gk=async(t,n)=>{const{assetDir:e,height:o,id:s,platform:c,uri:r,width:i,x:a,y:d}=t;const{completionTriggerCharacters:l,diagnosticsEnabled:u,fontFamily:f,fontSize:h,fontWeight:g,isAutoClosingBracketsEnabled:m,isAutoClosingQuotesEnabled:w,isAutoClosingTagsEnabled:p,isQuickSuggestionsEnabled:y,letterSpacing:E,lineNumbers:x,rowHeight:I,tabSize:k}=await Vk();const S=await xa(g,h,f,E);const v=await Ea(c,e);Qc(v);const C=ya(r,v);const b=jk(v,C);await er(C,b);const M=or(C);const A=t.tokenizerId+1;cr(A,M);const L={...t,charWidth:S,completionTriggerCharacters:l,diagnosticsEnabled:u,fontFamily:f,fontSize:h,fontWeight:g,isAutoClosingBracketsEnabled:m,isAutoClosingQuotesEnabled:w,isAutoClosingTagsEnabled:p,isQuickSuggestionsEnabled:y,languageId:C,letterSpacing:E,lineNumbers:x,loadError:"",rowHeight:I,tabSize:k,tokenizerId:A};let P="";try{P=await vo(r)}catch(t){const n=ra(L,a,d,i,o,9);return{...n,differences:[],focus:ro,focused:true,initial:false,loadError:qk(t),textInfos:[]}}const F=ra(L,a,d,i,o,9);const W=ia(F,P);let T=W;const R=li(T);const D={...T,decorations:R};const O=Kr();const{differences:B,textInfos:N}=await Yr(D,O);const H={...D,differences:B,focus:ro,focused:true,textInfos:N};await fa(ua,r,s,C,P);if(u){await Wa(H)}const z=await Ia("editor.completionsOnType");const U=Boolean(z);const $={...H,completionsOnType:U,initial:false};return $};const Xk=t=>t;const Zk=t=>t;const Qk=(t,n)=>{g(t);g(n);gi(t,n)};const Kk=(t,n,e,o,s)=>`.Editor {\n --EditorRowHeight: ${t}px;\n --ScrollBarHeight: ${n}px;\n --ScrollBarTop: ${e}px;\n --ScrollBarWidth: ${o}px;\n --ScrollBarLeft: ${s}px;\n}\n.Editor .EditorRow {\n height: var(--EditorRowHeight);\n line-height: var(--EditorRowHeight);\n}\n.Editor .ScrollBarThumbVertical {\n height: var(--ScrollBarHeight);\n translate: 0px var(--ScrollBarTop);\n}\n.Editor .ScrollBarThumbHorizontal {\n width: var(--ScrollBarWidth);\n translate: var(--ScrollBarLeft) 0px;\n}\n`;const Jk=(t,n,e)=>{const o=t/n*e;if(!Number.isFinite(o)){return 0}return o};const tS=(t,n)=>{const{deltaX:e,deltaY:o,finalDeltaY:s,height:c,longestLineWidth:r,minimumSliderSize:i,rowHeight:a,scrollBarHeight:d,uid:l,width:u}=n;const f=jr(o,s,c,d);const h=qr(u,r,i);const g=Jk(e,r,u);const m=Kk(a,d,f,h,g);return[oo,l,m]};const nS=(t,n)=>{const e=".EditorInput textarea";return[eo,n.uid,e]};const eS=(t,n)=>[so,n.uid,ro];const oS=1;const sS=2;const cS=3;const rS=4;const iS=6;const aS=7;const dS=8;const lS=9;const uS=10;const fS=11;const hS=t=>t!=="type"&&t!=="childCount";const gS=t=>{const n=Object.keys(t).filter(hS);return n};const mS=t=>{const n=[];let e=0;while(e<t.length){const o=t[e];const{children:s,nodesConsumed:c}=wS(t,e+1,o.childCount||0);n.push({node:o,children:s});e+=1+c}return n};const wS=(t,n,e)=>{if(e===0){return{children:[],nodesConsumed:0}}const o=[];let s=n;let c=e;let r=0;while(c>0&&s<t.length){const n=t[s];const e=n.childCount||0;const{children:i,nodesConsumed:a}=wS(t,s+1,e);o.push({node:n,children:i});const d=1+a;s+=d;r+=d;c--}return{children:o,nodesConsumed:r}};const pS=(t,n)=>{if(t.type!==n.type){return null}const e=[];if(t.type===jn){if(t.uid!==n.uid){e.push({type:fS,uid:n.uid})}return e}if(t.type===Vn&&n.type===Vn){if(t.text!==n.text){e.push({type:oS,value:n.text})}return e}const o=gS(t);const s=gS(n);for(const o of s){if(t[o]!==n[o]){e.push({type:cS,key:o,value:n[o]})}}for(const t of o){if(!Object.hasOwn(n,t)){e.push({type:rS,key:t})}}return e};const yS=t=>{const n=[t.node];for(const e of t.children){n.push(...yS(e))}return n};const ES=(t,n,e)=>{if(n===-1){t.push({type:aS,index:e});return e}if(n!==e){t.push({type:uS,index:e})}return e};const xS=(t,n)=>{if(n>=0){t.push({type:dS})}return-1};const IS=(t,n)=>{n.push({type:iS,nodes:yS(t)})};const kS=(t,n)=>{n.push({type:sS,nodes:yS(t)})};const SS=(t,n,e,o,s)=>{const c=pS(t.node,n.node);if(c===null){const t=ES(e,o,s);kS(n,e);return t}const r=t.children.length>0||n.children.length>0;if(c.length===0&&!r){return o}const i=ES(e,o,s);if(c.length>0){e.push(...c)}if(r){CS(t.children,n.children,e)}return i};const vS=(t,n,e)=>{const o=pS(t.node,n.node);if(o===null){kS(n,e);return}if(o.length>0){e.push(...o)}if(t.children.length>0||n.children.length>0){CS(t.children,n.children,e)}};const CS=(t,n,e)=>{const o=Math.max(t.length,n.length);let s=-1;const c=[];for(let r=0;r<o;r++){const o=t[r];const i=n[r];if(!o&&!i){continue}if(!o){s=xS(e,s);IS(i,e);continue}if(!i){c.push(r);continue}s=SS(o,i,e,s,r)}xS(e,s);for(let t=c.length-1;t>=0;t--){e.push({type:lS,index:c[t]})}};const bS=(t,n,e,o)=>{if(o.length===0&&t.length===1&&n.length===1){vS(t[0],n[0],e);return}CS(t,n,e)};const MS=t=>{let n=-1;for(let e=t.length-1;e>=0;e--){const o=t[e];if(o.type!==aS&&o.type!==dS&&o.type!==uS){n=e;break}}return n===-1?[]:t.slice(0,n+1)};const AS=(t,n)=>{const e=mS(t);const o=mS(n);const s=[];bS(e,o,s,[]);return MS(s)};const LS=()=>[{childCount:1,className:"EditorInput",type:yx},{ariaAutoComplete:"list",ariaMultiLine:"true",ariaRoleDescription:"editor",autocapitalize:"off",autocomplete:"off",autocorrect:"off",childCount:0,name:"editor",onBeforeInput:XE,onBlur:ZE,onCompositionEnd:KE,onCompositionStart:JE,onCompositionUpdate:tx,onCut:ex,onFocus:ox,onPaste:rx,role:"textbox",spellcheck:false,type:kx,wrap:"off"}];const PS=t=>{const n=Array.from(t,t=>({childCount:0,className:DE,translate:t,type:yx}));return n};const FS=t=>{const n=PS([...t]);return[{childCount:t.length,className:"LayerCursor",type:yx},...n]};const WS="error";const TS="warning";const RS=t=>{switch(t){case WS:return PE;case TS:return FE;default:return PE}};const DS=(...t)=>t.filter(Boolean).join(" ");const OS=t=>{const{height:n,type:e,width:o,x:s,y:c}=t;const r=RS(e);return[{childCount:0,className:DS(RE,r),height:n,left:s,top:c,type:yx,width:o}]};const BS=t=>{const n=t.flatMap(OS);return n};const NS=t=>{const n=BS([...t]);return[{childCount:t.length,className:"LayerDiagnostics",type:yx},...n]};const HS=(t,n,e=true,o=-1)=>{const s=[];for(let e=0;e<t.length;e++){const c=t[e];const r=n[e];let i=OE;if(e===o){i+=" "+BE}s.push({childCount:c.length/2,className:i,translate:Fi(r),type:yx});for(let t=0;t<c.length;t+=2){const n=c[t];const e=c[t+1];s.push({childCount:1,className:e,type:xx},Sx(n))}}return s};const zS=(t,n,e=true,o=-1)=>{const s=HS(t,n,e,o);return[{childCount:t.length,className:"EditorRows",onMouseDown:sx,onPointerDown:ix,onWheel:px,type:yx},...s]};const US=t=>{const n=[];for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];n.push({childCount:0,className:NE,height:r,left:o,top:s,type:yx,width:c})}return n};const $S=t=>{const n=US(t);return[{childCount:t.length/4,className:"Selections",type:yx},...n]};const _S=(t,n,e,o=true,s=-1,c=[],r=[])=>[{childCount:4,className:"EditorLayers",type:yx},...$S(t),...zS(n,e,o,s),...FS(c),...NS(r)];const YS=t=>[{childCount:t.length,className:"EditorScrollBarDiagnostics",type:yx},...BS([...t])];const VS=()=>[{childCount:1,className:"ScrollBar ScrollBarVertical",onContextMenu:nx,onPointerDown:gx,type:yx},{childCount:0,className:"ScrollBarThumb ScrollBarThumbVertical",type:yx},{childCount:1,className:"ScrollBar ScrollBarHorizontal",onPointerDown:ux,type:yx},{childCount:0,className:"ScrollBarThumb ScrollBarThumbHorizontal",type:yx}];const jS=({cursorInfos:t=[],diagnostics:n=[],differences:e,highlightedLine:o=-1,lineNumbers:s=true,scrollBarDiagnostics:c=[],selectionInfos:r=[],textInfos:i})=>[{childCount:5,className:"EditorContent",onMouseMove:cx,type:yx},...LS(),..._S(r,i,e,s,o,t,n),...YS(c),...VS()];const qS=t=>[{childCount:1,className:"LineNumber",type:xx},Sx(t)];const GS=t=>{const n=t.flatMap(qS);return n};const XS=t=>{const n=GS([...t]);return[{childCount:t.length,className:"Gutter",type:yx},...n]};const ZS=({cursorInfos:t=[],diagnostics:n=[],differences:e,gutterInfos:o=[],highlightedLine:s=-1,lineNumbers:c=true,loadError:r="",scrollBarDiagnostics:i=[],selectionInfos:a=[],textInfos:d})=>{if(r){return[{childCount:2,className:"Viewlet TextEditorError",role:"code",type:yx},{childCount:0,className:"EditorTextIcon EditorTextIconError MaskIcon MaskIconError",type:yx},{childCount:1,className:"TextEditorErrorMessage",type:yx},Sx(r)]}const l=c?XS(o):[];return[{childCount:c?2:1,className:"Viewlet Editor",onContextMenu:nx,role:"code",type:yx},...l,...jS({cursorInfos:t,diagnostics:n,differences:e,highlightedLine:s,lineNumbers:c,scrollBarDiagnostics:i,selectionInfos:a,textInfos:d})]};const QS=new Map;const KS=t=>QS.get(t);const JS=(t,n)=>{QS.set(t,n)};const tv=t=>{const{initial:n,textInfos:e}=t;if(n&&e.length===0){return[]}return ZS(t)};const nv=(t,n)=>{const e=t.initial?tv(t):KS(n.uid)||tv(t);const o=tv(n);const s=AS(e,o);if(s.length===0){return[]}JS(n.uid,o);return[co,n.uid,s]};const ev=t=>{const n=Fs(t.id);if(!n){throw new Error("unsupported widget")}return n.add(t)};const ov=t=>{const n=Fs(t.id);if(!n){throw new Error("unsupported widget")}return n.render(t)};const sv=t=>{const n=Fs(t.id);if(!n){throw new Error("unsupported widget")}return n.remove(t)};const cv=(t,n)=>{const e=[];const o=[];const s=[];const c=t.widgets||[];const r=n.widgets||[];const i=Object.create(null);const a=Object.create(null);for(const t of c){i[t.id]=t}for(const t of r){a[t.id]=t}for(const t of c){if(Object.hasOwn(a,t.id)){o.push(a[t.id])}else{s.push(t)}}for(const t of r){if(Object.hasOwn(i,t.id));else{e.push(t)}}const d=[];for(const t of e){const n=ev(t);if(n.length>0){d.push(...n)}}const l=[];for(const t of o){const n=ov(t);if(n.length>0){l.push(...n)}}const u=[];for(const t of s){const n=sv(t);if(n.length>0){u.push(...n)}}const f=[...d,...l,...u];return f.filter(t=>t[0]!=="Viewlet.setFocusContext")};const rv=t=>{switch(t){case Ha:return tS;case Ba:return nS;case Na:return eS;case za:return nv;case Ua:return cv;default:throw new Error("unknown renderer")}};const iv=(t,n,e)=>{const o=[];for(const s of e){const e=rv(s);const c=e(t,n);if(c.length>0){if(s===Ua){o.push(...c)}else{o.push(c)}}}return o};const av=(t,n)=>{const{newState:e,oldState:o}=Jo(t);ns(t,e,e);const s=iv(o,e,n);return s};const dv={apply(t,n){const{incrementalEdits:e}=n;if(e!==es){return["setIncrementalEdits",e]}const{differences:o,textInfos:s}=n;n.differences=o;const{highlightedLine:c,minLineY:r}=n;const i=c-r;const a=HS(s,o,true,i);return["setText",a]},isEqual:(t,n)=>t.lines===n.lines&&t.tokenizerId===n.tokenizerId&&t.minLineY===n.minLineY&&t.decorations===n.decorations&&t.embeds===n.embeds&&t.deltaX===n.deltaX&&t.width===n.width&&t.highlightedLine===n.highlightedLine&&t.debugEnabled===n.debugEnabled};const lv={apply:(t,n)=>{const{cursorInfos:e=[],selectionInfos:o=[]}=n;const s=PS(e);const c=US(o);return["setSelections",s,c]},isEqual:(t,n)=>t.cursorInfos===n.cursorInfos&&t.selectionInfos===n.selectionInfos};const uv={apply:tS,isEqual:Ra};const fv={apply:(t,n)=>["setFocused",n.focused],isEqual:(t,n)=>t.focused===n.focused};const hv={apply:(t,n)=>[so,n.uid,n.focus,0,n.uid,"Editor"],isEqual:(t,n)=>t.focus===n.focus};const gv={apply(t,n){if(n.additionalFocus){return["Viewlet.setAdditionalFocus",n.uid,n.additionalFocus]}return["viewlet.unsetAdditionalFocus",n.uid,n.additionalFocus]},isEqual:(t,n)=>t.additionalFocus===n.additionalFocus};const mv={apply(t,n){const e=BS(n.visualDecorations||[]);return["setDecorationsDom",e]},isEqual:(t,n)=>t.visualDecorations===n.visualDecorations};const wv={apply(t,n){const{lineNumbers:e,maxLineY:o,minLineY:s}=n;if(!e){return[]}const c=[];for(let t=s;t<o;t++){c.push(t+1)}const r=GS(c);return["renderGutter",r]},isEqual:(t,n)=>t.lineNumbers===n.lineNumbers&&t.minLineY===n.minLineY&&t.maxLineY===n.maxLineY};const pv={apply:cv,isEqual:(t,n)=>t.widgets===n.widgets,multiple:true};const yv=[dv,lv,uv,fv,mv,wv,pv,hv,gv];const Ev=async t=>{const n=Jo(t);if(!n){return[]}const{newState:e,oldState:o}=n;const s=[];ns(t,e,e);for(const t of yv){if(t.isEqual(o,e)){continue}const n=await t.apply(o,e);if(t.multiple){s.push(...n)}else if(n.length>0){s.push(n)}}return s};const xv=()=>[{name:ox,params:["handleFocus"]},{name:cx,params:["handleMouseMove",Xn,Zn,qn]},{name:ZE,params:["handleBlur"]},{name:XE,params:["handleBeforeInput","event.inputType","event.data"],preventDefault:true},{name:JE,params:["compositionStart","event.data"]},{name:tx,params:["compositionUpdate","event.data"]},{name:KE,params:["compositionEnd","event.data"]},{name:ex,params:["cut"],preventDefault:true},{name:rx,params:["paste",'event.clipboardData ? event.clipboardData.getData("text/plain") : ""'],preventDefault:true},{name:sx,params:["handleMouseDown","event.button","event.altKey","event.ctrlKey",Xn,Zn,"event.detail"]},{name:ix,params:["handlePointerDown","event.button","event.altKey","event.ctrlKey",Xn,Zn,"event.detail"],trackPointerEvents:[ax,dx]},{name:ax,params:["handlePointerMove",Xn,Zn,qn]},{name:dx,params:["handlePointerUp"]},{name:px,params:["handleWheel",Qn,"event.deltaX",Kn],passive:true},{name:nx,params:["handleContextMenu",Gn,Xn,Zn],preventDefault:true},{name:gx,params:["handleScrollBarVerticalPointerDown",Zn],preventDefault:true,trackPointerEvents:[mx,wx]},{name:mx,params:["handleScrollBarVerticalPointerMove",Zn]},{name:wx,params:["handlePointerUp"]},{name:ux,params:["handleScrollBarHorizontalPointerDown",Xn],trackPointerEvents:[fx,hx]},{name:fx,params:["handleScrollBarHorizontalMove",Xn]},{name:hx,params:["handlePointerUp"]}];const Iv=(t,n)=>{const{lines:e}=t;return{lines:e}};const kv=async(t,n,e)=>{await bo(t,e)};const Sv=async(t,n)=>{await Fo(t,n)};const vv=(t,n)=>t;const Cv=(t,n)=>{g(t);g(n);mi(t,n)};const bv=async(t,...n)=>{const e=$n(Ge);return e.invoke(t,...n)};const Mv=async t=>{const n=await bv("RunAndDebug.getHighlight",t);return n};const Av=()=>{const t=ts();return parseInt(t[0])};const Lv=async t=>{const n=await Mv(t);const e=Av();const o=Jo(e);if(!o){return}const{newState:s,oldState:c}=o;const r={...s,highlightedLine:n.rowIndex};ns(e,c,r);await Eo("Editor.rerender",e)};const Pv=t=>async(n,...e)=>{const o=Jo(n);const s=o.newState;const c=await t(s,...e);if(s===c){return c}const r=await pg(s,c);ns(n,s,r);return r};const Fv={"ActivateByEvent.activateByEvent":zo,"CodeGenerator.accept":Uo,"ColorPicker.loadContent":Go,"Editor.addCursorAbove":Pv(Ga),"Editor.addCursorBelow":Pv(Za),"Editor.applyDocumentEdits":Pv(td),"Editor.applyEdit":Pv(nd),"Editor.applyEdit2":UI,"Editor.applyWorkspaceEdit":Pv(od),"Editor.braceCompletion":Pv(Sd),"Editor.cancelSelection":Pv(vd),"Editor.closeCodeGenerator":Pv(Ad),"Editor.closeFind":Pv(Pd),"Editor.closeFind2":zI,"Editor.closeRename":Pv(Od),"Editor.closeSourceAction":Pv(Nd),"Editor.closeWidget2":HI,"Editor.compositionEnd":Pv(Xd),"Editor.compositionStart":Pv(jd),"Editor.compositionUpdate":Pv(Gd),"Editor.contextMenu":Pv(Rh),"Editor.copy":Pv(Jd),"Editor.copyLineDown":Pv(tl),"Editor.copyLineUp":Pv(nl),"Editor.create":Ta,"Editor.create2":us,"Editor.cursorCharacterLeft":Pv(ql),"Editor.cursorCharacterRight":Pv(Kl),"Editor.cursorDown":Pv(nu),"Editor.cursorEnd":Pv(eu),"Editor.cursorHome":Pv(ou),"Editor.cursorLeft":Pv(ql),"Editor.cursorRight":Pv(Kl),"Editor.cursorSet":Pv(su),"Editor.cursorUp":Pv(au),"Editor.cursorWordLeft":Pv(du),"Editor.cursorWordPartLeft":Pv(lu),"Editor.cursorWordPartRight":Pv(uu),"Editor.cursorWordRight":Pv(fu),"Editor.cut":Pv(mu),"Editor.deleteAll":Pv(wu),"Editor.deleteAllLeft":Pv(ku),"Editor.deleteAllRight":Pv(Cu),"Editor.deleteCharacterLeft":Pv(bu),"Editor.deleteCharacterRight":Pv(Mu),"Editor.deleteHorizontalRight":Pv(vu),"Editor.deleteLeft":Pv(bu),"Editor.deleteRight":Pv(Mu),"Editor.deleteWordLeft":Pv(Au),"Editor.deleteWordPartLeft":Pv(Lu),"Editor.deleteWordPartRight":Pv(Pu),"Editor.deleteWordRight":Pv(Fu),"Editor.diff2":ja,"Editor.executeWidgetCommand":Pv(dI),"Editor.findAllReferences":Pv(Wu),"Editor.format":Pv(Bu),"Editor.getCommandIds":Zo,"Editor.getDiagnostics":_I,"Editor.getKeyBindings":VI,"Editor.getKeys":jI,"Editor.getLanguageId":FI,"Editor.getLines2":OI,"Editor.getMenuEntries":ZI,"Editor.getMenuEntries2":ZI,"Editor.getMenuIds":QI,"Editor.getOffsetAtCursor":WI,"Editor.getPositionAtCursor":LI,"Editor.getProblems":JI,"Editor.getQuickPickMenuEntries":tk,"Editor.getSelections":nk,"Editor.getSelections2":BI,"Editor.getSourceActions":$I,"Editor.getText":ek,"Editor.getUri":PI,"Editor.getWordAt":$u,"Editor.getWordAt2":TI,"Editor.getWordAtOffset2":RI,"Editor.getWordBefore":_u,"Editor.getWordBefore2":DI,"Editor.goToDefinition":Pv(wh),"Editor.goToTypeDefinition":Pv(kh),"Editor.handleBeforeInput":Pv(sk),"Editor.handleBeforeInputFromContentEditable":Pv(ag),"Editor.handleBlur":Pv(sd),"Editor.handleClickAtPosition":Pv(Wh),"Editor.handleContextMenu":Pv(Rh),"Editor.handleDoubleClick":Pv(Hh),"Editor.handleFocus":Pv(zh),"Editor.handleMouseDown":Pv(Zh),"Editor.handleMouseMove":Pv(og),"Editor.handleMouseMoveWithAltKey":Pv(cg),"Editor.handleNativeSelectionChange":dg,"Editor.handlePointerCaptureLost":Pv(lg),"Editor.handlePointerDown":Pv(ug),"Editor.handlePointerMove":Pv(Pg),"Editor.handlePointerUp":Pv(Fg),"Editor.handleScrollBarClick":Ng,"Editor.handleScrollBarHorizontalMove":Pv(Tg),"Editor.handleScrollBarHorizontalPointerDown":Pv(Rg),"Editor.handleScrollBarMove":Pv(Og),"Editor.handleScrollBarPointerDown":Pv(Ng),"Editor.handleScrollBarVerticalMove":Pv(Bg),"Editor.handleScrollBarVerticalPointerDown":Pv(Ng),"Editor.handleScrollBarVerticalPointerMove":Pv(Bg),"Editor.handleSingleClick":Pv(Vh),"Editor.handleTab":Pv(ik),"Editor.handleTouchEnd":Pv(Hg),"Editor.handleTouchMove":Pv(Vg),"Editor.handleTouchStart":Pv(Ug),"Editor.handleTripleClick":Pv(Gh),"Editor.handleWheel":Pv(jg),"Editor.hotReload":mk,"Editor.indendLess":Pv(Gg),"Editor.indentMore":Pv(Zg),"Editor.insertLineBreak":Pv(nm),"Editor.loadContent":Pv(Gk),"Editor.moveLineDown":Pv(Xk),"Editor.moveLineUp":Pv(Zk),"Editor.moveRectangleSelection":Pv(fg),"Editor.moveRectangleSelectionPx":Pv(hg),"Editor.moveSelection":Pv(bg),"Editor.moveSelectionPx":Pv(Lg),"Editor.offsetAt":Wr,"Editor.openCodeGenerator":Pv(rm),"Editor.openColorPicker":Pv(Yd),"Editor.openCompletion":Pv(um),"Editor.openFind":Pv(km),"Editor.openFind2":Pv(Im),"Editor.openRename":Pv(bm),"Editor.organizeImports":Pv(Am),"Editor.paste":Pv(Pm),"Editor.pasteText":Pv(Lm),"Editor.redo":Pv(Fm),"Editor.render":Ev,"Editor.render2":av,"Editor.renderEventListeners":xv,"Editor.replaceRange":Pv(cd),"Editor.rerender":Pv($x),"Editor.resize":Pv(yi),"Editor.save":Pv(Gm),"Editor.saveState":Ko(Iv),"Editor.selectAll":Pv(Xm),"Editor.selectAllLeft":Pv(Km),"Editor.selectAllOccurrences":Pv(dw),"Editor.selectAllRight":Pv(fw),"Editor.selectCharacterLeft":Pv(hw),"Editor.selectCharacterRight":Pv(gw),"Editor.selectDown":Pv(ww),"Editor.selectInsideString":Pv(yw),"Editor.selectionGrow":Pv(xw),"Editor.selectLine":Pv(qh),"Editor.selectNextOccurrence":Pv(vw),"Editor.selectPreviousOccurrence":Pv(Cw),"Editor.selectUp":Pv(Mw),"Editor.selectWord":Pv(Nh),"Editor.selectWordLeft":Pv(Aw),"Editor.selectWordRight":Pv(Lw),"Editor.setDebugEnabled":Pv(vv),"Editor.setDecorations":Pv(Pw),"Editor.setDelta":Pv(Yg),"Editor.setDeltaY":Pv($g),"Editor.setLanguageId":Pv(Fw),"Editor.setSelections":Pv(Ww),"Editor.setSelections2":NI,"Editor.setText":Pv(Tw),"Editor.showHover":$w,"Editor.showHover2":zw,"Editor.showSourceActions":Xw,"Editor.showSourceActions2":Xw,"Editor.showSourceActions3":Xw,"Editor.sortLinesAscending":Pv(tp),"Editor.tabCompletion":Pv(ip),"Editor.terminate":e,"Editor.toggleBlockComment":Pv(gp),"Editor.toggleComment":Pv(Ep),"Editor.toggleLineComment":Pv(yp),"Editor.type":Pv(xp),"Editor.typeWithAutoClosing":Pv(Np),"Editor.undo":Pv(zp),"Editor.unIndent":Pv(Up),"Editor.updateDebugInfo":Lv,"Editor.updateDiagnostics":Pv(Wa),"EditorCompletion.close":hy,"EditorCompletion.closeDetails":gy,"EditorCompletion.focusFirst":my,"EditorCompletion.focusIndex":wy,"EditorCompletion.focusNext":yy,"EditorCompletion.focusPrevious":Ey,"EditorCompletion.handleEditorBlur":xy,"EditorCompletion.handleEditorClick":Iy,"EditorCompletion.handleEditorDeleteLeft":ky,"EditorCompletion.handleEditorType":Sy,"EditorCompletion.handlePointerDown":vy,"EditorCompletion.handleWheel":Cy,"EditorCompletion.openDetails":by,"EditorCompletion.selectCurrent":My,"EditorCompletion.selectIndex":Ay,"EditorCompletion.toggleDetails":Ly,"EditorRename.accept":Nx,"EditorRename.close":Hx,"EditorRename.handleInput":zx,"EditorSourceAction.close":Zx,"EditorSourceAction.closeDetails":Qx,"EditorSourceAction.focusFirst":Kx,"EditorSourceAction.focusIndex":Jx,"EditorSourceAction.focusNext":nI,"EditorSourceAction.focusPrevious":eI,"EditorSourceAction.handleWheel":oI,"EditorSourceAction.selectCurrent":sI,"EditorSourceAction.selectIndex":cI,"EditorSourceAction.selectItem":rI,"EditorSourceAction.toggleDetails":iI,"EditorSourceActions.focusNext":Yx,"ExtensionHostManagement.activateByEvent":zo,"FindWidget.close":Oy,"FindWidget.focusCloseButton":By,"FindWidget.focusFind":Ny,"FindWidget.focusNext":Hy,"FindWidget.focusNextElement":zy,"FindWidget.focusNextMatchButton":Uy,"FindWidget.focusPrevious":$y,"FindWidget.focusPreviousElement":_y,"FindWidget.focusPreviousMatchButton":Yy,"FindWidget.focusReplace":Vy,"FindWidget.focusReplaceAllButton":jy,"FindWidget.focusReplaceButton":qy,"FindWidget.focusToggleReplace":Gy,"FindWidget.handleBlur":Xy,"FindWidget.handleClickButton":Zy,"FindWidget.handleFocus":Qy,"FindWidget.handleInput":Ky,"FindWidget.handleReplaceFocus":Jy,"FindWidget.handleReplaceInput":tE,"FindWidget.handleToggleReplaceFocus":nE,"FindWidget.loadContent":Em,"FindWidget.replace":eE,"FindWidget.replaceAll":oE,"FindWidget.toggleMatchCase":sE,"FindWidget.toggleMatchWholeWord":cE,"FindWidget.togglePreserveCase":rE,"FindWidget.toggleReplace":iE,"FindWidget.toggleUseRegularExpression":aE,"Font.ensure":YI,"HandleMessagePort.handleMessagePort":ck,"Hover.getHoverInfo":kE,"Hover.handleSashPointerDown":vE,"Hover.handleSashPointerMove":CE,"Hover.handleSashPointerUp":bE,"Hover.loadContent":SE,"Hover.render":Tx,"Initialize.initialize":xk,"Listener.register":Qk,"Listener.registerListener":gi,"Listener.unregister":Cv,"SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker":kv,"SendMessagePortToExtensionManagementWorker.sendMessagePortToExtensionManagementWorker":Sv};for(const[t,n]of Object.entries(Fv)){if(t.startsWith("Editor.")){Fv["EditorText"+t.slice("Editor".length)]=n}}const Wv=async()=>{const t="HandleMessagePort.handleMessagePort2";const n=await On({commandMap:{},async send(n){await kv(n,t,Xe)}});return n};const Tv=async()=>{const t=await Wv();ha(t)};const Rv=async()=>{const t=await On({commandMap:{},async send(t){await Fo(t,Xe)}});return t};const Dv=async()=>{try{const t=await Rv();fo(t)}catch{}};const Ov=t=>So(t);const Bv=async()=>{const t=await On({commandMap:{},send:Ov});mo(t)};const Nv=async()=>{const t=await Nn({commandMap:Fv});Io(t)};const Hv=t=>Po(t);const zv=async()=>{const t=await On({commandMap:{},send:Hv});yo(t)};const Uv=async()=>{Qo(Fv);await Promise.all([Nv(),Tv(),Dv(),zv(),Bv()])};const $v="CodeGeneratorInput";const _v=t=>{const n=Of();const e=Bf();return[{childCount:2,className:DS(GE,LE),type:yx},{childCount:0,className:DS(ME,jE),name:$v,placeholder:e,type:Ex},{childCount:1,className:AE,type:yx},Sx(n)]};const Yv={apply(t,n){const e=_v();return[ry,n.uid,e]},isEqual:(t,n)=>t.questions===n.questions};const Vv={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[oy,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height};const jv={apply:(t,n)=>[Kp,".CodeGeneratorInput",n.focusSource],isEqual:(t,n)=>t.focused===n.focused&&t.focusSource===n.focusSource};const qv=[Yv,Vv,jv];const Gv=(t,n)=>{const e=[];for(const o of qv){if(!o.isEqual(t,n)){e.push(o.apply(t,n))}}return e};const Xv=t=>{const n=Gv(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(t[0]===ry){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const Zv=t=>_p(t,"EditorCodeGenerator",Xv);const Qv=Vx;const Kv={__proto__:null,add:Zv,remove:Qv,render:Xv};const Jv=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const tC=[ry,cy,Qp,sy,Jp,iy];const nC=t=>{const n=Jv(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(tC.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const eC=t=>_p(t,"ColorPicker",nC);const oC=Vx;const sC={};const cC={__proto__:null,Commands:sC,add:eC,remove:oC,render:nC};const rC=t=>{const n=[{childCount:2,className:"Viewlet EditorCompletionDetails",type:yx},{childCount:1,className:TE,type:yx},Sx(t),{childCount:1,className:WE,onClick:QE,type:yx},{childCount:0,className:`${qE} ${VE}`,type:yx}];return n};const iC=(t,n,e)=>{const o=[];for(const s of t){if(!s.isEqual(n,e)){o.push(s.apply(n,e))}}return o};const aC={apply(t,n){const e=rC(n.content);return[ry,n.uid,e]},isEqual:(t,n)=>t.content===n.content};const dC={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[oy,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height};const lC=[aC,dC];const uC=(t,n)=>iC(lC,t,n);const fC=(t,n)=>{const{widgets:e}=t;for(const t of e){if(t.id===n){return t.newState}}return undefined};const hC=t=>fC(t,Te);const gC=t=>{const n=uC(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(t[0]===ry){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const mC=t=>_p(t,"EditorCompletionDetails",gC);const wC=Vx;const pC=(t,n)=>{const e=hC(t);if(!e){return t}const{x:o}=Sm(t);const s=o+e.width-n.borderSize;return{...n,x:s}};const yC=(t,n)=>pC(t,n);const EC=(t,n)=>pC(t,n);const xC={__proto__:null,add:mC,handleEditorDeleteLeft:EC,handleEditorType:yC,remove:wC,render:gC};const IC=[ry,cy,Qp,sy,Jp,ty,ny,ey,iy,"Viewlet.focusSelector"];const kC=t=>{const n=ay(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(IC.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const SC=t=>_p(t,"EditorCompletion",kC);const vC=t=>[["Viewlet.dispose",t.newState.uid]];const{close:CC}=Zp(["close"],"",Oe);const bC={__proto__:null,add:SC,close:CC,remove:vC,render:kC};const MC=()=>{Ps(We,cC);Ps(Te,Py);Ps(Re,xC);Ps(De,dE);Ps(Oe,bC);Ps(Be,Ux);Ps(Ne,aI);Ps(Fe,Kv)};const AC=t=>{t.preventDefault();console.error(`[editor-worker] Unhandled Rejection: ${t.reason}`)};const LC=(t,n,e,o,s)=>{console.error(`[editor-worker] Unhandled Error: ${s}`);return true};const PC=t=>{t.addEventListener("error",LC);t.addEventListener("unhandledrejection",AC)};const FC=async()=>{PC(globalThis);await Uv();MC()};FC();
1
+ const t=t=>{const n=t.indexOf(".");return t.slice(n+1)};const n=()=>{const n=Object.create(null);const e={};return{clear(){for(const t of Object.keys(n)){delete n[t]}},diff(t,e,o){const{oldState:s,scheduledState:c}=n[t];const r=[];for(let t=0;t<e.length;t++){const n=e[t];if(!n(s,c)){r.push(o[t])}}return r},dispose(t){delete n[t]},get(t){return n[t]},getCommandIds(){const n=Object.keys(e);const o=n.map(t);return o},getKeys(){return Object.keys(n).map(Number)},registerCommands(t){Object.assign(e,t)},set(t,e,o,s){n[t]={newState:o,oldState:e,scheduledState:s??o}},wrapCommand(t){const e=async(e,...o)=>{const{newState:s,oldState:c}=n[e];const r=await t(s,...o);if(c===r||s===r){return}const i=n[e];const a={...i.newState,...r};n[e]={newState:a,oldState:i.oldState,scheduledState:a}};return e},wrapGetter(t){const e=(e,...o)=>{const{newState:s}=n[e];return t(s,...o)};return e},wrapLoadContent(t){const e=async(e,...o)=>{const{newState:s,oldState:c}=n[e];const r=await t(s,...o);const{error:i,state:a}=r;if(c===a||s===a){return{error:i}}const d=n[e];const l={...d.newState,...a};n[e]={newState:l,oldState:d.oldState,scheduledState:l};return{error:i}};return e}}};const e=()=>{globalThis.close()};class o extends Error{constructor(t){super(t);this.name="AssertionError"}}const s=1;const c=2;const r=3;const i=4;const a=5;const d=6;const l=7;const u=8;const f=t=>{switch(typeof t){case"number":return c;case"function":return d;case"string":return i;case"object":if(t===null){return l}if(Array.isArray(t)){return r}return s;case"boolean":return a;default:return u}};const h=t=>{const n=f(t);if(n!==s){throw new o("expected value to be of type object")}};const g=t=>{const n=f(t);if(n!==c){throw new o("expected value to be of type number")}};const m=t=>{const n=f(t);if(n!==r){throw new o("expected value to be of type array")}};const w=t=>{const n=f(t);if(n!==i){throw new o("expected value to be of type string")}};const p=t=>{const n=f(t);if(n!==a){throw new o("expected value to be of type boolean")}};const y=t=>{if(t.startsWith("Error: ")){return t.slice("Error: ".length)}if(t.startsWith("VError: ")){return t.slice("VError: ".length)}return t};const E=(t,n)=>{const e=y(`${t}`);if(n){return`${n}: ${e}`}return e};const x="\n";const I=(t,n=undefined)=>t.indexOf(x,n);const S=(t,n)=>{if(!n){return t}const e=I(t);const o=I(n);if(o===-1){return t}const s=t.slice(0,e);const c=n.slice(o);const r=y(n.slice(0,o));if(s.includes(r)){return s+c}return n};class k extends Error{constructor(t,n){const e=E(t,n);super(e);this.name="VError";if(t instanceof Error){this.stack=S(this.stack,t.stack)}if(t.codeFrame){this.codeFrame=t.codeFrame}if(t.code){this.code=t.code}}}const v=t=>t&&t instanceof MessagePort;const C=t=>t&&t.constructor&&t.constructor.name==="MessagePortMain";const b=t=>typeof OffscreenCanvas!=="undefined"&&t instanceof OffscreenCanvas;const M=(t,n)=>t?.constructor?.name===n;const A=t=>M(t,"Socket");const L=[v,C,b,A];const P=t=>{for(const n of L){if(n(t)){return true}}return false};const F=(t,n,e)=>{if(!t){return}if(e(t)){n.push(t);return}if(Array.isArray(t)){for(const o of t){F(o,n,e)}return}if(typeof t==="object"){for(const o of Object.values(t)){F(o,n,e)}return}};const W=t=>{const n=[];F(t,n,P);return n};const T=t=>{const n=(...n)=>{const e=t.getData(...n);t.dispatchEvent(new MessageEvent("message",{data:e}))};t.onMessage(n);const e=n=>{t.dispatchEvent(new Event("close"))};t.onClose(e)};class R extends EventTarget{constructor(t){super();this._rawIpc=t;T(this)}}const D="E_INCOMPATIBLE_NATIVE_MODULE";const O="E_MODULES_NOT_SUPPORTED_IN_ELECTRON";const B="ERR_MODULE_NOT_FOUND";const N="\n";const H=t=>t.join(N);const z=/^\s+at/;const U=/^\s*at async Promise.all \(index \d+\)$/;const $=t=>z.test(t)&&!U.test(t);const Y=t=>{const n=t.findIndex($);if(n===-1){return{actualMessage:H(t),rest:[]}}let e=n-1;while(++e<t.length){if(!$(t[e])){break}}return{actualMessage:t[n-1],rest:t.slice(n,e)}};const _=t=>t.split(N);const V=/^Error: The module '.*'$/;const j=/^\s* at/;const q=t=>V.test(t);const G=t=>j.test(t);const X=t=>{const n=_(t);const e=n.findIndex(q);const o=e+n.slice(e).findIndex(G,e);const s=n.slice(e,o);const c=s.join(" ").slice("Error: ".length);return c};const Z=t=>t.includes("[ERR_MODULE_NOT_FOUND]");const Q=t=>{const n=_(t);const e=n.findIndex(Z);const o=n[e];return{code:B,message:o}};const K=t=>{if(!t){return false}return t.includes("ERR_MODULE_NOT_FOUND")};const J=t=>{if(!t){return false}return t.includes("SyntaxError: Cannot use import statement outside a module")};const tt=/^innerError Error: Cannot find module '.*.node'/;const nt=/was compiled against a different Node.js version/;const et=t=>tt.test(t)&&nt.test(t);const ot=t=>{const n=X(t);return{code:D,message:`Incompatible native node module: ${n}`}};const st=()=>({code:O,message:`ES Modules are not supported in electron`});const ct=(t,n)=>{if(et(n)){return ot(n)}if(J(n)){return st()}if(K(n)){return Q(n)}const e=_(n);const{actualMessage:o,rest:s}=Y(e);return{code:"",message:o,stack:s}};class rt extends k{constructor(t,n="",e=""){if(n||e){const{code:o,message:s,stack:c}=ct(n,e);const r=new Error(s);r.code=o;r.stack=c;super(r,t)}else{super(t)}this.name="IpcError";this.stdout=n;this.stderr=e}}const it="ready";const at=t=>t.data;const dt=()=>{if(typeof WorkerGlobalScope==="undefined"){throw new TypeError("module is not in web worker scope")}return globalThis};const lt=t=>{t.postMessage(it)};class ut extends R{getData(t){return at(t)}send(t){this._rawIpc.postMessage(t)}sendAndTransfer(t){const n=W(t);this._rawIpc.postMessage(t,n)}dispose(){}onClose(t){}onMessage(t){this._rawIpc.addEventListener("message",t)}}const ft=t=>new ut(t);const ht=async t=>{const{promise:n,resolve:e}=Promise.withResolvers();t.addEventListener("message",e,{once:true});const o=await n;return o.data};const gt=async()=>{const t=dt();lt(t);const n=ft(t);const e=await ht(n);if(e.method!=="initialize"){throw new rt("unexpected first message")}const o=e.params[0];if(o==="message-port"){n.send({id:e.id,jsonrpc:"2.0",result:null});n.dispose();const t=e.params[1];return t}return globalThis};class mt extends R{getData(t){return at(t)}send(t){this._rawIpc.postMessage(t)}sendAndTransfer(t){const n=W(t);this._rawIpc.postMessage(t,n)}dispose(){if(this._rawIpc.close){this._rawIpc.close()}}onClose(t){}onMessage(t){this._rawIpc.addEventListener("message",t);this._rawIpc.start()}}const wt=t=>new mt(t);const pt={__proto__:null,listen:gt,wrap:wt};const yt=(t,n,e)=>{if("addEventListener"in t){t.addEventListener(n,e)}else{t.on(n,e)}};const Et=(t,n,e)=>{if("removeEventListener"in t){t.removeEventListener(n,e)}else{t.off(n,e)}};const xt=(t,n)=>{const{promise:e,resolve:o}=Promise.withResolvers();const s=Object.create(null);const c=e=>{for(const e of Object.keys(n)){Et(t,e,s[e])}o(e)};for(const[e,o]of Object.entries(n)){const n=t=>{c({event:t,type:o})};yt(t,e,n);s[e]=n}return e};const It=3;const St=async({isMessagePortOpen:t,messagePort:n})=>{if(!v(n)){throw new rt("port must be of type MessagePort")}if(t){return n}const e=xt(n,{message:It});n.start();const{event:o,type:s}=await e;if(s!==It){throw new rt("Failed to wait for ipc message")}if(o.data!==it){throw new rt("unexpected first message")}return n};const kt=t=>{t.start()};class vt extends R{getData=at;send(t){this._rawIpc.postMessage(t)}sendAndTransfer(t){const n=W(t);this._rawIpc.postMessage(t,n)}dispose(){this._rawIpc.close()}onMessage(t){this._rawIpc.addEventListener("message",t)}onClose(t){}}const Ct=t=>new vt(t);const bt={__proto__:null,create:St,signal:kt,wrap:Ct};class Mt extends Error{constructor(t){super(`Command not found ${t}`);this.name="CommandNotFoundError"}}const At=Object.create(null);const Lt=t=>{Object.assign(At,t)};const Pt=t=>At[t];const Ft=(t,...n)=>{const e=Pt(t);if(!e){throw new Mt(t)}return e(...n)};const Wt="2.0";const Tt=Object.create(null);const Rt=t=>Tt[t];const Dt=t=>{delete Tt[t]};class Ot extends Error{constructor(t){super(t);this.name="JsonRpcError"}}const Bt="\n";const Nt="DOMException";const Ht="ReferenceError";const zt="SyntaxError";const Ut="TypeError";const $t=(t,n)=>{if(n){switch(n){case Nt:return DOMException;case Ht:return ReferenceError;case zt:return SyntaxError;case Ut:return TypeError;default:return Error}}if(t.startsWith("TypeError: ")){return TypeError}if(t.startsWith("SyntaxError: ")){return SyntaxError}if(t.startsWith("ReferenceError: ")){return ReferenceError}return Error};const Yt=(t,n,e)=>{const o=$t(t,n);if(o===DOMException&&e){return new o(t,e)}if(o===Error){const n=new Error(t);if(e&&e!=="VError"){n.name=e}return n}return new o(t)};const _t=t=>t.join(Bt);const Vt=t=>t.split(Bt);const jt=()=>{const t=3;const n=_t(Vt((new Error).stack||"").slice(t));return n};const qt=(t,n=undefined)=>t.indexOf(Bt,n);const Gt=t=>{let n=t.stack||t.data||t.message||"";if(n.startsWith(" at")){n=t.message+Bt+n}return n};const Xt=-32601;const Zt=-32001;const Qt=t=>{const n=jt();if(t&&t instanceof Error){if(typeof t.stack==="string"){t.stack=t.stack+Bt+n}return t}if(t&&t.code&&t.code===Xt){const e=new Ot(t.message);const o=Gt(t);e.stack=o+Bt+n;return e}if(t&&t.message){const e=Yt(t.message,t.type,t.name);if(t.data){if(t.data.stack&&t.data.type&&t.message){e.stack=t.data.type+": "+t.message+Bt+t.data.stack+Bt+n}else if(t.data.stack){e.stack=t.data.stack}if(t.data.codeFrame){e.codeFrame=t.data.codeFrame}if(t.data.code){e.code=t.data.code}if(t.data.type){e.name=t.data.type}}else{if(t.stack){const n=e.stack||"";const o=qt(n);const s=Gt(t);e.stack=s+n.slice(o)}if(t.codeFrame){e.codeFrame=t.codeFrame}}return e}if(typeof t==="string"){return new Error(`JsonRpc Error: ${t}`)}return new Error(`JsonRpc Error: ${t}`)};const Kt=t=>{if("error"in t){const n=Qt(t.error);throw n}if("result"in t){return t.result}throw new Ot("unexpected response message")};const Jt=(...t)=>{console.warn(...t)};const tn=(t,n)=>{const e=Rt(t);if(!e){console.log(n);Jt(`callback ${t} may already be disposed`);return}e(n);Dt(t)};const nn="E_COMMAND_NOT_FOUND";const en=t=>{if(t&&t.type){return t.type}if(t&&t.constructor&&t.constructor.name){return t.constructor.name}return undefined};const on=t=>t.trim().startsWith("at ");const sn=t=>{const n=t.stack||"";const e=n.indexOf("\n");if(e!==-1&&!on(n.slice(0,e))){return n.slice(e+1)}return n};const cn=(t,n)=>{if(t&&t.code===nn){return{code:Xt,data:t.stack,message:t.message}}return{code:Zt,data:{code:n.code,codeFrame:n.codeFrame,name:n.name,stack:sn(n),type:en(n)},message:n.message}};const rn=(t,n)=>({error:n,id:t,jsonrpc:Wt});const an=(t,n,e,o)=>{const s=e(n);o(n,s);const c=cn(n,s);return rn(t,c)};const dn=(t,n)=>({id:t.id,jsonrpc:Wt,result:n??null});const ln=(t,n)=>{const e=n??null;return dn(t,e)};const un=(t,n)=>({error:{code:Zt,data:n,message:n.message},id:t,jsonrpc:Wt});const fn=async(t,n,e,o,s,c)=>{try{const o=c(t.method)?await e(t.method,n,...t.params):await e(t.method,...t.params);return ln(t,o)}catch(e){if(n.canUseSimpleErrorResponse){return un(t.id,e)}return an(t.id,e,o,s)}};const hn=t=>t;const gn=()=>{};const mn=()=>false;const wn=tn;const pn=t=>{if(t.length===1){const n=t[0];return{execute:n.execute,ipc:n.ipc,logError:n.logError||gn,message:n.message,preparePrettyError:n.preparePrettyError||hn,requiresSocket:n.requiresSocket||mn,resolve:n.resolve||wn}}return{execute:t[2],ipc:t[0],logError:t[5],message:t[1],preparePrettyError:t[4],requiresSocket:t[6],resolve:t[3]}};const yn=async(...t)=>{const n=pn(t);const{execute:e,ipc:o,logError:s,message:c,preparePrettyError:r,requiresSocket:i,resolve:a}=n;if("id"in c){if("method"in c){const t=await fn(c,o,e,r,s,i);try{o.send(t)}catch(t){const n=an(c.id,t,r,s);o.send(n)}return}a(c.id,c);return}if("method"in c){await fn(c,o,e,r,s,i);return}throw new Ot("unexpected message")};const En="2.0";const xn=(t,n)=>({jsonrpc:En,method:t,params:n});const In=(t,n,e)=>{const o={id:t,jsonrpc:En,method:n,params:e};return o};let Sn=0;const kn=()=>++Sn;const vn=t=>{const n=kn();const{promise:e,resolve:o}=Promise.withResolvers();t[n]=o;return{id:n,promise:e}};const Cn=async(t,n,e,o,s)=>{const{id:c,promise:r}=vn(t);const i=In(c,e,o);if(s&&n.sendAndTransfer){n.sendAndTransfer(i)}else{n.send(i)}const a=await r;return Kt(a)};const bn=t=>{const n=Object.create(null);t._resolve=(t,e)=>{const o=n[t];if(!o){console.warn(`callback ${t} may already be disposed`);return}o(e);delete n[t]};const e={async dispose(){await(t?.dispose())},invoke(e,...o){return Cn(n,t,e,o,false)},invokeAndTransfer(e,...o){return Cn(n,t,e,o,true)},ipc:t,send(n,...e){const o=xn(n,e);t.send(o)}};return e};const Mn=()=>false;const An=t=>t;const Ln=()=>{};const Pn=t=>{const n=t?.target?.requiresSocket||Mn;const e=t?.target?.execute||Ft;return yn(t.target,t.data,e,t.target._resolve,An,Ln,n)};const Fn=t=>{if("addEventListener"in t){t.addEventListener("message",Pn)}else if("on"in t){t.on("message",Pn)}};const Wn=async(t,n)=>{const e=await t.listen(n);if(t.signal){t.signal(e)}const o=t.wrap(e);return o};const Tn=async({commandMap:t,isMessagePortOpen:n=true,messagePort:e})=>{Lt(t);const o=await bt.create({isMessagePortOpen:n,messagePort:e});const s=bt.wrap(o);Fn(s);const c=bn(s);e.start();return c};const Rn=async({commandMap:t,isMessagePortOpen:n,send:e})=>{const{port1:o,port2:s}=new MessageChannel;await e(o);return Tn({commandMap:t,isMessagePortOpen:n,messagePort:s})};const Dn=t=>{let n;const e=()=>{if(!n){n=t()}return n};return{async dispose(){const t=await e();await t.dispose()},async invoke(t,...n){const o=await e();return o.invoke(t,...n)},async invokeAndTransfer(t,...n){const o=await e();return o.invokeAndTransfer(t,...n)},async send(t,...n){const o=await e();o.send(t,...n)}}};const On=async({commandMap:t,isMessagePortOpen:n,send:e})=>Dn(()=>Rn({commandMap:t,isMessagePortOpen:n,send:e}));const Bn=async({commandMap:t,messagePort:n})=>Tn({commandMap:t,messagePort:n});const Nn=async({commandMap:t})=>{Lt(t);const n=await Wn(pt);Fn(n);const e=bn(n);return e};const Hn=({commandMap:t})=>{const n=[];const e=(e,...o)=>{n.push([e,...o]);const s=t[e];if(!s){throw new Error(`command ${e} not found`)}return s(...o)};const o={invocations:n,invoke:e,invokeAndTransfer:e};return o};const zn=Object.create(null);const Un=(t,n)=>{zn[t]=n};const $n=t=>zn[t];const Yn=t=>{delete zn[t]};const _n=t=>({async dispose(){const n=$n(t);await n.dispose()},invoke(n,...e){const o=$n(t);return o.invoke(n,...e)},invokeAndTransfer(n,...e){const o=$n(t);return o.invokeAndTransfer(n,...e)},registerMockRpc(n){const e=Hn({commandMap:n});Un(t,e);e[Symbol.dispose]=()=>{Yn(t)};return e},set(n){Un(t,n)}});const Vn=12;const jn=100;const qn="event.altKey";const Gn="event.button";const Xn="event.clientX";const Zn="event.clientY";const Qn="event.deltaMode";const Kn="event.deltaY";const Jn=1;const te=2;const ne=3;const ee=8;const oe=9;const se=255;const ce=12;const re=13;const ie=14;const ae=15;const de=16;const le=18;const ue=29;const fe=31;const he=32;const ge=34;const me=36;const we=38;const pe=39;const ye=40;const Ee=43;const xe=50;const Ie=52;const Se=54;const ke=58;const ve=59;const Ce=60;const be=68;const Me=87;const Ae=88;const Le=90;const Pe=92;const Fe=1;const We=2;const Te=3;const Re=4;const De=5;const Oe=6;const Be=7;const Ne=8;const He=1<<11>>>0;const ze=1<<10>>>0;const Ue=1<<9>>>0;const $e=3;const Ye=22;const _e=1;const Ve=0;const je=2;const qe=301;const Ge=55;const Xe=99;const Ze=44;const Qe=9006;const Ke=7009;const Je=300;const to=4561;const no=1;const eo="Viewlet.focusSelector";const oo="Viewlet.setCss";const so="Viewlet.setFocusContext";const co="Viewlet.setPatches";const ro=12;const{invoke:io,set:ao}=_n(Ze);const lo={__proto__:null,invoke:io,set:ao};const{invoke:uo,set:fo}=_n(Qe);const ho=(t,n)=>uo("Extensions.getLanguages",t,n);const{invoke:go,set:mo}=_n(to);const wo=async(t,n)=>go("Open.openUrl",t,n);const{invoke:po,set:yo}=_n(Ke);const{invoke:Eo,invokeAndTransfer:xo,set:Io}=_n(no);const So=async(t,n,e,o,s)=>{g(t);g(n);g(e);g(o);await Eo("ContextMenu.show2",t,n,e,o,s)};const ko=async(t,n)=>{const e="HandleMessagePort.handleMessagePort";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToOpenerWorker",t,e,n)};const vo=async t=>Eo("FileSystem.readFile",t);const Co=async()=>Eo("Layout.handleWorkspaceRefresh");const bo=async(t,n=0)=>{const e="HandleMessagePort.handleMessagePort2";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker",t,e,n)};const Mo=async t=>{await Eo("ClipBoard.writeText",t)};const Ao=async()=>Eo("ClipBoard.readText");const Lo=(t,n,e)=>Eo("ExtensionHostManagement.activateByEvent",t,n,e);const Po=async t=>{const n="TextMeasurement.handleMessagePort";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToTextMeasurementWorker",t,n,0)};const Fo=async(t,n)=>{const e="Extensions.handleMessagePort";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker",t,e,n)};const Wo=async t=>await Eo("Preferences.get",t);const To=async(t,n,e)=>{await Eo("Main.openUri",t,n,e)};const Ro=async t=>{await xo("SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker",t,"HandleMessagePort.handleMessagePort2")};const Do={__proto__:null,activateByEvent:Lo,getPreference:Wo,handleWorkspaceRefresh:Co,invoke:Eo,invokeAndTransfer:xo,openUri:To,readClipBoardText:Ao,readFile:vo,sendMessagePortToExtensionHostWorker:bo,sendMessagePortToExtensionManagementWorker:Fo,sendMessagePortToOpenerWorker:ko,sendMessagePortToSyntaxHighlightingWorker:Ro,sendMessagePortToTextMeasurementWorker:Po,set:Io,showContextMenu2:So,writeClipBoardText:Mo};const{invoke:Oo,set:Bo}=_n(Je);const No={__proto__:null,invoke:Oo,set:Bo};const Ho=t=>{let n;let e;const o=async()=>{const n=await e();Un(t,n)};const s=async()=>{if(!n){n=o()}await n};return{async invoke(n,...e){await s();const o=$n(t);return o.invoke(n,...e)},async invokeAndTransfer(n,...e){await s();const o=$n(t);return o.invokeAndTransfer(n,...e)},setFactory(t){e=t}}};const zo=async(t,n,e)=>{w(t);await Lo(t,n,e)};const Uo=t=>t;const $o=6;const Yo=async(t,n,e)=>{const o=await Rn({commandMap:{},isMessagePortOpen:true,async send(e){await xo("IpcParent.create",{method:$o,name:t,port:e,raw:true,url:n})}});if(e){await o.invoke(e)}return o};const _o=async()=>{const t="Color Picker Worker";const n="colorPickerWorkerMain.js";return Yo(t,n)};const Vo={};const jo=()=>{if(!Vo.workerPromise){Vo.workerPromise=_o()}return Vo.workerPromise};const qo=async(t,...n)=>{const e=await jo();return await e.invoke(t,...n)};const Go=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;await qo("ColorPicker.create",o,c,r,s,e,n);await qo("ColorPicker.loadContent",o);const i=await qo("ColorPicker.diff2",o);const a=await qo("ColorPicker.render2",o,i);return{...t,commands:a}};const Xo=n();const{getCommandIds:Zo,registerCommands:Qo,wrapGetter:Ko}=Xo;const Jo=t=>Xo.get(t);const ts=()=>{const t=Xo.getKeys();return t.map(String)};const ns=(t,n,e)=>{Xo.set(t,n,e)};const es=[];const os=41;const ss=9;const cs=0;const rs=16;const is=51;const as=11;const ds=38;const ls=52;const us=(t,n,e,o,s,c,r,i)=>{g(t);const a={additionalFocus:0,assetDir:i,charWidth:0,columnWidth:0,completionState:"",completionTriggerCharacters:[],completionUid:0,cursorInfos:[],cursorWidth:2,debugEnabled:false,decorations:[],deltaX:0,deltaY:0,diagnostics:[],diagnosticsEnabled:false,differences:[],embeds:[],finalDeltaY:0,finalY:0,focus:0,focused:false,focusKey:cs,fontFamily:"",fontSize:0,fontWeight:0,handleOffset:0,handleOffsetX:0,hasListener:false,height:c,highlightedLine:-1,id:t,incrementalEdits:es,initial:true,invalidStartIndex:0,isAutoClosingBracketsEnabled:false,isAutoClosingQuotesEnabled:false,isAutoClosingTagsEnabled:false,isMonospaceFont:false,isQuickSuggestionsEnabled:false,isSelecting:false,itemHeight:20,languageId:"",letterSpacing:0,lineCache:[],lineNumbers:false,lines:[],longestLineWidth:0,maxLineY:0,minimumSliderSize:20,minLineY:0,modified:false,numberOfLines:0,numberOfVisibleLines:0,platform:r,primarySelectionIndex:0,redoStack:[],rowHeight:0,savedSelections:[],scrollBarHeight:0,scrollBarWidth:0,selectionAnchorPosition:{columnIndex:0,rowIndex:0},selectionAutoMovePosition:{columnIndex:0,rowIndex:0},selectionInfos:[],selections:new Uint32Array,tabSize:0,textInfos:[],tokenizerId:0,uid:t,undoStack:[],uri:n,validLines:[],visualDecorations:[],widgets:[],width:s,x:e,y:o};ns(t,a,a)};const fs="compositionUpdate";const hs="contentEditableInput";const gs="delete";const ms="deleteHorizontalRight";const ws="deleteLeft";const ps="editorCut";const ys="editorPasteText";const Es="editorSnippet";const xs="editorType";const Is="editorTypeWithAutoClosing";const Ss="format";const ks="indentLess";const vs="indentMore";const Cs="insertLineBreak";const bs="lineComment";const Ms="rename";const As="toggleBlockComment";const Ls=Object.create(null);const Ps=(t,n)=>{Ls[t]=n};const Fs=t=>Ls[t];const Ws=t=>Fs(t);const Ts=async(t,n,e)=>{const o=Ws(n.id);if(e.length===1&&e[0].origin===xs&&o.handleEditorType){const n=await o.handleEditorType(t);return{...n}}if(e.length===1&&e[0].origin===ws&&o.handleEditorDeleteLeft){const n=await o.handleEditorDeleteLeft(t);return{...n}}return n};const Rs=async(t,n)=>{const e=t.widgets||[];if(e.length===0){return e}let o=t;for(const s of e){o=await Ts(t,s,n)}return o};const Ds=(t,n,e)=>{g(t);g(n);g(e);return Math.min(Math.max(t,n),e)};const Os="Link";const Bs="Function";const Ns="Parameter";const Hs="Type";const zs="VariableName";const Us="Class";const $s=1;const Ys=2816;const _s=2817;const Vs=2824;const js=2825;const qs=2956;const Gs=2857;const Xs=3072;const Zs=3073;const Qs=3077;const Ks=3088;const Js=1792;const tc=1793;const nc=512;const ec=513;const oc=769;const sc=1024;const cc=1536;const rc=1537;const ic=1544;const ac=1545;const dc=2048;const lc=2049;const uc=2056;const fc=2057;const hc=2064;const gc=2080;const mc=2081;const wc=2088;const pc=2089;const yc=2313;const Ec=2560;const xc=2561;const Ic=2569;const Sc=2584;const kc=256;const vc=257;const Cc=272;const bc=t=>{switch(t){case $s:return Os;case sc:case cc:case rc:case ic:case ac:case nc:case ec:case oc:return Hs;case Js:case tc:return Ns;case dc:case lc:case uc:case fc:case hc:case gc:case mc:case wc:case pc:case yc:case Ec:case xc:case Ic:case Sc:return zs;case kc:case vc:case Cc:return Us;case Ys:case _s:case Vs:case js:case qs:case Gs:case Xs:case Zs:case Qs:case Ks:return Bs;default:return`Unknown-${t}`}};const Mc=t=>structuredClone(t);const Ac=t=>Mc(t);const Lc={warned:[]};const Pc=t=>{const n=[];for(const e of t){h(e);n.push(e.type,e.length)}return n};const Fc=(t,n)=>{if(Lc.warned.includes(n)){return}Lc.warned.push(n);console.warn(`tokenizers without hasArrayReturn=false are deprecated (language ${t})`)};const Wc=(t,n,e,o,s)=>{try{const c=n(e,o);if(!c?.tokens||!c.state){throw new Error("invalid tokenization result")}if(!s){Fc(t,n);c.tokens=Pc(c.tokens)}return c}catch(t){console.error(t);return{lineState:o,tokens:[0,e.length]}}};const Tc={TopLevelContent:1};const Rc={Text:1};const Dc={[Rc.Text]:"Text"};const Oc={state:Tc.TopLevelContent};const Bc=true;const Nc=(t,n)=>({state:n.state,tokens:[Rc.Text,t.length]});const Hc={__proto__:null,State:Tc,TokenMap:Dc,TokenType:Rc,hasArrayReturn:Bc,initialLineState:Oc,tokenizeLine:Nc};const zc={enabled:false};const Uc=t=>{zc.enabled=t};const $c=()=>zc.enabled;const{invoke:Yc,set:_c}=No;const Vc={pending:Object.create(null),tokenizePaths:Object.create(null),tokenizers:Object.create(null)};const jc=t=>Object.hasOwn(Vc.tokenizers,t);const qc=(t,n)=>{Vc.tokenizers[t]=n};const Gc=t=>Vc.tokenizers[t];const Xc=(t,n)=>{Vc.tokenizePaths[t]=n};const Zc=t=>Vc.tokenizePaths[t]||"";const Qc=t=>{for(const n of t){if(n&&n.id&&n.tokenize){Xc(n.id,n.tokenize)}}};const Kc=t=>Object.hasOwn(Vc.pending,t);const Jc=Object.create(null);const tr=(t,n)=>{Jc[t]=n};const nr=t=>Jc[t]||{};const er=async(t,n)=>{if(!n){return}Xc(t,n);if($c()){const e=await Yc("Tokenizer.load",t,n);tr(t,e);return}try{const e=await import(n);if(typeof e.tokenizeLine!=="function"){console.warn(`tokenizer.tokenizeLine should be a function in "${n}"`);return}if(!e.TokenMap||typeof e.TokenMap!=="object"||Array.isArray(e.TokenMap)){console.warn(`tokenizer.TokenMap should be an object in "${n}"`);return}tr(t,e.TokenMap);qc(t,e)}catch(t){console.error(t)}};const or=t=>{if(jc(t)){return Gc(t)}if(Kc(t)){return Hc}return Hc};const sr=Object.create(null);const cr=(t,n)=>{sr[t]=n};const rr=t=>sr[t]||Hc;const ir=(t,n,e,o,s,c,r)=>{const i=or(e);if(o!==n.length&&i&&i!==Hc){const a=o===0&&s===n.length;const d=n.slice(o,s);const l=Wc(t,i.tokenizeLine,d,c[e]||Ac(i.initialLineState),i.hasArrayReturn);c[e]=l;if(l.embeddedLanguage){const n=ir(t,d,l.embeddedLanguage,l.embeddedLanguageStart,l.embeddedLanguageEnd,c,r);if(n?.isFull){return n}}return{isFull:a,result:l,TokenMap:i.TokenMap}}r.push(e);c[e]=undefined;return{isFull:false,result:{},TokenMap:[]}};const ar=(t,n,e,o)=>{const s=[];const c=[];const r=Object.create(null);for(const i of o){const o=e[i+1];const a=n[i];if(o.embeddedLanguage){const{embeddedLanguage:n,embeddedLanguageEnd:e,embeddedLanguageStart:i}=o;if(a.length===0){const t={tokens:[]};o.embeddedResultIndex=c.length;c.push({isFull:true,result:t,TokenMap:[]})}else{o.embeddedResultIndex=c.length;c.push(ir(t,a,n,i,e,r,s))}}else{for(const t of Object.keys(r)){r[t]=undefined}}}return{embeddedResults:c,tokenizersToLoad:s}};const dr=(t,n,e)=>t<n?n:e;const lr=(t,n,e)=>{const{invalidStartIndex:o,languageId:s,lineCache:c,lines:r,tokenizerId:i}=t;const a=rr(i);const{hasArrayReturn:d,initialLineState:l,tokenizeLine:u}=a;const f=o;const h=dr(o,e,f);const g=[];const m=[];const w=[];for(let t=f;t<h;t++){const n=t===0?Ac(l):c[t];const e=r[t];const o=Wc(s,u,e,n,d);c[t+1]=o;if(o.embeddedLanguage){o.embeddedResultIndex=w.length;w.push(t)}}const p=c.slice(n+1,e+1);if(w.length>0){const{embeddedResults:n,tokenizersToLoad:e}=ar(s,r,c,w);t.invalidStartIndex=0;return{embeddedResults:n,tokenizersToLoad:e,tokens:p}}t.invalidStartIndex=Math.max(o,h);return{embeddedResults:m,tokenizersToLoad:g,tokens:p}};const ur=Object.create(null);const fr=async(t,n,e,o)=>{if($c()){if(o){const{id:o,invalidStartIndex:s,languageId:c,lines:r}=t;let i=true;let a=r;if(ur[o]===r){i=false;a=[]}else{ur[o]=r}const d={invalidStartIndex:s,languageId:c};return Yc("GetTokensViewport.getTokensViewport",d,n,e,i,o,a)}return Yc("GetTokensViewport.getTokensViewport",t,n,e,true,t.id,t.lines)}return lr(t,n,e)};const hr=async t=>{for(const n of t){const t=Zc(n);await er(n,t)}};const gr=".";const mr='"';const wr="";const pr="\n";const yr=" ";const Er="\t";const xr=(t,n,e)=>{if(n){return t.replaceAll(Er,()=>yr.repeat(e))}return t};const Ir=t=>t.includes(Er);const Sr=(t,n,e)=>{const o=t.length;const s=e.length;t.length=o+s;for(let e=o-1;e>=n;e--){t[e+s]=t[e]}for(let o=0;o<s;o++){t[o+n]=e[o]}};const kr=(t,n,e,o)=>{const s=t.splice(n,e);Sr(t,n,o);return s};const vr=t=>t.join("\n");const Cr=/^\s+/;const br=t=>{const n=t.match(Cr);if(!n){return""}return n[0]};const Mr=(t,n)=>{h(t);m(n);const e=[...t.lines];let o=0;for(const s of n){const n=s.start.rowIndex+o;const c=s.end.rowIndex+o;const r=s.start.columnIndex;const i=s.end.columnIndex;const{deleted:a,inserted:d}=s;g(n);g(c);g(r);g(i);m(d);m(a);if(n===c){const o=e[n];if(d.length===0){const t=o.slice(0,r);const s=o.slice(i);e[n]=t+s}else if(d.length===1){let t=o.slice(0,r);if(r>o.length){t+=" ".repeat(r-o.length)}const s=o.slice(i);const c=d[0];e[n]=t+c+s}else{const s=o.slice(0,r)+d[0];const c=d.at(-1)+o.slice(i);kr(e,n,a.length,[s,...d.slice(1,-1),c]);t.maxLineY=Math.min(t.numberOfVisibleLines,e.length)}}else{const o=e[n].slice(0,r)+d[0];if(d.length===1){const t=c>=e.length?"":e[c].slice(i);kr(e,n,a.length,[o+t])}else{const t=d.slice(1,-1);const s=d.at(-1)+(c>=e.length?"":e[c].slice(i));kr(e,n,a.length,[o,...t,s])}t.maxLineY=Math.min(t.numberOfVisibleLines,t.lines.length)}o+=d.length-a.length}return e};const Ar=(t,n)=>t.lines[n];const Lr=t=>vr(t.lines);const Pr=(t,n)=>{h(t);const e=n.start.rowIndex;const o=n.start.columnIndex;const s=Math.min(n.end.rowIndex,t.lines.length-1);const c=n.end.columnIndex;if(e===s){return[t.lines[e].slice(o,c)]}const r=[t.lines[e].slice(o),...t.lines.slice(e+1,s),t.lines[s].slice(0,c)];return r};const Fr=async(t,n,e)=>{h(t);g(n);g(e);let o=0;let s=0;const{lines:c}=t;const r=Math.min(n,t.lines.length);while(s<r){o+=c[s].length+1;s++}o+=e;return o};const Wr=(t,n,e)=>{h(t);g(n);g(e);let o=0;let s=0;const{lines:c}=t;const r=Math.min(n,t.lines.length);while(s<r){o+=c[s].length+1;s++}o+=e;return o};const Tr=(t,n)=>{const{lines:e}=t;let o=0;let s=0;let c=0;while(o<e.length&&c<n){c+=e[o].length+1;o++}if(c>n){o--;c-=e[o].length+1;s=n-c}else{s=c-n}return{columnIndex:s,rowIndex:o}};const Rr=10;const Dr=(t,n)=>{let e=0;let o=0;let s=0;const c=t.length;for(let r=0;r<c;r+=2){const c=t[r+1];o+=c;e=o;if(e>=n){e-=c;o-=c;s=r;break}}return{end:o,start:e,startIndex:s}};const Or=(t,n,e)=>{for(const[o,{end:s}]of t){if(o<e&&s>n){return true}}return false};const Br=(t,n)=>{for(const[e,o]of t){if(e<=n&&o.end>n){return o}}return undefined};const Nr=(t,n,e,o,s,c,r,i,a,d,l,u)=>{const f=[];const h=new Map;for(let t=0;t<o.length;t+=4){const n=o[t];const c=o[t+1];const r=o[t+2];const i=n-s;const a=i+c;if(i<e.length&&a>0){const t=bc(r);if(t){h.set(Math.max(0,i),{className:t,end:Math.min(e.length,a)})}}}const g=t[n.embeddedResultIndex];const m=g.result.tokens;const w=g.TokenMap;const p=m.length;let{end:y,start:E,startIndex:x}=Dr(m,l);const I=zr(E,d,a);for(let t=x;t<p;t+=2){const n=m[t];const o=m[t+1];const s=E+o;const i=Or(h,E,s);if(i){let t=E;while(t<s){const o=Br(h,t);let i;let a;let d;if(o){i=Math.min(s,o.end);a=e.slice(t,i);const c=w[n]||"Unknown";d=`Token ${c} ${o.className}`}else{let o=s;for(const[n]of h){if(n>t&&n<s){o=Math.min(o,n)}}i=o;a=e.slice(t,i);d=`Token ${w[n]||"Unknown"}`}const l=xr(a,c,r);f.push(l,d);t=i}}else{const t=e.slice(E,s);const o=`Token ${w[n]||"Unknown"}`;const i=xr(t,c,r);f.push(i,o)}E=s;y=s;if(y>=u){break}}return{difference:I,lineInfo:f}};const Hr=()=>({maxOffset:Infinity,minOffset:0});const zr=(t,n,e)=>{const o=t*n;const s=o-e;return s};const Ur=(t,n,e,o,s,c,r,i,a,d,l,u,f)=>{const h=[];const g=new Map;for(let n=0;n<o.length;n+=4){const e=o[n];const s=o[n+1];const r=o[n+2];const i=e-c;const a=i+s;if(i<t.length&&a>0){const n=bc(r);if(n){g.set(Math.max(0,i),{className:n,end:Math.min(t.length,a)})}}}const{tokens:m}=n;let{end:w,start:p,startIndex:y}=Dr(m,u);const E=zr(p,l,d);const x=m.length;for(let n=y;n<x;n+=2){const e=m[n];const o=m[n+1];const c=p+o;const a=Or(g,p,c);if(a){let n=p;while(n<c){const o=Br(g,n);let a;let d;let l;if(o){a=Math.min(c,o.end);d=t.slice(n,a);const r=s[e]||"Unknown";l=`Token ${r} ${o.className}`}else{let o=c;for(const[t]of g){if(t>n&&t<c){o=Math.min(o,t)}}a=o;d=t.slice(n,a);l=`Token ${s[e]||"Unknown"}`}const u=xr(d,r,i);h.push(u,l);n=a}}else{const n=t.slice(p,c);const o=`Token ${s[e]||"Unknown"}`;const a=xr(n,r,i);h.push(a,o)}p=c;w=c;if(w>=f){break}}return{difference:E,lineInfo:h}};const $r=(t,n,e,o,s,c,r,i,a,d,l)=>{const{maxOffset:u,minOffset:f}=Hr();if(e.length>0&&n.embeddedResultIndex!==undefined){const s=e[n.embeddedResultIndex];if(s?.isFull){return Nr(e,n,t,o,c,r,i,a,d,l,f,u)}}return Ur(t,n,e,o,s,c,r,i,a,d,l,f,u)};const Yr=(t,n,e,o,s,c,r,i,a)=>{const d=[];const l=[];const{decorations:u,languageId:f,lines:h}=t;const g=nr(f);let m=c;const w=2;for(let t=o;t<s;t++){const s=h[t];const c=Ir(s);const f=[];for(let t=0;t<u.length;t+=4){const n=u[t];const e=u[t+1];const o=u[t+2];const c=u[t+3];if(n>=m&&n<m+s.length){f.push(n,e,o,c)}}const{difference:p,lineInfo:y}=$r(s,n[t-o],e,f,g,m,c,w,r,i,a);d.push(y);l.push(p);m+=s.length+1}return{differences:l,result:d}};const _r=async(t,n)=>{const{charWidth:e,deltaX:o,lines:s,minLineY:c,numberOfVisibleLines:r,width:i}=t;const a=Math.min(c+r,s.length);let{embeddedResults:d,tokenizersToLoad:l,tokens:u}=await fr(t,c,a,n);for(let e=0;l.length>0&&e<Rr;e++){await hr(l);const e=await fr(t,c,a,n);({embeddedResults:d,tokenizersToLoad:l,tokens:u}=e)}const f=await Fr(t,c,0);const h=e;const{differences:g,result:m}=Yr(t,u,d,c,a,f,i,o,h);return{differences:g,textInfos:m}};const Vr=(t,n,e,o)=>{const s=t/n*(e-o);if(!Number.isFinite(s)){return 0}return s};const jr=Vr;const qr=(t,n,e)=>{if(t>=n){return 0}return Math.max(Math.round(t**2/n),e)};const Gr=(t,n)=>{if(t>n){return 0}return t**2/n};const Xr=(t,n,e)=>{const o=n/2;if(e<=o){return{handleOffset:e,percent:0}}if(e<=t-o){return{handleOffset:o,percent:(e-o)/(t-n)}}return{handleOffset:n-t+e,percent:1}};const Zr={enabled:false};const Qr=t=>{Zr.enabled=t};const Kr=()=>Zr.enabled;const Jr=async(t,n)=>{h(t);g(n);const{deltaY:e,finalDeltaY:o,height:s,itemHeight:c,numberOfVisibleLines:r,scrollBarHeight:i}=t;const a=Ds(n,0,o);if(e===a){return t}const d=Math.floor(a/c);const l=d+r;const u=jr(a,o,s,i);const f={...t,deltaY:a,maxLineY:l,minLineY:d,scrollBarY:u};const m=Kr();const{differences:w,textInfos:p}=await _r(f,m);const y={...f,differences:w,textInfos:p};return y};const ti=async(t,n)=>{if(!n.undoStack){return es}if(t.undoStack===n.undoStack){return es}const e=n.undoStack.at(-1);if(e&&e.length===1){const o=e[0];if(o.origin===xs){const{rowIndex:e}=o.start;const{lines:s}=n;const c=t.lines[e];const r=s[e];const i=await Yc("TokenizeIncremental.tokenizeIncremental",n.uid,n.languageId,c,r,e,n.minLineY);if(i&&i.length===1){return i}}}return es};const ni=(t,n)=>t.matchAll(n).toArray();const ei=/(?:https?|ftps?|file):\/\/[^\s"']+|www\.[^\s"']+/g;const oi=/^(?:https?|ftp|ftps|file):\/\//;const si=/^www\./;const ci=".,;:!?";const ri={")":"(","]":"[","}":"{",">":"<"};const ii=(t,n)=>{const e=ri[n];let o=0;for(const s of t){if(s===e){o++}else if(s===n){o--}}return o<0};const ai=t=>{let n=t;while(n.length>0){const t=n.at(-1);if(!t){break}if(ci.includes(t)){n=n.slice(0,-1);continue}if(t in ri&&ii(n,t)){n=n.slice(0,-1);continue}break}return n};const di=t=>{const n=ni(t,ei);const e=[];for(const t of n){const n=ai(t[0]);if(oi.test(n)||si.test(n)){e.push({length:n.length,start:t.index??0})}}return e};const li=t=>{const n=[];const{lines:e}=t;let o=0;for(const t of e){const e=di(t);for(const t of e){const e=o+t.start;n.push(e,t.length,$s,0)}o+=t.length+1}return n};const ui=(t,n)=>{const{decorations:e,lines:o}=t;for(let t=0;t<e.length;t+=4){const s=e[t];const c=e[t+1];const r=e[t+2];if(r===$s&&n>=s&&n<s+c){let t=0;for(const n of o){const e=n.length+1;if(t+e>s){const e=s-t;const o=n.slice(e,e+c);return o}t+=e}}}return undefined};const fi=1;const hi=Object.create(null);const gi=(t,n)=>{g(t);g(n);if(!Object.hasOwn(hi,t)){hi[t]=[]}if(!hi[t].includes(n)){hi[t].push(n)}};const mi=(t,n)=>{g(t);g(n);if(Object.hasOwn(hi,t)){const e=hi[t].indexOf(n);if(e!==-1){hi[t].splice(e,1)}}};const wi=t=>{g(t);return hi[t]||[]};const pi=async(t,n,...e)=>{g(t);w(n);const o=wi(t);const s=o.map(async t=>{try{const o=$n(t);if(o){await o.invoke(n,...e)}}catch(n){console.warn(`Failed to notify listener ${t}:`,n)}});await Promise.all(s)};const yi=(t,n,e=t.columnWidth)=>{const o=n.x??t.x;const s=n.y??t.y;const c=n.width??t.width;const r=n.height??t.height;const i=Math.floor(r/t.itemHeight);const a=t.lines.length;const d=Math.max(a-i,0);const l=d*t.itemHeight;const u=Math.min(t.deltaY,l);const f=Math.floor(u/t.itemHeight);const h=Math.min(f+i,a);const g=a*t.rowHeight;const m=qr(r,g,t.minimumSliderSize);return{...t,columnWidth:e,deltaY:u,finalDeltaY:l,finalY:d,height:r,maxLineY:h,minLineY:f,numberOfVisibleLines:i,scrollBarHeight:m,width:c,x:o,y:s}};const Ei=t=>{if(!t){return[""]}return t.split("\n")};const{invoke:xi}=Do;const Ii=async t=>{try{await xi("Main.handleModifiedStatusChange",t,true)}catch{}};const Si=(t,n)=>{const e=t[n];const o=t[n+1];const s=t[n+2];const c=t[n+3];if(e>s||e===s&&o>=c){return[s,c,e,o,1]}return[e,o,s,c,0]};const ki=t=>{let n=0;for(const e of t){if(e===Er){n++}}return n};const vi=/^\p{ASCII}*$/u;const Ci=t=>vi.test(t);const bi=async(t,n)=>t.length*n;const Mi=async(t,n,e,o,s,c,r)=>{const i=await po("TextMeasurement.measureTextWidth",t,n,e,o,s,c,r);return i};const Ai=async(t,n,e,o,s,c,r)=>{if(c&&Ci(t)){return await bi(t,r)}return await Mi(t,n,e,o,s,c,r)};const Li=async(t,n,e,o,s,c,r,i,a,d,l,u=0)=>{if(!t){return 0}w(t);g(i);g(a);g(d);p(c);g(l);g(u);if(n===0){return 0}if(n*l>d){return d}const f=Ir(t);const h=xr(t,f,i);const m=ki(t.slice(0,n));const y=h.slice(0,n+m);const E=await Ai(y,e,o,s,r,c,l);return E-a+u};const Pi=(t,n,e)=>(t-n)*e;const Fi=t=>`${t}px`;const Wi=(t,n,e,o)=>new Uint32Array([t,n,e,o]);const Ti=t=>new Uint32Array(t);const Ri=t=>Ti(t.length);const Di=(t,n)=>{const e=Ri(t);for(let o=0;o<e.length;o+=4){const[s,c,r,i]=Si(t,o);n(e,o,s,c,r,i)}return e};const Oi=(t,n)=>{for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];n(o,s,c,r)}};const Bi=(t,n,e,o)=>{t[n]=t[n+2]=e;t[n+1]=t[n+3]=o};const Ni=(t,n,e,o)=>t===e&&n===o;const Hi=(t,n,e,o)=>t===e;const zi=(t,n)=>{for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];if(!n(o,s,c,r)){return false}}return true};const Ui=t=>zi(t,Ni);const $i=t=>zi(t,Hi);const Yi=(t,n)=>{const e=Ti(t.length*4);let o=0;for(const s of t){const{end:t,start:c}=n(s);e[o++]=c.rowIndex;e[o++]=c.columnIndex;e[o++]=t.rowIndex;e[o++]=t.columnIndex}return e};const _i=[];const Vi=(t,n)=>{if(!n){return _i}const e=[];for(let n=0;n<t.length;n+=2){const o=t[n];const s=t[n+1];e.push(`${Fi(o)} ${Fi(s)}`)}return e};const ji=t=>{const n=[];for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];n.push(Fi(o),Fi(s),Fi(c),Fi(r))}return n};const qi=async t=>{const n=[];const e=[];const{charWidth:o,cursorWidth:s,differences:c,focused:r,fontFamily:i,fontSize:a,fontWeight:d,isMonospaceFont:l,letterSpacing:u,lines:f,maxLineY:h,minLineY:g,rowHeight:m,selections:w,tabSize:p,width:y}=t;const E=o;const x=s/2;for(let t=0;t<w.length;t+=4){const[o,s,r,I,S]=Si(w,t);if(r<g||o>h){continue}const k=r-g;const v=c[k];const C=f[r];const b=await Li(C,I,d,a,i,l,u,p,x,y,E,v);const M=Pi(r,g,m);if(Ni(o,s,r,I)&&b>0){n.push(b,M);continue}const A=Pi(o,g,m);const L=o-g;const P=c[L];if(o===r){const t=await Li(C,s,d,a,i,l,u,p,x,y,E,P);if(S){n.push(t,M)}else if(b>=0){n.push(b,M)}const o=b-t;e.push(t,A,o,m)}else{if(o>=g){const t=f[o];const c=await Li(t,s,d,a,i,l,u,p,x,y,E,P);const r=await Li(t,t.length,d,a,i,l,u,p,x,y,E,P);const h=Pi(o,g,m);const w=r-c;if(S){n.push(c,h)}e.push(c,h,w,m)}const t=Math.max(o+1,g);const w=Math.min(r,h);for(let n=t;n<w;n++){const t=f[n];const o=Pi(n,g,m);const s=n-g;const r=c[s];const h=await Li(t,t.length,d,a,i,l,u,p,x,y,E,r);e.push(0,o,h,m)}if(r<=h){const t=b;e.push(0,M,t,m);if(!S){n.push(t,M)}}}}return{cursorInfos:Vi(n,r),selectionInfos:ji(e)}};const Gi=t=>{const{inserted:n,start:e}=t;const o=e.rowIndex;const s=e.columnIndex;const c=n.length;if(c===1){const t={columnIndex:n.at(-1).length+s,rowIndex:o+c-1};return{end:t,start:t}}const r={columnIndex:s,rowIndex:o+c-1};return{end:r,start:r}};const Xi=(t,n)=>{h(t);return{...t,selections:n}};const Zi=(t,n)=>{h(t);m(n);const e=Yi(n,Gi);return e};const Qi=(t,n)=>Jr(t,n);const Ki=(t,n)=>Qi(t,t.deltaY+n);const Ji=t=>t.origin===Is;const ta=(t,n)=>{const{autoClosingRanges:e=[]}=t;const o=[];const s=n[0];const c=s.start.rowIndex;const r=s.start.columnIndex;const i=s.end.rowIndex;const a=s.end.columnIndex;for(let t=0;t<e.length;t+=4){const n=e[t];const d=e[t+1];const l=e[t+2];const u=e[t+3];if(i===l&&a===u||c===n&&r>=d&&i===l&&a<=u){const t=s.inserted[0].length-s.deleted[0].length;o.push(n,d,l,u+t)}}if(Ji(s)){o.push(c,r+1,i,a+1)}return o};const na=(t,n)=>Xi(t,n);const ea=async(t,n,e=undefined)=>{h(t);m(n);if(n.length===0){return t}const o=Mr(t,n);const s={...t,lines:o};const c=e||Zi(s,n);const r=Math.min(t.invalidStartIndex,n[0].start.rowIndex);const i=ta(t,n);const a={...s,autoClosingRanges:i,invalidStartIndex:r,lines:o,modified:true,redoStack:[],selections:c,undoStack:[...t.undoStack,n]};const d=li(a);const l={...a,decorations:d};ns(t.uid,t,l);if(!t.modified){await Ii(t.uri)}try{await pi(fi,"handleEditorChanged",t.uid,t.uri,n)}catch(t){console.warn("Failed to notify editor change listeners:",t)}const u=await ti(t,l);const f=await Rs(l,n);const g={...l,...f,incrementalEdits:u};if(u!==es){return g}const w=Kr();const{differences:p,textInfos:y}=await _r(g,w);return{...g,differences:p,textInfos:y}};const oa=async(t,n)=>{h(t);m(n);if(n.length===0){return t}const e=Mr(t,n);const o={...t,lines:e};const s=Zi(o,n);const c=Math.min(t.invalidStartIndex,n[0].start.rowIndex);const r={...o,invalidStartIndex:c,lines:e,selections:s};const i=await ti(t,r);const a={...r,incrementalEdits:i};if(i!==es){return a}const d=Kr();const{differences:l,textInfos:u}=await _r(a,d);return{...a,differences:l,textInfos:u}};const sa=async(t,n)=>{const e=Mr(t,n);const o=n[0].start.rowIndex;const s={...t,invalidStartIndex:o,lines:e,redoStack:[],undoStack:[...t.undoStack,n]};const c=await ti(t,s);const r={...s,incrementalEdits:c};if(c!==es){return r}const i=Kr();const{differences:a,textInfos:d}=await _r(r,i);return{...r,differences:a,textInfos:d}};const ca=t=>t.selections&&t.selections.length>0;const ra=(t,n,e,o,s,c)=>yi(t,{height:s,width:o,x:n,y:e},c);const ia=(t,n)=>{const e=Ei(n);const{itemHeight:o,minimumSliderSize:s,numberOfVisibleLines:c}=t;const r=e.length;const i=Math.min(c,r);const a=Math.max(r-c,0);const d=a*o;const l=e.length*t.rowHeight;const u=qr(t.height,l,s);return{...t,finalDeltaY:d,finalY:a,lines:e,maxLineY:i,scrollBarHeight:u}};const aa={cursorInfos:[],debugEnabled:false,decorations:[],deltaX:0,deltaY:0,diagnostics:[],differences:[],embeds:[],focused:false,hasListener:false,height:0,highlightedLine:-1,incrementalEdits:es,isSelecting:false,languageId:"",lineCache:[],lines:[],longestLineWidth:0,maxLineY:0,minLineY:0,redoStack:[],scrollBarHeight:0,selectionAnchorPosition:{columnIndex:0,rowIndex:0},selectionAutoMovePosition:{columnIndex:0,rowIndex:0},selectionInfos:[],selections:new Uint32Array,textInfos:[],tokenizerId:0,undoStack:[],uri:"",width:0,x:0,y:0};const da="ExtensionHostHover.execute";const la="ExtensionHost.executeTabCompletionProvider";const ua="ExtensionHostTextDocument.syncFull";const{invoke:fa,set:ha}=lo;const ga=t=>{w(t);return t.lastIndexOf(gr)};const ma=(t,n)=>t.lastIndexOf(gr,n);const wa=(t,n)=>{for(const e of t){if(e&&e.extensions&&Array.isArray(e.extensions)&&e.extensions.includes(n)){return e.id}}return""};const pa=(t,n)=>{for(const e of t){if(e&&e.fileNames&&Array.isArray(e.fileNames)&&e.fileNames.includes(n)){return e.id}}return""};const ya=(t,n)=>{w(t);const e=ga(t);const o=t.slice(e);const s=o.toLowerCase();const c=wa(n,s);if(c){return c}const r=t.toLowerCase();const i=ma(t,e-1);const a=t.slice(i);const d=wa(n,a);if(d){return d}const l=pa(n,r);if(l){return l}return"unknown"};const Ea=async(t,n)=>{g(t);w(n);const e=await ho(t,n);return e};const xa=async(t,n,e,o)=>await Ai("a",t,n,e,o,false,0);const Ia=async t=>{const n=await Wo(t);return n};const Sa="onDiagnostic";const ka="onHover";const va="onTabCompletion";const Ca=async({args:t,assetDir:n,editor:e,event:o,method:s,noProviderFoundMessage:c,noProviderFoundResult:r=undefined,platform:i})=>{const a=`${o}:${e.languageId}`;await zo(a,n,i);const d=await fa(s,e.uid,...t);return d};const ba=t=>({documentId:t.id||t.uid,languageId:t.languageId,text:Lr(t),uri:t.uri});const Ma=async t=>{const n=ba(t);return uo("Extensions.executeDiagnosticProvider",n)};const Aa=async t=>{const n=await Ma(t);if(n.length>0){return n}const{assetDir:e,platform:o}=t;return Ca({args:[],assetDir:e,editor:t,event:Sa,method:"ExtensionHost.executeDiagnosticProvider",noProviderFoundMessage:"no diagnostic provider found",platform:o})};const La=t=>t.type;const Pa=async(t,n)=>{const e=[];const{charWidth:o,fontFamily:s,fontSize:c,fontWeight:r,isMonospaceFont:i,letterSpacing:a,lines:d,minLineY:l,rowHeight:u,tabSize:f,width:h}=t;for(const t of n){const{columnIndex:n,endColumnIndex:g,rowIndex:m}=t;const w=g-n;const p=w*o;const y=0;const E=0;const x=await Li(d[m],n,r,c,s,i,a,f,E,h,o,y);const I=Pi(m,l,u)-u;e.push({height:u,type:La(t),width:p,x:x,y:I})}return e};const Fa=(t,n)=>{const e=li(t);const o=[...e,...n];const s=[];for(let t=0;t<o.length;t+=4){s.push({length:o[t+1],modifiers:o[t+3],offset:o[t],type:o[t+2]})}s.sort((t,n)=>t.offset-n.offset);const c=[];for(const t of s){c.push(t.offset,t.length,t.type,t.modifiers)}return c};const Wa=async t=>{try{const n=Lr(t);await fa(ua,t.uri,t.id,t.languageId,n);const e=await Aa(t);const o=Jo(t.id);if(!o){return t}const s=await Pa(o.newState,e);const c=s.flatMap(t=>[t.offset,t.length,t.type,t.modifiers||0]);const r=Fa(o.newState,c);const i={...o.newState,decorations:r,diagnostics:e,visualDecorations:s};ns(t.id,o.oldState,i);await Eo("Editor.rerender",t.id);return i}catch(n){if(n&&n.message.includes("No diagnostic provider found")){return t}console.error(`Failed to update diagnostics: ${n}`);return t}};const Ta=async({assetDir:t,columnToReveal:n,completionTriggerCharacters:e,content:o,diagnosticsEnabled:s,fontFamily:c,fontSize:r,fontWeight:i,formatOnSave:a,height:d,hoverEnabled:l,id:u,isAutoClosingBracketsEnabled:f,isAutoClosingQuotesEnabled:h,isAutoClosingTagsEnabled:m,isMonospaceFont:p,isQuickSuggestionsEnabled:y,languageId:E,letterSpacing:x,lineNumbers:I,lineToReveal:S,links:k,platform:v,rowHeight:C,savedDeltaY:b,savedSelections:M,tabSize:A,uri:L,useFunctionalRendering:P,width:F,x:W,y:T})=>{g(u);w(o);const R=await xa(i,r,c,x);const D=await Ea(v,t);const O=ya(L,D);const B={assetDir:t,charWidth:R,columnWidth:0,completionState:"",completionTriggerCharacters:e,completionUid:0,cursorInfos:[],cursorWidth:2,decorations:[],deltaX:0,deltaY:0,diagnostics:[],diagnosticsEnabled:s,differences:[],finalDeltaY:0,finalY:0,focused:false,focusKey:cs,fontFamily:c,fontSize:r,fontWeight:i,handleOffset:0,handleOffsetX:0,hasListener:false,height:d,id:u,incrementalEdits:es,invalidStartIndex:0,isAutoClosingBracketsEnabled:f,isAutoClosingQuotesEnabled:h,isAutoClosingTagsEnabled:m,isMonospaceFont:p,isQuickSuggestionsEnabled:y,isSelecting:false,itemHeight:20,languageId:O,letterSpacing:x,lineCache:[],lineNumbers:I,lines:[],longestLineWidth:0,maxLineY:0,minimumSliderSize:20,minLineY:0,modified:false,numberOfVisiblelines:0,numberOfVisibleLines:0,platform:v,primarySelectionIndex:0,redoStack:[],rowHeight:C,savedSelections:M,scrollBarHeight:0,scrollBarWidth:0,selectionAnchorPosition:{columnIndex:0,rowIndex:0},selectionAutoMovePosition:{columnIndex:0,rowIndex:0},selectionInfos:[],selections:new Uint32Array,tabSize:A,textInfos:[],tokenizerId:0,uid:u,undoStack:[],uri:L,useFunctionalRendering:P,validLines:[],widgets:[],width:F,x:W,y:T};const N=ra(B,W,T,F,d,9);const H=ia(N,o);let z;if(S&&n){const t=S*C;z=await Jr(H,t)}else{z=await Jr(H,0)}const U=li(z);const $={...z,decorations:U};const Y=Kr();const{differences:_,textInfos:V}=await _r($,Y);const j={...$,differences:_,focus:ro,focused:true,textInfos:V};ns(u,aa,j);await fa(ua,L,u,E,o);if(s){await Wa(j)}const q=await Ia("editor.completionsOnType");const G=Boolean(q);ns(u,aa,{...j,completionsOnType:G})};const Ra=(t,n)=>t.rowHeight===n.rowHeight&&t.deltaY===n.deltaY&&t.finalDeltaY===n.finalDeltaY&&t.height===n.height&&t.deltaX===n.deltaX&&t.longestLineWidth===n.longestLineWidth&&t.minimumSliderSize===n.minimumSliderSize&&t.width===n.width&&t.scrollBarHeight===n.scrollBarHeight;const Da=(t,n)=>{if(!n.focused){return true}if(!t.isSelecting&&n.isSelecting){return false}return t.focused===n.focused&&t.focus===n.focus};const Oa=(t,n)=>t.cursorInfos===n.cursorInfos&&t.diagnostics===n.diagnostics&&t.highlightedLine===n.highlightedLine&&t.lineNumbers===n.lineNumbers&&t.loadError===n.loadError&&t.textInfos===n.textInfos&&t.differences===n.differences&&t.initial===n.initial&&t.selectionInfos===n.selectionInfos;const Ba=6;const Na=7;const Ha=11;const za=12;const Ua=13;const $a=(t,n)=>t.widgets===n.widgets;const Ya=[Oa,Da,Da,Ra,$a];const _a=[za,Ba,Na,Ha,Ua];const Va=(t,n)=>{const e=[];for(let o=0;o<Ya.length;o++){const s=Ya[o];if(!s(t,n)){e.push(_a[o])}}return e};const ja=t=>{const{newState:n,oldState:e}=Jo(t);const o=Va(e,n);return o};const qa=t=>{const n=[];for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];if(e===0&&o!==0){n.push(o-1,s,o-1,s)}n.push(o,s,c,r)}return new Uint32Array(n)};const Ga=t=>{const{selections:n}=t;const e=qa(n);return{...t,selections:e}};const Xa=(t,n)=>{const e=[];for(let o=0;o<t.length;o+=4){const s=t[o];const c=t[o+1];const r=t[o+2];const i=t[o+3];e.push(s,c,r,i);if(o===t.length-4&&r<n){e.push(r+1,i,r+1,i)}}return new Uint32Array(e)};const Za=t=>{const{lines:n,selections:e}=t;const o=Xa(e,n.length);return{...t,selections:o}};const Qa=(t,n)=>{const e=[];for(const o of n){const n=Tr(t,o.startOffset);const s=Tr(t,o.endOffset);const c=Pr(t,{end:s,start:n});const r={deleted:c,end:s,inserted:Ei(o.inserted),origin:Ss,start:n};if(r.inserted.length===0){r.inserted=[""]}e.push(r)}return e};const Ka=(...t)=>{console.warn(...t)};const Ja=(...t)=>{console.error(...t)};const td=(t,n)=>{if(!Array.isArray(n)){Ka("something is wrong with format on save",n);return t}if(n.length===0){return t}const e=Qa(t,n);return ea(t,e)};const nd=async(t,n)=>{h(t);m(n);return ea(t,n)};const ed=(t,n)=>{const e=[];for(const o of n){if(o.uri===t.uri){for(const n of o.edits){const o=Tr(t,n.offset);const s=Tr(t,n.offset+n.deleted);const c=Pr(t,{end:s,start:o});const r={deleted:c,end:s,inserted:[n.inserted],origin:Ms,start:o};e.push(r)}}}return e};const od=async(t,n)=>{h(t);m(n);const e=ed(t,n);if(e.length===0){return t}return ea(t,e)};const sd=t=>{if(!t.focused){return t}const n={...t,focused:false};return n};const cd=(t,n,e,o)=>{const s=[];const c=n.length;for(let r=0;r<c;r+=4){const[c,i,a,d]=Si(n,r);const l={columnIndex:i,rowIndex:c};const u={columnIndex:d,rowIndex:a};const f={end:u,start:l};s.push({deleted:Pr(t,f),end:u,inserted:e,origin:o,start:l})}return s};const rd=(t,n,e)=>{const{selections:o}=t;return cd(t,o,n,e)};const id=async(t,n,e,o,s,c,r,i,a,d)=>{for(let l=n;l<t.length;l++){const n=await Ai(t.slice(0,l),s,c,r,i,a,d);if(o-n<e/2){return l}}return t.length};const ad=()=>"Segmenter"in Intl;const dd=()=>{const t=new Intl.Segmenter;return{at(n,e){const o=t.segment(n);return o.containing(e)},getSegments:n=>t.segment(n),modelIndex(n,e){const o=t.segment(n);let s=0;for(const t of o){if(s>=e){return t.index}s++}return n.length},visualIndex(n,e){const o=t.segment(n);let s=0;for(const t of o){if(t.index>=e){return s}s++}return s}}};const ld=async(t,n,e,o,s,c,r,i)=>{const a=dd();const d=a.getSegments(t);const l=false;const u=0;for(const n of d){const a=await Ai(t.slice(0,n.index),s,c,r,i,l,u);if(o-a<e){return n.index}}return t.length};const ud=(t,n)=>{const e=Math.round(t/n);return e};const fd=(t,n,e)=>{let o=n;for(let s=0;s<n;s++){if(t[s]===Er){o-=e-1}}return o};const hd=async(t,n,e,o,s,c,r,i,a)=>{w(t);g(n);g(e);w(o);g(s);p(c);g(r);g(i);g(a);const d=ud(a,r);const l=Ir(t);const u=fd(t,d,i);const f=t.slice(0,u);const h=xr(f,l,i);const m=await Ai(h,n,e,o,s,c,r);const y=Ci(t);if(y){if(Math.abs(a-m)<r/2){return u}return await id(t,u,r,a,n,e,o,s,c,r)}return await ld(t,u,r,a,n,e,o,s)};const gd=async(t,n,e)=>{h(t);g(n);g(e);const{charWidth:o,deltaX:s,deltaY:c,fontFamily:r,fontSize:i,fontWeight:a,isMonospaceFont:d,letterSpacing:l,lines:u,rowHeight:f,tabSize:m,x:w,y:p}=t;const y=Math.floor((e-p+c)/f);if(y<0){return{columnIndex:0,rowIndex:0}}const E=n-w+s;const x=Ds(y,0,u.length-1);const I=u[x];const S=await hd(I,a,i,r,l,d,o,m,E);return{columnIndex:S,rowIndex:x}};const md=(t,n,e)=>{const{columnWidth:o,x:s}=t;const c=e*o+s;return c};const wd=(t,n)=>{const{rowHeight:e,y:o}=t;const s=(n+1)*e+o;return s};const pd={timeout:-1};const yd=async(t,n,e,o,s)=>{h(t);g(n);g(e);w(o);const c=md(t,n,e);const r=wd(t,n);const i=o;await Eo("Editor.showOverlayMessage",t,"Viewlet.send",t.uid,"showOverlayMessage",c,r,i);if(!s){const n=()=>{xd(t)};pd.timeout=setTimeout(n,3e3)}return t};const Ed=async(t,n,e,o)=>yd(t,n,e,o,true);const xd=async t=>{clearTimeout(pd.timeout);pd.timeout=-1;return t};const Id=String;const Sd=t=>{switch(t){case"(":return")";case"[":return"]";case"{":return"}";default:return"???"}};const kd=async(t,n)=>{try{const e=Wr(t,t.cursor);const o=await Eo("ExtensionHostBraceCompletion.executeBraceCompletionProvider",t,e,n);if(o){const e=Sd(n);const o=n+e;const s=rd(t,[o],xs);return ea(t,s)}const s=rd(t,[n],xs);return ea(t,s)}catch(n){console.error(n);const e=Array.isArray(t.cursor)?t.cursor[0]:t.cursor;return Ed(t,e,Id(n))}};const vd=t=>{const{selections:n}=t;if(n.length===4&&n[0]===n[2]&&n[1]===n[3]){return t}const e=Ti(4);Bi(e,0,n[0],n[1]);return na(t,e)};const Cd=(t,n)=>{for(const[e,o]of t.entries()){if(o.id===n){return e}}return-1};const bd=(t,n)=>{const e=Cd(t,n);const o=[...t.slice(0,e),...t.slice(e+1)];return o};const Md=t=>t.id===Fe;const Ad=t=>{const{widgets:n}=t;const e=n.findIndex(Md);if(e===-1){return t}const o=bd(n,Fe);return{...t,focused:true,widgets:o}};const Ld=t=>t.id===De;const Pd=t=>{const{widgets:n}=t;const e=n.findIndex(Ld);if(e===-1){return t}const o=bd(n,De);return{...t,focused:true,widgets:o}};const Fd=async()=>{const t="Rename Worker";const n="renameWorkerMain.js";const e=await Yo(t,n);await e.invoke("Rename.initialize");return e};const Wd={};const Td=()=>{if(!Wd.workerPromise){Wd.workerPromise=Fd()}return Wd.workerPromise};const Rd=async(t,...n)=>{const e=await Td();return await e.invoke(t,...n)};const Dd=t=>t.id===Be;const Od=async t=>{const{uid:n,widgets:e}=t;const o=e.findIndex(Dd);if(o===-1){return t}const s=e[o];await Rd("Rename.close",s.newState.uid);const c=Jo(n);const{newState:r}=c;return r};const Bd=t=>t.id===Ne;const Nd=t=>{const{widgets:n}=t;const e=n.findIndex(Bd);if(e===-1){return t}const o=bd(n,Ne);return{...t,widgets:o}};const Hd=(t,n)=>{for(const e of t){if(e.id===n){return true}}return false};const zd=async(t,n,e,o,s,c)=>{const{widgets:r}=e;if(Hd(r,t)){return e}const i=o();i.newState.editorUid=e.uid;const a=await s(i.newState,e.uid);a.editorUid=e.uid;const d={...i,newState:a};const l=[...r,d];const u=!c;const f={...e,additionalFocus:c?0:n,focus:c?n:ro,focused:u,widgets:l};return f};const Ud=()=>Math.random();const $d=()=>{const t=Ud();const n={id:We,newState:{commands:[],height:0,uid:t,width:0,x:0,y:0},oldState:{commands:[],height:0,uid:t,width:0,x:0,y:0}};return n};const Yd=(t,n)=>Go(t,n);const _d=async t=>zd(We,os,t,$d,Yd);const Vd={compositionText:"",isComposing:false};const jd=(t,n)=>{Vd.isComposing=true;return t};const qd=(t,n)=>{const e=[];for(let o=0;o<t.length;o+=4){const s=t[o];const c=t[o+1];const r=t[o+2];const i=t[o+3];const a=c-Vd.compositionText.length;e.push({deleted:[Vd.compositionText],end:{columnIndex:i,rowIndex:r},inserted:[n],origin:fs,start:{columnIndex:a,rowIndex:s}})}return e};const Gd=(t,n)=>{const{selections:e}=t;const o=qd(e,n);Vd.compositionText=n;return ea(t,o)};const Xd=(t,n)=>{const{selections:e}=t;const o=qd(e,n);Vd.isComposing=false;Vd.compositionText="";return ea(t,o)};const Zd=async t=>{try{w(t);await Mo(t)}catch(t){throw new k(t,"Failed to write text to clipboard")}};const Qd=(t,n,e,o,s,c)=>{if(n){const n=t[s].length;return{end:{columnIndex:n,rowIndex:e},start:{columnIndex:0,rowIndex:e}}}return{end:{columnIndex:c,rowIndex:s},start:{columnIndex:o,rowIndex:e}}};const Kd=(t,n,e,o)=>t===e&&n===o;const Jd=async t=>{if(!ca(t)){return t}const{lines:n,selections:e}=t;const o=e[0];const s=e[1];const c=e[2];const r=e[3];const i=Kd(o,s,c,r);const a=Qd(n,i,o,s,c,r);const d=Pr(t,a);const l=vr(d);const u=i?"\n"+l:l;await Zd(u);return t};const tl=t=>{const{selections:n}=t;const e=[];for(let t=0;t<n.length;t+=4){const o=n[t];g(o);e.push(o)}const o=[...new Set(e)].toSorted((t,n)=>t-n);const s=o.map(n=>{const e={columnIndex:0,rowIndex:n};return{deleted:[""],end:e,inserted:[Ar(t,n),""],start:e}});const c=new Uint32Array(o.length*4);for(let t=0;t<o.length;t++){const n=o[t]+t+1;c[t*4]=n;c[t*4+1]=0;c[t*4+2]=n;c[t*4+3]=0}return ea(t,s,c)};const nl=t=>{const{selections:n}=t;const e=n[0];const o={columnIndex:0,rowIndex:e};const s=[{deleted:[""],end:o,inserted:[Ar(t,e),""],start:o}];return ea(t,s)};const el=(t,n,e,o)=>{if(n===0){if(t===0){return{columnIndex:0,rowIndex:0}}return{columnIndex:e[t-1].length,rowIndex:t-1}}const s=o(e[t],n);return{columnIndex:n-s,rowIndex:t}};const ol=(t,n,e,o)=>{t[n]=e;t[n+1]=o};const sl=(t,n,e,o)=>{t[n]=t[n+2]=e;t[n+1]=t[n+3]=o};const cl=(t,n,e,o,s,c)=>{if(o===0){if(e===0){t[n]=0;t[n+1]=0}else{t[n]=e-1;t[n+1]=s[e-1].length}}else{const r=c(s[e],o);t[n]=e;t[n+1]=o-r}};const rl=(t,n,e)=>{const o=new Uint32Array(t.length);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=Si(t,s);if(c===i&&r===a){if(c===0&&r===0){o[s]=0;o[s+1]=0;o[s+2]=0;o[s+3]=0}else{cl(o,s,c,r,n,e);cl(o,s+2,c,r,n,e)}}else{sl(o,s,t[s],t[s+1])}}return o};const il=(t,n)=>{const{lines:e,selections:o}=t;const s=rl(o,e,n);return na(t,s)};const al=(t,n)=>{if(!ad()){return 1}if(n>t.length){return 1}const e=dd();const o=e.at(t,n-1);if(!o){return 1}return n-o.index};const dl=()=>2;const ll=(t,n)=>{if(!ad()){return 1}const e=dd();const o=e.at(t,n);return o.segment.length};const ul=t=>t===yr||t===Er;const fl=(t,n)=>{if(t.length===0){return 0}for(let e=0;e<n;e++){if(!ul(t[e])){return n-e}}return n};const hl=(t,n)=>t.length-n;const gl=(t,n)=>{for(const e of n){const n=t.match(e);if(n){return n[0].length}}return 1};const ml=/(?<![A-Z])[A-Z]+\s*$/;const wl=/[\u{C0}-\u{17F}\w\-]+>?\s*$/u;const pl=/[a-zA-Z]+[^a-zA-Z\d]+\s*$/;const yl=/\s+$/;const El=/[^a-zA-Z\d]+\s*$/;const xl=[ml,wl,pl,yl,El];const Il=(t,n)=>{const e=t.slice(0,n);return gl(e,xl)};const Sl=/^\s*[\u{C0}-\u{17F}\w]+/iu;const kl=/^[^a-zA-Z\d]+\w*/;const vl=[Sl,kl];const Cl=(t,n)=>{const e=t.slice(n);return gl(e,vl)};const bl=/(?<![A-Z])[A-Z]{2}[a-z]+$/;const Ml=/(?=[A-Z]+)[A-Z][a-z]+$/;const Al=/[A-Z]+[a-z]+\d?\s*$/;const Ll=/[A-Z]+\d*\s*$/;const Pl=/[a-z]+\d*\s*$/;const Fl=/[A-Z]*[a-z]+_+\s*$/;const Wl=/(?<![A-Z])[A-Z]_+\s*$/;const Tl=/[a-z]+\s*$/;const Rl=/[^a-zA-Z\d\s]+\s*$/;const Dl=[bl,Ml,Al,Ll,Pl,Fl,Wl,Tl,Rl];const Ol=(t,n)=>{const e=t.slice(0,n);return gl(e,Dl)};const Bl=/^\s*[a-z]+\d?/;const Nl=/^\s*[A-Z]{2}[a-z\d]+/;const Hl=/^\s*[A-Z]+(?=[A-Z][a-z]+)/;const zl=/^\s*[A-Z]+[a-z]*\d*/;const Ul=/^\s*_+[a-z]*\d?/;const $l=/^\s*[^\da-zA-Z\s]+/;const Yl=[Bl,Hl,zl,Ul,$l];const _l=[Bl,Nl,Hl,zl,Ul,$l];const Vl=/[A-Z]/;const jl=(t,n)=>{const e=t.slice(n);if(Vl.test(t[n-1])){return gl(e,Yl)}return gl(e,_l)};const ql=t=>il(t,al);const Gl=(t,n,e)=>{const{rowIndex:o}=t;const{columnIndex:s}=t;if(s>=n[o].length){if(o>=n.length){return t}return{columnIndex:0,rowIndex:o+1}}const c=e(n[o],s);return{columnIndex:s+c,rowIndex:o}};const Xl=(t,n,e,o,s,c)=>{if(e>=s.length){return}const r=s[e];if(o>=r.length){t[n]=t[n+2]=e+1;t[n+1]=t[n+3]=0}else{const s=c(r,o);t[n]=t[n+2]=e;t[n+1]=t[n+3]=o+s}};const Zl=(t,n,e)=>{const o=new Uint32Array(t.length);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=Si(t,s);if(c===i&&r===a){Xl(o,s,c,r,n,e)}else{o[s]=o[s+2]=i;o[s+1]=o[s+3]=a}}return o};const Ql=(t,n)=>{const{lines:e,selections:o}=t;const s=Zl(o,e,n);return na(t,s)};const Kl=t=>Ql(t,ll);const Jl=(t,n,e,o,s,c)=>{Bi(t,n,s+1,c)};const tu=t=>Di(t,Jl);const nu=t=>{const{selections:n}=t;const e=tu(n);return na(t,e)};const eu=t=>Ql(t,hl);const ou=t=>il(t,fl);const su=(t,n,e)=>{h(t);g(n);g(e);const o=Wi(n,e,n,e);return na(t,o)};const cu=(t,n,e,o,s,c)=>{if(e===0){Bi(t,n,0,0)}else{Bi(t,n,e-1,o)}};const ru=t=>Di(t,cu);const iu=(t,n,e,o)=>{const{selections:s}=t;const c=ru(s);return na(t,c)};const au=t=>iu(t);const du=t=>il(t,Il);const lu=t=>il(t,Ol);const uu=t=>Ql(t,jl);const fu=t=>Ql(t,Cl);const hu=async t=>{const{lines:n,selections:e}=t;const o=new Set;const s=[];for(let t=0;t<e.length;t+=4){const[n]=Si(e,t);if(!o.has(n)){o.add(n);s.push(n)}}const c=new Uint32Array(s.length*4);const r=new Uint32Array(s.length*4);const i=[];for(let t=0;t<s.length;t++){const e=s[t];const o=n[e];const a=t*4;c[a]=e;c[a+1]=0;c[a+2]=e;c[a+3]=o.length;r[a]=e;r[a+1]=0;r[a+2]=e;r[a+3]=0;i.push(o)}const a=cd(t,c,[""],ps);await Zd(vr(i));return ea(t,a,r)};const gu=async t=>{const n=rd(t,[""],ps);const e=n.map(t=>vr(t.deleted)).filter(t=>t.length>0);const o=vr(e);await Zd(o);return ea(t,n)};const mu=async t=>{const{selections:n}=t;if(Ui(n)){return hu(t)}return gu(t)};const wu=t=>{const{lines:n}=t;const e=n.length-1;const o=n.at(-1).length;const s={columnIndex:0,rowIndex:0};const c={columnIndex:o,rowIndex:e};const r=[{deleted:Pr(t,{end:c,start:s}),end:c,inserted:[""],origin:gs,start:s}];return ea(t,r)};const pu=(t,n,e)=>{const o=[];const s=(n,s,c,r)=>{const i=el(n,s,t,e);const a={columnIndex:r,rowIndex:c};o.push({deleted:Pr({lines:t},{end:a,start:i}),end:a,inserted:[""],origin:ws,start:i})};Oi(n,s);return o};const yu=(t,n,e,o,s)=>{if(!Ni(n,e,o,s)){return false}if(e<1){return false}for(let o=0;o<t.length;o+=4){const s=t[o];const c=t[o+1];if(n===s&&e===c){return true}}return false};const Eu=(t,n)=>{for(let e=0;e<n.length;e+=4){const[o,s,c,r]=Si(n,e);if(!yu(t,o,s,c,r)){return false}}return true};const xu=t=>{const{lines:n,selections:e}=t;for(let t=0;t<e.length;t+=4){e[t+1]++;e[t+3]++}const o=pu(n,e,dl);return ea(t,o)};const Iu=(t,n)=>{const{autoClosingRanges:e=[],lines:o,selections:s}=t;if(Eu(e,s)){return xu(t)}if(Ui(s)){const e=pu(o,s,n);return ea(t,e)}const c=rd(t,[""],ws);return ea(t,c)};const Su=t=>Iu(t,fl);const ku=(t,n)=>{const{selections:e}=t;if(Ui(e)){const o=[];const{lines:s}=t;for(let c=0;c<e.length;c+=4){const[r,i]=Si(e,c);const a={columnIndex:i,rowIndex:r};const d=Gl(a,s,n);o.push({deleted:Pr(t,{end:d,start:a}),end:d,inserted:[""],origin:ms,start:a})}return o}const o=rd(t,[""],ms);return o};const vu=(t,n)=>{const e=ku(t,n);return ea(t,e)};const Cu=t=>vu(t,hl);const bu=t=>{const n=Iu(t,al);return n};const Mu=t=>vu(t,ll);const Au=t=>{const n=Iu(t,Il);return n};const Lu=t=>{const n=Iu(t,Ol);return n};const Pu=t=>vu(t,jl);const Fu=t=>vu(t,Cl);const Wu=async t=>{await Eo("SideBar.show","References",true);return t};const Tu=async t=>{const n={documentId:t.id||t.uid,languageId:t.languageId,text:Lr(t),uri:t.uri};return uo("Extensions.executeFormattingProvider",n)};const Ru="Failed to execute formatting provider: FormattingError:";const Du=t=>t&&t instanceof Error&&t.message.startsWith(Ru);const Ou="Failed to execute formatting provider: FormattingError:";const Bu=async t=>{try{const n=await Tu(t);return td(t,n)}catch(n){if(Du(n)){console.error("Formatting Error:",n.message.slice(Ou.length));return t}console.error(n);const e=String(n);await yd(t,0,0,e,true);return t}};const Nu=/^[\w\-]+/;const Hu=/[\w\-]+$/;const zu=(t,n)=>{const e=t.slice(0,n);const o=e.match(Hu);const s=t.slice(n);const c=s.match(Nu);let r=wr;if(o){r+=o[0]}if(c){r+=c[0]}return{word:r}};const Uu=(t,n)=>{const e=t.slice(0,n);const o=e.match(Hu);if(o){return o[0]}return wr};const $u=(t,n,e)=>{const{lines:o}=t;const s=o[n];return zu(s,e)};const Yu=(t,n,e)=>{const{lines:o}=t;const s=o[n];return Uu(s,e)};const _u=async(t,n)=>{const e=await Eo("ExtensionHostDefinition.executeDefinitionProvider",t,n);return e};const Vu={};const ju=/\{(PH\d+)\}/g;const qu=(t,n=Vu)=>{if(n===Vu){return t}const e=(t,e)=>n[e];return t.replaceAll(ju,e)};const Gu="Copy";const Xu="Cut";const Zu="Editor: Close Color Picker";const Qu="Editor: Copy Line Down";const Ku="Editor: Copy Line Up";const Ju="Editor: Format Document (forced)";const tf="Editor: Go To Definition";const nf="Editor: Go To Type Definition";const ef="Editor: Indent";const of="Editor: Open Color Picker";const sf="Editor: Select All Occurrences";const cf="Editor: Select Down";const rf="Editor: Select Inside String";const af="Editor: Select Next Occurrence";const df="Editor: Select Up";const lf="Show Hover";const uf="Editor: Sort Lines Ascending";const ff="Editor: Toggle Comment";const hf="Editor: Unindent";const gf="Enter Code";const mf="Escape to close";const wf="Find All Implementations";const pf="Find All References";const yf="Format Document";const Ef="Go to Definition";const xf="Go to Type Definition";const If="Move Line Down";const Sf="Move Line Up";const kf="No definition found";const vf="No definition found for '{PH1}'";const Cf="No type definition found";const bf="No type definition found for '{PH1}'";const Mf="Paste";const Af="Source Action";const Lf="Toggle Block Comment";const Pf=()=>qu(Ef);const Ff=()=>qu(kf);const Wf=t=>qu(vf,{PH1:t});const Tf=t=>qu(bf,{PH1:t});const Rf=()=>qu(Cf);const Df=()=>qu(Af);const Of=()=>qu(mf);const Bf=()=>qu(gf);const Nf=()=>qu(xf);const Hf=()=>qu(pf);const zf=()=>qu(wf);const Uf=()=>qu(Xu);const $f=()=>qu(Gu);const Yf=()=>qu(Mf);const _f=()=>qu(Lf);const Vf=()=>qu(Sf);const jf=()=>qu(If);const qf=()=>qu(yf);const Gf=()=>qu(lf);const Xf=()=>qu(Ju);const Zf=()=>qu(af);const Qf=()=>qu(sf);const Kf=()=>qu(tf);const Jf=()=>qu(nf);const th=()=>qu(rf);const nh=()=>qu(ef);const eh=()=>qu(hf);const oh=()=>qu(uf);const sh=()=>qu(ff);const ch=()=>qu(df);const rh=()=>qu(cf);const ih=()=>qu(of);const ah=()=>qu(Zu);const dh=()=>qu(Qu);const lh=()=>qu(Ku);const uh=async({editor:t,getErrorMessage:n,getLocation:e,getNoLocationFoundMessage:o,isNoProviderFoundError:s})=>{const{selections:c}=t;const r=c[0];const i=c[1];try{const n=await e(t,r,i);if(!n){const n=$u(t,r,i);const e=o(n);return yd(t,r,i,e,false)}if(typeof n.uri!=="string"||typeof n.startOffset!=="number"||typeof n.endOffset!=="number"){return t}const{uri:s}=n;if(s===t.uri){const e=Tr(t,n.startOffset);const o=new Uint32Array([e.rowIndex,e.columnIndex,e.rowIndex,e.columnIndex]);return na(t,o)}const c={endColumnIndex:n.endColumnIndex,endRowIndex:n.endRowIndex,startColumnIndex:n.startColumnIndex,startRowIndex:n.startRowIndex};await To(s,true,c);return t}catch(e){if(s(e)){const o=n(e);await yd(t,r,i,o,false);return t}const o=n(e);await yd(t,r,i,o,true);return t}};const fh=async(t,n,e)=>{const o=Wr(t,n,e);const s=await _u(t,o);return s};const hh=t=>{if(t.word){return Wf(t.word)}return Ff()};const gh=String;const mh=t=>t?.message?.startsWith("Failed to execute definition provider: No definition provider found");const wh=async t=>uh({editor:t,getErrorMessage:gh,getLocation:fh,getNoLocationFoundMessage:hh,isNoProviderFoundError:mh});const ph=t=>{if(t.word){return Tf(t.word)}return Rf()};const yh=async(t,n)=>{const e=await Eo("ExtensionHostTypeDefinition.executeTypeDefinitionProvider",t,n);return e};const Eh=async(t,n,e)=>{const o=Wr(t,n,e);const s=await yh(t,o);return s};const xh=String;const Ih=t=>t?.message?.startsWith("Failed to execute type definition provider: No type definition provider found");const Sh=async(t,n=true)=>uh({editor:t,getErrorMessage:xh,getLocation:Eh,getNoLocationFoundMessage:ph,isNoProviderFoundError:Ih});const kh=t=>{switch(t){case De:return true;default:return false}};const vh=t=>{if(t.length===0){return t}return t.filter(kh)};const Ch=async(t,n)=>{await wo(t,n)};const bh=async(t,n)=>{const{platform:e}=t;const{columnIndex:o,rowIndex:s}=n;const c=Wr(t,s,o);const r=ui(t,c);if(r){await Ch(r,e);return t}const i={...t,selections:new Uint32Array([s,o,s,o])};const a=await wh(i);return a};const Mh=async(t,n)=>{const{selections:e}=t;for(let o=0;o<e.length;o+=4){const[s,c,r,i]=Si(e,o);if(s===n.rowIndex&&c===n.columnIndex&&r===n.rowIndex&&i===n.columnIndex){const n=new Uint32Array(e.length-4);n.set(e.subarray(0,o),0);n.set(e.subarray(o+4),o);return na(t,n)}}const o=new Uint32Array(e.length+4);o.set(e,0);const s=e.length;o[s]=n.rowIndex;o[s+1]=n.columnIndex;o[s+2]=n.rowIndex;o[s+3]=n.columnIndex;return na(t,o)};const Ah=1;const Lh=2;const Ph=(t,n)=>{const e=vh(t.widgets);return{...t,focused:true,selectionAnchorPosition:n,selections:new Uint32Array([n.rowIndex,n.columnIndex,n.rowIndex,n.columnIndex]),widgets:e}};const Fh=t=>{switch(t){case Lh:return bh;case Ah:return Mh;default:return Ph}};const Wh=async(t,n,e,o)=>{h(t);g(n);g(e);g(o);const s=Fh(n);const c=await s(t,{columnIndex:o,rowIndex:e});return c};const Th=3;const Rh=async(t,n,e,o)=>{const{uid:s}=t;await So(s,Th,e,o,{menuId:Th});return t};const Dh=/^[a-zA-Z\u{C0}-\u{17F}\d]+/u;const Oh=/[a-zA-Z\u{C0}-\u{17F}\d]+$/u;const Bh=(t,n,e)=>{const o=t.slice(0,e);const s=t.slice(e);const c=o.match(Oh);const r=s.match(Dh);const i=e-(c?c[0].length:0);const a=e+(r?r[0].length:0);const d=new Uint32Array([n,i,n,a]);return d};const Nh=(t,n,e)=>{const o=Ar(t,n);const s=Bh(o,n,e);return na(t,s)};const Hh=async(t,n,e,o)=>{const s=await gd(t,e,o);return Nh(t,s.rowIndex,s.columnIndex)};const zh=t=>{if(t.focused&&t.focus===ro){return t}return{...t,additionalFocus:0,focus:ro,focused:true}};const Uh=1;const $h=2;const Yh=3;const _h=(t,n)=>{if(t){return Lh}if(n){return Ah}return 0};const Vh=async(t,n,e,o)=>{h(t);g(n);g(e);g(o);const s=await gd(t,e,o);return Wh(t,n,s.rowIndex,s.columnIndex)};const jh=(t,n)=>new Uint32Array([n,0,n,t.length]);const qh=t=>{const{selections:n}=t;const e=n[t.primarySelectionIndex];const o=Ar(t,e);const s=jh(o,e);return na(t,s)};const Gh=(t,n,e,o)=>{h(t);g(e);g(o);return qh(t)};const Xh=0;const Zh=async(t,n,e,o,s,c,r)=>{if(n!==Xh){return t}const i=_h(e,o);let a;switch(r){case $h:a=await Hh(t,i,s,c);break;case Uh:a=await Vh(t,i,s,c);break;case Yh:a=Gh(t,i,s,c);break;default:return t}return{...a,isSelecting:true}};const Qh={editor:undefined,timeout:-1,x:0,y:0};const Kh=()=>Qh;const Jh=(t,n,e,o)=>{Qh.editor=t;Qh.timeout=n;Qh.x=e;Qh.y=o};const tg=async(t,n)=>{};const ng=async()=>{const{editor:t,x:n,y:e}=Kh();await gd(t,n,e);await tg()};const eg=300;const og=(t,n,e)=>{if(!t.hoverEnabled){return t}const o=Kh();if(o.timeout!==-1){clearTimeout(o.timeout)}const s=setTimeout(ng,eg);Jh(t,s,n,e);return t};const sg=(t,n)=>{let e=0;for(let o=0;o<t.length;o++){const s=t[o];e+=s.length;if(e>=n){return o}}return-1};const cg=async(t,n,e)=>{h(t);g(n);g(e);const o=await gd(t,n,e);const s=Wr(t,o.rowIndex,o.columnIndex);try{const n=await _u(t,s);if(!n){return t}const e=Tr(t,n.startOffset);Tr(t,n.endOffset);const o=t.lineCache[e.rowIndex+1];if(!o){return t}const c=sg(o.tokens,e.columnIndex);if(c===-1){return t}return t}catch(n){if(n&&n.message.startsWith("Failed to execute definition provider: No definition provider found")){return t}throw n}};const rg=(t,n)=>new Uint32Array([n.startRowIndex,n.startColumnIndex,n.endRowIndex,n.endColumnIndex]);const ig=(t,n,e)=>{const o=rg(t,e);const s={end:{columnIndex:o[3],rowIndex:o[2]},start:{columnIndex:o[1],rowIndex:o[0]}};const c=[{deleted:Pr(t,s),end:s.end,inserted:[n],origin:hs,start:s.start}];return c};const ag=(t,n,e)=>{const o=ig(t,n,e);return ea(t,o)};const dg=(t,n)=>{const e=rg(t,n);return na(t,e)};const lg=t=>({...t,hasListener:false,isSelecting:false,selectionAutoMovePosition:{columnIndex:0,rowIndex:0}});const ug=async(t,n,e,o,s,c,r)=>t;const fg=(t,n)=>t;const hg=async(t,n,e)=>{await gd(t,n,e)};const gg=t=>{globalThis.requestAnimationFrame(t)};const mg=(t,n)=>t.selections!==n.selections||t.focused!==n.focused||t.minLineY!==n.minLineY||t.maxLineY!==n.maxLineY||t.differences!==n.differences||t.charWidth!==n.charWidth||t.cursorWidth!==n.cursorWidth||t.fontFamily!==n.fontFamily||t.fontSize!==n.fontSize||t.fontWeight!==n.fontWeight||t.isMonospaceFont!==n.isMonospaceFont||t.letterSpacing!==n.letterSpacing||t.lines!==n.lines||t.rowHeight!==n.rowHeight||t.tabSize!==n.tabSize||t.width!==n.width;const wg=(t,n)=>{if(t.textInfos!==n.textInfos||t.differences!==n.differences){return false}return t.lines!==n.lines||t.tokenizerId!==n.tokenizerId||t.minLineY!==n.minLineY||t.maxLineY!==n.maxLineY||t.decorations!==n.decorations||t.embeds!==n.embeds||t.deltaX!==n.deltaX||t.width!==n.width||t.highlightedLine!==n.highlightedLine||t.debugEnabled!==n.debugEnabled};const pg=async(t,n)=>{let e=n;if(wg(t,n)){const t=Kr();const{differences:o,textInfos:s}=await _r(n,t);e={...n,differences:o,textInfos:s}}if(!mg(t,n)){return e}const{cursorInfos:o,selectionInfos:s}=await qi(e);return{...e,cursorInfos:o,selectionInfos:s}};const yg=-1;const Eg=0;const xg=1;const Ig=(t,n)=>{if(t.rowIndex>n.rowIndex){return xg}if(t.rowIndex===n.rowIndex){if(t.columnIndex>n.columnIndex){return xg}if(t.columnIndex<n.columnIndex){return yg}return Eg}return yg};const Sg=(t,n)=>new Uint32Array([t.rowIndex,t.columnIndex,n.rowIndex,n.columnIndex]);const kg=(t,n)=>new Uint32Array([n.rowIndex,n.columnIndex,n.rowIndex,n.columnIndex]);const vg=(t,n)=>new Uint32Array([t.rowIndex,t.columnIndex,n.rowIndex,n.columnIndex]);const Cg=(t,n)=>{switch(Ig(n,t)){case Eg:return kg(t,n);case xg:return vg(t,n);case yg:return Sg(t,n);default:throw new Error("unexpected comparison result")}};const bg=(t,n)=>{const e=t.selectionAnchorPosition;const o=Cg(e,n);return na(t,o)};const Mg=(t,n)=>{const{maxLineY:e,minLineY:o,rowHeight:s}=t;const c=e-o;if(n.rowIndex<o){const e=n.rowIndex;const o=n.rowIndex+c;const r=n.rowIndex*s;const i=t.selectionAnchorPosition;const a=new Uint32Array([n.rowIndex-1,n.columnIndex,i.rowIndex,i.columnIndex]);return{...t,deltaY:r,maxLineY:o,minLineY:e,selections:a}}if(n.rowIndex>e){const c=e-o;const r=n.rowIndex-c;const i=n.rowIndex;const a=r*s;const d=t.selectionAnchorPosition;const l=new Uint32Array([d.rowIndex,d.columnIndex,n.rowIndex+1,n.columnIndex]);return{...t,deltaY:a,maxLineY:i,minLineY:r,selections:l}}return t};const Ag=async t=>{const n=Jo(t);const e=n?.newState;if(!e||!e.hasListener||!e.isSelecting){return}const o=e.selectionAutoMovePosition;if(o.rowIndex===0){return}const s=Mg(e,o);if(e===s){return}const c=o.rowIndex<e.minLineY?-1:1;const r={...s,selectionAutoMovePosition:{columnIndex:o.columnIndex,rowIndex:o.rowIndex+c}};const i=await pg(e,r);ns(e.uid,e,i);gg(()=>Ag(t))};const Lg=async(t,n,e)=>{h(t);g(n);g(e);const o=await gd(t,n,e);const s=bg(t,o);if(!t.hasListener&&(o.rowIndex<t.minLineY||o.rowIndex>t.maxLineY)){gg(()=>Ag(t.uid));return{...s,hasListener:true,selectionAutoMovePosition:o}}return s};const Pg=async(t,n,e,o)=>{if(!t.isSelecting){return t}if(o){return hg(t,n,e)}return Lg(t,n,e)};const Fg=t=>({...t,hasListener:false,isSelecting:false,selectionAutoMovePosition:{columnIndex:0,rowIndex:0}});const Wg=(t,n,e)=>{if(e<=0){return 0}if(e<=t-n/2){return e/(t-n)}return 1};const Tg=(t,n)=>{const{handleOffsetX:e,longestLineWidth:o,width:s,x:c}=t;if(s>o){return{...t,deltaX:0,scrollBarWidth:0}}const r=20;const i=Ds(n,c,c+s);const a=i-c-e;const d=Gr(s,o);const l=o-s+r;const u=Wg(s,d,a);const f=Ds(u,0,1);const h=f*l;return{...t,deltaX:h}};const Rg=(t,n)=>{const{deltaX:e,longestLineWidth:o,width:s,x:c}=t;const r=n-c;const i=Gr(s,o);const a=s-i;const d=Vr(e,a,s,i);const l=r-d;if(l>=0&&l<i){return{...t,handleOffsetX:l}}const{handleOffset:u,percent:f}=Xr(s,i,r);const h=f*a;return{...t,deltaX:h,handleOffsetX:u}};const Dg=(t,n)=>{const{height:e,scrollBarHeight:o}=t;if(n<=e-o/2){return n/(e-o)}return 1};const Og=async(t,n)=>{const{finalDeltaY:e,handleOffset:o=0,y:s}=t;const c=n-s-o;const r=Dg(t,c);const i=r*e;const a=await Qi(t,i);return a};const Bg=Og;const Ng=async(t,n)=>{const{deltaY:e,finalDeltaY:o,height:s,scrollBarHeight:c,y:r}=t;const i=n-r;const a=jr(e,o,s,c);const d=i-a;if(d>=0&&d<c){return{...t,handleOffset:d}}const{handleOffset:l,percent:u}=Xr(s,c,i);const f=u*o;const h=await Qi(t,f);return{...h,handleOffset:l}};const Hg=(t,n)=>{};const zg={deltaY:0,touchOffsetY:0};const Ug=(t,n)=>{if(n.touches.length===0){return}const e=n.touches[0];zg.touchOffsetY=e.y;zg.deltaY=t.deltaY};const $g=(t,n)=>Ki(t,n);const Yg=(t,n)=>Qi(t,n);const _g=(t,n,e,o)=>{g(n);g(e);g(o);const{deltaX:s}=t;if(e===0){return $g(t,o)}const c=Ds(s+e,0,Infinity);return{...$g(t,o),deltaX:c}};const Vg=(t,n)=>{if(n.touches.length===0){return}const e=n.touches[0];const o=zg.deltaY+(zg.touchOffsetY-e.y);Yg(t,o)};const jg=(t,n,e,o)=>_g(t,n,e,o);const qg=t=>{const n=[];const e=[];for(let n=0;n<t.length;n+=4){const o=t[n];const s=t[n+2];for(let t=o;t<=s;t++){e.push(t)}}for(const t of e){n.push({deleted:[" "],end:{columnIndex:2,rowIndex:t},inserted:[""],origin:ks,start:{columnIndex:0,rowIndex:t}})}return n};const Gg=t=>{const{selections:n}=t;const e=qg(n);return ea(t,e)};const Xg=t=>{const n=[];for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+2];for(let t=o;t<=s;t++){n.push(t)}}const e=Array.from(n,t=>({deleted:[""],end:{columnIndex:0,rowIndex:t},inserted:[" "],origin:vs,start:{columnIndex:0,rowIndex:t}}));return e};const Zg=t=>{const{selections:n}=t;const e=Xg(n);return ea(t,e)};const Qg=async t=>Eo("Languages.getLanguageConfiguration",{languageId:t.languageId,uri:t.uri});const Kg=t=>{if(t?.indentationRules?.increaseIndentPattern&&typeof t.indentationRules.increaseIndentPattern==="string"){const n=new RegExp(t.indentationRules.increaseIndentPattern);return n}return undefined};const Jg=(t,n)=>{if(!n){return false}return n.test(t)};const tm=(t,n,e)=>{const o=[];const s=[];const c=Kg(e);for(let e=0;e<n.length;e+=4){const[r,i,a,d]=Si(n,e);const l={columnIndex:i,rowIndex:r};const u={columnIndex:d,rowIndex:a};const f={end:u,start:l};if(Ni(r,i,a,d)){const n=t[r];const e=n.slice(0,i);const a=br(e);if(Jg(e,c)){o.push({deleted:Pr({lines:t},f),end:u,inserted:["",a+" ",a],origin:Cs,start:l});s.push(r+1,a.length+2,r+1,a.length+2)}else{o.push({deleted:Pr({lines:t},f),end:u,inserted:["",a],origin:Cs,start:l});s.push(r+1,a.length,r+1,a.length)}}else{o.push({deleted:Pr({lines:t},f),end:u,inserted:["",""],origin:Cs,start:l});s.push(r+1,0,r+1,0)}}return{changes:o,selectionChanges:new Uint32Array(s)}};const nm=async t=>{const{lines:n,selections:e}=t;const o=await Qg(t);const{changes:s,selectionChanges:c}=tm(n,e,o);return ea(t,s,c)};const em=2;const om=0;const sm=()=>{const t=Ud();const n={id:Fe,newState:{focused:true,focusSource:em,height:0,questions:[],uid:t,width:0,x:0,y:0},oldState:{focused:false,focusSource:om,height:0,questions:[],uid:t,width:0,x:0,y:0}};return n};const cm=async t=>{const n={...t,height:45,width:150,x:100,y:100};return n};const rm=async t=>{const n=true;return zd(Fe,ls,t,sm,cm,n)};const im=()=>{const t=Ud();const n={id:Te,newState:{commands:[],height:0,uid:t,width:0,x:0,y:0},oldState:{commands:[],height:0,uid:t,width:0,x:0,y:0}};return n};const{invoke:am,setFactory:dm}=Ho(qe);const lm=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Jo(n);const{languageId:a}=i;await am("Completions.create",o,c,r,s,e,n,a);await am("Completions.loadContent",o);const d=await am("Completions.diff2",o);const l=await am("Completions.render2",o,d);return{...t,commands:l}};const um=async t=>{const n=false;return zd(Te,ss,t,im,lm,n)};const fm=()=>{const t=Ud();const n={id:De,newState:{commands:[],editorUid:0,height:0,uid:t,width:0,x:0,y:0},oldState:{commands:[],editorUid:0,height:0,uid:t,width:0,x:0,y:0}};return n};const hm=async()=>{const t="Find Widget Worker";const n="findWidgetWorkerMain.js";return Yo(t,n)};const gm=9002;const mm=async()=>{if($n(gm)){return}const t=await hm();Un(gm,t)};const wm=async(t,...n)=>{const e=$n(gm);return await e.invoke(t,...n)};const pm=async()=>{const t=$n(gm);Yn(gm);if(t){await t.dispose()}};const ym=t=>{const n=Jo(t);if(!n){throw new Error(`editor ${t} not found`)}const{newState:e}=n;return e};const Em=async(t,n)=>{const{uid:e}=t;const o=ym(n);const{height:s,width:c,x:r,y:i}=o;await mm();await wm("FindWidget.create",e,r,i,c,s,n);await wm("FindWidget.loadContent",e);const a=await wm("FindWidget.diff2",e);const d=await wm("FindWidget.render2",e,a);return{...t,commands:d}};const xm=(t,n)=>Em(t,n);const Im=async t=>{const n=true;return zd(De,rs,t,fm,xm,n)};const Sm=async t=>Im(t);const km=t=>{const{selections:n}=t;const e=n[0];const o=n[1];const s=md(t,e,o);const c=wd(t,e);return{columnIndex:o,rowIndex:e,x:s,y:c}};const vm=()=>{const t=Ud();const n={id:Be,newState:{commands:[],height:0,uid:t,width:0,x:0,y:0},oldState:{commands:[],height:0,uid:t,width:0,x:0,y:0}};return n};const Cm=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Jo(n);const{languageId:a}=i;await Rd("Rename.create",o,c,r,s,e,n,a);await Rd("Rename.loadContent",o);const d=await Rd("Rename.diff2",o);const l=await Rd("Rename.render2",o,d);return{...t,commands:l}};const bm=async t=>{const{columnIndex:n,rowIndex:e}=km(t);const{word:o}=$u(t,e,n);if(!o){return t}const s=true;return zd(Be,as,t,vm,Cm,s)};const Mm=async t=>{const n=await Ca({args:[],editor:t,event:"onLanguage",method:"ExtensionHostOrganizeImports.execute"});return n};const Am=async t=>{const n=await Mm(t);return td(t,n)};const Lm=(t,n)=>{const e=Ei(n);const o=rd(t,e,ys);return ea(t,o)};const Pm=async t=>{const n=await Ao();w(n);return Lm(t,n)};const Fm=t=>{const{redoStack:n=[]}=t;if(n.length===0){return t}const e=n.at(-1);const o={...t,redoStack:n.slice(0,-1),undoStack:[...t.undoStack,e]};return oa(o,e)};const Wm=t=>{if(!t){return`Error: ${t}`}let{message:n}=t;while(t.cause){t=t.cause;n+=`: ${t}`}return n};const Tm=t=>{if(!t){return{codeFrame:undefined,message:t,stack:undefined,type:"Error"}}const n=Wm(t);if(t.codeFrame){return{codeFrame:t.codeFrame,message:n,stack:t.stack,type:t.constructor.name}}return{category:t.category,codeFrame:t.originalCodeFrame,message:n,stack:t.originalStack,stderr:t.stderr}};const Rm=/\((.*):(\d+):(\d+)\)$/;const Dm=/at (.*):(\d+):(\d+)$/;const Om=t=>{for(const n of t){if(Rm.test(n)||Dm.test(n)){return n}}return""};const Bm=async t=>{try{const n=Ei(t.stack);const e=Om(n);let o=e.match(Rm);if(!o){o=e.match(Dm)}if(!o){return t}const s=vr(n.slice(1));const c=Wm(t);return{message:c,stack:s,type:t.constructor.name}}catch(n){console.warn("ErrorHandling Error");console.warn(n);return t}};const Nm=async t=>{if(t&&t.message&&t.codeFrame){return Tm(t)}if(t&&t.stack){return Bm(t)}return t};const Hm=t=>{if(t&&t.type&&t.message&&t.codeFrame){return`${t.type}: ${t.message}\n\n${t.codeFrame}\n\n${t.stack}`}if(t&&t.message&&t.codeFrame){return`${t.message}\n\n${t.codeFrame}\n\n${t.stack}`}if(t&&t.type&&t.message){return`${t.type}: ${t.message}\n${t.stack}`}if(t&&t.stack){return t.stack}if(t===null){return null}return String(t)};const zm=async t=>{const n=await Nm(t);const e=Hm(n);console.error(e);return n};const Um=async t=>{try{await zm(t)}catch(n){console.warn("ErrorHandling error");console.warn(n);console.error(t)}};const $m=async t=>t;const Ym=t=>t.startsWith("untitled:");const _m=async(t,n)=>{await Eo("FileSystem.writeFile",t,n)};const Vm=async t=>{const n="Save File";const{canceled:e,filePath:o}=await go("Open.showSaveDialog",n,[],t);if(e){return""}return o};const jm=async(t,n,e)=>{const o=await Vm(e);if(!o){return}await Eo("FileSystem.writeFile",o,n);await Co();await Eo("Main.handleUriChange",t,o);return o};const qm=t=>{const n="code"in t?t.code:undefined;return n==="EACCES"||t.message.includes("EACCES:")};const Gm=async t=>{if(qm(t)){await Eo("ElectronDialog.showMessageBox",{buttons:["OK"],defaultId:0,message:"You don't have permission to save changes to this file.",title:"Unable to Save File",type:"error"});return}await Eo("ElectronDialog.showMessageBox",{buttons:["OK"],defaultId:0,detail:t.message,message:"Saving the file failed.",title:"Failed to Save File",type:"error"})};const Xm=async t=>{try{const{platform:n,uri:e}=t;const o=await $m(t);const s=Lr(o);if(Ym(e)){const t=await jm(e,s,n);if(t){return{...o,modified:false,uri:t}}return o}await _m(e,s);return{...o,modified:false}}catch(n){const e=new k(n,`Failed to save file "${t.uri}"`);await Um(e);if(t.platform===je){try{await Gm(e)}catch(t){await Um(t)}}return t}};const Zm=t=>{const{lines:n}=t;const e=0;const o=0;const s=n.length-1;const c=n.at(-1).length;const r=Wi(e,o,s,c);return na(t,r)};const Qm=(t,n,e)=>{const o=Ri(t);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=Si(t,s);cl(o,s+2,c,r,n,e);ol(o,s,i,a)}return o};const Km=(t,n)=>{const{lines:e,selections:o}=t;const s=Qm(o,e,n);return na(t,s)};const Jm=t=>{Km(t,fl)};const tw=/[a-zA-Z\d]/;const nw=t=>tw.test(t);const ew=t=>nw(t)||t==="_";const ow=(t,n)=>{for(let e=n-1;e>=0;e--){if(!ew(t[e])){return e+1}}return 0};const sw=(t,n)=>{for(let e=n;e<t.length;e++){if(!ew(t[e])){return e}}return t.length};const cw=(t,n,e)=>{const o=t[n];const s=ow(o,e);const c=sw(o,e);const r=o.slice(s,c);return{end:c,start:s,word:r}};const rw=(t,n,e)=>{let o=0;if(!t[n+o].endsWith(e[o])){return false}while(++o<e.length-1){if(t[n+o]!==e[o]){return false}}return t[n+o].startsWith(e[o])};const iw=(t,n)=>{if(n.length===0){throw new Error("word length must be greater than zero")}const e=[];for(let o=0;o<t.length;o++){const s=t[o];let c=-n.length;while((c=s.indexOf(n,c+n.length))!==-1){e.push(o,c,o,c+n.length)}}return new Uint32Array(e)};const aw=(t,n)=>{const e=[];for(let o=0;o<t.length-n.length+1;o){if(rw(t,o,n)){e.push(o,t[o].length-n[0].length,o+n.length-1,n.at(-1).length);o+=n.length-1}else{o++}}return new Uint32Array(e)};const dw=(t,n)=>{if(n.length<4){throw new Error("selections must have at least one entry")}const e=0;const o=n[e];const s=n[e+1];const c=n[e+2];const r=n[e+3];if(o===c){if(s===r){const e=cw(t,c,r);if(e.start===e.end){return n}const o=iw(t,e.word);return o}const e=t[o];const i=e.slice(s,r);const a=iw(t,i);return a}const i=[];i.push(t[o].slice(s));for(let n=o+1;n<c-1;n++){i.push(t[n])}i.push(t[c].slice(0,r));const a=aw(t,i);return a};const lw=t=>{const{lines:n,selections:e}=t;const o=dw(n,e);return na(t,o)};const uw=(t,n,e)=>{const o=new Uint32Array(t.length);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=Si(t,s);const d=n[i];o[s]=c;o[s+1]=r;if(a>=d.length){o[s+2]=i+1;o[s+3]=0}else{const t=e(d,a);o[s+2]=i;o[s+3]=a+t}}return o};const fw=(t,n)=>{const{lines:e}=t;const{selections:o}=t;const s=uw(o,e,n);return na(t,s)};const hw=t=>fw(t,hl);const gw=t=>Km(t,al);const mw=t=>fw(t,ll);const ww=(t,n)=>{const e=t.length-1;const o=new Uint32Array(n.length);for(let t=0;t<n.length;t+=4){const[s,c,r,i]=Si(n,t);o[t]=s;o[t+1]=c;o[t+2]=Math.min(r+1,e);o[t+3]=i}return o};const pw=t=>{const{lines:n,selections:e}=t;const o=ww(n,e);return na(t,o)};const yw=(t,n)=>{const e=new Uint32Array(n.length);for(let o=0;o<n.length;o+=4){const[s,c,r,i]=Si(n,o);if(s===r&&c===i){const n=s;let r=c;let a=i;const d=t[n];while(r>0&&d[r]!==mr){r--}r++;while(a<d.length&&d[a]!==mr){a++}e[o]=n;e[o+1]=r;e[o+2]=n;e[o+3]=a}else{e[o]=s;e[o+1]=c;e[o+2]=r;e[o+3]=i}}return e};const Ew=t=>{const{selections:n}=t;const{lines:e}=t;const o=yw(e,n);return na(t,o)};const xw=async(t,n)=>{const e=await Eo("ExtensionHostSelection.executeGrowSelection",t,n);if(e.length===0){return n}return new Uint32Array(e)};const Iw=async t=>{const{selections:n}=t;const e=await xw(t,n);return na(t,e)};const Sw=(t,n)=>{const e=n.length-4;const o=n[e];const s=n[e+1];const c=n[e+3];const r=t[o];const i=r.slice(s,c);const a=r.indexOf(i,c);if(a!==-1){const t=a+i.length;const e=new Uint32Array(n.length+4);e.set(n,0);const s=n.length;e[s]=o;e[s+1]=a;e[s+2]=o;e[s+3]=t;return{revealRange:e.length-4,selectionEdits:e}}for(let e=o+1;e<t.length;e++){const o=t[e];const s=o.indexOf(i);if(s!==-1){const t=s+i.length;const o=new Uint32Array(n.length+4);o.set(n,0);const c=n.length;o[c]=e;o[c+1]=s;o[c+2]=e;o[c+3]=t;return{revealRange:o.length-4,selectionEdits:o}}}let d=0;for(let e=0;e<=o;e++){const o=t[e];let s=-i.length;while((s=o.indexOf(i,s+i.length))!==-1){let t=n[d];while(t<e&&d<n.length){d+=4;t=n[d]}if(t===e){let t=n[d+3];while(t<s&&d<n.length){d+=4;t=n[t+3]}}t=n[d];const o=n[d+1];const c=n[d+3];const r=t===e&&o<=s&&s<=c;if(!r){if(t>e){d-=4}const o=s+i.length;d+=4;const c=new Uint32Array(n.length+4);c.set(n.subarray(0,d),0);c[d]=e;c[d+1]=s;c[d+2]=e;c[d+3]=o;c.set(n.subarray(d),d+4);return{revealRange:c.length-4,selectionEdits:c}}}}return undefined};const kw=t=>{const{lines:n}=t;const{selections:e}=t;if(Ui(e)){const t=new Uint32Array(e.length);for(let o=0;o<e.length;o+=4){const[s,c,r,i]=Si(e,o);const a=cw(n,s,c);t[o]=s;if(a.start===a.end){t[o+1]=c;t[o+2]=r;t[o+3]=i}else{t[o+1]=a.start;t[o+2]=s;t[o+3]=a.end}}return{revealRange:t.length-4,selectionEdits:t}}if($i(t.selections)){return Sw(t.lines,t.selections)}return undefined};const vw=(t,n,e,o)=>e>=t&&o<=n;const Cw=t=>{const n=kw(t);if(!n){return t}const{revealRange:e,selectionEdits:o}=n;const s=o[e];const c=o[e+2];if(vw(t.minLineY,t.maxLineY,s,c)){return na(t,o)}return ea(t,[],o)};const bw=t=>t;const Mw=(t,n)=>{const e=new Uint32Array(n.length);for(let t=0;t<n.length;t+=4){const[o,s,c,r]=Si(n,t);e[t]=Math.max(o-1,0);e[t+1]=s;e[t+2]=c;e[t+3]=r}return e};const Aw=t=>{const{lines:n,selections:e}=t;const o=Mw(n,e);return na(t,o)};const Lw=t=>Km(t,Il);const Pw=t=>fw(t,Cl);const Fw=(t,n,e)=>{if(t.decorations.length===0&&n.length===0){return t}return{...t,decorations:n,diagnostics:e}};const Ww=async(t,n,e)=>{const{tokenizerId:o}=t;Xc(n,e);await er(n,e);const s=or(n);const c=o+1;cr(c,s);const r=ym(t.uid);if(!r){return t}const i=Kr();const{differences:a,textInfos:d}=await _r(t,i);const l=ym(t.uid);if(!l){return t}const u={...l,differences:a,focused:true,textInfos:d};return{...u,invalidStartIndex:0,languageId:n,tokenizerId:c}};const Tw=(t,n)=>{const{maxLineY:e,minLineY:o,rowHeight:s}=t;const c=n[0];if(c<o){const e=c*s;return{...t,deltaY:e,maxLineY:c+1,minLineY:c,selections:n}}if(c>e){const e=c*s;return{...t,deltaY:e,maxLineY:c+1,minLineY:c,selections:n}}return{...t,selections:n}};const Rw=(t,n)=>{w(n);const e=t.lines.length-1;const o=t.lines.at(-1).length;const s={columnIndex:0,rowIndex:0};const c={columnIndex:o,rowIndex:e};const r=[{deleted:Pr(t,{end:c,start:s}),end:c,inserted:Ei(n),origin:xs,start:s}];return ea(t,r)};const Dw=()=>{const t=Ud();const n={id:Oe,newState:{commands:[],content:"",diagnostics:[],documentation:"",editorUid:0,height:0,lineInfos:[],uid:t,width:0,x:0,y:0},oldState:{commands:[],content:"",diagnostics:[],documentation:"",editorUid:0,height:0,lineInfos:[],uid:t,width:0,x:0,y:0}};return n};const Ow=async()=>{const t="Hover Worker";const n="hoverWorkerMain.js";const e="Hover.initialize";const o=await Yo(t,n,e);return o};const Bw={};const Nw=()=>{if(!Bw.workerPromise){Bw.workerPromise=Ow()}return Bw.workerPromise};const Hw=async(t,...n)=>{const e=await Nw();return await e.invoke(t,...n)};const zw=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Jo(n);const{languageId:a}=i;await Hw("Hover.create",o,c,r,s,e,n,a);await Hw("Hover.loadContent",o);const d=await Hw("Hover.diff2",o);const l=await Hw("Hover.render2",o,d);return{...t,commands:l}};const Uw=async t=>{const n=false;return zd(Oe,is,t,Dw,zw,n)};const $w="EditorHover";const Yw=async t=>{await Eo("Viewlet.openWidget",$w);return t};const _w=()=>{const t=Ud();const n={id:Ne,newState:{commands:[],focusedIndex:0,height:0,maxHeight:0,sourceActions:[],uid:t,width:0,x:0,y:0},oldState:{commands:[],focusedIndex:0,height:0,maxHeight:0,sourceActions:[],uid:t,width:0,x:0,y:0}};return n};const Vw=async()=>{const t="Source Action Worker";const n="sourceActionWorkerMain.js";const e="SourceActions.initialize";const o=await Yo(t,n,e);return o};const jw={};const qw=()=>{if(!jw.workerPromise){jw.workerPromise=Vw()}return jw.workerPromise};const Gw=async(t,...n)=>{const e=await qw();return await e.invoke(t,...n)};const Xw=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Jo(n);const{languageId:a}=i;await Gw("SourceActions.create",o,c,r,s,e,n,a);await Gw("SourceActions.loadContent",o);const d=await Gw("SourceActions.diff2",o);const l=await Gw("SourceActions.render2",o,d);return{...t,commands:l}};const Zw=async t=>zd(Ne,ds,t,_w,Xw);const Qw=(t,n)=>t.localeCompare(n);const Kw=t=>{const n=[...t];n.sort(Qw);return n};const Jw="sort-lines-ascending";const tp=(t,n)=>{const e=n[0];const o=n[2];const s=[];for(let c=0;c<n.length;c+=4){const r=n[c];const i=n[c+1];const a=n[c+2];const d=n[c+3];const l={columnIndex:i,rowIndex:r};const u={columnIndex:d,rowIndex:a};const f={end:u,start:l};const h=t.slice(e,o+1);const g=Kw(h);s.push({deleted:Pr({lines:t},f),end:u,inserted:g,origin:Jw,start:l})}return s};const np=t=>{const{lines:n,selections:e}=t;const o=tp(n,e);return ea(t,o)};const ep=async(t,n)=>Ca({args:[n],editor:t,event:va,method:la,noProviderFoundMessage:"No tab completion provider found",noProviderFoundResult:undefined});const op=t=>{const{selections:n}=t;const e=n[0];const o=n[1];const s=Wr(t,e,o);return s};const sp=async t=>{const n=op(t);const e=await ep(t,n);return e};const cp=(t,n,e)=>{const o=Ei(e.inserted);const s=[];const c=[];for(let r=0;r<n.length;r+=4){const[i,a,d,l]=Si(n,r);if(o.length>1){const n=Ar({lines:t},i);const r=br(n);const u=[o[0],...o.slice(1).map(t=>r+t)];const f=[""];s.push({deleted:f,end:{columnIndex:l,rowIndex:d},inserted:u,origin:Es,start:{columnIndex:a-e.deleted,rowIndex:i}});const h=o.at(-1);c.push(d+o.length-f.length,l+h.length,d+o.length-f.length,l+h.length)}else{const t=o[0];const n=t.indexOf("$0");if(n===-1){const t=a-e.deleted;c.push(i,t,i,t);s.push({deleted:[""],end:{columnIndex:l,rowIndex:d},inserted:o,origin:Es,start:{columnIndex:a-e.deleted,rowIndex:i}})}else{const n=t.replace("$0","");const o=l+2;c.push(i,o,i,o);s.push({deleted:[""],end:{columnIndex:l,rowIndex:d},inserted:[n],origin:Es,start:{columnIndex:a-e.deleted,rowIndex:i}})}}}return{changes:s,selectionChanges:new Uint32Array(c)}};const rp=(t,n)=>{const{lines:e,selections:o}=t;const{changes:s,selectionChanges:c}=cp(e,o,n);return ea(t,s,c)};const ip=String;const ap=async t=>{try{const n=await sp(t);if(!n){return t}return rp(t,n)}catch(n){await Um(n);const e=t.selections[0];const o=t.selections[1];return Ed(t,e,o,ip(n))}};const dp=async(t,n)=>{const{assetDir:e,platform:o}=t;try{await zo(`onLanguage:${t.languageId}`,e,o);const s=await fa(`ExtensionHostCommment.execute`,t.uid,n);if(s){return s}}catch{}const s=await Qg(t);if(!s?.comments?.blockComment){return undefined}return s.comments.blockComment};const lp=/^\s+/;const up=/\s+$/;const fp=(t,n,e)=>({deleted:[e],end:{columnIndex:n+e.length,rowIndex:t},inserted:[],origin:As,start:{columnIndex:n,rowIndex:t}});const hp=(t,n,e,o,s,c,r)=>{if(n===o){return[fp(t,e,c),fp(t,s-c.length,r)]}return[fp(n,e,c),fp(o,s,r)]};const gp=(t,n)=>{const{selections:e}=t;const[o]=e;const s=Ar(t,o);const c=t.lines.length;let r=o;let i=-1;const a=n[0];const d=n[1];while(r<c){const n=Ar(t,r);i=n.indexOf(d);if(i!==-1){break}r++}let l=-1;let u=o;while(u>=0){const n=Ar(t,u);l=n.indexOf(a);if(l!==-1){break}u--}const f=[];if(l!==-1&&i!==-1){f.push(...hp(o,u,l,r,i,a,d))}else{const t=s.match(lp);const n=s.match(up);let e=0;let c=s.length;if(t){e+=t[0].length}if(n){c-=n[0].length}const r={deleted:[],end:{columnIndex:e,rowIndex:o},inserted:[a],origin:As,start:{columnIndex:e,rowIndex:o}};const i={deleted:[],end:{columnIndex:c+a.length,rowIndex:o},inserted:[d],origin:As,start:{columnIndex:c+a.length,rowIndex:o}};f.push(r,i)}return f};const mp=async t=>{const n=op(t);const e=await dp(t,n);if(!e){return t}const o=gp(t,e);return sa(t,o)};const wp=async t=>{const n=await Qg(t);if(!n?.comments?.lineComment){return undefined}return n.comments.lineComment};const pp=/^\s+/;const yp=(t,n,e)=>{const o=n.match(pp);const s=o?o[0].length:0;if(n.slice(s).startsWith(e)){if(n[s+e.length]===" "){return{deleted:[e+" "],end:{columnIndex:s+e.length+1,rowIndex:t},inserted:[""],origin:bs,start:{columnIndex:s,rowIndex:t}}}return{deleted:[e],end:{columnIndex:s+e.length,rowIndex:t},inserted:[""],origin:bs,start:{columnIndex:s,rowIndex:t}}}return{deleted:[],end:{columnIndex:s,rowIndex:t},inserted:[`${e} `],origin:bs,start:{columnIndex:s,rowIndex:t}}};const Ep=async t=>{const n=await wp(t);if(!n){return t}const e=t;const o=t.selections[0];const s=Ar(e,o);const c=[yp(o,s,n)];return ea(t,c)};const xp=async t=>{try{const n=await Ep(t);if(t!==n){return n}return mp(t)}catch(n){Ja(n);await yd(t,0,0,String(n),true);return t}};const Ip=async(t,n)=>{const e=rd(t,[n],xs);const o=await ea(t,e);if(o.completionsOnType){const t=await um(o);return t}return o};const Sp="/";const kp="{";const vp="}";const Cp="(";const bp=")";const Mp="[";const Ap="]";const Lp="???";const Pp="'";const Fp='"';const Wp="`";const Tp=t=>{switch(t){case kp:return vp;case Cp:return bp;case Mp:return Ap;default:return Lp}};const Rp=(t,n)=>{const e=Tp(n);const o=n+e;const s=rd(t,[o],Is);const c=new Uint32Array([s[0].start.rowIndex,s[0].start.columnIndex+1,s[0].end.rowIndex,s[0].end.columnIndex+1]);return ea(t,s,c)};const Dp=t=>{const{selections:n}=t;const e=new Uint32Array([n[0],n[1]+1,n[2],n[3]+1]);return na(t,e)};const Op=(t,n)=>{const{autoClosingRanges:e=[],selections:o}=t;if(Eu(e,o)){return Dp(t)}return Ip(t,n)};const Bp=(t,n)=>{const e=n+n;const o=rd(t,[e],Is);const s=new Uint32Array([o[0].start.rowIndex,o[0].start.columnIndex+1,o[0].end.rowIndex,o[0].end.columnIndex+1]);return ea(t,o,s)};const Np=async(t,n)=>{const e=Wr(t,t.selections[0],t.selections[1]);const o=await Eo("ExtensionHostClosingTagCompletion.executeClosingTagProvider",t,e,n);if(!o){const e=rd(t,[n],xs);return ea(t,e)}const s=rd(t,[o.inserted],xs);return ea(t,s)};const Hp=async(t,n)=>{const{isAutoClosingBracketsEnabled:e,isAutoClosingQuotesEnabled:o,isAutoClosingTagsEnabled:s}=t;switch(n){case Sp:if(s){return Np(t,n)}break;case vp:case bp:case Ap:if(e){return Op(t,n)}break;case kp:case Cp:case Mp:if(e){return Rp(t,n)}break;case Wp:case Fp:case Pp:if(o){return Bp(t,n)}break}const c=Ip(t,n);return c};const zp=t=>{const n=t.end.columnIndex-t.deleted[0].length+t.inserted[0].length;return{deleted:t.inserted,end:{columnIndex:n,rowIndex:t.end.rowIndex},inserted:t.deleted,start:t.start}};const Up=t=>{const{undoStack:n}=t;if(n.length===0){return t}const e=n.at(-1);const o=e.map(zp);const s={...t,redoStack:[...t.redoStack||[],e],undoStack:n.slice(0,-1)};return oa(s,o)};const $p=t=>t;const Yp=t=>{switch(t){case We:case Te:case De:case Oe:case Be:case Ne:return true;default:return false}};const _p=(t,n,e)=>{const o=e(t);const{uid:s}=t.newState;const c=[];c.push(["Viewlet.createFunctionalRoot",n,s,Yp(t.id)]);c.push(...o);if(Yp(t.id)){c.push(["Viewlet.appendToBody",s])}else{c.push(["Viewlet.send",s,"appendWidget"])}const r=c.findIndex(t=>t[2]==="focus"||t[0]==="Viewlet.focusSelector");if(r!==-1){const t=c[r];c.splice(r,1);c.push(t)}return c};const Vp=t=>{switch(t){case We:return qo;case Te:return am;case De:return wm;case Oe:return Hw;case Be:return Rd;case Ne:return Gw;default:return undefined}};const jp="Close";const qp=(t,n,e)=>{const o=t=>t.id===n;const s=t.widgets.findIndex(o);if(s===-1){return t}const c=t.widgets[s];const r={...c,newState:e,oldState:c.newState};const i=[...t.widgets.slice(0,s),r,...t.widgets.slice(s+1)];return{...t,widgets:i}};const Gp=(t,n)=>{for(const e of ts()){const o=Jo(Number(e)).newState;const s=o.widgets||[];for(const e of s){if(e.id===n&&e.newState.uid===t){return o}}}return undefined};const Xp=(t,n)=>{if(t&&t.widgets){return t}const e=Jo(t);if(e&&e.newState&&e.newState.widgets){return e.newState}return Gp(t,n)};const Zp=(t,n,e)=>{const o=t=>t.id===e;const s=n=>t==="close"||t==="handleClickButton"&&n.includes(jp);const c=async(c,...r)=>{const i=Xp(c,e);if(!i){return c}const a=i.widgets.findIndex(o);if(a===-1){return i}const d=i.widgets[a];const l=d.newState;const{uid:u}=l;const f=Vp(e);await f(`${n}.${t}`,u,...r);const h=await f(`${n}.diff2`,u);const g=await f(`${n}.render2`,u,h);const m=Jo(i.uid).newState;if(s(r)){const t={...m,focused:true,widgets:bd(m.widgets,e)};ns(i.uid,m,t);return t}const w={...l,commands:g};const p=qp(m,e,w);ns(i.uid,m,p);return p};return c};const Qp=(t,n,e)=>{const o=Object.create(null);for(const s of t){o[s]=Zp(s,n,e)}return o};const Kp="Viewlet.appendToBody";const Jp="focus";const ty="Viewlet.registerEventListeners";const ny="Viewlet.setSelectionByName";const ey="Viewlet.setValueByName";const oy="Viewlet.setFocusContext";const sy="setBounds";const cy="Viewlet.setBounds";const ry="Viewlet.setCss";const iy="Viewlet.setDom2";const ay="Viewlet.setUid";const dy=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const ly=[iy,ry,Kp,cy,ty,ny,ey,oy,ay,"Viewlet.focusSelector"];const uy=t=>{const n=dy(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(ly.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const fy=t=>_p(t,"EditorCompletion",uy);const hy=t=>[["Viewlet.dispose",t.newState.uid]];const{close:gy,closeDetails:my,focusFirst:wy,focusIndex:py,focusLast:yy,focusNext:Ey,focusPrevious:xy,handleEditorBlur:Iy,handleEditorClick:Sy,handleEditorDeleteLeft:ky,handleEditorType:vy,handlePointerDown:Cy,handleWheel:by,openDetails:My,selectCurrent:Ay,selectIndex:Ly,toggleDetails:Py}=Qp(["handleEditorType","focusFirst","focusNext","focusPrevious","focusLast","handleEditorDeleteLeft","openDetails","focusIndex","handleEditorBlur","handleEditorClick","openDetails","selectCurrent","selectIndex","toggleDetails","closeDetails","handleWheel","close","handlePointerDown"],"Completions",Te);const Fy={__proto__:null,add:fy,close:gy,closeDetails:my,focusFirst:wy,focusIndex:py,focusLast:yy,focusNext:Ey,focusPrevious:xy,handleEditorBlur:Iy,handleEditorClick:Sy,handleEditorDeleteLeft:ky,handleEditorType:vy,handlePointerDown:Cy,handleWheel:by,openDetails:My,remove:hy,render:uy,selectCurrent:Ay,selectIndex:Ly,toggleDetails:Py};const Wy=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const Ty=[iy,ry,Kp,cy,ty,ny,ey,oy,ay,"Viewlet.focusSelector"];const Ry=t=>{const n=Wy(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(Ty.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const Dy=t=>_p(t,"FindWidget",Ry);const Oy=t=>[["Viewlet.dispose",t.newState.uid]];const{close:By,focusCloseButton:Ny,focusFind:Hy,focusNext:zy,focusNextElement:Uy,focusNextMatchButton:$y,focusPrevious:Yy,focusPreviousElement:_y,focusPreviousMatchButton:Vy,focusReplace:jy,focusReplaceAllButton:qy,focusReplaceButton:Gy,focusToggleReplace:Xy,handleBlur:Zy,handleClickButton:Qy,handleFocus:Ky,handleInput:Jy,handleReplaceFocus:tE,handleReplaceInput:nE,handleToggleReplaceFocus:eE,replace:oE,replaceAll:sE,toggleMatchCase:cE,toggleMatchWholeWord:rE,togglePreserveCase:iE,toggleReplace:aE,toggleUseRegularExpression:dE}=Qp(["close","focusCloseButton","focusFind","focusNext","focusNextMatchButton","focusPrevious","focusPreviousMatchButton","focusReplace","focusReplaceAllButton","focusReplaceButton","focusToggleReplace","handleBlur","handleClickButton","handleFocus","handleInput","handleReplaceFocus","handleReplaceInput","handleToggleReplaceFocus","replace","replaceAll","toggleMatchCase","toggleMatchWholeWord","toggleReplace","toggleUseRegularExpression","focusNextElement","focusPreviousElement","togglePreserveCase"],"FindWidget",De);const lE={__proto__:null,add:Dy,close:By,focusCloseButton:Ny,focusFind:Hy,focusNext:zy,focusNextElement:Uy,focusNextMatchButton:$y,focusPrevious:Yy,focusPreviousElement:_y,focusPreviousMatchButton:Vy,focusReplace:jy,focusReplaceAllButton:qy,focusReplaceButton:Gy,focusToggleReplace:Xy,handleBlur:Zy,handleClickButton:Qy,handleFocus:Ky,handleInput:Jy,handleReplaceFocus:tE,handleReplaceInput:nE,handleToggleReplaceFocus:eE,remove:Oy,render:Ry,replace:oE,replaceAll:sE,toggleMatchCase:cE,toggleMatchWholeWord:rE,togglePreserveCase:iE,toggleReplace:aE,toggleUseRegularExpression:dE};const uE=t=>({documentId:t.id||t.uid,languageId:t.languageId,text:Lr(t),uri:t.uri});const fE=async(t,n)=>{const e=uE(t);return uo("Extensions.executeHoverProvider",e,n)};const hE=async(t,n)=>{h(t);g(n);const e=await fE(t,n);if(e){return e}return Ca({args:[n],editor:t,event:ka,method:da,noProviderFoundMessage:"No hover provider found"})};const gE=async(t,n)=>{h(t);g(n);const e=await hE(t,n);return e};const mE=async(t,n,e,o,s)=>100;const wE=(t,n,e)=>{const o=n.length;let s=0;let c=0;const r=[];for(let i=0;i<o;i+=2){const o=n[i];const a=n[i+1];s+=a;const d=t.slice(c,s);const l=`Token ${e[o]||"Unknown"}`;const u=d;r.push(u,l);c=s}return r};const pE=(t,n,e)=>{const o=[];const{hasArrayReturn:s,initialLineState:c,tokenizeLine:r,TokenMap:i}=n;let a=Ac(c);for(const n of t){const t=Wc(e,r,n,a,s);const{tokens:c}=t;const d=wE(n,c,i);o.push(d);a=t}console.error({lineInfos:o});return o};const yE=async(t,n,e)=>{await er(n,e);const o=or(n);const s=Ei(t);const c=pE(s,o,n);return c};const EE=(t,n)=>{if(t){return t}const e=n[0];const o=n[1];return{columnIndex:o,rowIndex:e}};const xE=(t,n,e)=>{const o=[];for(const e of t){if(e.rowIndex===n){o.push(e)}}return o};const IE="typescript";const SE=(t,n,e,o)=>{const s=md(t,n,e);const c=t.height-wd(t,n)+t.y+40;return{x:s,y:c}};const kE=async(t,n)=>{g(t);const e=Jo(t);const o=e.newState;const{selections:s}=o;const{columnIndex:c,rowIndex:r}=EE(n,s);const i=Wr(o,r,c);const a=await gE(o,i);if(!a){return undefined}const{displayString:d,displayStringLanguageId:l,documentation:u}=a;const f="";const h=await yE(d,l||IE,f);const m=Yu(o,r,c);const w=c-m.length;await mE();const{x:p,y:y}=SE(o,r,w);const E=o.diagnostics||[];const x=xE(E,r);return{documentation:u,lineInfos:h,matchingDiagnostics:x,x:p,y:y}};const vE=async(t,n,e)=>{const o=await kE(t,e);if(!o){return n}const{documentation:s,lineInfos:c,matchingDiagnostics:r,x:i,y:a}=o;return{...n,diagnostics:r,documentation:s,lineInfos:c,x:i,y:a}};const CE=(t,n,e)=>t;const bE=(t,n,e)=>{const{x:o}=t;const s=100;const c=Math.max(n-o,s);return{...t,resizedWidth:c}};const ME=(t,n,e)=>t;const AE="CodeGeneratorInput";const LE="CodeGeneratorMessage";const PE="CodeGeneratorWidget";const FE="DiagnosticError";const WE="DiagnosticWarning";const TE="CompletionDetailCloseButton";const RE="CompletionDetailContent";const DE="Diagnostic";const OE="EditorCursor";const BE="EditorRow";const NE="EditorRowHighlighted";const HE="EditorSelection";const zE="HoverDisplayString";const UE="HoverDocumentation";const $E="HoverEditorRow";const YE="HoverProblem";const _E="HoverProblemDetail";const VE="HoverProblemMessage";const jE="IconClose";const qE="InputBox";const GE="MaskIcon";const XE="Viewlet";const ZE=1;const QE=2;const KE=9;const JE=10;const tx=11;const nx=12;const ex=13;const ox=14;const sx=15;const cx=18;const rx=19;const ix=20;const ax=21;const dx=22;const lx=23;const ux=26;const fx=27;const hx=28;const gx=29;const mx=30;const wx=31;const px=32;const yx=33;const Ex=4;const xx=6;const Ix=8;const Sx=12;const kx=62;const vx=t=>({childCount:0,text:t,type:Sx});const Cx=t=>{const n=[{childCount:t.length/2,className:$E,type:Ex}];for(let e=0;e<t.length;e+=2){const o=t[e];const s=t[e+1];n.push({childCount:1,className:s,type:Ix},vx(o))}return n};const bx=t=>{const n=t.flatMap(Cx);return n};const Mx={childCount:1,className:VE,type:Ix};const Ax={childCount:1,className:_E,type:Ix};const Lx=(t,n,e)=>{const o=n?1:0;const s=e&&e.length>0?1:0;return t.length+o+s};const Px=(t,n,e)=>{const o=[];o.push({childCount:Lx(t,n,e)+1,className:"Viewlet EditorHover",type:Ex});if(e&&e.length>0){o.push({childCount:e.length*2,className:`${zE} ${YE}`,type:Ex});for(const t of e){o.push(Mx,vx(t.message),Ax,vx(`${t.source} (${t.code})`))}}if(t.length>0){const n=bx(t);o.push({childCount:t.length,className:zE,type:Ex},...n)}if(n){o.push({childCount:1,className:UE,type:Ex},vx(n))}o.push({childCount:0,className:"Sash SashVertical SashResize",onPointerDown:ux,type:Ex});return o};const Fx={apply(t,n){const e=Px(n.lineInfos,n.documentation,n.diagnostics);return[iy,e]},isEqual:(t,n)=>t.lineInfos===n.lineInfos&&t.documentation===n.documentation&&t.diagnostics===n.diagnostics};const Wx={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[sy,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y};const Tx=[Fx,Wx];const Rx=(t,n)=>{const e=[];for(const o of Tx){if(!o.isEqual(t,n)){e.push(o.apply(t,n))}}return e};const Dx=[iy,ry,Kp,cy,ty,ny,ey,oy,ay,"Viewlet.focusSelector"];const Ox=t=>{const n=dy(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(Dx.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const Bx=t=>_p(t,"EditorRename",Ox);const Nx=t=>[["Viewlet.dispose",t.newState.uid]];const{accept:Hx,close:zx,handleInput:Ux}=Qp(["handleInput","close","accept"],"Rename",Be);const $x={__proto__:null,accept:Hx,add:Bx,close:zx,handleInput:Ux,remove:Nx,render:Ox};const Yx=t=>structuredClone(t);const _x=(t,n)=>{const e={...t,focusedIndex:n};return e};const Vx=t=>{const n=t.focusedIndex+1;return _x(t,n)};const jx=t=>[["Viewlet.send",t.newState.uid,"dispose"]];const qx=[iy,ry,Kp,cy,ty,ny,ey,oy,ay,"Viewlet.focusSelector"];const Gx=t=>{const n=dy(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(qx.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const Xx=t=>_p(t,"EditorSourceActions",Gx);const Zx=jx;const{close:Qx,closeDetails:Kx,focusFirst:Jx,focusIndex:tI,focusLast:nI,focusNext:eI,focusPrevious:oI,handleWheel:sI,selectCurrent:cI,selectIndex:rI,selectItem:iI,toggleDetails:aI}=Qp(["focusFirst","focusIndex","focusLast","focusNext","focusPrevious","selectCurrent","selectIndex","selectItem","toggleDetails","closeDetails","handleWheel","close"],"SourceActions",Ne);const dI={__proto__:null,add:Xx,close:Qx,closeDetails:Kx,focusFirst:Jx,focusIndex:tI,focusLast:nI,focusNext:eI,focusPrevious:oI,handleWheel:sI,remove:Zx,render:Gx,selectCurrent:cI,selectIndex:rI,selectItem:iI,toggleDetails:aI};const lI=async(t,n,e,o,s,...c)=>{const r=Vp(s);const i=e.slice(n.length+1);const a=t.widgets.find(t=>t.id===s);if(!a){return t}const{uid:d}=a.newState;g(d);await r(`${n}.${i}`,d,...c);const l=t=>t.id===s;const u=ym(t.uid);const f=u.widgets.findIndex(l);if(f===-1){return u}const h=await r(`${n}.diff2`,d);const m=await r(`${n}.render2`,d,h);const w=t.widgets.findIndex(l);if(w===-1){return u}const p=u.widgets[w];const y={...p.newState,commands:m};const E=qp(u,s,y);return E};const uI=(t,n)=>t.filter(t=>t.languageId===n);const fI=async t=>{if(!t){return[]}const{newState:n}=Jo(t);const{languageId:e}=n;const o=await Eo("GetEditorSourceActions.getEditorSourceActions");const s=uI(o,e);return s};const hI=/[\w\-]+$/;const gI=t=>{const{lines:n,selections:e}=t;const o=e[0];const s=e[1];const c=n[o];const r=c.slice(0,s);const i=r.match(hI);if(i){return i[0]}return""};const mI=async t=>{await Eo("Focus.setFocus",t)};const wI=async t=>{if(!t){return}await Eo("Focus.removeAdditionalFocus",t)};const pI=12;const yI=9;const EI=11;const xI=12;const II=16;const SI=38;const kI=43;const vI=46;const CI=47;const bI=48;const MI=49;const AI=50;const LI=52;const PI=t=>{const n=ym(t);return km(n)};const FI=t=>{const n=ym(t);return n.uri};const WI=t=>{const n=ym(t);return n.languageId};const TI=t=>{const n=ym(t);return op(n)};const RI=(t,n,e)=>{const o=ym(t);const{word:s}=$u(o,n,e);return s};const DI=t=>{const n=ym(t);const e=gI(n);return e};const OI=(t,n,e)=>{const o=ym(t);const s=Yu(o,n,e);return s};const BI=t=>{const n=ym(t);const{lines:e}=n;return e};const NI=t=>{const n=ym(t);const{selections:e}=n;return e};const HI=async(t,n)=>{const e=ym(t);const o={...e,selections:n};const s=await pg(e,o);ns(t,e,s)};const zI=async(t,n,e,o)=>{const s=ym(t);const c=Vp(n);const{widgets:r}=s;const i=r.findIndex(t=>t.id===n);if(i===-1){return}await c(`${e}.dispose`);const a=[...r.slice(0,i),...r.slice(i+1)];const d={...s,focused:true,widgets:a};const l=await pg(s,d);ns(t,s,l);await mI(xI);if(o){await wI(o)}};const UI=async t=>{await zI(t,De,"FindWidget",0)};const $I=async(t,n)=>{const e=ym(t);const o=await nd(e,n);const s=await pg(e,o);ns(t,e,s)};const YI=async t=>{const n=await fI(t);return n};const _I=async t=>{const n=ym(t);const{diagnostics:e}=n;return e};const VI=async(t,n)=>{await po("TextMeasurement.ensureFont",t,n)};const jI=()=>[{command:"Editor.closeSourceAction",key:ee,when:SI},{command:"EditorSourceActions.focusNext",key:de,when:SI},{command:"EditorSourceActions.focusPrevious",key:ie,when:SI},{command:"EditorSourceActions.focusFirst",key:ce,when:SI},{command:"EditorSourceActions.focusLast",key:se,when:SI},{command:"EditorSourceActions.selectCurrent",key:ne,when:SI},{command:"FindWidget.focusNext",key:ne,when:II},{command:"FindWidget.preventDefaultBrowserFind",key:He|ge,when:II},{command:"FindWidget.focusPrevious",key:ze|Ce,when:II},{command:"FindWidget.focusNext",key:Ce,when:II},{command:"FindWidget.focusToggleReplace",key:ze|te,when:II},{command:"FindWidget.focusReplace",key:te,when:II},{command:"FindWidget.focusPreviousMatchButton",key:te,when:kI},{command:"FindWidget.replaceAll",key:Ue|He|ne,when:kI},{command:"FindWidget.focusNextMatchButton",key:te,when:AI},{command:"FindWidget.focusReplace",key:ze|te,when:AI},{command:"FindWidget.focusPreviousMatchButton",key:ze|te,when:MI},{command:"FindWidget.focusCloseButton",key:te,when:MI},{command:"FindWidget.focusNextMatchButton",key:ze|te,when:bI},{command:"FindWidget.focusReplaceButton",key:te,when:bI},{command:"FindWidget.focusFind",key:ze|te,when:kI},{command:"FindWidget.focusReplaceAllButton",key:te,when:vI},{command:"FindWidget.focusCloseButton",key:ze|te,when:vI},{command:"FindWidget.focusReplaceButton",key:ze|te,when:CI},{command:"EditorCompletion.focusNext",key:de,when:yI},{command:"EditorCompletion.focusPrevious",key:ie,when:yI},{command:"EditorCompletion.selectCurrent",key:ne,when:yI},{command:"EditorCompletion.close",key:ee,when:yI},{command:"EditorCompletion.focusLast",key:se,when:yI},{command:"EditorCompletion.focusFirst",key:ce,when:yI},{command:"EditorCompletion.toggleDetails",key:He|oe,when:yI},{command:"Editor.cursorWordRight",key:He|ae,when:xI},{command:"Editor.cursorWordLeft",key:He|re,when:xI},{command:"Editor.deleteWordPartLeft",key:Ue|Jn,when:xI},{command:"Editor.deleteWordPartRight",key:Ue|le,when:xI},{command:"Editor.deleteWordLeft",key:He|Jn,when:xI},{command:"Editor.deleteWordRight",key:He|le,when:xI},{command:"Editor.selectNextOccurrence",key:He|he,when:xI},{command:"Editor.openColorPicker",key:He|we,when:xI},{command:"Editor.showSourceActions3",key:He|Me,when:xI},{command:"Editor.handleTab",key:te,when:xI},{command:"Editor.unindent",key:ze|te,when:xI},{command:"Editor.indentLess",key:He|Le,when:xI},{command:"Editor.closeFind",key:ee,when:II},{command:"Editor.openFind2",key:He|ge,when:xI},{command:"Editor.openCodeGenerator",key:He|pe,when:xI},{command:"Editor.closeCodeGenerator",key:ee,when:LI},{command:"EditorCodeGenerator.accept",key:ne,when:LI},{command:"Editor.indentMore",key:He|Pe,when:xI},{command:"Editor.selectCharacterLeft",key:ze|re,when:xI},{command:"Editor.selectWordLeft",key:He|ze|re,when:xI},{command:"Editor.selectCharacterRight",key:ze|ae,when:xI},{command:"Editor.selectWordRight",key:He|ze|ae,when:xI},{command:"Editor.selectLine",key:He|ye,when:xI},{command:"Editor.deleteAllLeft",key:He|ze|Jn,when:xI},{command:"Editor.deleteAllRight",key:He|ze|le,when:xI},{command:"Editor.cancelSelection",key:ee,when:xI},{command:"Editor.undo",key:He|Se,when:xI},{command:"Editor.cursorLeft",key:re,when:xI},{command:"Editor.cursorRight",key:ae,when:xI},{command:"Editor.cursorUp",key:ie,when:xI},{command:"Editor.cursorDown",key:de,when:xI},{command:"Editor.deleteLeft",key:Jn,when:xI},{command:"Editor.deleteRight",key:le,when:xI},{command:"Editor.insertLineBreak",key:ne,when:xI},{command:"Editor.copyLineDown",key:He|ze|he,when:xI},{command:"Editor.moveLineDown",key:He|ze|de,when:xI},{command:"Editor.moveLineUp",key:He|ze|ie,when:xI},{command:"Editor.openCompletion",key:He|oe,when:xI},{command:"Editor.openRename",key:ke,when:xI},{command:"EditorRename.accept",key:ne,when:EI},{command:"Editor.closeRename",key:ee,when:EI},{command:"Editor.cursorHome",key:ce,when:xI},{command:"Editor.cursorEnd",key:se,when:xI},{command:"Editor.toggleComment",key:He|Ae,when:xI},{command:"Editor.copy",key:He|fe,when:xI},{command:"Editor.selectAll",key:He|ue,when:xI},{command:"Editor.showHover2",key:He|me,when:xI},{command:"Editor.cut",key:He|Ie,when:xI},{command:"Editor.paste",key:He|xe,when:xI},{command:"Editor.cursorWordPartLeft",key:Ue|re,when:xI},{command:"Editor.cursorWordPartRight",key:Ue|ae,when:xI},{command:"Editor.selectAllOccurrences",key:Ue|ve,when:xI},{command:"Editor.addCursorAbove",key:Ue|ze|ie,when:xI},{command:"Editor.addCursorBelow",key:Ue|ze|de,when:xI},{command:"Editor.findAllReferences",key:Ue|ze|be,when:xI},{command:"Editor.organizeImports",key:Ue|ze|Ee,when:xI},{command:"Editor.selectionGrow",key:He|ze|oe,when:pI}];const qI=()=>ts();const GI={CommandPalette:"Command Palette"};const XI=()=>qu(GI.CommandPalette);const ZI={command:"",flags:_e,id:"separator",label:""};const QI=()=>[{command:"Editor.goToDefinition",flags:Ve,id:"go-to-definition",label:Pf()},{command:"Editor.goToTypeDefinition",flags:Ve,id:"go-to-type-definition",label:Nf()},ZI,{args:["References",true],command:"SideBar.show",flags:Ve,id:"find-all-references",label:Hf()},{args:["Implementations",true],command:"SideBar.show",flags:Ve,id:"find-all-implementations",label:zf()},ZI,{command:"Editor.format",flags:Ve,id:"format",label:qf()},{command:"Editor.showSourceActions2",flags:Ve,id:Ye,label:Df()},ZI,{command:"Editor.cut",flags:Ve,id:"cut",label:Uf()},{command:"Editor.copy",flags:Ve,id:"copy",label:$f()},{command:"Editor.paste",flags:Ve,id:"paste",label:Yf()},ZI,{command:"QuickPick.showEverything",flags:Ve,id:"commandPalette",label:XI()}];const KI=()=>[$e];const JI=t=>Aa(t);const tS=async()=>{const t=ts();const n=t.map(t=>{const n=Number(t);const e=Jo(n);return e});const e=n.map(t=>t.newState);const o=await Promise.all(e.map(JI));const s=o.flat();return s};const nS=()=>[{id:"Editor.format",label:qf()},{id:"Editor.showHover",label:Gf()},{id:"Editor.formatForced",label:Xf()},{id:"Editor.selectNextOccurrence",label:Zf()},{id:"Editor.selectAllOccurrences",label:Qf()},{id:"Editor.goToDefinition",label:Kf()},{id:"Editor.goToTypeDefinition",label:Jf()},{id:"Editor.selectInsideString",label:th()},{aliases:["Indent More","DeIndent"],id:"Editor.indent",label:nh()},{aliases:["Indent Less","DeIndent"],id:"Editor.unindent",label:eh()},{id:"Editor.sortLinesAscending",label:oh()},{id:"Editor.toggleComment",label:sh()},{id:"Editor.selectUp",label:ch()},{id:"Editor.selectDown",label:rh()},{id:"Editor.toggleBlockComment",label:_f()},{id:"Editor.openColorPicker",label:ih()},{id:"Editor.closeColorPicker",label:ah()},{id:"Editor.copyLineDown",label:dh()},{id:"Editor.copyLineUp",label:lh()},{id:"Editor.moveLineDown",label:jf()},{id:"Editor.moveLineUp",label:Vf()},{id:"Editor.showSourceActions2",label:Df()}];const eS=t=>{const n=ym(t);const{selections:e}=n;return e};const oS=t=>{g(t);const n=ym(t);const{lines:e}=n;return e.join(pr)};const sS="insertText";const cS=(t,n,e)=>{switch(n){case sS:return Hp(t,e);default:return t}};const rS=async(t,n)=>{const e=await Bn({commandMap:{},messagePort:t});if(n){Un(n,e)}};const iS=(t,n)=>rp(t,n);const aS=async t=>{const n=await sp(t);if(!n){return t}return iS(t,n)};const dS=async()=>{await pm();await mm()};const lS=t=>{switch(t){case De:return{invoke:wm,name:"FindWidget"};default:return undefined}};const uS=async(t,n,e,o)=>{if(e?.newState){const s=`${n}:${e.newState.uid}`;const c=lS(e.id);if(c&&o&&Object.hasOwn(o,s)){const{invoke:n,name:r}=c;const i=o[s];await n(`${r}.create`,e.newState.uid,e.newState.x,e.newState.y,e.newState.width,e.newState.height,t);await n(`${r}.loadContent`,e.newState.uid,i);const a=await n(`${r}.diff2`,e.newState.uid);const d=await n(`${r}.render2`,e.newState.uid,a);return{restored:true,widget:{...e,newState:{...e.newState,commands:d}}}}}return{restored:false,widget:e}};const fS=async(t,n)=>{const e=[];for(const o of t){const t=parseInt(o);const s=Jo(t);if(!s?.newState||!Array.isArray(s.newState.widgets)){continue}const{widgets:c}=s.newState;const r=[];let i=false;for(const e of c){const s=await uS(t,o,e,n);r.push(s.widget);if(s.restored){i=true}}if(!i){e.push(s);continue}e.push({...s,newState:{...s.newState,widgets:r}})}return e};const hS=async(t,n,e)=>{if(!e?.newState){return}const o=lS(e.id);if(!o){return}const{invoke:s,name:c}=o;const{uid:r}=e.newState;const i=`${n}:${r}`;const a=await s(`${c}.saveState`,r);t[i]=a};const gS=async t=>{const n=Object.create(null);for(const e of t){const t=Jo(parseInt(e));if(!t?.newState||!Array.isArray(t.newState.widgets)){continue}const{widgets:o}=t.newState;for(const t of o){await hS(n,e,t)}}return n};const mS={isReloading:false};const wS=async()=>{if(mS.isReloading){return}mS.isReloading=true;try{const t=ts();const n=await gS(t);await dS();const e=await fS(t,n);for(const t of e){ns(t.newState.uid,t.oldState,t.newState)}await Eo(`Editor.rerender`)}finally{mS.isReloading=false}};const pS=async t=>{try{await Ro(t)}catch{await xo("SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker",t,"HandleMessagePort.handleMessagePort")}};const yS=async()=>{try{const t=await Rn({commandMap:{},send:pS});return t}catch(t){throw new k(t,`Failed to create syntax highlighting worker rpc`)}};const ES=async(t,n)=>{if(t){Uc(true);const t=await yS();_c(t)}if(n){Qr(true)}};const xS=async()=>{const t="Completion Worker";const n="completionWorkerMain.js";const e="Completions.initialize";const o=await Yo(t,n,e);return o};const IS=async(t,n)=>{dm(xS);await ES(t,n)};const SS="editor.lineHeight";const kS="editor.fontSize";const vS="editor.fontFamily";const CS="editor.letterSpacing";const bS="editor.tabSize";const MS="editor.lineNumbers";const AS="editor.diagnostics";const LS="editor.quickSuggestions";const PS="editor.autoClosingQuotes";const FS="editor.autoclosingBrackets";const WS="editor.fontWeight";const TS=async()=>Boolean(await Ia(FS));const RS=async()=>Boolean(await Ia(PS));const DS=async()=>Boolean(await Ia(LS));const OS=async()=>true;const BS=async()=>await Ia(SS)||20;const NS=async()=>await Ia(kS)||15;const HS=async()=>await Ia(vS)||"Fira Code";const zS=async()=>await Ia(CS)??.5;const US=async()=>await Ia(bS)||2;const $S=async()=>await Ia(MS)??false;const YS=async()=>[".","/"];const _S=async()=>await Ia(AS)??false;const VS=async()=>await Ia(WS)??400;const jS=async()=>{const[t,n,e,o,s,c,r,i,a,d,l,u,f]=await Promise.all([_S(),HS(),NS(),VS(),TS(),RS(),OS(),DS(),$S(),BS(),US(),zS(),YS()]);return{completionTriggerCharacters:f,diagnosticsEnabled:t,fontFamily:n,fontSize:e,fontWeight:o,isAutoClosingBracketsEnabled:s,isAutoClosingQuotesEnabled:c,isAutoClosingTagsEnabled:r,isQuickSuggestionsEnabled:i,letterSpacing:u,lineNumbers:a,rowHeight:d,tabSize:l}};const qS=(t,n)=>{for(const e of t){if(e?.id===n){return e.tokenize||""}}return""};const GS=t=>{if(t instanceof Error){return t.message}return String(t)};const XS=async(t,n)=>{const{assetDir:e,height:o,id:s,platform:c,uri:r,width:i,x:a,y:d}=t;const{completionTriggerCharacters:l,diagnosticsEnabled:u,fontFamily:f,fontSize:h,fontWeight:g,isAutoClosingBracketsEnabled:m,isAutoClosingQuotesEnabled:w,isAutoClosingTagsEnabled:p,isQuickSuggestionsEnabled:y,letterSpacing:E,lineNumbers:x,rowHeight:I,tabSize:S}=await jS();const k=await xa(g,h,f,E);const v=await Ea(c,e);Qc(v);const C=ya(r,v);const b=qS(v,C);await er(C,b);const M=or(C);const A=t.tokenizerId+1;cr(A,M);const L={...t,charWidth:k,completionTriggerCharacters:l,diagnosticsEnabled:u,fontFamily:f,fontSize:h,fontWeight:g,isAutoClosingBracketsEnabled:m,isAutoClosingQuotesEnabled:w,isAutoClosingTagsEnabled:p,isQuickSuggestionsEnabled:y,languageId:C,letterSpacing:E,lineNumbers:x,loadError:"",rowHeight:I,tabSize:S,tokenizerId:A};let P="";try{P=await vo(r)}catch(t){const n=ra(L,a,d,i,o,9);return{...n,differences:[],focus:ro,focused:true,initial:false,loadError:GS(t),textInfos:[]}}const F=ra(L,a,d,i,o,9);const W=ia(F,P);let T=W;const R=li(T);const D={...T,decorations:R};const O=Kr();const{differences:B,textInfos:N}=await _r(D,O);const H={...D,differences:B,focus:ro,focused:true,textInfos:N};await fa(ua,r,s,C,P);if(u){await Wa(H)}const z=await Ia("editor.completionsOnType");const U=Boolean(z);const $={...H,completionsOnType:U,initial:false};return $};const ZS=t=>t;const QS=t=>t;const KS=(t,n)=>{g(t);g(n);gi(t,n)};const JS=(t,n,e,o,s)=>`.Editor {\n --EditorRowHeight: ${t}px;\n --ScrollBarHeight: ${n}px;\n --ScrollBarTop: ${e}px;\n --ScrollBarWidth: ${o}px;\n --ScrollBarLeft: ${s}px;\n}\n.Editor .EditorRow {\n height: var(--EditorRowHeight);\n line-height: var(--EditorRowHeight);\n}\n.Editor .ScrollBarThumbVertical {\n height: var(--ScrollBarHeight);\n translate: 0px var(--ScrollBarTop);\n}\n.Editor .ScrollBarThumbHorizontal {\n width: var(--ScrollBarWidth);\n translate: var(--ScrollBarLeft) 0px;\n}\n`;const tk=(t,n,e)=>{const o=t/n*e;if(!Number.isFinite(o)){return 0}return o};const nk=(t,n)=>{const{deltaX:e,deltaY:o,finalDeltaY:s,height:c,longestLineWidth:r,minimumSliderSize:i,rowHeight:a,scrollBarHeight:d,uid:l,width:u}=n;const f=jr(o,s,c,d);const h=qr(u,r,i);const g=tk(e,r,u);const m=JS(a,d,f,h,g);return[oo,l,m]};const ek=(t,n)=>{const e=".EditorInput textarea";return[eo,n.uid,e]};const ok=(t,n)=>[so,n.uid,ro];const sk=1;const ck=2;const rk=3;const ik=4;const ak=6;const dk=7;const lk=8;const uk=9;const fk=10;const hk=11;const gk=t=>t!=="type"&&t!=="childCount";const mk=t=>{const n=Object.keys(t).filter(gk);return n};const wk=t=>{const n=[];let e=0;while(e<t.length){const o=t[e];const{children:s,nodesConsumed:c}=pk(t,e+1,o.childCount||0);n.push({node:o,children:s});e+=1+c}return n};const pk=(t,n,e)=>{if(e===0){return{children:[],nodesConsumed:0}}const o=[];let s=n;let c=e;let r=0;while(c>0&&s<t.length){const n=t[s];const e=n.childCount||0;const{children:i,nodesConsumed:a}=pk(t,s+1,e);o.push({node:n,children:i});const d=1+a;s+=d;r+=d;c--}return{children:o,nodesConsumed:r}};const yk=(t,n)=>{if(t.type!==n.type){return null}const e=[];if(t.type===jn){if(t.uid!==n.uid){e.push({type:hk,uid:n.uid})}return e}if(t.type===Vn&&n.type===Vn){if(t.text!==n.text){e.push({type:sk,value:n.text})}return e}const o=mk(t);const s=mk(n);for(const o of s){if(t[o]!==n[o]){e.push({type:rk,key:o,value:n[o]})}}for(const t of o){if(!Object.hasOwn(n,t)){e.push({type:ik,key:t})}}return e};const Ek=t=>{const n=[t.node];for(const e of t.children){n.push(...Ek(e))}return n};const xk=(t,n,e)=>{if(n===-1){t.push({type:dk,index:e});return e}if(n!==e){t.push({type:fk,index:e})}return e};const Ik=(t,n)=>{if(n>=0){t.push({type:lk})}return-1};const Sk=(t,n)=>{n.push({type:ak,nodes:Ek(t)})};const kk=(t,n)=>{n.push({type:ck,nodes:Ek(t)})};const vk=(t,n,e,o,s)=>{const c=yk(t.node,n.node);if(c===null){const t=xk(e,o,s);kk(n,e);return t}const r=t.children.length>0||n.children.length>0;if(c.length===0&&!r){return o}const i=xk(e,o,s);if(c.length>0){e.push(...c)}if(r){bk(t.children,n.children,e)}return i};const Ck=(t,n,e)=>{const o=yk(t.node,n.node);if(o===null){kk(n,e);return}if(o.length>0){e.push(...o)}if(t.children.length>0||n.children.length>0){bk(t.children,n.children,e)}};const bk=(t,n,e)=>{const o=Math.max(t.length,n.length);let s=-1;const c=[];for(let r=0;r<o;r++){const o=t[r];const i=n[r];if(!o&&!i){continue}if(!o){s=Ik(e,s);Sk(i,e);continue}if(!i){c.push(r);continue}s=vk(o,i,e,s,r)}Ik(e,s);for(let t=c.length-1;t>=0;t--){e.push({type:uk,index:c[t]})}};const Mk=(t,n,e,o)=>{if(o.length===0&&t.length===1&&n.length===1){Ck(t[0],n[0],e);return}bk(t,n,e)};const Ak=t=>{let n=-1;for(let e=t.length-1;e>=0;e--){const o=t[e];if(o.type!==dk&&o.type!==lk&&o.type!==fk){n=e;break}}return n===-1?[]:t.slice(0,n+1)};const Lk=(t,n)=>{const e=wk(t);const o=wk(n);const s=[];Mk(e,o,s,[]);return Ak(s)};const Pk=()=>[{childCount:1,className:"EditorInput",type:Ex},{ariaAutoComplete:"list",ariaMultiLine:"true",ariaRoleDescription:"editor",autocapitalize:"off",autocomplete:"off",autocorrect:"off",childCount:0,name:"editor",onBeforeInput:ZE,onBlur:QE,onCompositionEnd:JE,onCompositionStart:tx,onCompositionUpdate:nx,onCut:ox,onFocus:sx,onPaste:ix,role:"textbox",spellcheck:false,type:kx,wrap:"off"}];const Fk=t=>{const n=Array.from(t,t=>({childCount:0,className:OE,translate:t,type:Ex}));return n};const Wk=t=>{const n=Fk([...t]);return[{childCount:t.length,className:"LayerCursor",type:Ex},...n]};const Tk="error";const Rk="warning";const Dk=t=>{switch(t){case Tk:return FE;case Rk:return WE;default:return FE}};const Ok=(...t)=>t.filter(Boolean).join(" ");const Bk=t=>{const{height:n,type:e,width:o,x:s,y:c}=t;const r=Dk(e);return[{childCount:0,className:Ok(DE,r),height:n,left:s,top:c,type:Ex,width:o}]};const Nk=t=>{const n=t.flatMap(Bk);return n};const Hk=t=>{const n=Nk([...t]);return[{childCount:t.length,className:"LayerDiagnostics",type:Ex},...n]};const zk=(t,n,e=true,o=-1)=>{const s=[];for(let e=0;e<t.length;e++){const c=t[e];const r=n[e];let i=BE;if(e===o){i+=" "+NE}s.push({childCount:c.length/2,className:i,translate:Fi(r),type:Ex});for(let t=0;t<c.length;t+=2){const n=c[t];const e=c[t+1];s.push({childCount:1,className:e,type:Ix},vx(n))}}return s};const Uk=(t,n,e=true,o=-1)=>{const s=zk(t,n,e,o);return[{childCount:t.length,className:"EditorRows",onMouseDown:cx,onPointerDown:ax,onWheel:yx,type:Ex},...s]};const $k=t=>{const n=[];for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];n.push({childCount:0,className:HE,height:r,left:o,top:s,type:Ex,width:c})}return n};const Yk=t=>{const n=$k(t);return[{childCount:t.length/4,className:"Selections",type:Ex},...n]};const _k=(t,n,e,o=true,s=-1,c=[],r=[])=>[{childCount:4,className:"EditorLayers",type:Ex},...Yk(t),...Uk(n,e,o,s),...Wk(c),...Hk(r)];const Vk=t=>[{childCount:t.length,className:"EditorScrollBarDiagnostics",type:Ex},...Nk([...t])];const jk=()=>[{childCount:1,className:"ScrollBar ScrollBarVertical",onContextMenu:ex,onPointerDown:mx,type:Ex},{childCount:0,className:"ScrollBarThumb ScrollBarThumbVertical",type:Ex},{childCount:1,className:"ScrollBar ScrollBarHorizontal",onPointerDown:fx,type:Ex},{childCount:0,className:"ScrollBarThumb ScrollBarThumbHorizontal",type:Ex}];const qk=({cursorInfos:t=[],diagnostics:n=[],differences:e,highlightedLine:o=-1,lineNumbers:s=true,scrollBarDiagnostics:c=[],selectionInfos:r=[],textInfos:i})=>[{childCount:5,className:"EditorContent",onMouseMove:rx,type:Ex},...Pk(),..._k(r,i,e,s,o,t,n),...Vk(c),...jk()];const Gk=t=>[{childCount:1,className:"LineNumber",type:Ix},vx(t)];const Xk=t=>{const n=t.flatMap(Gk);return n};const Zk=t=>{const n=Xk([...t]);return[{childCount:t.length,className:"Gutter",type:Ex},...n]};const Qk=({cursorInfos:t=[],diagnostics:n=[],differences:e,gutterInfos:o=[],highlightedLine:s=-1,lineNumbers:c=true,loadError:r="",scrollBarDiagnostics:i=[],selectionInfos:a=[],textInfos:d})=>{if(r){return[{childCount:2,className:"Viewlet TextEditorError",role:"code",type:Ex},{childCount:0,className:"EditorTextIcon EditorTextIconError MaskIcon MaskIconError",type:Ex},{childCount:1,className:"TextEditorErrorMessage",type:Ex},vx(r)]}const l=c?Zk(o):[];return[{childCount:c?2:1,className:"Viewlet Editor",onContextMenu:ex,role:"code",type:Ex},...l,...qk({cursorInfos:t,diagnostics:n,differences:e,highlightedLine:s,lineNumbers:c,scrollBarDiagnostics:i,selectionInfos:a,textInfos:d})]};const Kk=new Map;const Jk=t=>Kk.get(t);const tv=(t,n)=>{Kk.set(t,n)};const nv=t=>{const{initial:n,textInfos:e}=t;if(n&&e.length===0){return[]}return Qk(t)};const ev=(t,n)=>{const e=t.initial?nv(t):Jk(n.uid)||nv(t);const o=nv(n);const s=Lk(e,o);if(s.length===0){return[]}tv(n.uid,o);return[co,n.uid,s]};const ov=t=>{const n=Fs(t.id);if(!n){throw new Error("unsupported widget")}return n.add(t)};const sv=t=>{const n=Fs(t.id);if(!n){throw new Error("unsupported widget")}return n.render(t)};const cv=t=>{const n=Fs(t.id);if(!n){throw new Error("unsupported widget")}return n.remove(t)};const rv=(t,n)=>{const e=[];const o=[];const s=[];const c=t.widgets||[];const r=n.widgets||[];const i=Object.create(null);const a=Object.create(null);for(const t of c){i[t.id]=t}for(const t of r){a[t.id]=t}for(const t of c){if(Object.hasOwn(a,t.id)){o.push(a[t.id])}else{s.push(t)}}for(const t of r){if(Object.hasOwn(i,t.id));else{e.push(t)}}const d=[];for(const t of e){const n=ov(t);if(n.length>0){d.push(...n)}}const l=[];for(const t of o){const n=sv(t);if(n.length>0){l.push(...n)}}const u=[];for(const t of s){const n=cv(t);if(n.length>0){u.push(...n)}}const f=[...d,...l,...u];return f.filter(t=>t[0]!=="Viewlet.setFocusContext")};const iv=t=>{switch(t){case Ha:return nk;case Ba:return ek;case Na:return ok;case za:return ev;case Ua:return rv;default:throw new Error("unknown renderer")}};const av=(t,n,e)=>{const o=[];for(const s of e){const e=iv(s);const c=e(t,n);if(c.length>0){if(s===Ua){o.push(...c)}else{o.push(c)}}}return o};const dv=(t,n)=>{const{newState:e,oldState:o}=Jo(t);ns(t,e,e);const s=av(o,e,n);return s};const lv={apply(t,n){const{incrementalEdits:e}=n;if(e!==es){return["setIncrementalEdits",e]}const{differences:o,textInfos:s}=n;n.differences=o;const{highlightedLine:c,minLineY:r}=n;const i=c-r;const a=zk(s,o,true,i);return["setText",a]},isEqual:(t,n)=>t.lines===n.lines&&t.tokenizerId===n.tokenizerId&&t.minLineY===n.minLineY&&t.decorations===n.decorations&&t.embeds===n.embeds&&t.deltaX===n.deltaX&&t.width===n.width&&t.highlightedLine===n.highlightedLine&&t.debugEnabled===n.debugEnabled};const uv={apply:(t,n)=>{const{cursorInfos:e=[],selectionInfos:o=[]}=n;const s=Fk(e);const c=$k(o);return["setSelections",s,c]},isEqual:(t,n)=>t.cursorInfos===n.cursorInfos&&t.selectionInfos===n.selectionInfos};const fv={apply:nk,isEqual:Ra};const hv={apply:(t,n)=>["setFocused",n.focused],isEqual:(t,n)=>t.focused===n.focused};const gv={apply:(t,n)=>[so,n.uid,n.focus,0,n.uid,"Editor"],isEqual:(t,n)=>t.focus===n.focus};const mv={apply(t,n){if(n.additionalFocus){return["Viewlet.setAdditionalFocus",n.uid,n.additionalFocus]}return["viewlet.unsetAdditionalFocus",n.uid,n.additionalFocus]},isEqual:(t,n)=>t.additionalFocus===n.additionalFocus};const wv={apply(t,n){const e=Nk(n.visualDecorations||[]);return["setDecorationsDom",e]},isEqual:(t,n)=>t.visualDecorations===n.visualDecorations};const pv={apply(t,n){const{lineNumbers:e,maxLineY:o,minLineY:s}=n;if(!e){return[]}const c=[];for(let t=s;t<o;t++){c.push(t+1)}const r=Xk(c);return["renderGutter",r]},isEqual:(t,n)=>t.lineNumbers===n.lineNumbers&&t.minLineY===n.minLineY&&t.maxLineY===n.maxLineY};const yv={apply:rv,isEqual:(t,n)=>t.widgets===n.widgets,multiple:true};const Ev=[lv,uv,fv,hv,wv,pv,yv,gv,mv];const xv=async t=>{const n=Jo(t);if(!n){return[]}const{newState:e,oldState:o}=n;const s=[];ns(t,e,e);for(const t of Ev){if(t.isEqual(o,e)){continue}const n=await t.apply(o,e);if(t.multiple){s.push(...n)}else if(n.length>0){s.push(n)}}return s};const Iv=()=>[{name:sx,params:["handleFocus"]},{name:rx,params:["handleMouseMove",Xn,Zn,qn]},{name:QE,params:["handleBlur"]},{name:ZE,params:["handleBeforeInput","event.inputType","event.data"],preventDefault:true},{name:tx,params:["compositionStart","event.data"]},{name:nx,params:["compositionUpdate","event.data"]},{name:JE,params:["compositionEnd","event.data"]},{name:ox,params:["cut"],preventDefault:true},{name:ix,params:["paste",'event.clipboardData ? event.clipboardData.getData("text/plain") : ""'],preventDefault:true},{name:cx,params:["handleMouseDown","event.button","event.altKey","event.ctrlKey",Xn,Zn,"event.detail"]},{name:ax,params:["handlePointerDown","event.button","event.altKey","event.ctrlKey",Xn,Zn,"event.detail"],trackPointerEvents:[dx,lx]},{name:dx,params:["handlePointerMove",Xn,Zn,qn]},{name:lx,params:["handlePointerUp"]},{name:yx,params:["handleWheel",Qn,"event.deltaX",Kn],passive:true},{name:ex,params:["handleContextMenu",Gn,Xn,Zn],preventDefault:true},{name:mx,params:["handleScrollBarVerticalPointerDown",Zn],preventDefault:true,trackPointerEvents:[wx,px]},{name:wx,params:["handleScrollBarVerticalPointerMove",Zn]},{name:px,params:["handlePointerUp"]},{name:fx,params:["handleScrollBarHorizontalPointerDown",Xn],trackPointerEvents:[hx,gx]},{name:hx,params:["handleScrollBarHorizontalMove",Xn]},{name:gx,params:["handlePointerUp"]}];const Sv=(t,n)=>{const{lines:e}=t;return{lines:e}};const kv=async(t,n,e)=>{await bo(t,e)};const vv=async(t,n)=>{await Fo(t,n)};const Cv=(t,n)=>t;const bv=(t,n)=>{g(t);g(n);mi(t,n)};const Mv=async(t,...n)=>{const e=$n(Ge);return e.invoke(t,...n)};const Av=async t=>{const n=await Mv("RunAndDebug.getHighlight",t);return n};const Lv=()=>{const t=ts();return parseInt(t[0])};const Pv=async t=>{const n=await Av(t);const e=Lv();const o=Jo(e);if(!o){return}const{newState:s,oldState:c}=o;const r={...s,highlightedLine:n.rowIndex};ns(e,c,r);await Eo("Editor.rerender",e)};const Fv=t=>async(n,...e)=>{const o=Jo(n);const s=o.newState;const c=await t(s,...e);if(s===c){return c}const r=await pg(s,c);ns(n,s,r);return r};const Wv={"ActivateByEvent.activateByEvent":zo,"CodeGenerator.accept":Uo,"ColorPicker.loadContent":Go,"Editor.addCursorAbove":Fv(Ga),"Editor.addCursorBelow":Fv(Za),"Editor.applyDocumentEdits":Fv(td),"Editor.applyEdit":Fv(nd),"Editor.applyEdit2":$I,"Editor.applyWorkspaceEdit":Fv(od),"Editor.braceCompletion":Fv(kd),"Editor.cancelSelection":Fv(vd),"Editor.closeCodeGenerator":Fv(Ad),"Editor.closeFind":Fv(Pd),"Editor.closeFind2":UI,"Editor.closeRename":Fv(Od),"Editor.closeSourceAction":Fv(Nd),"Editor.closeWidget2":zI,"Editor.compositionEnd":Fv(Xd),"Editor.compositionStart":Fv(jd),"Editor.compositionUpdate":Fv(Gd),"Editor.contextMenu":Fv(Rh),"Editor.copy":Fv(Jd),"Editor.copyLineDown":Fv(tl),"Editor.copyLineUp":Fv(nl),"Editor.create":Ta,"Editor.create2":us,"Editor.cursorCharacterLeft":Fv(ql),"Editor.cursorCharacterRight":Fv(Kl),"Editor.cursorDown":Fv(nu),"Editor.cursorEnd":Fv(eu),"Editor.cursorHome":Fv(ou),"Editor.cursorLeft":Fv(ql),"Editor.cursorRight":Fv(Kl),"Editor.cursorSet":Fv(su),"Editor.cursorUp":Fv(au),"Editor.cursorWordLeft":Fv(du),"Editor.cursorWordPartLeft":Fv(lu),"Editor.cursorWordPartRight":Fv(uu),"Editor.cursorWordRight":Fv(fu),"Editor.cut":Fv(mu),"Editor.deleteAll":Fv(wu),"Editor.deleteAllLeft":Fv(Su),"Editor.deleteAllRight":Fv(Cu),"Editor.deleteCharacterLeft":Fv(bu),"Editor.deleteCharacterRight":Fv(Mu),"Editor.deleteHorizontalRight":Fv(vu),"Editor.deleteLeft":Fv(bu),"Editor.deleteRight":Fv(Mu),"Editor.deleteWordLeft":Fv(Au),"Editor.deleteWordPartLeft":Fv(Lu),"Editor.deleteWordPartRight":Fv(Pu),"Editor.deleteWordRight":Fv(Fu),"Editor.diff2":ja,"Editor.executeWidgetCommand":Fv(lI),"Editor.findAllReferences":Fv(Wu),"Editor.format":Fv(Bu),"Editor.getCommandIds":Zo,"Editor.getDiagnostics":_I,"Editor.getKeyBindings":jI,"Editor.getKeys":qI,"Editor.getLanguageId":WI,"Editor.getLines2":BI,"Editor.getMenuEntries":QI,"Editor.getMenuEntries2":QI,"Editor.getMenuIds":KI,"Editor.getOffsetAtCursor":TI,"Editor.getPositionAtCursor":PI,"Editor.getProblems":tS,"Editor.getQuickPickMenuEntries":nS,"Editor.getSelections":eS,"Editor.getSelections2":NI,"Editor.getSourceActions":YI,"Editor.getText":oS,"Editor.getUri":FI,"Editor.getWordAt":$u,"Editor.getWordAt2":RI,"Editor.getWordAtOffset2":DI,"Editor.getWordBefore":Yu,"Editor.getWordBefore2":OI,"Editor.goToDefinition":Fv(wh),"Editor.goToTypeDefinition":Fv(Sh),"Editor.handleBeforeInput":Fv(cS),"Editor.handleBeforeInputFromContentEditable":Fv(ag),"Editor.handleBlur":Fv(sd),"Editor.handleClickAtPosition":Fv(Wh),"Editor.handleContextMenu":Fv(Rh),"Editor.handleDoubleClick":Fv(Hh),"Editor.handleFocus":Fv(zh),"Editor.handleMouseDown":Fv(Zh),"Editor.handleMouseMove":Fv(og),"Editor.handleMouseMoveWithAltKey":Fv(cg),"Editor.handleNativeSelectionChange":dg,"Editor.handlePointerCaptureLost":Fv(lg),"Editor.handlePointerDown":Fv(ug),"Editor.handlePointerMove":Fv(Pg),"Editor.handlePointerUp":Fv(Fg),"Editor.handleScrollBarClick":Ng,"Editor.handleScrollBarHorizontalMove":Fv(Tg),"Editor.handleScrollBarHorizontalPointerDown":Fv(Rg),"Editor.handleScrollBarMove":Fv(Og),"Editor.handleScrollBarPointerDown":Fv(Ng),"Editor.handleScrollBarVerticalMove":Fv(Bg),"Editor.handleScrollBarVerticalPointerDown":Fv(Ng),"Editor.handleScrollBarVerticalPointerMove":Fv(Bg),"Editor.handleSingleClick":Fv(Vh),"Editor.handleTab":Fv(aS),"Editor.handleTouchEnd":Fv(Hg),"Editor.handleTouchMove":Fv(Vg),"Editor.handleTouchStart":Fv(Ug),"Editor.handleTripleClick":Fv(Gh),"Editor.handleWheel":Fv(jg),"Editor.hotReload":wS,"Editor.indendLess":Fv(Gg),"Editor.indentMore":Fv(Zg),"Editor.insertLineBreak":Fv(nm),"Editor.loadContent":Fv(XS),"Editor.moveLineDown":Fv(ZS),"Editor.moveLineUp":Fv(QS),"Editor.moveRectangleSelection":Fv(fg),"Editor.moveRectangleSelectionPx":Fv(hg),"Editor.moveSelection":Fv(bg),"Editor.moveSelectionPx":Fv(Lg),"Editor.offsetAt":Wr,"Editor.openCodeGenerator":Fv(rm),"Editor.openColorPicker":Fv(_d),"Editor.openCompletion":Fv(um),"Editor.openFind":Fv(Sm),"Editor.openFind2":Fv(Im),"Editor.openRename":Fv(bm),"Editor.organizeImports":Fv(Am),"Editor.paste":Fv(Pm),"Editor.pasteText":Fv(Lm),"Editor.redo":Fv(Fm),"Editor.render":xv,"Editor.render2":dv,"Editor.renderEventListeners":Iv,"Editor.replaceRange":Fv(cd),"Editor.rerender":Fv(Yx),"Editor.resize":Fv(yi),"Editor.save":Fv(Xm),"Editor.saveState":Ko(Sv),"Editor.selectAll":Fv(Zm),"Editor.selectAllLeft":Fv(Jm),"Editor.selectAllOccurrences":Fv(lw),"Editor.selectAllRight":Fv(hw),"Editor.selectCharacterLeft":Fv(gw),"Editor.selectCharacterRight":Fv(mw),"Editor.selectDown":Fv(pw),"Editor.selectInsideString":Fv(Ew),"Editor.selectionGrow":Fv(Iw),"Editor.selectLine":Fv(qh),"Editor.selectNextOccurrence":Fv(Cw),"Editor.selectPreviousOccurrence":Fv(bw),"Editor.selectUp":Fv(Aw),"Editor.selectWord":Fv(Nh),"Editor.selectWordLeft":Fv(Lw),"Editor.selectWordRight":Fv(Pw),"Editor.setDebugEnabled":Fv(Cv),"Editor.setDecorations":Fv(Fw),"Editor.setDelta":Fv(_g),"Editor.setDeltaY":Fv($g),"Editor.setLanguageId":Fv(Ww),"Editor.setSelections":Fv(Tw),"Editor.setSelections2":HI,"Editor.setText":Fv(Rw),"Editor.showHover":Yw,"Editor.showHover2":Uw,"Editor.showSourceActions":Zw,"Editor.showSourceActions2":Zw,"Editor.showSourceActions3":Zw,"Editor.sortLinesAscending":Fv(np),"Editor.tabCompletion":Fv(ap),"Editor.terminate":e,"Editor.toggleBlockComment":Fv(mp),"Editor.toggleComment":Fv(xp),"Editor.toggleLineComment":Fv(Ep),"Editor.type":Fv(Ip),"Editor.typeWithAutoClosing":Fv(Hp),"Editor.undo":Fv(Up),"Editor.unIndent":Fv($p),"Editor.updateDebugInfo":Pv,"Editor.updateDiagnostics":Fv(Wa),"EditorCompletion.close":gy,"EditorCompletion.closeDetails":my,"EditorCompletion.focusFirst":wy,"EditorCompletion.focusIndex":py,"EditorCompletion.focusNext":Ey,"EditorCompletion.focusPrevious":xy,"EditorCompletion.handleEditorBlur":Iy,"EditorCompletion.handleEditorClick":Sy,"EditorCompletion.handleEditorDeleteLeft":ky,"EditorCompletion.handleEditorType":vy,"EditorCompletion.handlePointerDown":Cy,"EditorCompletion.handleWheel":by,"EditorCompletion.openDetails":My,"EditorCompletion.selectCurrent":Ay,"EditorCompletion.selectIndex":Ly,"EditorCompletion.toggleDetails":Py,"EditorRename.accept":Hx,"EditorRename.close":zx,"EditorRename.handleInput":Ux,"EditorSourceAction.close":Qx,"EditorSourceAction.closeDetails":Kx,"EditorSourceAction.focusFirst":Jx,"EditorSourceAction.focusIndex":tI,"EditorSourceAction.focusNext":eI,"EditorSourceAction.focusPrevious":oI,"EditorSourceAction.handleWheel":sI,"EditorSourceAction.selectCurrent":cI,"EditorSourceAction.selectIndex":rI,"EditorSourceAction.selectItem":iI,"EditorSourceAction.toggleDetails":aI,"EditorSourceActions.focusNext":Vx,"ExtensionHostManagement.activateByEvent":zo,"FindWidget.close":By,"FindWidget.focusCloseButton":Ny,"FindWidget.focusFind":Hy,"FindWidget.focusNext":zy,"FindWidget.focusNextElement":Uy,"FindWidget.focusNextMatchButton":$y,"FindWidget.focusPrevious":Yy,"FindWidget.focusPreviousElement":_y,"FindWidget.focusPreviousMatchButton":Vy,"FindWidget.focusReplace":jy,"FindWidget.focusReplaceAllButton":qy,"FindWidget.focusReplaceButton":Gy,"FindWidget.focusToggleReplace":Xy,"FindWidget.handleBlur":Zy,"FindWidget.handleClickButton":Qy,"FindWidget.handleFocus":Ky,"FindWidget.handleInput":Jy,"FindWidget.handleReplaceFocus":tE,"FindWidget.handleReplaceInput":nE,"FindWidget.handleToggleReplaceFocus":eE,"FindWidget.loadContent":Em,"FindWidget.replace":oE,"FindWidget.replaceAll":sE,"FindWidget.toggleMatchCase":cE,"FindWidget.toggleMatchWholeWord":rE,"FindWidget.togglePreserveCase":iE,"FindWidget.toggleReplace":aE,"FindWidget.toggleUseRegularExpression":dE,"Font.ensure":VI,"HandleMessagePort.handleMessagePort":rS,"Hover.getHoverInfo":kE,"Hover.handleSashPointerDown":CE,"Hover.handleSashPointerMove":bE,"Hover.handleSashPointerUp":ME,"Hover.loadContent":vE,"Hover.render":Rx,"Initialize.initialize":IS,"Listener.register":KS,"Listener.registerListener":gi,"Listener.unregister":bv,"SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker":kv,"SendMessagePortToExtensionManagementWorker.sendMessagePortToExtensionManagementWorker":vv};for(const[t,n]of Object.entries(Wv)){if(t.startsWith("Editor.")){Wv["EditorText"+t.slice("Editor".length)]=n}}const Tv=async()=>{const t="HandleMessagePort.handleMessagePort2";const n=await On({commandMap:{},async send(n){await kv(n,t,Xe)}});return n};const Rv=async()=>{const t=await Tv();ha(t)};const Dv=async()=>{const t=await On({commandMap:{},async send(t){await Fo(t,Xe)}});return t};const Ov=async()=>{try{const t=await Dv();fo(t)}catch{}};const Bv=t=>ko(t);const Nv=async()=>{const t=await On({commandMap:{},send:Bv});mo(t)};const Hv=async()=>{const t=await Nn({commandMap:Wv});Io(t)};const zv=t=>Po(t);const Uv=async()=>{const t=await On({commandMap:{},send:zv});yo(t)};const $v=async()=>{Qo(Wv);await Promise.all([Hv(),Rv(),Ov(),Uv(),Nv()])};const Yv="CodeGeneratorInput";const _v=t=>{const n=Of();const e=Bf();return[{childCount:2,className:Ok(XE,PE),type:Ex},{childCount:0,className:Ok(AE,qE),name:Yv,placeholder:e,type:xx},{childCount:1,className:LE,type:Ex},vx(n)]};const Vv={apply(t,n){const e=_v();return[iy,n.uid,e]},isEqual:(t,n)=>t.questions===n.questions};const jv={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[sy,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height};const qv={apply:(t,n)=>[Jp,".CodeGeneratorInput",n.focusSource],isEqual:(t,n)=>t.focused===n.focused&&t.focusSource===n.focusSource};const Gv=[Vv,jv,qv];const Xv=(t,n)=>{const e=[];for(const o of Gv){if(!o.isEqual(t,n)){e.push(o.apply(t,n))}}return e};const Zv=t=>{const n=Xv(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(t[0]===iy){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const Qv=t=>_p(t,"EditorCodeGenerator",Zv);const Kv=jx;const Jv={__proto__:null,add:Qv,remove:Kv,render:Zv};const tC=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const nC=[iy,ry,Kp,cy,ty,ay];const eC=t=>{const n=tC(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(nC.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const oC=t=>_p(t,"ColorPicker",eC);const sC=jx;const cC={};const rC={__proto__:null,Commands:cC,add:oC,remove:sC,render:eC};const iC=t=>{const n=[{childCount:2,className:"Viewlet EditorCompletionDetails",type:Ex},{childCount:1,className:RE,type:Ex},vx(t),{childCount:1,className:TE,onClick:KE,type:Ex},{childCount:0,className:`${GE} ${jE}`,type:Ex}];return n};const aC=(t,n,e)=>{const o=[];for(const s of t){if(!s.isEqual(n,e)){o.push(s.apply(n,e))}}return o};const dC={apply(t,n){const e=iC(n.content);return[iy,n.uid,e]},isEqual:(t,n)=>t.content===n.content};const lC={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[sy,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height};const uC=[dC,lC];const fC=(t,n)=>aC(uC,t,n);const hC=(t,n)=>{const{widgets:e}=t;for(const t of e){if(t.id===n){return t.newState}}return undefined};const gC=t=>hC(t,Te);const mC=t=>{const n=fC(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(t[0]===iy){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const wC=t=>_p(t,"EditorCompletionDetails",mC);const pC=jx;const yC=(t,n)=>{const e=gC(t);if(!e){return t}const{x:o}=km(t);const s=o+e.width-n.borderSize;return{...n,x:s}};const EC=(t,n)=>yC(t,n);const xC=(t,n)=>yC(t,n);const IC={__proto__:null,add:wC,handleEditorDeleteLeft:xC,handleEditorType:EC,remove:pC,render:mC};const SC=[iy,ry,Kp,cy,ty,ny,ey,oy,ay,"Viewlet.focusSelector"];const kC=t=>{const n=dy(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(SC.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const vC=t=>_p(t,"EditorCompletion",kC);const CC=t=>[["Viewlet.dispose",t.newState.uid]];const{close:bC}=Qp(["close"],"",Oe);const MC={__proto__:null,add:vC,close:bC,remove:CC,render:kC};const AC=()=>{Ps(We,rC);Ps(Te,Fy);Ps(Re,IC);Ps(De,lE);Ps(Oe,MC);Ps(Be,$x);Ps(Ne,dI);Ps(Fe,Jv)};const LC=t=>{t.preventDefault();console.error(`[editor-worker] Unhandled Rejection: ${t.reason}`)};const PC=(t,n,e,o,s)=>{console.error(`[editor-worker] Unhandled Error: ${s}`);return true};const FC=t=>{t.addEventListener("error",PC);t.addEventListener("unhandledrejection",LC)};const WC=async()=>{FC(globalThis);await $v();AC()};WC();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.13.0",
3
+ "version": "19.14.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"