@lvce-editor/editor-worker 19.17.3 → 19.18.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.
@@ -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 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 $=/^\s*at async Promise.all \(index \d+\)$/;const U=t=>z.test(t)&&!$.test(t);const Y=t=>{const n=t.findIndex(U);if(n===-1){return{actualMessage:H(t),rest:[]}}let e=n-1;while(++e<t.length){if(!U(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 $t="TypeError";const Ut=(t,n)=>{if(n){switch(n){case Nt:return DOMException;case Ht:return ReferenceError;case zt:return SyntaxError;case $t: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=Ut(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 $n=(t,n)=>{zn[t]=n};const Un=t=>zn[t];const Yn=t=>{delete zn[t]};const _n=t=>({async dispose(){const n=Un(t);await n.dispose()},invoke(n,...e){const o=Un(t);return o.invoke(n,...e)},invokeAndTransfer(n,...e){const o=Un(t);return o.invokeAndTransfer(n,...e)},registerMockRpc(n){const e=Hn({commandMap:n});$n(t,e);e[Symbol.dispose]=()=>{Yn(t)};return e},set(n){$n(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 $e=1<<9>>>0;const Ue=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();$n(t,n)};const s=async()=>{if(!n){n=o()}await n};return{async invoke(n,...e){await s();const o=Un(t);return o.invoke(n,...e)},async invokeAndTransfer(n,...e){await s();const o=Un(t);return o.invokeAndTransfer(n,...e)},setFactory(t){e=t}}};const zo=async(t,n,e)=>{w(t);await Lo(t,n,e)};const $o=t=>t;const Uo=6;const Yo=async(t,n,e)=>{const o=await Rn({commandMap:{},isMessagePortOpen:true,async send(e){await xo("IpcParent.create",{method:Uo,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 $s="Class";const Us=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 Us: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 $s;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 $c=t=>{zc.enabled=t};const Uc=()=>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(Uc()){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(Uc()){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 $r=(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 Ur=(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 $r(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}=Ur(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,Us,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===Us&&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=Un(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 $i=t=>zi(t,Ni);const Ui=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=>{const n=Lr(t);await fa(ua,t.uri,t.id,t.languageId,n);return Aa(t)};const Ta=async(t,n)=>{const e=await Pa(t,n);const o=e.flatMap(t=>[t.offset,t.length,t.type,t.modifiers||0]);const s=Fa(t,o);return{...t,decorations:s,diagnostics:n,visualDecorations:e}};const Ra=(t,n)=>{if(t instanceof Error&&t.message.includes("No diagnostic provider found")){return n}console.error(`Failed to update diagnostics: ${t}`);return n};const Da=async t=>{try{const n=await Wa(t);if(!Jo(t.id)){return t}return Ta(t,n)}catch(n){return Ra(n,t)}};const Oa=async t=>{try{const n=await Wa(t);const e=Jo(t.id);if(!e){return t}const o=await Ta(e.newState,n);ns(t.id,e.oldState,o);await Eo("Editor.rerender",t.id);return o}catch(n){return Ra(n,t)}};const Ba=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 $=li(z);const U={...z,decorations:$};const Y=Kr();const{differences:_,textInfos:V}=await _r(U,Y);const j={...U,differences:_,focus:ro,focused:true,textInfos:V};ns(u,aa,j);await fa(ua,L,u,E,o);const q=s?await Oa(j):j;const G=await Ia("editor.completionsOnType");const X=Boolean(G);ns(u,aa,{...q,completionsOnType:X})};const Na=(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 Ha=(t,n)=>{if(!n.focused){return true}if(!t.isSelecting&&n.isSelecting){return false}return t.focused===n.focused&&t.focus===n.focus};const za=(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 $a=6;const Ua=7;const Ya=11;const _a=12;const Va=13;const ja=(t,n)=>t.widgets===n.widgets;const qa=[za,Ha,Ha,Na,ja];const Ga=[_a,$a,Ua,Ya,Va];const Xa=(t,n)=>{const e=[];for(let o=0;o<qa.length;o++){const s=qa[o];if(!s(t,n)){e.push(Ga[o])}}return e};const Za=t=>{const{newState:n,oldState:e}=Jo(t);const o=Xa(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 Ka=t=>{const{selections:n}=t;const e=Qa(n);return{...t,selections:e}};const Ja=(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 td=t=>{const{lines:n,selections:e}=t;const o=Ja(e,n.length);return{...t,selections:o}};const nd=(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 ed=(...t)=>{console.warn(...t)};const od=(...t)=>{console.error(...t)};const sd=(t,n)=>{if(!Array.isArray(n)){ed("something is wrong with format on save",n);return t}if(n.length===0){return t}const e=nd(t,n);return ea(t,e)};const cd=async(t,n)=>{h(t);m(n);return ea(t,n)};const rd=(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 id=async(t,n)=>{h(t);m(n);const e=rd(t,n);if(e.length===0){return t}return ea(t,e)};const ad=t=>{if(!t.focused){return t}const n={...t,focused:false};return n};const dd=(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 ld=(t,n,e)=>{const{selections:o}=t;return dd(t,o,n,e)};const ud=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 fd=()=>"Segmenter"in Intl;const hd=()=>{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 gd=async(t,n,e,o,s,c,r,i)=>{const a=hd();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 md=(t,n)=>{const e=Math.round(t/n);return e};const wd=(t,n,e)=>{let o=n;for(let s=0;s<n;s++){if(t[s]===Er){o-=e-1}}return o};const pd=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=md(a,r);const l=Ir(t);const u=wd(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 ud(t,u,r,a,n,e,o,s,c,r)}return await gd(t,u,r,a,n,e,o,s)};const yd=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 pd(I,a,i,r,l,d,o,m,E);return{columnIndex:S,rowIndex:x}};const Ed=(t,n,e)=>{const{columnWidth:o,x:s}=t;const c=e*o+s;return c};const xd=(t,n)=>{const{rowHeight:e,y:o}=t;const s=(n+1)*e+o;return s};const Id={timeout:-1};const Sd=async(t,n,e,o,s)=>{h(t);g(n);g(e);w(o);const c=Ed(t,n,e);const r=xd(t,n);const i=o;await Eo("Editor.showOverlayMessage",t,"Viewlet.send",t.uid,"showOverlayMessage",c,r,i);if(!s){const n=()=>{vd(t)};Id.timeout=setTimeout(n,3e3)}return t};const kd=async(t,n,e,o)=>Sd(t,n,e,o,true);const vd=async t=>{clearTimeout(Id.timeout);Id.timeout=-1;return t};const Cd=String;const bd=t=>{switch(t){case"(":return")";case"[":return"]";case"{":return"}";default:return"???"}};const Md=async(t,n)=>{try{const e=Ad(t);const o=await Eo("ExtensionHostBraceCompletion.executeBraceCompletionProvider",t,e,n);if(o){const e=bd(n);const o=n+e;const s=ld(t,[o],xs);return ea(t,s)}const s=ld(t,[n],xs);return ea(t,s)}catch(n){console.error(n);const e=Array.isArray(t.cursor)?t.cursor[0]:t.cursor;return kd(t,e,Cd(n))}};const Ad=t=>Wr(t,t.selections[0],t.selections[1]);const Ld=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 Pd=(t,n)=>{for(const[e,o]of t.entries()){if(o.id===n){return e}}return-1};const Fd=(t,n)=>{const e=Pd(t,n);const o=[...t.slice(0,e),...t.slice(e+1)];return o};const Wd=t=>t.id===Fe;const Td=t=>{const{widgets:n}=t;const e=n.findIndex(Wd);if(e===-1){return t}const o=Fd(n,Fe);return{...t,focused:true,widgets:o}};const Rd=t=>t.id===De;const Dd=t=>{const{widgets:n}=t;const e=n.findIndex(Rd);if(e===-1){return t}const o=Fd(n,De);return{...t,focused:true,widgets:o}};const Od=async()=>{const t="Rename Worker";const n="renameWorkerMain.js";const e=await Yo(t,n);await e.invoke("Rename.initialize");return e};const Bd={};const Nd=()=>{if(!Bd.workerPromise){Bd.workerPromise=Od()}return Bd.workerPromise};const Hd=async(t,...n)=>{const e=await Nd();return await e.invoke(t,...n)};const zd=t=>t.id===Be;const $d=async t=>{const{uid:n,widgets:e}=t;const o=e.findIndex(zd);if(o===-1){return t}const s=e[o];await Hd("Rename.close",s.newState.uid);const c=Jo(n);const{newState:r}=c;return r};const Ud=t=>t.id===Ne;const Yd=t=>{const{widgets:n}=t;const e=n.findIndex(Ud);if(e===-1){return t}const o=Fd(n,Ne);return{...t,widgets:o}};const _d=(t,n)=>{for(const e of t){if(e.id===n){return true}}return false};const Vd=async(t,n,e,o,s,c)=>{const{widgets:r}=e;if(_d(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 jd=()=>Math.random();const qd=()=>{const t=jd();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 Gd=(t,n)=>Go(t,n);const Xd=async t=>Vd(We,os,t,qd,Gd);const Zd={compositionText:"",isComposing:false};const Qd=(t,n)=>{Zd.isComposing=true;return t};const Kd=(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-Zd.compositionText.length;e.push({deleted:[Zd.compositionText],end:{columnIndex:i,rowIndex:r},inserted:[n],origin:fs,start:{columnIndex:a,rowIndex:s}})}return e};const Jd=(t,n)=>{const{selections:e}=t;const o=Kd(e,n);Zd.compositionText=n;return ea(t,o)};const tl=(t,n)=>{const{selections:e}=t;const o=Kd(e,n);Zd.isComposing=false;Zd.compositionText="";return ea(t,o)};const nl=async t=>{try{w(t);await Mo(t)}catch(t){throw new k(t,"Failed to write text to clipboard")}};const el=(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 ol=(t,n,e,o)=>t===e&&n===o;const sl=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=ol(o,s,c,r);const a=el(n,i,o,s,c,r);const d=Pr(t,a);const l=vr(d);const u=i?"\n"+l:l;await nl(u);return t};const cl=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 rl=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 il=(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 al=(t,n,e,o)=>{t[n]=e;t[n+1]=o};const dl=(t,n,e,o)=>{t[n]=t[n+2]=e;t[n+1]=t[n+3]=o};const ll=(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 ul=(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{ll(o,s,c,r,n,e);ll(o,s+2,c,r,n,e)}}else{dl(o,s,t[s],t[s+1])}}return o};const fl=(t,n)=>{const{lines:e,selections:o}=t;const s=ul(o,e,n);return na(t,s)};const hl=(t,n)=>{if(!fd()){return 1}if(n>t.length){return 1}const e=hd();const o=e.at(t,n-1);if(!o){return 1}return n-o.index};const gl=()=>2;const ml=(t,n)=>{if(!fd()){return 1}const e=hd();const o=e.at(t,n);return o.segment.length};const wl=t=>t===yr||t===Er;const pl=(t,n)=>{if(t.length===0){return 0}for(let e=0;e<n;e++){if(!wl(t[e])){return n-e}}return n};const yl=(t,n)=>t.length-n;const El=(t,n)=>{for(const e of n){const n=t.match(e);if(n){return n[0].length}}return 1};const xl=/(?<![A-Z])[A-Z]+\s*$/;const Il=/[\u{C0}-\u{17F}\w\-]+>?\s*$/u;const Sl=/[a-zA-Z]+[^a-zA-Z\d]+\s*$/;const kl=/\s+$/;const vl=/[^a-zA-Z\d]+\s*$/;const Cl=[xl,Il,Sl,kl,vl];const bl=(t,n)=>{const e=t.slice(0,n);return El(e,Cl)};const Ml=/^\s*[\u{C0}-\u{17F}\w]+/iu;const Al=/^[^a-zA-Z\d]+\w*/;const Ll=[Ml,Al];const Pl=(t,n)=>{const e=t.slice(n);return El(e,Ll)};const Fl=/(?<![A-Z])[A-Z]{2}[a-z]+$/;const Wl=/(?=[A-Z]+)[A-Z][a-z]+$/;const Tl=/[A-Z]+[a-z]+\d?\s*$/;const Rl=/[A-Z]+\d*\s*$/;const Dl=/[a-z]+\d*\s*$/;const Ol=/[A-Z]*[a-z]+_+\s*$/;const Bl=/(?<![A-Z])[A-Z]_+\s*$/;const Nl=/[a-z]+\s*$/;const Hl=/[^a-zA-Z\d\s]+\s*$/;const zl=[Fl,Wl,Tl,Rl,Dl,Ol,Bl,Nl,Hl];const $l=(t,n)=>{const e=t.slice(0,n);return El(e,zl)};const Ul=/^\s*[a-z]+\d?/;const Yl=/^\s*[A-Z]{2}[a-z\d]+/;const _l=/^\s*[A-Z]+(?=[A-Z][a-z]+)/;const Vl=/^\s*[A-Z]+[a-z]*\d*/;const jl=/^\s*_+[a-z]*\d?/;const ql=/^\s*[^\da-zA-Z\s]+/;const Gl=[Ul,_l,Vl,jl,ql];const Xl=[Ul,Yl,_l,Vl,jl,ql];const Zl=/[A-Z]/;const Ql=(t,n)=>{const e=t.slice(n);if(Zl.test(t[n-1])){return El(e,Gl)}return El(e,Xl)};const Kl=t=>fl(t,hl);const Jl=(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 tu=(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 nu=(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){tu(o,s,c,r,n,e)}else{o[s]=o[s+2]=i;o[s+1]=o[s+3]=a}}return o};const eu=(t,n)=>{const{lines:e,selections:o}=t;const s=nu(o,e,n);return na(t,s)};const ou=t=>eu(t,ml);const su=(t,n,e,o,s,c)=>{Bi(t,n,s+1,c)};const cu=t=>Di(t,su);const ru=t=>{const{selections:n}=t;const e=cu(n);return na(t,e)};const iu=t=>eu(t,yl);const au=t=>fl(t,pl);const du=(t,n,e)=>{h(t);g(n);g(e);const o=Wi(n,e,n,e);return na(t,o)};const lu=(t,n,e,o,s,c)=>{if(e===0){Bi(t,n,0,0)}else{Bi(t,n,e-1,o)}};const uu=t=>Di(t,lu);const fu=(t,n,e,o)=>{const{selections:s}=t;const c=uu(s);return na(t,c)};const hu=t=>fu(t);const gu=t=>fl(t,bl);const mu=t=>fl(t,$l);const wu=t=>eu(t,Ql);const pu=t=>eu(t,Pl);const yu=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=dd(t,c,[""],ps);await nl(vr(i));return ea(t,a,r)};const Eu=async t=>{const n=ld(t,[""],ps);const e=n.map(t=>vr(t.deleted)).filter(t=>t.length>0);const o=vr(e);await nl(o);return ea(t,n)};const xu=async t=>{const{selections:n}=t;if($i(n)){return yu(t)}return Eu(t)};const Iu=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 Su=(t,n,e)=>{const o=[];const s=(n,s,c,r)=>{const i=il(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 ku=(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 vu=(t,n)=>{for(let e=0;e<n.length;e+=4){const[o,s,c,r]=Si(n,e);if(!ku(t,o,s,c,r)){return false}}return true};const Cu=t=>{const{lines:n,selections:e}=t;for(let t=0;t<e.length;t+=4){e[t+1]++;e[t+3]++}const o=Su(n,e,gl);return ea(t,o)};const bu=(t,n)=>{const{autoClosingRanges:e=[],lines:o,selections:s}=t;if(vu(e,s)){return Cu(t)}if($i(s)){const e=Su(o,s,n);return ea(t,e)}const c=ld(t,[""],ws);return ea(t,c)};const Mu=t=>bu(t,pl);const Au=(t,n)=>{const{selections:e}=t;if($i(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=Jl(a,s,n);o.push({deleted:Pr(t,{end:d,start:a}),end:d,inserted:[""],origin:ms,start:a})}return o}const o=ld(t,[""],ms);return o};const Lu=(t,n)=>{const e=Au(t,n);return ea(t,e)};const Pu=t=>Lu(t,yl);const Fu=t=>{const n=bu(t,hl);return n};const Wu=t=>Lu(t,ml);const Tu=t=>{const n=bu(t,bl);return n};const Ru=t=>{const n=bu(t,$l);return n};const Du=t=>Lu(t,Ql);const Ou=t=>Lu(t,Pl);const Bu=async t=>{await Eo("SideBar.show","References",true);return t};const Nu=async t=>{const n={documentId:t.id||t.uid,languageId:t.languageId,text:Lr(t),uri:t.uri};return uo("Extensions.executeFormattingProvider",n)};const Hu="Failed to execute formatting provider: FormattingError:";const zu=t=>t&&t instanceof Error&&t.message.startsWith(Hu);const $u="Failed to execute formatting provider: FormattingError:";const Uu=async t=>{try{const n=await Nu(t);return sd(t,n)}catch(n){if(zu(n)){console.error("Formatting Error:",n.message.slice($u.length));return t}console.error(n);const e=String(n);await Sd(t,0,0,e,true);return t}};const Yu=/^[\w\-]+/;const _u=/[\w\-]+$/;const Vu=(t,n)=>{const e=t.slice(0,n);const o=e.match(_u);const s=t.slice(n);const c=s.match(Yu);let r=wr;if(o){r+=o[0]}if(c){r+=c[0]}return{word:r}};const ju=(t,n)=>{const e=t.slice(0,n);const o=e.match(_u);if(o){return o[0]}return wr};const qu=(t,n,e)=>{const{lines:o}=t;const s=o[n];return Vu(s,e)};const Gu=(t,n,e)=>{const{lines:o}=t;const s=o[n];return ju(s,e)};const Xu=async(t,n)=>{const e=await Eo("ExtensionHostDefinition.executeDefinitionProvider",t,n);return e};const Zu={};const Qu=/\{(PH\d+)\}/g;const Ku=(t,n=Zu)=>{if(n===Zu){return t}const e=(t,e)=>n[e];return t.replaceAll(Qu,e)};const Ju="Copy";const tf="Cut";const nf="Editor: Close Color Picker";const ef="Editor: Copy Line Down";const of="Editor: Copy Line Up";const sf="Editor: Format Document (forced)";const cf="Editor: Go To Definition";const rf="Editor: Go To Type Definition";const af="Editor: Indent";const df="Editor: Open Color Picker";const lf="Editor: Select All Occurrences";const uf="Editor: Select Down";const ff="Editor: Select Inside String";const hf="Editor: Select Next Occurrence";const gf="Editor: Select Up";const mf="Show Hover";const wf="Editor: Sort Lines Ascending";const pf="Editor: Toggle Comment";const yf="Editor: Unindent";const Ef="Enter Code";const xf="Escape to close";const If="Find All Implementations";const Sf="Find All References";const kf="Format Document";const vf="Go to Definition";const Cf="Go to Type Definition";const bf="Move Line Down";const Mf="Move Line Up";const Af="No definition found";const Lf="No definition found for '{PH1}'";const Pf="No type definition found";const Ff="No type definition found for '{PH1}'";const Wf="Paste";const Tf="Source Action";const Rf="Toggle Block Comment";const Df=()=>Ku(vf);const Of=()=>Ku(Af);const Bf=t=>Ku(Lf,{PH1:t});const Nf=t=>Ku(Ff,{PH1:t});const Hf=()=>Ku(Pf);const zf=()=>Ku(Tf);const $f=()=>Ku(xf);const Uf=()=>Ku(Ef);const Yf=()=>Ku(Cf);const _f=()=>Ku(Sf);const Vf=()=>Ku(If);const jf=()=>Ku(tf);const qf=()=>Ku(Ju);const Gf=()=>Ku(Wf);const Xf=()=>Ku(Rf);const Zf=()=>Ku(Mf);const Qf=()=>Ku(bf);const Kf=()=>Ku(kf);const Jf=()=>Ku(mf);const th=()=>Ku(sf);const nh=()=>Ku(hf);const eh=()=>Ku(lf);const oh=()=>Ku(cf);const sh=()=>Ku(rf);const ch=()=>Ku(ff);const rh=()=>Ku(af);const ih=()=>Ku(yf);const ah=()=>Ku(wf);const dh=()=>Ku(pf);const lh=()=>Ku(gf);const uh=()=>Ku(uf);const fh=()=>Ku(df);const hh=()=>Ku(nf);const gh=()=>Ku(ef);const mh=()=>Ku(of);const wh=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=qu(t,r,i);const e=o(n);return Sd(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 Sd(t,r,i,o,false);return t}const o=n(e);await Sd(t,r,i,o,true);return t}};const ph=async(t,n,e)=>{const o=Wr(t,n,e);const s=await Xu(t,o);return s};const yh=t=>{if(t.word){return Bf(t.word)}return Of()};const Eh=String;const xh=t=>t?.message?.startsWith("Failed to execute definition provider: No definition provider found");const Ih=async t=>wh({editor:t,getErrorMessage:Eh,getLocation:ph,getNoLocationFoundMessage:yh,isNoProviderFoundError:xh});const Sh=t=>{if(t.word){return Nf(t.word)}return Hf()};const kh=async(t,n)=>{const e=await Eo("ExtensionHostTypeDefinition.executeTypeDefinitionProvider",t,n);return e};const vh=async(t,n,e)=>{const o=Wr(t,n,e);const s=await kh(t,o);return s};const Ch=String;const bh=t=>t?.message?.startsWith("Failed to execute type definition provider: No type definition provider found");const Mh=async(t,n=true)=>wh({editor:t,getErrorMessage:Ch,getLocation:vh,getNoLocationFoundMessage:Sh,isNoProviderFoundError:bh});const Ah=t=>{switch(t){case De:return true;default:return false}};const Lh=t=>{if(t.length===0){return t}return t.filter(Ah)};const Ph=async(t,n)=>{await wo(t,n)};const Fh=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 Ph(r,e);return t}const i={...t,selections:new Uint32Array([s,o,s,o])};const a=await Ih(i);return a};const Wh=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 Th=1;const Rh=2;const Dh=(t,n)=>{const e=Lh(t.widgets);return{...t,focused:true,selectionAnchorPosition:n,selections:new Uint32Array([n.rowIndex,n.columnIndex,n.rowIndex,n.columnIndex]),widgets:e}};const Oh=t=>{switch(t){case Rh:return Fh;case Th:return Wh;default:return Dh}};const Bh=async(t,n,e,o)=>{h(t);g(n);g(e);g(o);const s=Oh(n);const c=await s(t,{columnIndex:o,rowIndex:e});return c};const Nh=3;const Hh=async(t,n,e,o)=>{const{uid:s}=t;await So(s,Nh,e,o,{menuId:Nh});return t};const zh=/^[a-zA-Z\u{C0}-\u{17F}\d]+/u;const $h=/[a-zA-Z\u{C0}-\u{17F}\d]+$/u;const Uh=(t,n,e)=>{const o=t.slice(0,e);const s=t.slice(e);const c=o.match($h);const r=s.match(zh);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 Yh=(t,n,e)=>{const o=Ar(t,n);const s=Uh(o,n,e);return na(t,s)};const _h=async(t,n,e,o)=>{const s=await yd(t,e,o);return Yh(t,s.rowIndex,s.columnIndex)};const Vh=t=>{if(t.focused&&t.focus===ro){return t}return{...t,additionalFocus:0,focus:ro,focused:true}};const jh=1;const qh=2;const Gh=3;const Xh=(t,n)=>{if(t){return Rh}if(n){return Th}return 0};const Zh=async(t,n,e,o)=>{h(t);g(n);g(e);g(o);const s=await yd(t,e,o);return Bh(t,n,s.rowIndex,s.columnIndex)};const Qh=(t,n)=>new Uint32Array([n,0,n,t.length]);const Kh=t=>{const{selections:n}=t;const e=n[t.primarySelectionIndex];const o=Ar(t,e);const s=Qh(o,e);return na(t,s)};const Jh=(t,n,e,o)=>{h(t);g(e);g(o);return Kh(t)};const tg=0;const ng=async(t,n,e,o,s,c,r)=>{if(n!==tg){return t}const i=Xh(e,o);let a;switch(r){case qh:a=await _h(t,i,s,c);break;case jh:a=await Zh(t,i,s,c);break;case Gh:a=Jh(t,i,s,c);break;default:return t}return{...a,isSelecting:true}};const eg={editor:undefined,timeout:-1,x:0,y:0};const og=()=>eg;const sg=(t,n,e,o)=>{eg.editor=t;eg.timeout=n;eg.x=e;eg.y=o};const cg=async(t,n)=>{};const rg=async()=>{const{editor:t,x:n,y:e}=og();await yd(t,n,e);await cg()};const ig=300;const ag=(t,n,e)=>{if(!t.hoverEnabled){return t}const o=og();if(o.timeout!==-1){clearTimeout(o.timeout)}const s=setTimeout(rg,ig);sg(t,s,n,e);return t};const dg=(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 lg=async(t,n,e)=>{h(t);g(n);g(e);const o=await yd(t,n,e);const s=Wr(t,o.rowIndex,o.columnIndex);try{const n=await Xu(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=dg(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 ug=(t,n)=>new Uint32Array([n.startRowIndex,n.startColumnIndex,n.endRowIndex,n.endColumnIndex]);const fg=(t,n,e)=>{const o=ug(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 hg=(t,n,e)=>{const o=fg(t,n,e);return ea(t,o)};const gg=(t,n)=>{const e=ug(t,n);return na(t,e)};const mg=t=>({...t,hasListener:false,isSelecting:false,selectionAutoMovePosition:{columnIndex:0,rowIndex:0}});const wg=async(t,n,e,o,s,c,r)=>t;const pg=(t,n)=>t;const yg=async(t,n,e)=>{await yd(t,n,e)};const Eg=t=>{globalThis.requestAnimationFrame(t)};const xg=(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 Ig=(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 Sg=async(t,n)=>{let e=n;if(Ig(t,n)){const t=Kr();const{differences:o,textInfos:s}=await _r(n,t);e={...n,differences:o,textInfos:s}}if(!xg(t,n)){return e}const{cursorInfos:o,selectionInfos:s}=await qi(e);return{...e,cursorInfos:o,selectionInfos:s}};const kg=-1;const vg=0;const Cg=1;const bg=(t,n)=>{if(t.rowIndex>n.rowIndex){return Cg}if(t.rowIndex===n.rowIndex){if(t.columnIndex>n.columnIndex){return Cg}if(t.columnIndex<n.columnIndex){return kg}return vg}return kg};const Mg=(t,n)=>new Uint32Array([t.rowIndex,t.columnIndex,n.rowIndex,n.columnIndex]);const Ag=(t,n)=>new Uint32Array([n.rowIndex,n.columnIndex,n.rowIndex,n.columnIndex]);const Lg=(t,n)=>new Uint32Array([t.rowIndex,t.columnIndex,n.rowIndex,n.columnIndex]);const Pg=(t,n)=>{switch(bg(n,t)){case vg:return Ag(t,n);case Cg:return Lg(t,n);case kg:return Mg(t,n);default:throw new Error("unexpected comparison result")}};const Fg=(t,n)=>{const e=t.selectionAnchorPosition;const o=Pg(e,n);return na(t,o)};const Wg=(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 Tg=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=Wg(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 Sg(e,r);ns(e.uid,e,i);Eg(()=>Tg(t))};const Rg=async(t,n,e)=>{h(t);g(n);g(e);const o=await yd(t,n,e);const s=Fg(t,o);if(!t.hasListener&&(o.rowIndex<t.minLineY||o.rowIndex>t.maxLineY)){Eg(()=>Tg(t.uid));return{...s,hasListener:true,selectionAutoMovePosition:o}}return s};const Dg=async(t,n,e,o)=>{if(!t.isSelecting){return t}if(o){return yg(t,n,e)}return Rg(t,n,e)};const Og=t=>({...t,hasListener:false,isSelecting:false,selectionAutoMovePosition:{columnIndex:0,rowIndex:0}});const Bg=(t,n,e)=>{if(e<=0){return 0}if(e<=t-n/2){return e/(t-n)}return 1};const Ng=(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=Bg(s,d,a);const f=Ds(u,0,1);const h=f*l;return{...t,deltaX:h}};const Hg=(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 zg=(t,n)=>{const{height:e,scrollBarHeight:o}=t;if(n<=e-o/2){return n/(e-o)}return 1};const $g=async(t,n)=>{const{finalDeltaY:e,handleOffset:o=0,y:s}=t;const c=n-s-o;const r=zg(t,c);const i=r*e;const a=await Qi(t,i);return a};const Ug=$g;const Yg=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 _g=(t,n)=>{};const Vg={deltaY:0,touchOffsetY:0};const jg=(t,n)=>{if(n.touches.length===0){return}const e=n.touches[0];Vg.touchOffsetY=e.y;Vg.deltaY=t.deltaY};const qg=(t,n)=>Ki(t,n);const Gg=(t,n)=>Qi(t,n);const Xg=(t,n,e,o)=>{g(n);g(e);g(o);const{deltaX:s}=t;if(e===0){return qg(t,o)}const c=Ds(s+e,0,Infinity);return{...qg(t,o),deltaX:c}};const Zg=(t,n)=>{if(n.touches.length===0){return}const e=n.touches[0];const o=Vg.deltaY+(Vg.touchOffsetY-e.y);Gg(t,o)};const Qg=(t,n,e,o)=>Xg(t,n,e,o);const Kg=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 Jg=t=>{const{selections:n}=t;const e=Kg(n);return ea(t,e)};const tm=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 nm=t=>{const{selections:n}=t;const e=tm(n);return ea(t,e)};const em=async t=>Eo("Languages.getLanguageConfiguration",{languageId:t.languageId,uri:t.uri});const om=t=>{if(t?.indentationRules?.increaseIndentPattern&&typeof t.indentationRules.increaseIndentPattern==="string"){const n=new RegExp(t.indentationRules.increaseIndentPattern);return n}return undefined};const sm=(t,n)=>{if(!n){return false}return n.test(t)};const cm=(t,n,e)=>{const o=[];const s=[];const c=om(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(sm(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 rm=async t=>{const{lines:n,selections:e}=t;const o=await em(t);const{changes:s,selectionChanges:c}=cm(n,e,o);return ea(t,s,c)};const im=2;const am=0;const dm=()=>{const t=jd();const n={id:Fe,newState:{focused:true,focusSource:im,height:0,questions:[],uid:t,width:0,x:0,y:0},oldState:{focused:false,focusSource:am,height:0,questions:[],uid:t,width:0,x:0,y:0}};return n};const lm=async t=>{const n={...t,height:45,width:150,x:100,y:100};return n};const um=async t=>{const n=true;return Vd(Fe,ls,t,dm,lm,n)};const fm=()=>{const t=jd();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:hm,setFactory:gm}=Ho(qe);const mm=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 hm("Completions.create",o,c,r,s,e,n,a);await hm("Completions.loadContent",o);const d=await hm("Completions.diff2",o);const l=await hm("Completions.render2",o,d);return{...t,commands:l}};const wm=async t=>{const n=false;return Vd(Te,ss,t,fm,mm,n)};const pm=()=>{const t=jd();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 ym=async()=>{const t="Find Widget Worker";const n="findWidgetWorkerMain.js";return Yo(t,n)};const Em=9002;const xm=async()=>{if(Un(Em)){return}const t=await ym();$n(Em,t)};const Im=async(t,...n)=>{const e=Un(Em);return await e.invoke(t,...n)};const Sm=async()=>{const t=Un(Em);Yn(Em);if(t){await t.dispose()}};const km=t=>{const n=Jo(t);if(!n){throw new Error(`editor ${t} not found`)}const{newState:e}=n;return e};const vm=async(t,n)=>{const{uid:e}=t;const o=km(n);const{height:s,width:c,x:r,y:i}=o;await xm();await Im("FindWidget.create",e,r,i,c,s,n);await Im("FindWidget.loadContent",e);const a=await Im("FindWidget.diff2",e);const d=await Im("FindWidget.render2",e,a);return{...t,commands:d}};const Cm=(t,n)=>vm(t,n);const bm=async t=>{const n=true;return Vd(De,rs,t,pm,Cm,n)};const Mm=async t=>bm(t);const Am=t=>{const{selections:n}=t;const e=n[0];const o=n[1];const s=Ed(t,e,o);const c=xd(t,e);return{columnIndex:o,rowIndex:e,x:s,y:c}};const Lm=()=>{const t=jd();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 Pm=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 Hd("Rename.create",o,c,r,s,e,n,a);await Hd("Rename.loadContent",o);const d=await Hd("Rename.diff2",o);const l=await Hd("Rename.render2",o,d);return{...t,commands:l}};const Fm=async t=>{const{columnIndex:n,rowIndex:e}=Am(t);const{word:o}=qu(t,e,n);if(!o){return t}const s=true;return Vd(Be,as,t,Lm,Pm,s)};const Wm=async t=>{const n=await Ca({args:[],editor:t,event:"onLanguage",method:"ExtensionHostOrganizeImports.execute"});return n};const Tm=async t=>{const n=await Wm(t);return sd(t,n)};const Rm=(t,n)=>{const e=Ei(n);const o=ld(t,e,ys);return ea(t,o)};const Dm=async t=>{const n=await Ao();w(n);return Rm(t,n)};const Om=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 Bm=t=>{if(!t){return`Error: ${t}`}let{message:n}=t;while(t.cause){t=t.cause;n+=`: ${t}`}return n};const Nm=t=>{if(!t){return{codeFrame:undefined,message:t,stack:undefined,type:"Error"}}const n=Bm(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 Hm=/\((.*):(\d+):(\d+)\)$/;const zm=/at (.*):(\d+):(\d+)$/;const $m=t=>{for(const n of t){if(Hm.test(n)||zm.test(n)){return n}}return""};const Um=async t=>{try{const n=Ei(t.stack);const e=$m(n);let o=e.match(Hm);if(!o){o=e.match(zm)}if(!o){return t}const s=vr(n.slice(1));const c=Bm(t);return{message:c,stack:s,type:t.constructor.name}}catch(n){console.warn("ErrorHandling Error");console.warn(n);return t}};const Ym=async t=>{if(t&&t.message&&t.codeFrame){return Nm(t)}if(t&&t.stack){return Um(t)}return t};const _m=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 Vm=async t=>{const n=await Ym(t);const e=_m(n);console.error(e);return n};const jm=async t=>{try{await Vm(t)}catch(n){console.warn("ErrorHandling error");console.warn(n);console.error(t)}};const qm=async t=>t;const Gm=t=>t.startsWith("untitled:");const Xm=async(t,n)=>{await Eo("FileSystem.writeFile",t,n)};const Zm=async t=>{const n="Save File";const{canceled:e,filePath:o}=await go("Open.showSaveDialog",n,[],t);if(e){return""}return o};const Qm=async(t,n,e)=>{const o=await Zm(e);if(!o){return}await Eo("FileSystem.writeFile",o,n);await Co();await Eo("Main.handleUriChange",t,o);return o};const Km=t=>{const n="code"in t?t.code:undefined;return n==="EACCES"||t.message.includes("EACCES:")};const Jm=async t=>{if(Km(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 tw=async t=>{try{const{platform:n,uri:e}=t;const o=await qm(t);const s=Lr(o);if(Gm(e)){const t=await Qm(e,s,n);if(t){return{...o,modified:false,uri:t}}return o}await Xm(e,s);return{...o,modified:false}}catch(n){const e=new k(n,`Failed to save file "${t.uri}"`);await jm(e);if(t.platform===je){try{await Jm(e)}catch(t){await jm(t)}}return t}};const nw=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 ew=(t,n,e)=>{const o=Ri(t);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=Si(t,s);ll(o,s+2,c,r,n,e);al(o,s,i,a)}return o};const ow=(t,n)=>{const{lines:e,selections:o}=t;const s=ew(o,e,n);return na(t,s)};const sw=t=>{ow(t,pl)};const cw=/[a-zA-Z\d]/;const rw=t=>cw.test(t);const iw=t=>rw(t)||t==="_";const aw=(t,n)=>{for(let e=n-1;e>=0;e--){if(!iw(t[e])){return e+1}}return 0};const dw=(t,n)=>{for(let e=n;e<t.length;e++){if(!iw(t[e])){return e}}return t.length};const lw=(t,n,e)=>{const o=t[n];const s=aw(o,e);const c=dw(o,e);const r=o.slice(s,c);return{end:c,start:s,word:r}};const uw=(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 fw=(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 hw=(t,n)=>{const e=[];for(let o=0;o<t.length-n.length+1;o){if(uw(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 gw=(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=lw(t,c,r);if(e.start===e.end){return n}const o=fw(t,e.word);return o}const e=t[o];const i=e.slice(s,r);const a=fw(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=hw(t,i);return a};const mw=t=>{const{lines:n,selections:e}=t;const o=gw(n,e);return na(t,o)};const ww=(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 pw=(t,n)=>{const{lines:e}=t;const{selections:o}=t;const s=ww(o,e,n);return na(t,s)};const yw=t=>pw(t,yl);const Ew=t=>ow(t,hl);const xw=t=>pw(t,ml);const Iw=(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 Sw=t=>{const{lines:n,selections:e}=t;const o=Iw(n,e);return na(t,o)};const kw=(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 vw=t=>{const{selections:n}=t;const{lines:e}=t;const o=kw(e,n);return na(t,o)};const Cw=async(t,n)=>{const e=await Eo("ExtensionHostSelection.executeGrowSelection",t,n);if(e.length===0){return n}return new Uint32Array(e)};const bw=async t=>{const{selections:n}=t;const e=await Cw(t,n);return na(t,e)};const Mw=(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 Aw=t=>{const{lines:n}=t;const{selections:e}=t;if($i(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=lw(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(Ui(t.selections)){return Mw(t.lines,t.selections)}return undefined};const Lw=(t,n,e,o)=>e>=t&&o<=n;const Pw=t=>{const n=Aw(t);if(!n){return t}const{revealRange:e,selectionEdits:o}=n;const s=o[e];const c=o[e+2];if(Lw(t.minLineY,t.maxLineY,s,c)){return na(t,o)}return ea(t,[],o)};const Fw=t=>t;const Ww=(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 Tw=t=>{const{lines:n,selections:e}=t;const o=Ww(n,e);return na(t,o)};const Rw=t=>ow(t,bl);const Dw=t=>pw(t,Pl);const Ow=(t,n,e)=>{if(t.decorations.length===0&&n.length===0){return t}return{...t,decorations:n,diagnostics:e}};const Bw=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=km(t.uid);if(!r){return t}const i=Kr();const{differences:a,textInfos:d}=await _r(t,i);const l=km(t.uid);if(!l){return t}const u={...l,differences:a,focused:true,textInfos:d};return{...u,invalidStartIndex:0,languageId:n,tokenizerId:c}};const Nw=(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 Hw=(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 zw=()=>{const t=jd();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 $w=async()=>{const t="Hover Worker";const n="hoverWorkerMain.js";const e="Hover.initialize";const o=await Yo(t,n,e);return o};const Uw={};const Yw=()=>{if(!Uw.workerPromise){Uw.workerPromise=$w()}return Uw.workerPromise};const _w=async(t,...n)=>{const e=await Yw();return await e.invoke(t,...n)};const Vw=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 _w("Hover.create",o,c,r,s,e,n,a);await _w("Hover.loadContent",o);const d=await _w("Hover.diff2",o);const l=await _w("Hover.render2",o,d);return{...t,commands:l}};const jw=async t=>{const n=false;return Vd(Oe,is,t,zw,Vw,n)};const qw="EditorHover";const Gw=async t=>{await Eo("Viewlet.openWidget",qw);return t};const Xw=()=>{const t=jd();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 Zw=async()=>{const t="Source Action Worker";const n="sourceActionWorkerMain.js";const e="SourceActions.initialize";const o=await Yo(t,n,e);return o};const Qw={};const Kw=()=>{if(!Qw.workerPromise){Qw.workerPromise=Zw()}return Qw.workerPromise};const Jw=async(t,...n)=>{const e=await Kw();return await e.invoke(t,...n)};const tp=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 Jw("SourceActions.create",o,c,r,s,e,n,a);await Jw("SourceActions.loadContent",o);const d=await Jw("SourceActions.diff2",o);const l=await Jw("SourceActions.render2",o,d);return{...t,commands:l}};const np=async t=>Vd(Ne,ds,t,Xw,tp);const ep=(t,n)=>t.localeCompare(n);const op=t=>{const n=[...t];n.sort(ep);return n};const sp="sort-lines-ascending";const cp=(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=op(h);s.push({deleted:Pr({lines:t},f),end:u,inserted:g,origin:sp,start:l})}return s};const rp=t=>{const{lines:n,selections:e}=t;const o=cp(n,e);return ea(t,o)};const ip=async(t,n)=>Ca({args:[n],editor:t,event:va,method:la,noProviderFoundMessage:"No tab completion provider found",noProviderFoundResult:undefined});const ap=t=>{const{selections:n}=t;const e=n[0];const o=n[1];const s=Wr(t,e,o);return s};const dp=async t=>{const n=ap(t);const e=await ip(t,n);return e};const lp=(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 up=(t,n)=>{const{lines:e,selections:o}=t;const{changes:s,selectionChanges:c}=lp(e,o,n);return ea(t,s,c)};const fp=String;const hp=async t=>{try{const n=await dp(t);if(!n){return t}return up(t,n)}catch(n){await jm(n);const e=t.selections[0];const o=t.selections[1];return kd(t,e,o,fp(n))}};const gp=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 em(t);if(!s?.comments?.blockComment){return undefined}return s.comments.blockComment};const mp=/^\s+/;const wp=/\s+$/;const pp=(t,n,e)=>({deleted:[e],end:{columnIndex:n+e.length,rowIndex:t},inserted:[],origin:As,start:{columnIndex:n,rowIndex:t}});const yp=(t,n,e,o,s,c,r)=>{if(n===o){return[pp(t,e,c),pp(t,s-c.length,r)]}return[pp(n,e,c),pp(o,s,r)]};const Ep=(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(...yp(o,u,l,r,i,a,d))}else{const t=s.match(mp);const n=s.match(wp);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 xp=async t=>{const n=ap(t);const e=await gp(t,n);if(!e){return t}const o=Ep(t,e);return sa(t,o)};const Ip=async t=>{const n=await em(t);if(!n?.comments?.lineComment){return undefined}return n.comments.lineComment};const Sp=/^\s+/;const kp=(t,n,e)=>{const o=n.match(Sp);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 vp=async t=>{const n=await Ip(t);if(!n){return t}const e=t;const o=t.selections[0];const s=Ar(e,o);const c=[kp(o,s,n)];return ea(t,c)};const Cp=async t=>{try{const n=await vp(t);if(t!==n){return n}return xp(t)}catch(n){od(n);await Sd(t,0,0,String(n),true);return t}};const bp=async(t,n)=>{const e=ld(t,[n],xs);const o=await ea(t,e);if(o.completionsOnType){const t=await wm(o);return t}return o};const Mp="/";const Ap="{";const Lp="}";const Pp="(";const Fp=")";const Wp="[";const Tp="]";const Rp="???";const Dp="'";const Op='"';const Bp="`";const Np=t=>{switch(t){case Ap:return Lp;case Pp:return Fp;case Wp:return Tp;default:return Rp}};const Hp=(t,n)=>{const e=Np(n);const o=n+e;const s=ld(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 zp=t=>{const{selections:n}=t;const e=new Uint32Array([n[0],n[1]+1,n[2],n[3]+1]);return na(t,e)};const $p=(t,n)=>{const{autoClosingRanges:e=[],selections:o}=t;if(vu(e,o)){return zp(t)}return bp(t,n)};const Up=(t,n)=>{const e=n+n;const o=ld(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 Yp=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=ld(t,[n],xs);return ea(t,e)}const s=ld(t,[o.inserted],xs);return ea(t,s)};const _p=async(t,n)=>{const{isAutoClosingBracketsEnabled:e,isAutoClosingQuotesEnabled:o,isAutoClosingTagsEnabled:s}=t;switch(n){case Mp:if(s){return Yp(t,n)}break;case Lp:case Fp:case Tp:if(e){return $p(t,n)}break;case Ap:case Pp:case Wp:if(e){return Hp(t,n)}break;case Bp:case Op:case Dp:if(o){return Up(t,n)}break}const c=bp(t,n);return c};const Vp=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 jp=t=>{const{undoStack:n}=t;if(n.length===0){return t}const e=n.at(-1);const o=e.map(Vp);const s={...t,redoStack:[...t.redoStack||[],e],undoStack:n.slice(0,-1)};return oa(s,o)};const qp=t=>t;const Gp=t=>{switch(t){case We:case Te:case De:case Oe:case Be:case Ne:return true;default:return false}};const Xp=(t,n,e)=>{const o=e(t);const{uid:s}=t.newState;const c=[];c.push(["Viewlet.createFunctionalRoot",n,s,Gp(t.id)]);c.push(...o);if(Gp(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 Zp=t=>{switch(t){case We:return qo;case Te:return hm;case De:return Im;case Oe:return _w;case Be:return Hd;case Ne:return Jw;default:return undefined}};const Qp="Close";const Kp=(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 Jp=(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 ty=(t,n)=>{if(t&&t.widgets){return t}const e=Jo(t);if(e&&e.newState&&e.newState.widgets){return e.newState}return Jp(t,n)};const ny=(t,n,e)=>{const o=t=>t.id===e;const s=n=>t==="close"||t==="handleClickButton"&&n.includes(Qp);const c=async(c,...r)=>{const i=ty(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=Zp(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:Fd(m.widgets,e)};ns(i.uid,m,t);return t}const w={...l,commands:g};const p=Kp(m,e,w);ns(i.uid,m,p);return p};return c};const ey=(t,n,e)=>{const o=Object.create(null);for(const s of t){o[s]=ny(s,n,e)}return o};const oy="Viewlet.appendToBody";const sy="focus";const cy="Viewlet.registerEventListeners";const ry="Viewlet.setSelectionByName";const iy="Viewlet.setValueByName";const ay="Viewlet.setFocusContext";const dy="setBounds";const ly="Viewlet.setBounds";const uy="Viewlet.setCss";const fy="Viewlet.setDom2";const hy="Viewlet.setUid";const gy=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const my=[fy,uy,oy,ly,cy,ry,iy,ay,hy,"Viewlet.focusSelector"];const wy=t=>{const n=gy(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(my.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const py=t=>Xp(t,"EditorCompletion",wy);const yy=t=>[["Viewlet.dispose",t.newState.uid]];const{close:Ey,closeDetails:xy,focusFirst:Iy,focusIndex:Sy,focusLast:ky,focusNext:vy,focusPrevious:Cy,handleEditorBlur:by,handleEditorClick:My,handleEditorDeleteLeft:Ay,handleEditorType:Ly,handlePointerDown:Py,handleWheel:Fy,openDetails:Wy,selectCurrent:Ty,selectIndex:Ry,toggleDetails:Dy}=ey(["handleEditorType","focusFirst","focusNext","focusPrevious","focusLast","handleEditorDeleteLeft","openDetails","focusIndex","handleEditorBlur","handleEditorClick","openDetails","selectCurrent","selectIndex","toggleDetails","closeDetails","handleWheel","close","handlePointerDown"],"Completions",Te);const Oy={__proto__:null,add:py,close:Ey,closeDetails:xy,focusFirst:Iy,focusIndex:Sy,focusLast:ky,focusNext:vy,focusPrevious:Cy,handleEditorBlur:by,handleEditorClick:My,handleEditorDeleteLeft:Ay,handleEditorType:Ly,handlePointerDown:Py,handleWheel:Fy,openDetails:Wy,remove:yy,render:wy,selectCurrent:Ty,selectIndex:Ry,toggleDetails:Dy};const By=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const Ny=[fy,uy,oy,ly,cy,ry,iy,ay,hy,"Viewlet.focusSelector"];const Hy=t=>{const n=By(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(Ny.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const zy=t=>Xp(t,"FindWidget",Hy);const $y=t=>[["Viewlet.dispose",t.newState.uid]];const{close:Uy,focusCloseButton:Yy,focusFind:_y,focusNext:Vy,focusNextElement:jy,focusNextMatchButton:qy,focusPrevious:Gy,focusPreviousElement:Xy,focusPreviousMatchButton:Zy,focusReplace:Qy,focusReplaceAllButton:Ky,focusReplaceButton:Jy,focusToggleReplace:tE,handleBlur:nE,handleClickButton:eE,handleFocus:oE,handleInput:sE,handleReplaceFocus:cE,handleReplaceInput:rE,handleToggleReplaceFocus:iE,replace:aE,replaceAll:dE,toggleMatchCase:lE,toggleMatchWholeWord:uE,togglePreserveCase:fE,toggleReplace:hE,toggleUseRegularExpression:gE}=ey(["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 mE={__proto__:null,add:zy,close:Uy,focusCloseButton:Yy,focusFind:_y,focusNext:Vy,focusNextElement:jy,focusNextMatchButton:qy,focusPrevious:Gy,focusPreviousElement:Xy,focusPreviousMatchButton:Zy,focusReplace:Qy,focusReplaceAllButton:Ky,focusReplaceButton:Jy,focusToggleReplace:tE,handleBlur:nE,handleClickButton:eE,handleFocus:oE,handleInput:sE,handleReplaceFocus:cE,handleReplaceInput:rE,handleToggleReplaceFocus:iE,remove:$y,render:Hy,replace:aE,replaceAll:dE,toggleMatchCase:lE,toggleMatchWholeWord:uE,togglePreserveCase:fE,toggleReplace:hE,toggleUseRegularExpression:gE};const wE=t=>({documentId:t.id||t.uid,languageId:t.languageId,text:Lr(t),uri:t.uri});const pE=async(t,n)=>{const e=wE(t);return uo("Extensions.executeHoverProvider",e,n)};const yE=async(t,n)=>{h(t);g(n);const e=await pE(t,n);if(e){return e}return Ca({args:[n],editor:t,event:ka,method:da,noProviderFoundMessage:"No hover provider found"})};const EE=async(t,n)=>{h(t);g(n);const e=await yE(t,n);return e};const xE=async(t,n,e,o,s)=>100;const IE=(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 SE=(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=IE(n,c,i);o.push(d);a=t}console.error({lineInfos:o});return o};const kE=async(t,n,e)=>{await er(n,e);const o=or(n);const s=Ei(t);const c=SE(s,o,n);return c};const vE=(t,n)=>{if(t){return t}const e=n[0];const o=n[1];return{columnIndex:o,rowIndex:e}};const CE=(t,n,e)=>{const o=[];for(const e of t){if(e.rowIndex===n){o.push(e)}}return o};const bE="typescript";const ME=(t,n,e,o)=>{const s=Ed(t,n,e);const c=t.height-xd(t,n)+t.y+40;return{x:s,y:c}};const AE=async(t,n)=>{g(t);const e=Jo(t);const o=e.newState;const{selections:s}=o;const{columnIndex:c,rowIndex:r}=vE(n,s);const i=Wr(o,r,c);const a=await EE(o,i);if(!a){return undefined}const{displayString:d,displayStringLanguageId:l,documentation:u}=a;const f="";const h=await kE(d,l||bE,f);const m=Gu(o,r,c);const w=c-m.length;await xE();const{x:p,y:y}=ME(o,r,w);const E=o.diagnostics||[];const x=CE(E,r);return{documentation:u,lineInfos:h,matchingDiagnostics:x,x:p,y:y}};const LE=async(t,n,e)=>{const o=await AE(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 PE=(t,n,e)=>t;const FE=(t,n,e)=>{const{x:o}=t;const s=100;const c=Math.max(n-o,s);return{...t,resizedWidth:c}};const WE=(t,n,e)=>t;const TE="CodeGeneratorInput";const RE="CodeGeneratorMessage";const DE="CodeGeneratorWidget";const OE="DiagnosticError";const BE="DiagnosticWarning";const NE="CompletionDetailCloseButton";const HE="CompletionDetailContent";const zE="Diagnostic";const $E="EditorCursor";const UE="EditorRow";const YE="EditorRowHighlighted";const _E="EditorSelection";const VE="HoverDisplayString";const jE="HoverDocumentation";const qE="HoverEditorRow";const GE="HoverProblem";const XE="HoverProblemDetail";const ZE="HoverProblemMessage";const QE="IconClose";const KE="InputBox";const JE="MaskIcon";const tx="Viewlet";const nx=1;const ex=2;const ox=9;const sx=10;const cx=11;const rx=12;const ix=13;const ax=14;const dx=15;const lx=18;const ux=19;const fx=20;const hx=21;const gx=22;const mx=23;const wx=26;const px=27;const yx=28;const Ex=29;const xx=30;const Ix=31;const Sx=32;const kx=33;const vx=4;const Cx=6;const bx=8;const Mx=12;const Ax=62;const Lx=t=>({childCount:0,text:t,type:Mx});const Px=t=>{const n=[{childCount:t.length/2,className:qE,type:vx}];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:bx},Lx(o))}return n};const Fx=t=>{const n=t.flatMap(Px);return n};const Wx={childCount:1,className:ZE,type:bx};const Tx={childCount:1,className:XE,type:bx};const Rx=(t,n,e)=>{const o=n?1:0;const s=e&&e.length>0?1:0;return t.length+o+s};const Dx=(t,n,e)=>{const o=[];o.push({childCount:Rx(t,n,e)+1,className:"Viewlet EditorHover",type:vx});if(e&&e.length>0){o.push({childCount:e.length*2,className:`${VE} ${GE}`,type:vx});for(const t of e){o.push(Wx,Lx(t.message),Tx,Lx(`${t.source} (${t.code})`))}}if(t.length>0){const n=Fx(t);o.push({childCount:t.length,className:VE,type:vx},...n)}if(n){o.push({childCount:1,className:jE,type:vx},Lx(n))}o.push({childCount:0,className:"Sash SashVertical SashResize",onPointerDown:wx,type:vx});return o};const Ox={apply(t,n){const e=Dx(n.lineInfos,n.documentation,n.diagnostics);return[fy,e]},isEqual:(t,n)=>t.lineInfos===n.lineInfos&&t.documentation===n.documentation&&t.diagnostics===n.diagnostics};const Bx={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[dy,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y};const Nx=[Ox,Bx];const Hx=(t,n)=>{const e=[];for(const o of Nx){if(!o.isEqual(t,n)){e.push(o.apply(t,n))}}return e};const zx=[fy,uy,oy,ly,cy,ry,iy,ay,hy,"Viewlet.focusSelector"];const $x=t=>{const n=gy(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(zx.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const Ux=t=>Xp(t,"EditorRename",$x);const Yx=t=>[["Viewlet.dispose",t.newState.uid]];const{accept:_x,close:Vx,handleInput:jx}=ey(["handleInput","close","accept"],"Rename",Be);const qx={__proto__:null,accept:_x,add:Ux,close:Vx,handleInput:jx,remove:Yx,render:$x};const Gx=t=>structuredClone(t);const Xx=(t,n)=>{const e={...t,focusedIndex:n};return e};const Zx=t=>{const n=t.focusedIndex+1;return Xx(t,n)};const Qx=t=>[["Viewlet.send",t.newState.uid,"dispose"]];const Kx=[fy,uy,oy,ly,cy,ry,iy,ay,hy,"Viewlet.focusSelector"];const Jx=t=>{const n=gy(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(Kx.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const tI=t=>Xp(t,"EditorSourceActions",Jx);const nI=Qx;const{close:eI,closeDetails:oI,focusFirst:sI,focusIndex:cI,focusLast:rI,focusNext:iI,focusPrevious:aI,handleWheel:dI,selectCurrent:lI,selectIndex:uI,selectItem:fI,toggleDetails:hI}=ey(["focusFirst","focusIndex","focusLast","focusNext","focusPrevious","selectCurrent","selectIndex","selectItem","toggleDetails","closeDetails","handleWheel","close"],"SourceActions",Ne);const gI={__proto__:null,add:tI,close:eI,closeDetails:oI,focusFirst:sI,focusIndex:cI,focusLast:rI,focusNext:iI,focusPrevious:aI,handleWheel:dI,remove:nI,render:Jx,selectCurrent:lI,selectIndex:uI,selectItem:fI,toggleDetails:hI};const mI=async(t,n,e,o,s,...c)=>{const r=Zp(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=km(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=Kp(u,s,y);return E};const wI=async t=>{if(!t){return[]}const{newState:n}=Jo(t);return Ca({args:[],editor:n,event:"onLanguage",method:"ExtensionHostCodeActions.getSourceActions"})};const pI=/[\w\-]+$/;const yI=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(pI);if(i){return i[0]}return""};const EI=async t=>{await Eo("Focus.setFocus",t)};const xI=async t=>{if(!t){return}await Eo("Focus.removeAdditionalFocus",t)};const II=12;const SI=9;const kI=11;const vI=12;const CI=16;const bI=38;const MI=43;const AI=46;const LI=47;const PI=48;const FI=49;const WI=50;const TI=52;const RI=t=>{const n=km(t);return Am(n)};const DI=t=>{const n=km(t);return n.uri};const OI=t=>{const n=km(t);return n.languageId};const BI=t=>{const n=km(t);return ap(n)};const NI=(t,n,e)=>{const o=km(t);const{word:s}=qu(o,n,e);return s};const HI=t=>{const n=km(t);const e=yI(n);return e};const zI=(t,n,e)=>{const o=km(t);const s=Gu(o,n,e);return s};const $I=t=>{const n=km(t);const{lines:e}=n;return e};const UI=t=>{const n=km(t);const{selections:e}=n;return e};const YI=async(t,n)=>{const e=km(t);const o={...e,selections:n};const s=await Sg(e,o);ns(t,e,s)};const _I=async(t,n,e,o)=>{const s=km(t);const c=Zp(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 Sg(s,d);ns(t,s,l);await EI(vI);if(o){await xI(o)}};const VI=async t=>{await _I(t,De,"FindWidget",0)};const jI=async(t,n)=>{const e=km(t);const o=await cd(e,n);const s=await Sg(e,o);ns(t,e,s)};const qI=async t=>{const n=await wI(t);return n};const GI=async t=>{const n=km(t);const{diagnostics:e}=n;return e};const XI=async(t,n)=>{await po("TextMeasurement.ensureFont",t,n)};const ZI=()=>[{command:"Editor.closeSourceAction",key:ee,when:bI},{command:"EditorSourceActions.focusNext",key:de,when:bI},{command:"EditorSourceActions.focusPrevious",key:ie,when:bI},{command:"EditorSourceActions.focusFirst",key:ce,when:bI},{command:"EditorSourceActions.focusLast",key:se,when:bI},{command:"EditorSourceActions.selectCurrent",key:ne,when:bI},{command:"FindWidget.focusNext",key:ne,when:CI},{command:"FindWidget.preventDefaultBrowserFind",key:He|ge,when:CI},{command:"FindWidget.focusPrevious",key:ze|Ce,when:CI},{command:"FindWidget.focusNext",key:Ce,when:CI},{command:"FindWidget.focusToggleReplace",key:ze|te,when:CI},{command:"FindWidget.focusReplace",key:te,when:CI},{command:"FindWidget.focusPreviousMatchButton",key:te,when:MI},{command:"FindWidget.replaceAll",key:$e|He|ne,when:MI},{command:"FindWidget.focusNextMatchButton",key:te,when:WI},{command:"FindWidget.focusReplace",key:ze|te,when:WI},{command:"FindWidget.focusPreviousMatchButton",key:ze|te,when:FI},{command:"FindWidget.focusCloseButton",key:te,when:FI},{command:"FindWidget.focusNextMatchButton",key:ze|te,when:PI},{command:"FindWidget.focusReplaceButton",key:te,when:PI},{command:"FindWidget.focusFind",key:ze|te,when:MI},{command:"FindWidget.focusReplaceAllButton",key:te,when:AI},{command:"FindWidget.focusCloseButton",key:ze|te,when:AI},{command:"FindWidget.focusReplaceButton",key:ze|te,when:LI},{command:"EditorCompletion.focusNext",key:de,when:SI},{command:"EditorCompletion.focusPrevious",key:ie,when:SI},{command:"EditorCompletion.selectCurrent",key:ne,when:SI},{command:"EditorCompletion.close",key:ee,when:SI},{command:"EditorCompletion.focusLast",key:se,when:SI},{command:"EditorCompletion.focusFirst",key:ce,when:SI},{command:"EditorCompletion.toggleDetails",key:He|oe,when:SI},{command:"Editor.cursorWordRight",key:He|ae,when:vI},{command:"Editor.cursorWordLeft",key:He|re,when:vI},{command:"Editor.deleteWordPartLeft",key:$e|Jn,when:vI},{command:"Editor.deleteWordPartRight",key:$e|le,when:vI},{command:"Editor.deleteWordLeft",key:He|Jn,when:vI},{command:"Editor.deleteWordRight",key:He|le,when:vI},{command:"Editor.selectNextOccurrence",key:He|he,when:vI},{command:"Editor.openColorPicker",key:He|we,when:vI},{command:"Editor.showSourceActions3",key:He|Me,when:vI},{command:"Editor.handleTab",key:te,when:vI},{command:"Editor.unindent",key:ze|te,when:vI},{command:"Editor.indentLess",key:He|Le,when:vI},{command:"Editor.closeFind",key:ee,when:CI},{command:"Editor.openFind2",key:He|ge,when:vI},{command:"Editor.openCodeGenerator",key:He|pe,when:vI},{command:"Editor.closeCodeGenerator",key:ee,when:TI},{command:"EditorCodeGenerator.accept",key:ne,when:TI},{command:"Editor.indentMore",key:He|Pe,when:vI},{command:"Editor.selectCharacterLeft",key:ze|re,when:vI},{command:"Editor.selectWordLeft",key:He|ze|re,when:vI},{command:"Editor.selectCharacterRight",key:ze|ae,when:vI},{command:"Editor.selectWordRight",key:He|ze|ae,when:vI},{command:"Editor.selectLine",key:He|ye,when:vI},{command:"Editor.deleteAllLeft",key:He|ze|Jn,when:vI},{command:"Editor.deleteAllRight",key:He|ze|le,when:vI},{command:"Editor.cancelSelection",key:ee,when:vI},{command:"Editor.undo",key:He|Se,when:vI},{command:"Editor.cursorLeft",key:re,when:vI},{command:"Editor.cursorRight",key:ae,when:vI},{command:"Editor.cursorUp",key:ie,when:vI},{command:"Editor.cursorDown",key:de,when:vI},{command:"Editor.deleteLeft",key:Jn,when:vI},{command:"Editor.deleteRight",key:le,when:vI},{command:"Editor.insertLineBreak",key:ne,when:vI},{command:"Editor.copyLineDown",key:He|ze|he,when:vI},{command:"Editor.moveLineDown",key:He|ze|de,when:vI},{command:"Editor.moveLineUp",key:He|ze|ie,when:vI},{command:"Editor.openCompletion",key:He|oe,when:vI},{command:"Editor.openRename",key:ke,when:vI},{command:"EditorRename.accept",key:ne,when:kI},{command:"Editor.closeRename",key:ee,when:kI},{command:"Editor.cursorHome",key:ce,when:vI},{command:"Editor.cursorEnd",key:se,when:vI},{command:"Editor.toggleComment",key:He|Ae,when:vI},{command:"Editor.copy",key:He|fe,when:vI},{command:"Editor.selectAll",key:He|ue,when:vI},{command:"Editor.showHover2",key:He|me,when:vI},{command:"Editor.cut",key:He|Ie,when:vI},{command:"Editor.paste",key:He|xe,when:vI},{command:"Editor.cursorWordPartLeft",key:$e|re,when:vI},{command:"Editor.cursorWordPartRight",key:$e|ae,when:vI},{command:"Editor.selectAllOccurrences",key:$e|ve,when:vI},{command:"Editor.addCursorAbove",key:$e|ze|ie,when:vI},{command:"Editor.addCursorBelow",key:$e|ze|de,when:vI},{command:"Editor.findAllReferences",key:$e|ze|be,when:vI},{command:"Editor.organizeImports",key:$e|ze|Ee,when:vI},{command:"Editor.selectionGrow",key:He|ze|oe,when:II}];const QI=()=>ts();const KI={CommandPalette:"Command Palette"};const JI=()=>Ku(KI.CommandPalette);const tS={command:"",flags:_e,id:"separator",label:""};const nS=()=>[{command:"Editor.goToDefinition",flags:Ve,id:"go-to-definition",label:Df()},{command:"Editor.goToTypeDefinition",flags:Ve,id:"go-to-type-definition",label:Yf()},tS,{args:["References",true],command:"SideBar.show",flags:Ve,id:"find-all-references",label:_f()},{args:["Implementations",true],command:"SideBar.show",flags:Ve,id:"find-all-implementations",label:Vf()},tS,{command:"Editor.format",flags:Ve,id:"format",label:Kf()},{command:"Editor.showSourceActions2",flags:Ve,id:Ye,label:zf()},tS,{command:"Editor.cut",flags:Ve,id:"cut",label:jf()},{command:"Editor.copy",flags:Ve,id:"copy",label:qf()},{command:"Editor.paste",flags:Ve,id:"paste",label:Gf()},tS,{command:"QuickPick.showEverything",flags:Ve,id:"commandPalette",label:JI()}];const eS=()=>[Ue];const oS=t=>Aa(t);const sS=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(oS));const s=o.flat();return s};const cS=()=>[{id:"Editor.format",label:Kf()},{id:"Editor.showHover",label:Jf()},{id:"Editor.formatForced",label:th()},{id:"Editor.selectNextOccurrence",label:nh()},{id:"Editor.selectAllOccurrences",label:eh()},{id:"Editor.goToDefinition",label:oh()},{id:"Editor.goToTypeDefinition",label:sh()},{id:"Editor.selectInsideString",label:ch()},{aliases:["Indent More","DeIndent"],id:"Editor.indent",label:rh()},{aliases:["Indent Less","DeIndent"],id:"Editor.unindent",label:ih()},{id:"Editor.sortLinesAscending",label:ah()},{id:"Editor.toggleComment",label:dh()},{id:"Editor.selectUp",label:lh()},{id:"Editor.selectDown",label:uh()},{id:"Editor.toggleBlockComment",label:Xf()},{id:"Editor.openColorPicker",label:fh()},{id:"Editor.closeColorPicker",label:hh()},{id:"Editor.copyLineDown",label:gh()},{id:"Editor.copyLineUp",label:mh()},{id:"Editor.moveLineDown",label:Qf()},{id:"Editor.moveLineUp",label:Zf()},{id:"Editor.showSourceActions2",label:zf()}];const rS=t=>{const n=km(t);const{selections:e}=n;return e};const iS=t=>{g(t);const n=km(t);const{lines:e}=n;return e.join(pr)};const aS="insertText";const dS=(t,n,e)=>{switch(n){case aS:return _p(t,e);default:return t}};const lS=async(t,n)=>{const e=await Bn({commandMap:{},messagePort:t});if(n){$n(n,e)}};const uS=(t,n)=>up(t,n);const fS=async t=>{const n=await dp(t);if(!n){return t}return uS(t,n)};const hS=async()=>{await Sm();await xm()};const gS=t=>{switch(t){case De:return{invoke:Im,name:"FindWidget"};default:return undefined}};const mS=async(t,n,e,o)=>{if(e?.newState){const s=`${n}:${e.newState.uid}`;const c=gS(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 wS=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 mS(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 pS=async(t,n,e)=>{if(!e?.newState){return}const o=gS(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 yS=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 pS(n,e,t)}}return n};const ES={isReloading:false};const xS=async()=>{if(ES.isReloading){return}ES.isReloading=true;try{const t=ts();const n=await yS(t);await hS();const e=await wS(t,n);for(const t of e){ns(t.newState.uid,t.oldState,t.newState)}await Eo(`Editor.rerender`)}finally{ES.isReloading=false}};const IS=async t=>{try{await Ro(t)}catch{await xo("SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker",t,"HandleMessagePort.handleMessagePort")}};const SS=async()=>{try{const t=await Rn({commandMap:{},send:IS});return t}catch(t){throw new k(t,`Failed to create syntax highlighting worker rpc`)}};const kS=async(t,n)=>{if(t){$c(true);const t=await SS();_c(t)}if(n){Qr(true)}};const vS=async()=>{const t="Completion Worker";const n="completionWorkerMain.js";const e="Completions.initialize";const o=await Yo(t,n,e);return o};const CS=async(t,n)=>{gm(vS);await kS(t,n)};const bS="editor.lineHeight";const MS="editor.fontSize";const AS="editor.fontFamily";const LS="editor.letterSpacing";const PS="editor.tabSize";const FS="editor.lineNumbers";const WS="editor.diagnostics";const TS="editor.quickSuggestions";const RS="editor.autoClosingQuotes";const DS="editor.autoclosingBrackets";const OS="editor.fontWeight";const BS=async()=>Boolean(await Ia(DS));const NS=async()=>Boolean(await Ia(RS));const HS=async()=>Boolean(await Ia(TS));const zS=async()=>true;const $S=async()=>await Ia(bS)||20;const US=async()=>await Ia(MS)||15;const YS=async()=>await Ia(AS)||"Fira Code";const _S=async()=>await Ia(LS)??.5;const VS=async()=>await Ia(PS)||2;const jS=async()=>await Ia(FS)??false;const qS=async()=>[".","/"];const GS=async()=>await Ia(WS)??false;const XS=async()=>await Ia(OS)??400;const ZS=async()=>{const[t,n,e,o,s,c,r,i,a,d,l,u,f]=await Promise.all([GS(),YS(),US(),XS(),BS(),NS(),zS(),HS(),jS(),$S(),VS(),_S(),qS()]);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&&e.tokenize){return e.tokenize}}return""};const KS=t=>{if(t instanceof Error){return t.message}return String(t)};const JS=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 ZS();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:KS(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);const z=u?await Da(H):H;const $=await Ia("editor.completionsOnType");const U=Boolean($);const Y={...z,completionsOnType:U,initial:false};return Y};const tk=t=>t;const nk=t=>t;const ek=(t,n)=>{g(t);g(n);gi(t,n)};const ok=(t,n,e,o,s,c)=>{const r=`.Editor[data-uid="${t}"]`;return`${r} {\n --EditorRowHeight: ${n}px;\n --ScrollBarHeight: ${e}px;\n --ScrollBarTop: ${o}px;\n --ScrollBarWidth: ${s}px;\n --ScrollBarLeft: ${c}px;\n}\n${r} .EditorRow {\n height: var(--EditorRowHeight);\n line-height: var(--EditorRowHeight);\n}\n${r} .ScrollBarThumbVertical {\n height: var(--ScrollBarHeight);\n translate: 0px var(--ScrollBarTop);\n}\n${r} .ScrollBarThumbHorizontal {\n width: var(--ScrollBarWidth);\n translate: var(--ScrollBarLeft) 0px;\n}\n`};const sk=(t,n,e)=>{const o=t/n*e;if(!Number.isFinite(o)){return 0}return o};const ck=(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=sk(e,r,u);const m=ok(l,a,d,f,h,g);return[oo,l,m]};const rk=(t,n)=>{const e=".EditorInput textarea";return[eo,n.uid,e]};const ik=(t,n)=>[so,n.uid,ro];const ak=1;const dk=2;const lk=3;const uk=4;const fk=6;const hk=7;const gk=8;const mk=9;const wk=10;const pk=11;const yk=t=>t!=="type"&&t!=="childCount";const Ek=t=>{const n=Object.keys(t).filter(yk);return n};const xk=t=>{const n=[];let e=0;while(e<t.length){const o=t[e];const{children:s,nodesConsumed:c}=Ik(t,e+1,o.childCount||0);n.push({node:o,children:s});e+=1+c}return n};const Ik=(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}=Ik(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 Sk=(t,n)=>{if(t.type!==n.type){return null}const e=[];if(t.type===jn){if(t.uid!==n.uid){e.push({type:pk,uid:n.uid})}return e}if(t.type===Vn&&n.type===Vn){if(t.text!==n.text){e.push({type:ak,value:n.text})}return e}const o=Ek(t);const s=Ek(n);for(const o of s){if(t[o]!==n[o]){e.push({type:lk,key:o,value:n[o]})}}for(const t of o){if(!Object.hasOwn(n,t)){e.push({type:uk,key:t})}}return e};const kk=t=>{const n=[t.node];for(const e of t.children){n.push(...kk(e))}return n};const vk=(t,n,e)=>{if(n===-1){t.push({type:hk,index:e});return e}if(n!==e){t.push({type:wk,index:e})}return e};const Ck=(t,n)=>{if(n>=0){t.push({type:gk})}return-1};const bk=(t,n)=>{n.push({type:fk,nodes:kk(t)})};const Mk=(t,n)=>{n.push({type:dk,nodes:kk(t)})};const Ak=(t,n,e,o,s)=>{const c=Sk(t.node,n.node);if(c===null){const t=vk(e,o,s);Mk(n,e);return t}const r=t.children.length>0||n.children.length>0;if(c.length===0&&!r){return o}const i=vk(e,o,s);if(c.length>0){e.push(...c)}if(r){Pk(t.children,n.children,e)}return i};const Lk=(t,n,e)=>{const o=Sk(t.node,n.node);if(o===null){Mk(n,e);return}if(o.length>0){e.push(...o)}if(t.children.length>0||n.children.length>0){Pk(t.children,n.children,e)}};const Pk=(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=Ck(e,s);bk(i,e);continue}if(!i){c.push(r);continue}s=Ak(o,i,e,s,r)}Ck(e,s);for(let t=c.length-1;t>=0;t--){e.push({type:mk,index:c[t]})}};const Fk=(t,n,e,o)=>{if(o.length===0&&t.length===1&&n.length===1){Lk(t[0],n[0],e);return}Pk(t,n,e)};const Wk=t=>{let n=-1;for(let e=t.length-1;e>=0;e--){const o=t[e];if(o.type!==hk&&o.type!==gk&&o.type!==wk){n=e;break}}return n===-1?[]:t.slice(0,n+1)};const Tk=(t,n)=>{const e=xk(t);const o=xk(n);const s=[];Fk(e,o,s,[]);return Wk(s)};const Rk=()=>[{childCount:1,className:"EditorInput",type:vx},{ariaAutoComplete:"list",ariaMultiLine:"true",ariaRoleDescription:"editor",autocapitalize:"off",autocomplete:"off",autocorrect:"off",childCount:0,name:"editor",onBeforeInput:nx,onBlur:ex,onCompositionEnd:sx,onCompositionStart:cx,onCompositionUpdate:rx,onCut:ax,onFocus:dx,onPaste:fx,role:"textbox",spellcheck:false,type:Ax,wrap:"off"}];const Dk=t=>{const n=Array.from(t,t=>({childCount:0,className:$E,translate:t,type:vx}));return n};const Ok=t=>{const n=Dk([...t]);return[{childCount:t.length,className:"LayerCursor",type:vx},...n]};const Bk="error";const Nk="warning";const Hk=t=>{switch(t){case Bk:return OE;case Nk:return BE;default:return OE}};const zk=(...t)=>t.filter(Boolean).join(" ");const $k=t=>{const{height:n,type:e,width:o,x:s,y:c}=t;const r=Hk(e);return[{childCount:0,className:zk(zE,r),height:n,left:s,top:c,type:vx,width:o}]};const Uk=t=>{const n=t.flatMap($k);return n};const Yk=t=>{const n=Uk([...t]);return[{childCount:t.length,className:"LayerDiagnostics",type:vx},...n]};const _k=(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=UE;if(e===o){i+=" "+YE}s.push({childCount:c.length/2,className:i,translate:Fi(r),type:vx});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:bx},Lx(n))}}return s};const Vk=(t,n,e=true,o=-1)=>{const s=_k(t,n,e,o);return[{childCount:t.length,className:"EditorRows",onMouseDown:lx,onPointerDown:hx,onWheel:kx,type:vx},...s]};const jk=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:_E,height:r,left:o,top:s,type:vx,width:c})}return n};const qk=t=>{const n=jk(t);return[{childCount:t.length/4,className:"Selections",type:vx},...n]};const Gk=(t,n,e,o=true,s=-1,c=[],r=[])=>[{childCount:4,className:"EditorLayers",type:vx},...qk(t),...Vk(n,e,o,s),...Ok(c),...Yk(r)];const Xk=t=>[{childCount:t.length,className:"EditorScrollBarDiagnostics",type:vx},...Uk([...t])];const Zk=()=>[{childCount:1,className:"ScrollBar ScrollBarVertical",onContextMenu:ix,onPointerDown:xx,type:vx},{childCount:0,className:"ScrollBarThumb ScrollBarThumbVertical",type:vx},{childCount:1,className:"ScrollBar ScrollBarHorizontal",onPointerDown:px,type:vx},{childCount:0,className:"ScrollBarThumb ScrollBarThumbHorizontal",type:vx}];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:ux,type:vx},...Rk(),...Gk(r,i,e,s,o,t,n),...Xk(c),...Zk()];const Kk=t=>[{childCount:1,className:"LineNumber",type:bx},Lx(t)];const Jk=t=>{const n=t.flatMap(Kk);return n};const tv=t=>{const n=Jk([...t]);return[{childCount:t.length,className:"Gutter",type:vx},...n]};const nv=({cursorInfos:t=[],diagnostics:n=[],differences:e,gutterInfos:o=[],highlightedLine:s=-1,lineNumbers:c=true,loadError:r="",scrollBarDiagnostics:i=[],selectionInfos:a=[],textInfos:d,uid:l})=>{if(r){return[{childCount:2,className:"Viewlet TextEditorError","data-uid":l,role:"code",type:vx},{childCount:0,className:"EditorTextIcon EditorTextIconError MaskIcon MaskIconError",type:vx},{childCount:1,className:"TextEditorErrorMessage",type:vx},Lx(r)]}const u=c?tv(o):[];return[{childCount:c?2:1,className:"Viewlet Editor","data-uid":l,onContextMenu:ix,role:"code",type:vx},...u,...Qk({cursorInfos:t,diagnostics:n,differences:e,highlightedLine:s,lineNumbers:c,scrollBarDiagnostics:i,selectionInfos:a,textInfos:d})]};const ev=new Map;const ov=t=>ev.get(t);const sv=(t,n)=>{ev.set(t,n)};const cv=t=>{const{initial:n,textInfos:e}=t;if(n&&e.length===0){return[]}return nv(t)};const rv=(t,n)=>{const e=t.initial?cv(t):ov(n.uid)||cv(t);const o=cv(n);const s=Tk(e,o);if(s.length===0){return[]}sv(n.uid,o);return[co,n.uid,s]};const iv=t=>{const n=Fs(t.id);if(!n){throw new Error("unsupported widget")}return n.add(t)};const av=t=>{const n=Fs(t.id);if(!n){throw new Error("unsupported widget")}return n.render(t)};const dv=t=>{const n=Fs(t.id);if(!n){throw new Error("unsupported widget")}return n.remove(t)};const lv=(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=iv(t);if(n.length>0){d.push(...n)}}const l=[];for(const t of o){const n=av(t);if(n.length>0){l.push(...n)}}const u=[];for(const t of s){const n=dv(t);if(n.length>0){u.push(...n)}}const f=[...d,...l,...u];return f.filter(t=>t[0]!=="Viewlet.setFocusContext")};const uv=t=>{switch(t){case Ya:return ck;case $a:return rk;case Ua:return ik;case _a:return rv;case Va:return lv;default:throw new Error("unknown renderer")}};const fv=(t,n,e)=>{const o=[];for(const s of e){const e=uv(s);const c=e(t,n);if(c.length>0){if(s===Va){o.push(...c)}else{o.push(c)}}}return o};const hv=(t,n)=>{const{newState:e,oldState:o}=Jo(t);ns(t,e,e);const s=fv(o,e,n);return s};const gv={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=_k(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 mv={apply:(t,n)=>{const{cursorInfos:e=[],selectionInfos:o=[]}=n;const s=Dk(e);const c=jk(o);return["setSelections",s,c]},isEqual:(t,n)=>t.cursorInfos===n.cursorInfos&&t.selectionInfos===n.selectionInfos};const wv={apply:ck,isEqual:Na};const pv={apply:(t,n)=>["setFocused",n.focused],isEqual:(t,n)=>t.focused===n.focused};const yv={apply:(t,n)=>[so,n.uid,n.focus,0,n.uid,"Editor"],isEqual:(t,n)=>t.focus===n.focus};const Ev={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 xv={apply(t,n){const e=Uk(n.visualDecorations||[]);return["setDecorationsDom",e]},isEqual:(t,n)=>t.visualDecorations===n.visualDecorations};const Iv={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=Jk(c);return["renderGutter",r]},isEqual:(t,n)=>t.lineNumbers===n.lineNumbers&&t.minLineY===n.minLineY&&t.maxLineY===n.maxLineY};const Sv={apply:lv,isEqual:(t,n)=>t.widgets===n.widgets,multiple:true};const kv=[gv,mv,wv,pv,xv,Iv,Sv,yv,Ev];const vv=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 kv){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 Cv=()=>[{name:dx,params:["handleFocus"]},{name:ux,params:["handleMouseMove",Xn,Zn,qn]},{name:ex,params:["handleBlur"]},{name:nx,params:["handleBeforeInput","event.inputType","event.data"],preventDefault:true},{name:cx,params:["compositionStart","event.data"]},{name:rx,params:["compositionUpdate","event.data"]},{name:sx,params:["compositionEnd","event.data"]},{name:ax,params:["cut"],preventDefault:true},{name:fx,params:["paste",'event.clipboardData ? event.clipboardData.getData("text/plain") : ""'],preventDefault:true},{name:lx,params:["handleMouseDown","event.button","event.altKey","event.ctrlKey",Xn,Zn,"event.detail"]},{name:hx,params:["handlePointerDown","event.button","event.altKey","event.ctrlKey",Xn,Zn,"event.detail"],trackPointerEvents:[gx,mx]},{name:gx,params:["handlePointerMove",Xn,Zn,qn]},{name:mx,params:["handlePointerUp"]},{name:kx,params:["handleWheel",Qn,"event.deltaX",Kn],passive:true},{name:ix,params:["handleContextMenu",Gn,Xn,Zn],preventDefault:true},{name:xx,params:["handleScrollBarVerticalPointerDown",Zn],preventDefault:true,trackPointerEvents:[Ix,Sx]},{name:Ix,params:["handleScrollBarVerticalPointerMove",Zn]},{name:Sx,params:["handlePointerUp"]},{name:px,params:["handleScrollBarHorizontalPointerDown",Xn],trackPointerEvents:[yx,Ex]},{name:yx,params:["handleScrollBarHorizontalMove",Xn]},{name:Ex,params:["handlePointerUp"]}];const bv=(t,n)=>{const{lines:e}=t;return{lines:e}};const Mv=async(t,n,e)=>{await bo(t,e)};const Av=async(t,n)=>{await Fo(t,n)};const Lv=(t,n)=>t;const Pv=(t,n)=>{g(t);g(n);mi(t,n)};const Fv=async(t,...n)=>{const e=Un(Ge);return e.invoke(t,...n)};const Wv=async t=>{const n=await Fv("RunAndDebug.getHighlight",t);return n};const Tv=()=>{const t=ts();return parseInt(t[0])};const Rv=async t=>{const n=await Wv(t);const e=Tv();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 Dv=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 Sg(s,c);ns(n,s,r);return r};const Ov={"ActivateByEvent.activateByEvent":zo,"CodeGenerator.accept":$o,"ColorPicker.loadContent":Go,"Editor.addCursorAbove":Dv(Ka),"Editor.addCursorBelow":Dv(td),"Editor.applyDocumentEdits":Dv(sd),"Editor.applyEdit":Dv(cd),"Editor.applyEdit2":jI,"Editor.applyWorkspaceEdit":Dv(id),"Editor.braceCompletion":Dv(Md),"Editor.cancelSelection":Dv(Ld),"Editor.closeCodeGenerator":Dv(Td),"Editor.closeFind":Dv(Dd),"Editor.closeFind2":VI,"Editor.closeRename":Dv($d),"Editor.closeSourceAction":Dv(Yd),"Editor.closeWidget2":_I,"Editor.compositionEnd":Dv(tl),"Editor.compositionStart":Dv(Qd),"Editor.compositionUpdate":Dv(Jd),"Editor.contextMenu":Dv(Hh),"Editor.copy":Dv(sl),"Editor.copyLineDown":Dv(cl),"Editor.copyLineUp":Dv(rl),"Editor.create":Ba,"Editor.create2":us,"Editor.cursorCharacterLeft":Dv(Kl),"Editor.cursorCharacterRight":Dv(ou),"Editor.cursorDown":Dv(ru),"Editor.cursorEnd":Dv(iu),"Editor.cursorHome":Dv(au),"Editor.cursorLeft":Dv(Kl),"Editor.cursorRight":Dv(ou),"Editor.cursorSet":Dv(du),"Editor.cursorUp":Dv(hu),"Editor.cursorWordLeft":Dv(gu),"Editor.cursorWordPartLeft":Dv(mu),"Editor.cursorWordPartRight":Dv(wu),"Editor.cursorWordRight":Dv(pu),"Editor.cut":Dv(xu),"Editor.deleteAll":Dv(Iu),"Editor.deleteAllLeft":Dv(Mu),"Editor.deleteAllRight":Dv(Pu),"Editor.deleteCharacterLeft":Dv(Fu),"Editor.deleteCharacterRight":Dv(Wu),"Editor.deleteHorizontalRight":Dv(Lu),"Editor.deleteLeft":Dv(Fu),"Editor.deleteRight":Dv(Wu),"Editor.deleteWordLeft":Dv(Tu),"Editor.deleteWordPartLeft":Dv(Ru),"Editor.deleteWordPartRight":Dv(Du),"Editor.deleteWordRight":Dv(Ou),"Editor.diff2":Za,"Editor.executeWidgetCommand":Dv(mI),"Editor.findAllReferences":Dv(Bu),"Editor.format":Dv(Uu),"Editor.getCommandIds":Zo,"Editor.getDiagnostics":GI,"Editor.getKeyBindings":ZI,"Editor.getKeys":QI,"Editor.getLanguageId":OI,"Editor.getLines2":$I,"Editor.getMenuEntries":nS,"Editor.getMenuEntries2":nS,"Editor.getMenuIds":eS,"Editor.getOffsetAtCursor":BI,"Editor.getPositionAtCursor":RI,"Editor.getProblems":sS,"Editor.getQuickPickMenuEntries":cS,"Editor.getSelections":rS,"Editor.getSelections2":UI,"Editor.getSourceActions":qI,"Editor.getText":iS,"Editor.getUri":DI,"Editor.getWordAt":qu,"Editor.getWordAt2":NI,"Editor.getWordAtOffset2":HI,"Editor.getWordBefore":Gu,"Editor.getWordBefore2":zI,"Editor.goToDefinition":Dv(Ih),"Editor.goToTypeDefinition":Dv(Mh),"Editor.handleBeforeInput":Dv(dS),"Editor.handleBeforeInputFromContentEditable":Dv(hg),"Editor.handleBlur":Dv(ad),"Editor.handleClickAtPosition":Dv(Bh),"Editor.handleContextMenu":Dv(Hh),"Editor.handleDoubleClick":Dv(_h),"Editor.handleFocus":Dv(Vh),"Editor.handleMouseDown":Dv(ng),"Editor.handleMouseMove":Dv(ag),"Editor.handleMouseMoveWithAltKey":Dv(lg),"Editor.handleNativeSelectionChange":gg,"Editor.handlePointerCaptureLost":Dv(mg),"Editor.handlePointerDown":Dv(wg),"Editor.handlePointerMove":Dv(Dg),"Editor.handlePointerUp":Dv(Og),"Editor.handleScrollBarClick":Yg,"Editor.handleScrollBarHorizontalMove":Dv(Ng),"Editor.handleScrollBarHorizontalPointerDown":Dv(Hg),"Editor.handleScrollBarMove":Dv($g),"Editor.handleScrollBarPointerDown":Dv(Yg),"Editor.handleScrollBarVerticalMove":Dv(Ug),"Editor.handleScrollBarVerticalPointerDown":Dv(Yg),"Editor.handleScrollBarVerticalPointerMove":Dv(Ug),"Editor.handleSingleClick":Dv(Zh),"Editor.handleTab":Dv(fS),"Editor.handleTouchEnd":Dv(_g),"Editor.handleTouchMove":Dv(Zg),"Editor.handleTouchStart":Dv(jg),"Editor.handleTripleClick":Dv(Jh),"Editor.handleWheel":Dv(Qg),"Editor.hotReload":xS,"Editor.indendLess":Dv(Jg),"Editor.indentMore":Dv(nm),"Editor.insertLineBreak":Dv(rm),"Editor.loadContent":Dv(JS),"Editor.moveLineDown":Dv(tk),"Editor.moveLineUp":Dv(nk),"Editor.moveRectangleSelection":Dv(pg),"Editor.moveRectangleSelectionPx":Dv(yg),"Editor.moveSelection":Dv(Fg),"Editor.moveSelectionPx":Dv(Rg),"Editor.offsetAt":Wr,"Editor.openCodeGenerator":Dv(um),"Editor.openColorPicker":Dv(Xd),"Editor.openCompletion":Dv(wm),"Editor.openFind":Dv(Mm),"Editor.openFind2":Dv(bm),"Editor.openRename":Dv(Fm),"Editor.organizeImports":Dv(Tm),"Editor.paste":Dv(Dm),"Editor.pasteText":Dv(Rm),"Editor.redo":Dv(Om),"Editor.render":vv,"Editor.render2":hv,"Editor.renderEventListeners":Cv,"Editor.replaceRange":Dv(dd),"Editor.rerender":Dv(Gx),"Editor.resize":Dv(yi),"Editor.save":Dv(tw),"Editor.saveState":Ko(bv),"Editor.selectAll":Dv(nw),"Editor.selectAllLeft":Dv(sw),"Editor.selectAllOccurrences":Dv(mw),"Editor.selectAllRight":Dv(yw),"Editor.selectCharacterLeft":Dv(Ew),"Editor.selectCharacterRight":Dv(xw),"Editor.selectDown":Dv(Sw),"Editor.selectInsideString":Dv(vw),"Editor.selectionGrow":Dv(bw),"Editor.selectLine":Dv(Kh),"Editor.selectNextOccurrence":Dv(Pw),"Editor.selectPreviousOccurrence":Dv(Fw),"Editor.selectUp":Dv(Tw),"Editor.selectWord":Dv(Yh),"Editor.selectWordLeft":Dv(Rw),"Editor.selectWordRight":Dv(Dw),"Editor.setDebugEnabled":Dv(Lv),"Editor.setDecorations":Dv(Ow),"Editor.setDelta":Dv(Xg),"Editor.setDeltaY":Dv(qg),"Editor.setLanguageId":Dv(Bw),"Editor.setSelections":Dv(Nw),"Editor.setSelections2":YI,"Editor.setText":Dv(Hw),"Editor.showHover":Gw,"Editor.showHover2":jw,"Editor.showSourceActions":Dv(np),"Editor.showSourceActions2":Dv(np),"Editor.showSourceActions3":Dv(np),"Editor.sortLinesAscending":Dv(rp),"Editor.tabCompletion":Dv(hp),"Editor.terminate":e,"Editor.toggleBlockComment":Dv(xp),"Editor.toggleComment":Dv(Cp),"Editor.toggleLineComment":Dv(vp),"Editor.type":Dv(bp),"Editor.typeWithAutoClosing":Dv(_p),"Editor.undo":Dv(jp),"Editor.unIndent":Dv(qp),"Editor.updateDebugInfo":Rv,"Editor.updateDiagnostics":Dv(Oa),"EditorCompletion.close":Ey,"EditorCompletion.closeDetails":xy,"EditorCompletion.focusFirst":Iy,"EditorCompletion.focusIndex":Sy,"EditorCompletion.focusNext":vy,"EditorCompletion.focusPrevious":Cy,"EditorCompletion.handleEditorBlur":by,"EditorCompletion.handleEditorClick":My,"EditorCompletion.handleEditorDeleteLeft":Ay,"EditorCompletion.handleEditorType":Ly,"EditorCompletion.handlePointerDown":Py,"EditorCompletion.handleWheel":Fy,"EditorCompletion.openDetails":Wy,"EditorCompletion.selectCurrent":Ty,"EditorCompletion.selectIndex":Ry,"EditorCompletion.toggleDetails":Dy,"EditorRename.accept":_x,"EditorRename.close":Vx,"EditorRename.handleInput":jx,"EditorSourceAction.close":eI,"EditorSourceAction.closeDetails":oI,"EditorSourceAction.focusFirst":sI,"EditorSourceAction.focusIndex":cI,"EditorSourceAction.focusNext":iI,"EditorSourceAction.focusPrevious":aI,"EditorSourceAction.handleWheel":dI,"EditorSourceAction.selectCurrent":lI,"EditorSourceAction.selectIndex":uI,"EditorSourceAction.selectItem":fI,"EditorSourceAction.toggleDetails":hI,"EditorSourceActions.focusNext":Zx,"ExtensionHostManagement.activateByEvent":zo,"FindWidget.close":Uy,"FindWidget.focusCloseButton":Yy,"FindWidget.focusFind":_y,"FindWidget.focusNext":Vy,"FindWidget.focusNextElement":jy,"FindWidget.focusNextMatchButton":qy,"FindWidget.focusPrevious":Gy,"FindWidget.focusPreviousElement":Xy,"FindWidget.focusPreviousMatchButton":Zy,"FindWidget.focusReplace":Qy,"FindWidget.focusReplaceAllButton":Ky,"FindWidget.focusReplaceButton":Jy,"FindWidget.focusToggleReplace":tE,"FindWidget.handleBlur":nE,"FindWidget.handleClickButton":eE,"FindWidget.handleFocus":oE,"FindWidget.handleInput":sE,"FindWidget.handleReplaceFocus":cE,"FindWidget.handleReplaceInput":rE,"FindWidget.handleToggleReplaceFocus":iE,"FindWidget.loadContent":vm,"FindWidget.replace":aE,"FindWidget.replaceAll":dE,"FindWidget.toggleMatchCase":lE,"FindWidget.toggleMatchWholeWord":uE,"FindWidget.togglePreserveCase":fE,"FindWidget.toggleReplace":hE,"FindWidget.toggleUseRegularExpression":gE,"Font.ensure":XI,"HandleMessagePort.handleMessagePort":lS,"Hover.getHoverInfo":AE,"Hover.handleSashPointerDown":PE,"Hover.handleSashPointerMove":FE,"Hover.handleSashPointerUp":WE,"Hover.loadContent":LE,"Hover.render":Hx,"Initialize.initialize":CS,"Listener.register":ek,"Listener.registerListener":gi,"Listener.unregister":Pv,"SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker":Mv,"SendMessagePortToExtensionManagementWorker.sendMessagePortToExtensionManagementWorker":Av};for(const[t,n]of Object.entries(Ov)){if(t.startsWith("Editor.")){Ov["EditorText"+t.slice("Editor".length)]=n}}const Bv=async()=>{const t="HandleMessagePort.handleMessagePort2";const n=await On({commandMap:{},async send(n){await Mv(n,t,Xe)}});return n};const Nv=async()=>{const t=await Bv();ha(t)};const Hv=async()=>{const t=await On({commandMap:{},async send(t){await Fo(t,Xe)}});return t};const zv=async()=>{try{const t=await Hv();fo(t)}catch{}};const $v=t=>ko(t);const Uv=async()=>{const t=await On({commandMap:{},send:$v});mo(t)};const Yv=async()=>{const t=await Nn({commandMap:Ov});Io(t)};const _v=t=>Po(t);const Vv=async()=>{const t=await On({commandMap:{},send:_v});yo(t)};const jv=async()=>{Qo(Ov);await Promise.all([Yv(),Nv(),zv(),Vv(),Uv()])};const qv="CodeGeneratorInput";const Gv=t=>{const n=$f();const e=Uf();return[{childCount:2,className:zk(tx,DE),type:vx},{childCount:0,className:zk(TE,KE),name:qv,placeholder:e,type:Cx},{childCount:1,className:RE,type:vx},Lx(n)]};const Xv={apply(t,n){const e=Gv();return[fy,n.uid,e]},isEqual:(t,n)=>t.questions===n.questions};const Zv={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[dy,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)=>[sy,".CodeGeneratorInput",n.focusSource],isEqual:(t,n)=>t.focused===n.focused&&t.focusSource===n.focusSource};const Kv=[Xv,Zv,Qv];const Jv=(t,n)=>{const e=[];for(const o of Kv){if(!o.isEqual(t,n)){e.push(o.apply(t,n))}}return e};const tC=t=>{const n=Jv(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(t[0]===fy){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const nC=t=>Xp(t,"EditorCodeGenerator",tC);const eC=Qx;const oC={__proto__:null,add:nC,remove:eC,render:tC};const sC=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const cC=[fy,uy,oy,ly,cy,hy];const rC=t=>{const n=sC(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(cC.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const iC=t=>Xp(t,"ColorPicker",rC);const aC=Qx;const dC={};const lC={__proto__:null,Commands:dC,add:iC,remove:aC,render:rC};const uC=t=>{const n=[{childCount:2,className:"Viewlet EditorCompletionDetails",type:vx},{childCount:1,className:HE,type:vx},Lx(t),{childCount:1,className:NE,onClick:ox,type:vx},{childCount:0,className:`${JE} ${QE}`,type:vx}];return n};const fC=(t,n,e)=>{const o=[];for(const s of t){if(!s.isEqual(n,e)){o.push(s.apply(n,e))}}return o};const hC={apply(t,n){const e=uC(n.content);return[fy,n.uid,e]},isEqual:(t,n)=>t.content===n.content};const gC={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[dy,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height};const mC=[hC,gC];const wC=(t,n)=>fC(mC,t,n);const pC=(t,n)=>{const{widgets:e}=t;for(const t of e){if(t.id===n){return t.newState}}return undefined};const yC=t=>pC(t,Te);const EC=t=>{const n=wC(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(t[0]===fy){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const xC=t=>Xp(t,"EditorCompletionDetails",EC);const IC=Qx;const SC=(t,n)=>{const e=yC(t);if(!e){return t}const{x:o}=Am(t);const s=o+e.width-n.borderSize;return{...n,x:s}};const kC=(t,n)=>SC(t,n);const vC=(t,n)=>SC(t,n);const CC={__proto__:null,add:xC,handleEditorDeleteLeft:vC,handleEditorType:kC,remove:IC,render:EC};const bC=[fy,uy,oy,ly,cy,ry,iy,ay,hy,"Viewlet.focusSelector"];const MC=t=>{const n=gy(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(bC.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const AC=t=>Xp(t,"EditorCompletion",MC);const LC=t=>[["Viewlet.dispose",t.newState.uid]];const{close:PC}=ey(["close"],"",Oe);const FC={__proto__:null,add:AC,close:PC,remove:LC,render:MC};const WC=()=>{Ps(We,lC);Ps(Te,Oy);Ps(Re,CC);Ps(De,mE);Ps(Oe,FC);Ps(Be,qx);Ps(Ne,gI);Ps(Fe,oC)};const TC=t=>{t.preventDefault();console.error(`[editor-worker] Unhandled Rejection: ${t.reason}`)};const RC=(t,n,e,o,s)=>{console.error(`[editor-worker] Unhandled Error: ${s}`);return true};const DC=t=>{t.addEventListener("error",RC);t.addEventListener("unhandledrejection",TC)};const OC=async()=>{DC(globalThis);await jv();WC()};OC();
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 K=t=>{const n=$(t);const e=n.findIndex(Z);const o=n[e];return{code:B,message:o}};const Q=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(Q(n)){return K(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 Kt=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 Qt=t=>{if("error"in t){const n=Kt(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 Qt(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 Kn="event.deltaMode";const Qn="event.deltaY";const Jn="event.key";const te=1;const ne=2;const ee=3;const oe=8;const se=9;const ce=255;const re=12;const ie=13;const ae=14;const de=15;const le=16;const ue=18;const fe=29;const he=31;const ge=32;const me=34;const we=36;const pe=38;const ye=39;const Ee=40;const xe=43;const Ie=50;const Se=52;const ke=54;const ve=58;const Ce=59;const be=60;const Me=68;const Ae=87;const Le=88;const Pe=90;const Fe=92;const We=1;const Te=2;const Re=3;const De=4;const Oe=5;const Be=6;const Ne=7;const He=8;const ze=1<<11>>>0;const Ue=1<<10>>>0;const _e=1<<9>>>0;const Ye=3;const $e=22;const Ve=1;const je=0;const qe=2;const Ge=301;const Xe=55;const Ze=99;const Ke=3308;const Qe=44;const Je=9006;const to=7009;const no=300;const eo=4561;const oo=1;const so="Viewlet.focusSelector";const co="Viewlet.setCss";const ro="Viewlet.setFocusContext";const io="Viewlet.setPatches";const ao=12;const{invoke:lo,set:uo}=$n(Ke);const{invoke:fo,set:ho}=$n(Qe);const go={__proto__:null,invoke:fo,set:ho};const{invoke:mo,set:wo}=$n(Je);const po=(t,n)=>mo("Extensions.getLanguages",t,n);const{invoke:yo,set:Eo}=$n(eo);const xo=async(t,n)=>yo("Open.openUrl",t,n);const{invoke:Io,set:So}=$n(to);const{invoke:ko,invokeAndTransfer:vo,set:Co}=$n(oo);const bo=async(t,n,e,o,s)=>{g(t);g(n);g(e);g(o);await ko("ContextMenu.show2",t,n,e,o,s)};const Mo=async(t,n)=>{const e="HandleMessagePort.handleMessagePort";await vo("SendMessagePortToExtensionHostWorker.sendMessagePortToOpenerWorker",t,e,n)};const Ao=async(t,n)=>{const e="Errors.handleMessagePort";await vo("SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker",t,e,n)};const Lo=async t=>ko("FileSystem.readFile",t);const Po=async()=>ko("Layout.handleWorkspaceRefresh");const Fo=async(t,n=0)=>{const e="HandleMessagePort.handleMessagePort2";await vo("SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker",t,e,n)};const Wo=async t=>{await ko("ClipBoard.writeText",t)};const To=async()=>ko("ClipBoard.readText");const Ro=(t,n,e)=>ko("ExtensionHostManagement.activateByEvent",t,n,e);const Do=async t=>{const n="TextMeasurement.handleMessagePort";await vo("SendMessagePortToExtensionHostWorker.sendMessagePortToTextMeasurementWorker",t,n,0)};const Oo=async(t,n)=>{const e="Extensions.handleMessagePort";await vo("SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker",t,e,n)};const Bo=async t=>await ko("Preferences.get",t);const No=async(t,n,e)=>{await ko("Main.openUri",t,n,e)};const Ho=async t=>{await vo("SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker",t,"HandleMessagePort.handleMessagePort2")};const zo={__proto__:null,activateByEvent:Ro,getPreference:Bo,handleWorkspaceRefresh:Po,invoke:ko,invokeAndTransfer:vo,openUri:No,readClipBoardText:To,readFile:Lo,sendMessagePortToErrorWorker:Ao,sendMessagePortToExtensionHostWorker:Fo,sendMessagePortToExtensionManagementWorker:Oo,sendMessagePortToOpenerWorker:Mo,sendMessagePortToSyntaxHighlightingWorker:Ho,sendMessagePortToTextMeasurementWorker:Do,set:Co,showContextMenu2:bo,writeClipBoardText:Wo};const{invoke:Uo,set:_o}=$n(no);const Yo={__proto__:null,invoke:Uo,set:_o};const $o=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 Vo=async(t,n,e)=>{w(t);await Ro(t,n,e)};const jo=t=>t;const qo=6;const Go=async(t,n,e)=>{const o=await Rn({commandMap:{},isMessagePortOpen:true,async send(e){await vo("IpcParent.create",{method:qo,name:t,port:e,raw:true,url:n})}});if(e){await o.invoke(e)}return o};const Xo=async()=>{const t="Color Picker Worker";const n="colorPickerWorkerMain.js";return Go(t,n)};const Zo={};const Ko=()=>{if(!Zo.workerPromise){Zo.workerPromise=Xo()}return Zo.workerPromise};const Qo=async(t,...n)=>{const e=await Ko();return await e.invoke(t,...n)};const Jo=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 ts=n();const{dispose:ns,getCommandIds:es,registerCommands:os,wrapGetter:ss}=ts;const cs=t=>ts.get(t);const rs=()=>{const t=ts.getKeys();return t.map(String)};const is=(t,n,e)=>{ts.set(t,n,e)};const as=[];const ds=41;const ls=9;const us=0;const fs=16;const hs=51;const gs=11;const ms=38;const ws=52;const ps=(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:us,fontFamily:"",fontSize:0,fontWeight:0,handleOffset:0,handleOffsetX:0,hasListener:false,height:c,highlightedLine:-1,id:t,incrementalEdits:as,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};is(t,a,a)};const ys="compositionUpdate";const Es="contentEditableInput";const xs="delete";const Is="deleteHorizontalRight";const Ss="deleteLeft";const ks="editorCut";const vs="editorPasteText";const Cs="editorSnippet";const bs="editorType";const Ms="editorTypeWithAutoClosing";const As="format";const Ls="indentLess";const Ps="indentMore";const Fs="insertLineBreak";const Ws="lineComment";const Ts="rename";const Rs="toggleBlockComment";const Ds=Object.create(null);const Os=(t,n)=>{Ds[t]=n};const Bs=t=>Ds[t];const Ns=t=>Bs(t);const Hs=async(t,n,e)=>{const o=Ns(n.id);if(e.length===1&&e[0].origin===bs&&o.handleEditorType){const n=await o.handleEditorType(t);return{...n}}if(e.length===1&&e[0].origin===Ss&&o.handleEditorDeleteLeft){const n=await o.handleEditorDeleteLeft(t);return{...n}}return n};const zs=async(t,n)=>{const e=t.widgets||[];if(e.length===0){return e}let o=t;for(const s of e){o=await Hs(t,s,n)}return o};const Us=(t,n,e)=>{g(t);g(n);g(e);return Math.min(Math.max(t,n),e)};const _s="Link";const Ys="EditorGoToDefinitionLink";const $s="Function";const Vs="Parameter";const js="Type";const qs="VariableName";const Gs="Class";const Xs=1;const Zs=2;const Ks=2816;const Qs=2817;const Js=2824;const tc=2825;const nc=2956;const ec=2857;const oc=3072;const sc=3073;const cc=3077;const rc=3088;const ic=1792;const ac=1793;const dc=512;const lc=513;const uc=769;const fc=1024;const hc=1536;const gc=1537;const mc=1544;const wc=1545;const pc=2048;const yc=2049;const Ec=2056;const xc=2057;const Ic=2064;const Sc=2080;const kc=2081;const vc=2088;const Cc=2089;const bc=2313;const Mc=2560;const Ac=2561;const Lc=2569;const Pc=2584;const Fc=256;const Wc=257;const Tc=272;const Rc=t=>{switch(t){case Zs:return Ys;case Xs:return _s;case fc:case hc:case gc:case mc:case wc:case dc:case lc:case uc:return js;case ic:case ac:return Vs;case pc:case yc:case Ec:case xc:case Ic:case Sc:case kc:case vc:case Cc:case bc:case Mc:case Ac:case Lc:case Pc:return qs;case Fc:case Wc:case Tc:return Gs;case Ks:case Qs:case Js:case tc:case nc:case ec:case oc:case sc:case cc:case rc:return $s;default:return`Unknown-${t}`}};const Dc=t=>structuredClone(t);const Oc=t=>Dc(t);const Bc={warned:[]};const Nc=t=>{const n=[];for(const e of t){h(e);n.push(e.type,e.length)}return n};const Hc=(t,n)=>{if(Bc.warned.includes(n)){return}Bc.warned.push(n);console.warn(`tokenizers without hasArrayReturn=false are deprecated (language ${t})`)};const zc=(t,n,e,o,s)=>{try{const c=n(e,o);if(!c?.tokens||!c.state){throw new Error("invalid tokenization result")}if(!s){Hc(t,n);c.tokens=Nc(c.tokens)}return c}catch(t){console.error(t);return{lineState:o,tokens:[0,e.length]}}};const Uc={TopLevelContent:1};const _c={Text:1};const Yc={[_c.Text]:"Text"};const $c={state:Uc.TopLevelContent};const Vc=true;const jc=(t,n)=>({state:n.state,tokens:[_c.Text,t.length]});const qc={__proto__:null,State:Uc,TokenMap:Yc,TokenType:_c,hasArrayReturn:Vc,initialLineState:$c,tokenizeLine:jc};const Gc={enabled:false};const Xc=t=>{Gc.enabled=t};const Zc=()=>Gc.enabled;const{invoke:Kc,set:Qc}=Yo;const Jc={pending:Object.create(null),tokenizePaths:Object.create(null),tokenizers:Object.create(null)};const tr=t=>Object.hasOwn(Jc.tokenizers,t);const nr=(t,n)=>{Jc.tokenizers[t]=n};const er=t=>Jc.tokenizers[t];const or=(t,n)=>{Jc.tokenizePaths[t]=n};const sr=t=>Jc.tokenizePaths[t]||"";const cr=t=>{for(const n of t){if(n&&n.id&&n.tokenize){or(n.id,n.tokenize)}}};const rr=t=>Object.hasOwn(Jc.pending,t);const ir=Object.create(null);const ar=(t,n)=>{ir[t]=n};const dr=t=>ir[t]||{};const lr=async(t,n)=>{if(!n){return}or(t,n);if(Zc()){const e=await Kc("Tokenizer.load",t,n);ar(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}ar(t,e.TokenMap);nr(t,e)}catch(t){console.error(t)}};const ur=t=>{if(tr(t)){return er(t)}if(rr(t)){return qc}return qc};const fr=Object.create(null);const hr=(t,n)=>{fr[t]=n};const gr=t=>fr[t]||qc;const mr=(t,n,e,o,s,c,r)=>{const i=ur(e);if(o!==n.length&&i&&i!==qc){const a=o===0&&s===n.length;const d=n.slice(o,s);const l=zc(t,i.tokenizeLine,d,c[e]||Oc(i.initialLineState),i.hasArrayReturn);c[e]=l;if(l.embeddedLanguage){const n=mr(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 wr=(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(mr(t,a,n,i,e,r,s))}}else{for(const t of Object.keys(r)){r[t]=undefined}}}return{embeddedResults:c,tokenizersToLoad:s}};const pr=(t,n,e)=>t<n?n:e;const yr=(t,n,e)=>{const{invalidStartIndex:o,languageId:s,lineCache:c,lines:r,tokenizerId:i}=t;const a=gr(i);const{hasArrayReturn:d,initialLineState:l,tokenizeLine:u}=a;const f=o;const h=pr(o,e,f);const g=[];const m=[];const w=[];for(let t=f;t<h;t++){const n=t===0?Oc(l):c[t];const e=r[t];const o=zc(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}=wr(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 Er=Object.create(null);const xr=async(t,n,e,o)=>{if(Zc()){if(o){const{id:o,invalidStartIndex:s,languageId:c,lines:r}=t;let i=true;let a=r;if(Er[o]===r){i=false;a=[]}else{Er[o]=r}const d={invalidStartIndex:s,languageId:c};return Kc("GetTokensViewport.getTokensViewport",d,n,e,i,o,a)}return Kc("GetTokensViewport.getTokensViewport",t,n,e,true,t.id,t.lines)}return yr(t,n,e)};const Ir=async t=>{for(const n of t){const t=sr(n);await lr(n,t)}};const Sr=".";const kr='"';const vr="";const Cr="\n";const br=" ";const Mr="\t";const Ar=(t,n,e)=>{if(n){return t.replaceAll(Mr,()=>br.repeat(e))}return t};const Lr=t=>t.includes(Mr);const Pr=(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 Fr=(t,n,e,o)=>{const s=t.splice(n,e);Pr(t,n,o);return s};const Wr=t=>t.join("\n");const Tr=/^\s+/;const Rr=t=>{const n=t.match(Tr);if(!n){return""}return n[0]};const Dr=(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);Fr(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);Fr(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));Fr(e,n,a.length,[o,...t,s])}t.maxLineY=Math.min(t.numberOfVisibleLines,t.lines.length)}o+=d.length-a.length}return e};const Or=(t,n)=>t.lines[n];const Br=t=>Wr(t.lines);const Nr=(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 Hr=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 zr=(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 Ur=(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 _r=10;const Yr=(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 $r=(t,n,e)=>{for(const[o,{end:s}]of t){if(o<e&&s>n){return true}}return false};const Vr=(t,n)=>{for(const[e,o]of t){if(e<=n&&o.end>n){return o}}return undefined};const jr=(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=Rc(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}=Yr(m,l);const I=Gr(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=$r(h,E,s);if(i){let t=E;while(t<s){const o=Vr(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=Ar(a,c,r);f.push(l,d);t=i}}else{const t=e.slice(E,s);const o=`Token ${w[n]||"Unknown"}`;const i=Ar(t,c,r);f.push(i,o)}E=s;y=s;if(y>=u){break}}return{difference:I,lineInfo:f}};const qr=()=>({maxOffset:Infinity,minOffset:0});const Gr=(t,n,e)=>{const o=t*n;const s=o-e;return s};const Xr=(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=Rc(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}=Yr(m,u);const E=Gr(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=$r(g,p,c);if(a){let n=p;while(n<c){const o=Vr(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=Ar(d,r,i);h.push(u,l);n=a}}else{const n=t.slice(p,c);const o=`Token ${s[e]||"Unknown"}`;const a=Ar(n,r,i);h.push(a,o)}p=c;w=c;if(w>=f){break}}return{difference:E,lineInfo:h}};const Zr=(t,n,e,o,s,c,r,i,a,d,l)=>{const{maxOffset:u,minOffset:f}=qr();if(e.length>0&&n.embeddedResultIndex!==undefined){const s=e[n.embeddedResultIndex];if(s?.isFull){return jr(e,n,t,o,c,r,i,a,d,l,f,u)}}return Xr(t,n,e,o,s,c,r,i,a,d,l,f,u)};const Kr=(t,n,e,o,s,c,r,i,a)=>{const d=[];const l=[];const{decorations:u,languageId:f,lines:h}=t;const g=dr(f);let m=c;const w=2;for(let t=o;t<s;t++){const s=h[t];const c=Lr(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}=Zr(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 Qr=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 xr(t,c,a,n);for(let e=0;l.length>0&&e<_r;e++){await Ir(l);const e=await xr(t,c,a,n);({embeddedResults:d,tokenizersToLoad:l,tokens:u}=e)}const f=await Hr(t,c,0);const h=e;const{differences:g,result:m}=Kr(t,u,d,c,a,f,i,o,h);return{differences:g,textInfos:m}};const Jr=(t,n,e,o)=>{const s=t/n*(e-o);if(!Number.isFinite(s)){return 0}return s};const ti=Jr;const ni=(t,n,e)=>{if(t>=n){return 0}return Math.max(Math.round(t**2/n),e)};const ei=(t,n)=>{if(t>n){return 0}return t**2/n};const oi=(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 si={enabled:false};const ci=t=>{si.enabled=t};const ri=()=>si.enabled;const ii=async(t,n)=>{h(t);g(n);const{deltaY:e,finalDeltaY:o,height:s,itemHeight:c,numberOfVisibleLines:r,scrollBarHeight:i}=t;const a=Us(n,0,o);if(e===a){return t}const d=Math.floor(a/c);const l=d+r;const u=ti(a,o,s,i);const f={...t,deltaY:a,maxLineY:l,minLineY:d,scrollBarY:u};const m=ri();const{differences:w,textInfos:p}=await Qr(f,m);const y={...f,differences:w,textInfos:p};return y};const ai=async(t,n)=>{if(!n.undoStack){return as}if(t.undoStack===n.undoStack){return as}const e=n.undoStack.at(-1);if(e&&e.length===1){const o=e[0];if(o.origin===bs){const{rowIndex:e}=o.start;const{lines:s}=n;const c=t.lines[e];const r=s[e];const i=await Kc("TokenizeIncremental.tokenizeIncremental",n.uid,n.languageId,c,r,e,n.minLineY);if(i&&i.length===1){return i}}}return as};const di=(t,n)=>t.matchAll(n).toArray();const li=/(?:https?|ftps?|file):\/\/[^\s"']+|www\.[^\s"']+/g;const ui=/^(?:https?|ftp|ftps|file):\/\//;const fi=/^www\./;const hi=".,;:!?";const gi={")":"(","]":"[","}":"{",">":"<"};const mi=(t,n)=>{const e=gi[n];let o=0;for(const s of t){if(s===e){o++}else if(s===n){o--}}return o<0};const wi=t=>{let n=t;while(n.length>0){const t=n.at(-1);if(!t){break}if(hi.includes(t)){n=n.slice(0,-1);continue}if(t in gi&&mi(n,t)){n=n.slice(0,-1);continue}break}return n};const pi=t=>{const n=di(t,li);const e=[];for(const t of n){const n=wi(t[0]);if(ui.test(n)||fi.test(n)){e.push({length:n.length,start:t.index??0})}}return e};const yi=t=>{const n=[];const{lines:e}=t;let o=0;for(const t of e){const e=pi(t);for(const t of e){const e=o+t.start;n.push(e,t.length,Xs,0)}o+=t.length+1}return n};const Ei=(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===Xs&&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 xi=1;const Ii=Object.create(null);const Si=(t,n)=>{g(t);g(n);if(!Object.hasOwn(Ii,t)){Ii[t]=[]}if(!Ii[t].includes(n)){Ii[t].push(n)}};const ki=(t,n)=>{g(t);g(n);if(Object.hasOwn(Ii,t)){const e=Ii[t].indexOf(n);if(e!==-1){Ii[t].splice(e,1)}}};const vi=t=>{g(t);return Ii[t]||[]};const Ci=async(t,n,...e)=>{g(t);w(n);const o=vi(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 bi=(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=ni(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 Mi=t=>{if(!t){return[""]}return t.split("\n")};const{invoke:Ai}=zo;const Li=async t=>{try{await Ai("Main.handleModifiedStatusChange",t,true)}catch{}};const Pi=(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 Fi=t=>{let n=0;for(const e of t){if(e===Mr){n++}}return n};const Wi=/^\p{ASCII}*$/u;const Ti=t=>Wi.test(t);const Ri=async(t,n)=>t.length*n;const Di=async(t,n,e,o,s,c,r)=>{const i=await Io("TextMeasurement.measureTextWidth",t,n,e,o,s,c,r);return i};const Oi=async(t,n,e,o,s,c,r)=>{if(c&&Ti(t)){return await Ri(t,r)}return await Di(t,n,e,o,s,c,r)};const Bi=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=Lr(t);const h=Ar(t,f,i);const m=Fi(t.slice(0,n));const y=h.slice(0,n+m);const E=await Oi(y,e,o,s,r,c,l);return E-a+u};const Ni=(t,n,e)=>(t-n)*e;const Hi=t=>`${t}px`;const zi=(t,n,e,o)=>new Uint32Array([t,n,e,o]);const Ui=t=>new Uint32Array(t);const _i=t=>Ui(t.length);const Yi=(t,n)=>{const e=_i(t);for(let o=0;o<e.length;o+=4){const[s,c,r,i]=Pi(t,o);n(e,o,s,c,r,i)}return e};const $i=(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 Vi=(t,n,e,o)=>{t[n]=t[n+2]=e;t[n+1]=t[n+3]=o};const ji=(t,n,e,o)=>t===e&&n===o;const qi=(t,n,e,o)=>t===e;const Gi=(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 Xi=t=>Gi(t,ji);const Zi=t=>Gi(t,qi);const Ki=(t,n)=>{const e=Ui(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 Qi=[];const Ji=(t,n)=>{if(!n){return Qi}const e=[];for(let n=0;n<t.length;n+=2){const o=t[n];const s=t[n+1];e.push(`${Hi(o)} ${Hi(s)}`)}return e};const ta=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(Hi(o),Hi(s),Hi(c),Hi(r))}return n};const na=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]=Pi(w,t);if(r<g||o>h){continue}const k=r-g;const v=c[k];const C=f[r];const b=await Bi(C,I,d,a,i,l,u,p,x,y,E,v);const M=Ni(r,g,m);if(ji(o,s,r,I)&&b>0){n.push(b,M);continue}const A=Ni(o,g,m);const L=o-g;const P=c[L];if(o===r){const t=await Bi(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 Bi(t,s,d,a,i,l,u,p,x,y,E,P);const r=await Bi(t,t.length,d,a,i,l,u,p,x,y,E,P);const h=Ni(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=Ni(n,g,m);const s=n-g;const r=c[s];const h=await Bi(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:Ji(n,r),selectionInfos:ta(e)}};const ea=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 oa=(t,n)=>{h(t);return{...t,selections:n}};const sa=(t,n)=>{h(t);m(n);const e=Ki(n,ea);return e};const ca=(t,n)=>ii(t,n);const ra=(t,n)=>ca(t,t.deltaY+n);const ia=t=>t.origin===Ms;const aa=(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(ia(s)){o.push(c,r+1,i,a+1)}return o};const da=(t,n)=>oa(t,n);const la=async(t,n,e=undefined)=>{h(t);m(n);if(n.length===0){return t}const o=Dr(t,n);const s={...t,lines:o};const c=e||sa(s,n);const r=Math.min(t.invalidStartIndex,n[0].start.rowIndex);const i=aa(t,n);const a={...s,autoClosingRanges:i,invalidStartIndex:r,lines:o,modified:true,redoStack:[],selections:c,undoStack:[...t.undoStack,n]};const d=yi(a);const l={...a,decorations:d};is(t.uid,t,l);if(!t.modified){await Li(t.uri)}try{await Ci(xi,"handleEditorChanged",t.uid,t.uri,n)}catch(t){console.warn("Failed to notify editor change listeners:",t)}const u=await ai(t,l);const f=await zs(l,n);const g={...l,...f,incrementalEdits:u};if(u!==as){return g}const w=ri();const{differences:p,textInfos:y}=await Qr(g,w);return{...g,differences:p,textInfos:y}};const ua=async(t,n)=>{h(t);m(n);if(n.length===0){return t}const e=Dr(t,n);const o={...t,lines:e};const s=sa(o,n);const c=Math.min(t.invalidStartIndex,n[0].start.rowIndex);const r={...o,invalidStartIndex:c,lines:e,selections:s};const i=await ai(t,r);const a={...r,incrementalEdits:i};if(i!==as){return a}const d=ri();const{differences:l,textInfos:u}=await Qr(a,d);return{...a,differences:l,textInfos:u}};const fa=async(t,n)=>{const e=Dr(t,n);const o=n[0].start.rowIndex;const s={...t,invalidStartIndex:o,lines:e,redoStack:[],undoStack:[...t.undoStack,n]};const c=await ai(t,s);const r={...s,incrementalEdits:c};if(c!==as){return r}const i=ri();const{differences:a,textInfos:d}=await Qr(r,i);return{...r,differences:a,textInfos:d}};const ha=t=>t.selections&&t.selections.length>0;const ga=(t,n,e,o,s,c)=>bi(t,{height:s,width:o,x:n,y:e},c);const ma=(t,n)=>{const e=Mi(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=ni(t.height,l,s);return{...t,finalDeltaY:d,finalY:a,lines:e,maxLineY:i,scrollBarHeight:u}};const wa={cursorInfos:[],debugEnabled:false,decorations:[],deltaX:0,deltaY:0,diagnostics:[],differences:[],embeds:[],focused:false,hasListener:false,height:0,highlightedLine:-1,incrementalEdits:as,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 pa="ExtensionHostHover.execute";const ya="ExtensionHost.executeTabCompletionProvider";const Ea="ExtensionHostTextDocument.syncFull";const{invoke:xa,set:Ia}=go;const Sa=t=>{w(t);return t.lastIndexOf(Sr)};const ka=(t,n)=>t.lastIndexOf(Sr,n);const va=(t,n)=>{for(const e of t){if(e&&e.extensions&&Array.isArray(e.extensions)&&e.extensions.includes(n)){return e.id}}return""};const Ca=(t,n)=>{for(const e of t){if(e&&e.fileNames&&Array.isArray(e.fileNames)&&e.fileNames.includes(n)){return e.id}}return""};const ba=(t,n)=>{w(t);const e=Sa(t);const o=t.slice(e);const s=o.toLowerCase();const c=va(n,s);if(c){return c}const r=t.toLowerCase();const i=ka(t,e-1);const a=t.slice(i);const d=va(n,a);if(d){return d}const l=Ca(n,r);if(l){return l}return"unknown"};const Ma=async(t,n)=>{g(t);w(n);const e=await po(t,n);return e};const Aa=async(t,n,e,o)=>await Oi("a",t,n,e,o,false,0);const La=async t=>{const n=await Bo(t);return n};const Pa=async(t,n)=>{const e=await lo("Errors.prepare",t);await lo("Errors.print",e,n)};const Fa=(t,n)=>{if(n){console.error(n,t);return}console.error(t)};const Wa=async(t,n="")=>{try{await Pa(t,n)}catch(e){console.warn("ErrorHandling error",e);Fa(t,n)}};const Ta="onDiagnostic";const Ra="onHover";const Da="onTabCompletion";const Oa=async({args:t,assetDir:n,editor:e,event:o,method:s,noProviderFoundMessage:c,noProviderFoundResult:r=undefined,platform:i})=>{const a=`${o}:${e.languageId}`;await Vo(a,n,i);const d=await xa(s,e.uid,...t);return d};const Ba=t=>({documentId:t.id||t.uid,languageId:t.languageId,text:Br(t),uri:t.uri});const Na=async t=>{const n=Ba(t);return mo("Extensions.executeDiagnosticProvider",n)};const Ha=async t=>{const n=await Na(t);if(n.length>0){return n}const{assetDir:e,platform:o}=t;return Oa({args:[],assetDir:e,editor:t,event:Ta,method:"ExtensionHost.executeDiagnosticProvider",noProviderFoundMessage:"no diagnostic provider found",platform:o})};const za=t=>t.type;const Ua=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 Bi(d[m],n,r,c,s,i,a,f,E,h,o,y);const I=Ni(m,l,u)-u;e.push({height:u,type:za(t),width:p,x:x,y:I})}return e};const _a=(t,n)=>{const e=yi(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 Ya=async t=>{const n=Br(t);await xa(Ea,t.uri,t.id,t.languageId,n);return Ha(t)};const $a=async(t,n)=>{const e=await Ua(t,n);const o=e.flatMap(t=>[t.offset,t.length,t.type,t.modifiers||0]);const s=_a(t,o);return{...t,decorations:s,diagnostics:n,visualDecorations:e}};const Va=async(t,n)=>{if(t instanceof Error&&t.message.includes("No diagnostic provider found")){return n}await Wa(t,"Failed to update diagnostics: ");return n};const ja=async t=>{try{const n=await Ya(t);if(!cs(t.id)){return t}return $a(t,n)}catch(n){return Va(n,t)}};const qa=async t=>{try{const n=await Ya(t);const e=cs(t.id);if(!e){return t}const o=await $a(e.newState,n);is(t.id,e.oldState,o);await ko("Editor.rerender",t.id);return o}catch(n){return Va(n,t)}};const Ga=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 Aa(i,r,c,x);const D=await Ma(v,t);const O=ba(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:us,fontFamily:c,fontSize:r,fontWeight:i,handleOffset:0,handleOffsetX:0,hasListener:false,height:d,id:u,incrementalEdits:as,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=ga(B,W,T,F,d,9);const H=ma(N,o);let z;if(S&&n){const t=S*C;z=await ii(H,t)}else{z=await ii(H,0)}const U=yi(z);const _={...z,decorations:U};const Y=ri();const{differences:$,textInfos:V}=await Qr(_,Y);const j={..._,differences:$,focus:ao,focused:true,textInfos:V};is(u,wa,j);await xa(Ea,L,u,E,o);const q=s?await qa(j):j;const G=await La("editor.completionsOnType");const X=Boolean(G);is(u,wa,{...q,completionsOnType:X})};const Xa=(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 Za=(t,n)=>{if(t.focus!==n.focus){return false}if(!n.focused){return true}if(!t.isSelecting&&n.isSelecting){return false}return t.focused===n.focused};const Ka=(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 Qa=6;const Ja=7;const td=11;const nd=12;const ed=13;const od=(t,n)=>t.widgets===n.widgets;const sd=[Ka,Za,Za,Xa,od];const cd=[nd,Qa,Ja,td,ed];const rd=(t,n)=>{const e=[];for(let o=0;o<sd.length;o++){const s=sd[o];if(!s(t,n)){e.push(cd[o])}}return e};const id=t=>{const{newState:n,oldState:e}=cs(t);const o=rd(e,n);return o};const ad=t=>{const n=Bs(t.id);if(!n){throw new Error("unsupported widget")}return n.add(t)};const dd=t=>{const n=Bs(t.id);if(!n){throw new Error("unsupported widget")}return n.render(t)};const ld=t=>{const n=Bs(t.id);if(!n){throw new Error("unsupported widget")}return n.remove(t)};const ud=(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=ad(t);if(n.length>0){d.push(...n)}}const l=[];for(const t of o){const n=dd(t);if(n.length>0){l.push(...n)}}const u=[];for(const t of s){const n=ld(t);if(n.length>0){u.push(...n)}}const f=[...d,...l,...u];return f.filter(t=>t[0]!=="Viewlet.setFocusContext")};const fd=async t=>{const n=cs(t)?.newState;if(!n){return[]}for(const t of n.widgets){if(t.id===Te){await Qo("ColorPicker.dispose",t.newState.uid)}}const e=ud(n,{widgets:[]});ns(t);return e};const hd=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 gd=t=>{const{selections:n}=t;const e=hd(n);return{...t,selections:e}};const md=(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 wd=t=>{const{lines:n,selections:e}=t;const o=md(e,n.length);return{...t,selections:o}};const pd=(t,n)=>{const e=[];for(const o of n){const n=Ur(t,o.startOffset);const s=Ur(t,o.endOffset);const c=Nr(t,{end:s,start:n});const r={deleted:c,end:s,inserted:Mi(o.inserted),origin:As,start:n};if(r.inserted.length===0){r.inserted=[""]}e.push(r)}return e};const yd=(...t)=>{console.warn(...t)};const Ed=(...t)=>{console.error(...t)};const xd=(t,n)=>{if(!Array.isArray(n)){yd("something is wrong with format on save",n);return t}if(n.length===0){return t}const e=pd(t,n);return la(t,e)};const Id=async(t,n)=>{h(t);m(n);return la(t,n)};const Sd=(t,n)=>{const e=[];for(const o of n){if(o.uri===t.uri){for(const n of o.edits){const o=Ur(t,n.offset);const s=Ur(t,n.offset+n.deleted);const c=Nr(t,{end:s,start:o});const r={deleted:c,end:s,inserted:[n.inserted],origin:Ts,start:o};e.push(r)}}}return e};const kd=async(t,n)=>{h(t);m(n);const e=Sd(t,n);if(e.length===0){return t}return la(t,e)};const vd=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]=Pi(n,r);const l={columnIndex:i,rowIndex:c};const u={columnIndex:d,rowIndex:a};const f={end:u,start:l};s.push({deleted:Nr(t,f),end:u,inserted:e,origin:o,start:l})}return s};const bd=(t,n,e)=>{const{selections:o}=t;return Cd(t,o,n,e)};const Md=()=>Math.random();const Ad=9;const Ld=async(t,n,e,o,s,c,r,i,a,d)=>{for(let l=n;l<t.length;l++){const n=await Oi(t.slice(0,l),s,c,r,i,a,d);if(o-n<e/2){return l}}return t.length};const Pd=()=>"Segmenter"in Intl;const Fd=()=>{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 Wd=async(t,n,e,o,s,c,r,i)=>{const a=Fd();const d=a.getSegments(t);const l=false;const u=0;for(const n of d){const a=await Oi(t.slice(0,n.index),s,c,r,i,l,u);if(o-a<e){return n.index}}return t.length};const Td=(t,n)=>{const e=Math.round(t/n);return e};const Rd=(t,n,e)=>{let o=n;for(let s=0;s<n;s++){if(t[s]===Mr){o-=e-1}}return o};const Dd=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=Td(a,r);const l=Lr(t);const u=Rd(t,d,i);const f=t.slice(0,u);const h=Ar(f,l,i);const m=await Oi(h,n,e,o,s,c,r);const y=Ti(t);if(y){if(Math.abs(a-m)<r/2){return u}return await Ld(t,u,r,a,n,e,o,s,c,r)}return await Wd(t,u,r,a,n,e,o,s)};const Od=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=Us(y,0,u.length-1);const I=u[x];const S=await Dd(I,a,i,r,l,d,o,m,E);return{columnIndex:S,rowIndex:x}};const Bd=(t,n,e)=>{const{columnWidth:o,x:s}=t;const c=e*o+s;return c};const Nd=(t,n)=>{const{rowHeight:e,y:o}=t;const s=(n+1)*e+o;return s};const Hd=(t,n,e,o,s)=>{h(t);g(n);g(e);w(o);const c=Bd(t,n,e);const r=Nd(t,n);const i=t.widgets.find(t=>t.id===Ad);const a=i?.newState.uid??Md();const d={message:o,uid:a,x:c,y:r};const l={id:Ad,newState:d};return{...t,widgets:[...t.widgets.filter(t=>t.id!==Ad),l]}};const zd=(t,n,e,o)=>Hd(t,n,e,o);const Ud=String;const _d=t=>{switch(t){case"(":return")";case"[":return"]";case"{":return"}";default:return"???"}};const Yd=async(t,n)=>{try{const e=$d(t);const o=await ko("ExtensionHostBraceCompletion.executeBraceCompletionProvider",t,e,n);if(o){const e=_d(n);const o=n+e;const s=bd(t,[o],bs);return la(t,s)}const s=bd(t,[n],bs);return la(t,s)}catch(n){console.error(n);const e=Array.isArray(t.cursor)?t.cursor[0]:t.cursor;return zd(t,e,Ud(n))}};const $d=t=>zr(t,t.selections[0],t.selections[1]);const Vd=t=>{const{selections:n}=t;if(n.length===4&&n[0]===n[2]&&n[1]===n[3]){return t}const e=Ui(4);Vi(e,0,n[0],n[1]);return da(t,e)};const jd=(t,n)=>{for(const[e,o]of t.entries()){if(o.id===n){return e}}return-1};const qd=(t,n)=>{const e=jd(t,n);const o=[...t.slice(0,e),...t.slice(e+1)];return o};const Gd=t=>t.id===We;const Xd=t=>{const{widgets:n}=t;const e=n.findIndex(Gd);if(e===-1){return t}const o=qd(n,We);return{...t,focused:true,widgets:o}};const Zd=t=>t.id===Oe;const Kd=t=>{const{widgets:n}=t;const e=n.findIndex(Zd);if(e===-1){return t}const o=qd(n,Oe);return{...t,focused:true,widgets:o}};const Qd=async()=>{const t="Rename Worker";const n="renameWorkerMain.js";const e=await Go(t,n);await e.invoke("Rename.initialize");return e};const Jd={};const tl=()=>{if(!Jd.workerPromise){Jd.workerPromise=Qd()}return Jd.workerPromise};const nl=async(t,...n)=>{const e=await tl();return await e.invoke(t,...n)};const el=t=>t.id===Ne;const ol=async t=>{const{uid:n,widgets:e}=t;const o=e.findIndex(el);if(o===-1){return t}const s=e[o];await nl("Rename.close",s.newState.uid);const c=cs(n);const{newState:r}=c;return r};const sl=t=>t.id===He;const cl=t=>{const{widgets:n}=t;const e=n.findIndex(sl);if(e===-1){return t}const o=qd(n,He);return{...t,widgets:o}};const rl=(t,n)=>{for(const e of t){if(e.id===n){return true}}return false};const il=async(t,n,e,o,s,c)=>{const{widgets:r}=e;if(rl(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:ao,focused:u,widgets:l};return f};const al=()=>{const t=Md();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 dl=(t,n)=>Jo(t,n);const ll=async t=>{const n=true;return il(Te,ds,t,al,dl,n)};const ul=t=>{const{widgets:n}=t;if(n.every(t=>t.id!==Te)){return t}return{...t,additionalFocus:0,focus:ao,focused:true,widgets:qd(n,Te)}};const fl={compositionText:"",isComposing:false};const hl=(t,n)=>{fl.isComposing=true;return t};const gl=(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-fl.compositionText.length;e.push({deleted:[fl.compositionText],end:{columnIndex:i,rowIndex:r},inserted:[n],origin:ys,start:{columnIndex:a,rowIndex:s}})}return e};const ml=(t,n)=>{const{selections:e}=t;const o=gl(e,n);fl.compositionText=n;return la(t,o)};const wl=(t,n)=>{const{selections:e}=t;const o=gl(e,n);fl.isComposing=false;fl.compositionText="";return la(t,o)};const pl=async t=>{try{w(t);await Wo(t)}catch(t){throw new k(t,"Failed to write text to clipboard")}};const yl=(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 El=(t,n,e,o)=>t===e&&n===o;const xl=async t=>{if(!ha(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=El(o,s,c,r);const a=yl(n,i,o,s,c,r);const d=Nr(t,a);const l=Wr(d);const u=i?"\n"+l:l;await pl(u);return t};const Il=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:[Or(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 la(t,s,c)};const Sl=t=>{const{selections:n}=t;const e=n[0];const o={columnIndex:0,rowIndex:e};const s=[{deleted:[""],end:o,inserted:[Or(t,e),""],start:o}];return la(t,s)};const kl=(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 vl=(t,n,e,o)=>{t[n]=e;t[n+1]=o};const Cl=(t,n,e,o)=>{t[n]=t[n+2]=e;t[n+1]=t[n+3]=o};const bl=(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 Ml=(t,n,e)=>{const o=new Uint32Array(t.length);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=Pi(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{bl(o,s,c,r,n,e);bl(o,s+2,c,r,n,e)}}else{Cl(o,s,t[s],t[s+1])}}return o};const Al=(t,n)=>{const{lines:e,selections:o}=t;const s=Ml(o,e,n);return da(t,s)};const Ll=(t,n)=>{if(!Pd()){return 1}if(n>t.length){return 1}const e=Fd();const o=e.at(t,n-1);if(!o){return 1}return n-o.index};const Pl=()=>2;const Fl=(t,n)=>{if(!Pd()){return 1}const e=Fd();const o=e.at(t,n);return o.segment.length};const Wl=t=>t===br||t===Mr;const Tl=(t,n)=>{if(t.length===0){return 0}for(let e=0;e<n;e++){if(!Wl(t[e])){return n-e}}return n};const Rl=(t,n)=>t.length-n;const Dl=(t,n)=>{for(const e of n){const n=t.match(e);if(n){return n[0].length}}return 1};const Ol=/(?<![A-Z])[A-Z]+\s*$/;const Bl=/[\u{C0}-\u{17F}\w\-]+>?\s*$/u;const Nl=/[a-zA-Z]+[^a-zA-Z\d]+\s*$/;const Hl=/\s+$/;const zl=/[^a-zA-Z\d]+\s*$/;const Ul=[Ol,Bl,Nl,Hl,zl];const _l=(t,n)=>{const e=t.slice(0,n);return Dl(e,Ul)};const Yl=/^\s*[\u{C0}-\u{17F}\w]+/iu;const $l=/^[^a-zA-Z\d]+\w*/;const Vl=[Yl,$l];const jl=(t,n)=>{const e=t.slice(n);return Dl(e,Vl)};const ql=/(?<![A-Z])[A-Z]{2}[a-z]+$/;const Gl=/(?=[A-Z]+)[A-Z][a-z]+$/;const Xl=/[A-Z]+[a-z]+\d?\s*$/;const Zl=/[A-Z]+\d*\s*$/;const Kl=/[a-z]+\d*\s*$/;const Ql=/[A-Z]*[a-z]+_+\s*$/;const Jl=/(?<![A-Z])[A-Z]_+\s*$/;const tu=/[a-z]+\s*$/;const nu=/[^a-zA-Z\d\s]+\s*$/;const eu=[ql,Gl,Xl,Zl,Kl,Ql,Jl,tu,nu];const ou=(t,n)=>{const e=t.slice(0,n);return Dl(e,eu)};const su=/^\s*[a-z]+\d?/;const cu=/^\s*[A-Z]{2}[a-z\d]+/;const ru=/^\s*[A-Z]+(?=[A-Z][a-z]+)/;const iu=/^\s*[A-Z]+[a-z]*\d*/;const au=/^\s*_+[a-z]*\d?/;const du=/^\s*[^\da-zA-Z\s]+/;const lu=[su,ru,iu,au,du];const uu=[su,cu,ru,iu,au,du];const fu=/[A-Z]/;const hu=(t,n)=>{const e=t.slice(n);if(fu.test(t[n-1])){return Dl(e,lu)}return Dl(e,uu)};const gu=t=>Al(t,Ll);const mu=(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 wu=(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 pu=(t,n,e)=>{const o=new Uint32Array(t.length);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=Pi(t,s);if(c===i&&r===a){wu(o,s,c,r,n,e)}else{o[s]=o[s+2]=i;o[s+1]=o[s+3]=a}}return o};const yu=(t,n)=>{const{lines:e,selections:o}=t;const s=pu(o,e,n);return da(t,s)};const Eu=t=>yu(t,Fl);const xu=(t,n,e,o,s,c)=>{Vi(t,n,s+1,c)};const Iu=t=>Yi(t,xu);const Su=t=>{const{selections:n}=t;const e=Iu(n);return da(t,e)};const ku=t=>yu(t,Rl);const vu=t=>Al(t,Tl);const Cu=(t,n,e)=>{h(t);g(n);g(e);const o=zi(n,e,n,e);return da(t,o)};const bu=(t,n,e,o,s,c)=>{if(e===0){Vi(t,n,0,0)}else{Vi(t,n,e-1,o)}};const Mu=t=>Yi(t,bu);const Au=(t,n,e,o)=>{const{selections:s}=t;const c=Mu(s);return da(t,c)};const Lu=t=>Au(t);const Pu=t=>Al(t,_l);const Fu=t=>Al(t,ou);const Wu=t=>yu(t,hu);const Tu=t=>yu(t,jl);const Ru=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]=Pi(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,[""],ks);await pl(Wr(i));return la(t,a,r)};const Du=async t=>{const n=bd(t,[""],ks);const e=n.map(t=>Wr(t.deleted)).filter(t=>t.length>0);const o=Wr(e);await pl(o);return la(t,n)};const Ou=async t=>{const{selections:n}=t;if(Xi(n)){return Ru(t)}return Du(t)};const Bu=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:Nr(t,{end:c,start:s}),end:c,inserted:[""],origin:xs,start:s}];return la(t,r)};const Nu=(t,n,e)=>{const o=[];const s=(n,s,c,r)=>{const i=kl(n,s,t,e);const a={columnIndex:r,rowIndex:c};o.push({deleted:Nr({lines:t},{end:a,start:i}),end:a,inserted:[""],origin:Ss,start:i})};$i(n,s);return o};const Hu=(t,n,e,o,s)=>{if(!ji(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 zu=(t,n)=>{for(let e=0;e<n.length;e+=4){const[o,s,c,r]=Pi(n,e);if(!Hu(t,o,s,c,r)){return false}}return true};const Uu=t=>{const{lines:n,selections:e}=t;for(let t=0;t<e.length;t+=4){e[t+1]++;e[t+3]++}const o=Nu(n,e,Pl);return la(t,o)};const _u=(t,n)=>{const{autoClosingRanges:e=[],lines:o,selections:s}=t;if(zu(e,s)){return Uu(t)}if(Xi(s)){const e=Nu(o,s,n);return la(t,e)}const c=bd(t,[""],Ss);return la(t,c)};const Yu=t=>_u(t,Tl);const $u=(t,n)=>{const{selections:e}=t;if(Xi(e)){const o=[];const{lines:s}=t;for(let c=0;c<e.length;c+=4){const[r,i]=Pi(e,c);const a={columnIndex:i,rowIndex:r};const d=mu(a,s,n);o.push({deleted:Nr(t,{end:d,start:a}),end:d,inserted:[""],origin:Is,start:a})}return o}const o=bd(t,[""],Is);return o};const Vu=(t,n)=>{const e=$u(t,n);return la(t,e)};const ju=t=>Vu(t,Rl);const qu=t=>{const n=_u(t,Ll);return n};const Gu=t=>Vu(t,Fl);const Xu=t=>{const n=_u(t,_l);return n};const Zu=t=>{const n=_u(t,ou);return n};const Ku=t=>Vu(t,hu);const Qu=t=>Vu(t,jl);const Ju=async t=>{await ko("SideBar.show","References",true);return t};const tf=async t=>{const n={documentId:t.id||t.uid,languageId:t.languageId,text:Br(t),uri:t.uri};return mo("Extensions.executeFormattingProvider",n)};const nf="Failed to execute formatting provider: FormattingError:";const ef=t=>t&&t instanceof Error&&t.message.startsWith(nf);const of="Failed to execute formatting provider: FormattingError:";const sf=async t=>{try{const n=await tf(t);return xd(t,n)}catch(n){if(ef(n)){console.error("Formatting Error:",n.message.slice(of.length));return t}console.error(n);const e=String(n);await Hd(t,0,0,e);return t}};const cf=/^[\w\-]+/;const rf=/[\w\-]+$/;const af=(t,n)=>{const e=t.slice(0,n);const o=e.match(rf);const s=t.slice(n);const c=s.match(cf);let r=vr;if(o){r+=o[0]}if(c){r+=c[0]}return{word:r}};const df=(t,n)=>{const e=t.slice(0,n);const o=e.match(rf);if(o){return o[0]}return vr};const lf=(t,n,e)=>{const{lines:o}=t;const s=o[n];return af(s,e)};const uf=(t,n,e)=>{const{lines:o}=t;const s=o[n];return df(s,e)};const ff=async(t,n)=>{const e=await ko("ExtensionHostDefinition.executeDefinitionProvider",t,n);return e};const hf={};const gf=/\{(PH\d+)\}/g;const mf=(t,n=hf)=>{if(n===hf){return t}const e=(t,e)=>n[e];return t.replaceAll(gf,e)};const wf="Copy";const pf="Cut";const yf="Editor: Close Color Picker";const Ef="Editor: Copy Line Down";const xf="Editor: Copy Line Up";const If="Editor: Format Document (forced)";const Sf="Editor: Go To Definition";const kf="Editor: Go To Type Definition";const vf="Editor: Indent";const Cf="Editor: Open Color Picker";const bf="Editor: Select All Occurrences";const Mf="Editor: Select Down";const Af="Editor: Select Inside String";const Lf="Editor: Select Next Occurrence";const Pf="Editor: Select Up";const Ff="Show Hover";const Wf="Editor: Sort Lines Ascending";const Tf="Editor: Toggle Comment";const Rf="Editor: Unindent";const Df="Enter Code";const Of="Escape to close";const Bf="Find All Implementations";const Nf="Find All References";const Hf="Format Document";const zf="Go to Definition";const Uf="Go to Type Definition";const _f="Move Line Down";const Yf="Move Line Up";const $f="No definition found";const Vf="No definition found for '{PH1}'";const jf="No type definition found";const qf="No type definition found for '{PH1}'";const Gf="Paste";const Xf="Source Action";const Zf="Toggle Block Comment";const Kf=()=>mf(zf);const Qf=()=>mf($f);const Jf=t=>mf(Vf,{PH1:t});const th=t=>mf(qf,{PH1:t});const nh=()=>mf(jf);const eh=()=>mf(Xf);const oh=()=>mf(Of);const sh=()=>mf(Df);const ch=()=>mf(Uf);const rh=()=>mf(Nf);const ih=()=>mf(Bf);const ah=()=>mf(pf);const dh=()=>mf(wf);const lh=()=>mf(Gf);const uh=()=>mf(Zf);const fh=()=>mf(Yf);const hh=()=>mf(_f);const gh=()=>mf(Hf);const mh=()=>mf(Ff);const wh=()=>mf(If);const ph=()=>mf(Lf);const yh=()=>mf(bf);const Eh=()=>mf(Sf);const xh=()=>mf(kf);const Ih=()=>mf(Af);const Sh=()=>mf(vf);const kh=()=>mf(Rf);const vh=()=>mf(Wf);const Ch=()=>mf(Tf);const bh=()=>mf(Pf);const Mh=()=>mf(Mf);const Ah=()=>mf(Cf);const Lh=()=>mf(yf);const Ph=()=>mf(Ef);const Fh=()=>mf(xf);const Wh=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=lf(t,r,i);const e=o(n);return Hd(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=Ur(t,n.startOffset);const o=new Uint32Array([e.rowIndex,e.columnIndex,e.rowIndex,e.columnIndex]);return da(t,o)}const c={endColumnIndex:n.endColumnIndex,endRowIndex:n.endRowIndex,startColumnIndex:n.startColumnIndex,startRowIndex:n.startRowIndex};await No(s,true,c);return t}catch(e){if(s(e)){const o=n(e);await Hd(t,r,i,o);return t}const o=n(e);await Hd(t,r,i,o);return t}};const Th=async(t,n,e)=>{const o=zr(t,n,e);const s=await ff(t,o);return s};const Rh=t=>{if(t.word){return Jf(t.word)}return Qf()};const Dh=String;const Oh=t=>t?.message?.startsWith("Failed to execute definition provider: No definition provider found");const Bh=async t=>Wh({editor:t,getErrorMessage:Dh,getLocation:Th,getNoLocationFoundMessage:Rh,isNoProviderFoundError:Oh});const Nh=t=>{if(t.word){return th(t.word)}return nh()};const Hh=async(t,n)=>{const e=await ko("ExtensionHostTypeDefinition.executeTypeDefinitionProvider",t,n);return e};const zh=async(t,n,e)=>{const o=zr(t,n,e);const s=await Hh(t,o);return s};const Uh=String;const _h=t=>t?.message?.startsWith("Failed to execute type definition provider: No type definition provider found");const Yh=async(t,n=true)=>Wh({editor:t,getErrorMessage:Uh,getLocation:zh,getNoLocationFoundMessage:Nh,isNoProviderFoundError:_h});const $h=t=>{switch(t){case Oe:return true;default:return false}};const Vh=t=>{if(t.length===0){return t}return t.filter($h)};const jh=async(t,n)=>{await xo(t,n)};const qh=async(t,n)=>{const{platform:e}=t;const{columnIndex:o,rowIndex:s}=n;const c=zr(t,s,o);const r=Ei(t,c);if(r){await jh(r,e);return t}const i={...t,selections:new Uint32Array([s,o,s,o])};const a=await Bh(i);return a};const Gh=async(t,n)=>{const{selections:e}=t;for(let o=0;o<e.length;o+=4){const[s,c,r,i]=Pi(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 da(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 da(t,o)};const Xh=1;const Zh=2;const Kh=(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 Qh=t=>{switch(t){case Zh:return qh;case Xh:return Gh;default:return Kh}};const Jh=async(t,n,e,o)=>{h(t);g(n);g(e);g(o);const s=Qh(n);const c=await s(t,{columnIndex:o,rowIndex:e});return c};const tg=3;const ng=async(t,n,e,o)=>{const{uid:s}=t;await bo(s,tg,e,o,{menuId:tg});return t};const eg=/^[a-zA-Z\u{C0}-\u{17F}\d]+/u;const og=/[a-zA-Z\u{C0}-\u{17F}\d]+$/u;const sg=(t,n,e)=>{const o=t.slice(0,e);const s=t.slice(e);const c=o.match(og);const r=s.match(eg);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 cg=(t,n,e)=>{const o=Or(t,n);const s=sg(o,n,e);return da(t,s)};const rg=async(t,n,e,o)=>{const s=await Od(t,e,o);return cg(t,s.rowIndex,s.columnIndex)};const ig=t=>{if(t.focused&&t.focus===ao){return t}return{...t,additionalFocus:0,focus:ao,focused:true}};const ag=4;const dg=(t,n)=>t[n+2]===Zs;const lg=(t,n,e)=>{const{decorations:o}=t;for(let t=0;t<o.length;t+=ag){if(dg(o,t)){return o[t]===n&&o[t+1]===e}}return false};const ug=t=>{const{decorations:n}=t;const e=[];for(let t=0;t<n.length;t+=ag){if(!dg(n,t)){e.push(n[t],n[t+1],n[t+2],n[t+3])}}if(e.length===n.length){return t}return{...t,decorations:e}};const fg=(t,n,e)=>{if(lg(t,n,e)){return t}const o=ug(t);return{...o,decorations:[...o.decorations,n,e,Zs,0]}};const hg="Alt";const gg=(t,n)=>{if(n!==hg){return t}return ug(t)};const mg=1;const wg=2;const pg=3;const yg=(t,n)=>{if(t){return Zh}if(n){return Xh}return 0};const Eg=async(t,n,e,o)=>{h(t);g(n);g(e);g(o);const s=await Od(t,e,o);return Jh(t,n,s.rowIndex,s.columnIndex)};const xg=(t,n)=>new Uint32Array([n,0,n,t.length]);const Ig=t=>{const{selections:n}=t;const e=n[t.primarySelectionIndex];const o=Or(t,e);const s=xg(o,e);return da(t,s)};const Sg=(t,n,e,o)=>{h(t);g(e);g(o);return Ig(t)};const kg=0;const vg=async(t,n,e,o,s,c,r)=>{if(n!==kg){return t}const i=yg(e,o);let a;switch(r){case wg:a=await rg(t,i,s,c);break;case mg:a=await Eg(t,i,s,c);break;case pg:a=Sg(t,i,s,c);break;default:return t}return{...a,isSelecting:true}};const Cg={editor:undefined,timeout:-1,x:0,y:0};const bg=()=>Cg;const Mg=(t,n,e,o)=>{Cg.editor=t;Cg.timeout=n;Cg.x=e;Cg.y=o};const Ag=/[a-zA-Z\d]/;const Lg=t=>Ag.test(t);const Pg=t=>Lg(t)||t==="_";const Fg=(t,n)=>{for(let e=n-1;e>=0;e--){if(!Pg(t[e])){return e+1}}return 0};const Wg=(t,n)=>{for(let e=n;e<t.length;e++){if(!Pg(t[e])){return e}}return t.length};const Tg=(t,n,e)=>{const o=t[n];const s=Fg(o,e);const c=Wg(o,e);const r=o.slice(s,c);return{end:c,start:s,word:r}};const Rg=t=>t instanceof Error&&t.message.startsWith("Failed to execute definition provider: No definition provider found");const Dg=async(t,n,e)=>{h(t);g(n);g(e);const o=await Od(t,n,e);const s=Tg(t.lines,o.rowIndex,o.columnIndex);if(!s.word){return ug(t)}const c=zr(t,o.rowIndex,s.start);const r=s.end-s.start;if(lg(t,c,r)){return t}const i=zr(t,o.rowIndex,o.columnIndex);try{const n=await ff(t,i);if(!n){return ug(t)}return fg(t,c,r)}catch(n){if(Rg(n)){return ug(t)}throw n}};const Og=async(t,n)=>{};const Bg=async()=>{const{editor:t,x:n,y:e}=bg();await Od(t,n,e);await Og()};const Ng=300;const Hg=async(t,n,e,o)=>{if(o){return Dg(t,n,e)}const s=ug(t);if(!s.hoverEnabled){return s}const c=bg();if(c.timeout!==-1){clearTimeout(c.timeout)}const r=setTimeout(Bg,Ng);Mg(s,r,n,e);return s};const zg=(t,n)=>new Uint32Array([n.startRowIndex,n.startColumnIndex,n.endRowIndex,n.endColumnIndex]);const Ug=(t,n,e)=>{const o=zg(t,e);const s={end:{columnIndex:o[3],rowIndex:o[2]},start:{columnIndex:o[1],rowIndex:o[0]}};const c=[{deleted:Nr(t,s),end:s.end,inserted:[n],origin:Es,start:s.start}];return c};const _g=(t,n,e)=>{const o=Ug(t,n,e);return la(t,o)};const Yg=(t,n)=>{const e=zg(t,n);return da(t,e)};const $g=t=>({...t,hasListener:false,isSelecting:false,selectionAutoMovePosition:{columnIndex:0,rowIndex:0}});const Vg=async(t,n,e,o,s,c,r)=>t;const jg=(t,n)=>t;const qg=async(t,n,e)=>{await Od(t,n,e)};const Gg=t=>{globalThis.requestAnimationFrame(t)};const Xg=(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 Zg=(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 Kg=async(t,n)=>{let e=n;if(Zg(t,n)){const t=ri();const{differences:o,textInfos:s}=await Qr(n,t);e={...n,differences:o,textInfos:s}}if(!Xg(t,n)){return e}const{cursorInfos:o,selectionInfos:s}=await na(e);return{...e,cursorInfos:o,selectionInfos:s}};const Qg=-1;const Jg=0;const tm=1;const nm=(t,n)=>{if(t.rowIndex>n.rowIndex){return tm}if(t.rowIndex===n.rowIndex){if(t.columnIndex>n.columnIndex){return tm}if(t.columnIndex<n.columnIndex){return Qg}return Jg}return Qg};const em=(t,n)=>new Uint32Array([t.rowIndex,t.columnIndex,n.rowIndex,n.columnIndex]);const om=(t,n)=>new Uint32Array([n.rowIndex,n.columnIndex,n.rowIndex,n.columnIndex]);const sm=(t,n)=>new Uint32Array([t.rowIndex,t.columnIndex,n.rowIndex,n.columnIndex]);const cm=(t,n)=>{switch(nm(n,t)){case Jg:return om(t,n);case tm:return sm(t,n);case Qg:return em(t,n);default:throw new Error("unexpected comparison result")}};const rm=(t,n)=>{const e=t.selectionAnchorPosition;const o=cm(e,n);return da(t,o)};const im=(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 am=async t=>{const n=cs(t);const e=n?.newState;if(!e||!e.hasListener||!e.isSelecting){return}const o=e.selectionAutoMovePosition;if(o.rowIndex===0){return}const s=im(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 Kg(e,r);is(e.uid,e,i);Gg(()=>am(t))};const dm=async(t,n,e)=>{h(t);g(n);g(e);const o=await Od(t,n,e);const s=rm(t,o);if(!t.hasListener&&(o.rowIndex<t.minLineY||o.rowIndex>t.maxLineY)){Gg(()=>am(t.uid));return{...s,hasListener:true,selectionAutoMovePosition:o}}return s};const lm=async(t,n,e,o)=>{if(!t.isSelecting){return t}if(o){return qg(t,n,e)}return dm(t,n,e)};const um=t=>({...t,hasListener:false,isSelecting:false,selectionAutoMovePosition:{columnIndex:0,rowIndex:0}});const fm=(t,n,e)=>{if(e<=0){return 0}if(e<=t-n/2){return e/(t-n)}return 1};const hm=(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=Us(n,c,c+s);const a=i-c-e;const d=ei(s,o);const l=o-s+r;const u=fm(s,d,a);const f=Us(u,0,1);const h=f*l;return{...t,deltaX:h}};const gm=(t,n)=>{const{deltaX:e,longestLineWidth:o,width:s,x:c}=t;const r=n-c;const i=ei(s,o);const a=s-i;const d=Jr(e,a,s,i);const l=r-d;if(l>=0&&l<i){return{...t,handleOffsetX:l}}const{handleOffset:u,percent:f}=oi(s,i,r);const h=f*a;return{...t,deltaX:h,handleOffsetX:u}};const mm=(t,n)=>{const{height:e,scrollBarHeight:o}=t;if(n<=e-o/2){return n/(e-o)}return 1};const wm=async(t,n)=>{const{finalDeltaY:e,handleOffset:o=0,y:s}=t;const c=n-s-o;const r=mm(t,c);const i=r*e;const a=await ca(t,i);return a};const pm=wm;const ym=async(t,n)=>{const{deltaY:e,finalDeltaY:o,height:s,scrollBarHeight:c,y:r}=t;const i=n-r;const a=ti(e,o,s,c);const d=i-a;if(d>=0&&d<c){return{...t,handleOffset:d}}const{handleOffset:l,percent:u}=oi(s,c,i);const f=u*o;const h=await ca(t,f);return{...h,handleOffset:l}};const Em=(t,n)=>{};const xm={deltaY:0,touchOffsetY:0};const Im=(t,n)=>{if(n.touches.length===0){return}const e=n.touches[0];xm.touchOffsetY=e.y;xm.deltaY=t.deltaY};const Sm=(t,n)=>ra(t,n);const km=(t,n)=>ca(t,n);const vm=(t,n,e,o)=>{g(n);g(e);g(o);const{deltaX:s}=t;if(e===0){return Sm(t,o)}const c=Us(s+e,0,Infinity);return{...Sm(t,o),deltaX:c}};const Cm=(t,n)=>{if(n.touches.length===0){return}const e=n.touches[0];const o=xm.deltaY+(xm.touchOffsetY-e.y);km(t,o)};const bm=(t,n,e,o)=>vm(t,n,e,o);const Mm=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:Ls,start:{columnIndex:0,rowIndex:t}})}return n};const Am=t=>{const{selections:n}=t;const e=Mm(n);return la(t,e)};const Lm=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:Ps,start:{columnIndex:0,rowIndex:t}}));return e};const Pm=t=>{const{selections:n}=t;const e=Lm(n);return la(t,e)};const Fm=async t=>ko("Languages.getLanguageConfiguration",{languageId:t.languageId,uri:t.uri});const Wm=t=>{if(t?.indentationRules?.increaseIndentPattern&&typeof t.indentationRules.increaseIndentPattern==="string"){const n=new RegExp(t.indentationRules.increaseIndentPattern);return n}return undefined};const Tm=(t,n)=>{if(!n){return false}return n.test(t)};const Rm=(t,n,e)=>{const o=[];const s=[];const c=Wm(e);for(let e=0;e<n.length;e+=4){const[r,i,a,d]=Pi(n,e);const l={columnIndex:i,rowIndex:r};const u={columnIndex:d,rowIndex:a};const f={end:u,start:l};if(ji(r,i,a,d)){const n=t[r];const e=n.slice(0,i);const a=Rr(e);if(Tm(e,c)){o.push({deleted:Nr({lines:t},f),end:u,inserted:["",a+" ",a],origin:Fs,start:l});s.push(r+1,a.length+2,r+1,a.length+2)}else{o.push({deleted:Nr({lines:t},f),end:u,inserted:["",a],origin:Fs,start:l});s.push(r+1,a.length,r+1,a.length)}}else{o.push({deleted:Nr({lines:t},f),end:u,inserted:["",""],origin:Fs,start:l});s.push(r+1,0,r+1,0)}}return{changes:o,selectionChanges:new Uint32Array(s)}};const Dm=async t=>{const{lines:n,selections:e}=t;const o=await Fm(t);const{changes:s,selectionChanges:c}=Rm(n,e,o);return la(t,s,c)};const Om=2;const Bm=0;const Nm=()=>{const t=Md();const n={id:We,newState:{focused:true,focusSource:Om,height:0,questions:[],uid:t,width:0,x:0,y:0},oldState:{focused:false,focusSource:Bm,height:0,questions:[],uid:t,width:0,x:0,y:0}};return n};const Hm=async t=>{const n={...t,height:45,width:150,x:100,y:100};return n};const zm=async t=>{const n=true;return il(We,ws,t,Nm,Hm,n)};const Um=()=>{const t=Md();const n={id:Re,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:_m,setFactory:Ym}=$o(Ge);const $m=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=cs(n);const{languageId:a}=i;await _m("Completions.create",o,c,r,s,e,n,a);await _m("Completions.loadContent",o);const d=await _m("Completions.diff2",o);const l=await _m("Completions.render2",o,d);return{...t,commands:l}};const Vm=async t=>{const n=false;return il(Re,ls,t,Um,$m,n)};const jm=()=>{const t=Md();const n={id:Oe,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 qm=async()=>{const t="Find Widget Worker";const n="findWidgetWorkerMain.js";return Go(t,n)};const Gm=9002;const Xm=async()=>{if(_n(Gm)){return}const t=await qm();Un(Gm,t)};const Zm=async(t,...n)=>{const e=_n(Gm);return await e.invoke(t,...n)};const Km=async()=>{const t=_n(Gm);Yn(Gm);if(t){await t.dispose()}};const Qm=t=>{const n=cs(t);if(!n){throw new Error(`editor ${t} not found`)}const{newState:e}=n;return e};const Jm=async(t,n)=>{const{uid:e}=t;const o=Qm(n);const{height:s,width:c,x:r,y:i}=o;await Xm();await Zm("FindWidget.create",e,r,i,c,s,n);await Zm("FindWidget.loadContent",e);const a=await Zm("FindWidget.diff2",e);const d=await Zm("FindWidget.render2",e,a);return{...t,commands:d}};const tw=(t,n)=>Jm(t,n);const nw=async t=>{const n=true;return il(Oe,fs,t,jm,tw,n)};const ew=async t=>nw(t);const ow=t=>{const{selections:n}=t;const e=n[0];const o=n[1];const s=Bd(t,e,o);const c=Nd(t,e);return{columnIndex:o,rowIndex:e,x:s,y:c}};const sw=()=>{const t=Md();const n={id:Ne,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 cw=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=cs(n);const{languageId:a}=i;await nl("Rename.create",o,c,r,s,e,n,a);await nl("Rename.loadContent",o);const d=await nl("Rename.diff2",o);const l=await nl("Rename.render2",o,d);return{...t,commands:l}};const rw=async t=>{const{columnIndex:n,rowIndex:e}=ow(t);const{word:o}=lf(t,e,n);if(!o){return t}const s=true;return il(Ne,gs,t,sw,cw,s)};const iw=async t=>{const n=await Oa({args:[],editor:t,event:"onLanguage",method:"ExtensionHostOrganizeImports.execute"});return n};const aw=async t=>{const n=await iw(t);return xd(t,n)};const dw=(t,n)=>{const e=Mi(n);const o=bd(t,e,vs);return la(t,o)};const lw=async t=>{const n=await To();w(n);return dw(t,n)};const uw=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 ua(o,e)};const fw=async t=>t;const hw=t=>t.startsWith("untitled:");const gw=async(t,n)=>{await ko("FileSystem.writeFile",t,n)};const mw=async t=>{const n="Save File";const{canceled:e,filePath:o}=await yo("Open.showSaveDialog",n,[],t);if(e){return""}return o};const ww=async(t,n,e)=>{const o=await mw(e);if(!o){return}await ko("FileSystem.writeFile",o,n);await Po();await ko("Main.handleUriChange",t,o);return o};const pw=t=>{const n="code"in t?t.code:undefined;return n==="EACCES"||t.message.includes("EACCES:")};const yw=async t=>{if(pw(t)){await ko("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 ko("ElectronDialog.showMessageBox",{buttons:["OK"],defaultId:0,detail:t.message,message:"Saving the file failed.",title:"Failed to Save File",type:"error"})};const Ew=async t=>{try{const{platform:n,uri:e}=t;const o=await fw(t);const s=Br(o);if(hw(e)){const t=await ww(e,s,n);if(t){return{...o,modified:false,uri:t}}return o}await gw(e,s);return{...o,modified:false}}catch(n){const e=new k(n,`Failed to save file "${t.uri}"`);await Wa(e);if(t.platform===qe){try{await yw(e)}catch(t){await Wa(t)}}return t}};const xw=t=>{const{lines:n}=t;const e=0;const o=0;const s=n.length-1;const c=n.at(-1).length;const r=zi(e,o,s,c);return da(t,r)};const Iw=(t,n,e)=>{const o=_i(t);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=Pi(t,s);bl(o,s+2,c,r,n,e);vl(o,s,i,a)}return o};const Sw=(t,n)=>{const{lines:e,selections:o}=t;const s=Iw(o,e,n);return da(t,s)};const kw=t=>{Sw(t,Tl)};const vw=(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 Cw=(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 bw=(t,n)=>{const e=[];for(let o=0;o<t.length-n.length+1;o){if(vw(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 Mw=(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=Tg(t,c,r);if(e.start===e.end){return n}const o=Cw(t,e.word);return o}const e=t[o];const i=e.slice(s,r);const a=Cw(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=bw(t,i);return a};const Aw=t=>{const{lines:n,selections:e}=t;const o=Mw(n,e);return da(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]=Pi(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 Pw=(t,n)=>{const{lines:e}=t;const{selections:o}=t;const s=Lw(o,e,n);return da(t,s)};const Fw=t=>Pw(t,Rl);const Ww=t=>Sw(t,Ll);const Tw=t=>Pw(t,Fl);const Rw=(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]=Pi(n,t);o[t]=s;o[t+1]=c;o[t+2]=Math.min(r+1,e);o[t+3]=i}return o};const Dw=t=>{const{lines:n,selections:e}=t;const o=Rw(n,e);return da(t,o)};const Ow=(t,n)=>{const e=new Uint32Array(n.length);for(let o=0;o<n.length;o+=4){const[s,c,r,i]=Pi(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]!==kr){r--}r++;while(a<d.length&&d[a]!==kr){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 Bw=t=>{const{selections:n}=t;const{lines:e}=t;const o=Ow(e,n);return da(t,o)};const Nw=async(t,n)=>{const e=await ko("ExtensionHostSelection.executeGrowSelection",t,n);if(e.length===0){return n}return new Uint32Array(e)};const Hw=async t=>{const{selections:n}=t;const e=await Nw(t,n);return da(t,e)};const zw=(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 Uw=t=>{const{lines:n}=t;const{selections:e}=t;if(Xi(e)){const t=new Uint32Array(e.length);for(let o=0;o<e.length;o+=4){const[s,c,r,i]=Pi(e,o);const a=Tg(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(Zi(t.selections)){return zw(t.lines,t.selections)}return undefined};const _w=(t,n,e,o)=>e>=t&&o<=n;const Yw=t=>{const n=Uw(t);if(!n){return t}const{revealRange:e,selectionEdits:o}=n;const s=o[e];const c=o[e+2];if(_w(t.minLineY,t.maxLineY,s,c)){return da(t,o)}return la(t,[],o)};const $w=t=>t;const Vw=(t,n)=>{const e=new Uint32Array(n.length);for(let t=0;t<n.length;t+=4){const[o,s,c,r]=Pi(n,t);e[t]=Math.max(o-1,0);e[t+1]=s;e[t+2]=c;e[t+3]=r}return e};const jw=t=>{const{lines:n,selections:e}=t;const o=Vw(n,e);return da(t,o)};const qw=t=>Sw(t,_l);const Gw=t=>Pw(t,jl);const Xw=(t,n,e)=>{if(t.decorations.length===0&&n.length===0){return t}return{...t,decorations:n,diagnostics:e}};const Zw=async(t,n,e)=>{const{tokenizerId:o}=t;or(n,e);await lr(n,e);const s=ur(n);const c=o+1;hr(c,s);const r=Qm(t.uid);if(!r){return t}const i=ri();const{differences:a,textInfos:d}=await Qr(t,i);const l=Qm(t.uid);if(!l){return t}const u={...l,differences:a,focused:true,textInfos:d};return{...u,invalidStartIndex:0,languageId:n,tokenizerId:c}};const Kw=(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 Qw=(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:Nr(t,{end:c,start:s}),end:c,inserted:Mi(n),origin:bs,start:s}];return la(t,r)};const Jw=()=>{const t=Md();const n={id:Be,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 tp=async()=>{const t="Hover Worker";const n="hoverWorkerMain.js";const e="Hover.initialize";const o=await Go(t,n,e);return o};const np={};const ep=()=>{if(!np.workerPromise){np.workerPromise=tp()}return np.workerPromise};const op=async(t,...n)=>{const e=await ep();return await e.invoke(t,...n)};const sp=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=cs(n);const{languageId:a}=i;await op("Hover.create",o,c,r,s,e,n,a);await op("Hover.loadContent",o);const d=await op("Hover.diff2",o);const l=await op("Hover.render2",o,d);return{...t,commands:l}};const cp=async t=>{const n=false;return il(Be,hs,t,Jw,sp,n)};const rp="EditorHover";const ip=async t=>{await ko("Viewlet.openWidget",rp);return t};const ap=()=>{const t=Md();const n={id:He,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 dp=async()=>{const t="Source Action Worker";const n="sourceActionWorkerMain.js";const e="SourceActions.initialize";const o=await Go(t,n,e);return o};const lp={};const up=()=>{if(!lp.workerPromise){lp.workerPromise=dp()}return lp.workerPromise};const fp=async(t,...n)=>{const e=await up();return await e.invoke(t,...n)};const hp=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=cs(n);const{languageId:a}=i;await fp("SourceActions.create",o,c,r,s,e,n,a);await fp("SourceActions.loadContent",o);const d=await fp("SourceActions.diff2",o);const l=await fp("SourceActions.render2",o,d);return{...t,commands:l}};const gp=async t=>il(He,ms,t,ap,hp);const mp=(t,n)=>t.localeCompare(n);const wp=t=>{const n=[...t];n.sort(mp);return n};const pp="sort-lines-ascending";const yp=(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=wp(h);s.push({deleted:Nr({lines:t},f),end:u,inserted:g,origin:pp,start:l})}return s};const Ep=t=>{const{lines:n,selections:e}=t;const o=yp(n,e);return la(t,o)};const xp=async(t,n)=>Oa({args:[n],editor:t,event:Da,method:ya,noProviderFoundMessage:"No tab completion provider found",noProviderFoundResult:undefined});const Ip=t=>{const{selections:n}=t;const e=n[0];const o=n[1];const s=zr(t,e,o);return s};const Sp=async t=>{const n=Ip(t);const e=await xp(t,n);return e};const kp=(t,n,e)=>{const o=Mi(e.inserted);const s=[];const c=[];for(let r=0;r<n.length;r+=4){const[i,a,d,l]=Pi(n,r);if(o.length>1){const n=Or({lines:t},i);const r=Rr(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:Cs,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:Cs,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:Cs,start:{columnIndex:a-e.deleted,rowIndex:i}})}}}return{changes:s,selectionChanges:new Uint32Array(c)}};const vp=(t,n)=>{const{lines:e,selections:o}=t;const{changes:s,selectionChanges:c}=kp(e,o,n);return la(t,s,c)};const Cp=String;const bp=async t=>{try{const n=await Sp(t);if(!n){return t}return vp(t,n)}catch(n){await Wa(n);const e=t.selections[0];const o=t.selections[1];return zd(t,e,o,Cp(n))}};const Mp=async(t,n)=>{const{assetDir:e,platform:o}=t;try{await Vo(`onLanguage:${t.languageId}`,e,o);const s=await xa(`ExtensionHostCommment.execute`,t.uid,n);if(s){return s}}catch{}const s=await Fm(t);if(!s?.comments?.blockComment){return undefined}return s.comments.blockComment};const Ap=/^\s+/;const Lp=/\s+$/;const Pp=(t,n,e)=>({deleted:[e],end:{columnIndex:n+e.length,rowIndex:t},inserted:[],origin:Rs,start:{columnIndex:n,rowIndex:t}});const Fp=(t,n,e,o,s,c,r)=>{if(n===o){return[Pp(t,e,c),Pp(t,s-c.length,r)]}return[Pp(n,e,c),Pp(o,s,r)]};const Wp=(t,n)=>{const{selections:e}=t;const[o]=e;const s=Or(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=Or(t,r);i=n.indexOf(d);if(i!==-1){break}r++}let l=-1;let u=o;while(u>=0){const n=Or(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(Ap);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:Rs,start:{columnIndex:e,rowIndex:o}};const i={deleted:[],end:{columnIndex:c+a.length,rowIndex:o},inserted:[d],origin:Rs,start:{columnIndex:c+a.length,rowIndex:o}};f.push(r,i)}return f};const Tp=async t=>{const n=Ip(t);const e=await Mp(t,n);if(!e){return t}const o=Wp(t,e);return fa(t,o)};const Rp=async t=>{const n=await Fm(t);if(!n?.comments?.lineComment){return undefined}return n.comments.lineComment};const Dp=/^\s+/;const Op=(t,n,e)=>{const o=n.match(Dp);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:Ws,start:{columnIndex:s,rowIndex:t}}}return{deleted:[e],end:{columnIndex:s+e.length,rowIndex:t},inserted:[""],origin:Ws,start:{columnIndex:s,rowIndex:t}}}return{deleted:[],end:{columnIndex:s,rowIndex:t},inserted:[`${e} `],origin:Ws,start:{columnIndex:s,rowIndex:t}}};const Bp=async t=>{const n=await Rp(t);if(!n){return t}const e=t;const o=t.selections[0];const s=Or(e,o);const c=[Op(o,s,n)];return la(t,c)};const Np=async t=>{try{const n=await Bp(t);if(t!==n){return n}return Tp(t)}catch(n){Ed(n);await Hd(t,0,0,String(n));return t}};const Hp=async(t,n)=>{const e=bd(t,[n],bs);const o=await la(t,e);if(o.completionsOnType){const t=await Vm(o);return t}return o};const zp="/";const Up="{";const _p="}";const Yp="(";const $p=")";const Vp="[";const jp="]";const qp="???";const Gp="'";const Xp='"';const Zp="`";const Kp=t=>{switch(t){case Up:return _p;case Yp:return $p;case Vp:return jp;default:return qp}};const Qp=(t,n)=>{const e=Kp(n);const o=n+e;const s=bd(t,[o],Ms);const c=new Uint32Array([s[0].start.rowIndex,s[0].start.columnIndex+1,s[0].end.rowIndex,s[0].end.columnIndex+1]);return la(t,s,c)};const Jp=t=>{const{selections:n}=t;const e=new Uint32Array([n[0],n[1]+1,n[2],n[3]+1]);return da(t,e)};const ty=(t,n)=>{const{autoClosingRanges:e=[],selections:o}=t;if(zu(e,o)){return Jp(t)}return Hp(t,n)};const ny=(t,n)=>{const e=n+n;const o=bd(t,[e],Ms);const s=new Uint32Array([o[0].start.rowIndex,o[0].start.columnIndex+1,o[0].end.rowIndex,o[0].end.columnIndex+1]);return la(t,o,s)};const ey=async(t,n)=>{const e=zr(t,t.selections[0],t.selections[1]);const o=await ko("ExtensionHostClosingTagCompletion.executeClosingTagProvider",t,e,n);if(!o){const e=bd(t,[n],bs);return la(t,e)}const s=bd(t,[o.inserted],bs);return la(t,s)};const oy=async(t,n)=>{const{isAutoClosingBracketsEnabled:e,isAutoClosingQuotesEnabled:o,isAutoClosingTagsEnabled:s}=t;switch(n){case zp:if(s){return ey(t,n)}break;case _p:case $p:case jp:if(e){return ty(t,n)}break;case Up:case Yp:case Vp:if(e){return Qp(t,n)}break;case Zp:case Xp:case Gp:if(o){return ny(t,n)}break}const c=Hp(t,n);return c};const sy=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 cy=t=>{const{undoStack:n}=t;if(n.length===0){return t}const e=n.at(-1);const o=e.map(sy);const s={...t,redoStack:[...t.redoStack||[],e],undoStack:n.slice(0,-1)};return ua(s,o)};const ry=t=>t;const iy=t=>{switch(t){case Ad:case Te:case Re:case Oe:case Be:case Ne:case He:return true;default:return false}};const ay=(t,n,e)=>{const o=e(t);const{uid:s}=t.newState;const c=[];c.push(["Viewlet.createFunctionalRoot",n,s,iy(t.id)]);c.push(...o);if(iy(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 dy=t=>{switch(t){case Te:return Qo;case Re:return _m;case Oe:return Zm;case Be:return op;case Ne:return nl;case He:return fp;default:return undefined}};const ly="Close";const uy=(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 fy=(t,n)=>{for(const e of rs()){const o=cs(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 hy=(t,n)=>{if(t&&t.widgets){return t}const e=cs(t);if(e&&e.newState&&e.newState.widgets){return e.newState}return fy(t,n)};const gy=(t,n,e)=>{const o=t=>t.id===e;const s=n=>t==="close"||t==="handleClickButton"&&n.includes(ly);const c=async(c,...r)=>{const i=hy(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=dy(e);await f(`${n}.${t}`,u,...r);const h=await f(`${n}.diff2`,u);const g=await f(`${n}.render2`,u,h);const m=cs(i.uid).newState;if(s(r)){const t={...m,focused:true,widgets:qd(m.widgets,e)};is(i.uid,m,t);return t}const w={...l,commands:g};const p=uy(m,e,w);is(i.uid,m,p);return p};return c};const my=(t,n,e)=>{const o=Object.create(null);for(const s of t){o[s]=gy(s,n,e)}return o};const wy="Viewlet.appendToBody";const py="focus";const yy="Viewlet.focusSelector";const Ey="Viewlet.registerEventListeners";const xy="Viewlet.setSelectionByName";const Iy="Viewlet.setValueByName";const Sy="Viewlet.setFocusContext";const ky="setBounds";const vy="Viewlet.setBounds";const Cy="Viewlet.setCss";const by="Viewlet.setDom2";const My="Viewlet.setUid";const Ay=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const Ly=[by,Cy,wy,vy,Ey,xy,Iy,Sy,My,"Viewlet.focusSelector"];const Py=t=>{const n=Ay(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=>ay(t,"EditorCompletion",Py);const Wy=t=>[["Viewlet.dispose",t.newState.uid]];const{close:Ty,closeDetails:Ry,focusFirst:Dy,focusIndex:Oy,focusLast:By,focusNext:Ny,focusPrevious:Hy,handleEditorBlur:zy,handleEditorClick:Uy,handleEditorDeleteLeft:_y,handleEditorType:Yy,handlePointerDown:$y,handleWheel:Vy,openDetails:jy,selectCurrent:qy,selectIndex:Gy,toggleDetails:Xy}=my(["handleEditorType","focusFirst","focusNext","focusPrevious","focusLast","handleEditorDeleteLeft","openDetails","focusIndex","handleEditorBlur","handleEditorClick","openDetails","selectCurrent","selectIndex","toggleDetails","closeDetails","handleWheel","close","handlePointerDown"],"Completions",Re);const Zy={__proto__:null,add:Fy,close:Ty,closeDetails:Ry,focusFirst:Dy,focusIndex:Oy,focusLast:By,focusNext:Ny,focusPrevious:Hy,handleEditorBlur:zy,handleEditorClick:Uy,handleEditorDeleteLeft:_y,handleEditorType:Yy,handlePointerDown:$y,handleWheel:Vy,openDetails:jy,remove:Wy,render:Py,selectCurrent:qy,selectIndex:Gy,toggleDetails:Xy};const Ky=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const Qy=[by,Cy,wy,vy,Ey,xy,Iy,Sy,My,"Viewlet.focusSelector"];const Jy=t=>{const n=Ky(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(Qy.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const tE=t=>ay(t,"FindWidget",Jy);const nE=t=>[["Viewlet.dispose",t.newState.uid]];const{close:eE,focusCloseButton:oE,focusFind:sE,focusNext:cE,focusNextElement:rE,focusNextMatchButton:iE,focusPrevious:aE,focusPreviousElement:dE,focusPreviousMatchButton:lE,focusReplace:uE,focusReplaceAllButton:fE,focusReplaceButton:hE,focusToggleReplace:gE,handleBlur:mE,handleClickButton:wE,handleFocus:pE,handleInput:yE,handleReplaceFocus:EE,handleReplaceInput:xE,handleToggleReplaceFocus:IE,replace:SE,replaceAll:kE,toggleMatchCase:vE,toggleMatchWholeWord:CE,togglePreserveCase:bE,toggleReplace:ME,toggleUseRegularExpression:AE}=my(["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",Oe);const LE={__proto__:null,add:tE,close:eE,focusCloseButton:oE,focusFind:sE,focusNext:cE,focusNextElement:rE,focusNextMatchButton:iE,focusPrevious:aE,focusPreviousElement:dE,focusPreviousMatchButton:lE,focusReplace:uE,focusReplaceAllButton:fE,focusReplaceButton:hE,focusToggleReplace:gE,handleBlur:mE,handleClickButton:wE,handleFocus:pE,handleInput:yE,handleReplaceFocus:EE,handleReplaceInput:xE,handleToggleReplaceFocus:IE,remove:nE,render:Jy,replace:SE,replaceAll:kE,toggleMatchCase:vE,toggleMatchWholeWord:CE,togglePreserveCase:bE,toggleReplace:ME,toggleUseRegularExpression:AE};const PE=t=>({documentId:t.id||t.uid,languageId:t.languageId,text:Br(t),uri:t.uri});const FE=async(t,n)=>{const e=PE(t);return mo("Extensions.executeHoverProvider",e,n)};const WE=async(t,n)=>{h(t);g(n);const e=await FE(t,n);if(e){return e}return Oa({args:[n],editor:t,event:Ra,method:pa,noProviderFoundMessage:"No hover provider found"})};const TE=async(t,n)=>{h(t);g(n);const e=await WE(t,n);return e};const RE=async(t,n,e,o,s)=>100;const DE=(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 OE=(t,n,e)=>{const o=[];const{hasArrayReturn:s,initialLineState:c,tokenizeLine:r,TokenMap:i}=n;let a=Oc(c);for(const n of t){const t=zc(e,r,n,a,s);const{tokens:c}=t;const d=DE(n,c,i);o.push(d);a=t}console.error({lineInfos:o});return o};const BE=async(t,n,e)=>{await lr(n,e);const o=ur(n);const s=Mi(t);const c=OE(s,o,n);return c};const NE=(t,n)=>{if(t){return t}const e=n[0];const o=n[1];return{columnIndex:o,rowIndex:e}};const HE=(t,n,e)=>{const o=[];for(const e of t){if(e.rowIndex===n){o.push(e)}}return o};const zE="typescript";const UE=(t,n,e,o)=>{const s=Bd(t,n,e);const c=t.height-Nd(t,n)+t.y+40;return{x:s,y:c}};const _E=async(t,n)=>{g(t);const e=cs(t);const o=e.newState;const{selections:s}=o;const{columnIndex:c,rowIndex:r}=NE(n,s);const i=zr(o,r,c);const a=await TE(o,i);if(!a){return undefined}const{displayString:d,displayStringLanguageId:l,documentation:u}=a;const f="";const h=await BE(d,l||zE,f);const m=uf(o,r,c);const w=c-m.length;await RE();const{x:p,y:y}=UE(o,r,w);const E=o.diagnostics||[];const x=HE(E,r);return{documentation:u,lineInfos:h,matchingDiagnostics:x,x:p,y:y}};const YE=async(t,n,e)=>{const o=await _E(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 $E=(t,n,e)=>t;const VE=(t,n,e)=>{const{x:o}=t;const s=100;const c=Math.max(n-o,s);return{...t,resizedWidth:c}};const jE=(t,n,e)=>t;const qE="CodeGeneratorInput";const GE="CodeGeneratorMessage";const XE="CodeGeneratorWidget";const ZE="DiagnosticError";const KE="DiagnosticWarning";const QE="CompletionDetailCloseButton";const JE="CompletionDetailContent";const tx="Diagnostic";const nx="EditorCursor";const ex="EditorRow";const ox="EditorRowHighlighted";const sx="EditorSelection";const cx="HoverDisplayString";const rx="HoverDocumentation";const ix="HoverEditorRow";const ax="HoverProblem";const dx="HoverProblemDetail";const lx="HoverProblemMessage";const ux="IconClose";const fx="InputBox";const hx="MaskIcon";const gx="Viewlet";const mx=1;const wx=2;const px=9;const yx=10;const Ex=11;const xx=12;const Ix=13;const Sx=14;const kx=15;const vx=18;const Cx=19;const bx=20;const Mx=21;const Ax=22;const Lx=23;const Px=26;const Fx=27;const Wx=28;const Tx=29;const Rx=30;const Dx=31;const Ox=32;const Bx=33;const Nx=34;const Hx=4;const zx=6;const Ux=8;const _x=12;const Yx=62;const $x=t=>({childCount:0,text:t,type:_x});const Vx=t=>{const n=[{childCount:t.length/2,className:ix,type:Hx}];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:Ux},$x(o))}return n};const jx=t=>{const n=t.flatMap(Vx);return n};const qx={childCount:1,className:lx,type:Ux};const Gx={childCount:1,className:dx,type:Ux};const Xx=(t,n,e)=>{const o=n?1:0;const s=e&&e.length>0?1:0;return t.length+o+s};const Zx=(t,n,e)=>{const o=[];o.push({childCount:Xx(t,n,e)+1,className:"Viewlet EditorHover",type:Hx});if(e&&e.length>0){o.push({childCount:e.length*2,className:`${cx} ${ax}`,type:Hx});for(const t of e){o.push(qx,$x(t.message),Gx,$x(`${t.source} (${t.code})`))}}if(t.length>0){const n=jx(t);o.push({childCount:t.length,className:cx,type:Hx},...n)}if(n){o.push({childCount:1,className:rx,type:Hx},$x(n))}o.push({childCount:0,className:"Sash SashVertical SashResize",onPointerDown:Px,type:Hx});return o};const Kx={apply(t,n){const e=Zx(n.lineInfos,n.documentation,n.diagnostics);return[by,e]},isEqual:(t,n)=>t.lineInfos===n.lineInfos&&t.documentation===n.documentation&&t.diagnostics===n.diagnostics};const Qx={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[ky,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y};const Jx=[Kx,Qx];const tI=(t,n)=>{const e=[];for(const o of Jx){if(!o.isEqual(t,n)){e.push(o.apply(t,n))}}return e};const nI=[by,Cy,wy,vy,Ey,xy,Iy,Sy,My,"Viewlet.focusSelector"];const eI=t=>{const n=Ay(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(nI.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const oI=t=>ay(t,"EditorRename",eI);const sI=t=>[["Viewlet.dispose",t.newState.uid]];const{accept:cI,close:rI,handleInput:iI}=my(["handleInput","close","accept"],"Rename",Ne);const aI={__proto__:null,accept:cI,add:oI,close:rI,handleInput:iI,remove:sI,render:eI};const dI=t=>structuredClone(t);const lI=(t,n)=>{const e={...t,focusedIndex:n};return e};const uI=t=>{const n=t.focusedIndex+1;return lI(t,n)};const fI=t=>[["Viewlet.dispose",t.newState.uid]];const hI=[by,Cy,wy,vy,Ey,xy,Iy,Sy,My,"Viewlet.focusSelector"];const gI=t=>{const n=Ay(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(hI.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const mI=t=>ay(t,"EditorSourceActions",gI);const wI=fI;const{close:pI,closeDetails:yI,focusFirst:EI,focusIndex:xI,focusLast:II,focusNext:SI,focusPrevious:kI,handleWheel:vI,selectCurrent:CI,selectIndex:bI,selectItem:MI,toggleDetails:AI}=my(["focusFirst","focusIndex","focusLast","focusNext","focusPrevious","selectCurrent","selectIndex","selectItem","toggleDetails","closeDetails","handleWheel","close"],"SourceActions",He);const LI={__proto__:null,add:mI,close:pI,closeDetails:yI,focusFirst:EI,focusIndex:xI,focusLast:II,focusNext:SI,focusPrevious:kI,handleWheel:vI,remove:wI,render:gI,selectCurrent:CI,selectIndex:bI,selectItem:MI,toggleDetails:AI};const PI=async(t,n,e,o,s,...c)=>{const r=dy(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=Qm(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=uy(u,s,y);return E};const FI=async t=>{if(!t){return[]}const{newState:n}=cs(t);return Oa({args:[],editor:n,event:"onLanguage",method:"ExtensionHostCodeActions.getSourceActions"})};const WI=/[\w\-]+$/;const TI=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(WI);if(i){return i[0]}return""};const RI=async t=>{await ko("Focus.setFocus",t)};const DI=async t=>{if(!t){return}await ko("Focus.removeAdditionalFocus",t)};const OI=12;const BI=9;const NI=11;const HI=12;const zI=16;const UI=38;const _I=43;const YI=46;const $I=47;const VI=48;const jI=49;const qI=50;const GI=52;const XI=41;const ZI=t=>{const n=Qm(t);return ow(n)};const KI=t=>{const n=Qm(t);return n.uri};const QI=t=>{const n=Qm(t);return n.languageId};const JI=t=>{const n=Qm(t);return Ip(n)};const tS=(t,n,e)=>{const o=Qm(t);const{word:s}=lf(o,n,e);return s};const nS=t=>{const n=Qm(t);const e=TI(n);return e};const eS=(t,n,e)=>{const o=Qm(t);const s=uf(o,n,e);return s};const oS=t=>{const n=Qm(t);const{lines:e}=n;return e};const sS=t=>{const n=Qm(t);const{selections:e}=n;return e};const cS=async(t,n)=>{const e=Qm(t);const o={...e,selections:n};const s=await Kg(e,o);is(t,e,s)};const rS=async(t,n,e,o)=>{const s=Qm(t);const c=dy(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 Kg(s,d);is(t,s,l);await RI(HI);if(o){await DI(o)}};const iS=async t=>{await rS(t,Oe,"FindWidget",0)};const aS=async(t,n)=>{const e=Qm(t);const o=await Id(e,n);const s=await Kg(e,o);is(t,e,s)};const dS=async t=>{const n=await FI(t);return n};const lS=async t=>{const n=Qm(t);const{diagnostics:e}=n;return e};const uS=async(t,n)=>{await Io("TextMeasurement.ensureFont",t,n)};const fS=()=>[{command:"Editor.closeColorPicker",key:oe,when:XI},{command:"Editor.closeSourceAction",key:oe,when:UI},{command:"EditorSourceActions.focusNext",key:le,when:UI},{command:"EditorSourceActions.focusPrevious",key:ae,when:UI},{command:"EditorSourceActions.focusFirst",key:re,when:UI},{command:"EditorSourceActions.focusLast",key:ce,when:UI},{command:"EditorSourceActions.selectCurrent",key:ee,when:UI},{command:"FindWidget.focusNext",key:ee,when:zI},{command:"FindWidget.preventDefaultBrowserFind",key:ze|me,when:zI},{command:"FindWidget.focusPrevious",key:Ue|be,when:zI},{command:"FindWidget.focusNext",key:be,when:zI},{command:"FindWidget.focusToggleReplace",key:Ue|ne,when:zI},{command:"FindWidget.focusReplace",key:ne,when:zI},{command:"FindWidget.focusPreviousMatchButton",key:ne,when:_I},{command:"FindWidget.replaceAll",key:_e|ze|ee,when:_I},{command:"FindWidget.focusNextMatchButton",key:ne,when:qI},{command:"FindWidget.focusReplace",key:Ue|ne,when:qI},{command:"FindWidget.focusPreviousMatchButton",key:Ue|ne,when:jI},{command:"FindWidget.focusCloseButton",key:ne,when:jI},{command:"FindWidget.focusNextMatchButton",key:Ue|ne,when:VI},{command:"FindWidget.focusReplaceButton",key:ne,when:VI},{command:"FindWidget.focusFind",key:Ue|ne,when:_I},{command:"FindWidget.focusReplaceAllButton",key:ne,when:YI},{command:"FindWidget.focusCloseButton",key:Ue|ne,when:YI},{command:"FindWidget.focusReplaceButton",key:Ue|ne,when:$I},{command:"EditorCompletion.focusNext",key:le,when:BI},{command:"EditorCompletion.focusPrevious",key:ae,when:BI},{command:"EditorCompletion.selectCurrent",key:ee,when:BI},{command:"EditorCompletion.close",key:oe,when:BI},{command:"EditorCompletion.focusLast",key:ce,when:BI},{command:"EditorCompletion.focusFirst",key:re,when:BI},{command:"EditorCompletion.toggleDetails",key:ze|se,when:BI},{command:"Editor.cursorWordRight",key:ze|de,when:HI},{command:"Editor.cursorWordLeft",key:ze|ie,when:HI},{command:"Editor.deleteWordPartLeft",key:_e|te,when:HI},{command:"Editor.deleteWordPartRight",key:_e|ue,when:HI},{command:"Editor.deleteWordLeft",key:ze|te,when:HI},{command:"Editor.deleteWordRight",key:ze|ue,when:HI},{command:"Editor.selectNextOccurrence",key:ze|ge,when:HI},{command:"Editor.openColorPicker",key:ze|pe,when:HI},{command:"Editor.showSourceActions3",key:ze|Ae,when:HI},{command:"Editor.handleTab",key:ne,when:HI},{command:"Editor.unindent",key:Ue|ne,when:HI},{command:"Editor.indentLess",key:ze|Pe,when:HI},{command:"Editor.closeFind",key:oe,when:zI},{command:"Editor.openFind2",key:ze|me,when:HI},{command:"Editor.openCodeGenerator",key:ze|ye,when:HI},{command:"Editor.closeCodeGenerator",key:oe,when:GI},{command:"EditorCodeGenerator.accept",key:ee,when:GI},{command:"Editor.indentMore",key:ze|Fe,when:HI},{command:"Editor.selectCharacterLeft",key:Ue|ie,when:HI},{command:"Editor.selectWordLeft",key:ze|Ue|ie,when:HI},{command:"Editor.selectCharacterRight",key:Ue|de,when:HI},{command:"Editor.selectWordRight",key:ze|Ue|de,when:HI},{command:"Editor.selectLine",key:ze|Ee,when:HI},{command:"Editor.deleteAllLeft",key:ze|Ue|te,when:HI},{command:"Editor.deleteAllRight",key:ze|Ue|ue,when:HI},{command:"Editor.cancelSelection",key:oe,when:HI},{command:"Editor.undo",key:ze|ke,when:HI},{command:"Editor.cursorLeft",key:ie,when:HI},{command:"Editor.cursorRight",key:de,when:HI},{command:"Editor.cursorUp",key:ae,when:HI},{command:"Editor.cursorDown",key:le,when:HI},{command:"Editor.deleteLeft",key:te,when:HI},{command:"Editor.deleteRight",key:ue,when:HI},{command:"Editor.insertLineBreak",key:ee,when:HI},{command:"Editor.copyLineDown",key:ze|Ue|ge,when:HI},{command:"Editor.moveLineDown",key:ze|Ue|le,when:HI},{command:"Editor.moveLineUp",key:ze|Ue|ae,when:HI},{command:"Editor.openCompletion",key:ze|se,when:HI},{command:"Editor.openRename",key:ve,when:HI},{command:"EditorRename.accept",key:ee,when:NI},{command:"Editor.closeRename",key:oe,when:NI},{command:"Editor.cursorHome",key:re,when:HI},{command:"Editor.cursorEnd",key:ce,when:HI},{command:"Editor.toggleComment",key:ze|Le,when:HI},{command:"Editor.copy",key:ze|he,when:HI},{command:"Editor.selectAll",key:ze|fe,when:HI},{command:"Editor.showHover2",key:ze|we,when:HI},{command:"Editor.cut",key:ze|Se,when:HI},{command:"Editor.paste",key:ze|Ie,when:HI},{command:"Editor.cursorWordPartLeft",key:_e|ie,when:HI},{command:"Editor.cursorWordPartRight",key:_e|de,when:HI},{command:"Editor.selectAllOccurrences",key:_e|Ce,when:HI},{command:"Editor.addCursorAbove",key:_e|Ue|ae,when:HI},{command:"Editor.addCursorBelow",key:_e|Ue|le,when:HI},{command:"Editor.findAllReferences",key:_e|Ue|Me,when:HI},{command:"Editor.organizeImports",key:_e|Ue|xe,when:HI},{command:"Editor.selectionGrow",key:ze|Ue|se,when:OI}];const hS=()=>rs();const gS={CommandPalette:"Command Palette"};const mS=()=>mf(gS.CommandPalette);const wS={command:"",flags:Ve,id:"separator",label:""};const pS=()=>[{command:"Editor.goToDefinition",flags:je,id:"go-to-definition",label:Kf()},{command:"Editor.goToTypeDefinition",flags:je,id:"go-to-type-definition",label:ch()},wS,{args:["References",true],command:"SideBar.show",flags:je,id:"find-all-references",label:rh()},{args:["Implementations",true],command:"SideBar.show",flags:je,id:"find-all-implementations",label:ih()},wS,{command:"Editor.format",flags:je,id:"format",label:gh()},{command:"Editor.showSourceActions2",flags:je,id:$e,label:eh()},wS,{command:"Editor.cut",flags:je,id:"cut",label:ah()},{command:"Editor.copy",flags:je,id:"copy",label:dh()},{command:"Editor.paste",flags:je,id:"paste",label:lh()},wS,{command:"QuickPick.showEverything",flags:je,id:"commandPalette",label:mS()}];const yS=()=>[Ye];const ES=t=>Ha(t);const xS=async()=>{const t=rs();const n=t.map(t=>{const n=Number(t);const e=cs(n);return e});const e=n.map(t=>t.newState);const o=await Promise.all(e.map(ES));const s=o.flat();return s};const IS=()=>[{id:"Editor.format",label:gh()},{id:"Editor.showHover",label:mh()},{id:"Editor.formatForced",label:wh()},{id:"Editor.selectNextOccurrence",label:ph()},{id:"Editor.selectAllOccurrences",label:yh()},{id:"Editor.goToDefinition",label:Eh()},{id:"Editor.goToTypeDefinition",label:xh()},{id:"Editor.selectInsideString",label:Ih()},{aliases:["Indent More","DeIndent"],id:"Editor.indent",label:Sh()},{aliases:["Indent Less","DeIndent"],id:"Editor.unindent",label:kh()},{id:"Editor.sortLinesAscending",label:vh()},{id:"Editor.toggleComment",label:Ch()},{id:"Editor.selectUp",label:bh()},{id:"Editor.selectDown",label:Mh()},{id:"Editor.toggleBlockComment",label:uh()},{id:"Editor.openColorPicker",label:Ah()},{id:"Editor.closeColorPicker",label:Lh()},{id:"Editor.copyLineDown",label:Ph()},{id:"Editor.copyLineUp",label:Fh()},{id:"Editor.moveLineDown",label:hh()},{id:"Editor.moveLineUp",label:fh()},{id:"Editor.showSourceActions2",label:eh()}];const SS=t=>{const n=Qm(t);const{selections:e}=n;return e};const kS=t=>{g(t);const n=Qm(t);const{lines:e}=n;return e.join(Cr)};const vS="insertText";const CS=(t,n,e)=>{switch(n){case vS:return oy(t,e);default:return t}};const bS=async(t,n)=>{const e=await Bn({commandMap:{},messagePort:t});if(n){Un(n,e)}};const MS=(t,n)=>vp(t,n);const AS=async t=>{const n=await Sp(t);if(!n){return t}return MS(t,n)};const LS=async()=>{await Km();await Xm()};const PS=t=>{switch(t){case Oe:return{invoke:Zm,name:"FindWidget"};default:return undefined}};const FS=async(t,n,e,o)=>{if(e?.newState){const s=`${n}:${e.newState.uid}`;const c=PS(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 WS=async(t,n)=>{const e=[];for(const o of t){const t=parseInt(o);const s=cs(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 FS(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 TS=async(t,n,e)=>{if(!e?.newState){return}const o=PS(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 RS=async t=>{const n=Object.create(null);for(const e of t){const t=cs(parseInt(e));if(!t?.newState||!Array.isArray(t.newState.widgets)){continue}const{widgets:o}=t.newState;for(const t of o){await TS(n,e,t)}}return n};const DS={isReloading:false};const OS=async()=>{if(DS.isReloading){return}DS.isReloading=true;try{const t=rs();const n=await RS(t);await LS();const e=await WS(t,n);for(const t of e){is(t.newState.uid,t.oldState,t.newState)}await ko(`Editor.rerender`)}finally{DS.isReloading=false}};const BS=async t=>{try{await Ho(t)}catch{await vo("SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker",t,"HandleMessagePort.handleMessagePort")}};const NS=async()=>{try{const t=await Rn({commandMap:{},send:BS});return t}catch(t){throw new k(t,`Failed to create syntax highlighting worker rpc`)}};const HS=async(t,n)=>{if(t){Xc(true);const t=await NS();Qc(t)}if(n){ci(true)}};const zS=async()=>{const t="Completion Worker";const n="completionWorkerMain.js";const e="Completions.initialize";const o=await Go(t,n,e);return o};const US=async(t,n)=>{Ym(zS);await HS(t,n)};const _S="editor.lineHeight";const YS="editor.fontSize";const $S="editor.fontFamily";const VS="editor.letterSpacing";const jS="editor.tabSize";const qS="editor.lineNumbers";const GS="editor.diagnostics";const XS="editor.quickSuggestions";const ZS="editor.autoClosingQuotes";const KS="editor.autoclosingBrackets";const QS="editor.fontWeight";const JS=async()=>Boolean(await La(KS));const tk=async()=>Boolean(await La(ZS));const nk=async()=>Boolean(await La(XS));const ek=async()=>true;const ok=async()=>await La(_S)||20;const sk=async()=>await La(YS)||15;const ck=async()=>await La($S)||"Fira Code";const rk=async()=>await La(VS)??.5;const ik=async()=>await La(jS)||2;const ak=async()=>await La(qS)??false;const dk=async()=>[".","/"];const lk=async()=>await La(GS)??false;const uk=async()=>await La(QS)??400;const fk=async()=>{const[t,n,e,o,s,c,r,i,a,d,l,u,f]=await Promise.all([lk(),ck(),sk(),uk(),JS(),tk(),ek(),nk(),ak(),ok(),ik(),rk(),dk()]);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 hk=(t,n)=>{for(const e of t){if(e?.id===n&&e.tokenize){return e.tokenize}}return""};const gk=t=>{if(t instanceof Error){return t.message}return String(t)};const mk=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 fk();const k=await Aa(g,h,f,E);const v=await Ma(c,e);cr(v);const C=ba(r,v);const b=hk(v,C);await lr(C,b);const M=ur(C);const A=t.tokenizerId+1;hr(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 Lo(r)}catch(t){const n=ga(L,a,d,i,o,9);return{...n,differences:[],focus:ao,focused:true,initial:false,loadError:gk(t),textInfos:[]}}const F=ga(L,a,d,i,o,9);const W=ma(F,P);let T=W;const R=yi(T);const D={...T,decorations:R};const O=ri();const{differences:B,textInfos:N}=await Qr(D,O);const H={...D,differences:B,focus:ao,focused:true,textInfos:N};await xa(Ea,r,s,C,P);const z=u?await ja(H):H;const U=await La("editor.completionsOnType");const _=Boolean(U);const Y={...z,completionsOnType:_,initial:false};return Y};const wk=t=>t;const pk=t=>t;const yk=(t,n)=>{g(t);g(n);Si(t,n)};const Ek=(t,n,e,o,s,c)=>{const r=`.Editor[data-uid="${t}"]`;return`${r} {\n --EditorRowHeight: ${n}px;\n --ScrollBarHeight: ${e}px;\n --ScrollBarTop: ${o}px;\n --ScrollBarWidth: ${s}px;\n --ScrollBarLeft: ${c}px;\n}\n${r} .EditorRow {\n height: var(--EditorRowHeight);\n line-height: var(--EditorRowHeight);\n}\n${r} .ScrollBarThumbVertical {\n height: var(--ScrollBarHeight);\n translate: 0px var(--ScrollBarTop);\n}\n${r} .ScrollBarThumbHorizontal {\n width: var(--ScrollBarWidth);\n translate: var(--ScrollBarLeft) 0px;\n}\n`};const xk=(t,n,e)=>{const o=t/n*e;if(!Number.isFinite(o)){return 0}return o};const Ik=(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=ti(o,s,c,d);const h=ni(u,r,i);const g=xk(e,r,u);const m=Ek(l,a,d,f,h,g);return[co,l,m]};const Sk=(t,n)=>{const e=".EditorInput textarea";return[so,n.uid,e]};const kk=(t,n)=>[ro,n.uid,n.focus];const vk=1;const Ck=2;const bk=3;const Mk=4;const Ak=6;const Lk=7;const Pk=8;const Fk=9;const Wk=10;const Tk=11;const Rk=t=>t!=="type"&&t!=="childCount";const Dk=t=>{const n=Object.keys(t).filter(Rk);return n};const Ok=t=>{const n=[];let e=0;while(e<t.length){const o=t[e];const{children:s,nodesConsumed:c}=Bk(t,e+1,o.childCount||0);n.push({node:o,children:s});e+=1+c}return n};const Bk=(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}=Bk(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 Nk=(t,n)=>{if(t.type!==n.type){return null}const e=[];if(t.type===jn){if(t.uid!==n.uid){e.push({type:Tk,uid:n.uid})}return e}if(t.type===Vn&&n.type===Vn){if(t.text!==n.text){e.push({type:vk,value:n.text})}return e}const o=Dk(t);const s=Dk(n);for(const o of s){if(t[o]!==n[o]){e.push({type:bk,key:o,value:n[o]})}}for(const t of o){if(!Object.hasOwn(n,t)){e.push({type:Mk,key:t})}}return e};const Hk=t=>{const n=[t.node];for(const e of t.children){n.push(...Hk(e))}return n};const zk=(t,n,e)=>{if(n===-1){t.push({type:Lk,index:e});return e}if(n!==e){t.push({type:Wk,index:e})}return e};const Uk=(t,n)=>{if(n>=0){t.push({type:Pk})}return-1};const _k=(t,n)=>{n.push({type:Ak,nodes:Hk(t)})};const Yk=(t,n)=>{n.push({type:Ck,nodes:Hk(t)})};const $k=(t,n,e,o,s)=>{const c=Nk(t.node,n.node);if(c===null){const t=zk(e,o,s);Yk(n,e);return t}const r=t.children.length>0||n.children.length>0;if(c.length===0&&!r){return o}const i=zk(e,o,s);if(c.length>0){e.push(...c)}if(r){jk(t.children,n.children,e)}return i};const Vk=(t,n,e)=>{const o=Nk(t.node,n.node);if(o===null){Yk(n,e);return}if(o.length>0){e.push(...o)}if(t.children.length>0||n.children.length>0){jk(t.children,n.children,e)}};const jk=(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=Uk(e,s);_k(i,e);continue}if(!i){c.push(r);continue}s=$k(o,i,e,s,r)}Uk(e,s);for(let t=c.length-1;t>=0;t--){e.push({type:Fk,index:c[t]})}};const qk=(t,n,e,o)=>{if(o.length===0&&t.length===1&&n.length===1){Vk(t[0],n[0],e);return}jk(t,n,e)};const Gk=t=>{let n=-1;for(let e=t.length-1;e>=0;e--){const o=t[e];if(o.type!==Lk&&o.type!==Pk&&o.type!==Wk){n=e;break}}return n===-1?[]:t.slice(0,n+1)};const Xk=(t,n)=>{const e=Ok(t);const o=Ok(n);const s=[];qk(e,o,s,[]);return Gk(s)};const Zk=()=>[{childCount:1,className:"EditorInput",type:Hx},{ariaAutoComplete:"list",ariaMultiLine:"true",ariaRoleDescription:"editor",autocapitalize:"off",autocomplete:"off",autocorrect:"off",childCount:0,name:"editor",onBeforeInput:mx,onBlur:wx,onCompositionEnd:yx,onCompositionStart:Ex,onCompositionUpdate:xx,onCut:Sx,onFocus:kx,onPaste:bx,role:"textbox",spellcheck:false,type:Yx,wrap:"off"}];const Kk=t=>{const n=Array.from(t,t=>({childCount:0,className:nx,translate:t,type:Hx}));return n};const Qk=t=>{const n=Kk([...t]);return[{childCount:t.length,className:"LayerCursor",type:Hx},...n]};const Jk="error";const tv="warning";const nv=t=>{switch(t){case Jk:return ZE;case tv:return KE;default:return ZE}};const ev=(...t)=>t.filter(Boolean).join(" ");const ov=t=>{const{height:n,type:e,width:o,x:s,y:c}=t;const r=nv(e);return[{childCount:0,className:ev(tx,r),height:n,left:s,top:c,type:Hx,width:o}]};const sv=t=>{const n=t.flatMap(ov);return n};const cv=t=>{const n=sv([...t]);return[{childCount:t.length,className:"LayerDiagnostics",type:Hx},...n]};const rv=(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=ex;if(e===o){i+=" "+ox}s.push({childCount:c.length/2,className:i,translate:Hi(r),type:Hx});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:Ux},$x(n))}}return s};const iv=(t,n,e=true,o=-1)=>{const s=rv(t,n,e,o);return[{childCount:t.length,className:"EditorRows",onMouseDown:vx,onPointerDown:Mx,onWheel:Bx,type:Hx},...s]};const av=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:sx,height:r,left:o,top:s,type:Hx,width:c})}return n};const dv=t=>{const n=av(t);return[{childCount:t.length/4,className:"Selections",type:Hx},...n]};const lv=(t,n,e,o=true,s=-1,c=[],r=[])=>[{childCount:4,className:"EditorLayers",type:Hx},...dv(t),...iv(n,e,o,s),...Qk(c),...cv(r)];const uv=t=>[{childCount:t.length,className:"EditorScrollBarDiagnostics",type:Hx},...sv([...t])];const fv=()=>[{childCount:1,className:"ScrollBar ScrollBarVertical",onContextMenu:Ix,onPointerDown:Rx,type:Hx},{childCount:0,className:"ScrollBarThumb ScrollBarThumbVertical",type:Hx},{childCount:1,className:"ScrollBar ScrollBarHorizontal",onPointerDown:Fx,type:Hx},{childCount:0,className:"ScrollBarThumb ScrollBarThumbHorizontal",type:Hx}];const hv=({cursorInfos:t=[],diagnostics:n=[],differences:e,highlightedLine:o=-1,lineNumbers:s=true,scrollBarDiagnostics:c=[],selectionInfos:r=[],textInfos:i})=>[{childCount:5,className:"EditorContent",onKeyUp:Nx,onMouseMove:Cx,type:Hx},...Zk(),...lv(r,i,e,s,o,t,n),...uv(c),...fv()];const gv=t=>[{childCount:1,className:"LineNumber",type:Ux},$x(t)];const mv=t=>{const n=t.flatMap(gv);return n};const wv=t=>{const n=mv([...t]);return[{childCount:t.length,className:"Gutter",type:Hx},...n]};const pv=({cursorInfos:t=[],diagnostics:n=[],differences:e,gutterInfos:o=[],highlightedLine:s=-1,lineNumbers:c=true,loadError:r="",scrollBarDiagnostics:i=[],selectionInfos:a=[],textInfos:d,uid:l})=>{if(r){return[{childCount:2,className:"Viewlet TextEditorError","data-uid":l,role:"code",type:Hx},{childCount:0,className:"EditorTextIcon EditorTextIconError MaskIcon MaskIconError",type:Hx},{childCount:1,className:"TextEditorErrorMessage",type:Hx},$x(r)]}const u=c?wv(o):[];return[{childCount:c?2:1,className:"Viewlet Editor","data-uid":l,onContextMenu:Ix,role:"code",type:Hx},...u,...hv({cursorInfos:t,diagnostics:n,differences:e,highlightedLine:s,lineNumbers:c,scrollBarDiagnostics:i,selectionInfos:a,textInfos:d})]};const yv=new Map;const Ev=t=>yv.get(t);const xv=(t,n)=>{yv.set(t,n)};const Iv=t=>{const{initial:n,textInfos:e}=t;if(n&&e.length===0){return[]}return pv(t)};const Sv=(t,n)=>{const e=t.initial?Iv(t):Ev(n.uid)||Iv(t);const o=Iv(n);const s=Xk(e,o);if(s.length===0){return[]}xv(n.uid,o);return[io,n.uid,s]};const kv=t=>{switch(t){case td:return Ik;case Qa:return Sk;case Ja:return kk;case nd:return Sv;case ed:return ud;default:throw new Error("unknown renderer")}};const vv=(t,n,e)=>{const o=[];for(const s of e){const e=kv(s);const c=e(t,n);if(c.length>0){if(s===ed){o.push(...c)}else{o.push(c)}}}return o};const Cv=(t,n)=>{const{newState:e,oldState:o}=cs(t);is(t,e,e);const s=vv(o,e,n);return s};const bv={apply(t,n){const{incrementalEdits:e}=n;if(e!==as){return["setIncrementalEdits",e]}const{differences:o,textInfos:s}=n;n.differences=o;const{highlightedLine:c,minLineY:r}=n;const i=c-r;const a=rv(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 Mv={apply:(t,n)=>{const{cursorInfos:e=[],selectionInfos:o=[]}=n;const s=Kk(e);const c=av(o);return["setSelections",s,c]},isEqual:(t,n)=>t.cursorInfos===n.cursorInfos&&t.selectionInfos===n.selectionInfos};const Av={apply:Ik,isEqual:Xa};const Lv={apply:(t,n)=>["setFocused",n.focused],isEqual:(t,n)=>t.focused===n.focused};const Pv={apply:(t,n)=>[ro,n.uid,n.focus,0,n.uid,"Editor"],isEqual:(t,n)=>t.focus===n.focus};const Fv={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=sv(n.visualDecorations||[]);return["setDecorationsDom",e]},isEqual:(t,n)=>t.visualDecorations===n.visualDecorations};const Tv={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=mv(c);return["renderGutter",r]},isEqual:(t,n)=>t.lineNumbers===n.lineNumbers&&t.minLineY===n.minLineY&&t.maxLineY===n.maxLineY};const Rv={apply:ud,isEqual:(t,n)=>t.widgets===n.widgets,multiple:true};const Dv=[bv,Mv,Av,Lv,Wv,Tv,Rv,Pv,Fv];const Ov=async t=>{const n=cs(t);if(!n){return[]}const{newState:e,oldState:o}=n;const s=[];is(t,e,e);for(const t of Dv){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 Bv=()=>[{name:kx,params:["handleFocus"]},{name:Cx,params:["handleMouseMove",Xn,Zn,qn]},{name:Nx,params:["handleKeyUp",Jn]},{name:wx,params:["handleBlur"]},{name:mx,params:["handleBeforeInput","event.inputType","event.data"],preventDefault:true},{name:Ex,params:["compositionStart","event.data"]},{name:xx,params:["compositionUpdate","event.data"]},{name:yx,params:["compositionEnd","event.data"]},{name:Sx,params:["cut"],preventDefault:true},{name:bx,params:["paste",'event.clipboardData ? event.clipboardData.getData("text/plain") : ""'],preventDefault:true},{name:vx,params:["handleMouseDown","event.button","event.altKey","event.ctrlKey",Xn,Zn,"event.detail"]},{name:Mx,params:["handlePointerDown","event.button","event.altKey","event.ctrlKey",Xn,Zn,"event.detail"],trackPointerEvents:[Ax,Lx]},{name:Ax,params:["handlePointerMove",Xn,Zn,qn]},{name:Lx,params:["handlePointerUp"]},{name:Bx,params:["handleWheel",Kn,"event.deltaX",Qn],passive:true},{name:Ix,params:["handleContextMenu",Gn,Xn,Zn],preventDefault:true},{name:Rx,params:["handleScrollBarVerticalPointerDown",Zn],preventDefault:true,trackPointerEvents:[Dx,Ox]},{name:Dx,params:["handleScrollBarVerticalPointerMove",Zn]},{name:Ox,params:["handlePointerUp"]},{name:Fx,params:["handleScrollBarHorizontalPointerDown",Xn],trackPointerEvents:[Wx,Tx]},{name:Wx,params:["handleScrollBarHorizontalMove",Xn]},{name:Tx,params:["handlePointerUp"]}];const Nv=(t,n)=>{const{lines:e}=t;return{lines:e}};const Hv=async(t,n,e)=>{await Fo(t,e)};const zv=async(t,n)=>{await Oo(t,n)};const Uv=(t,n)=>t;const _v=(t,n)=>{g(t);g(n);ki(t,n)};const Yv=async(t,...n)=>{const e=_n(Xe);return e.invoke(t,...n)};const $v=async t=>{const n=await Yv("RunAndDebug.getHighlight",t);return n};const Vv=()=>{const t=rs();return parseInt(t[0])};const jv=async t=>{const n=await $v(t);const e=Vv();const o=cs(e);if(!o){return}const{newState:s,oldState:c}=o;const r={...s,highlightedLine:n.rowIndex};is(e,c,r);await ko("Editor.rerender",e)};const qv=t=>async(n,...e)=>{const o=cs(n);const s=o.newState;const c=await t(s,...e);if(s===c){return c}const r=await Kg(s,c);is(n,s,r);return r};const Gv={"ActivateByEvent.activateByEvent":Vo,"CodeGenerator.accept":jo,"ColorPicker.loadContent":Jo,"Editor.addCursorAbove":qv(gd),"Editor.addCursorBelow":qv(wd),"Editor.applyDocumentEdits":qv(xd),"Editor.applyEdit":qv(Id),"Editor.applyEdit2":aS,"Editor.applyWorkspaceEdit":qv(kd),"Editor.braceCompletion":qv(Yd),"Editor.cancelSelection":qv(Vd),"Editor.closeCodeGenerator":qv(Xd),"Editor.closeColorPicker":qv(ul),"Editor.closeFind":qv(Kd),"Editor.closeFind2":iS,"Editor.closeRename":qv(ol),"Editor.closeSourceAction":qv(cl),"Editor.closeWidget2":rS,"Editor.compositionEnd":qv(wl),"Editor.compositionStart":qv(hl),"Editor.compositionUpdate":qv(ml),"Editor.contextMenu":qv(ng),"Editor.copy":qv(xl),"Editor.copyLineDown":qv(Il),"Editor.copyLineUp":qv(Sl),"Editor.create":Ga,"Editor.create2":ps,"Editor.cursorCharacterLeft":qv(gu),"Editor.cursorCharacterRight":qv(Eu),"Editor.cursorDown":qv(Su),"Editor.cursorEnd":qv(ku),"Editor.cursorHome":qv(vu),"Editor.cursorLeft":qv(gu),"Editor.cursorRight":qv(Eu),"Editor.cursorSet":qv(Cu),"Editor.cursorUp":qv(Lu),"Editor.cursorWordLeft":qv(Pu),"Editor.cursorWordPartLeft":qv(Fu),"Editor.cursorWordPartRight":qv(Wu),"Editor.cursorWordRight":qv(Tu),"Editor.cut":qv(Ou),"Editor.deleteAll":qv(Bu),"Editor.deleteAllLeft":qv(Yu),"Editor.deleteAllRight":qv(ju),"Editor.deleteCharacterLeft":qv(qu),"Editor.deleteCharacterRight":qv(Gu),"Editor.deleteHorizontalRight":qv(Vu),"Editor.deleteLeft":qv(qu),"Editor.deleteRight":qv(Gu),"Editor.deleteWordLeft":qv(Xu),"Editor.deleteWordPartLeft":qv(Zu),"Editor.deleteWordPartRight":qv(Ku),"Editor.deleteWordRight":qv(Qu),"Editor.diff2":id,"Editor.dispose":fd,"Editor.executeWidgetCommand":qv(PI),"Editor.findAllReferences":qv(Ju),"Editor.format":qv(sf),"Editor.getCommandIds":es,"Editor.getDiagnostics":lS,"Editor.getKeyBindings":fS,"Editor.getKeys":hS,"Editor.getLanguageId":QI,"Editor.getLines2":oS,"Editor.getMenuEntries":pS,"Editor.getMenuEntries2":pS,"Editor.getMenuIds":yS,"Editor.getOffsetAtCursor":JI,"Editor.getPositionAtCursor":ZI,"Editor.getProblems":xS,"Editor.getQuickPickMenuEntries":IS,"Editor.getSelections":SS,"Editor.getSelections2":sS,"Editor.getSourceActions":dS,"Editor.getText":kS,"Editor.getUri":KI,"Editor.getWordAt":lf,"Editor.getWordAt2":tS,"Editor.getWordAtOffset2":nS,"Editor.getWordBefore":uf,"Editor.getWordBefore2":eS,"Editor.goToDefinition":qv(Bh),"Editor.goToTypeDefinition":qv(Yh),"Editor.handleBeforeInput":qv(CS),"Editor.handleBeforeInputFromContentEditable":qv(_g),"Editor.handleBlur":qv(vd),"Editor.handleClickAtPosition":qv(Jh),"Editor.handleContextMenu":qv(ng),"Editor.handleDoubleClick":qv(rg),"Editor.handleFocus":qv(ig),"Editor.handleKeyUp":qv(gg),"Editor.handleMouseDown":qv(vg),"Editor.handleMouseMove":qv(Hg),"Editor.handleMouseMoveWithAltKey":qv(Dg),"Editor.handleNativeSelectionChange":Yg,"Editor.handlePointerCaptureLost":qv($g),"Editor.handlePointerDown":qv(Vg),"Editor.handlePointerMove":qv(lm),"Editor.handlePointerUp":qv(um),"Editor.handleScrollBarClick":ym,"Editor.handleScrollBarHorizontalMove":qv(hm),"Editor.handleScrollBarHorizontalPointerDown":qv(gm),"Editor.handleScrollBarMove":qv(wm),"Editor.handleScrollBarPointerDown":qv(ym),"Editor.handleScrollBarVerticalMove":qv(pm),"Editor.handleScrollBarVerticalPointerDown":qv(ym),"Editor.handleScrollBarVerticalPointerMove":qv(pm),"Editor.handleSingleClick":qv(Eg),"Editor.handleTab":qv(AS),"Editor.handleTouchEnd":qv(Em),"Editor.handleTouchMove":qv(Cm),"Editor.handleTouchStart":qv(Im),"Editor.handleTripleClick":qv(Sg),"Editor.handleWheel":qv(bm),"Editor.hotReload":OS,"Editor.indendLess":qv(Am),"Editor.indentMore":qv(Pm),"Editor.insertLineBreak":qv(Dm),"Editor.loadContent":qv(mk),"Editor.moveLineDown":qv(wk),"Editor.moveLineUp":qv(pk),"Editor.moveRectangleSelection":qv(jg),"Editor.moveRectangleSelectionPx":qv(qg),"Editor.moveSelection":qv(rm),"Editor.moveSelectionPx":qv(dm),"Editor.offsetAt":zr,"Editor.openCodeGenerator":qv(zm),"Editor.openColorPicker":qv(ll),"Editor.openCompletion":qv(Vm),"Editor.openFind":qv(ew),"Editor.openFind2":qv(nw),"Editor.openRename":qv(rw),"Editor.organizeImports":qv(aw),"Editor.paste":qv(lw),"Editor.pasteText":qv(dw),"Editor.redo":qv(uw),"Editor.render":Ov,"Editor.render2":Cv,"Editor.renderEventListeners":Bv,"Editor.replaceRange":qv(Cd),"Editor.rerender":qv(dI),"Editor.resize":qv(bi),"Editor.save":qv(Ew),"Editor.saveState":ss(Nv),"Editor.selectAll":qv(xw),"Editor.selectAllLeft":qv(kw),"Editor.selectAllOccurrences":qv(Aw),"Editor.selectAllRight":qv(Fw),"Editor.selectCharacterLeft":qv(Ww),"Editor.selectCharacterRight":qv(Tw),"Editor.selectDown":qv(Dw),"Editor.selectInsideString":qv(Bw),"Editor.selectionGrow":qv(Hw),"Editor.selectLine":qv(Ig),"Editor.selectNextOccurrence":qv(Yw),"Editor.selectPreviousOccurrence":qv($w),"Editor.selectUp":qv(jw),"Editor.selectWord":qv(cg),"Editor.selectWordLeft":qv(qw),"Editor.selectWordRight":qv(Gw),"Editor.setDebugEnabled":qv(Uv),"Editor.setDecorations":qv(Xw),"Editor.setDelta":qv(vm),"Editor.setDeltaY":qv(Sm),"Editor.setLanguageId":qv(Zw),"Editor.setSelections":qv(Kw),"Editor.setSelections2":cS,"Editor.setText":qv(Qw),"Editor.showHover":ip,"Editor.showHover2":cp,"Editor.showSourceActions":qv(gp),"Editor.showSourceActions2":qv(gp),"Editor.showSourceActions3":qv(gp),"Editor.sortLinesAscending":qv(Ep),"Editor.tabCompletion":qv(bp),"Editor.terminate":e,"Editor.toggleBlockComment":qv(Tp),"Editor.toggleComment":qv(Np),"Editor.toggleLineComment":qv(Bp),"Editor.type":qv(Hp),"Editor.typeWithAutoClosing":qv(oy),"Editor.undo":qv(cy),"Editor.unIndent":qv(ry),"Editor.updateDebugInfo":jv,"Editor.updateDiagnostics":qv(qa),"EditorCompletion.close":Ty,"EditorCompletion.closeDetails":Ry,"EditorCompletion.focusFirst":Dy,"EditorCompletion.focusIndex":Oy,"EditorCompletion.focusNext":Ny,"EditorCompletion.focusPrevious":Hy,"EditorCompletion.handleEditorBlur":zy,"EditorCompletion.handleEditorClick":Uy,"EditorCompletion.handleEditorDeleteLeft":_y,"EditorCompletion.handleEditorType":Yy,"EditorCompletion.handlePointerDown":$y,"EditorCompletion.handleWheel":Vy,"EditorCompletion.openDetails":jy,"EditorCompletion.selectCurrent":qy,"EditorCompletion.selectIndex":Gy,"EditorCompletion.toggleDetails":Xy,"EditorRename.accept":cI,"EditorRename.close":rI,"EditorRename.handleInput":iI,"EditorSourceAction.close":pI,"EditorSourceAction.closeDetails":yI,"EditorSourceAction.focusFirst":EI,"EditorSourceAction.focusIndex":xI,"EditorSourceAction.focusNext":SI,"EditorSourceAction.focusPrevious":kI,"EditorSourceAction.handleWheel":vI,"EditorSourceAction.selectCurrent":CI,"EditorSourceAction.selectIndex":bI,"EditorSourceAction.selectItem":MI,"EditorSourceAction.toggleDetails":AI,"EditorSourceActions.focusNext":uI,"ExtensionHostManagement.activateByEvent":Vo,"FindWidget.close":eE,"FindWidget.focusCloseButton":oE,"FindWidget.focusFind":sE,"FindWidget.focusNext":cE,"FindWidget.focusNextElement":rE,"FindWidget.focusNextMatchButton":iE,"FindWidget.focusPrevious":aE,"FindWidget.focusPreviousElement":dE,"FindWidget.focusPreviousMatchButton":lE,"FindWidget.focusReplace":uE,"FindWidget.focusReplaceAllButton":fE,"FindWidget.focusReplaceButton":hE,"FindWidget.focusToggleReplace":gE,"FindWidget.handleBlur":mE,"FindWidget.handleClickButton":wE,"FindWidget.handleFocus":pE,"FindWidget.handleInput":yE,"FindWidget.handleReplaceFocus":EE,"FindWidget.handleReplaceInput":xE,"FindWidget.handleToggleReplaceFocus":IE,"FindWidget.loadContent":Jm,"FindWidget.replace":SE,"FindWidget.replaceAll":kE,"FindWidget.toggleMatchCase":vE,"FindWidget.toggleMatchWholeWord":CE,"FindWidget.togglePreserveCase":bE,"FindWidget.toggleReplace":ME,"FindWidget.toggleUseRegularExpression":AE,"Font.ensure":uS,"HandleMessagePort.handleMessagePort":bS,"Hover.getHoverInfo":_E,"Hover.handleSashPointerDown":$E,"Hover.handleSashPointerMove":VE,"Hover.handleSashPointerUp":jE,"Hover.loadContent":YE,"Hover.render":tI,"Initialize.initialize":US,"Listener.register":yk,"Listener.registerListener":Si,"Listener.unregister":_v,"SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker":Hv,"SendMessagePortToExtensionManagementWorker.sendMessagePortToExtensionManagementWorker":zv};for(const[t,n]of Object.entries(Gv)){if(t.startsWith("Editor.")){Gv["EditorText"+t.slice("Editor".length)]=n}}const Xv=async()=>{const t=await On({commandMap:{},send(t){return Ao(t,Ze)}});uo(t)};const Zv=async()=>{const t="HandleMessagePort.handleMessagePort2";const n=await On({commandMap:{},async send(n){await Hv(n,t,Ze)}});return n};const Kv=async()=>{const t=await Zv();Ia(t)};const Qv=async()=>{const t=await On({commandMap:{},async send(t){await Oo(t,Ze)}});return t};const Jv=async()=>{try{const t=await Qv();wo(t)}catch{}};const tC=t=>Mo(t);const nC=async()=>{const t=await On({commandMap:{},send:tC});Eo(t)};const eC=async()=>{const t=await Nn({commandMap:Gv});Co(t)};const oC=t=>Do(t);const sC=async()=>{const t=await On({commandMap:{},send:oC});So(t)};const cC=async()=>{os(Gv);await Promise.all([eC(),Xv(),Kv(),Jv(),sC(),nC()])};const rC="CodeGeneratorInput";const iC=t=>{const n=oh();const e=sh();return[{childCount:2,className:ev(gx,XE),type:Hx},{childCount:0,className:ev(qE,fx),name:rC,placeholder:e,type:zx},{childCount:1,className:GE,type:Hx},$x(n)]};const aC={apply(t,n){const e=iC();return[by,n.uid,e]},isEqual:(t,n)=>t.questions===n.questions};const dC={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[ky,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={apply:(t,n)=>[py,".CodeGeneratorInput",n.focusSource],isEqual:(t,n)=>t.focused===n.focused&&t.focusSource===n.focusSource};const uC=[aC,dC,lC];const fC=(t,n)=>{const e=[];for(const o of uC){if(!o.isEqual(t,n)){e.push(o.apply(t,n))}}return e};const hC=t=>{const n=fC(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(t[0]===by){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const gC=t=>ay(t,"EditorCodeGenerator",hC);const mC=fI;const wC={__proto__:null,add:gC,remove:mC,render:hC};const pC=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const yC=[by,Cy,wy,yy,vy,Ey,My];const EC=t=>{const n=pC(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(yC.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const xC=t=>ay(t,"ColorPicker",EC);const IC=fI;const SC={};const kC={__proto__:null,Commands:SC,add:xC,remove:IC,render:EC};const vC=t=>{const n=[{childCount:2,className:"Viewlet EditorCompletionDetails",type:Hx},{childCount:1,className:JE,type:Hx},$x(t),{childCount:1,className:QE,onClick:px,type:Hx},{childCount:0,className:`${hx} ${ux}`,type:Hx}];return n};const CC=(t,n,e)=>{const o=[];for(const s of t){if(!s.isEqual(n,e)){o.push(s.apply(n,e))}}return o};const bC={apply(t,n){const e=vC(n.content);return[by,n.uid,e]},isEqual:(t,n)=>t.content===n.content};const MC={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[ky,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height};const AC=[bC,MC];const LC=(t,n)=>CC(AC,t,n);const PC=(t,n)=>{const{widgets:e}=t;for(const t of e){if(t.id===n){return t.newState}}return undefined};const FC=t=>PC(t,Re);const WC=t=>{const n=LC(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(t[0]===by){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const TC=t=>ay(t,"EditorCompletionDetails",WC);const RC=fI;const DC=(t,n)=>{const e=FC(t);if(!e){return t}const{x:o}=ow(t);const s=o+e.width-n.borderSize;return{...n,x:s}};const OC=(t,n)=>DC(t,n);const BC=(t,n)=>DC(t,n);const NC={__proto__:null,add:TC,handleEditorDeleteLeft:BC,handleEditorType:OC,remove:RC,render:WC};const HC=[by,Cy,wy,vy,Ey,xy,Iy,Sy,My,"Viewlet.focusSelector"];const zC=t=>{const n=Ay(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(HC.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const UC=t=>ay(t,"EditorCompletion",zC);const _C=t=>[["Viewlet.dispose",t.newState.uid]];const{close:YC}=my(["close"],"",Be);const $C={__proto__:null,add:UC,close:YC,remove:_C,render:zC};const VC=t=>{const{message:n,uid:e,x:o,y:s}=t.newState;const c=[{childCount:1,className:"Viewlet EditorMessage EditorMessageText EditorOverlayMessage",style:`left:${o}px;top:${s}px;`,type:Hx},$x(n)];return[[by,e,c]]};const jC=t=>ay(t,"EditorMessage",VC);const qC={__proto__:null,add:jC,remove:_C,render:VC};const GC=()=>{Os(Te,kC);Os(Re,Zy);Os(De,NC);Os(Oe,LE);Os(Be,$C);Os(Ad,qC);Os(Ne,aI);Os(He,LI);Os(We,wC)};const XC=t=>{t.preventDefault();console.error(`[editor-worker] Unhandled Rejection: ${t.reason}`)};const ZC=(t,n,e,o,s)=>{console.error(`[editor-worker] Unhandled Error: ${s}`);return true};const KC=t=>{t.addEventListener("error",ZC);t.addEventListener("unhandledrejection",XC)};const QC=async()=>{KC(globalThis);await cC();GC()};QC();