@lvce-editor/editor-worker 19.0.0 → 19.2.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 k=(t,n)=>{if(!n){return t}const e=I(t);const o=I(n);if(o===-1){return t}const s=t.slice(0,e);const c=n.slice(o);const r=y(n.slice(0,o));if(s.includes(r)){return s+c}return n};class S extends Error{constructor(t,n){const e=E(t,n);super(e);this.name="VError";if(t instanceof Error){this.stack=k(this.stack,t.stack)}if(t.codeFrame){this.codeFrame=t.codeFrame}if(t.code){this.code=t.code}}}const C=t=>t&&t instanceof MessagePort;const v=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 L=t=>M(t,"Socket");const A=[C,v,b,L];const F=t=>{for(const n of A){if(n(t)){return true}}return false};const P=(t,n,e)=>{if(!t){return}if(e(t)){n.push(t);return}if(Array.isArray(t)){for(const o of t){P(o,n,e)}return}if(typeof t==="object"){for(const o of Object.values(t)){P(o,n,e)}return}};const W=t=>{const n=[];P(t,n,F);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 B="E_MODULES_NOT_SUPPORTED_IN_ELECTRON";const O="ERR_MODULE_NOT_FOUND";const H="\n";const N=t=>t.join(H);const z=/^\s+at/;const Y=/^\s*at async Promise.all \(index \d+\)$/;const $=t=>z.test(t)&&!Y.test(t);const U=t=>{const n=t.findIndex($);if(n===-1){return{actualMessage:N(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(H);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:O,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:B,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}=U(e);return{code:"",message:o,stack:s}};class rt extends S{constructor(t,n="",e=""){if(n||e){const{code:o,message:s,stack:c}=ct(n,e);const r=new Error(s);r.code=o;r.stack=c;super(r,t)}else{super(t)}this.name="IpcError";this.stdout=n;this.stderr=e}}const it="ready";const at=t=>t.data;const dt=()=>{if(typeof WorkerGlobalScope==="undefined"){throw new TypeError("module is not in web worker scope")}return globalThis};const lt=t=>{t.postMessage(it)};class ut extends R{getData(t){return at(t)}send(t){this._rawIpc.postMessage(t)}sendAndTransfer(t){const n=W(t);this._rawIpc.postMessage(t,n)}dispose(){}onClose(t){}onMessage(t){this._rawIpc.addEventListener("message",t)}}const ft=t=>new ut(t);const ht=async t=>{const{promise:n,resolve:e}=Promise.withResolvers();t.addEventListener("message",e,{once:true});const o=await n;return o.data};const gt=async()=>{const t=dt();lt(t);const n=ft(t);const e=await ht(n);if(e.method!=="initialize"){throw new rt("unexpected first message")}const o=e.params[0];if(o==="message-port"){n.send({id:e.id,jsonrpc:"2.0",result:null});n.dispose();const t=e.params[1];return t}return globalThis};class mt extends R{getData(t){return at(t)}send(t){this._rawIpc.postMessage(t)}sendAndTransfer(t){const n=W(t);this._rawIpc.postMessage(t,n)}dispose(){if(this._rawIpc.close){this._rawIpc.close()}}onClose(t){}onMessage(t){this._rawIpc.addEventListener("message",t);this._rawIpc.start()}}const wt=t=>new mt(t);const pt={__proto__:null,listen:gt,wrap:wt};const yt=(t,n,e)=>{if("addEventListener"in t){t.addEventListener(n,e)}else{t.on(n,e)}};const Et=(t,n,e)=>{if("removeEventListener"in t){t.removeEventListener(n,e)}else{t.off(n,e)}};const xt=(t,n)=>{const{promise:e,resolve:o}=Promise.withResolvers();const s=Object.create(null);const c=e=>{for(const e of Object.keys(n)){Et(t,e,s[e])}o(e)};for(const[e,o]of Object.entries(n)){const n=t=>{c({event:t,type:o})};yt(t,e,n);s[e]=n}return e};const It=3;const kt=async({isMessagePortOpen:t,messagePort:n})=>{if(!C(n)){throw new rt("port must be of type MessagePort")}if(t){return n}const e=xt(n,{message:It});n.start();const{event:o,type:s}=await e;if(s!==It){throw new rt("Failed to wait for ipc message")}if(o.data!==it){throw new rt("unexpected first message")}return n};const St=t=>{t.start()};class Ct 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 vt=t=>new Ct(t);const bt={__proto__:null,create:kt,signal:St,wrap:vt};class Mt extends Error{constructor(t){super(`Command not found ${t}`);this.name="CommandNotFoundError"}}const Lt=Object.create(null);const At=t=>{Object.assign(Lt,t)};const Ft=t=>Lt[t];const Pt=(t,...n)=>{const e=Ft(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 Bt extends Error{constructor(t){super(t);this.name="JsonRpcError"}}const Ot="\n";const Ht="DOMException";const Nt="ReferenceError";const zt="SyntaxError";const Yt="TypeError";const $t=(t,n)=>{if(n){switch(n){case Ht:return DOMException;case Nt:return ReferenceError;case zt:return SyntaxError;case Yt: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 Ut=(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(Ot);const Vt=t=>t.split(Ot);const jt=()=>{const t=3;const n=_t(Vt((new Error).stack||"").slice(t));return n};const qt=(t,n=undefined)=>t.indexOf(Ot,n);const Gt=t=>{let n=t.stack||t.data||t.message||"";if(n.startsWith(" at")){n=t.message+Ot+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+Ot+n}return t}if(t&&t.code&&t.code===Xt){const e=new Bt(t.message);const o=Gt(t);e.stack=o+Ot+n;return e}if(t&&t.message){const e=Ut(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+Ot+t.data.stack+Ot+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 Bt("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 Bt("unexpected message")};const En="2.0";const xn=(t,n)=>({jsonrpc:En,method:t,params:n});const In=(t,n,e)=>{const o={id:t,jsonrpc:En,method:n,params:e};return o};let kn=0;const Sn=()=>++kn;const Cn=t=>{const n=Sn();const{promise:e,resolve:o}=Promise.withResolvers();t[n]=o;return{id:n,promise:e}};const vn=async(t,n,e,o,s)=>{const{id:c,promise:r}=Cn(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 vn(n,t,e,o,false)},invokeAndTransfer(e,...o){return vn(n,t,e,o,true)},ipc:t,send(n,...e){const o=xn(n,e);t.send(o)}};return e};const Mn=()=>false;const Ln=t=>t;const An=()=>{};const Fn=t=>{const n=t?.target?.requiresSocket||Mn;const e=t?.target?.execute||Pt;return yn(t.target,t.data,e,t.target._resolve,Ln,An,n)};const Pn=t=>{if("addEventListener"in t){t.addEventListener("message",Fn)}else if("on"in t){t.on("message",Fn)}};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})=>{At(t);const o=await bt.create({isMessagePortOpen:n,messagePort:e});const s=bt.wrap(o);Pn(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 Bn=async({commandMap:t,isMessagePortOpen:n,send:e})=>Dn(()=>Rn({commandMap:t,isMessagePortOpen:n,send:e}));const On=async({commandMap:t,messagePort:n})=>Tn({commandMap:t,messagePort:n});const Hn=async({commandMap:t})=>{At(t);const n=await Wn(pt);Pn(n);const e=bn(n);return e};const Nn=({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 Yn=(t,n)=>{zn[t]=n};const $n=t=>zn[t];const Un=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=Nn({commandMap:n});Yn(t,e);e[Symbol.dispose]=()=>{Un(t)};return e},set(n){Yn(t,n)}});const Vn=12;const jn=100;const qn="event.altKey";const Gn="event.button";const Xn="event.clientX";const Zn="event.clientY";const Qn="event.deltaMode";const Kn="event.deltaY";const Jn=1;const te=2;const ne=3;const ee=8;const oe=9;const se=255;const ce=12;const re=13;const ie=14;const ae=15;const de=16;const le=18;const ue=29;const fe=31;const he=32;const ge=34;const me=36;const we=38;const pe=39;const ye=40;const Ee=43;const xe=50;const Ie=52;const ke=54;const Se=58;const Ce=59;const ve=60;const be=68;const Me=87;const Le=88;const Ae=90;const Fe=92;const Pe=1;const We=2;const Te=3;const Re=4;const De=5;const Be=6;const Oe=7;const He=8;const Ne=1<<11>>>0;const ze=1<<10>>>0;const Ye=1<<9>>>0;const $e=3;const Ue=22;const _e=1;const Ve=0;const je=301;const qe=55;const Ge=99;const Xe=44;const Ze=9006;const Qe=7009;const Ke=300;const Je=4561;const to=1;const no="Viewlet.focusSelector";const eo="Viewlet.setCss";const oo="Viewlet.setFocusContext";const so="Viewlet.setPatches";const co=12;const{invoke:ro,set:io}=_n(Xe);const ao={__proto__:null,invoke:ro,set:io};const{invoke:lo,set:uo}=_n(Ze);const fo=(t,n)=>lo("Extensions.getLanguages",t,n);const{invoke:ho,set:go}=_n(Je);const mo=async(t,n)=>ho("Open.openUrl",t,n);const{invoke:wo,set:po}=_n(Qe);const{invoke:yo,invokeAndTransfer:Eo,set:xo}=_n(to);const Io=async(t,n,e,o,s)=>{g(t);g(n);g(e);g(o);await yo("ContextMenu.show2",t,n,e,o,s)};const ko=async(t,n)=>{const e="HandleMessagePort.handleMessagePort";await Eo("SendMessagePortToExtensionHostWorker.sendMessagePortToOpenerWorker",t,e,n)};const So=async t=>yo("FileSystem.readFile",t);const Co=async()=>yo("Layout.handleWorkspaceRefresh");const vo=async(t,n=0)=>{const e="HandleMessagePort.handleMessagePort2";await Eo("SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker",t,e,n)};const bo=async t=>{await yo("ClipBoard.writeText",t)};const Mo=async()=>yo("ClipBoard.readText");const Lo=(t,n,e)=>yo("ExtensionHostManagement.activateByEvent",t,n,e);const Ao=async t=>{const n="TextMeasurement.handleMessagePort";await Eo("SendMessagePortToExtensionHostWorker.sendMessagePortToTextMeasurementWorker",t,n,0)};const Fo=async(t,n)=>{const e="Extensions.handleMessagePort";await Eo("SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker",t,e,n)};const Po=async t=>await yo("Preferences.get",t);const Wo=async(t,n,e)=>{await yo("Main.openUri",t,n,e)};const To=async t=>{await Eo("SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker",t,"HandleMessagePort.handleMessagePort2")};const Ro={__proto__:null,activateByEvent:Lo,getPreference:Po,handleWorkspaceRefresh:Co,invoke:yo,invokeAndTransfer:Eo,openUri:Wo,readClipBoardText:Mo,readFile:So,sendMessagePortToExtensionHostWorker:vo,sendMessagePortToExtensionManagementWorker:Fo,sendMessagePortToOpenerWorker:ko,sendMessagePortToSyntaxHighlightingWorker:To,sendMessagePortToTextMeasurementWorker:Ao,set:xo,showContextMenu2:Io,writeClipBoardText:bo};const{invoke:Do,set:Bo}=_n(Ke);const Oo={__proto__:null,invoke:Do,set:Bo};const Ho=t=>{let n;let e;const o=async()=>{const n=await e();Yn(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 No=async(t,n,e)=>{w(t);await Lo(t,n,e)};const zo=t=>t;const Yo=6;const $o=async(t,n,e)=>{const o=await Rn({commandMap:{},isMessagePortOpen:true,async send(e){await Eo("IpcParent.create",{method:Yo,name:t,port:e,raw:true,url:n})}});if(e){await o.invoke(e)}return o};const Uo=async()=>{const t="Color Picker Worker";const n="colorPickerWorkerMain.js";return $o(t,n)};const _o={};const Vo=()=>{if(!_o.workerPromise){_o.workerPromise=Uo()}return _o.workerPromise};const jo=async(t,...n)=>{const e=await Vo();return await e.invoke(t,...n)};const qo=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;await jo("ColorPicker.create",o,c,r,s,e,n);await jo("ColorPicker.loadContent",o);const i=await jo("ColorPicker.diff2",o);const a=await jo("ColorPicker.render2",o,i);return{...t,commands:a}};const Go=n();const{getCommandIds:Xo,registerCommands:Zo,wrapGetter:Qo}=Go;const Ko=t=>Go.get(t);const Jo=()=>{const t=Go.getKeys();return t.map(String)};const ts=(t,n,e)=>{Go.set(t,n,e)};const ns=[];const es=41;const os=9;const ss=0;const cs=16;const rs=51;const is=11;const as=38;const ds=52;const ls=(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:ss,fontFamily:"",fontSize:0,fontWeight:0,handleOffset:0,handleOffsetX:0,height:c,highlightedLine:-1,id:t,incrementalEdits:ns,initial:true,invalidStartIndex:0,isAutoClosingBracketsEnabled:false,isAutoClosingQuotesEnabled:false,isAutoClosingTagsEnabled:false,isMonospaceFont:false,isQuickSuggestionsEnabled: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,selectionInfos:[],selections:new Uint32Array,tabSize:0,textInfos:[],tokenizerId:0,uid:t,undoStack:[],uri:n,validLines:[],visualDecorations:[],widgets:[],width:s,x:e,y:o};ts(t,a,a)};const us="compositionUpdate";const fs="contentEditableInput";const hs="delete";const gs="deleteHorizontalRight";const ms="deleteLeft";const ws="editorCut";const ps="editorPasteText";const ys="editorSnippet";const Es="editorType";const xs="editorTypeWithAutoClosing";const Is="format";const ks="indentLess";const Ss="indentMore";const Cs="insertLineBreak";const vs="lineComment";const bs="rename";const Ms="toggleBlockComment";const Ls=Object.create(null);const As=(t,n)=>{Ls[t]=n};const Fs=t=>Ls[t];const Ps=t=>Fs(t);const Ws=async(t,n,e)=>{const o=Ps(n.id);if(e.length===1&&e[0].origin===Es&&o.handleEditorType){const n=await o.handleEditorType(t);return{...n}}if(e.length===1&&e[0].origin===ms&&o.handleEditorDeleteLeft){const n=await o.handleEditorDeleteLeft(t);return{...n}}return n};const Ts=async(t,n)=>{const e=t.widgets||[];if(e.length===0){return e}let o=t;for(const s of e){o=await Ws(t,s,n)}return o};const Rs=(t,n,e)=>{g(t);g(n);g(e);return Math.min(Math.max(t,n),e)};const Ds="Link";const Bs="Function";const Os="Parameter";const Hs="Type";const Ns="VariableName";const zs="Class";const Ys=1;const $s=2816;const Us=2817;const _s=2824;const Vs=2825;const js=2956;const qs=2857;const Gs=3072;const Xs=3073;const Zs=3077;const Qs=3088;const Ks=1792;const Js=1793;const tc=512;const nc=513;const ec=769;const oc=1024;const sc=1536;const cc=1537;const rc=1544;const ic=1545;const ac=2048;const dc=2049;const lc=2056;const uc=2057;const fc=2064;const hc=2080;const gc=2081;const mc=2088;const wc=2089;const pc=2313;const yc=2560;const Ec=2561;const xc=2569;const Ic=2584;const kc=256;const Sc=257;const Cc=272;const vc=t=>{switch(t){case Ys:return Ds;case oc:case sc:case cc:case rc:case ic:case tc:case nc:case ec:return Hs;case Ks:case Js:return Os;case ac: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:return Ns;case kc:case Sc:case Cc:return zs;case $s:case Us:case _s:case Vs:case js:case qs:case Gs:case Xs:case Zs:case Qs:return Bs;default:return`Unknown-${t}`}};const bc=t=>structuredClone(t);const Mc=t=>bc(t);const Lc={warned:[]};const Ac=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 Pc=(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=Ac(c.tokens)}return c}catch(t){console.error(t);return{lineState:o,tokens:[0,e.length]}}};const Wc={TopLevelContent:1};const Tc={Text:1};const Rc={[Tc.Text]:"Text"};const Dc={state:Wc.TopLevelContent};const Bc=true;const Oc=(t,n)=>({state:n.state,tokens:[Tc.Text,t.length]});const Hc={__proto__:null,State:Wc,TokenMap:Rc,TokenType:Tc,hasArrayReturn:Bc,initialLineState:Dc,tokenizeLine:Oc};const Nc={enabled:false};const zc=t=>{Nc.enabled=t};const Yc=()=>Nc.enabled;const{invoke:$c,set:Uc}=Oo;const _c={pending:Object.create(null),tokenizePaths:Object.create(null),tokenizers:Object.create(null)};const Vc=t=>Object.hasOwn(_c.tokenizers,t);const jc=(t,n)=>{_c.tokenizers[t]=n};const qc=t=>_c.tokenizers[t];const Gc=(t,n)=>{_c.tokenizePaths[t]=n};const Xc=t=>_c.tokenizePaths[t]||"";const Zc=t=>{for(const n of t){if(n&&n.id&&n.tokenize){Gc(n.id,n.tokenize)}}};const Qc=t=>Object.hasOwn(_c.pending,t);const Kc=Object.create(null);const Jc=(t,n)=>{Kc[t]=n};const tr=t=>Kc[t]||{};const nr=async(t,n)=>{if(!n){return}Gc(t,n);if(Yc()){const e=await $c("Tokenizer.load",t,n);Jc(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}Jc(t,e.TokenMap);jc(t,e)}catch(t){console.error(t)}};const er=t=>{if(Vc(t)){return qc(t)}if(Qc(t)){return Hc}return Hc};const or=Object.create(null);const sr=(t,n)=>{or[t]=n};const cr=t=>or[t]||Hc;const rr=(t,n,e,o,s,c,r)=>{const i=er(e);if(o!==n.length&&i&&i!==Hc){const a=o===0&&s===n.length;const d=n.slice(o,s);const l=Pc(t,i.tokenizeLine,d,c[e]||Mc(i.initialLineState),i.hasArrayReturn);c[e]=l;if(l.embeddedLanguage){const n=rr(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 ir=(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(rr(t,a,n,i,e,r,s))}}else{for(const t of Object.keys(r)){r[t]=undefined}}}return{embeddedResults:c,tokenizersToLoad:s}};const ar=(t,n,e)=>t<n?n:e;const dr=(t,n,e)=>{const{invalidStartIndex:o,languageId:s,lineCache:c,lines:r,tokenizerId:i}=t;const a=cr(i);const{hasArrayReturn:d,initialLineState:l,tokenizeLine:u}=a;const f=o;const h=ar(o,e,f);const g=[];const m=[];const w=[];for(let t=f;t<h;t++){const n=t===0?Mc(l):c[t];const e=r[t];const o=Pc(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}=ir(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 lr=Object.create(null);const ur=async(t,n,e,o)=>{if(Yc()){if(o){const{id:o,invalidStartIndex:s,languageId:c,lines:r}=t;let i=true;let a=r;if(lr[o]===r){i=false;a=[]}else{lr[o]=r}const d={invalidStartIndex:s,languageId:c};return $c("GetTokensViewport.getTokensViewport",d,n,e,i,o,a)}return $c("GetTokensViewport.getTokensViewport",t,n,e,true,t.id,t.lines)}return dr(t,n,e)};const fr=async t=>{for(const n of t){const t=Xc(n);await nr(n,t)}};const hr=".";const gr='"';const mr="";const wr="\n";const pr=" ";const yr="\t";const Er=(t,n,e)=>{if(n){return t.replaceAll(yr,()=>pr.repeat(e))}return t};const xr=t=>t.includes(yr);const Ir=(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);Ir(t,n,o);return s};const Sr=t=>t.join("\n");const Cr=/^\s+/;const vr=t=>{const n=t.match(Cr);if(!n){return""}return n[0]};const br=(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 Mr=(t,n)=>t.lines[n];const Lr=t=>Sr(t.lines);const Ar=(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 Pr=(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)=>{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 Tr=10;const Rr=(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 Dr=(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 Or=(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=vc(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}=Rr(m,l);const I=Nr(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=Dr(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=Er(a,c,r);f.push(l,d);t=i}}else{const t=e.slice(E,s);const o=`Token ${w[n]||"Unknown"}`;const i=Er(t,c,r);f.push(i,o)}E=s;y=s;if(y>=u){break}}return{difference:I,lineInfo:f}};const Hr=(t,n,e)=>{if(t===0){return{maxOffset:Math.ceil(n/e),minOffset:0}}const o=Math.ceil(t/e);const s=o+Math.ceil(n/e);return{maxOffset:s,minOffset:o}};const Nr=(t,n,e)=>{const o=t*n;const s=o-e;return s};const zr=(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=vc(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}=Rr(m,u);const E=Nr(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=Dr(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=Er(d,r,i);h.push(u,l);n=a}}else{const n=t.slice(p,c);const o=`Token ${s[e]||"Unknown"}`;const a=Er(n,r,i);h.push(a,o)}p=c;w=c;if(w>=f){break}}return{difference:E,lineInfo:h}};const Yr=(t,n,e,o,s,c,r,i,a,d,l)=>{const{maxOffset:u,minOffset:f}=Hr(d,a,l);if(e.length>0&&n.embeddedResultIndex!==undefined){const s=e[n.embeddedResultIndex];if(s?.isFull){return Or(e,n,t,o,c,r,i,a,d,l,f,u)}}return zr(t,n,e,o,s,c,r,i,a,d,l,f,u)};const $r=(t,n,e,o,s,c,r,i,a)=>{const d=[];const l=[];const{decorations:u,languageId:f,lines:h}=t;const g=tr(f);let m=c;const w=2;for(let t=o;t<s;t++){const s=h[t];const c=xr(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}=Yr(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 Ur=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 ur(t,c,a,n);for(let e=0;l.length>0&&e<Tr;e++){await fr(l);const e=await ur(t,c,a,n);({embeddedResults:d,tokenizersToLoad:l,tokens:u}=e)}const f=await Fr(t,c,0);const h=e;const{differences:g,result:m}=$r(t,u,d,c,a,f,i,o,h);return{differences:g,textInfos:m}};const _r=(t,n,e,o)=>{const s=t/n*(e-o);if(!Number.isFinite(s)){return 0}return s};const Vr=_r;const jr=(t,n,e)=>{if(t>=n){return 0}return Math.max(Math.round(t**2/n),e)};const qr=(t,n)=>{if(t>n){return 0}return t**2/n};const Gr=(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 Xr={enabled:false};const Zr=t=>{Xr.enabled=t};const Qr=()=>Xr.enabled;const Kr=async(t,n)=>{h(t);g(n);const{deltaY:e,finalDeltaY:o,height:s,itemHeight:c,numberOfVisibleLines:r,scrollBarHeight:i}=t;const a=Rs(n,0,o);if(e===a){return t}const d=Math.floor(a/c);const l=d+r;const u=Vr(a,o,s,i);const f={...t,deltaY:a,maxLineY:l,minLineY:d,scrollBarY:u};const m=Qr();const{differences:w,textInfos:p}=await Ur(f,m);const y={...f,differences:w,textInfos:p};return y};const Jr=async(t,n)=>{if(!n.undoStack){return ns}if(t.undoStack===n.undoStack){return ns}const e=n.undoStack.at(-1);if(e&&e.length===1){const o=e[0];if(o.origin===Es){const{rowIndex:e}=o.start;const{lines:s}=n;const c=t.lines[e];const r=s[e];const i=await $c("TokenizeIncremental.tokenizeIncremental",n.uid,n.languageId,c,r,e,n.minLineY);if(i&&i.length===1){return i}}}return ns};const ti=(t,n)=>t.matchAll(n).toArray();const ni=/(?:https?|ftps?|file):\/\/[^\s"']+|www\.[^\s"']+/g;const ei=/^(?:https?|ftp|ftps|file):\/\//;const oi=/^www\./;const si=t=>{const n=ti(t,ni);const e=[];for(const t of n){const n=t[0];if(ei.test(n)||oi.test(n)){e.push({length:n.length,start:t.index??0})}}return e};const ci=t=>{const n=[];const{lines:e}=t;let o=0;for(const t of e){const e=si(t);for(const t of e){const e=o+t.start;n.push(e,t.length,Ys,0)}o+=t.length+1}return n};const ri=(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===Ys&&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 ii=1;const ai=Object.create(null);const di=(t,n)=>{g(t);g(n);if(!Object.hasOwn(ai,t)){ai[t]=[]}if(!ai[t].includes(n)){ai[t].push(n)}};const li=(t,n)=>{g(t);g(n);if(Object.hasOwn(ai,t)){const e=ai[t].indexOf(n);if(e!==-1){ai[t].splice(e,1)}}};const ui=t=>{g(t);return ai[t]||[]};const fi=async(t,n,...e)=>{g(t);w(n);const o=ui(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 hi=(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=jr(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 gi=t=>{if(!t){return[""]}return t.split("\n")};const{invoke:mi}=Ro;const wi=async t=>{try{await mi("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 yi=t=>{let n=0;for(const e of t){if(e===yr){n++}}return n};const Ei=/^\p{ASCII}*$/u;const xi=t=>Ei.test(t);const Ii=async(t,n)=>t.length*n;const ki=async(t,n,e,o,s,c,r)=>{const i=await wo("TextMeasurement.measureTextWidth",t,n,e,o,s,c,r);return i};const Si=async(t,n,e,o,s,c,r)=>{if(c&&xi(t)){return await Ii(t,r)}return await ki(t,n,e,o,s,c,r)};const Ci=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=xr(t);const h=Er(t,f,i);const m=yi(t.slice(0,n));const y=h.slice(0,n+m);const E=await Si(y,e,o,s,r,c,l);return E-a+u};const vi=(t,n,e)=>(t-n)*e;const bi=t=>`${t}px`;const Mi=(t,n,e,o)=>new Uint32Array([t,n,e,o]);const Li=t=>new Uint32Array(t);const Ai=t=>Li(t.length);const Fi=(t,n)=>{const e=Ai(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 Pi=(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 Wi=(t,n,e,o)=>{t[n]=t[n+2]=e;t[n+1]=t[n+3]=o};const Ti=(t,n,e,o)=>t===e&&n===o;const Ri=(t,n,e,o)=>t===e;const Di=(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 Bi=t=>Di(t,Ti);const Oi=t=>Di(t,Ri);const Hi=(t,n)=>{const e=Li(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 Ni=[];const zi=(t,n)=>{if(!n){return Ni}const e=[];for(let n=0;n<t.length;n+=2){const o=t[n];const s=t[n+1];e.push(`${bi(o)} ${bi(s)}`)}return e};const Yi=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(bi(o),bi(s),bi(c),bi(r))}return n};const $i=async t=>{const n=[];const e=[];const{charWidth:o,cursorWidth:s,differences:c,focused:r,fontFamily:i,fontSize:a,fontWeight:d,isMonospaceFont:l,letterSpacing:u,lines:f,maxLineY:h,minLineY:g,rowHeight:m,selections:w,tabSize:p,width:y}=t;const E=o;const x=s/2;for(let t=0;t<w.length;t+=4){const[o,s,r,I,k]=pi(w,t);if(r<g||o>h){continue}const S=r-g;const C=c[S];const v=f[r];const b=await Ci(v,I,d,a,i,l,u,p,x,y,E,C);const M=vi(r,g,m);if(Ti(o,s,r,I)&&b>0){n.push(b,M);continue}const L=vi(o,g,m);const A=o-g;const F=c[A];if(o===r){const t=await Ci(v,s,d,a,i,l,u,p,x,y,E,F);if(k){n.push(t,M)}else if(b>=0){n.push(b,M)}const o=b-t;e.push(t,L,o,m)}else{if(o>=g){const t=f[o];const c=await Ci(t,s,d,a,i,l,u,p,x,y,E,F);const r=await Ci(t,t.length,d,a,i,l,u,p,x,y,E,F);const h=vi(o,g,m);const w=r-c;if(k){n.push(c,h)}e.push(c,h,w,m)}const t=Math.max(o+1,g);const w=Math.min(r,h);for(let n=t;n<w;n++){const t=f[n];const o=vi(n,g,m);const s=n-g;const r=c[s];const h=await Ci(t,t.length,d,a,i,l,u,p,x,y,E,r);e.push(0,o,h,m)}if(r<=h){const t=b;e.push(0,M,t,m);if(!k){n.push(t,M)}}}}return{cursorInfos:zi(n,r),selectionInfos:Yi(e)}};const Ui=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 _i=(t,n)=>{h(t);return{...t,selections:n}};const Vi=(t,n)=>{h(t);m(n);const e=Hi(n,Ui);return e};const ji=(t,n)=>Kr(t,n);const qi=(t,n)=>ji(t,t.deltaY+n);const Gi=t=>t.origin===xs;const Xi=(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(Gi(s)){o.push(c,r+1,i,a+1)}return o};const Zi=(t,n)=>_i(t,n);const Qi=async(t,n,e=undefined)=>{h(t);m(n);if(n.length===0){return t}const o=br(t,n);const s={...t,lines:o};const c=e||Vi(s,n);const r=Math.min(t.invalidStartIndex,n[0].start.rowIndex);const i=Xi(t,n);const a={...s,autoClosingRanges:i,invalidStartIndex:r,lines:o,modified:true,redoStack:[],selections:c,undoStack:[...t.undoStack,n]};const d=ci(a);const l={...a,decorations:d};ts(t.uid,t,l);if(!t.modified){await wi(t.uri)}try{await fi(ii,"handleEditorChanged",t.uid,t.uri,n)}catch(t){console.warn("Failed to notify editor change listeners:",t)}const u=await Jr(t,l);const f=await Ts(l,n);const g={...l,...f,incrementalEdits:u};if(u!==ns){return g}const w=Qr();const{differences:p,textInfos:y}=await Ur(g,w);return{...g,differences:p,textInfos:y}};const Ki=async(t,n)=>{h(t);m(n);if(n.length===0){return t}const e=br(t,n);const o={...t,lines:e};const s=Vi(o,n);const c=Math.min(t.invalidStartIndex,n[0].start.rowIndex);const r={...o,invalidStartIndex:c,lines:e,selections:s};const i=await Jr(t,r);const a={...r,incrementalEdits:i};if(i!==ns){return a}const d=Qr();const{differences:l,textInfos:u}=await Ur(a,d);return{...a,differences:l,textInfos:u}};const Ji=async(t,n)=>{const e=br(t,n);const o=n[0].start.rowIndex;const s={...t,invalidStartIndex:o,lines:e,redoStack:[],undoStack:[...t.undoStack,n]};const c=await Jr(t,s);const r={...s,incrementalEdits:c};if(c!==ns){return r}const i=Qr();const{differences:a,textInfos:d}=await Ur(r,i);return{...r,differences:a,textInfos:d}};const ta=t=>t.selections&&t.selections.length>0;const na=(t,n,e,o,s,c)=>hi(t,{height:s,width:o,x:n,y:e},c);const ea=(t,n)=>{const e=gi(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=jr(t.height,l,s);return{...t,finalDeltaY:d,finalY:a,lines:e,maxLineY:i,scrollBarHeight:u}};const oa={cursorInfos:[],debugEnabled:false,decorations:[],deltaX:0,deltaY:0,diagnostics:[],differences:[],embeds:[],focused:false,height:0,highlightedLine:-1,incrementalEdits:ns,languageId:"",lineCache:[],lines:[],longestLineWidth:0,maxLineY:0,minLineY:0,redoStack:[],scrollBarHeight:0,selectionInfos:[],selections:new Uint32Array,textInfos:[],tokenizerId:0,undoStack:[],uri:"",width:0,x:0,y:0};const sa="ExtensionHostHover.execute";const ca="ExtensionHost.executeTabCompletionProvider";const ra="ExtensionHostTextDocument.syncFull";const{invoke:ia,set:aa}=ao;const da=t=>{w(t);return t.lastIndexOf(hr)};const la=(t,n)=>t.lastIndexOf(hr,n);const ua=(t,n)=>{for(const e of t){if(e&&e.extensions&&Array.isArray(e.extensions)&&e.extensions.includes(n)){return e.id}}return""};const fa=(t,n)=>{for(const e of t){if(e&&e.fileNames&&Array.isArray(e.fileNames)&&e.fileNames.includes(n)){return e.id}}return""};const ha=(t,n)=>{w(t);const e=da(t);const o=t.slice(e);const s=o.toLowerCase();const c=ua(n,s);if(c){return c}const r=t.toLowerCase();const i=la(t,e-1);const a=t.slice(i);const d=ua(n,a);if(d){return d}const l=fa(n,r);if(l){return l}return"unknown"};const ga=async(t,n)=>{g(t);w(n);const e=await fo(t,n);return e};const ma=async(t,n,e,o)=>await Si("a",t,n,e,o,false,0);const wa=async t=>{const n=await Po(t);return n};const pa="onDiagnostic";const ya="onHover";const Ea="onTabCompletion";const xa=async({args:t,assetDir:n,editor:e,event:o,method:s,noProviderFoundMessage:c,noProviderFoundResult:r=undefined,platform:i})=>{const a=`${o}:${e.languageId}`;await No(a,n,i);const d=await ia(s,e.uid,...t);return d};const Ia=t=>({documentId:t.id||t.uid,languageId:t.languageId,text:Lr(t),uri:t.uri});const ka=async t=>{const n=Ia(t);return lo("Extensions.executeDiagnosticProvider",n)};const Sa=async t=>{const n=await ka(t);if(n.length>0){return n}const{assetDir:e,platform:o}=t;return xa({args:[],assetDir:e,editor:t,event:pa,method:"ExtensionHost.executeDiagnosticProvider",noProviderFoundMessage:"no diagnostic provider found",platform:o})};const Ca=t=>t.type;const va=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 Ci(d[m],n,r,c,s,i,a,f,E,h,o,y);const I=vi(m,l,u)-u;e.push({height:u,type:Ca(t),width:p,x:x,y:I})}return e};const ba=(t,n)=>{const e=ci(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 Ma=async t=>{try{const n=Lr(t);await ia(ra,t.uri,t.id,t.languageId,n);const e=await Sa(t);const o=Ko(t.id);if(!o){return t}const s=await va(o.newState,e);const c=s.flatMap(t=>[t.offset,t.length,t.type,t.modifiers||0]);const r=ba(o.newState,c);const i={...o.newState,decorations:r,diagnostics:e,visualDecorations:s};ts(t.id,o.oldState,i);await yo("Editor.rerender",t.id);return i}catch(n){if(n&&n.message.includes("No diagnostic provider found")){return t}console.error(`Failed to update diagnostics: ${n}`);return t}};const La=async({assetDir:t,columnToReveal:n,completionTriggerCharacters:e,content:o,diagnosticsEnabled:s,fontFamily:c,fontSize:r,fontWeight:i,formatOnSave:a,height:d,hoverEnabled:l,id:u,isAutoClosingBracketsEnabled:f,isAutoClosingQuotesEnabled:h,isAutoClosingTagsEnabled:m,isMonospaceFont:p,isQuickSuggestionsEnabled:y,languageId:E,letterSpacing:x,lineNumbers:I,lineToReveal:k,links:S,platform:C,rowHeight:v,savedDeltaY:b,savedSelections:M,tabSize:L,uri:A,useFunctionalRendering:F,width:P,x:W,y:T})=>{g(u);w(o);const R=await ma(i,r,c,x);const D=await ga(C,t);const B=ha(A,D);const O={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:ss,fontFamily:c,fontSize:r,fontWeight:i,handleOffset:0,handleOffsetX:0,height:d,id:u,incrementalEdits:ns,invalidStartIndex:0,isAutoClosingBracketsEnabled:f,isAutoClosingQuotesEnabled:h,isAutoClosingTagsEnabled:m,isMonospaceFont:p,isQuickSuggestionsEnabled:y,itemHeight:20,languageId:B,letterSpacing:x,lineCache:[],lineNumbers:I,lines:[],longestLineWidth:0,maxLineY:0,minimumSliderSize:20,minLineY:0,modified:false,numberOfVisiblelines:0,numberOfVisibleLines:0,platform:C,primarySelectionIndex:0,redoStack:[],rowHeight:v,savedSelections:M,scrollBarHeight:0,scrollBarWidth:0,selectionInfos:[],selections:new Uint32Array,tabSize:L,textInfos:[],tokenizerId:0,uid:u,undoStack:[],uri:A,useFunctionalRendering:F,validLines:[],widgets:[],width:P,x:W,y:T};const H=na(O,W,T,P,d,9);const N=ea(H,o);let z;if(k&&n){const t=k*v;z=await Kr(N,t)}else{z=await Kr(N,0)}const Y=ci(z);const $={...z,decorations:Y};const U=Qr();const{differences:_,textInfos:V}=await Ur($,U);const j={...$,differences:_,focus:co,focused:true,textInfos:V};ts(u,oa,j);await ia(ra,A,u,E,o);if(s){await Ma(j)}const q=await wa("editor.completionsOnType");const G=Boolean(q);ts(u,oa,{...j,completionsOnType:G})};const Aa=(t,n)=>t.rowHeight===n.rowHeight&&t.deltaY===n.deltaY&&t.finalDeltaY===n.finalDeltaY&&t.height===n.height&&t.scrollBarHeight===n.scrollBarHeight;const Fa=(t,n)=>{if(!n.focused){return true}return t.focused===n.focused&&t.focus===n.focus};const Pa=(t,n)=>t.cursorInfos===n.cursorInfos&&t.diagnostics===n.diagnostics&&t.highlightedLine===n.highlightedLine&&t.lineNumbers===n.lineNumbers&&t.textInfos===n.textInfos&&t.differences===n.differences&&t.initial===n.initial&&t.deltaY===n.deltaY&&t.scrollBarHeight===n.scrollBarHeight&&t.scrollBarWidth===n.scrollBarWidth&&t.selectionInfos===n.selectionInfos;const Wa=6;const Ta=7;const Ra=11;const Da=12;const Ba=[Pa,Fa,Fa,Aa];const Oa=[Da,Wa,Ta,Ra];const Ha=(t,n)=>{const e=[];for(let o=0;o<Ba.length;o++){const s=Ba[o];if(!s(t,n)){e.push(Oa[o])}}return e};const Na=t=>{const{newState:n,oldState:e}=Ko(t);const o=Ha(e,n);return o};const za=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 Ya=t=>{const{selections:n}=t;const e=za(n);return{...t,selections:e}};const $a=(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 Ua=t=>{const{lines:n,selections:e}=t;const o=$a(e,n.length);return{...t,selections:o}};const _a=(t,n)=>{const e=[];for(const o of n){const n=Wr(t,o.startOffset);const s=Wr(t,o.endOffset);const c=Ar(t,{end:s,start:n});const r={deleted:c,end:s,inserted:gi(o.inserted),origin:Is,start:n};if(r.inserted.length===0){r.inserted=[""]}e.push(r)}return e};const Va=(...t)=>{console.warn(...t)};const ja=(...t)=>{console.error(...t)};const qa=(t,n)=>{if(!Array.isArray(n)){Va("something is wrong with format on save",n);return t}if(n.length===0){return t}const e=_a(t,n);return Qi(t,e)};const Ga=async(t,n)=>{h(t);m(n);return Qi(t,n)};const Xa=(t,n)=>{const e=[];for(const o of n){if(o.uri===t.uri){for(const n of o.edits){const o=Wr(t,n.offset);const s=Wr(t,n.offset+n.deleted);const c=Ar(t,{end:s,start:o});const r={deleted:c,end:s,inserted:[n.inserted],origin:bs,start:o};e.push(r)}}}return e};const Za=async(t,n)=>{h(t);m(n);const e=Xa(t,n);if(e.length===0){return t}return Qi(t,e)};const Qa=t=>{if(!t.focused){return t}const n={...t,focused:false};return n};const Ka=(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:Ar(t,f),end:u,inserted:e,origin:o,start:l})}return s};const Ja=(t,n,e)=>{const{selections:o}=t;return Ka(t,o,n,e)};const td=async(t,n,e,o,s,c,r,i,a,d)=>{for(let l=n;l<t.length;l++){const n=await Si(t.slice(0,l),s,c,r,i,a,d);if(o-n<e/2){return l}}return t.length};const nd=()=>"Segmenter"in Intl;const ed=()=>{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 od=async(t,n,e,o,s,c,r,i)=>{const a=ed();const d=a.getSegments(t);const l=false;const u=0;for(const n of d){const a=await Si(t.slice(0,n.index),s,c,r,i,l,u);if(o-a<e){return n.index}}return t.length};const sd=(t,n)=>{const e=Math.round(t/n);return e};const cd=(t,n,e)=>{let o=n;for(let s=0;s<n;s++){if(t[s]===yr){o-=e-1}}return o};const rd=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=sd(a,r);const l=xr(t);const u=cd(t,d,i);const f=t.slice(0,u);const h=Er(f,l,i);const m=await Si(h,n,e,o,s,c,r);const y=xi(t);if(y){if(Math.abs(a-m)<r/2){return u}return await td(t,u,r,a,n,e,o,s,c,r)}return await od(t,u,r,a,n,e,o,s)};const id=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=Rs(y,0,u.length-1);const I=u[x];const k=await rd(I,a,i,r,l,d,o,m,E);return{columnIndex:k,rowIndex:x}};const ad=(t,n,e)=>{const{columnWidth:o,x:s}=t;const c=e*o+s;return c};const dd=(t,n)=>{const{rowHeight:e,y:o}=t;const s=(n+1)*e+o;return s};const ld={timeout:-1};const ud=async(t,n,e,o,s)=>{h(t);g(n);g(e);w(o);const c=ad(t,n,e);const r=dd(t,n);const i=o;await yo("Editor.showOverlayMessage",t,"Viewlet.send",t.uid,"showOverlayMessage",c,r,i);if(!s){const n=()=>{hd(t)};ld.timeout=setTimeout(n,3e3)}return t};const fd=async(t,n,e,o)=>ud(t,n,e,o,true);const hd=async t=>{clearTimeout(ld.timeout);ld.timeout=-1;return t};const gd=String;const md=t=>{switch(t){case"(":return")";case"[":return"]";case"{":return"}";default:return"???"}};const wd=async(t,n)=>{try{const e=Pr(t,t.cursor);const o=await yo("ExtensionHostBraceCompletion.executeBraceCompletionProvider",t,e,n);if(o){const e=md(n);const o=n+e;const s=Ja(t,[o],Es);return Qi(t,s)}const s=Ja(t,[n],Es);return Qi(t,s)}catch(n){console.error(n);const e=Array.isArray(t.cursor)?t.cursor[0]:t.cursor;return fd(t,e,gd(n))}};const pd=t=>{const{selections:n}=t;if(n.length===4&&n[0]===n[2]&&n[1]===n[3]){return t}const e=Li(4);Wi(e,0,n[0],n[1]);return Zi(t,e)};const yd=(t,n)=>{for(const[e,o]of t.entries()){if(o.id===n){return e}}return-1};const Ed=(t,n)=>{const e=yd(t,n);const o=[...t.slice(0,e),...t.slice(e+1)];return o};const xd=t=>t.id===Pe;const Id=t=>{const{widgets:n}=t;const e=n.findIndex(xd);if(e===-1){return t}const o=Ed(n,Pe);return{...t,focused:true,widgets:o}};const kd=t=>t.id===De;const Sd=t=>{const{widgets:n}=t;const e=n.findIndex(kd);if(e===-1){return t}const o=Ed(n,De);return{...t,focused:true,widgets:o}};const Cd=async()=>{const t="Rename Worker";const n="renameWorkerMain.js";const e=await $o(t,n);await e.invoke("Rename.initialize");return e};const vd={};const bd=()=>{if(!vd.workerPromise){vd.workerPromise=Cd()}return vd.workerPromise};const Md=async(t,...n)=>{const e=await bd();return await e.invoke(t,...n)};const Ld=t=>t.id===Oe;const Ad=async t=>{const{uid:n,widgets:e}=t;const o=e.findIndex(Ld);if(o===-1){return t}const s=e[o];await Md("Rename.close",s.newState.uid);const c=Ko(n);const{newState:r}=c;return r};const Fd=t=>t.id===He;const Pd=t=>{const{widgets:n}=t;const e=n.findIndex(Fd);if(e===-1){return t}const o=Ed(n,He);return{...t,widgets:o}};const Wd=(t,n)=>{for(const e of t){if(e.id===n){return true}}return false};const Td=async(t,n,e,o,s,c)=>{const{widgets:r}=e;if(Wd(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:co,focused:u,widgets:l};return f};const Rd=()=>Math.random();const Dd=()=>{const t=Rd();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 Bd=(t,n)=>qo(t,n);const Od=async t=>Td(We,es,t,Dd,Bd);const Hd={compositionText:"",isComposing:false};const Nd=(t,n)=>{Hd.isComposing=true;return t};const zd=(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-Hd.compositionText.length;e.push({deleted:[Hd.compositionText],end:{columnIndex:i,rowIndex:r},inserted:[n],origin:us,start:{columnIndex:a,rowIndex:s}})}return e};const Yd=(t,n)=>{const{selections:e}=t;const o=zd(e,n);Hd.compositionText=n;return Qi(t,o)};const $d=(t,n)=>{const{selections:e}=t;const o=zd(e,n);Hd.isComposing=false;Hd.compositionText="";return Qi(t,o)};const Ud=async t=>{try{w(t);await bo(t)}catch(t){throw new S(t,"Failed to write text to clipboard")}};const _d=(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 Vd=(t,n,e,o)=>t===e&&n===o;const jd=async t=>{if(!ta(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=Vd(o,s,c,r);const a=_d(n,i,o,s,c,r);const d=Ar(t,a);const l=Sr(d);const u=i?"\n"+l:l;await Ud(u);return t};const qd=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:[Mr(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 Qi(t,s,c)};const Gd=t=>{const{selections:n}=t;const e=n[0];const o={columnIndex:0,rowIndex:e};const s=[{deleted:[""],end:o,inserted:[Mr(t,e),""],start:o}];return Qi(t,s)};const Xd=(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 Zd=(t,n,e,o)=>{t[n]=e;t[n+1]=o};const Qd=(t,n,e,o)=>{t[n]=t[n+2]=e;t[n+1]=t[n+3]=o};const Kd=(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 Jd=(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{Kd(o,s,c,r,n,e);Kd(o,s+2,c,r,n,e)}}else{Qd(o,s,t[s],t[s+1])}}return o};const tl=(t,n)=>{const{lines:e,selections:o}=t;const s=Jd(o,e,n);return Zi(t,s)};const nl=(t,n)=>{if(!nd()){return 1}if(n>t.length){return 1}const e=ed();const o=e.at(t,n-1);if(!o){return 1}return n-o.index};const el=()=>2;const ol=(t,n)=>{if(!nd()){return 1}const e=ed();const o=e.at(t,n);return o.segment.length};const sl=t=>t===pr||t===yr;const cl=(t,n)=>{if(t.length===0){return 0}for(let e=0;e<n;e++){if(!sl(t[e])){return n-e}}return n};const rl=(t,n)=>t.length-n;const il=(t,n)=>{for(const e of n){const n=t.match(e);if(n){return n[0].length}}return 1};const al=/(?<![A-Z])[A-Z]+\s*$/;const dl=/[\u{C0}-\u{17F}\w\-]+>?\s*$/u;const ll=/[a-zA-Z]+[^a-zA-Z\d]+\s*$/;const ul=/\s+$/;const fl=/[^a-zA-Z\d]+\s*$/;const hl=[al,dl,ll,ul,fl];const gl=(t,n)=>{const e=t.slice(0,n);return il(e,hl)};const ml=/^\s*[\u{C0}-\u{17F}\w]+/iu;const wl=/^[^a-zA-Z\d]+\w*/;const pl=[ml,wl];const yl=(t,n)=>{const e=t.slice(n);return il(e,pl)};const El=/(?<![A-Z])[A-Z]{2}[a-z]+$/;const xl=/(?=[A-Z]+)[A-Z][a-z]+$/;const Il=/[A-Z]+[a-z]+\d?\s*$/;const kl=/[A-Z]+\d*\s*$/;const Sl=/[a-z]+\d*\s*$/;const Cl=/[A-Z]*[a-z]+_+\s*$/;const vl=/(?<![A-Z])[A-Z]_+\s*$/;const bl=/[a-z]+\s*$/;const Ml=/[^a-zA-Z\d\s]+\s*$/;const Ll=[El,xl,Il,kl,Sl,Cl,vl,bl,Ml];const Al=(t,n)=>{const e=t.slice(0,n);return il(e,Ll)};const Fl=/^\s*[a-z]+\d?/;const Pl=/^\s*[A-Z]{2}[a-z\d]+/;const Wl=/^\s*[A-Z]+(?=[A-Z][a-z]+)/;const Tl=/^\s*[A-Z]+[a-z]*\d*/;const Rl=/^\s*_+[a-z]*\d?/;const Dl=/^\s*[^\da-zA-Z\s]+/;const Bl=[Fl,Wl,Tl,Rl,Dl];const Ol=[Fl,Pl,Wl,Tl,Rl,Dl];const Hl=/[A-Z]/;const Nl=(t,n)=>{const e=t.slice(n);if(Hl.test(t[n-1])){return il(e,Bl)}return il(e,Ol)};const zl=t=>tl(t,nl);const Yl=(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 $l=(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 Ul=(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){$l(o,s,c,r,n,e)}else{o[s]=o[s+2]=i;o[s+1]=o[s+3]=a}}return o};const _l=(t,n)=>{const{lines:e,selections:o}=t;const s=Ul(o,e,n);return Zi(t,s)};const Vl=t=>_l(t,ol);const jl=(t,n,e,o,s,c)=>{Wi(t,n,s+1,c)};const ql=t=>Fi(t,jl);const Gl=t=>{const{selections:n}=t;const e=ql(n);return Zi(t,e)};const Xl=t=>_l(t,rl);const Zl=t=>tl(t,cl);const Ql=(t,n,e)=>{h(t);g(n);g(e);const o=Mi(n,e,n,e);return Zi(t,o)};const Kl=(t,n,e,o,s,c)=>{if(e===0){Wi(t,n,0,0)}else{Wi(t,n,e-1,o)}};const Jl=t=>Fi(t,Kl);const tu=(t,n,e,o)=>{const{selections:s}=t;const c=Jl(s);return Zi(t,c)};const nu=t=>tu(t);const eu=t=>tl(t,gl);const ou=t=>tl(t,Al);const su=t=>_l(t,Nl);const cu=t=>_l(t,yl);const ru=async t=>{const{lines:n,selections:e}=t;const[o]=e;const s=n[o];const c=new Uint32Array([o,0,o,s.length]);const r=Ka(t,c,[""],ws);const i=new Uint32Array([o,0,o,0]);await Ud(s);return Qi(t,r,i)};const iu=async t=>{const{selections:n}=t;const[e,o,s,c]=n;const r=Ja(t,[""],ws);const i=new Uint32Array([e,o,s,c]);const a=Sr(r[0].deleted);await Ud(a);return Qi(t,r,i)};const au=async t=>{const{selections:n}=t;const[e,o,s,c]=n;if(Ti(e,o,s,c)){return ru(t)}return iu(t)};const du=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:Ar(t,{end:c,start:s}),end:c,inserted:[""],origin:hs,start:s}];return Qi(t,r)};const lu=(t,n,e)=>{const o=[];const s=(n,s,c,r)=>{const i=Xd(n,s,t,e);const a={columnIndex:r,rowIndex:c};o.push({deleted:Ar({lines:t},{end:a,start:i}),end:a,inserted:[""],origin:ms,start:i})};Pi(n,s);return o};const uu=(t,n,e,o,s)=>{if(!Ti(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 fu=(t,n)=>{for(let e=0;e<n.length;e+=4){const[o,s,c,r]=pi(n,e);if(!uu(t,o,s,c,r)){return false}}return true};const hu=t=>{const{lines:n,selections:e}=t;for(let t=0;t<e.length;t+=4){e[t+1]++;e[t+3]++}const o=lu(n,e,el);return Qi(t,o)};const gu=(t,n)=>{const{autoClosingRanges:e=[],lines:o,selections:s}=t;if(fu(e,s)){return hu(t)}if(Bi(s)){const e=lu(o,s,n);return Qi(t,e)}const c=Ja(t,[""],ms);return Qi(t,c)};const mu=t=>gu(t,cl);const wu=(t,n)=>{const{selections:e}=t;if(Bi(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=Yl(a,s,n);o.push({deleted:Ar(t,{end:d,start:a}),end:d,inserted:[""],origin:gs,start:a})}return o}const o=Ja(t,[""],gs);return o};const pu=(t,n)=>{const e=wu(t,n);return Qi(t,e)};const yu=t=>pu(t,rl);const Eu=t=>{const n=gu(t,nl);return n};const xu=t=>pu(t,ol);const Iu=t=>{const n=gu(t,gl);return n};const ku=t=>{const n=gu(t,Al);return n};const Su=t=>pu(t,Nl);const Cu=t=>pu(t,yl);const vu=async t=>{await yo("SideBar.show","References",true);return t};const bu=async t=>{const n={documentId:t.id||t.uid,languageId:t.languageId,text:Lr(t),uri:t.uri};return lo("Extensions.executeFormattingProvider",n)};const Mu="Failed to execute formatting provider: FormattingError:";const Lu=t=>t&&t instanceof Error&&t.message.startsWith(Mu);const Au="Failed to execute formatting provider: FormattingError:";const Fu=async t=>{try{const n=await bu(t);return qa(t,n)}catch(n){if(Lu(n)){console.error("Formatting Error:",n.message.slice(Au.length));return t}console.error(n);const e=String(n);await ud(t,0,0,e,true);return t}};const Pu=/^[\w\-]+/;const Wu=/[\w\-]+$/;const Tu=(t,n)=>{const e=t.slice(0,n);const o=e.match(Wu);const s=t.slice(n);const c=s.match(Pu);let r=mr;if(o){r+=o[0]}if(c){r+=c[0]}return{word:r}};const Ru=(t,n)=>{const e=t.slice(0,n);const o=e.match(Wu);if(o){return o[0]}return mr};const Du=(t,n,e)=>{const{lines:o}=t;const s=o[n];return Tu(s,e)};const Bu=(t,n,e)=>{const{lines:o}=t;const s=o[n];return Ru(s,e)};const Ou=async(t,n)=>{const e=await yo("ExtensionHostDefinition.executeDefinitionProvider",t,n);return e};const Hu={};const Nu=/\{(PH\d+)\}/g;const zu=(t,n=Hu)=>{if(n===Hu){return t}const e=(t,e)=>n[e];return t.replaceAll(Nu,e)};const Yu="Copy";const $u="Cut";const Uu="Editor: Close Color Picker";const _u="Editor: Copy Line Down";const Vu="Editor: Copy Line Up";const ju="Editor: Format Document (forced)";const qu="Editor: Go To Definition";const Gu="Editor: Go To Type Definition";const Xu="Editor: Indent";const Zu="Editor: Open Color Picker";const Qu="Editor: Select All Occurrences";const Ku="Editor: Select Down";const Ju="Editor: Select Inside String";const tf="Editor: Select Next Occurrence";const nf="Editor: Select Up";const ef="Show Hover";const of="Editor: Sort Lines Ascending";const sf="Editor: Toggle Comment";const cf="Editor: Unindent";const rf="Enter Code";const af="Escape to close";const df="Find All Implementations";const lf="Find All References";const uf="Format Document";const ff="Go to Definition";const hf="Go to Type Definition";const gf="Move Line Down";const mf="Move Line Up";const wf="No definition found";const pf="No definition found for '{PH1}'";const yf="No type definition found";const Ef="No type definition found for '{PH1}'";const xf="Paste";const If="Source Action";const kf="Toggle Block Comment";const Sf=()=>zu(ff);const Cf=()=>zu(wf);const vf=t=>zu(pf,{PH1:t});const bf=t=>zu(Ef,{PH1:t});const Mf=()=>zu(yf);const Lf=()=>zu(If);const Af=()=>zu(af);const Ff=()=>zu(rf);const Pf=()=>zu(hf);const Wf=()=>zu(lf);const Tf=()=>zu(df);const Rf=()=>zu($u);const Df=()=>zu(Yu);const Bf=()=>zu(xf);const Of=()=>zu(kf);const Hf=()=>zu(mf);const Nf=()=>zu(gf);const zf=()=>zu(uf);const Yf=()=>zu(ef);const $f=()=>zu(ju);const Uf=()=>zu(tf);const _f=()=>zu(Qu);const Vf=()=>zu(qu);const jf=()=>zu(Gu);const qf=()=>zu(Ju);const Gf=()=>zu(Xu);const Xf=()=>zu(cf);const Zf=()=>zu(of);const Qf=()=>zu(sf);const Kf=()=>zu(nf);const Jf=()=>zu(Ku);const th=()=>zu(Zu);const nh=()=>zu(Uu);const eh=()=>zu(_u);const oh=()=>zu(Vu);const sh=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=Du(t,r,i);const e=o(n);return ud(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=Wr(t,n.startOffset);const o=new Uint32Array([e.rowIndex,e.columnIndex,e.rowIndex,e.columnIndex]);return Zi(t,o)}const c={endColumnIndex:n.endColumnIndex,endRowIndex:n.endRowIndex,startColumnIndex:n.startColumnIndex,startRowIndex:n.startRowIndex};await Wo(s,true,c);return t}catch(e){if(s(e)){const o=n(e);await ud(t,r,i,o,false);return t}const o=n(e);await ud(t,r,i,o,true);return t}};const ch=async(t,n,e)=>{const o=Pr(t,n,e);const s=await Ou(t,o);return s};const rh=t=>{if(t.word){return vf(t.word)}return Cf()};const ih=String;const ah=t=>t?.message?.startsWith("Failed to execute definition provider: No definition provider found");const dh=async t=>sh({editor:t,getErrorMessage:ih,getLocation:ch,getNoLocationFoundMessage:rh,isNoProviderFoundError:ah});const lh=t=>{if(t.word){return bf(t.word)}return Mf()};const uh=async(t,n)=>{const e=await yo("ExtensionHostTypeDefinition.executeTypeDefinitionProvider",t,n);return e};const fh=async(t,n,e)=>{const o=Pr(t,n,e);const s=await uh(t,o);return s};const hh=String;const gh=t=>t?.message?.startsWith("Failed to execute type definition provider: No type definition provider found");const mh=async(t,n=true)=>sh({editor:t,getErrorMessage:hh,getLocation:fh,getNoLocationFoundMessage:lh,isNoProviderFoundError:gh});const wh=t=>{switch(t){case De:return true;default:return false}};const ph=t=>{if(t.length===0){return t}return t.filter(wh)};const yh={position:{columnIndex:0,rowIndex:0}};const Eh=()=>yh.position;const xh=t=>{yh.position=t};const Ih=async(t,n)=>{await mo(t,n)};const kh=async(t,n)=>{const{platform:e}=t;const{columnIndex:o,rowIndex:s}=n;const c=Pr(t,s,o);const r=ri(t,c);if(r){await Ih(r,e);return t}const i={...t,selections:new Uint32Array([s,o,s,o])};const a=await dh(i);return a};const Sh=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 Zi(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 Zi(t,o)};const Ch=1;const vh=2;const bh=(t,n)=>{xh(n);const e=ph(t.widgets);return{...t,focused:true,selections:new Uint32Array([n.rowIndex,n.columnIndex,n.rowIndex,n.columnIndex]),widgets:e}};const Mh=t=>{switch(t){case vh:return kh;case Ch:return Sh;default:return bh}};const Lh=async(t,n,e,o)=>{h(t);g(n);g(e);g(o);const s=Mh(n);const c=await s(t,{columnIndex:o,rowIndex:e});return c};const Ah=3;const Fh=async(t,n,e,o)=>{const{uid:s}=t;await Io(s,Ah,e,o,{menuId:Ah});return t};const Ph=/^[a-zA-Z\u{C0}-\u{17F}\d]+/u;const Wh=/[a-zA-Z\u{C0}-\u{17F}\d]+$/u;const Th=(t,n,e)=>{const o=t.slice(0,e);const s=t.slice(e);const c=o.match(Wh);const r=s.match(Ph);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 Rh=(t,n,e)=>{const o=Mr(t,n);const s=Th(o,n,e);return Zi(t,s)};const Dh=async(t,n,e,o)=>{const s=await id(t,e,o);return Rh(t,s.rowIndex,s.columnIndex)};const Bh=t=>{if(t.focused&&t.focus===co){return t}return{...t,additionalFocus:0,focus:co,focused:true}};const Oh=1;const Hh=2;const Nh=3;const zh=async(t,n,e,o)=>{h(t);g(n);g(e);g(o);const s=await id(t,e,o);return Lh(t,n,s.rowIndex,s.columnIndex)};const Yh=(t,n)=>new Uint32Array([n,0,n,t.length]);const $h=t=>{const{selections:n}=t;const e=n[t.primarySelectionIndex];const o=Mr(t,e);const s=Yh(o,e);return Zi(t,s)};const Uh=(t,n,e,o)=>{h(t);g(e);g(o);return $h(t)};const _h=(t,n)=>{if(t){return vh}if(n){return Ch}return 0};const Vh=(t,n,e,o,s,c,r)=>{const i=_h(e,o);switch(r){case Hh:return Dh(t,i,s,c);case Oh:return zh(t,i,s,c);case Nh:return Uh(t,i,s,c);default:return t}};const jh={editor:undefined,timeout:-1,x:0,y:0};const qh=()=>jh;const Gh=(t,n,e,o)=>{jh.editor=t;jh.timeout=n;jh.x=e;jh.y=o};const Xh=async(t,n)=>{};const Zh=async()=>{const{editor:t,x:n,y:e}=qh();await id(t,n,e);await Xh()};const Qh=300;const Kh=(t,n,e)=>{if(!t.hoverEnabled){return t}const o=qh();if(o.timeout!==-1){clearTimeout(o.timeout)}const s=setTimeout(Zh,Qh);Gh(t,s,n,e);return t};const Jh=(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 tg=async(t,n,e)=>{h(t);g(n);g(e);const o=await id(t,n,e);const s=Pr(t,o.rowIndex,o.columnIndex);try{const n=await Ou(t,s);if(!n){return t}const e=Wr(t,n.startOffset);Wr(t,n.endOffset);const o=t.lineCache[e.rowIndex+1];if(!o){return t}const c=Jh(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 ng=(t,n)=>new Uint32Array([n.startRowIndex,n.startColumnIndex,n.endRowIndex,n.endColumnIndex]);const eg=(t,n,e)=>{const o=ng(t,e);const s={end:{columnIndex:o[3],rowIndex:o[2]},start:{columnIndex:o[1],rowIndex:o[0]}};const c=[{deleted:Ar(t,s),end:s.end,inserted:[n],origin:fs,start:s.start}];return c};const og=(t,n,e)=>{const o=eg(t,n,e);return Qi(t,o)};const sg=(t,n)=>{const e=ng(t,n);return Zi(t,e)};const cg={currentEditor:undefined,hasListener:false,isSelecting:false,position:{columnIndex:0,rowIndex:0}};const rg=t=>{cg.currentEditor=t;cg.hasListener=true};const ig=()=>{cg.currentEditor=undefined;cg.hasListener=false;cg.isSelecting=false};const ag=()=>{cg.isSelecting=true};const dg=()=>cg.isSelecting;const lg=t=>{cg.position=t};const ug=()=>cg.currentEditor;const fg=()=>cg.position;const hg=()=>cg.hasListener;const gg=t=>{ig();return t};const mg=(t,n,e,o,s,c,r)=>{ag();return Vh(t,n,e,o,s,c,r)};const wg=(t,n)=>t;const pg=async(t,n,e)=>{await id(t,n,e)};const yg=t=>{globalThis.requestAnimationFrame(t)};const Eg=-1;const xg=0;const Ig=1;const kg=(t,n)=>{if(t.rowIndex>n.rowIndex){return Ig}if(t.rowIndex===n.rowIndex){if(t.columnIndex>n.columnIndex){return Ig}if(t.columnIndex<n.columnIndex){return Eg}return xg}return Eg};const Sg=(t,n)=>new Uint32Array([t.rowIndex,t.columnIndex,n.rowIndex,n.columnIndex]);const Cg=(t,n)=>new Uint32Array([n.rowIndex,n.columnIndex,n.rowIndex,n.columnIndex]);const vg=(t,n)=>new Uint32Array([t.rowIndex,t.columnIndex,n.rowIndex,n.columnIndex]);const bg=(t,n)=>{switch(kg(n,t)){case xg:return Cg(t,n);case Ig:return vg(t,n);case Eg:return Sg(t,n);default:throw new Error("unexpected comparison result")}};const Mg=(t,n)=>{const e=Eh();const o=bg(e,n);return Zi(t,o)};const Lg=(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=Eh();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=Eh();const l=new Uint32Array([d.rowIndex,d.columnIndex,n.rowIndex+1,n.columnIndex]);return{...t,deltaY:a,maxLineY:i,minLineY:r,selections:l}}return t};const Ag=async()=>{const t=ug();if(!t){return}const n=fg();if(n.rowIndex===0){return}const e=Lg(t,n);if(t===e){return}rg(e);const o=n.rowIndex<t.minLineY?-1:1;lg({columnIndex:n.columnIndex,rowIndex:n.rowIndex+o});yg(Ag)};const Fg=async(t,n,e)=>{h(t);g(n);g(e);const o=await id(t,n,e);if(!hg()&&(o.rowIndex<t.minLineY||o.rowIndex>t.maxLineY)){yg(Ag);rg(t);lg(o)}return Mg(t,o)};const Pg=async(t,n,e,o)=>{if(!dg()){return t}if(o){return pg(t,n,e)}return Fg(t,n,e)};const Wg=t=>{ig();return t};const Tg=(t,n,e)=>{if(e<=0){return 0}if(e<=t-n/2){return e/(t-n)}return 1};const Rg=(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=Rs(n,c,c+s);const a=i-c-e;const d=qr(s,o);const l=o-s+r;const u=Tg(s,d,a);const f=Rs(u,0,1);const h=f*l;return{...t,deltaX:h}};const Dg=(t,n)=>{const{deltaX:e,longestLineWidth:o,width:s,x:c}=t;const r=n-c;const i=qr(s,o);const a=s-i;const d=_r(e,a,s,i);const l=r-d;if(l>=0&&l<i){return{...t,handleOffsetX:l}}const{handleOffset:u,percent:f}=Gr(s,i,r);const h=f*a;return{...t,deltaX:h,handleOffsetX:u}};const Bg=(t,n)=>{const{height:e,scrollBarHeight:o}=t;if(n<=e-o/2){return n/(e-o)}return 1};const Og=async(t,n)=>{const{finalDeltaY:e,handleOffset:o=0,y:s}=t;const c=n-s-o;const r=Bg(t,c);const i=r*e;const a=await ji(t,i);return a};const Hg=Og;const Ng=async(t,n)=>{const{deltaY:e,finalDeltaY:o,height:s,scrollBarHeight:c,y:r}=t;const i=n-r;const a=Vr(e,o,s,c);const d=i-a;if(d>=0&&d<c){return{...t,handleOffset:d}}const{handleOffset:l,percent:u}=Gr(s,c,i);const f=u*o;const h=await ji(t,f);return{...h,handleOffset:l}};const zg=(t,n)=>{};const Yg={deltaY:0,touchOffsetY:0};const $g=(t,n)=>{if(n.touches.length===0){return}const e=n.touches[0];Yg.touchOffsetY=e.y;Yg.deltaY=t.deltaY};const Ug=(t,n)=>qi(t,n);const _g=(t,n)=>ji(t,n);const Vg=(t,n,e,o)=>{g(n);g(e);g(o);const{deltaX:s}=t;if(e===0){return Ug(t,o)}const c=Rs(s+e,0,Infinity);return{...Ug(t,o),deltaX:c}};const jg=(t,n)=>{if(n.touches.length===0){return}const e=n.touches[0];const o=Yg.deltaY+(Yg.touchOffsetY-e.y);_g(t,o)};const qg=(t,n,e,o)=>Vg(t,n,e,o);const Gg=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 Xg=t=>{const{selections:n}=t;const e=Gg(n);return Qi(t,e)};const Zg=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:Ss,start:{columnIndex:0,rowIndex:t}}));return e};const Qg=t=>{const{selections:n}=t;const e=Zg(n);return Qi(t,e)};const Kg=async t=>yo("Languages.getLanguageConfiguration",{languageId:t.languageId,uri:t.uri});const Jg=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 nm=(t,n,e)=>{const o=[];const s=[];const c=Jg(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(Ti(r,i,a,d)){const n=t[r];const e=n.slice(0,i);const a=vr(e);if(tm(e,c)){o.push({deleted:Ar({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:Ar({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:Ar({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 em=async t=>{const{lines:n,selections:e}=t;const o=await Kg(t);const{changes:s,selectionChanges:c}=nm(n,e,o);return Qi(t,s,c)};const om=2;const sm=0;const cm=()=>{const t=Rd();const n={id:Pe,newState:{focused:true,focusSource:om,height:0,questions:[],uid:t,width:0,x:0,y:0},oldState:{focused:false,focusSource:sm,height:0,questions:[],uid:t,width:0,x:0,y:0}};return n};const rm=async t=>{const n={...t,height:45,width:150,x:100,y:100};return n};const im=async t=>{const n=true;return Td(Pe,ds,t,cm,rm,n)};const am=()=>{const t=Rd();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:dm,setFactory:lm}=Ho(je);const um=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Ko(n);const{languageId:a}=i;await dm("Completions.create",o,c,r,s,e,n,a);await dm("Completions.loadContent",o);const d=await dm("Completions.diff2",o);const l=await dm("Completions.render2",o,d);return{...t,commands:l}};const fm=async t=>{const n=false;return Td(Te,os,t,am,um,n)};const hm=()=>{const t=Rd();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 gm=async()=>{const t="Find Widget Worker";const n="findWidgetWorkerMain.js";return $o(t,n)};const mm=9002;const wm=async()=>{if($n(mm)){return}const t=await gm();Yn(mm,t)};const pm=async(t,...n)=>{const e=$n(mm);return await e.invoke(t,...n)};const ym=async()=>{const t=$n(mm);Un(mm);if(t){await t.dispose()}};const Em=t=>{const n=Ko(t);if(!n){throw new Error(`editor ${t} not found`)}const{newState:e}=n;return e};const xm=async(t,n)=>{const{uid:e}=t;const o=Em(n);const{height:s,width:c,x:r,y:i}=o;await wm();await pm("FindWidget.create",e,r,i,c,s,n);await pm("FindWidget.loadContent",e);const a=await pm("FindWidget.diff2",e);const d=await pm("FindWidget.render2",e,a);return{...t,commands:d}};const Im=(t,n)=>xm(t,n);const km=async t=>{const n=true;return Td(De,cs,t,hm,Im,n)};const Sm=async t=>km(t);const Cm=t=>{const{selections:n}=t;const e=n[0];const o=n[1];const s=ad(t,e,o);const c=dd(t,e);return{columnIndex:o,rowIndex:e,x:s,y:c}};const vm=()=>{const t=Rd();const n={id:Oe,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 bm=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Ko(n);const{languageId:a}=i;await Md("Rename.create",o,c,r,s,e,n,a);await Md("Rename.loadContent",o);const d=await Md("Rename.diff2",o);const l=await Md("Rename.render2",o,d);return{...t,commands:l}};const Mm=async t=>{const{columnIndex:n,rowIndex:e}=Cm(t);const{word:o}=Du(t,e,n);if(!o){return t}const s=true;return Td(Oe,is,t,vm,bm,s)};const Lm=async t=>{const n=await xa({args:[],editor:t,event:"onLanguage",method:"ExtensionHostOrganizeImports.execute"});return n};const Am=async t=>{const n=await Lm(t);return qa(t,n)};const Fm=(t,n)=>{const e=gi(n);const o=Ja(t,e,ps);return Qi(t,o)};const Pm=async t=>{const n=await Mo();w(n);return Fm(t,n)};const Wm=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 Ki(o,e)};const Tm=t=>{if(!t){return`Error: ${t}`}let{message:n}=t;while(t.cause){t=t.cause;n+=`: ${t}`}return n};const Rm=t=>{if(!t){return{codeFrame:undefined,message:t,stack:undefined,type:"Error"}}const n=Tm(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 Dm=/\((.*):(\d+):(\d+)\)$/;const Bm=/at (.*):(\d+):(\d+)$/;const Om=t=>{for(const n of t){if(Dm.test(n)||Bm.test(n)){return n}}return""};const Hm=async t=>{try{const n=gi(t.stack);const e=Om(n);let o=e.match(Dm);if(!o){o=e.match(Bm)}if(!o){return t}const s=Sr(n.slice(1));const c=Tm(t);return{message:c,stack:s,type:t.constructor.name}}catch(n){console.warn("ErrorHandling Error");console.warn(n);return t}};const Nm=async t=>{if(t&&t.message&&t.codeFrame){return Rm(t)}if(t&&t.stack){return Hm(t)}return t};const zm=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 Ym=async t=>{const n=await Nm(t);const e=zm(n);console.error(e);return n};const $m=async t=>{try{await Ym(t)}catch(n){console.warn("ErrorHandling error");console.warn(n);console.error(t)}};const Um=async t=>t;const _m=t=>t.startsWith("untitled:");const Vm=async(t,n)=>{await yo("FileSystem.writeFile",t,n)};const jm=async t=>{const n="Save File";const{canceled:e,filePath:o}=await ho("Open.showSaveDialog",n,[],t);if(e){return""}return o};const qm=async(t,n,e)=>{const o=await jm(e);if(!o){return}await yo("FileSystem.writeFile",o,n);await Co();await yo("Main.handleUriChange",t,o);return o};const Gm=async t=>{try{const{platform:n,uri:e}=t;const o=await Um(t);const s=Lr(o);if(_m(e)){const t=await qm(e,s,n);if(t){return{...o,modified:false,uri:t}}return o}await Vm(e,s);return{...o,modified:false}}catch(n){const e=new S(n,`Failed to save file "${t.uri}"`);await $m(e);return t}};const Xm=t=>{const{lines:n}=t;const e=0;const o=0;const s=n.length-1;const c=n.at(-1).length;const r=Mi(e,o,s,c);return Zi(t,r)};const Zm=(t,n,e)=>{const o=Ai(t);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=pi(t,s);Kd(o,s+2,c,r,n,e);Zd(o,s,i,a)}return o};const Qm=(t,n)=>{const{lines:e,selections:o}=t;const s=Zm(o,e,n);return Zi(t,s)};const Km=t=>{Qm(t,cl)};const Jm=/[a-zA-Z\d]/;const tw=t=>Jm.test(t);const nw=t=>tw(t)||t==="_";const ew=(t,n)=>{for(let e=n-1;e>=0;e--){if(!nw(t[e])){return e+1}}return 0};const ow=(t,n)=>{for(let e=n;e<t.length;e++){if(!nw(t[e])){return e}}return t.length};const sw=(t,n,e)=>{const o=t[n];const s=ew(o,e);const c=ow(o,e);const r=o.slice(s,c);return{end:c,start:s,word:r}};const cw=(t,n,e)=>{let o=0;if(!t[n+o].endsWith(e[o])){return false}while(++o<e.length-1){if(t[n+o]!==e[o]){return false}}return t[n+o].startsWith(e[o])};const rw=(t,n)=>{if(n.length===0){throw new Error("word length must be greater than zero")}const e=[];for(let o=0;o<t.length;o++){const s=t[o];let c=-n.length;while((c=s.indexOf(n,c+n.length))!==-1){e.push(o,c,o,c+n.length)}}return new Uint32Array(e)};const iw=(t,n)=>{const e=[];for(let o=0;o<t.length-n.length+1;o){if(cw(t,o,n)){e.push(o,t[o].length-n[0].length,o+n.length-1,n.at(-1).length);o+=n.length-1}else{o++}}return new Uint32Array(e)};const aw=(t,n)=>{if(n.length<4){throw new Error("selections must have at least one entry")}const e=0;const o=n[e];const s=n[e+1];const c=n[e+2];const r=n[e+3];if(o===c){if(s===r){const e=sw(t,c,r);if(e.start===e.end){return n}const o=rw(t,e.word);return o}const e=t[o];const i=e.slice(s,r);const a=rw(t,i);return a}const i=[];i.push(t[o].slice(s));for(let n=o+1;n<c-1;n++){i.push(t[n])}i.push(t[c].slice(0,r));const a=iw(t,i);return a};const dw=t=>{const{lines:n,selections:e}=t;const o=aw(n,e);return Zi(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 uw=(t,n)=>{const{lines:e}=t;const{selections:o}=t;const s=lw(o,e,n);return Zi(t,s)};const fw=t=>uw(t,rl);const hw=t=>Qm(t,nl);const gw=t=>uw(t,ol);const mw=(t,n)=>{const e=t.length-1;const o=new Uint32Array(n.length);for(let t=0;t<n.length;t+=4){const[s,c,r,i]=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 ww=t=>{const{lines:n,selections:e}=t;const o=mw(n,e);return Zi(t,o)};const pw=(t,n)=>{const e=new Uint32Array(n.length);for(let o=0;o<n.length;o+=4){const[s,c,r,i]=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]!==gr){r--}r++;while(a<d.length&&d[a]!==gr){a++}e[o]=n;e[o+1]=r;e[o+2]=n;e[o+3]=a}else{e[o]=s;e[o+1]=c;e[o+2]=r;e[o+3]=i}}return e};const yw=t=>{const{selections:n}=t;const{lines:e}=t;const o=pw(e,n);return Zi(t,o)};const Ew=async(t,n)=>{const e=await yo("ExtensionHostSelection.executeGrowSelection",t,n);if(e.length===0){return n}return new Uint32Array(e)};const xw=async t=>{const{selections:n}=t;const e=await Ew(t,n);return Zi(t,e)};const Iw=(t,n)=>{const e=n.length-4;const o=n[e];const s=n[e+1];const c=n[e+3];const r=t[o];const i=r.slice(s,c);const a=r.indexOf(i,c);if(a!==-1){const t=a+i.length;const e=new Uint32Array(n.length+4);e.set(n,0);const s=n.length;e[s]=o;e[s+1]=a;e[s+2]=o;e[s+3]=t;return{revealRange:e.length-4,selectionEdits:e}}for(let e=o+1;e<t.length;e++){const o=t[e];const s=o.indexOf(i);if(s!==-1){const t=s+i.length;const o=new Uint32Array(n.length+4);o.set(n,0);const c=n.length;o[c]=e;o[c+1]=s;o[c+2]=e;o[c+3]=t;return{revealRange:o.length-4,selectionEdits:o}}}let d=0;for(let e=0;e<=o;e++){const o=t[e];let s=-i.length;while((s=o.indexOf(i,s+i.length))!==-1){let t=n[d];while(t<e&&d<n.length){d+=4;t=n[d]}if(t===e){let t=n[d+3];while(t<s&&d<n.length){d+=4;t=n[t+3]}}t=n[d];const o=n[d+1];const c=n[d+3];const r=t===e&&o<=s&&s<=c;if(!r){if(t>e){d-=4}const o=s+i.length;d+=4;const c=new Uint32Array(n.length+4);c.set(n.subarray(0,d),0);c[d]=e;c[d+1]=s;c[d+2]=e;c[d+3]=o;c.set(n.subarray(d),d+4);return{revealRange:c.length-4,selectionEdits:c}}}}return undefined};const kw=t=>{const{lines:n}=t;const{selections:e}=t;if(Bi(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=sw(n,s,c);t[o]=s;if(a.start===a.end){t[o+1]=c;t[o+2]=r;t[o+3]=i}else{t[o+1]=a.start;t[o+2]=s;t[o+3]=a.end}}return{revealRange:t.length-4,selectionEdits:t}}if(Oi(t.selections)){return Iw(t.lines,t.selections)}return undefined};const Sw=(t,n,e,o)=>e>=t&&o<=n;const Cw=t=>{const n=kw(t);if(!n){return t}const{revealRange:e,selectionEdits:o}=n;const s=o[e];const c=o[e+2];if(Sw(t.minLineY,t.maxLineY,s,c)){return Zi(t,o)}return Qi(t,[],o)};const vw=t=>t;const bw=(t,n)=>{const e=new Uint32Array(n.length);for(let t=0;t<n.length;t+=4){const[o,s,c,r]=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 Mw=t=>{const{lines:n,selections:e}=t;const o=bw(n,e);return Zi(t,o)};const Lw=t=>Qm(t,gl);const Aw=t=>uw(t,yl);const Fw=(t,n,e)=>{if(t.decorations.length===0&&n.length===0){return t}return{...t,decorations:n,diagnostics:e}};const Pw=async(t,n,e)=>{const{tokenizerId:o}=t;Gc(n,e);await nr(n,e);const s=er(n);const c=o+1;sr(c,s);const r=Em(t.uid);if(!r){return t}const i=Qr();const{differences:a,textInfos:d}=await Ur(t,i);const l=Em(t.uid);if(!l){return t}const u={...l,differences:a,focused:true,textInfos:d};return{...u,invalidStartIndex:0,languageId:n,tokenizerId:c}};const Ww=(t,n)=>{const{maxLineY:e,minLineY:o,rowHeight:s}=t;const c=n[0];if(c<o){const e=c*s;return{...t,deltaY:e,maxLineY:c+1,minLineY:c,selections:n}}if(c>e){const e=c*s;return{...t,deltaY:e,maxLineY:c+1,minLineY:c,selections:n}}return{...t,selections:n}};const Tw=(t,n)=>{w(n);const e=t.lines.length-1;const o=t.lines.at(-1).length;const s={columnIndex:0,rowIndex:0};const c={columnIndex:o,rowIndex:e};const r=[{deleted:Ar(t,{end:c,start:s}),end:c,inserted:gi(n),origin:Es,start:s}];return Qi(t,r)};const Rw=()=>{const t=Rd();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 Dw=async()=>{const t="Hover Worker";const n="hoverWorkerMain.js";const e="Hover.initialize";const o=await $o(t,n,e);return o};const Bw={};const Ow=()=>{if(!Bw.workerPromise){Bw.workerPromise=Dw()}return Bw.workerPromise};const Hw=async(t,...n)=>{const e=await Ow();return await e.invoke(t,...n)};const Nw=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Ko(n);const{languageId:a}=i;await Hw("Hover.create",o,c,r,s,e,n,a);await Hw("Hover.loadContent",o);const d=await Hw("Hover.diff2",o);const l=await Hw("Hover.render2",o,d);return{...t,commands:l}};const zw=async t=>{const n=false;return Td(Be,rs,t,Rw,Nw,n)};const Yw="EditorHover";const $w=async t=>{await yo("Viewlet.openWidget",Yw);return t};const Uw=()=>{const t=Rd();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 _w=async()=>{const t="Source Action Worker";const n="sourceActionWorkerMain.js";const e="SourceActions.initialize";const o=await $o(t,n,e);return o};const Vw={};const jw=()=>{if(!Vw.workerPromise){Vw.workerPromise=_w()}return Vw.workerPromise};const qw=async(t,...n)=>{const e=await jw();return await e.invoke(t,...n)};const Gw=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Ko(n);const{languageId:a}=i;await qw("SourceActions.create",o,c,r,s,e,n,a);await qw("SourceActions.loadContent",o);const d=await qw("SourceActions.diff2",o);const l=await qw("SourceActions.render2",o,d);return{...t,commands:l}};const Xw=async t=>Td(He,as,t,Uw,Gw);const Zw=(t,n)=>t.localeCompare(n);const Qw=t=>{const n=[...t];n.sort(Zw);return n};const Kw="sort-lines-ascending";const Jw=(t,n)=>{const e=n[0];const o=n[2];const s=[];for(let c=0;c<n.length;c+=4){const r=n[c];const i=n[c+1];const a=n[c+2];const d=n[c+3];const l={columnIndex:i,rowIndex:r};const u={columnIndex:d,rowIndex:a};const f={end:u,start:l};const h=t.slice(e,o+1);const g=Qw(h);s.push({deleted:Ar({lines:t},f),end:u,inserted:g,origin:Kw,start:l})}return s};const tp=t=>{const{lines:n,selections:e}=t;const o=Jw(n,e);return Qi(t,o)};const np=async(t,n)=>xa({args:[n],editor:t,event:Ea,method:ca,noProviderFoundMessage:"No tab completion provider found",noProviderFoundResult:undefined});const ep=t=>{const{selections:n}=t;const e=n[0];const o=n[1];const s=Pr(t,e,o);return s};const op=async t=>{const n=ep(t);const e=await np(t,n);return e};const sp=(t,n,e)=>{const o=gi(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=Mr({lines:t},i);const r=vr(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:ys,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:ys,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:ys,start:{columnIndex:a-e.deleted,rowIndex:i}})}}}return{changes:s,selectionChanges:new Uint32Array(c)}};const cp=(t,n)=>{const{lines:e,selections:o}=t;const{changes:s,selectionChanges:c}=sp(e,o,n);return Qi(t,s,c)};const rp=String;const ip=async t=>{try{const n=await op(t);if(!n){return t}return cp(t,n)}catch(n){await $m(n);const e=t.selections[0];const o=t.selections[1];return fd(t,e,o,rp(n))}};const ap=async(t,n)=>{const{assetDir:e,platform:o}=t;try{await No(`onLanguage:${t.languageId}`,e,o);const s=await ia(`ExtensionHostCommment.execute`,t.uid,n);if(s){return s}}catch{}const s=await Kg(t);if(!s?.comments?.blockComment){return undefined}return s.comments.blockComment};const dp=/^\s+/;const lp=/\s+$/;const up=(t,n,e)=>({deleted:[e],end:{columnIndex:n+e.length,rowIndex:t},inserted:[],origin:Ms,start:{columnIndex:n,rowIndex:t}});const fp=(t,n,e,o,s,c,r)=>{if(n===o){return[up(t,e,c),up(t,s-c.length,r)]}return[up(n,e,c),up(o,s,r)]};const hp=(t,n)=>{const{selections:e}=t;const[o]=e;const s=Mr(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=Mr(t,r);i=n.indexOf(d);if(i!==-1){break}r++}let l=-1;let u=o;while(u>=0){const n=Mr(t,u);l=n.indexOf(a);if(l!==-1){break}u--}const f=[];if(l!==-1&&i!==-1){f.push(...fp(o,u,l,r,i,a,d))}else{const t=s.match(dp);const n=s.match(lp);let e=0;let c=s.length;if(t){e+=t[0].length}if(n){c-=n[0].length}const r={deleted:[],end:{columnIndex:e,rowIndex:o},inserted:[a],origin:Ms,start:{columnIndex:e,rowIndex:o}};const i={deleted:[],end:{columnIndex:c+a.length,rowIndex:o},inserted:[d],origin:Ms,start:{columnIndex:c+a.length,rowIndex:o}};f.push(r,i)}return f};const gp=async t=>{const n=ep(t);const e=await ap(t,n);if(!e){return t}const o=hp(t,e);return Ji(t,o)};const mp=async t=>{const n=await Kg(t);if(!n?.comments?.lineComment){return undefined}return n.comments.lineComment};const wp=/^\s+/;const pp=(t,n,e)=>{const o=n.match(wp);const s=o?o[0].length:0;if(n.slice(s).startsWith(e)){if(n[s+e.length]===" "){return{deleted:[e+" "],end:{columnIndex:s+e.length+1,rowIndex:t},inserted:[""],origin:vs,start:{columnIndex:s,rowIndex:t}}}return{deleted:[e],end:{columnIndex:s+e.length,rowIndex:t},inserted:[""],origin:vs,start:{columnIndex:s,rowIndex:t}}}return{deleted:[],end:{columnIndex:s,rowIndex:t},inserted:[`${e} `],origin:vs,start:{columnIndex:s,rowIndex:t}}};const yp=async t=>{const n=await mp(t);if(!n){return t}const e=t;const o=t.selections[0];const s=Mr(e,o);const c=[pp(o,s,n)];return Qi(t,c)};const Ep=async t=>{try{const n=await yp(t);if(t!==n){return n}return gp(t)}catch(n){ja(n);await ud(t,0,0,String(n),true);return t}};const xp=async(t,n)=>{const e=Ja(t,[n],Es);const o=await Qi(t,e);if(o.completionsOnType){const t=await fm(o);return t}return o};const Ip="/";const kp="{";const Sp="}";const Cp="(";const vp=")";const bp="[";const Mp="]";const Lp="???";const Ap="'";const Fp='"';const Pp="`";const Wp=t=>{switch(t){case kp:return Sp;case Cp:return vp;case bp:return Mp;default:return Lp}};const Tp=(t,n)=>{const e=Wp(n);const o=n+e;const s=Ja(t,[o],xs);const c=new Uint32Array([s[0].start.rowIndex,s[0].start.columnIndex+1,s[0].end.rowIndex,s[0].end.columnIndex+1]);return Qi(t,s,c)};const Rp=t=>{const{selections:n}=t;const e=new Uint32Array([n[0],n[1]+1,n[2],n[3]+1]);return Zi(t,e)};const Dp=(t,n)=>{const{autoClosingRanges:e=[],selections:o}=t;if(fu(e,o)){return Rp(t)}return xp(t,n)};const Bp=(t,n)=>{const e=n+n;const o=Ja(t,[e],xs);const s=new Uint32Array([o[0].start.rowIndex,o[0].start.columnIndex+1,o[0].end.rowIndex,o[0].end.columnIndex+1]);return Qi(t,o,s)};const Op=async(t,n)=>{const e=Pr(t,t.selections[0],t.selections[1]);const o=await yo("ExtensionHostClosingTagCompletion.executeClosingTagProvider",t,e,n);if(!o){const e=Ja(t,[n],Es);return Qi(t,e)}const s=Ja(t,[o.inserted],Es);return Qi(t,s)};const Hp=async(t,n)=>{const{isAutoClosingBracketsEnabled:e,isAutoClosingQuotesEnabled:o,isAutoClosingTagsEnabled:s}=t;switch(n){case Ip:if(s){return Op(t,n)}break;case Sp:case vp:case Mp:if(e){return Dp(t,n)}break;case kp:case Cp:case bp:if(e){return Tp(t,n)}break;case Pp:case Fp:case Ap:if(o){return Bp(t,n)}break}const c=xp(t,n);return c};const Np=t=>{const n=t.end.columnIndex-t.deleted[0].length+t.inserted[0].length;return{deleted:t.inserted,end:{columnIndex:n,rowIndex:t.end.rowIndex},inserted:t.deleted,start:t.start}};const zp=t=>{const{undoStack:n}=t;if(n.length===0){return t}const e=n.at(-1);const o=e.map(Np);const s={...t,redoStack:[...t.redoStack||[],e],undoStack:n.slice(0,-1)};return Ki(s,o)};const Yp=t=>t;const $p=t=>{switch(t){case We:case Te:case De:case Be:case Oe:case He:return true;default:return false}};const Up=(t,n,e)=>{const o=e(t);const{uid:s}=t.newState;const c=[];c.push(["Viewlet.createFunctionalRoot",n,s,$p(t.id)]);c.push(...o);if($p(t.id)){c.push(["Viewlet.appendToBody",s])}else{c.push(["Viewlet.send",s,"appendWidget"])}const r=c.findIndex(t=>t[2]==="focus"||t[0]==="Viewlet.focusSelector");if(r!==-1){const t=c[r];c.splice(r,1);c.push(t)}return c};const _p=t=>{switch(t){case We:return jo;case Te:return dm;case De:return pm;case Be:return Hw;case Oe:return Md;case He:return qw;default:return undefined}};const Vp=(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,e)=>{const o=t=>t.id===e;const s=async(s,...c)=>{const r=s.widgets.findIndex(o);if(r===-1){return s}const i=s.widgets[r];const a=i.newState;const{uid:d}=a;const l=_p(e);await l(`${n}.${t}`,d,...c);const u=await l(`${n}.diff2`,d);const f=await l(`${n}.render2`,d,u);const h={...a,commands:f};const g=Ko(s.uid).newState;const m=Vp(g,e,h);return m};return s};const qp=(t,n,e)=>{const o=Object.create(null);for(const s of t){o[s]=jp(s,n,e)}return o};const Gp="Viewlet.appendToBody";const Xp="focus";const Zp="Viewlet.registerEventListeners";const Qp="Viewlet.setSelectionByName";const Kp="Viewlet.setValueByName";const Jp="Viewlet.setFocusContext";const ty="setBounds";const ny="Viewlet.setBounds";const ey="Viewlet.setCss";const oy="Viewlet.setDom2";const sy="Viewlet.setUid";const cy=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const ry=[oy,ey,Gp,ny,Zp,Qp,Kp,Jp,sy,"Viewlet.focusSelector"];const iy=t=>{const n=cy(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(ry.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const ay=t=>Up(t,"EditorCompletion",iy);const dy=t=>[["Viewlet.dispose",t.newState.uid]];const{close:ly,closeDetails:uy,focusFirst:fy,focusIndex:hy,focusLast:gy,focusNext:my,focusPrevious:wy,handleEditorBlur:py,handleEditorClick:yy,handleEditorDeleteLeft:Ey,handleEditorType:xy,handlePointerDown:Iy,handleWheel:ky,openDetails:Sy,selectCurrent:Cy,selectIndex:vy,toggleDetails:by}=qp(["handleEditorType","focusFirst","focusNext","focusPrevious","focusLast","handleEditorDeleteLeft","openDetails","focusIndex","handleEditorBlur","handleEditorClick","openDetails","selectCurrent","selectIndex","toggleDetails","closeDetails","handleWheel","close","handlePointerDown"],"Completions",Te);const My={__proto__:null,add:ay,close:ly,closeDetails:uy,focusFirst:fy,focusIndex:hy,focusLast:gy,focusNext:my,focusPrevious:wy,handleEditorBlur:py,handleEditorClick:yy,handleEditorDeleteLeft:Ey,handleEditorType:xy,handlePointerDown:Iy,handleWheel:ky,openDetails:Sy,remove:dy,render:iy,selectCurrent:Cy,selectIndex:vy,toggleDetails:by};const Ly=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const Ay=[oy,ey,Gp,ny,Zp,Qp,Kp,Jp,sy,"Viewlet.focusSelector"];const Fy=t=>{const n=Ly(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(Ay.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const Py=t=>Up(t,"FindWidget",Fy);const Wy=t=>[["Viewlet.dispose",t.newState.uid]];const{close:Ty,focusCloseButton:Ry,focusFind:Dy,focusNext:By,focusNextElement:Oy,focusNextMatchButton:Hy,focusPrevious:Ny,focusPreviousElement:zy,focusPreviousMatchButton:Yy,focusReplace:$y,focusReplaceAllButton:Uy,focusReplaceButton:_y,focusToggleReplace:Vy,handleBlur:jy,handleClickButton:qy,handleFocus:Gy,handleInput:Xy,handleReplaceFocus:Zy,handleReplaceInput:Qy,handleToggleReplaceFocus:Ky,replace:Jy,replaceAll:tE,toggleMatchCase:nE,toggleMatchWholeWord:eE,togglePreserveCase:oE,toggleReplace:sE,toggleUseRegularExpression:cE}=qp(["close","focusCloseButton","focusFind","focusNext","focusNextMatchButton","focusPrevious","focusPreviousMatchButton","focusReplace","focusReplaceAllButton","focusReplaceButton","focusToggleReplace","handleBlur","handleClickButton","handleFocus","handleInput","handleReplaceFocus","handleReplaceInput","handleToggleReplaceFocus","replace","replaceAll","toggleMatchCase","toggleMatchWholeWord","toggleReplace","toggleUseRegularExpression","focusNextElement","focusPreviousElement","togglePreserveCase"],"FindWidget",De);const rE={__proto__:null,add:Py,close:Ty,focusCloseButton:Ry,focusFind:Dy,focusNext:By,focusNextElement:Oy,focusNextMatchButton:Hy,focusPrevious:Ny,focusPreviousElement:zy,focusPreviousMatchButton:Yy,focusReplace:$y,focusReplaceAllButton:Uy,focusReplaceButton:_y,focusToggleReplace:Vy,handleBlur:jy,handleClickButton:qy,handleFocus:Gy,handleInput:Xy,handleReplaceFocus:Zy,handleReplaceInput:Qy,handleToggleReplaceFocus:Ky,remove:Wy,render:Fy,replace:Jy,replaceAll:tE,toggleMatchCase:nE,toggleMatchWholeWord:eE,togglePreserveCase:oE,toggleReplace:sE,toggleUseRegularExpression:cE};const iE=t=>({documentId:t.id||t.uid,languageId:t.languageId,text:Lr(t),uri:t.uri});const aE=async(t,n)=>{const e=iE(t);return lo("Extensions.executeHoverProvider",e,n)};const dE=async(t,n)=>{h(t);g(n);const e=await aE(t,n);if(e){return e}return xa({args:[n],editor:t,event:ya,method:sa,noProviderFoundMessage:"No hover provider found"})};const lE=async(t,n)=>{h(t);g(n);const e=await dE(t,n);return e};const uE=async(t,n,e,o,s)=>100;const fE=(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 hE=(t,n,e)=>{const o=[];const{hasArrayReturn:s,initialLineState:c,tokenizeLine:r,TokenMap:i}=n;let a=Mc(c);for(const n of t){const t=Pc(e,r,n,a,s);const{tokens:c}=t;const d=fE(n,c,i);o.push(d);a=t}console.error({lineInfos:o});return o};const gE=async(t,n,e)=>{await nr(n,e);const o=er(n);const s=gi(t);const c=hE(s,o,n);return c};const mE=(t,n)=>{if(t){return t}const e=n[0];const o=n[1];return{columnIndex:o,rowIndex:e}};const wE=(t,n,e)=>{const o=[];for(const e of t){if(e.rowIndex===n){o.push(e)}}return o};const pE="typescript";const yE=(t,n,e,o)=>{const s=ad(t,n,e);const c=t.height-dd(t,n)+t.y+40;return{x:s,y:c}};const EE=async(t,n)=>{g(t);const e=Ko(t);const o=e.newState;const{selections:s}=o;const{columnIndex:c,rowIndex:r}=mE(n,s);const i=Pr(o,r,c);const a=await lE(o,i);if(!a){return undefined}const{displayString:d,displayStringLanguageId:l,documentation:u}=a;const f="";const h=await gE(d,l||pE,f);const m=Bu(o,r,c);const w=c-m.length;await uE();const{x:p,y:y}=yE(o,r,w);const E=o.diagnostics||[];const x=wE(E,r);return{documentation:u,lineInfos:h,matchingDiagnostics:x,x:p,y:y}};const xE=async(t,n,e)=>{const o=await EE(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 IE=(t,n,e)=>t;const kE=(t,n,e)=>{const{x:o}=t;const s=100;const c=Math.max(n-o,s);return{...t,resizedWidth:c}};const SE=(t,n,e)=>t;const CE="CodeGeneratorInput";const vE="CodeGeneratorMessage";const bE="CodeGeneratorWidget";const ME="DiagnosticError";const LE="DiagnosticWarning";const AE="CompletionDetailCloseButton";const FE="CompletionDetailContent";const PE="Diagnostic";const WE="EditorCursor";const TE="EditorRow";const RE="EditorRowHighlighted";const DE="EditorSelection";const BE="HoverDisplayString";const OE="HoverDocumentation";const HE="HoverEditorRow";const NE="HoverProblem";const zE="HoverProblemDetail";const YE="HoverProblemMessage";const $E="IconClose";const UE="InputBox";const _E="MaskIcon";const VE="Viewlet";const jE=1;const qE=2;const GE=9;const XE=10;const ZE=11;const QE=12;const KE=13;const JE=14;const tx=15;const nx=18;const ex=19;const ox=20;const sx=21;const cx=22;const rx=23;const ix=26;const ax=27;const dx=28;const lx=29;const ux=30;const fx=31;const hx=32;const gx=33;const mx=4;const wx=6;const px=8;const yx=12;const Ex=62;const xx=t=>({childCount:0,text:t,type:yx});const Ix=t=>{const n=[{childCount:t.length/2,className:HE,type:mx}];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:px},xx(o))}return n};const kx=t=>{const n=t.flatMap(Ix);return n};const Sx={childCount:1,className:YE,type:px};const Cx={childCount:1,className:zE,type:px};const vx=(t,n,e)=>{const o=n?1:0;const s=e&&e.length>0?1:0;return t.length+o+s};const bx=(t,n,e)=>{const o=[];o.push({childCount:vx(t,n,e)+1,className:"Viewlet EditorHover",type:mx});if(e&&e.length>0){o.push({childCount:e.length*2,className:`${BE} ${NE}`,type:mx});for(const t of e){o.push(Sx,xx(t.message),Cx,xx(`${t.source} (${t.code})`))}}if(t.length>0){const n=kx(t);o.push({childCount:t.length,className:BE,type:mx},...n)}if(n){o.push({childCount:1,className:OE,type:mx},xx(n))}o.push({childCount:0,className:"Sash SashVertical SashResize",onPointerDown:ix,type:mx});return o};const Mx={apply(t,n){const e=bx(n.lineInfos,n.documentation,n.diagnostics);return[oy,e]},isEqual:(t,n)=>t.lineInfos===n.lineInfos&&t.documentation===n.documentation&&t.diagnostics===n.diagnostics};const Lx={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[ty,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y};const Ax=[Mx,Lx];const Fx=(t,n)=>{const e=[];for(const o of Ax){if(!o.isEqual(t,n)){e.push(o.apply(t,n))}}return e};const Px=[oy,ey,Gp,ny,Zp,Qp,Kp,Jp,sy,"Viewlet.focusSelector"];const Wx=t=>{const n=cy(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(Px.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const Tx=t=>Up(t,"EditorRename",Wx);const Rx=t=>[["Viewlet.dispose",t.newState.uid]];const{accept:Dx,close:Bx,handleInput:Ox}=qp(["handleInput","close","accept"],"Rename",Oe);const Hx={__proto__:null,accept:Dx,add:Tx,close:Bx,handleInput:Ox,remove:Rx,render:Wx};const Nx=t=>structuredClone(t);const zx=(t,n)=>{const e={...t,focusedIndex:n};return e};const Yx=t=>{const n=t.focusedIndex+1;return zx(t,n)};const $x=t=>[["Viewlet.send",t.newState.uid,"dispose"]];const Ux=[oy,ey,Gp,ny,Zp,Qp,Kp,Jp,sy,"Viewlet.focusSelector"];const _x=t=>{const n=cy(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(Ux.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const Vx=t=>Up(t,"EditorSourceActions",_x);const jx=$x;const{close:qx,closeDetails:Gx,focusFirst:Xx,focusIndex:Zx,focusLast:Qx,focusNext:Kx,focusPrevious:Jx,handleWheel:tI,selectCurrent:nI,selectIndex:eI,selectItem:oI,toggleDetails:sI}=qp(["focusFirst","focusIndex","focusLast","focusNext","focusPrevious","selectCurrent","selectIndex","selectItem","toggleDetails","closeDetails","handleWheel","close"],"SourceActions",He);const cI={__proto__:null,add:Vx,close:qx,closeDetails:Gx,focusFirst:Xx,focusIndex:Zx,focusLast:Qx,focusNext:Kx,focusPrevious:Jx,handleWheel:tI,remove:jx,render:_x,selectCurrent:nI,selectIndex:eI,selectItem:oI,toggleDetails:sI};const rI=async(t,n,e,o,s,...c)=>{const r=_p(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=Em(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=Vp(u,s,y);return E};const iI=(t,n)=>t.filter(t=>t.languageId===n);const aI=async t=>{if(!t){return[]}const{newState:n}=Ko(t);const{languageId:e}=n;const o=await yo("GetEditorSourceActions.getEditorSourceActions");const s=iI(o,e);return s};const dI=/[\w\-]+$/;const lI=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(dI);if(i){return i[0]}return""};const uI=async t=>{await yo("Focus.setFocus",t)};const fI=async t=>{if(!t){return}await yo("Focus.removeAdditionalFocus",t)};const hI=(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 gI=(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 mI=async(t,n)=>{let e=n;if(gI(t,n)){const t=Qr();const{differences:o,textInfos:s}=await Ur(n,t);e={...n,differences:o,textInfos:s}}if(!hI(t,n)){return e}const{cursorInfos:o,selectionInfos:s}=await $i(e);return{...e,cursorInfos:o,selectionInfos:s}};const wI=12;const pI=9;const yI=11;const EI=12;const xI=16;const II=38;const kI=43;const SI=46;const CI=47;const vI=48;const bI=49;const MI=50;const LI=52;const AI=t=>{const n=Em(t);return Cm(n)};const FI=t=>{const n=Em(t);return n.uri};const PI=t=>{const n=Em(t);return n.languageId};const WI=t=>{const n=Em(t);return ep(n)};const TI=(t,n,e)=>{const o=Em(t);const{word:s}=Du(o,n,e);return s};const RI=t=>{const n=Em(t);const e=lI(n);return e};const DI=(t,n,e)=>{const o=Em(t);const s=Bu(o,n,e);return s};const BI=t=>{const n=Em(t);const{lines:e}=n;return e};const OI=t=>{const n=Em(t);const{selections:e}=n;return e};const HI=async(t,n)=>{const e=Em(t);const o={...e,selections:n};const s=await mI(e,o);ts(t,e,s)};const NI=async(t,n,e,o)=>{const s=Em(t);const c=_p(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 mI(s,d);ts(t,s,l);await uI(EI);if(o){await fI(o)}};const zI=async t=>{await NI(t,De,"FindWidget",0)};const YI=async(t,n)=>{const e=Em(t);const o=await Ga(e,n);const s=await mI(e,o);ts(t,e,s)};const $I=async t=>{const n=await aI(t);return n};const UI=async t=>{const n=Em(t);const{diagnostics:e}=n;return e};const _I=async(t,n)=>{await wo("TextMeasurement.ensureFont",t,n)};const VI=()=>[{command:"Editor.closeSourceAction",key:ee,when:II},{command:"EditorSourceActions.focusNext",key:de,when:II},{command:"EditorSourceActions.focusPrevious",key:ie,when:II},{command:"EditorSourceActions.focusFirst",key:ce,when:II},{command:"EditorSourceActions.focusLast",key:se,when:II},{command:"EditorSourceActions.selectCurrent",key:ne,when:II},{command:"FindWidget.focusNext",key:ne,when:xI},{command:"FindWidget.preventDefaultBrowserFind",key:Ne|ge,when:xI},{command:"FindWidget.focusPrevious",key:ze|ve,when:xI},{command:"FindWidget.focusNext",key:ve,when:xI},{command:"FindWidget.focusToggleReplace",key:ze|te,when:xI},{command:"FindWidget.focusReplace",key:te,when:xI},{command:"FindWidget.focusPreviousMatchButton",key:te,when:kI},{command:"FindWidget.replaceAll",key:Ye|Ne|ne,when:kI},{command:"FindWidget.focusNextMatchButton",key:te,when:MI},{command:"FindWidget.focusReplace",key:ze|te,when:MI},{command:"FindWidget.focusPreviousMatchButton",key:ze|te,when:bI},{command:"FindWidget.focusCloseButton",key:te,when:bI},{command:"FindWidget.focusNextMatchButton",key:ze|te,when:vI},{command:"FindWidget.focusReplaceButton",key:te,when:vI},{command:"FindWidget.focusFind",key:ze|te,when:kI},{command:"FindWidget.focusReplaceAllButton",key:te,when:SI},{command:"FindWidget.focusCloseButton",key:ze|te,when:SI},{command:"FindWidget.focusReplaceButton",key:ze|te,when:CI},{command:"EditorCompletion.focusNext",key:de,when:pI},{command:"EditorCompletion.focusPrevious",key:ie,when:pI},{command:"EditorCompletion.selectCurrent",key:ne,when:pI},{command:"EditorCompletion.close",key:ee,when:pI},{command:"EditorCompletion.focusLast",key:se,when:pI},{command:"EditorCompletion.focusFirst",key:ce,when:pI},{command:"EditorCompletion.toggleDetails",key:Ne|oe,when:pI},{command:"Editor.cursorWordRight",key:Ne|ae,when:EI},{command:"Editor.cursorWordLeft",key:Ne|re,when:EI},{command:"Editor.deleteWordPartLeft",key:Ye|Jn,when:EI},{command:"Editor.deleteWordPartRight",key:Ye|le,when:EI},{command:"Editor.deleteWordLeft",key:Ne|Jn,when:EI},{command:"Editor.deleteWordRight",key:Ne|le,when:EI},{command:"Editor.selectNextOccurrence",key:Ne|he,when:EI},{command:"Editor.openColorPicker",key:Ne|we,when:EI},{command:"Editor.showSourceActions3",key:Ne|Me,when:EI},{command:"Editor.handleTab",key:te,when:EI},{command:"Editor.unindent",key:ze|te,when:EI},{command:"Editor.indentLess",key:Ne|Ae,when:EI},{command:"Editor.closeFind",key:ee,when:xI},{command:"Editor.openFind2",key:Ne|ge,when:EI},{command:"Editor.openCodeGenerator",key:Ne|pe,when:EI},{command:"Editor.closeCodeGenerator",key:ee,when:LI},{command:"EditorCodeGenerator.accept",key:ne,when:LI},{command:"Editor.indentMore",key:Ne|Fe,when:EI},{command:"Editor.selectCharacterLeft",key:ze|re,when:EI},{command:"Editor.selectWordLeft",key:Ne|ze|re,when:EI},{command:"Editor.selectCharacterRight",key:ze|ae,when:EI},{command:"Editor.selectWordRight",key:Ne|ze|ae,when:EI},{command:"Editor.selectLine",key:Ne|ye,when:EI},{command:"Editor.deleteAllLeft",key:Ne|ze|Jn,when:EI},{command:"Editor.deleteAllRight",key:Ne|ze|le,when:EI},{command:"Editor.cancelSelection",key:ee,when:EI},{command:"Editor.undo",key:Ne|ke,when:EI},{command:"Editor.cursorLeft",key:re,when:EI},{command:"Editor.cursorRight",key:ae,when:EI},{command:"Editor.cursorUp",key:ie,when:EI},{command:"Editor.cursorDown",key:de,when:EI},{command:"Editor.deleteLeft",key:Jn,when:EI},{command:"Editor.deleteRight",key:le,when:EI},{command:"Editor.insertLineBreak",key:ne,when:EI},{command:"Editor.copyLineDown",key:Ne|ze|he,when:EI},{command:"Editor.moveLineDown",key:Ne|ze|de,when:EI},{command:"Editor.moveLineUp",key:Ne|ze|ie,when:EI},{command:"Editor.openCompletion",key:Ne|oe,when:EI},{command:"Editor.openRename",key:Se,when:EI},{command:"EditorRename.accept",key:ne,when:yI},{command:"Editor.closeRename",key:ee,when:yI},{command:"Editor.cursorHome",key:ce,when:EI},{command:"Editor.cursorEnd",key:se,when:EI},{command:"Editor.toggleComment",key:Ne|Le,when:EI},{command:"Editor.copy",key:Ne|fe,when:EI},{command:"Editor.selectAll",key:Ne|ue,when:EI},{command:"Editor.showHover2",key:Ne|me,when:EI},{command:"Editor.cut",key:Ne|Ie,when:EI},{command:"Editor.paste",key:Ne|xe,when:EI},{command:"Editor.cursorWordPartLeft",key:Ye|re,when:EI},{command:"Editor.cursorWordPartRight",key:Ye|ae,when:EI},{command:"Editor.selectAllOccurrences",key:Ye|Ce,when:EI},{command:"Editor.addCursorAbove",key:Ye|ze|ie,when:EI},{command:"Editor.addCursorBelow",key:Ye|ze|de,when:EI},{command:"Editor.findAllReferences",key:Ye|ze|be,when:EI},{command:"Editor.organizeImports",key:Ye|ze|Ee,when:EI},{command:"Editor.selectionGrow",key:Ne|ze|oe,when:wI}];const jI=()=>Jo();const qI={CommandPalette:"Command Palette"};const GI=()=>zu(qI.CommandPalette);const XI={command:"",flags:_e,id:"separator",label:""};const ZI=()=>[{command:"Editor.goToDefinition",flags:Ve,id:"go-to-definition",label:Sf()},{command:"Editor.goToTypeDefinition",flags:Ve,id:"go-to-type-definition",label:Pf()},XI,{args:["References",true],command:"SideBar.show",flags:Ve,id:"find-all-references",label:Wf()},{args:["Implementations",true],command:"SideBar.show",flags:Ve,id:"find-all-implementations",label:Tf()},XI,{command:"Editor.format",flags:Ve,id:"format",label:zf()},{command:"Editor.showSourceActions2",flags:Ve,id:Ue,label:Lf()},XI,{command:"Editor.cut",flags:Ve,id:"cut",label:Rf()},{command:"Editor.copy",flags:Ve,id:"copy",label:Df()},{command:"Editor.paste",flags:Ve,id:"paste",label:Bf()},XI,{command:"QuickPick.showEverything",flags:Ve,id:"commandPalette",label:GI()}];const QI=()=>[$e];const KI=t=>Sa(t);const JI=async()=>{const t=Jo();const n=t.map(t=>{const n=parseInt(t);const e=Ko(n);return e});const e=n.map(t=>t.newState);const o=await Promise.all(e.map(KI));const s=o.flat();return s};const tk=()=>[{id:"Editor.format",label:zf()},{id:"Editor.showHover",label:Yf()},{id:"Editor.formatForced",label:$f()},{id:"Editor.selectNextOccurrence",label:Uf()},{id:"Editor.selectAllOccurrences",label:_f()},{id:"Editor.goToDefinition",label:Vf()},{id:"Editor.goToTypeDefinition",label:jf()},{id:"Editor.selectInsideString",label:qf()},{aliases:["Indent More","DeIndent"],id:"Editor.indent",label:Gf()},{aliases:["Indent Less","DeIndent"],id:"Editor.unindent",label:Xf()},{id:"Editor.sortLinesAscending",label:Zf()},{id:"Editor.toggleComment",label:Qf()},{id:"Editor.selectUp",label:Kf()},{id:"Editor.selectDown",label:Jf()},{id:"Editor.toggleBlockComment",label:Of()},{id:"Editor.openColorPicker",label:th()},{id:"Editor.closeColorPicker",label:nh()},{id:"Editor.copyLineDown",label:eh()},{id:"Editor.copyLineUp",label:oh()},{id:"Editor.moveLineDown",label:Nf()},{id:"Editor.moveLineUp",label:Hf()},{id:"Editor.showSourceActions2",label:Lf()}];const nk=t=>{const n=Em(t);const{selections:e}=n;return e};const ek=t=>{g(t);const n=Em(t);const{lines:e}=n;return e.join(wr)};const ok="insertText";const sk=(t,n,e)=>{switch(n){case ok:return Hp(t,e);default:return t}};const ck=async(t,n)=>{const e=await On({commandMap:{},messagePort:t});if(n){Yn(n,e)}};const rk=(t,n)=>cp(t,n);const ik=async t=>{const n=await op(t);if(!n){return t}return rk(t,n)};const ak=async()=>{await ym();await wm()};const dk=t=>{switch(t){case De:return`FindWidget`;default:return""}};const lk=async t=>{const n=Object.create(null);for(const e of t){const t=Ko(parseInt(e));const{widgets:o}=t.newState;for(const t of o){const o=_p(t.id);const s=`${e}:${t.newState.uid}`;const c=dk(t.id);const r=await o(`${c}.saveState`,t.newState.uid);n[s]=r}}return n};const uk=async(t,n)=>{const e=[];for(const o of t){const t=parseInt(o);const s=Ko(t);const{widgets:c}=s.newState;const r=[];for(const e of c){const s=_p(e.id);const c=`${o}:${e.newState.uid}`;const i=n[c]||{};const a=dk(e.id);await s(`${a}.create`,e.newState.uid,e.newState.x,e.newState.y,e.newState.width,e.newState.height,t);await s(`${a}.loadContent`,e.newState.uid,i);const d=await s(`${a}.diff2`,e.newState.uid);const l=await s(`${a}.render2`,e.newState.uid,d);const u={...e,newState:{...e.newState,commands:l}};r.push(u)}e.push({...s,newState:{...s.newState,widgets:r}})}return e};const fk={isReloading:false};const hk=async()=>{if(fk.isReloading){return}fk.isReloading=true;const t=Jo();const n=await lk(t);await ak();const e=await uk(t,n);for(const t of e){ts(t.newState.uid,t.oldState,t.newState)}await yo(`Editor.rerender`);fk.isReloading=false};const gk=async t=>{try{await To(t)}catch{await Eo("SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker",t,"HandleMessagePort.handleMessagePort")}};const mk=async()=>{try{const t=await Rn({commandMap:{},send:gk});return t}catch(t){throw new S(t,`Failed to create syntax highlighting worker rpc`)}};const wk=async(t,n)=>{if(t){zc(true);const t=await mk();Uc(t)}if(n){Zr(true)}};const pk=async()=>{const t="Completion Worker";const n="completionWorkerMain.js";const e="Completions.initialize";const o=await $o(t,n,e);return o};const yk=async(t,n)=>{lm(pk);await wk(t,n)};const Ek="editor.lineHeight";const xk="editor.fontSize";const Ik="editor.fontFamily";const kk="editor.letterSpacing";const Sk="editor.tabSize";const Ck="editor.lineNumbers";const vk="editor.diagnostics";const bk="editor.quickSuggestions";const Mk="editor.autoClosingQuotes";const Lk="editor.autoclosingBrackets";const Ak="editor.fontWeight";const Fk=async()=>Boolean(await wa(Lk));const Pk=async()=>Boolean(await wa(Mk));const Wk=async()=>Boolean(await wa(bk));const Tk=async()=>true;const Rk=async()=>await wa(Ek)||20;const Dk=async()=>await wa(xk)||15;const Bk=async()=>await wa(Ik)||"Fira Code";const Ok=async()=>await wa(kk)??.5;const Hk=async()=>await wa(Sk)||2;const Nk=async()=>await wa(Ck)??false;const zk=async()=>[".","/"];const Yk=async()=>await wa(vk)??false;const $k=async()=>await wa(Ak)??400;const Uk=async()=>{const[t,n,e,o,s,c,r,i,a,d,l,u,f]=await Promise.all([Yk(),Bk(),Dk(),$k(),Fk(),Pk(),Tk(),Wk(),Nk(),Rk(),Hk(),Ok(),zk()]);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 _k=(t,n)=>{for(const e of t){if(e?.id===n){return e.tokenize||""}}return""};const Vk=async(t,n)=>{const{assetDir:e,height:o,id:s,platform:c,uri:r,width:i,x:a,y:d}=t;const{completionTriggerCharacters:l,diagnosticsEnabled:u,fontFamily:f,fontSize:h,fontWeight:g,isAutoClosingBracketsEnabled:m,isAutoClosingQuotesEnabled:w,isAutoClosingTagsEnabled:p,isQuickSuggestionsEnabled:y,letterSpacing:E,lineNumbers:x,rowHeight:I,tabSize:k}=await Uk();const S=await ma(g,h,f,E);const C=await ga(c,e);Zc(C);const v=ha(r,C);const b=_k(C,v);await nr(v,b);const M=er(v);const L=t.tokenizerId+1;sr(L,M);const A={...t,charWidth:S,completionTriggerCharacters:l,diagnosticsEnabled:u,fontFamily:f,fontSize:h,fontWeight:g,isAutoClosingBracketsEnabled:m,isAutoClosingQuotesEnabled:w,isAutoClosingTagsEnabled:p,isQuickSuggestionsEnabled:y,languageId:v,letterSpacing:E,lineNumbers:x,rowHeight:I,tabSize:k,tokenizerId:L};const F=await So(r);const P=na(A,a,d,i,o,9);const W=ea(P,F);let T=W;const R=ci(T);const D={...T,decorations:R};const B=Qr();const{differences:O,textInfos:H}=await Ur(D,B);const N={...D,differences:O,focus:co,focused:true,textInfos:H};await ia(ra,r,s,v,F);if(u){await Ma(N)}const z=await wa("editor.completionsOnType");const Y=Boolean(z);const $={...N,completionsOnType:Y,initial:false};return $};const jk=t=>t;const qk=t=>t;const Gk=(t,n)=>{g(t);g(n);di(t,n)};const Xk=(t,n,e)=>`.Editor {\n --EditorRowHeight: ${t}px;\n --ScrollBarHeight: ${n}px;\n --ScrollBarTop: ${e}px;\n}\n.Editor .EditorRow {\n height: var(--EditorRowHeight);\n line-height: var(--EditorRowHeight);\n}\n.Editor .ScrollBarThumbVertical {\n height: var(--ScrollBarHeight);\n translate: 0px var(--ScrollBarTop);\n}\n`;const Zk=(t,n)=>{const{deltaY:e,finalDeltaY:o,height:s,rowHeight:c,scrollBarHeight:r,uid:i}=n;const a=Vr(e,o,s,r);const d=Xk(c,r,a);return[eo,i,d]};const Qk=(t,n)=>{const e=".EditorInput";return[no,n.uid,e]};const Kk=(t,n)=>[oo,n.uid,co];const Jk=1;const tS=2;const nS=3;const eS=4;const oS=6;const sS=7;const cS=8;const rS=9;const iS=10;const aS=11;const dS=t=>t!=="type"&&t!=="childCount";const lS=t=>{const n=Object.keys(t).filter(dS);return n};const uS=t=>{const n=[];let e=0;while(e<t.length){const o=t[e];const{children:s,nodesConsumed:c}=fS(t,e+1,o.childCount||0);n.push({node:o,children:s});e+=1+c}return n};const fS=(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}=fS(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 hS=(t,n)=>{if(t.type!==n.type){return null}const e=[];if(t.type===jn){if(t.uid!==n.uid){e.push({type:aS,uid:n.uid})}return e}if(t.type===Vn&&n.type===Vn){if(t.text!==n.text){e.push({type:Jk,value:n.text})}return e}const o=lS(t);const s=lS(n);for(const o of s){if(t[o]!==n[o]){e.push({type:nS,key:o,value:n[o]})}}for(const t of o){if(!Object.hasOwn(n,t)){e.push({type:eS,key:t})}}return e};const gS=t=>{const n=[t.node];for(const e of t.children){n.push(...gS(e))}return n};const mS=(t,n,e)=>{if(n===-1){t.push({type:sS,index:e});return e}if(n!==e){t.push({type:iS,index:e})}return e};const wS=(t,n)=>{if(n>=0){t.push({type:cS})}return-1};const pS=(t,n)=>{n.push({type:oS,nodes:gS(t)})};const yS=(t,n)=>{n.push({type:tS,nodes:gS(t)})};const ES=(t,n,e,o,s)=>{const c=hS(t.node,n.node);if(c===null){const t=mS(e,o,s);yS(n,e);return t}const r=t.children.length>0||n.children.length>0;if(c.length===0&&!r){return o}const i=mS(e,o,s);if(c.length>0){e.push(...c)}if(r){IS(t.children,n.children,e)}return i};const xS=(t,n,e)=>{const o=hS(t.node,n.node);if(o===null){yS(n,e);return}if(o.length>0){e.push(...o)}if(t.children.length>0||n.children.length>0){IS(t.children,n.children,e)}};const IS=(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=wS(e,s);pS(i,e);continue}if(!i){c.push(r);continue}s=ES(o,i,e,s,r)}wS(e,s);for(let t=c.length-1;t>=0;t--){e.push({type:rS,index:c[t]})}};const kS=(t,n,e,o)=>{if(o.length===0&&t.length===1&&n.length===1){xS(t[0],n[0],e);return}IS(t,n,e)};const SS=t=>{let n=-1;for(let e=t.length-1;e>=0;e--){const o=t[e];if(o.type!==sS&&o.type!==cS&&o.type!==iS){n=e;break}}return n===-1?[]:t.slice(0,n+1)};const CS=(t,n)=>{const e=uS(t);const o=uS(n);const s=[];kS(e,o,s,[]);return SS(s)};const vS=()=>[{ariaAutoComplete:"list",ariaMultiLine:"true",ariaRoleDescription:"editor",autocapitalize:"off",autocomplete:"off",autocorrect:"off",childCount:0,className:"EditorInput",name:"editor",onBeforeInput:jE,onBlur:qE,onCompositionEnd:XE,onCompositionStart:ZE,onCompositionUpdate:QE,onCut:JE,onFocus:tx,onPaste:ox,role:"textbox",spellcheck:false,type:Ex,wrap:"off"}];const bS=t=>{const n=Array.from(t,t=>({childCount:0,className:WE,translate:t,type:mx}));return n};const MS=t=>{const n=bS([...t]);return[{childCount:t.length,className:"LayerCursor",type:mx},...n]};const LS="error";const AS="warning";const FS=t=>{switch(t){case LS:return ME;case AS:return LE;default:return ME}};const PS=(...t)=>t.filter(Boolean).join(" ");const WS=t=>{const{height:n,type:e,width:o,x:s,y:c}=t;const r=FS(e);return[{childCount:0,className:PS(PE,r),height:n,left:s,top:c,type:mx,width:o}]};const TS=t=>{const n=t.flatMap(WS);return n};const RS=t=>{const n=TS([...t]);return[{childCount:t.length,className:"LayerDiagnostics",type:mx},...n]};const DS=(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=TE;if(e===o){i+=" "+RE}s.push({childCount:c.length/2,className:i,translate:bi(r),type:mx});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:px},xx(n))}}return s};const BS=(t,n,e=true,o=-1)=>{const s=DS(t,n,e,o);return[{childCount:t.length,className:"EditorRows",onMouseDown:nx,onPointerDown:sx,onWheel:gx,type:mx},...s]};const OS=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:DE,height:r,left:o,top:s,type:mx,width:c})}return n};const HS=t=>{const n=OS(t);return[{childCount:t.length/4,className:"Selections",type:mx},...n]};const NS=(t,n,e,o=true,s=-1,c=[],r=[])=>[{childCount:4,className:"EditorLayers",type:mx},...HS(t),...BS(n,e,o,s),...MS(c),...RS(r)];const zS=t=>[{childCount:t.length,className:"EditorScrollBarDiagnostics",type:mx},...TS([...t])];const YS=(t,n,e,o)=>{const s=Vr(t,n,e,o);return[{childCount:1,className:"ScrollBar ScrollBarVertical",onContextMenu:KE,onPointerDown:ux,type:mx},{childCount:0,className:"ScrollBarThumb ScrollBarThumbVertical",style:`height:${o}px;`,translate:`0 ${s}px`,type:mx},{childCount:1,className:"ScrollBar ScrollBarHorizontal",onPointerDown:ax,type:mx},{childCount:0,className:"ScrollBarThumb ScrollBarThumbHorizontal",type:mx}]};const $S=({cursorInfos:t=[],deltaY:n=0,diagnostics:e=[],differences:o,finalDeltaY:s=0,height:c=0,highlightedLine:r=-1,lineNumbers:i=true,scrollBarDiagnostics:a=[],scrollBarHeight:d=0,selectionInfos:l=[],textInfos:u})=>[{childCount:5,className:"EditorContent",onMouseMove:ex,type:mx},...vS(),...NS(l,u,o,i,r,t,e),...zS(a),...YS(n,s,c,d)];const US=t=>[{childCount:1,className:"LineNumber",type:px},xx(t)];const _S=t=>{const n=t.flatMap(US);return n};const VS=t=>{const n=_S([...t]);return[{childCount:t.length,className:"Gutter",type:mx},...n]};const jS=({cursorInfos:t=[],deltaY:n=0,diagnostics:e=[],differences:o,finalDeltaY:s=0,gutterInfos:c=[],height:r=0,highlightedLine:i=-1,lineNumbers:a=true,scrollBarDiagnostics:d=[],scrollBarHeight:l=0,selectionInfos:u=[],textInfos:f})=>[{childCount:2,className:"Viewlet Editor",onContextMenu:KE,role:"code",type:mx},...VS(c),...$S({cursorInfos:t,deltaY:n,diagnostics:e,differences:o,finalDeltaY:s,height:r,highlightedLine:i,lineNumbers:a,scrollBarDiagnostics:d,scrollBarHeight:l,selectionInfos:u,textInfos:f})];const qS=t=>{const{initial:n,textInfos:e}=t;if(n&&e.length===0){return[]}return jS(t)};const GS=(t,n)=>{const e=qS(t);const o=qS(n);const s=CS(e,o);if(s.length===0){return[]}return[so,n.uid,s]};const XS=t=>{switch(t){case Ra:return Zk;case Wa:return Qk;case Ta:return Kk;case Da:return GS;default:throw new Error("unknown renderer")}};const ZS=(t,n,e)=>{const o=[];for(const s of e){const e=XS(s);const c=e(t,n);if(c.length>0){o.push(c)}}return o};const QS=(t,n)=>{const{newState:e,oldState:o}=Ko(t);ts(t,e,e);const s=ZS(o,e,n);return s};const KS=t=>{const n=Fs(t.id);if(!n){throw new Error("unsupported widget")}return n.add(t)};const JS=t=>{const n=Fs(t.id);if(!n){throw new Error("unsupported widget")}return n.render(t)};const tC=t=>{const n=Fs(t.id);if(!n){throw new Error("unsupported widget")}return n.remove(t)};const nC={apply(t,n){const{incrementalEdits:e}=n;if(e!==ns){return["setIncrementalEdits",e]}const{differences:o,textInfos:s}=n;n.differences=o;const{highlightedLine:c,minLineY:r}=n;const i=c-r;const a=DS(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 eC={apply:(t,n)=>{const{cursorInfos:e=[],selectionInfos:o=[]}=n;const s=bS(e);const c=OS(o);return["setSelections",s,c]},isEqual:(t,n)=>t.cursorInfos===n.cursorInfos&&t.selectionInfos===n.selectionInfos};const oC={apply(t,n){const e=Vr(n.deltaY,n.finalDeltaY,n.height,n.scrollBarHeight);const o=`0 ${e}px`;const s=`${n.scrollBarHeight}px`;return["setScrollBar",o,s]},isEqual:(t,n)=>t.deltaY===n.deltaY&&t.scrollBarHeight===n.scrollBarHeight};const sC={apply(t,n){const e=jr(n.width,n.longestLineWidth,n.minimumSliderSize);const o=n.deltaX/n.longestLineWidth*n.width;return["setScrollBarHorizontal",o,e,n.deltaX]},isEqual:(t,n)=>t.longestLineWidth===n.longestLineWidth&&t.deltaX===n.deltaX};const cC={apply:(t,n)=>["setFocused",n.focused],isEqual:(t,n)=>t.focused===n.focused};const rC={apply:(t,n)=>[oo,n.uid,n.focus,0,n.uid,"Editor"],isEqual:(t,n)=>t.focus===n.focus};const iC={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 aC={apply(t,n){const e=TS(n.visualDecorations||[]);return["setDecorationsDom",e]},isEqual:(t,n)=>t.visualDecorations===n.visualDecorations};const dC={apply(t,n){const{lineNumbers:e,maxLineY:o,minLineY:s}=n;const c=[];if(e){for(let t=s;t<o;t++){c.push(t+1)}}const r=_S(c);return["renderGutter",r]},isEqual:(t,n)=>t.minLineY===n.minLineY&&t.maxLineY===n.maxLineY};const lC={apply(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=KS(t);if(n.length>0){d.push(...n)}}const l=[];for(const t of o){const n=JS(t);if(n.length>0){l.push(...n)}}const u=[];for(const t of s){const n=tC(t);if(n.length>0){u.push(...n)}}const f=[...d,...l,...u];const h=f.filter(t=>t[0]!=="Viewlet.setFocusContext");return h},isEqual:(t,n)=>t.widgets===n.widgets,multiple:true};const uC=[nC,eC,sC,oC,cC,aC,dC,lC,rC,iC];const fC=async t=>{const n=Ko(t);if(!n){return[]}const{newState:e,oldState:o}=n;const s=[];ts(t,e,e);for(const t of uC){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 hC=()=>[{name:tx,params:["handleFocus"]},{name:ex,params:["handleMouseMove",Xn,Zn,qn]},{name:qE,params:["handleBlur"]},{name:jE,params:["handleBeforeInput","event.inputType","event.data"],preventDefault:true},{name:ZE,params:["compositionStart","event.data"]},{name:QE,params:["compositionUpdate","event.data"]},{name:XE,params:["compositionEnd","event.data"]},{name:JE,params:["cut"],preventDefault:true},{name:ox,params:["paste",'event.clipboardData ? event.clipboardData.getData("text/plain") : ""'],preventDefault:true},{name:nx,params:["handleMouseDown","event.button","event.altKey","event.ctrlKey",Xn,Zn,"event.detail"]},{name:sx,params:["handlePointerDown","event.button","event.altKey","event.ctrlKey",Xn,Zn,"event.detail"],trackPointerEvents:[cx,rx]},{name:cx,params:["handlePointerMove",Xn,Zn,qn]},{name:rx,params:["handlePointerUp"]},{name:gx,params:["handleWheel",Qn,"event.deltaX",Kn],passive:true},{name:KE,params:["handleContextMenu",Gn,Xn,Zn],preventDefault:true},{name:ux,params:["handleScrollBarVerticalPointerDown",Zn],preventDefault:true,trackPointerEvents:[fx,hx]},{name:fx,params:["handleScrollBarVerticalPointerMove",Zn]},{name:hx,params:["handlePointerUp"]},{name:ax,params:["handleScrollBarHorizontalPointerDown",Xn],trackPointerEvents:[dx,lx]},{name:dx,params:["handleScrollBarHorizontalMove",Xn]},{name:lx,params:["handlePointerUp"]}];const gC=(t,n)=>{const{lines:e}=t;return{lines:e}};const mC=async(t,n,e)=>{await vo(t,e)};const wC=async(t,n)=>{await Fo(t,n)};const pC=(t,n)=>t;const yC=(t,n)=>{g(t);g(n);li(t,n)};const EC=async(t,...n)=>{const e=$n(qe);return e.invoke(t,...n)};const xC=async t=>{const n=await EC("RunAndDebug.getHighlight",t);return n};const IC=()=>{const t=Jo();return parseInt(t[0])};const kC=async t=>{const n=await xC(t);const e=IC();const o=Ko(e);if(!o){return}const{newState:s,oldState:c}=o;const r={...s,highlightedLine:n.rowIndex};ts(e,c,r);await yo("Editor.rerender",e)};const SC=t=>async(n,...e)=>{const o=Ko(n);const s=o.newState;const c=await t(s,...e);if(s===c){return c}const r=await mI(s,c);ts(n,s,r);return r};const CC={"ActivateByEvent.activateByEvent":No,"CodeGenerator.accept":zo,"ColorPicker.loadContent":qo,"Editor.addCursorAbove":SC(Ya),"Editor.addCursorBelow":SC(Ua),"Editor.applyDocumentEdits":SC(qa),"Editor.applyEdit":SC(Ga),"Editor.applyEdit2":YI,"Editor.applyWorkspaceEdit":SC(Za),"Editor.braceCompletion":SC(wd),"Editor.cancelSelection":SC(pd),"Editor.closeCodeGenerator":SC(Id),"Editor.closeFind":SC(Sd),"Editor.closeFind2":zI,"Editor.closeRename":SC(Ad),"Editor.closeSourceAction":SC(Pd),"Editor.closeWidget2":NI,"Editor.compositionEnd":SC($d),"Editor.compositionStart":SC(Nd),"Editor.compositionUpdate":SC(Yd),"Editor.contextMenu":SC(Fh),"Editor.copy":SC(jd),"Editor.copyLineDown":SC(qd),"Editor.copyLineUp":SC(Gd),"Editor.create":La,"Editor.create2":ls,"Editor.cursorCharacterLeft":SC(zl),"Editor.cursorCharacterRight":SC(Vl),"Editor.cursorDown":SC(Gl),"Editor.cursorEnd":SC(Xl),"Editor.cursorHome":SC(Zl),"Editor.cursorLeft":SC(zl),"Editor.cursorRight":SC(Vl),"Editor.cursorSet":SC(Ql),"Editor.cursorUp":SC(nu),"Editor.cursorWordLeft":SC(eu),"Editor.cursorWordPartLeft":SC(ou),"Editor.cursorWordPartRight":SC(su),"Editor.cursorWordRight":SC(cu),"Editor.cut":SC(au),"Editor.deleteAll":SC(du),"Editor.deleteAllLeft":SC(mu),"Editor.deleteAllRight":SC(yu),"Editor.deleteCharacterLeft":SC(Eu),"Editor.deleteCharacterRight":SC(xu),"Editor.deleteHorizontalRight":SC(pu),"Editor.deleteLeft":SC(Eu),"Editor.deleteRight":SC(xu),"Editor.deleteWordLeft":SC(Iu),"Editor.deleteWordPartLeft":SC(ku),"Editor.deleteWordPartRight":SC(Su),"Editor.deleteWordRight":SC(Cu),"Editor.diff2":Na,"Editor.executeWidgetCommand":SC(rI),"Editor.findAllReferences":SC(vu),"Editor.format":SC(Fu),"Editor.getCommandIds":Xo,"Editor.getDiagnostics":UI,"Editor.getKeyBindings":VI,"Editor.getKeys":jI,"Editor.getLanguageId":PI,"Editor.getLines2":BI,"Editor.getMenuEntries":ZI,"Editor.getMenuEntries2":ZI,"Editor.getMenuIds":QI,"Editor.getOffsetAtCursor":WI,"Editor.getPositionAtCursor":AI,"Editor.getProblems":JI,"Editor.getQuickPickMenuEntries":tk,"Editor.getSelections":nk,"Editor.getSelections2":OI,"Editor.getSourceActions":$I,"Editor.getText":ek,"Editor.getUri":FI,"Editor.getWordAt":Du,"Editor.getWordAt2":TI,"Editor.getWordAtOffset2":RI,"Editor.getWordBefore":Bu,"Editor.getWordBefore2":DI,"Editor.goToDefinition":SC(dh),"Editor.goToTypeDefinition":SC(mh),"Editor.handleBeforeInput":SC(sk),"Editor.handleBeforeInputFromContentEditable":SC(og),"Editor.handleBlur":SC(Qa),"Editor.handleClickAtPosition":SC(Lh),"Editor.handleContextMenu":SC(Fh),"Editor.handleDoubleClick":SC(Dh),"Editor.handleFocus":SC(Bh),"Editor.handleMouseDown":SC(Vh),"Editor.handleMouseMove":SC(Kh),"Editor.handleMouseMoveWithAltKey":SC(tg),"Editor.handleNativeSelectionChange":sg,"Editor.handlePointerCaptureLost":SC(gg),"Editor.handlePointerDown":SC(mg),"Editor.handlePointerMove":SC(Pg),"Editor.handlePointerUp":SC(Wg),"Editor.handleScrollBarClick":Ng,"Editor.handleScrollBarHorizontalMove":SC(Rg),"Editor.handleScrollBarHorizontalPointerDown":SC(Dg),"Editor.handleScrollBarMove":SC(Og),"Editor.handleScrollBarPointerDown":SC(Ng),"Editor.handleScrollBarVerticalMove":SC(Hg),"Editor.handleScrollBarVerticalPointerDown":SC(Ng),"Editor.handleScrollBarVerticalPointerMove":SC(Hg),"Editor.handleSingleClick":SC(zh),"Editor.handleTab":SC(ik),"Editor.handleTouchEnd":SC(zg),"Editor.handleTouchMove":SC(jg),"Editor.handleTouchStart":SC($g),"Editor.handleTripleClick":SC(Uh),"Editor.handleWheel":SC(qg),"Editor.hotReload":hk,"Editor.indendLess":SC(Xg),"Editor.indentMore":SC(Qg),"Editor.insertLineBreak":SC(em),"Editor.loadContent":SC(Vk),"Editor.moveLineDown":SC(jk),"Editor.moveLineUp":SC(qk),"Editor.moveRectangleSelection":SC(wg),"Editor.moveRectangleSelectionPx":SC(pg),"Editor.moveSelection":SC(Mg),"Editor.moveSelectionPx":SC(Fg),"Editor.offsetAt":Pr,"Editor.openCodeGenerator":SC(im),"Editor.openColorPicker":SC(Od),"Editor.openCompletion":SC(fm),"Editor.openFind":SC(Sm),"Editor.openFind2":SC(km),"Editor.openRename":SC(Mm),"Editor.organizeImports":SC(Am),"Editor.paste":SC(Pm),"Editor.pasteText":SC(Fm),"Editor.redo":SC(Wm),"Editor.render":fC,"Editor.render2":QS,"Editor.renderEventListeners":hC,"Editor.replaceRange":SC(Ka),"Editor.rerender":SC(Nx),"Editor.save":SC(Gm),"Editor.saveState":Qo(gC),"Editor.selectAll":SC(Xm),"Editor.selectAllLeft":SC(Km),"Editor.selectAllOccurrences":SC(dw),"Editor.selectAllRight":SC(fw),"Editor.selectCharacterLeft":SC(hw),"Editor.selectCharacterRight":SC(gw),"Editor.selectDown":SC(ww),"Editor.selectInsideString":SC(yw),"Editor.selectionGrow":SC(xw),"Editor.selectLine":SC($h),"Editor.selectNextOccurrence":SC(Cw),"Editor.selectPreviousOccurrence":SC(vw),"Editor.selectUp":SC(Mw),"Editor.selectWord":SC(Rh),"Editor.selectWordLeft":SC(Lw),"Editor.selectWordRight":SC(Aw),"Editor.setDebugEnabled":SC(pC),"Editor.setDecorations":SC(Fw),"Editor.setDelta":SC(Vg),"Editor.setDeltaY":SC(Ug),"Editor.setLanguageId":SC(Pw),"Editor.setSelections":SC(Ww),"Editor.setSelections2":HI,"Editor.setText":SC(Tw),"Editor.showHover":$w,"Editor.showHover2":zw,"Editor.showSourceActions":Xw,"Editor.showSourceActions2":Xw,"Editor.showSourceActions3":Xw,"Editor.sortLinesAscending":SC(tp),"Editor.tabCompletion":SC(ip),"Editor.terminate":e,"Editor.toggleBlockComment":SC(gp),"Editor.toggleComment":SC(Ep),"Editor.toggleLineComment":SC(yp),"Editor.type":SC(xp),"Editor.typeWithAutoClosing":SC(Hp),"Editor.undo":SC(zp),"Editor.unIndent":SC(Yp),"Editor.updateDebugInfo":kC,"Editor.updateDiagnostics":SC(Ma),"EditorCompletion.close":ly,"EditorCompletion.closeDetails":uy,"EditorCompletion.focusFirst":fy,"EditorCompletion.focusIndex":hy,"EditorCompletion.focusNext":my,"EditorCompletion.focusPrevious":wy,"EditorCompletion.handleEditorBlur":py,"EditorCompletion.handleEditorClick":yy,"EditorCompletion.handleEditorDeleteLeft":Ey,"EditorCompletion.handleEditorType":xy,"EditorCompletion.handlePointerDown":Iy,"EditorCompletion.handleWheel":ky,"EditorCompletion.openDetails":Sy,"EditorCompletion.selectCurrent":Cy,"EditorCompletion.selectIndex":vy,"EditorCompletion.toggleDetails":by,"EditorRename.accept":Dx,"EditorRename.close":Bx,"EditorRename.handleInput":Ox,"EditorSourceAction.close":qx,"EditorSourceAction.closeDetails":Gx,"EditorSourceAction.focusFirst":Xx,"EditorSourceAction.focusIndex":Zx,"EditorSourceAction.focusNext":Kx,"EditorSourceAction.focusPrevious":Jx,"EditorSourceAction.handleWheel":tI,"EditorSourceAction.selectCurrent":nI,"EditorSourceAction.selectIndex":eI,"EditorSourceAction.selectItem":oI,"EditorSourceAction.toggleDetails":sI,"EditorSourceActions.focusNext":Yx,"ExtensionHostManagement.activateByEvent":No,"FindWidget.close":Ty,"FindWidget.focusCloseButton":Ry,"FindWidget.focusFind":Dy,"FindWidget.focusNext":By,"FindWidget.focusNextElement":Oy,"FindWidget.focusNextMatchButton":Hy,"FindWidget.focusPrevious":Ny,"FindWidget.focusPreviousElement":zy,"FindWidget.focusPreviousMatchButton":Yy,"FindWidget.focusReplace":$y,"FindWidget.focusReplaceAllButton":Uy,"FindWidget.focusReplaceButton":_y,"FindWidget.focusToggleReplace":Vy,"FindWidget.handleBlur":jy,"FindWidget.handleClickButton":qy,"FindWidget.handleFocus":Gy,"FindWidget.handleInput":Xy,"FindWidget.handleReplaceFocus":Zy,"FindWidget.handleReplaceInput":Qy,"FindWidget.handleToggleReplaceFocus":Ky,"FindWidget.loadContent":xm,"FindWidget.replace":Jy,"FindWidget.replaceAll":tE,"FindWidget.toggleMatchCase":nE,"FindWidget.toggleMatchWholeWord":eE,"FindWidget.togglePreserveCase":oE,"FindWidget.toggleReplace":sE,"FindWidget.toggleUseRegularExpression":cE,"Font.ensure":_I,"HandleMessagePort.handleMessagePort":ck,"Hover.getHoverInfo":EE,"Hover.handleSashPointerDown":IE,"Hover.handleSashPointerMove":kE,"Hover.handleSashPointerUp":SE,"Hover.loadContent":xE,"Hover.render":Fx,"Initialize.initialize":yk,"Listener.register":Gk,"Listener.registerListener":di,"Listener.unregister":yC,"SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker":mC,"SendMessagePortToExtensionManagementWorker.sendMessagePortToExtensionManagementWorker":wC};for(const[t,n]of Object.entries(CC)){if(t.startsWith("Editor.")){CC["EditorText"+t.slice("Editor".length)]=n}}const vC=async()=>{const t="HandleMessagePort.handleMessagePort2";const n=await Bn({commandMap:{},async send(n){await mC(n,t,Ge)}});return n};const bC=async()=>{const t=await vC();aa(t)};const MC=async()=>{const t=await Bn({commandMap:{},async send(t){await Fo(t,Ge)}});return t};const LC=async()=>{try{const t=await MC();uo(t)}catch{}};const AC=t=>ko(t);const FC=async()=>{const t=await Bn({commandMap:{},send:AC});go(t)};const PC=async()=>{const t=await Hn({commandMap:CC});xo(t)};const WC=t=>Ao(t);const TC=async()=>{const t=await Bn({commandMap:{},send:WC});po(t)};const RC=async()=>{Zo(CC);await Promise.all([PC(),bC(),LC(),TC(),FC()])};const DC="CodeGeneratorInput";const BC=t=>{const n=Af();const e=Ff();return[{childCount:2,className:PS(VE,bE),type:mx},{childCount:0,className:PS(CE,UE),name:DC,placeholder:e,type:wx},{childCount:1,className:vE,type:mx},xx(n)]};const OC={apply(t,n){const e=BC();return[oy,n.uid,e]},isEqual:(t,n)=>t.questions===n.questions};const HC={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[ty,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height};const NC={apply:(t,n)=>[Xp,".CodeGeneratorInput",n.focusSource],isEqual:(t,n)=>t.focused===n.focused&&t.focusSource===n.focusSource};const zC=[OC,HC,NC];const YC=(t,n)=>{const e=[];for(const o of zC){if(!o.isEqual(t,n)){e.push(o.apply(t,n))}}return e};const $C=t=>{const n=YC(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(t[0]===oy){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const UC=t=>Up(t,"EditorCodeGenerator",$C);const _C=$x;const VC={__proto__:null,add:UC,remove:_C,render:$C};const jC=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const qC=[oy,ey,Gp,ny,Zp,sy];const GC=t=>{const n=jC(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(qC.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const XC=t=>Up(t,"ColorPicker",GC);const ZC=$x;const QC={};const KC={__proto__:null,Commands:QC,add:XC,remove:ZC,render:GC};const JC=t=>{const n=[{childCount:2,className:"Viewlet EditorCompletionDetails",type:mx},{childCount:1,className:FE,type:mx},xx(t),{childCount:1,className:AE,onClick:GE,type:mx},{childCount:0,className:`${_E} ${$E}`,type:mx}];return n};const tv=(t,n,e)=>{const o=[];for(const s of t){if(!s.isEqual(n,e)){o.push(s.apply(n,e))}}return o};const nv={apply(t,n){const e=JC(n.content);return[oy,n.uid,e]},isEqual:(t,n)=>t.content===n.content};const ev={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[ty,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height};const ov=[nv,ev];const sv=(t,n)=>tv(ov,t,n);const cv=(t,n)=>{const{widgets:e}=t;for(const t of e){if(t.id===n){return t.newState}}return undefined};const rv=t=>cv(t,Te);const iv=t=>{const n=sv(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(t[0]===oy){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const av=t=>Up(t,"EditorCompletionDetails",iv);const dv=$x;const lv=(t,n)=>{const e=rv(t);if(!e){return t}const{x:o}=Cm(t);const s=o+e.width-n.borderSize;return{...n,x:s}};const uv=(t,n)=>lv(t,n);const fv=(t,n)=>lv(t,n);const hv={__proto__:null,add:av,handleEditorDeleteLeft:fv,handleEditorType:uv,remove:dv,render:iv};const gv=[oy,ey,Gp,ny,Zp,Qp,Kp,Jp,sy,"Viewlet.focusSelector"];const mv=t=>{const n=cy(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(gv.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const wv=t=>Up(t,"EditorCompletion",mv);const pv=t=>[["Viewlet.dispose",t.newState.uid]];const{close:yv}=qp(["close"],"",Be);const Ev={__proto__:null,add:wv,close:yv,remove:pv,render:mv};const xv=()=>{As(We,KC);As(Te,My);As(Re,hv);As(De,rE);As(Be,Ev);As(Oe,Hx);As(He,cI);As(Pe,VC)};const Iv=t=>{t.preventDefault();console.error(`[editor-worker] Unhandled Rejection: ${t.reason}`)};const kv=(t,n,e,o,s)=>{console.error(`[editor-worker] Unhandled Error: ${s}`);return true};const Sv=t=>{t.addEventListener("error",kv);t.addEventListener("unhandledrejection",Iv)};const Cv=async()=>{Sv(globalThis);await RC();xv()};Cv();
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 x=(t,n)=>{const e=y(`${t}`);if(n){return`${n}: ${e}`}return e};const E="\n";const I=(t,n=undefined)=>t.indexOf(E,n);const k=(t,n)=>{if(!n){return t}const e=I(t);const o=I(n);if(o===-1){return t}const s=t.slice(0,e);const c=n.slice(o);const r=y(n.slice(0,o));if(s.includes(r)){return s+c}return n};class S extends Error{constructor(t,n){const e=x(t,n);super(e);this.name="VError";if(t instanceof Error){this.stack=k(this.stack,t.stack)}if(t.codeFrame){this.codeFrame=t.codeFrame}if(t.code){this.code=t.code}}}const C=t=>t&&t instanceof MessagePort;const v=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 L=t=>M(t,"Socket");const A=[C,v,b,L];const P=t=>{for(const n of A){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 B="E_MODULES_NOT_SUPPORTED_IN_ELECTRON";const O="ERR_MODULE_NOT_FOUND";const H="\n";const N=t=>t.join(H);const z=/^\s+at/;const Y=/^\s*at async Promise.all \(index \d+\)$/;const $=t=>z.test(t)&&!Y.test(t);const U=t=>{const n=t.findIndex($);if(n===-1){return{actualMessage:N(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(H);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:O,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:B,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}=U(e);return{code:"",message:o,stack:s}};class rt extends S{constructor(t,n="",e=""){if(n||e){const{code:o,message:s,stack:c}=ct(n,e);const r=new Error(s);r.code=o;r.stack=c;super(r,t)}else{super(t)}this.name="IpcError";this.stdout=n;this.stderr=e}}const it="ready";const at=t=>t.data;const dt=()=>{if(typeof WorkerGlobalScope==="undefined"){throw new TypeError("module is not in web worker scope")}return globalThis};const lt=t=>{t.postMessage(it)};class ut extends R{getData(t){return at(t)}send(t){this._rawIpc.postMessage(t)}sendAndTransfer(t){const n=W(t);this._rawIpc.postMessage(t,n)}dispose(){}onClose(t){}onMessage(t){this._rawIpc.addEventListener("message",t)}}const ft=t=>new ut(t);const ht=async t=>{const{promise:n,resolve:e}=Promise.withResolvers();t.addEventListener("message",e,{once:true});const o=await n;return o.data};const gt=async()=>{const t=dt();lt(t);const n=ft(t);const e=await ht(n);if(e.method!=="initialize"){throw new rt("unexpected first message")}const o=e.params[0];if(o==="message-port"){n.send({id:e.id,jsonrpc:"2.0",result:null});n.dispose();const t=e.params[1];return t}return globalThis};class mt extends R{getData(t){return at(t)}send(t){this._rawIpc.postMessage(t)}sendAndTransfer(t){const n=W(t);this._rawIpc.postMessage(t,n)}dispose(){if(this._rawIpc.close){this._rawIpc.close()}}onClose(t){}onMessage(t){this._rawIpc.addEventListener("message",t);this._rawIpc.start()}}const wt=t=>new mt(t);const pt={__proto__:null,listen:gt,wrap:wt};const yt=(t,n,e)=>{if("addEventListener"in t){t.addEventListener(n,e)}else{t.on(n,e)}};const xt=(t,n,e)=>{if("removeEventListener"in t){t.removeEventListener(n,e)}else{t.off(n,e)}};const Et=(t,n)=>{const{promise:e,resolve:o}=Promise.withResolvers();const s=Object.create(null);const c=e=>{for(const e of Object.keys(n)){xt(t,e,s[e])}o(e)};for(const[e,o]of Object.entries(n)){const n=t=>{c({event:t,type:o})};yt(t,e,n);s[e]=n}return e};const It=3;const kt=async({isMessagePortOpen:t,messagePort:n})=>{if(!C(n)){throw new rt("port must be of type MessagePort")}if(t){return n}const e=Et(n,{message:It});n.start();const{event:o,type:s}=await e;if(s!==It){throw new rt("Failed to wait for ipc message")}if(o.data!==it){throw new rt("unexpected first message")}return n};const St=t=>{t.start()};class Ct 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 vt=t=>new Ct(t);const bt={__proto__:null,create:kt,signal:St,wrap:vt};class Mt extends Error{constructor(t){super(`Command not found ${t}`);this.name="CommandNotFoundError"}}const Lt=Object.create(null);const At=t=>{Object.assign(Lt,t)};const Pt=t=>Lt[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 Bt extends Error{constructor(t){super(t);this.name="JsonRpcError"}}const Ot="\n";const Ht="DOMException";const Nt="ReferenceError";const zt="SyntaxError";const Yt="TypeError";const $t=(t,n)=>{if(n){switch(n){case Ht:return DOMException;case Nt:return ReferenceError;case zt:return SyntaxError;case Yt: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 Ut=(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(Ot);const Vt=t=>t.split(Ot);const jt=()=>{const t=3;const n=_t(Vt((new Error).stack||"").slice(t));return n};const qt=(t,n=undefined)=>t.indexOf(Ot,n);const Gt=t=>{let n=t.stack||t.data||t.message||"";if(n.startsWith(" at")){n=t.message+Ot+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+Ot+n}return t}if(t&&t.code&&t.code===Xt){const e=new Bt(t.message);const o=Gt(t);e.stack=o+Ot+n;return e}if(t&&t.message){const e=Ut(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+Ot+t.data.stack+Ot+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 Bt("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 Bt("unexpected message")};const xn="2.0";const En=(t,n)=>({jsonrpc:xn,method:t,params:n});const In=(t,n,e)=>{const o={id:t,jsonrpc:xn,method:n,params:e};return o};let kn=0;const Sn=()=>++kn;const Cn=t=>{const n=Sn();const{promise:e,resolve:o}=Promise.withResolvers();t[n]=o;return{id:n,promise:e}};const vn=async(t,n,e,o,s)=>{const{id:c,promise:r}=Cn(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 vn(n,t,e,o,false)},invokeAndTransfer(e,...o){return vn(n,t,e,o,true)},ipc:t,send(n,...e){const o=En(n,e);t.send(o)}};return e};const Mn=()=>false;const Ln=t=>t;const An=()=>{};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,Ln,An,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})=>{At(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 Bn=async({commandMap:t,isMessagePortOpen:n,send:e})=>Dn(()=>Rn({commandMap:t,isMessagePortOpen:n,send:e}));const On=async({commandMap:t,messagePort:n})=>Tn({commandMap:t,messagePort:n});const Hn=async({commandMap:t})=>{At(t);const n=await Wn(pt);Fn(n);const e=bn(n);return e};const Nn=({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 Yn=(t,n)=>{zn[t]=n};const $n=t=>zn[t];const Un=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=Nn({commandMap:n});Yn(t,e);e[Symbol.dispose]=()=>{Un(t)};return e},set(n){Yn(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 xe=43;const Ee=50;const Ie=52;const ke=54;const Se=58;const Ce=59;const ve=60;const be=68;const Me=87;const Le=88;const Ae=90;const Pe=92;const Fe=1;const We=2;const Te=3;const Re=4;const De=5;const Be=6;const Oe=7;const He=8;const Ne=1<<11>>>0;const ze=1<<10>>>0;const Ye=1<<9>>>0;const $e=3;const Ue=22;const _e=1;const Ve=0;const je=301;const qe=55;const Ge=99;const Xe=44;const Ze=9006;const Qe=7009;const Ke=300;const Je=4561;const to=1;const no="Viewlet.focusSelector";const eo="Viewlet.setCss";const oo="Viewlet.setFocusContext";const so="Viewlet.setPatches";const co=12;const{invoke:ro,set:io}=_n(Xe);const ao={__proto__:null,invoke:ro,set:io};const{invoke:lo,set:uo}=_n(Ze);const fo=(t,n)=>lo("Extensions.getLanguages",t,n);const{invoke:ho,set:go}=_n(Je);const mo=async(t,n)=>ho("Open.openUrl",t,n);const{invoke:wo,set:po}=_n(Qe);const{invoke:yo,invokeAndTransfer:xo,set:Eo}=_n(to);const Io=async(t,n,e,o,s)=>{g(t);g(n);g(e);g(o);await yo("ContextMenu.show2",t,n,e,o,s)};const ko=async(t,n)=>{const e="HandleMessagePort.handleMessagePort";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToOpenerWorker",t,e,n)};const So=async t=>yo("FileSystem.readFile",t);const Co=async()=>yo("Layout.handleWorkspaceRefresh");const vo=async(t,n=0)=>{const e="HandleMessagePort.handleMessagePort2";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker",t,e,n)};const bo=async t=>{await yo("ClipBoard.writeText",t)};const Mo=async()=>yo("ClipBoard.readText");const Lo=(t,n,e)=>yo("ExtensionHostManagement.activateByEvent",t,n,e);const Ao=async t=>{const n="TextMeasurement.handleMessagePort";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToTextMeasurementWorker",t,n,0)};const Po=async(t,n)=>{const e="Extensions.handleMessagePort";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker",t,e,n)};const Fo=async t=>await yo("Preferences.get",t);const Wo=async(t,n,e)=>{await yo("Main.openUri",t,n,e)};const To=async t=>{await xo("SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker",t,"HandleMessagePort.handleMessagePort2")};const Ro={__proto__:null,activateByEvent:Lo,getPreference:Fo,handleWorkspaceRefresh:Co,invoke:yo,invokeAndTransfer:xo,openUri:Wo,readClipBoardText:Mo,readFile:So,sendMessagePortToExtensionHostWorker:vo,sendMessagePortToExtensionManagementWorker:Po,sendMessagePortToOpenerWorker:ko,sendMessagePortToSyntaxHighlightingWorker:To,sendMessagePortToTextMeasurementWorker:Ao,set:Eo,showContextMenu2:Io,writeClipBoardText:bo};const{invoke:Do,set:Bo}=_n(Ke);const Oo={__proto__:null,invoke:Do,set:Bo};const Ho=t=>{let n;let e;const o=async()=>{const n=await e();Yn(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 No=async(t,n,e)=>{w(t);await Lo(t,n,e)};const zo=t=>t;const Yo=6;const $o=async(t,n,e)=>{const o=await Rn({commandMap:{},isMessagePortOpen:true,async send(e){await xo("IpcParent.create",{method:Yo,name:t,port:e,raw:true,url:n})}});if(e){await o.invoke(e)}return o};const Uo=async()=>{const t="Color Picker Worker";const n="colorPickerWorkerMain.js";return $o(t,n)};const _o={};const Vo=()=>{if(!_o.workerPromise){_o.workerPromise=Uo()}return _o.workerPromise};const jo=async(t,...n)=>{const e=await Vo();return await e.invoke(t,...n)};const qo=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;await jo("ColorPicker.create",o,c,r,s,e,n);await jo("ColorPicker.loadContent",o);const i=await jo("ColorPicker.diff2",o);const a=await jo("ColorPicker.render2",o,i);return{...t,commands:a}};const Go=n();const{getCommandIds:Xo,registerCommands:Zo,wrapGetter:Qo}=Go;const Ko=t=>Go.get(t);const Jo=()=>{const t=Go.getKeys();return t.map(String)};const ts=(t,n,e)=>{Go.set(t,n,e)};const ns=[];const es=41;const os=9;const ss=0;const cs=16;const rs=51;const is=11;const as=38;const ds=52;const ls=(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:ss,fontFamily:"",fontSize:0,fontWeight:0,handleOffset:0,handleOffsetX:0,hasListener:false,height:c,highlightedLine:-1,id:t,incrementalEdits:ns,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,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};ts(t,a,a)};const us="compositionUpdate";const fs="contentEditableInput";const hs="delete";const gs="deleteHorizontalRight";const ms="deleteLeft";const ws="editorCut";const ps="editorPasteText";const ys="editorSnippet";const xs="editorType";const Es="editorTypeWithAutoClosing";const Is="format";const ks="indentLess";const Ss="indentMore";const Cs="insertLineBreak";const vs="lineComment";const bs="rename";const Ms="toggleBlockComment";const Ls=Object.create(null);const As=(t,n)=>{Ls[t]=n};const Ps=t=>Ls[t];const Fs=t=>Ps(t);const Ws=async(t,n,e)=>{const o=Fs(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===ms&&o.handleEditorDeleteLeft){const n=await o.handleEditorDeleteLeft(t);return{...n}}return n};const Ts=async(t,n)=>{const e=t.widgets||[];if(e.length===0){return e}let o=t;for(const s of e){o=await Ws(t,s,n)}return o};const Rs=(t,n,e)=>{g(t);g(n);g(e);return Math.min(Math.max(t,n),e)};const Ds="Link";const Bs="Function";const Os="Parameter";const Hs="Type";const Ns="VariableName";const zs="Class";const Ys=1;const $s=2816;const Us=2817;const _s=2824;const Vs=2825;const js=2956;const qs=2857;const Gs=3072;const Xs=3073;const Zs=3077;const Qs=3088;const Ks=1792;const Js=1793;const tc=512;const nc=513;const ec=769;const oc=1024;const sc=1536;const cc=1537;const rc=1544;const ic=1545;const ac=2048;const dc=2049;const lc=2056;const uc=2057;const fc=2064;const hc=2080;const gc=2081;const mc=2088;const wc=2089;const pc=2313;const yc=2560;const xc=2561;const Ec=2569;const Ic=2584;const kc=256;const Sc=257;const Cc=272;const vc=t=>{switch(t){case Ys:return Ds;case oc:case sc:case cc:case rc:case ic:case tc:case nc:case ec:return Hs;case Ks:case Js:return Os;case ac:case dc:case lc:case uc:case fc:case hc:case gc:case mc:case wc:case pc:case yc:case xc:case Ec:case Ic:return Ns;case kc:case Sc:case Cc:return zs;case $s:case Us:case _s:case Vs:case js:case qs:case Gs:case Xs:case Zs:case Qs:return Bs;default:return`Unknown-${t}`}};const bc=t=>structuredClone(t);const Mc=t=>bc(t);const Lc={warned:[]};const Ac=t=>{const n=[];for(const e of t){h(e);n.push(e.type,e.length)}return n};const Pc=(t,n)=>{if(Lc.warned.includes(n)){return}Lc.warned.push(n);console.warn(`tokenizers without hasArrayReturn=false are deprecated (language ${t})`)};const Fc=(t,n,e,o,s)=>{try{const c=n(e,o);if(!c?.tokens||!c.state){throw new Error("invalid tokenization result")}if(!s){Pc(t,n);c.tokens=Ac(c.tokens)}return c}catch(t){console.error(t);return{lineState:o,tokens:[0,e.length]}}};const Wc={TopLevelContent:1};const Tc={Text:1};const Rc={[Tc.Text]:"Text"};const Dc={state:Wc.TopLevelContent};const Bc=true;const Oc=(t,n)=>({state:n.state,tokens:[Tc.Text,t.length]});const Hc={__proto__:null,State:Wc,TokenMap:Rc,TokenType:Tc,hasArrayReturn:Bc,initialLineState:Dc,tokenizeLine:Oc};const Nc={enabled:false};const zc=t=>{Nc.enabled=t};const Yc=()=>Nc.enabled;const{invoke:$c,set:Uc}=Oo;const _c={pending:Object.create(null),tokenizePaths:Object.create(null),tokenizers:Object.create(null)};const Vc=t=>Object.hasOwn(_c.tokenizers,t);const jc=(t,n)=>{_c.tokenizers[t]=n};const qc=t=>_c.tokenizers[t];const Gc=(t,n)=>{_c.tokenizePaths[t]=n};const Xc=t=>_c.tokenizePaths[t]||"";const Zc=t=>{for(const n of t){if(n&&n.id&&n.tokenize){Gc(n.id,n.tokenize)}}};const Qc=t=>Object.hasOwn(_c.pending,t);const Kc=Object.create(null);const Jc=(t,n)=>{Kc[t]=n};const tr=t=>Kc[t]||{};const nr=async(t,n)=>{if(!n){return}Gc(t,n);if(Yc()){const e=await $c("Tokenizer.load",t,n);Jc(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}Jc(t,e.TokenMap);jc(t,e)}catch(t){console.error(t)}};const er=t=>{if(Vc(t)){return qc(t)}if(Qc(t)){return Hc}return Hc};const or=Object.create(null);const sr=(t,n)=>{or[t]=n};const cr=t=>or[t]||Hc;const rr=(t,n,e,o,s,c,r)=>{const i=er(e);if(o!==n.length&&i&&i!==Hc){const a=o===0&&s===n.length;const d=n.slice(o,s);const l=Fc(t,i.tokenizeLine,d,c[e]||Mc(i.initialLineState),i.hasArrayReturn);c[e]=l;if(l.embeddedLanguage){const n=rr(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 ir=(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(rr(t,a,n,i,e,r,s))}}else{for(const t of Object.keys(r)){r[t]=undefined}}}return{embeddedResults:c,tokenizersToLoad:s}};const ar=(t,n,e)=>t<n?n:e;const dr=(t,n,e)=>{const{invalidStartIndex:o,languageId:s,lineCache:c,lines:r,tokenizerId:i}=t;const a=cr(i);const{hasArrayReturn:d,initialLineState:l,tokenizeLine:u}=a;const f=o;const h=ar(o,e,f);const g=[];const m=[];const w=[];for(let t=f;t<h;t++){const n=t===0?Mc(l):c[t];const e=r[t];const o=Fc(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}=ir(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 lr=Object.create(null);const ur=async(t,n,e,o)=>{if(Yc()){if(o){const{id:o,invalidStartIndex:s,languageId:c,lines:r}=t;let i=true;let a=r;if(lr[o]===r){i=false;a=[]}else{lr[o]=r}const d={invalidStartIndex:s,languageId:c};return $c("GetTokensViewport.getTokensViewport",d,n,e,i,o,a)}return $c("GetTokensViewport.getTokensViewport",t,n,e,true,t.id,t.lines)}return dr(t,n,e)};const fr=async t=>{for(const n of t){const t=Xc(n);await nr(n,t)}};const hr=".";const gr='"';const mr="";const wr="\n";const pr=" ";const yr="\t";const xr=(t,n,e)=>{if(n){return t.replaceAll(yr,()=>pr.repeat(e))}return t};const Er=t=>t.includes(yr);const Ir=(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);Ir(t,n,o);return s};const Sr=t=>t.join("\n");const Cr=/^\s+/;const vr=t=>{const n=t.match(Cr);if(!n){return""}return n[0]};const br=(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 Mr=(t,n)=>t.lines[n];const Lr=t=>Sr(t.lines);const Ar=(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 Pr=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 Fr=(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)=>{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 Tr=10;const Rr=(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 Dr=(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 Or=(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=vc(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:x,startIndex:E}=Rr(m,l);const I=Nr(x,d,a);for(let t=E;t<p;t+=2){const n=m[t];const o=m[t+1];const s=x+o;const i=Dr(h,x,s);if(i){let t=x;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(x,s);const o=`Token ${w[n]||"Unknown"}`;const i=xr(t,c,r);f.push(i,o)}x=s;y=s;if(y>=u){break}}return{difference:I,lineInfo:f}};const Hr=(t,n,e)=>{if(t===0){return{maxOffset:Math.ceil(n/e),minOffset:0}}const o=Math.ceil(t/e);const s=o+Math.ceil(n/e);return{maxOffset:s,minOffset:o}};const Nr=(t,n,e)=>{const o=t*n;const s=o-e;return s};const zr=(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=vc(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}=Rr(m,u);const x=Nr(p,l,d);const E=m.length;for(let n=y;n<E;n+=2){const e=m[n];const o=m[n+1];const c=p+o;const a=Dr(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:x,lineInfo:h}};const Yr=(t,n,e,o,s,c,r,i,a,d,l)=>{const{maxOffset:u,minOffset:f}=Hr(d,a,l);if(e.length>0&&n.embeddedResultIndex!==undefined){const s=e[n.embeddedResultIndex];if(s?.isFull){return Or(e,n,t,o,c,r,i,a,d,l,f,u)}}return zr(t,n,e,o,s,c,r,i,a,d,l,f,u)};const $r=(t,n,e,o,s,c,r,i,a)=>{const d=[];const l=[];const{decorations:u,languageId:f,lines:h}=t;const g=tr(f);let m=c;const w=2;for(let t=o;t<s;t++){const s=h[t];const c=Er(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}=Yr(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 Ur=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 ur(t,c,a,n);for(let e=0;l.length>0&&e<Tr;e++){await fr(l);const e=await ur(t,c,a,n);({embeddedResults:d,tokenizersToLoad:l,tokens:u}=e)}const f=await Pr(t,c,0);const h=e;const{differences:g,result:m}=$r(t,u,d,c,a,f,i,o,h);return{differences:g,textInfos:m}};const _r=(t,n,e,o)=>{const s=t/n*(e-o);if(!Number.isFinite(s)){return 0}return s};const Vr=_r;const jr=(t,n,e)=>{if(t>=n){return 0}return Math.max(Math.round(t**2/n),e)};const qr=(t,n)=>{if(t>n){return 0}return t**2/n};const Gr=(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 Xr={enabled:false};const Zr=t=>{Xr.enabled=t};const Qr=()=>Xr.enabled;const Kr=async(t,n)=>{h(t);g(n);const{deltaY:e,finalDeltaY:o,height:s,itemHeight:c,numberOfVisibleLines:r,scrollBarHeight:i}=t;const a=Rs(n,0,o);if(e===a){return t}const d=Math.floor(a/c);const l=d+r;const u=Vr(a,o,s,i);const f={...t,deltaY:a,maxLineY:l,minLineY:d,scrollBarY:u};const m=Qr();const{differences:w,textInfos:p}=await Ur(f,m);const y={...f,differences:w,textInfos:p};return y};const Jr=async(t,n)=>{if(!n.undoStack){return ns}if(t.undoStack===n.undoStack){return ns}const e=n.undoStack.at(-1);if(e&&e.length===1){const o=e[0];if(o.origin===xs){const{rowIndex:e}=o.start;const{lines:s}=n;const c=t.lines[e];const r=s[e];const i=await $c("TokenizeIncremental.tokenizeIncremental",n.uid,n.languageId,c,r,e,n.minLineY);if(i&&i.length===1){return i}}}return ns};const ti=(t,n)=>t.matchAll(n).toArray();const ni=/(?:https?|ftps?|file):\/\/[^\s"']+|www\.[^\s"']+/g;const ei=/^(?:https?|ftp|ftps|file):\/\//;const oi=/^www\./;const si=t=>{const n=ti(t,ni);const e=[];for(const t of n){const n=t[0];if(ei.test(n)||oi.test(n)){e.push({length:n.length,start:t.index??0})}}return e};const ci=t=>{const n=[];const{lines:e}=t;let o=0;for(const t of e){const e=si(t);for(const t of e){const e=o+t.start;n.push(e,t.length,Ys,0)}o+=t.length+1}return n};const ri=(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===Ys&&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 ii=1;const ai=Object.create(null);const di=(t,n)=>{g(t);g(n);if(!Object.hasOwn(ai,t)){ai[t]=[]}if(!ai[t].includes(n)){ai[t].push(n)}};const li=(t,n)=>{g(t);g(n);if(Object.hasOwn(ai,t)){const e=ai[t].indexOf(n);if(e!==-1){ai[t].splice(e,1)}}};const ui=t=>{g(t);return ai[t]||[]};const fi=async(t,n,...e)=>{g(t);w(n);const o=ui(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 hi=(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=jr(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 gi=t=>{if(!t){return[""]}return t.split("\n")};const{invoke:mi}=Ro;const wi=async t=>{try{await mi("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 yi=t=>{let n=0;for(const e of t){if(e===yr){n++}}return n};const xi=/^\p{ASCII}*$/u;const Ei=t=>xi.test(t);const Ii=async(t,n)=>t.length*n;const ki=async(t,n,e,o,s,c,r)=>{const i=await wo("TextMeasurement.measureTextWidth",t,n,e,o,s,c,r);return i};const Si=async(t,n,e,o,s,c,r)=>{if(c&&Ei(t)){return await Ii(t,r)}return await ki(t,n,e,o,s,c,r)};const Ci=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=Er(t);const h=xr(t,f,i);const m=yi(t.slice(0,n));const y=h.slice(0,n+m);const x=await Si(y,e,o,s,r,c,l);return x-a+u};const vi=(t,n,e)=>(t-n)*e;const bi=t=>`${t}px`;const Mi=(t,n,e,o)=>new Uint32Array([t,n,e,o]);const Li=t=>new Uint32Array(t);const Ai=t=>Li(t.length);const Pi=(t,n)=>{const e=Ai(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 Fi=(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 Wi=(t,n,e,o)=>{t[n]=t[n+2]=e;t[n+1]=t[n+3]=o};const Ti=(t,n,e,o)=>t===e&&n===o;const Ri=(t,n,e,o)=>t===e;const Di=(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 Bi=t=>Di(t,Ti);const Oi=t=>Di(t,Ri);const Hi=(t,n)=>{const e=Li(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 Ni=[];const zi=(t,n)=>{if(!n){return Ni}const e=[];for(let n=0;n<t.length;n+=2){const o=t[n];const s=t[n+1];e.push(`${bi(o)} ${bi(s)}`)}return e};const Yi=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(bi(o),bi(s),bi(c),bi(r))}return n};const $i=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 x=o;const E=s/2;for(let t=0;t<w.length;t+=4){const[o,s,r,I,k]=pi(w,t);if(r<g||o>h){continue}const S=r-g;const C=c[S];const v=f[r];const b=await Ci(v,I,d,a,i,l,u,p,E,y,x,C);const M=vi(r,g,m);if(Ti(o,s,r,I)&&b>0){n.push(b,M);continue}const L=vi(o,g,m);const A=o-g;const P=c[A];if(o===r){const t=await Ci(v,s,d,a,i,l,u,p,E,y,x,P);if(k){n.push(t,M)}else if(b>=0){n.push(b,M)}const o=b-t;e.push(t,L,o,m)}else{if(o>=g){const t=f[o];const c=await Ci(t,s,d,a,i,l,u,p,E,y,x,P);const r=await Ci(t,t.length,d,a,i,l,u,p,E,y,x,P);const h=vi(o,g,m);const w=r-c;if(k){n.push(c,h)}e.push(c,h,w,m)}const t=Math.max(o+1,g);const w=Math.min(r,h);for(let n=t;n<w;n++){const t=f[n];const o=vi(n,g,m);const s=n-g;const r=c[s];const h=await Ci(t,t.length,d,a,i,l,u,p,E,y,x,r);e.push(0,o,h,m)}if(r<=h){const t=b;e.push(0,M,t,m);if(!k){n.push(t,M)}}}}return{cursorInfos:zi(n,r),selectionInfos:Yi(e)}};const Ui=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 _i=(t,n)=>{h(t);return{...t,selections:n}};const Vi=(t,n)=>{h(t);m(n);const e=Hi(n,Ui);return e};const ji=(t,n)=>Kr(t,n);const qi=(t,n)=>ji(t,t.deltaY+n);const Gi=t=>t.origin===Es;const Xi=(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(Gi(s)){o.push(c,r+1,i,a+1)}return o};const Zi=(t,n)=>_i(t,n);const Qi=async(t,n,e=undefined)=>{h(t);m(n);if(n.length===0){return t}const o=br(t,n);const s={...t,lines:o};const c=e||Vi(s,n);const r=Math.min(t.invalidStartIndex,n[0].start.rowIndex);const i=Xi(t,n);const a={...s,autoClosingRanges:i,invalidStartIndex:r,lines:o,modified:true,redoStack:[],selections:c,undoStack:[...t.undoStack,n]};const d=ci(a);const l={...a,decorations:d};ts(t.uid,t,l);if(!t.modified){await wi(t.uri)}try{await fi(ii,"handleEditorChanged",t.uid,t.uri,n)}catch(t){console.warn("Failed to notify editor change listeners:",t)}const u=await Jr(t,l);const f=await Ts(l,n);const g={...l,...f,incrementalEdits:u};if(u!==ns){return g}const w=Qr();const{differences:p,textInfos:y}=await Ur(g,w);return{...g,differences:p,textInfos:y}};const Ki=async(t,n)=>{h(t);m(n);if(n.length===0){return t}const e=br(t,n);const o={...t,lines:e};const s=Vi(o,n);const c=Math.min(t.invalidStartIndex,n[0].start.rowIndex);const r={...o,invalidStartIndex:c,lines:e,selections:s};const i=await Jr(t,r);const a={...r,incrementalEdits:i};if(i!==ns){return a}const d=Qr();const{differences:l,textInfos:u}=await Ur(a,d);return{...a,differences:l,textInfos:u}};const Ji=async(t,n)=>{const e=br(t,n);const o=n[0].start.rowIndex;const s={...t,invalidStartIndex:o,lines:e,redoStack:[],undoStack:[...t.undoStack,n]};const c=await Jr(t,s);const r={...s,incrementalEdits:c};if(c!==ns){return r}const i=Qr();const{differences:a,textInfos:d}=await Ur(r,i);return{...r,differences:a,textInfos:d}};const ta=t=>t.selections&&t.selections.length>0;const na=(t,n,e,o,s,c)=>hi(t,{height:s,width:o,x:n,y:e},c);const ea=(t,n)=>{const e=gi(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=jr(t.height,l,s);return{...t,finalDeltaY:d,finalY:a,lines:e,maxLineY:i,scrollBarHeight:u}};const oa={cursorInfos:[],debugEnabled:false,decorations:[],deltaX:0,deltaY:0,diagnostics:[],differences:[],embeds:[],focused:false,hasListener:false,height:0,highlightedLine:-1,incrementalEdits:ns,isSelecting:false,languageId:"",lineCache:[],lines:[],longestLineWidth:0,maxLineY:0,minLineY:0,redoStack:[],scrollBarHeight:0,selectionAutoMovePosition:{columnIndex:0,rowIndex:0},selectionInfos:[],selections:new Uint32Array,textInfos:[],tokenizerId:0,undoStack:[],uri:"",width:0,x:0,y:0};const sa="ExtensionHostHover.execute";const ca="ExtensionHost.executeTabCompletionProvider";const ra="ExtensionHostTextDocument.syncFull";const{invoke:ia,set:aa}=ao;const da=t=>{w(t);return t.lastIndexOf(hr)};const la=(t,n)=>t.lastIndexOf(hr,n);const ua=(t,n)=>{for(const e of t){if(e&&e.extensions&&Array.isArray(e.extensions)&&e.extensions.includes(n)){return e.id}}return""};const fa=(t,n)=>{for(const e of t){if(e&&e.fileNames&&Array.isArray(e.fileNames)&&e.fileNames.includes(n)){return e.id}}return""};const ha=(t,n)=>{w(t);const e=da(t);const o=t.slice(e);const s=o.toLowerCase();const c=ua(n,s);if(c){return c}const r=t.toLowerCase();const i=la(t,e-1);const a=t.slice(i);const d=ua(n,a);if(d){return d}const l=fa(n,r);if(l){return l}return"unknown"};const ga=async(t,n)=>{g(t);w(n);const e=await fo(t,n);return e};const ma=async(t,n,e,o)=>await Si("a",t,n,e,o,false,0);const wa=async t=>{const n=await Fo(t);return n};const pa="onDiagnostic";const ya="onHover";const xa="onTabCompletion";const Ea=async({args:t,assetDir:n,editor:e,event:o,method:s,noProviderFoundMessage:c,noProviderFoundResult:r=undefined,platform:i})=>{const a=`${o}:${e.languageId}`;await No(a,n,i);const d=await ia(s,e.uid,...t);return d};const Ia=t=>({documentId:t.id||t.uid,languageId:t.languageId,text:Lr(t),uri:t.uri});const ka=async t=>{const n=Ia(t);return lo("Extensions.executeDiagnosticProvider",n)};const Sa=async t=>{const n=await ka(t);if(n.length>0){return n}const{assetDir:e,platform:o}=t;return Ea({args:[],assetDir:e,editor:t,event:pa,method:"ExtensionHost.executeDiagnosticProvider",noProviderFoundMessage:"no diagnostic provider found",platform:o})};const Ca=t=>t.type;const va=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 x=0;const E=await Ci(d[m],n,r,c,s,i,a,f,x,h,o,y);const I=vi(m,l,u)-u;e.push({height:u,type:Ca(t),width:p,x:E,y:I})}return e};const ba=(t,n)=>{const e=ci(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 Ma=async t=>{try{const n=Lr(t);await ia(ra,t.uri,t.id,t.languageId,n);const e=await Sa(t);const o=Ko(t.id);if(!o){return t}const s=await va(o.newState,e);const c=s.flatMap(t=>[t.offset,t.length,t.type,t.modifiers||0]);const r=ba(o.newState,c);const i={...o.newState,decorations:r,diagnostics:e,visualDecorations:s};ts(t.id,o.oldState,i);await yo("Editor.rerender",t.id);return i}catch(n){if(n&&n.message.includes("No diagnostic provider found")){return t}console.error(`Failed to update diagnostics: ${n}`);return t}};const La=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:x,letterSpacing:E,lineNumbers:I,lineToReveal:k,links:S,platform:C,rowHeight:v,savedDeltaY:b,savedSelections:M,tabSize:L,uri:A,useFunctionalRendering:P,width:F,x:W,y:T})=>{g(u);w(o);const R=await ma(i,r,c,E);const D=await ga(C,t);const B=ha(A,D);const O={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:ss,fontFamily:c,fontSize:r,fontWeight:i,handleOffset:0,handleOffsetX:0,hasListener:false,height:d,id:u,incrementalEdits:ns,invalidStartIndex:0,isAutoClosingBracketsEnabled:f,isAutoClosingQuotesEnabled:h,isAutoClosingTagsEnabled:m,isMonospaceFont:p,isQuickSuggestionsEnabled:y,isSelecting:false,itemHeight:20,languageId:B,letterSpacing:E,lineCache:[],lineNumbers:I,lines:[],longestLineWidth:0,maxLineY:0,minimumSliderSize:20,minLineY:0,modified:false,numberOfVisiblelines:0,numberOfVisibleLines:0,platform:C,primarySelectionIndex:0,redoStack:[],rowHeight:v,savedSelections:M,scrollBarHeight:0,scrollBarWidth:0,selectionAutoMovePosition:{columnIndex:0,rowIndex:0},selectionInfos:[],selections:new Uint32Array,tabSize:L,textInfos:[],tokenizerId:0,uid:u,undoStack:[],uri:A,useFunctionalRendering:P,validLines:[],widgets:[],width:F,x:W,y:T};const H=na(O,W,T,F,d,9);const N=ea(H,o);let z;if(k&&n){const t=k*v;z=await Kr(N,t)}else{z=await Kr(N,0)}const Y=ci(z);const $={...z,decorations:Y};const U=Qr();const{differences:_,textInfos:V}=await Ur($,U);const j={...$,differences:_,focus:co,focused:true,textInfos:V};ts(u,oa,j);await ia(ra,A,u,x,o);if(s){await Ma(j)}const q=await wa("editor.completionsOnType");const G=Boolean(q);ts(u,oa,{...j,completionsOnType:G})};const Aa=(t,n)=>t.rowHeight===n.rowHeight&&t.deltaY===n.deltaY&&t.finalDeltaY===n.finalDeltaY&&t.height===n.height&&t.scrollBarHeight===n.scrollBarHeight;const Pa=(t,n)=>{if(!n.focused){return true}return t.focused===n.focused&&t.focus===n.focus};const Fa=(t,n)=>t.cursorInfos===n.cursorInfos&&t.diagnostics===n.diagnostics&&t.highlightedLine===n.highlightedLine&&t.lineNumbers===n.lineNumbers&&t.textInfos===n.textInfos&&t.differences===n.differences&&t.initial===n.initial&&t.deltaY===n.deltaY&&t.scrollBarHeight===n.scrollBarHeight&&t.scrollBarWidth===n.scrollBarWidth&&t.selectionInfos===n.selectionInfos;const Wa=6;const Ta=7;const Ra=11;const Da=12;const Ba=[Fa,Pa,Pa,Aa];const Oa=[Da,Wa,Ta,Ra];const Ha=(t,n)=>{const e=[];for(let o=0;o<Ba.length;o++){const s=Ba[o];if(!s(t,n)){e.push(Oa[o])}}return e};const Na=t=>{const{newState:n,oldState:e}=Ko(t);const o=Ha(e,n);return o};const za=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 Ya=t=>{const{selections:n}=t;const e=za(n);return{...t,selections:e}};const $a=(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 Ua=t=>{const{lines:n,selections:e}=t;const o=$a(e,n.length);return{...t,selections:o}};const _a=(t,n)=>{const e=[];for(const o of n){const n=Wr(t,o.startOffset);const s=Wr(t,o.endOffset);const c=Ar(t,{end:s,start:n});const r={deleted:c,end:s,inserted:gi(o.inserted),origin:Is,start:n};if(r.inserted.length===0){r.inserted=[""]}e.push(r)}return e};const Va=(...t)=>{console.warn(...t)};const ja=(...t)=>{console.error(...t)};const qa=(t,n)=>{if(!Array.isArray(n)){Va("something is wrong with format on save",n);return t}if(n.length===0){return t}const e=_a(t,n);return Qi(t,e)};const Ga=async(t,n)=>{h(t);m(n);return Qi(t,n)};const Xa=(t,n)=>{const e=[];for(const o of n){if(o.uri===t.uri){for(const n of o.edits){const o=Wr(t,n.offset);const s=Wr(t,n.offset+n.deleted);const c=Ar(t,{end:s,start:o});const r={deleted:c,end:s,inserted:[n.inserted],origin:bs,start:o};e.push(r)}}}return e};const Za=async(t,n)=>{h(t);m(n);const e=Xa(t,n);if(e.length===0){return t}return Qi(t,e)};const Qa=t=>{if(!t.focused){return t}const n={...t,focused:false};return n};const Ka=(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:Ar(t,f),end:u,inserted:e,origin:o,start:l})}return s};const Ja=(t,n,e)=>{const{selections:o}=t;return Ka(t,o,n,e)};const td=async(t,n,e,o,s,c,r,i,a,d)=>{for(let l=n;l<t.length;l++){const n=await Si(t.slice(0,l),s,c,r,i,a,d);if(o-n<e/2){return l}}return t.length};const nd=()=>"Segmenter"in Intl;const ed=()=>{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 od=async(t,n,e,o,s,c,r,i)=>{const a=ed();const d=a.getSegments(t);const l=false;const u=0;for(const n of d){const a=await Si(t.slice(0,n.index),s,c,r,i,l,u);if(o-a<e){return n.index}}return t.length};const sd=(t,n)=>{const e=Math.round(t/n);return e};const cd=(t,n,e)=>{let o=n;for(let s=0;s<n;s++){if(t[s]===yr){o-=e-1}}return o};const rd=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=sd(a,r);const l=Er(t);const u=cd(t,d,i);const f=t.slice(0,u);const h=xr(f,l,i);const m=await Si(h,n,e,o,s,c,r);const y=Ei(t);if(y){if(Math.abs(a-m)<r/2){return u}return await td(t,u,r,a,n,e,o,s,c,r)}return await od(t,u,r,a,n,e,o,s)};const id=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 x=n-w+s;const E=Rs(y,0,u.length-1);const I=u[E];const k=await rd(I,a,i,r,l,d,o,m,x);return{columnIndex:k,rowIndex:E}};const ad=(t,n,e)=>{const{columnWidth:o,x:s}=t;const c=e*o+s;return c};const dd=(t,n)=>{const{rowHeight:e,y:o}=t;const s=(n+1)*e+o;return s};const ld={timeout:-1};const ud=async(t,n,e,o,s)=>{h(t);g(n);g(e);w(o);const c=ad(t,n,e);const r=dd(t,n);const i=o;await yo("Editor.showOverlayMessage",t,"Viewlet.send",t.uid,"showOverlayMessage",c,r,i);if(!s){const n=()=>{hd(t)};ld.timeout=setTimeout(n,3e3)}return t};const fd=async(t,n,e,o)=>ud(t,n,e,o,true);const hd=async t=>{clearTimeout(ld.timeout);ld.timeout=-1;return t};const gd=String;const md=t=>{switch(t){case"(":return")";case"[":return"]";case"{":return"}";default:return"???"}};const wd=async(t,n)=>{try{const e=Fr(t,t.cursor);const o=await yo("ExtensionHostBraceCompletion.executeBraceCompletionProvider",t,e,n);if(o){const e=md(n);const o=n+e;const s=Ja(t,[o],xs);return Qi(t,s)}const s=Ja(t,[n],xs);return Qi(t,s)}catch(n){console.error(n);const e=Array.isArray(t.cursor)?t.cursor[0]:t.cursor;return fd(t,e,gd(n))}};const pd=t=>{const{selections:n}=t;if(n.length===4&&n[0]===n[2]&&n[1]===n[3]){return t}const e=Li(4);Wi(e,0,n[0],n[1]);return Zi(t,e)};const yd=(t,n)=>{for(const[e,o]of t.entries()){if(o.id===n){return e}}return-1};const xd=(t,n)=>{const e=yd(t,n);const o=[...t.slice(0,e),...t.slice(e+1)];return o};const Ed=t=>t.id===Fe;const Id=t=>{const{widgets:n}=t;const e=n.findIndex(Ed);if(e===-1){return t}const o=xd(n,Fe);return{...t,focused:true,widgets:o}};const kd=t=>t.id===De;const Sd=t=>{const{widgets:n}=t;const e=n.findIndex(kd);if(e===-1){return t}const o=xd(n,De);return{...t,focused:true,widgets:o}};const Cd=async()=>{const t="Rename Worker";const n="renameWorkerMain.js";const e=await $o(t,n);await e.invoke("Rename.initialize");return e};const vd={};const bd=()=>{if(!vd.workerPromise){vd.workerPromise=Cd()}return vd.workerPromise};const Md=async(t,...n)=>{const e=await bd();return await e.invoke(t,...n)};const Ld=t=>t.id===Oe;const Ad=async t=>{const{uid:n,widgets:e}=t;const o=e.findIndex(Ld);if(o===-1){return t}const s=e[o];await Md("Rename.close",s.newState.uid);const c=Ko(n);const{newState:r}=c;return r};const Pd=t=>t.id===He;const Fd=t=>{const{widgets:n}=t;const e=n.findIndex(Pd);if(e===-1){return t}const o=xd(n,He);return{...t,widgets:o}};const Wd=(t,n)=>{for(const e of t){if(e.id===n){return true}}return false};const Td=async(t,n,e,o,s,c)=>{const{widgets:r}=e;if(Wd(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:co,focused:u,widgets:l};return f};const Rd=()=>Math.random();const Dd=()=>{const t=Rd();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 Bd=(t,n)=>qo(t,n);const Od=async t=>Td(We,es,t,Dd,Bd);const Hd={compositionText:"",isComposing:false};const Nd=(t,n)=>{Hd.isComposing=true;return t};const zd=(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-Hd.compositionText.length;e.push({deleted:[Hd.compositionText],end:{columnIndex:i,rowIndex:r},inserted:[n],origin:us,start:{columnIndex:a,rowIndex:s}})}return e};const Yd=(t,n)=>{const{selections:e}=t;const o=zd(e,n);Hd.compositionText=n;return Qi(t,o)};const $d=(t,n)=>{const{selections:e}=t;const o=zd(e,n);Hd.isComposing=false;Hd.compositionText="";return Qi(t,o)};const Ud=async t=>{try{w(t);await bo(t)}catch(t){throw new S(t,"Failed to write text to clipboard")}};const _d=(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 Vd=(t,n,e,o)=>t===e&&n===o;const jd=async t=>{if(!ta(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=Vd(o,s,c,r);const a=_d(n,i,o,s,c,r);const d=Ar(t,a);const l=Sr(d);const u=i?"\n"+l:l;await Ud(u);return t};const qd=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:[Mr(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 Qi(t,s,c)};const Gd=t=>{const{selections:n}=t;const e=n[0];const o={columnIndex:0,rowIndex:e};const s=[{deleted:[""],end:o,inserted:[Mr(t,e),""],start:o}];return Qi(t,s)};const Xd=(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 Zd=(t,n,e,o)=>{t[n]=e;t[n+1]=o};const Qd=(t,n,e,o)=>{t[n]=t[n+2]=e;t[n+1]=t[n+3]=o};const Kd=(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 Jd=(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{Kd(o,s,c,r,n,e);Kd(o,s+2,c,r,n,e)}}else{Qd(o,s,t[s],t[s+1])}}return o};const tl=(t,n)=>{const{lines:e,selections:o}=t;const s=Jd(o,e,n);return Zi(t,s)};const nl=(t,n)=>{if(!nd()){return 1}if(n>t.length){return 1}const e=ed();const o=e.at(t,n-1);if(!o){return 1}return n-o.index};const el=()=>2;const ol=(t,n)=>{if(!nd()){return 1}const e=ed();const o=e.at(t,n);return o.segment.length};const sl=t=>t===pr||t===yr;const cl=(t,n)=>{if(t.length===0){return 0}for(let e=0;e<n;e++){if(!sl(t[e])){return n-e}}return n};const rl=(t,n)=>t.length-n;const il=(t,n)=>{for(const e of n){const n=t.match(e);if(n){return n[0].length}}return 1};const al=/(?<![A-Z])[A-Z]+\s*$/;const dl=/[\u{C0}-\u{17F}\w\-]+>?\s*$/u;const ll=/[a-zA-Z]+[^a-zA-Z\d]+\s*$/;const ul=/\s+$/;const fl=/[^a-zA-Z\d]+\s*$/;const hl=[al,dl,ll,ul,fl];const gl=(t,n)=>{const e=t.slice(0,n);return il(e,hl)};const ml=/^\s*[\u{C0}-\u{17F}\w]+/iu;const wl=/^[^a-zA-Z\d]+\w*/;const pl=[ml,wl];const yl=(t,n)=>{const e=t.slice(n);return il(e,pl)};const xl=/(?<![A-Z])[A-Z]{2}[a-z]+$/;const El=/(?=[A-Z]+)[A-Z][a-z]+$/;const Il=/[A-Z]+[a-z]+\d?\s*$/;const kl=/[A-Z]+\d*\s*$/;const Sl=/[a-z]+\d*\s*$/;const Cl=/[A-Z]*[a-z]+_+\s*$/;const vl=/(?<![A-Z])[A-Z]_+\s*$/;const bl=/[a-z]+\s*$/;const Ml=/[^a-zA-Z\d\s]+\s*$/;const Ll=[xl,El,Il,kl,Sl,Cl,vl,bl,Ml];const Al=(t,n)=>{const e=t.slice(0,n);return il(e,Ll)};const Pl=/^\s*[a-z]+\d?/;const Fl=/^\s*[A-Z]{2}[a-z\d]+/;const Wl=/^\s*[A-Z]+(?=[A-Z][a-z]+)/;const Tl=/^\s*[A-Z]+[a-z]*\d*/;const Rl=/^\s*_+[a-z]*\d?/;const Dl=/^\s*[^\da-zA-Z\s]+/;const Bl=[Pl,Wl,Tl,Rl,Dl];const Ol=[Pl,Fl,Wl,Tl,Rl,Dl];const Hl=/[A-Z]/;const Nl=(t,n)=>{const e=t.slice(n);if(Hl.test(t[n-1])){return il(e,Bl)}return il(e,Ol)};const zl=t=>tl(t,nl);const Yl=(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 $l=(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 Ul=(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){$l(o,s,c,r,n,e)}else{o[s]=o[s+2]=i;o[s+1]=o[s+3]=a}}return o};const _l=(t,n)=>{const{lines:e,selections:o}=t;const s=Ul(o,e,n);return Zi(t,s)};const Vl=t=>_l(t,ol);const jl=(t,n,e,o,s,c)=>{Wi(t,n,s+1,c)};const ql=t=>Pi(t,jl);const Gl=t=>{const{selections:n}=t;const e=ql(n);return Zi(t,e)};const Xl=t=>_l(t,rl);const Zl=t=>tl(t,cl);const Ql=(t,n,e)=>{h(t);g(n);g(e);const o=Mi(n,e,n,e);return Zi(t,o)};const Kl=(t,n,e,o,s,c)=>{if(e===0){Wi(t,n,0,0)}else{Wi(t,n,e-1,o)}};const Jl=t=>Pi(t,Kl);const tu=(t,n,e,o)=>{const{selections:s}=t;const c=Jl(s);return Zi(t,c)};const nu=t=>tu(t);const eu=t=>tl(t,gl);const ou=t=>tl(t,Al);const su=t=>_l(t,Nl);const cu=t=>_l(t,yl);const ru=async t=>{const{lines:n,selections:e}=t;const[o]=e;const s=n[o];const c=new Uint32Array([o,0,o,s.length]);const r=Ka(t,c,[""],ws);const i=new Uint32Array([o,0,o,0]);await Ud(s);return Qi(t,r,i)};const iu=async t=>{const{selections:n}=t;const[e,o,s,c]=n;const r=Ja(t,[""],ws);const i=new Uint32Array([e,o,s,c]);const a=Sr(r[0].deleted);await Ud(a);return Qi(t,r,i)};const au=async t=>{const{selections:n}=t;const[e,o,s,c]=n;if(Ti(e,o,s,c)){return ru(t)}return iu(t)};const du=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:Ar(t,{end:c,start:s}),end:c,inserted:[""],origin:hs,start:s}];return Qi(t,r)};const lu=(t,n,e)=>{const o=[];const s=(n,s,c,r)=>{const i=Xd(n,s,t,e);const a={columnIndex:r,rowIndex:c};o.push({deleted:Ar({lines:t},{end:a,start:i}),end:a,inserted:[""],origin:ms,start:i})};Fi(n,s);return o};const uu=(t,n,e,o,s)=>{if(!Ti(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 fu=(t,n)=>{for(let e=0;e<n.length;e+=4){const[o,s,c,r]=pi(n,e);if(!uu(t,o,s,c,r)){return false}}return true};const hu=t=>{const{lines:n,selections:e}=t;for(let t=0;t<e.length;t+=4){e[t+1]++;e[t+3]++}const o=lu(n,e,el);return Qi(t,o)};const gu=(t,n)=>{const{autoClosingRanges:e=[],lines:o,selections:s}=t;if(fu(e,s)){return hu(t)}if(Bi(s)){const e=lu(o,s,n);return Qi(t,e)}const c=Ja(t,[""],ms);return Qi(t,c)};const mu=t=>gu(t,cl);const wu=(t,n)=>{const{selections:e}=t;if(Bi(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=Yl(a,s,n);o.push({deleted:Ar(t,{end:d,start:a}),end:d,inserted:[""],origin:gs,start:a})}return o}const o=Ja(t,[""],gs);return o};const pu=(t,n)=>{const e=wu(t,n);return Qi(t,e)};const yu=t=>pu(t,rl);const xu=t=>{const n=gu(t,nl);return n};const Eu=t=>pu(t,ol);const Iu=t=>{const n=gu(t,gl);return n};const ku=t=>{const n=gu(t,Al);return n};const Su=t=>pu(t,Nl);const Cu=t=>pu(t,yl);const vu=async t=>{await yo("SideBar.show","References",true);return t};const bu=async t=>{const n={documentId:t.id||t.uid,languageId:t.languageId,text:Lr(t),uri:t.uri};return lo("Extensions.executeFormattingProvider",n)};const Mu="Failed to execute formatting provider: FormattingError:";const Lu=t=>t&&t instanceof Error&&t.message.startsWith(Mu);const Au="Failed to execute formatting provider: FormattingError:";const Pu=async t=>{try{const n=await bu(t);return qa(t,n)}catch(n){if(Lu(n)){console.error("Formatting Error:",n.message.slice(Au.length));return t}console.error(n);const e=String(n);await ud(t,0,0,e,true);return t}};const Fu=/^[\w\-]+/;const Wu=/[\w\-]+$/;const Tu=(t,n)=>{const e=t.slice(0,n);const o=e.match(Wu);const s=t.slice(n);const c=s.match(Fu);let r=mr;if(o){r+=o[0]}if(c){r+=c[0]}return{word:r}};const Ru=(t,n)=>{const e=t.slice(0,n);const o=e.match(Wu);if(o){return o[0]}return mr};const Du=(t,n,e)=>{const{lines:o}=t;const s=o[n];return Tu(s,e)};const Bu=(t,n,e)=>{const{lines:o}=t;const s=o[n];return Ru(s,e)};const Ou=async(t,n)=>{const e=await yo("ExtensionHostDefinition.executeDefinitionProvider",t,n);return e};const Hu={};const Nu=/\{(PH\d+)\}/g;const zu=(t,n=Hu)=>{if(n===Hu){return t}const e=(t,e)=>n[e];return t.replaceAll(Nu,e)};const Yu="Copy";const $u="Cut";const Uu="Editor: Close Color Picker";const _u="Editor: Copy Line Down";const Vu="Editor: Copy Line Up";const ju="Editor: Format Document (forced)";const qu="Editor: Go To Definition";const Gu="Editor: Go To Type Definition";const Xu="Editor: Indent";const Zu="Editor: Open Color Picker";const Qu="Editor: Select All Occurrences";const Ku="Editor: Select Down";const Ju="Editor: Select Inside String";const tf="Editor: Select Next Occurrence";const nf="Editor: Select Up";const ef="Show Hover";const of="Editor: Sort Lines Ascending";const sf="Editor: Toggle Comment";const cf="Editor: Unindent";const rf="Enter Code";const af="Escape to close";const df="Find All Implementations";const lf="Find All References";const uf="Format Document";const ff="Go to Definition";const hf="Go to Type Definition";const gf="Move Line Down";const mf="Move Line Up";const wf="No definition found";const pf="No definition found for '{PH1}'";const yf="No type definition found";const xf="No type definition found for '{PH1}'";const Ef="Paste";const If="Source Action";const kf="Toggle Block Comment";const Sf=()=>zu(ff);const Cf=()=>zu(wf);const vf=t=>zu(pf,{PH1:t});const bf=t=>zu(xf,{PH1:t});const Mf=()=>zu(yf);const Lf=()=>zu(If);const Af=()=>zu(af);const Pf=()=>zu(rf);const Ff=()=>zu(hf);const Wf=()=>zu(lf);const Tf=()=>zu(df);const Rf=()=>zu($u);const Df=()=>zu(Yu);const Bf=()=>zu(Ef);const Of=()=>zu(kf);const Hf=()=>zu(mf);const Nf=()=>zu(gf);const zf=()=>zu(uf);const Yf=()=>zu(ef);const $f=()=>zu(ju);const Uf=()=>zu(tf);const _f=()=>zu(Qu);const Vf=()=>zu(qu);const jf=()=>zu(Gu);const qf=()=>zu(Ju);const Gf=()=>zu(Xu);const Xf=()=>zu(cf);const Zf=()=>zu(of);const Qf=()=>zu(sf);const Kf=()=>zu(nf);const Jf=()=>zu(Ku);const th=()=>zu(Zu);const nh=()=>zu(Uu);const eh=()=>zu(_u);const oh=()=>zu(Vu);const sh=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=Du(t,r,i);const e=o(n);return ud(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=Wr(t,n.startOffset);const o=new Uint32Array([e.rowIndex,e.columnIndex,e.rowIndex,e.columnIndex]);return Zi(t,o)}const c={endColumnIndex:n.endColumnIndex,endRowIndex:n.endRowIndex,startColumnIndex:n.startColumnIndex,startRowIndex:n.startRowIndex};await Wo(s,true,c);return t}catch(e){if(s(e)){const o=n(e);await ud(t,r,i,o,false);return t}const o=n(e);await ud(t,r,i,o,true);return t}};const ch=async(t,n,e)=>{const o=Fr(t,n,e);const s=await Ou(t,o);return s};const rh=t=>{if(t.word){return vf(t.word)}return Cf()};const ih=String;const ah=t=>t?.message?.startsWith("Failed to execute definition provider: No definition provider found");const dh=async t=>sh({editor:t,getErrorMessage:ih,getLocation:ch,getNoLocationFoundMessage:rh,isNoProviderFoundError:ah});const lh=t=>{if(t.word){return bf(t.word)}return Mf()};const uh=async(t,n)=>{const e=await yo("ExtensionHostTypeDefinition.executeTypeDefinitionProvider",t,n);return e};const fh=async(t,n,e)=>{const o=Fr(t,n,e);const s=await uh(t,o);return s};const hh=String;const gh=t=>t?.message?.startsWith("Failed to execute type definition provider: No type definition provider found");const mh=async(t,n=true)=>sh({editor:t,getErrorMessage:hh,getLocation:fh,getNoLocationFoundMessage:lh,isNoProviderFoundError:gh});const wh=t=>{switch(t){case De:return true;default:return false}};const ph=t=>{if(t.length===0){return t}return t.filter(wh)};const yh={position:{columnIndex:0,rowIndex:0}};const xh=()=>yh.position;const Eh=t=>{yh.position=t};const Ih=async(t,n)=>{await mo(t,n)};const kh=async(t,n)=>{const{platform:e}=t;const{columnIndex:o,rowIndex:s}=n;const c=Fr(t,s,o);const r=ri(t,c);if(r){await Ih(r,e);return t}const i={...t,selections:new Uint32Array([s,o,s,o])};const a=await dh(i);return a};const Sh=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 Zi(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 Zi(t,o)};const Ch=1;const vh=2;const bh=(t,n)=>{Eh(n);const e=ph(t.widgets);return{...t,focused:true,selections:new Uint32Array([n.rowIndex,n.columnIndex,n.rowIndex,n.columnIndex]),widgets:e}};const Mh=t=>{switch(t){case vh:return kh;case Ch:return Sh;default:return bh}};const Lh=async(t,n,e,o)=>{h(t);g(n);g(e);g(o);const s=Mh(n);const c=await s(t,{columnIndex:o,rowIndex:e});return c};const Ah=3;const Ph=async(t,n,e,o)=>{const{uid:s}=t;await Io(s,Ah,e,o,{menuId:Ah});return t};const Fh=/^[a-zA-Z\u{C0}-\u{17F}\d]+/u;const Wh=/[a-zA-Z\u{C0}-\u{17F}\d]+$/u;const Th=(t,n,e)=>{const o=t.slice(0,e);const s=t.slice(e);const c=o.match(Wh);const r=s.match(Fh);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 Rh=(t,n,e)=>{const o=Mr(t,n);const s=Th(o,n,e);return Zi(t,s)};const Dh=async(t,n,e,o)=>{const s=await id(t,e,o);return Rh(t,s.rowIndex,s.columnIndex)};const Bh=t=>{if(t.focused&&t.focus===co){return t}return{...t,additionalFocus:0,focus:co,focused:true}};const Oh=1;const Hh=2;const Nh=3;const zh=async(t,n,e,o)=>{h(t);g(n);g(e);g(o);const s=await id(t,e,o);return Lh(t,n,s.rowIndex,s.columnIndex)};const Yh=(t,n)=>new Uint32Array([n,0,n,t.length]);const $h=t=>{const{selections:n}=t;const e=n[t.primarySelectionIndex];const o=Mr(t,e);const s=Yh(o,e);return Zi(t,s)};const Uh=(t,n,e,o)=>{h(t);g(e);g(o);return $h(t)};const _h=(t,n)=>{if(t){return vh}if(n){return Ch}return 0};const Vh=(t,n,e,o,s,c,r)=>{const i=_h(e,o);switch(r){case Hh:return Dh(t,i,s,c);case Oh:return zh(t,i,s,c);case Nh:return Uh(t,i,s,c);default:return t}};const jh={editor:undefined,timeout:-1,x:0,y:0};const qh=()=>jh;const Gh=(t,n,e,o)=>{jh.editor=t;jh.timeout=n;jh.x=e;jh.y=o};const Xh=async(t,n)=>{};const Zh=async()=>{const{editor:t,x:n,y:e}=qh();await id(t,n,e);await Xh()};const Qh=300;const Kh=(t,n,e)=>{if(!t.hoverEnabled){return t}const o=qh();if(o.timeout!==-1){clearTimeout(o.timeout)}const s=setTimeout(Zh,Qh);Gh(t,s,n,e);return t};const Jh=(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 tg=async(t,n,e)=>{h(t);g(n);g(e);const o=await id(t,n,e);const s=Fr(t,o.rowIndex,o.columnIndex);try{const n=await Ou(t,s);if(!n){return t}const e=Wr(t,n.startOffset);Wr(t,n.endOffset);const o=t.lineCache[e.rowIndex+1];if(!o){return t}const c=Jh(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 ng=(t,n)=>new Uint32Array([n.startRowIndex,n.startColumnIndex,n.endRowIndex,n.endColumnIndex]);const eg=(t,n,e)=>{const o=ng(t,e);const s={end:{columnIndex:o[3],rowIndex:o[2]},start:{columnIndex:o[1],rowIndex:o[0]}};const c=[{deleted:Ar(t,s),end:s.end,inserted:[n],origin:fs,start:s.start}];return c};const og=(t,n,e)=>{const o=eg(t,n,e);return Qi(t,o)};const sg=(t,n)=>{const e=ng(t,n);return Zi(t,e)};const cg=t=>({...t,hasListener:false,isSelecting:false,selectionAutoMovePosition:{columnIndex:0,rowIndex:0}});const rg=async(t,n,e,o,s,c,r)=>{const i=await Vh(t,n,e,o,s,c,r);return{...i,isSelecting:true}};const ig=(t,n)=>t;const ag=async(t,n,e)=>{await id(t,n,e)};const dg=t=>{globalThis.requestAnimationFrame(t)};const lg=(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 ug=(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 fg=async(t,n)=>{let e=n;if(ug(t,n)){const t=Qr();const{differences:o,textInfos:s}=await Ur(n,t);e={...n,differences:o,textInfos:s}}if(!lg(t,n)){return e}const{cursorInfos:o,selectionInfos:s}=await $i(e);return{...e,cursorInfos:o,selectionInfos:s}};const hg=-1;const gg=0;const mg=1;const wg=(t,n)=>{if(t.rowIndex>n.rowIndex){return mg}if(t.rowIndex===n.rowIndex){if(t.columnIndex>n.columnIndex){return mg}if(t.columnIndex<n.columnIndex){return hg}return gg}return hg};const pg=(t,n)=>new Uint32Array([t.rowIndex,t.columnIndex,n.rowIndex,n.columnIndex]);const yg=(t,n)=>new Uint32Array([n.rowIndex,n.columnIndex,n.rowIndex,n.columnIndex]);const xg=(t,n)=>new Uint32Array([t.rowIndex,t.columnIndex,n.rowIndex,n.columnIndex]);const Eg=(t,n)=>{switch(wg(n,t)){case gg:return yg(t,n);case mg:return xg(t,n);case hg:return pg(t,n);default:throw new Error("unexpected comparison result")}};const Ig=(t,n)=>{const e=xh();const o=Eg(e,n);return Zi(t,o)};const kg=(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=xh();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=xh();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 Sg=async t=>{const n=Ko(t);const e=n?.newState;if(!e||!e.hasListener||!e.isSelecting){return}const o=e.selectionAutoMovePosition;if(o.rowIndex===0){return}const s=kg(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 fg(e,r);ts(e.uid,e,i);dg(()=>Sg(t))};const Cg=async(t,n,e)=>{h(t);g(n);g(e);const o=await id(t,n,e);const s=Ig(t,o);if(!t.hasListener&&(o.rowIndex<t.minLineY||o.rowIndex>t.maxLineY)){dg(()=>Sg(t.uid));return{...s,hasListener:true,selectionAutoMovePosition:o}}return s};const vg=async(t,n,e,o)=>{if(!t.isSelecting){return t}if(o){return ag(t,n,e)}return Cg(t,n,e)};const bg=t=>({...t,hasListener:false,isSelecting:false,selectionAutoMovePosition:{columnIndex:0,rowIndex:0}});const Mg=(t,n,e)=>{if(e<=0){return 0}if(e<=t-n/2){return e/(t-n)}return 1};const Lg=(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=Rs(n,c,c+s);const a=i-c-e;const d=qr(s,o);const l=o-s+r;const u=Mg(s,d,a);const f=Rs(u,0,1);const h=f*l;return{...t,deltaX:h}};const Ag=(t,n)=>{const{deltaX:e,longestLineWidth:o,width:s,x:c}=t;const r=n-c;const i=qr(s,o);const a=s-i;const d=_r(e,a,s,i);const l=r-d;if(l>=0&&l<i){return{...t,handleOffsetX:l}}const{handleOffset:u,percent:f}=Gr(s,i,r);const h=f*a;return{...t,deltaX:h,handleOffsetX:u}};const Pg=(t,n)=>{const{height:e,scrollBarHeight:o}=t;if(n<=e-o/2){return n/(e-o)}return 1};const Fg=async(t,n)=>{const{finalDeltaY:e,handleOffset:o=0,y:s}=t;const c=n-s-o;const r=Pg(t,c);const i=r*e;const a=await ji(t,i);return a};const Wg=Fg;const Tg=async(t,n)=>{const{deltaY:e,finalDeltaY:o,height:s,scrollBarHeight:c,y:r}=t;const i=n-r;const a=Vr(e,o,s,c);const d=i-a;if(d>=0&&d<c){return{...t,handleOffset:d}}const{handleOffset:l,percent:u}=Gr(s,c,i);const f=u*o;const h=await ji(t,f);return{...h,handleOffset:l}};const Rg=(t,n)=>{};const Dg={deltaY:0,touchOffsetY:0};const Bg=(t,n)=>{if(n.touches.length===0){return}const e=n.touches[0];Dg.touchOffsetY=e.y;Dg.deltaY=t.deltaY};const Og=(t,n)=>qi(t,n);const Hg=(t,n)=>ji(t,n);const Ng=(t,n,e,o)=>{g(n);g(e);g(o);const{deltaX:s}=t;if(e===0){return Og(t,o)}const c=Rs(s+e,0,Infinity);return{...Og(t,o),deltaX:c}};const zg=(t,n)=>{if(n.touches.length===0){return}const e=n.touches[0];const o=Dg.deltaY+(Dg.touchOffsetY-e.y);Hg(t,o)};const Yg=(t,n,e,o)=>Ng(t,n,e,o);const $g=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 Ug=t=>{const{selections:n}=t;const e=$g(n);return Qi(t,e)};const _g=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:Ss,start:{columnIndex:0,rowIndex:t}}));return e};const Vg=t=>{const{selections:n}=t;const e=_g(n);return Qi(t,e)};const jg=async t=>yo("Languages.getLanguageConfiguration",{languageId:t.languageId,uri:t.uri});const qg=t=>{if(t?.indentationRules?.increaseIndentPattern&&typeof t.indentationRules.increaseIndentPattern==="string"){const n=new RegExp(t.indentationRules.increaseIndentPattern);return n}return undefined};const Gg=(t,n)=>{if(!n){return false}return n.test(t)};const Xg=(t,n,e)=>{const o=[];const s=[];const c=qg(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(Ti(r,i,a,d)){const n=t[r];const e=n.slice(0,i);const a=vr(e);if(Gg(e,c)){o.push({deleted:Ar({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:Ar({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:Ar({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 Zg=async t=>{const{lines:n,selections:e}=t;const o=await jg(t);const{changes:s,selectionChanges:c}=Xg(n,e,o);return Qi(t,s,c)};const Qg=2;const Kg=0;const Jg=()=>{const t=Rd();const n={id:Fe,newState:{focused:true,focusSource:Qg,height:0,questions:[],uid:t,width:0,x:0,y:0},oldState:{focused:false,focusSource:Kg,height:0,questions:[],uid:t,width:0,x:0,y:0}};return n};const tm=async t=>{const n={...t,height:45,width:150,x:100,y:100};return n};const nm=async t=>{const n=true;return Td(Fe,ds,t,Jg,tm,n)};const em=()=>{const t=Rd();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:om,setFactory:sm}=Ho(je);const cm=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Ko(n);const{languageId:a}=i;await om("Completions.create",o,c,r,s,e,n,a);await om("Completions.loadContent",o);const d=await om("Completions.diff2",o);const l=await om("Completions.render2",o,d);return{...t,commands:l}};const rm=async t=>{const n=false;return Td(Te,os,t,em,cm,n)};const im=()=>{const t=Rd();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 am=async()=>{const t="Find Widget Worker";const n="findWidgetWorkerMain.js";return $o(t,n)};const dm=9002;const lm=async()=>{if($n(dm)){return}const t=await am();Yn(dm,t)};const um=async(t,...n)=>{const e=$n(dm);return await e.invoke(t,...n)};const fm=async()=>{const t=$n(dm);Un(dm);if(t){await t.dispose()}};const hm=t=>{const n=Ko(t);if(!n){throw new Error(`editor ${t} not found`)}const{newState:e}=n;return e};const gm=async(t,n)=>{const{uid:e}=t;const o=hm(n);const{height:s,width:c,x:r,y:i}=o;await lm();await um("FindWidget.create",e,r,i,c,s,n);await um("FindWidget.loadContent",e);const a=await um("FindWidget.diff2",e);const d=await um("FindWidget.render2",e,a);return{...t,commands:d}};const mm=(t,n)=>gm(t,n);const wm=async t=>{const n=true;return Td(De,cs,t,im,mm,n)};const pm=async t=>wm(t);const ym=t=>{const{selections:n}=t;const e=n[0];const o=n[1];const s=ad(t,e,o);const c=dd(t,e);return{columnIndex:o,rowIndex:e,x:s,y:c}};const xm=()=>{const t=Rd();const n={id:Oe,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 Em=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Ko(n);const{languageId:a}=i;await Md("Rename.create",o,c,r,s,e,n,a);await Md("Rename.loadContent",o);const d=await Md("Rename.diff2",o);const l=await Md("Rename.render2",o,d);return{...t,commands:l}};const Im=async t=>{const{columnIndex:n,rowIndex:e}=ym(t);const{word:o}=Du(t,e,n);if(!o){return t}const s=true;return Td(Oe,is,t,xm,Em,s)};const km=async t=>{const n=await Ea({args:[],editor:t,event:"onLanguage",method:"ExtensionHostOrganizeImports.execute"});return n};const Sm=async t=>{const n=await km(t);return qa(t,n)};const Cm=(t,n)=>{const e=gi(n);const o=Ja(t,e,ps);return Qi(t,o)};const vm=async t=>{const n=await Mo();w(n);return Cm(t,n)};const bm=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 Ki(o,e)};const Mm=t=>{if(!t){return`Error: ${t}`}let{message:n}=t;while(t.cause){t=t.cause;n+=`: ${t}`}return n};const Lm=t=>{if(!t){return{codeFrame:undefined,message:t,stack:undefined,type:"Error"}}const n=Mm(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 Am=/\((.*):(\d+):(\d+)\)$/;const Pm=/at (.*):(\d+):(\d+)$/;const Fm=t=>{for(const n of t){if(Am.test(n)||Pm.test(n)){return n}}return""};const Wm=async t=>{try{const n=gi(t.stack);const e=Fm(n);let o=e.match(Am);if(!o){o=e.match(Pm)}if(!o){return t}const s=Sr(n.slice(1));const c=Mm(t);return{message:c,stack:s,type:t.constructor.name}}catch(n){console.warn("ErrorHandling Error");console.warn(n);return t}};const Tm=async t=>{if(t&&t.message&&t.codeFrame){return Lm(t)}if(t&&t.stack){return Wm(t)}return t};const Rm=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 Dm=async t=>{const n=await Tm(t);const e=Rm(n);console.error(e);return n};const Bm=async t=>{try{await Dm(t)}catch(n){console.warn("ErrorHandling error");console.warn(n);console.error(t)}};const Om=async t=>t;const Hm=t=>t.startsWith("untitled:");const Nm=async(t,n)=>{await yo("FileSystem.writeFile",t,n)};const zm=async t=>{const n="Save File";const{canceled:e,filePath:o}=await ho("Open.showSaveDialog",n,[],t);if(e){return""}return o};const Ym=async(t,n,e)=>{const o=await zm(e);if(!o){return}await yo("FileSystem.writeFile",o,n);await Co();await yo("Main.handleUriChange",t,o);return o};const $m=async t=>{try{const{platform:n,uri:e}=t;const o=await Om(t);const s=Lr(o);if(Hm(e)){const t=await Ym(e,s,n);if(t){return{...o,modified:false,uri:t}}return o}await Nm(e,s);return{...o,modified:false}}catch(n){const e=new S(n,`Failed to save file "${t.uri}"`);await Bm(e);return t}};const Um=t=>{const{lines:n}=t;const e=0;const o=0;const s=n.length-1;const c=n.at(-1).length;const r=Mi(e,o,s,c);return Zi(t,r)};const _m=(t,n,e)=>{const o=Ai(t);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=pi(t,s);Kd(o,s+2,c,r,n,e);Zd(o,s,i,a)}return o};const Vm=(t,n)=>{const{lines:e,selections:o}=t;const s=_m(o,e,n);return Zi(t,s)};const jm=t=>{Vm(t,cl)};const qm=/[a-zA-Z\d]/;const Gm=t=>qm.test(t);const Xm=t=>Gm(t)||t==="_";const Zm=(t,n)=>{for(let e=n-1;e>=0;e--){if(!Xm(t[e])){return e+1}}return 0};const Qm=(t,n)=>{for(let e=n;e<t.length;e++){if(!Xm(t[e])){return e}}return t.length};const Km=(t,n,e)=>{const o=t[n];const s=Zm(o,e);const c=Qm(o,e);const r=o.slice(s,c);return{end:c,start:s,word:r}};const Jm=(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 tw=(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 nw=(t,n)=>{const e=[];for(let o=0;o<t.length-n.length+1;o){if(Jm(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 ew=(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=Km(t,c,r);if(e.start===e.end){return n}const o=tw(t,e.word);return o}const e=t[o];const i=e.slice(s,r);const a=tw(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=nw(t,i);return a};const ow=t=>{const{lines:n,selections:e}=t;const o=ew(n,e);return Zi(t,o)};const sw=(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 cw=(t,n)=>{const{lines:e}=t;const{selections:o}=t;const s=sw(o,e,n);return Zi(t,s)};const rw=t=>cw(t,rl);const iw=t=>Vm(t,nl);const aw=t=>cw(t,ol);const dw=(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 lw=t=>{const{lines:n,selections:e}=t;const o=dw(n,e);return Zi(t,o)};const uw=(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]!==gr){r--}r++;while(a<d.length&&d[a]!==gr){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 fw=t=>{const{selections:n}=t;const{lines:e}=t;const o=uw(e,n);return Zi(t,o)};const hw=async(t,n)=>{const e=await yo("ExtensionHostSelection.executeGrowSelection",t,n);if(e.length===0){return n}return new Uint32Array(e)};const gw=async t=>{const{selections:n}=t;const e=await hw(t,n);return Zi(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 ww=t=>{const{lines:n}=t;const{selections:e}=t;if(Bi(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=Km(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(Oi(t.selections)){return mw(t.lines,t.selections)}return undefined};const pw=(t,n,e,o)=>e>=t&&o<=n;const yw=t=>{const n=ww(t);if(!n){return t}const{revealRange:e,selectionEdits:o}=n;const s=o[e];const c=o[e+2];if(pw(t.minLineY,t.maxLineY,s,c)){return Zi(t,o)}return Qi(t,[],o)};const xw=t=>t;const Ew=(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 Iw=t=>{const{lines:n,selections:e}=t;const o=Ew(n,e);return Zi(t,o)};const kw=t=>Vm(t,gl);const Sw=t=>cw(t,yl);const Cw=(t,n,e)=>{if(t.decorations.length===0&&n.length===0){return t}return{...t,decorations:n,diagnostics:e}};const vw=async(t,n,e)=>{const{tokenizerId:o}=t;Gc(n,e);await nr(n,e);const s=er(n);const c=o+1;sr(c,s);const r=hm(t.uid);if(!r){return t}const i=Qr();const{differences:a,textInfos:d}=await Ur(t,i);const l=hm(t.uid);if(!l){return t}const u={...l,differences:a,focused:true,textInfos:d};return{...u,invalidStartIndex:0,languageId:n,tokenizerId:c}};const bw=(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 Mw=(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:Ar(t,{end:c,start:s}),end:c,inserted:gi(n),origin:xs,start:s}];return Qi(t,r)};const Lw=()=>{const t=Rd();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 Aw=async()=>{const t="Hover Worker";const n="hoverWorkerMain.js";const e="Hover.initialize";const o=await $o(t,n,e);return o};const Pw={};const Fw=()=>{if(!Pw.workerPromise){Pw.workerPromise=Aw()}return Pw.workerPromise};const Ww=async(t,...n)=>{const e=await Fw();return await e.invoke(t,...n)};const Tw=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Ko(n);const{languageId:a}=i;await Ww("Hover.create",o,c,r,s,e,n,a);await Ww("Hover.loadContent",o);const d=await Ww("Hover.diff2",o);const l=await Ww("Hover.render2",o,d);return{...t,commands:l}};const Rw=async t=>{const n=false;return Td(Be,rs,t,Lw,Tw,n)};const Dw="EditorHover";const Bw=async t=>{await yo("Viewlet.openWidget",Dw);return t};const Ow=()=>{const t=Rd();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 Hw=async()=>{const t="Source Action Worker";const n="sourceActionWorkerMain.js";const e="SourceActions.initialize";const o=await $o(t,n,e);return o};const Nw={};const zw=()=>{if(!Nw.workerPromise){Nw.workerPromise=Hw()}return Nw.workerPromise};const Yw=async(t,...n)=>{const e=await zw();return await e.invoke(t,...n)};const $w=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Ko(n);const{languageId:a}=i;await Yw("SourceActions.create",o,c,r,s,e,n,a);await Yw("SourceActions.loadContent",o);const d=await Yw("SourceActions.diff2",o);const l=await Yw("SourceActions.render2",o,d);return{...t,commands:l}};const Uw=async t=>Td(He,as,t,Ow,$w);const _w=(t,n)=>t.localeCompare(n);const Vw=t=>{const n=[...t];n.sort(_w);return n};const jw="sort-lines-ascending";const qw=(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=Vw(h);s.push({deleted:Ar({lines:t},f),end:u,inserted:g,origin:jw,start:l})}return s};const Gw=t=>{const{lines:n,selections:e}=t;const o=qw(n,e);return Qi(t,o)};const Xw=async(t,n)=>Ea({args:[n],editor:t,event:xa,method:ca,noProviderFoundMessage:"No tab completion provider found",noProviderFoundResult:undefined});const Zw=t=>{const{selections:n}=t;const e=n[0];const o=n[1];const s=Fr(t,e,o);return s};const Qw=async t=>{const n=Zw(t);const e=await Xw(t,n);return e};const Kw=(t,n,e)=>{const o=gi(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=Mr({lines:t},i);const r=vr(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:ys,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:ys,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:ys,start:{columnIndex:a-e.deleted,rowIndex:i}})}}}return{changes:s,selectionChanges:new Uint32Array(c)}};const Jw=(t,n)=>{const{lines:e,selections:o}=t;const{changes:s,selectionChanges:c}=Kw(e,o,n);return Qi(t,s,c)};const tp=String;const np=async t=>{try{const n=await Qw(t);if(!n){return t}return Jw(t,n)}catch(n){await Bm(n);const e=t.selections[0];const o=t.selections[1];return fd(t,e,o,tp(n))}};const ep=async(t,n)=>{const{assetDir:e,platform:o}=t;try{await No(`onLanguage:${t.languageId}`,e,o);const s=await ia(`ExtensionHostCommment.execute`,t.uid,n);if(s){return s}}catch{}const s=await jg(t);if(!s?.comments?.blockComment){return undefined}return s.comments.blockComment};const op=/^\s+/;const sp=/\s+$/;const cp=(t,n,e)=>({deleted:[e],end:{columnIndex:n+e.length,rowIndex:t},inserted:[],origin:Ms,start:{columnIndex:n,rowIndex:t}});const rp=(t,n,e,o,s,c,r)=>{if(n===o){return[cp(t,e,c),cp(t,s-c.length,r)]}return[cp(n,e,c),cp(o,s,r)]};const ip=(t,n)=>{const{selections:e}=t;const[o]=e;const s=Mr(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=Mr(t,r);i=n.indexOf(d);if(i!==-1){break}r++}let l=-1;let u=o;while(u>=0){const n=Mr(t,u);l=n.indexOf(a);if(l!==-1){break}u--}const f=[];if(l!==-1&&i!==-1){f.push(...rp(o,u,l,r,i,a,d))}else{const t=s.match(op);const n=s.match(sp);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:Ms,start:{columnIndex:e,rowIndex:o}};const i={deleted:[],end:{columnIndex:c+a.length,rowIndex:o},inserted:[d],origin:Ms,start:{columnIndex:c+a.length,rowIndex:o}};f.push(r,i)}return f};const ap=async t=>{const n=Zw(t);const e=await ep(t,n);if(!e){return t}const o=ip(t,e);return Ji(t,o)};const dp=async t=>{const n=await jg(t);if(!n?.comments?.lineComment){return undefined}return n.comments.lineComment};const lp=/^\s+/;const up=(t,n,e)=>{const o=n.match(lp);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:vs,start:{columnIndex:s,rowIndex:t}}}return{deleted:[e],end:{columnIndex:s+e.length,rowIndex:t},inserted:[""],origin:vs,start:{columnIndex:s,rowIndex:t}}}return{deleted:[],end:{columnIndex:s,rowIndex:t},inserted:[`${e} `],origin:vs,start:{columnIndex:s,rowIndex:t}}};const fp=async t=>{const n=await dp(t);if(!n){return t}const e=t;const o=t.selections[0];const s=Mr(e,o);const c=[up(o,s,n)];return Qi(t,c)};const hp=async t=>{try{const n=await fp(t);if(t!==n){return n}return ap(t)}catch(n){ja(n);await ud(t,0,0,String(n),true);return t}};const gp=async(t,n)=>{const e=Ja(t,[n],xs);const o=await Qi(t,e);if(o.completionsOnType){const t=await rm(o);return t}return o};const mp="/";const wp="{";const pp="}";const yp="(";const xp=")";const Ep="[";const Ip="]";const kp="???";const Sp="'";const Cp='"';const vp="`";const bp=t=>{switch(t){case wp:return pp;case yp:return xp;case Ep:return Ip;default:return kp}};const Mp=(t,n)=>{const e=bp(n);const o=n+e;const s=Ja(t,[o],Es);const c=new Uint32Array([s[0].start.rowIndex,s[0].start.columnIndex+1,s[0].end.rowIndex,s[0].end.columnIndex+1]);return Qi(t,s,c)};const Lp=t=>{const{selections:n}=t;const e=new Uint32Array([n[0],n[1]+1,n[2],n[3]+1]);return Zi(t,e)};const Ap=(t,n)=>{const{autoClosingRanges:e=[],selections:o}=t;if(fu(e,o)){return Lp(t)}return gp(t,n)};const Pp=(t,n)=>{const e=n+n;const o=Ja(t,[e],Es);const s=new Uint32Array([o[0].start.rowIndex,o[0].start.columnIndex+1,o[0].end.rowIndex,o[0].end.columnIndex+1]);return Qi(t,o,s)};const Fp=async(t,n)=>{const e=Fr(t,t.selections[0],t.selections[1]);const o=await yo("ExtensionHostClosingTagCompletion.executeClosingTagProvider",t,e,n);if(!o){const e=Ja(t,[n],xs);return Qi(t,e)}const s=Ja(t,[o.inserted],xs);return Qi(t,s)};const Wp=async(t,n)=>{const{isAutoClosingBracketsEnabled:e,isAutoClosingQuotesEnabled:o,isAutoClosingTagsEnabled:s}=t;switch(n){case mp:if(s){return Fp(t,n)}break;case pp:case xp:case Ip:if(e){return Ap(t,n)}break;case wp:case yp:case Ep:if(e){return Mp(t,n)}break;case vp:case Cp:case Sp:if(o){return Pp(t,n)}break}const c=gp(t,n);return c};const Tp=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 Rp=t=>{const{undoStack:n}=t;if(n.length===0){return t}const e=n.at(-1);const o=e.map(Tp);const s={...t,redoStack:[...t.redoStack||[],e],undoStack:n.slice(0,-1)};return Ki(s,o)};const Dp=t=>t;const Bp=t=>{switch(t){case We:case Te:case De:case Be:case Oe:case He:return true;default:return false}};const Op=(t,n,e)=>{const o=e(t);const{uid:s}=t.newState;const c=[];c.push(["Viewlet.createFunctionalRoot",n,s,Bp(t.id)]);c.push(...o);if(Bp(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 Hp=t=>{switch(t){case We:return jo;case Te:return om;case De:return um;case Be:return Ww;case Oe:return Md;case He:return Yw;default:return undefined}};const Np=(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 zp=(t,n,e)=>{const o=t=>t.id===e;const s=async(s,...c)=>{const r=s.widgets.findIndex(o);if(r===-1){return s}const i=s.widgets[r];const a=i.newState;const{uid:d}=a;const l=Hp(e);await l(`${n}.${t}`,d,...c);const u=await l(`${n}.diff2`,d);const f=await l(`${n}.render2`,d,u);const h={...a,commands:f};const g=Ko(s.uid).newState;const m=Np(g,e,h);return m};return s};const Yp=(t,n,e)=>{const o=Object.create(null);for(const s of t){o[s]=zp(s,n,e)}return o};const $p="Viewlet.appendToBody";const Up="focus";const _p="Viewlet.registerEventListeners";const Vp="Viewlet.setSelectionByName";const jp="Viewlet.setValueByName";const qp="Viewlet.setFocusContext";const Gp="setBounds";const Xp="Viewlet.setBounds";const Zp="Viewlet.setCss";const Qp="Viewlet.setDom2";const Kp="Viewlet.setUid";const Jp=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const ty=[Qp,Zp,$p,Xp,_p,Vp,jp,qp,Kp,"Viewlet.focusSelector"];const ny=t=>{const n=Jp(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(ty.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const ey=t=>Op(t,"EditorCompletion",ny);const oy=t=>[["Viewlet.dispose",t.newState.uid]];const{close:sy,closeDetails:cy,focusFirst:ry,focusIndex:iy,focusLast:ay,focusNext:dy,focusPrevious:ly,handleEditorBlur:uy,handleEditorClick:fy,handleEditorDeleteLeft:hy,handleEditorType:gy,handlePointerDown:my,handleWheel:wy,openDetails:py,selectCurrent:yy,selectIndex:xy,toggleDetails:Ey}=Yp(["handleEditorType","focusFirst","focusNext","focusPrevious","focusLast","handleEditorDeleteLeft","openDetails","focusIndex","handleEditorBlur","handleEditorClick","openDetails","selectCurrent","selectIndex","toggleDetails","closeDetails","handleWheel","close","handlePointerDown"],"Completions",Te);const Iy={__proto__:null,add:ey,close:sy,closeDetails:cy,focusFirst:ry,focusIndex:iy,focusLast:ay,focusNext:dy,focusPrevious:ly,handleEditorBlur:uy,handleEditorClick:fy,handleEditorDeleteLeft:hy,handleEditorType:gy,handlePointerDown:my,handleWheel:wy,openDetails:py,remove:oy,render:ny,selectCurrent:yy,selectIndex:xy,toggleDetails:Ey};const ky=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const Sy=[Qp,Zp,$p,Xp,_p,Vp,jp,qp,Kp,"Viewlet.focusSelector"];const Cy=t=>{const n=ky(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(Sy.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const vy=t=>Op(t,"FindWidget",Cy);const by=t=>[["Viewlet.dispose",t.newState.uid]];const{close:My,focusCloseButton:Ly,focusFind:Ay,focusNext:Py,focusNextElement:Fy,focusNextMatchButton:Wy,focusPrevious:Ty,focusPreviousElement:Ry,focusPreviousMatchButton:Dy,focusReplace:By,focusReplaceAllButton:Oy,focusReplaceButton:Hy,focusToggleReplace:Ny,handleBlur:zy,handleClickButton:Yy,handleFocus:$y,handleInput:Uy,handleReplaceFocus:_y,handleReplaceInput:Vy,handleToggleReplaceFocus:jy,replace:qy,replaceAll:Gy,toggleMatchCase:Xy,toggleMatchWholeWord:Zy,togglePreserveCase:Qy,toggleReplace:Ky,toggleUseRegularExpression:Jy}=Yp(["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 tx={__proto__:null,add:vy,close:My,focusCloseButton:Ly,focusFind:Ay,focusNext:Py,focusNextElement:Fy,focusNextMatchButton:Wy,focusPrevious:Ty,focusPreviousElement:Ry,focusPreviousMatchButton:Dy,focusReplace:By,focusReplaceAllButton:Oy,focusReplaceButton:Hy,focusToggleReplace:Ny,handleBlur:zy,handleClickButton:Yy,handleFocus:$y,handleInput:Uy,handleReplaceFocus:_y,handleReplaceInput:Vy,handleToggleReplaceFocus:jy,remove:by,render:Cy,replace:qy,replaceAll:Gy,toggleMatchCase:Xy,toggleMatchWholeWord:Zy,togglePreserveCase:Qy,toggleReplace:Ky,toggleUseRegularExpression:Jy};const nx=t=>({documentId:t.id||t.uid,languageId:t.languageId,text:Lr(t),uri:t.uri});const ex=async(t,n)=>{const e=nx(t);return lo("Extensions.executeHoverProvider",e,n)};const ox=async(t,n)=>{h(t);g(n);const e=await ex(t,n);if(e){return e}return Ea({args:[n],editor:t,event:ya,method:sa,noProviderFoundMessage:"No hover provider found"})};const sx=async(t,n)=>{h(t);g(n);const e=await ox(t,n);return e};const cx=async(t,n,e,o,s)=>100;const rx=(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 ix=(t,n,e)=>{const o=[];const{hasArrayReturn:s,initialLineState:c,tokenizeLine:r,TokenMap:i}=n;let a=Mc(c);for(const n of t){const t=Fc(e,r,n,a,s);const{tokens:c}=t;const d=rx(n,c,i);o.push(d);a=t}console.error({lineInfos:o});return o};const ax=async(t,n,e)=>{await nr(n,e);const o=er(n);const s=gi(t);const c=ix(s,o,n);return c};const dx=(t,n)=>{if(t){return t}const e=n[0];const o=n[1];return{columnIndex:o,rowIndex:e}};const lx=(t,n,e)=>{const o=[];for(const e of t){if(e.rowIndex===n){o.push(e)}}return o};const ux="typescript";const fx=(t,n,e,o)=>{const s=ad(t,n,e);const c=t.height-dd(t,n)+t.y+40;return{x:s,y:c}};const hx=async(t,n)=>{g(t);const e=Ko(t);const o=e.newState;const{selections:s}=o;const{columnIndex:c,rowIndex:r}=dx(n,s);const i=Fr(o,r,c);const a=await sx(o,i);if(!a){return undefined}const{displayString:d,displayStringLanguageId:l,documentation:u}=a;const f="";const h=await ax(d,l||ux,f);const m=Bu(o,r,c);const w=c-m.length;await cx();const{x:p,y:y}=fx(o,r,w);const x=o.diagnostics||[];const E=lx(x,r);return{documentation:u,lineInfos:h,matchingDiagnostics:E,x:p,y:y}};const gx=async(t,n,e)=>{const o=await hx(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 mx=(t,n,e)=>t;const wx=(t,n,e)=>{const{x:o}=t;const s=100;const c=Math.max(n-o,s);return{...t,resizedWidth:c}};const px=(t,n,e)=>t;const yx="CodeGeneratorInput";const xx="CodeGeneratorMessage";const Ex="CodeGeneratorWidget";const Ix="DiagnosticError";const kx="DiagnosticWarning";const Sx="CompletionDetailCloseButton";const Cx="CompletionDetailContent";const vx="Diagnostic";const bx="EditorCursor";const Mx="EditorRow";const Lx="EditorRowHighlighted";const Ax="EditorSelection";const Px="HoverDisplayString";const Fx="HoverDocumentation";const Wx="HoverEditorRow";const Tx="HoverProblem";const Rx="HoverProblemDetail";const Dx="HoverProblemMessage";const Bx="IconClose";const Ox="InputBox";const Hx="MaskIcon";const Nx="Viewlet";const zx=1;const Yx=2;const $x=9;const Ux=10;const _x=11;const Vx=12;const jx=13;const qx=14;const Gx=15;const Xx=18;const Zx=19;const Qx=20;const Kx=21;const Jx=22;const tE=23;const nE=26;const eE=27;const oE=28;const sE=29;const cE=30;const rE=31;const iE=32;const aE=33;const dE=4;const lE=6;const uE=8;const fE=12;const hE=62;const gE=t=>({childCount:0,text:t,type:fE});const mE=t=>{const n=[{childCount:t.length/2,className:Wx,type:dE}];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:uE},gE(o))}return n};const wE=t=>{const n=t.flatMap(mE);return n};const pE={childCount:1,className:Dx,type:uE};const yE={childCount:1,className:Rx,type:uE};const xE=(t,n,e)=>{const o=n?1:0;const s=e&&e.length>0?1:0;return t.length+o+s};const EE=(t,n,e)=>{const o=[];o.push({childCount:xE(t,n,e)+1,className:"Viewlet EditorHover",type:dE});if(e&&e.length>0){o.push({childCount:e.length*2,className:`${Px} ${Tx}`,type:dE});for(const t of e){o.push(pE,gE(t.message),yE,gE(`${t.source} (${t.code})`))}}if(t.length>0){const n=wE(t);o.push({childCount:t.length,className:Px,type:dE},...n)}if(n){o.push({childCount:1,className:Fx,type:dE},gE(n))}o.push({childCount:0,className:"Sash SashVertical SashResize",onPointerDown:nE,type:dE});return o};const IE={apply(t,n){const e=EE(n.lineInfos,n.documentation,n.diagnostics);return[Qp,e]},isEqual:(t,n)=>t.lineInfos===n.lineInfos&&t.documentation===n.documentation&&t.diagnostics===n.diagnostics};const kE={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[Gp,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y};const SE=[IE,kE];const CE=(t,n)=>{const e=[];for(const o of SE){if(!o.isEqual(t,n)){e.push(o.apply(t,n))}}return e};const vE=[Qp,Zp,$p,Xp,_p,Vp,jp,qp,Kp,"Viewlet.focusSelector"];const bE=t=>{const n=Jp(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(vE.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const ME=t=>Op(t,"EditorRename",bE);const LE=t=>[["Viewlet.dispose",t.newState.uid]];const{accept:AE,close:PE,handleInput:FE}=Yp(["handleInput","close","accept"],"Rename",Oe);const WE={__proto__:null,accept:AE,add:ME,close:PE,handleInput:FE,remove:LE,render:bE};const TE=t=>structuredClone(t);const RE=(t,n)=>{const e={...t,focusedIndex:n};return e};const DE=t=>{const n=t.focusedIndex+1;return RE(t,n)};const BE=t=>[["Viewlet.send",t.newState.uid,"dispose"]];const OE=[Qp,Zp,$p,Xp,_p,Vp,jp,qp,Kp,"Viewlet.focusSelector"];const HE=t=>{const n=Jp(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(OE.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const NE=t=>Op(t,"EditorSourceActions",HE);const zE=BE;const{close:YE,closeDetails:$E,focusFirst:UE,focusIndex:_E,focusLast:VE,focusNext:jE,focusPrevious:qE,handleWheel:GE,selectCurrent:XE,selectIndex:ZE,selectItem:QE,toggleDetails:KE}=Yp(["focusFirst","focusIndex","focusLast","focusNext","focusPrevious","selectCurrent","selectIndex","selectItem","toggleDetails","closeDetails","handleWheel","close"],"SourceActions",He);const JE={__proto__:null,add:NE,close:YE,closeDetails:$E,focusFirst:UE,focusIndex:_E,focusLast:VE,focusNext:jE,focusPrevious:qE,handleWheel:GE,remove:zE,render:HE,selectCurrent:XE,selectIndex:ZE,selectItem:QE,toggleDetails:KE};const tI=async(t,n,e,o,s,...c)=>{const r=Hp(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=hm(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 x=Np(u,s,y);return x};const nI=(t,n)=>t.filter(t=>t.languageId===n);const eI=async t=>{if(!t){return[]}const{newState:n}=Ko(t);const{languageId:e}=n;const o=await yo("GetEditorSourceActions.getEditorSourceActions");const s=nI(o,e);return s};const oI=/[\w\-]+$/;const sI=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(oI);if(i){return i[0]}return""};const cI=async t=>{await yo("Focus.setFocus",t)};const rI=async t=>{if(!t){return}await yo("Focus.removeAdditionalFocus",t)};const iI=12;const aI=9;const dI=11;const lI=12;const uI=16;const fI=38;const hI=43;const gI=46;const mI=47;const wI=48;const pI=49;const yI=50;const xI=52;const EI=t=>{const n=hm(t);return ym(n)};const II=t=>{const n=hm(t);return n.uri};const kI=t=>{const n=hm(t);return n.languageId};const SI=t=>{const n=hm(t);return Zw(n)};const CI=(t,n,e)=>{const o=hm(t);const{word:s}=Du(o,n,e);return s};const vI=t=>{const n=hm(t);const e=sI(n);return e};const bI=(t,n,e)=>{const o=hm(t);const s=Bu(o,n,e);return s};const MI=t=>{const n=hm(t);const{lines:e}=n;return e};const LI=t=>{const n=hm(t);const{selections:e}=n;return e};const AI=async(t,n)=>{const e=hm(t);const o={...e,selections:n};const s=await fg(e,o);ts(t,e,s)};const PI=async(t,n,e,o)=>{const s=hm(t);const c=Hp(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 fg(s,d);ts(t,s,l);await cI(lI);if(o){await rI(o)}};const FI=async t=>{await PI(t,De,"FindWidget",0)};const WI=async(t,n)=>{const e=hm(t);const o=await Ga(e,n);const s=await fg(e,o);ts(t,e,s)};const TI=async t=>{const n=await eI(t);return n};const RI=async t=>{const n=hm(t);const{diagnostics:e}=n;return e};const DI=async(t,n)=>{await wo("TextMeasurement.ensureFont",t,n)};const BI=()=>[{command:"Editor.closeSourceAction",key:ee,when:fI},{command:"EditorSourceActions.focusNext",key:de,when:fI},{command:"EditorSourceActions.focusPrevious",key:ie,when:fI},{command:"EditorSourceActions.focusFirst",key:ce,when:fI},{command:"EditorSourceActions.focusLast",key:se,when:fI},{command:"EditorSourceActions.selectCurrent",key:ne,when:fI},{command:"FindWidget.focusNext",key:ne,when:uI},{command:"FindWidget.preventDefaultBrowserFind",key:Ne|ge,when:uI},{command:"FindWidget.focusPrevious",key:ze|ve,when:uI},{command:"FindWidget.focusNext",key:ve,when:uI},{command:"FindWidget.focusToggleReplace",key:ze|te,when:uI},{command:"FindWidget.focusReplace",key:te,when:uI},{command:"FindWidget.focusPreviousMatchButton",key:te,when:hI},{command:"FindWidget.replaceAll",key:Ye|Ne|ne,when:hI},{command:"FindWidget.focusNextMatchButton",key:te,when:yI},{command:"FindWidget.focusReplace",key:ze|te,when:yI},{command:"FindWidget.focusPreviousMatchButton",key:ze|te,when:pI},{command:"FindWidget.focusCloseButton",key:te,when:pI},{command:"FindWidget.focusNextMatchButton",key:ze|te,when:wI},{command:"FindWidget.focusReplaceButton",key:te,when:wI},{command:"FindWidget.focusFind",key:ze|te,when:hI},{command:"FindWidget.focusReplaceAllButton",key:te,when:gI},{command:"FindWidget.focusCloseButton",key:ze|te,when:gI},{command:"FindWidget.focusReplaceButton",key:ze|te,when:mI},{command:"EditorCompletion.focusNext",key:de,when:aI},{command:"EditorCompletion.focusPrevious",key:ie,when:aI},{command:"EditorCompletion.selectCurrent",key:ne,when:aI},{command:"EditorCompletion.close",key:ee,when:aI},{command:"EditorCompletion.focusLast",key:se,when:aI},{command:"EditorCompletion.focusFirst",key:ce,when:aI},{command:"EditorCompletion.toggleDetails",key:Ne|oe,when:aI},{command:"Editor.cursorWordRight",key:Ne|ae,when:lI},{command:"Editor.cursorWordLeft",key:Ne|re,when:lI},{command:"Editor.deleteWordPartLeft",key:Ye|Jn,when:lI},{command:"Editor.deleteWordPartRight",key:Ye|le,when:lI},{command:"Editor.deleteWordLeft",key:Ne|Jn,when:lI},{command:"Editor.deleteWordRight",key:Ne|le,when:lI},{command:"Editor.selectNextOccurrence",key:Ne|he,when:lI},{command:"Editor.openColorPicker",key:Ne|we,when:lI},{command:"Editor.showSourceActions3",key:Ne|Me,when:lI},{command:"Editor.handleTab",key:te,when:lI},{command:"Editor.unindent",key:ze|te,when:lI},{command:"Editor.indentLess",key:Ne|Ae,when:lI},{command:"Editor.closeFind",key:ee,when:uI},{command:"Editor.openFind2",key:Ne|ge,when:lI},{command:"Editor.openCodeGenerator",key:Ne|pe,when:lI},{command:"Editor.closeCodeGenerator",key:ee,when:xI},{command:"EditorCodeGenerator.accept",key:ne,when:xI},{command:"Editor.indentMore",key:Ne|Pe,when:lI},{command:"Editor.selectCharacterLeft",key:ze|re,when:lI},{command:"Editor.selectWordLeft",key:Ne|ze|re,when:lI},{command:"Editor.selectCharacterRight",key:ze|ae,when:lI},{command:"Editor.selectWordRight",key:Ne|ze|ae,when:lI},{command:"Editor.selectLine",key:Ne|ye,when:lI},{command:"Editor.deleteAllLeft",key:Ne|ze|Jn,when:lI},{command:"Editor.deleteAllRight",key:Ne|ze|le,when:lI},{command:"Editor.cancelSelection",key:ee,when:lI},{command:"Editor.undo",key:Ne|ke,when:lI},{command:"Editor.cursorLeft",key:re,when:lI},{command:"Editor.cursorRight",key:ae,when:lI},{command:"Editor.cursorUp",key:ie,when:lI},{command:"Editor.cursorDown",key:de,when:lI},{command:"Editor.deleteLeft",key:Jn,when:lI},{command:"Editor.deleteRight",key:le,when:lI},{command:"Editor.insertLineBreak",key:ne,when:lI},{command:"Editor.copyLineDown",key:Ne|ze|he,when:lI},{command:"Editor.moveLineDown",key:Ne|ze|de,when:lI},{command:"Editor.moveLineUp",key:Ne|ze|ie,when:lI},{command:"Editor.openCompletion",key:Ne|oe,when:lI},{command:"Editor.openRename",key:Se,when:lI},{command:"EditorRename.accept",key:ne,when:dI},{command:"Editor.closeRename",key:ee,when:dI},{command:"Editor.cursorHome",key:ce,when:lI},{command:"Editor.cursorEnd",key:se,when:lI},{command:"Editor.toggleComment",key:Ne|Le,when:lI},{command:"Editor.copy",key:Ne|fe,when:lI},{command:"Editor.selectAll",key:Ne|ue,when:lI},{command:"Editor.showHover2",key:Ne|me,when:lI},{command:"Editor.cut",key:Ne|Ie,when:lI},{command:"Editor.paste",key:Ne|Ee,when:lI},{command:"Editor.cursorWordPartLeft",key:Ye|re,when:lI},{command:"Editor.cursorWordPartRight",key:Ye|ae,when:lI},{command:"Editor.selectAllOccurrences",key:Ye|Ce,when:lI},{command:"Editor.addCursorAbove",key:Ye|ze|ie,when:lI},{command:"Editor.addCursorBelow",key:Ye|ze|de,when:lI},{command:"Editor.findAllReferences",key:Ye|ze|be,when:lI},{command:"Editor.organizeImports",key:Ye|ze|xe,when:lI},{command:"Editor.selectionGrow",key:Ne|ze|oe,when:iI}];const OI=()=>Jo();const HI={CommandPalette:"Command Palette"};const NI=()=>zu(HI.CommandPalette);const zI={command:"",flags:_e,id:"separator",label:""};const YI=()=>[{command:"Editor.goToDefinition",flags:Ve,id:"go-to-definition",label:Sf()},{command:"Editor.goToTypeDefinition",flags:Ve,id:"go-to-type-definition",label:Ff()},zI,{args:["References",true],command:"SideBar.show",flags:Ve,id:"find-all-references",label:Wf()},{args:["Implementations",true],command:"SideBar.show",flags:Ve,id:"find-all-implementations",label:Tf()},zI,{command:"Editor.format",flags:Ve,id:"format",label:zf()},{command:"Editor.showSourceActions2",flags:Ve,id:Ue,label:Lf()},zI,{command:"Editor.cut",flags:Ve,id:"cut",label:Rf()},{command:"Editor.copy",flags:Ve,id:"copy",label:Df()},{command:"Editor.paste",flags:Ve,id:"paste",label:Bf()},zI,{command:"QuickPick.showEverything",flags:Ve,id:"commandPalette",label:NI()}];const $I=()=>[$e];const UI=t=>Sa(t);const _I=async()=>{const t=Jo();const n=t.map(t=>{const n=parseInt(t);const e=Ko(n);return e});const e=n.map(t=>t.newState);const o=await Promise.all(e.map(UI));const s=o.flat();return s};const VI=()=>[{id:"Editor.format",label:zf()},{id:"Editor.showHover",label:Yf()},{id:"Editor.formatForced",label:$f()},{id:"Editor.selectNextOccurrence",label:Uf()},{id:"Editor.selectAllOccurrences",label:_f()},{id:"Editor.goToDefinition",label:Vf()},{id:"Editor.goToTypeDefinition",label:jf()},{id:"Editor.selectInsideString",label:qf()},{aliases:["Indent More","DeIndent"],id:"Editor.indent",label:Gf()},{aliases:["Indent Less","DeIndent"],id:"Editor.unindent",label:Xf()},{id:"Editor.sortLinesAscending",label:Zf()},{id:"Editor.toggleComment",label:Qf()},{id:"Editor.selectUp",label:Kf()},{id:"Editor.selectDown",label:Jf()},{id:"Editor.toggleBlockComment",label:Of()},{id:"Editor.openColorPicker",label:th()},{id:"Editor.closeColorPicker",label:nh()},{id:"Editor.copyLineDown",label:eh()},{id:"Editor.copyLineUp",label:oh()},{id:"Editor.moveLineDown",label:Nf()},{id:"Editor.moveLineUp",label:Hf()},{id:"Editor.showSourceActions2",label:Lf()}];const jI=t=>{const n=hm(t);const{selections:e}=n;return e};const qI=t=>{g(t);const n=hm(t);const{lines:e}=n;return e.join(wr)};const GI="insertText";const XI=(t,n,e)=>{switch(n){case GI:return Wp(t,e);default:return t}};const ZI=async(t,n)=>{const e=await On({commandMap:{},messagePort:t});if(n){Yn(n,e)}};const QI=(t,n)=>Jw(t,n);const KI=async t=>{const n=await Qw(t);if(!n){return t}return QI(t,n)};const JI=async()=>{await fm();await lm()};const tk=t=>{switch(t){case De:return`FindWidget`;default:return""}};const nk=async t=>{const n=Object.create(null);for(const e of t){const t=Ko(parseInt(e));const{widgets:o}=t.newState;for(const t of o){const o=Hp(t.id);const s=`${e}:${t.newState.uid}`;const c=tk(t.id);const r=await o(`${c}.saveState`,t.newState.uid);n[s]=r}}return n};const ek=async(t,n)=>{const e=[];for(const o of t){const t=parseInt(o);const s=Ko(t);const{widgets:c}=s.newState;const r=[];for(const e of c){const s=Hp(e.id);const c=`${o}:${e.newState.uid}`;const i=n[c]||{};const a=tk(e.id);await s(`${a}.create`,e.newState.uid,e.newState.x,e.newState.y,e.newState.width,e.newState.height,t);await s(`${a}.loadContent`,e.newState.uid,i);const d=await s(`${a}.diff2`,e.newState.uid);const l=await s(`${a}.render2`,e.newState.uid,d);const u={...e,newState:{...e.newState,commands:l}};r.push(u)}e.push({...s,newState:{...s.newState,widgets:r}})}return e};const ok={isReloading:false};const sk=async()=>{if(ok.isReloading){return}ok.isReloading=true;const t=Jo();const n=await nk(t);await JI();const e=await ek(t,n);for(const t of e){ts(t.newState.uid,t.oldState,t.newState)}await yo(`Editor.rerender`);ok.isReloading=false};const ck=async t=>{try{await To(t)}catch{await xo("SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker",t,"HandleMessagePort.handleMessagePort")}};const rk=async()=>{try{const t=await Rn({commandMap:{},send:ck});return t}catch(t){throw new S(t,`Failed to create syntax highlighting worker rpc`)}};const ik=async(t,n)=>{if(t){zc(true);const t=await rk();Uc(t)}if(n){Zr(true)}};const ak=async()=>{const t="Completion Worker";const n="completionWorkerMain.js";const e="Completions.initialize";const o=await $o(t,n,e);return o};const dk=async(t,n)=>{sm(ak);await ik(t,n)};const lk="editor.lineHeight";const uk="editor.fontSize";const fk="editor.fontFamily";const hk="editor.letterSpacing";const gk="editor.tabSize";const mk="editor.lineNumbers";const wk="editor.diagnostics";const pk="editor.quickSuggestions";const yk="editor.autoClosingQuotes";const xk="editor.autoclosingBrackets";const Ek="editor.fontWeight";const Ik=async()=>Boolean(await wa(xk));const kk=async()=>Boolean(await wa(yk));const Sk=async()=>Boolean(await wa(pk));const Ck=async()=>true;const vk=async()=>await wa(lk)||20;const bk=async()=>await wa(uk)||15;const Mk=async()=>await wa(fk)||"Fira Code";const Lk=async()=>await wa(hk)??.5;const Ak=async()=>await wa(gk)||2;const Pk=async()=>await wa(mk)??false;const Fk=async()=>[".","/"];const Wk=async()=>await wa(wk)??false;const Tk=async()=>await wa(Ek)??400;const Rk=async()=>{const[t,n,e,o,s,c,r,i,a,d,l,u,f]=await Promise.all([Wk(),Mk(),bk(),Tk(),Ik(),kk(),Ck(),Sk(),Pk(),vk(),Ak(),Lk(),Fk()]);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 Dk=(t,n)=>{for(const e of t){if(e?.id===n){return e.tokenize||""}}return""};const Bk=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:x,lineNumbers:E,rowHeight:I,tabSize:k}=await Rk();const S=await ma(g,h,f,x);const C=await ga(c,e);Zc(C);const v=ha(r,C);const b=Dk(C,v);await nr(v,b);const M=er(v);const L=t.tokenizerId+1;sr(L,M);const A={...t,charWidth:S,completionTriggerCharacters:l,diagnosticsEnabled:u,fontFamily:f,fontSize:h,fontWeight:g,isAutoClosingBracketsEnabled:m,isAutoClosingQuotesEnabled:w,isAutoClosingTagsEnabled:p,isQuickSuggestionsEnabled:y,languageId:v,letterSpacing:x,lineNumbers:E,rowHeight:I,tabSize:k,tokenizerId:L};const P=await So(r);const F=na(A,a,d,i,o,9);const W=ea(F,P);let T=W;const R=ci(T);const D={...T,decorations:R};const B=Qr();const{differences:O,textInfos:H}=await Ur(D,B);const N={...D,differences:O,focus:co,focused:true,textInfos:H};await ia(ra,r,s,v,P);if(u){await Ma(N)}const z=await wa("editor.completionsOnType");const Y=Boolean(z);const $={...N,completionsOnType:Y,initial:false};return $};const Ok=t=>t;const Hk=t=>t;const Nk=(t,n)=>{g(t);g(n);di(t,n)};const zk=(t,n,e)=>`.Editor {\n --EditorRowHeight: ${t}px;\n --ScrollBarHeight: ${n}px;\n --ScrollBarTop: ${e}px;\n}\n.Editor .EditorRow {\n height: var(--EditorRowHeight);\n line-height: var(--EditorRowHeight);\n}\n.Editor .ScrollBarThumbVertical {\n height: var(--ScrollBarHeight);\n translate: 0px var(--ScrollBarTop);\n}\n`;const Yk=(t,n)=>{const{deltaY:e,finalDeltaY:o,height:s,rowHeight:c,scrollBarHeight:r,uid:i}=n;const a=Vr(e,o,s,r);const d=zk(c,r,a);return[eo,i,d]};const $k=(t,n)=>{const e=".EditorInput textarea";return[no,n.uid,e]};const Uk=(t,n)=>[oo,n.uid,co];const _k=1;const Vk=2;const jk=3;const qk=4;const Gk=6;const Xk=7;const Zk=8;const Qk=9;const Kk=10;const Jk=11;const tS=t=>t!=="type"&&t!=="childCount";const nS=t=>{const n=Object.keys(t).filter(tS);return n};const eS=t=>{const n=[];let e=0;while(e<t.length){const o=t[e];const{children:s,nodesConsumed:c}=oS(t,e+1,o.childCount||0);n.push({node:o,children:s});e+=1+c}return n};const oS=(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}=oS(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 sS=(t,n)=>{if(t.type!==n.type){return null}const e=[];if(t.type===jn){if(t.uid!==n.uid){e.push({type:Jk,uid:n.uid})}return e}if(t.type===Vn&&n.type===Vn){if(t.text!==n.text){e.push({type:_k,value:n.text})}return e}const o=nS(t);const s=nS(n);for(const o of s){if(t[o]!==n[o]){e.push({type:jk,key:o,value:n[o]})}}for(const t of o){if(!Object.hasOwn(n,t)){e.push({type:qk,key:t})}}return e};const cS=t=>{const n=[t.node];for(const e of t.children){n.push(...cS(e))}return n};const rS=(t,n,e)=>{if(n===-1){t.push({type:Xk,index:e});return e}if(n!==e){t.push({type:Kk,index:e})}return e};const iS=(t,n)=>{if(n>=0){t.push({type:Zk})}return-1};const aS=(t,n)=>{n.push({type:Gk,nodes:cS(t)})};const dS=(t,n)=>{n.push({type:Vk,nodes:cS(t)})};const lS=(t,n,e,o,s)=>{const c=sS(t.node,n.node);if(c===null){const t=rS(e,o,s);dS(n,e);return t}const r=t.children.length>0||n.children.length>0;if(c.length===0&&!r){return o}const i=rS(e,o,s);if(c.length>0){e.push(...c)}if(r){fS(t.children,n.children,e)}return i};const uS=(t,n,e)=>{const o=sS(t.node,n.node);if(o===null){dS(n,e);return}if(o.length>0){e.push(...o)}if(t.children.length>0||n.children.length>0){fS(t.children,n.children,e)}};const fS=(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=iS(e,s);aS(i,e);continue}if(!i){c.push(r);continue}s=lS(o,i,e,s,r)}iS(e,s);for(let t=c.length-1;t>=0;t--){e.push({type:Qk,index:c[t]})}};const hS=(t,n,e,o)=>{if(o.length===0&&t.length===1&&n.length===1){uS(t[0],n[0],e);return}fS(t,n,e)};const gS=t=>{let n=-1;for(let e=t.length-1;e>=0;e--){const o=t[e];if(o.type!==Xk&&o.type!==Zk&&o.type!==Kk){n=e;break}}return n===-1?[]:t.slice(0,n+1)};const mS=(t,n)=>{const e=eS(t);const o=eS(n);const s=[];hS(e,o,s,[]);return gS(s)};const wS=()=>[{childCount:1,className:"EditorInput",type:dE},{ariaAutoComplete:"list",ariaMultiLine:"true",ariaRoleDescription:"editor",autocapitalize:"off",autocomplete:"off",autocorrect:"off",childCount:0,name:"editor",onBeforeInput:zx,onBlur:Yx,onCompositionEnd:Ux,onCompositionStart:_x,onCompositionUpdate:Vx,onCut:qx,onFocus:Gx,onPaste:Qx,role:"textbox",spellcheck:false,type:hE,wrap:"off"}];const pS=t=>{const n=Array.from(t,t=>({childCount:0,className:bx,translate:t,type:dE}));return n};const yS=t=>{const n=pS([...t]);return[{childCount:t.length,className:"LayerCursor",type:dE},...n]};const xS="error";const ES="warning";const IS=t=>{switch(t){case xS:return Ix;case ES:return kx;default:return Ix}};const kS=(...t)=>t.filter(Boolean).join(" ");const SS=t=>{const{height:n,type:e,width:o,x:s,y:c}=t;const r=IS(e);return[{childCount:0,className:kS(vx,r),height:n,left:s,top:c,type:dE,width:o}]};const CS=t=>{const n=t.flatMap(SS);return n};const vS=t=>{const n=CS([...t]);return[{childCount:t.length,className:"LayerDiagnostics",type:dE},...n]};const bS=(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=Mx;if(e===o){i+=" "+Lx}s.push({childCount:c.length/2,className:i,translate:bi(r),type:dE});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:uE},gE(n))}}return s};const MS=(t,n,e=true,o=-1)=>{const s=bS(t,n,e,o);return[{childCount:t.length,className:"EditorRows",onMouseDown:Xx,onPointerDown:Kx,onWheel:aE,type:dE},...s]};const LS=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:Ax,height:r,left:o,top:s,type:dE,width:c})}return n};const AS=t=>{const n=LS(t);return[{childCount:t.length/4,className:"Selections",type:dE},...n]};const PS=(t,n,e,o=true,s=-1,c=[],r=[])=>[{childCount:4,className:"EditorLayers",type:dE},...AS(t),...MS(n,e,o,s),...yS(c),...vS(r)];const FS=t=>[{childCount:t.length,className:"EditorScrollBarDiagnostics",type:dE},...CS([...t])];const WS=(t,n,e,o)=>{const s=Vr(t,n,e,o);return[{childCount:1,className:"ScrollBar ScrollBarVertical",onContextMenu:jx,onPointerDown:cE,type:dE},{childCount:0,className:"ScrollBarThumb ScrollBarThumbVertical",style:`height:${o}px;`,translate:`0 ${s}px`,type:dE},{childCount:1,className:"ScrollBar ScrollBarHorizontal",onPointerDown:eE,type:dE},{childCount:0,className:"ScrollBarThumb ScrollBarThumbHorizontal",type:dE}]};const TS=({cursorInfos:t=[],deltaY:n=0,diagnostics:e=[],differences:o,finalDeltaY:s=0,height:c=0,highlightedLine:r=-1,lineNumbers:i=true,scrollBarDiagnostics:a=[],scrollBarHeight:d=0,selectionInfos:l=[],textInfos:u})=>[{childCount:5,className:"EditorContent",onMouseMove:Zx,type:dE},...wS(),...PS(l,u,o,i,r,t,e),...FS(a),...WS(n,s,c,d)];const RS=t=>[{childCount:1,className:"LineNumber",type:uE},gE(t)];const DS=t=>{const n=t.flatMap(RS);return n};const BS=t=>{const n=DS([...t]);return[{childCount:t.length,className:"Gutter",type:dE},...n]};const OS=({cursorInfos:t=[],deltaY:n=0,diagnostics:e=[],differences:o,finalDeltaY:s=0,gutterInfos:c=[],height:r=0,highlightedLine:i=-1,lineNumbers:a=true,scrollBarDiagnostics:d=[],scrollBarHeight:l=0,selectionInfos:u=[],textInfos:f})=>{const h=a?BS(c):[];return[{childCount:a?2:1,className:"Viewlet Editor",onContextMenu:jx,role:"code",type:dE},...h,...TS({cursorInfos:t,deltaY:n,diagnostics:e,differences:o,finalDeltaY:s,height:r,highlightedLine:i,lineNumbers:a,scrollBarDiagnostics:d,scrollBarHeight:l,selectionInfos:u,textInfos:f})]};const HS=new Map;const NS=t=>HS.get(t);const zS=(t,n)=>{HS.set(t,n)};const YS=t=>{const{initial:n,textInfos:e}=t;if(n&&e.length===0){return[]}return OS(t)};const $S=(t,n)=>Math.abs(n.minLineY-t.minLineY)>1;const US=(t,n)=>{const e=t.initial?YS(t):NS(n.uid)||YS(t);const o=YS(n);if($S(t,n)){zS(n.uid,o);return[so,n.uid,[{nodes:o,type:6}]]}const s=mS(e,o);if(s.length===0){return[]}zS(n.uid,o);return[so,n.uid,s]};const _S=t=>{switch(t){case Ra:return Yk;case Wa:return $k;case Ta:return Uk;case Da:return US;default:throw new Error("unknown renderer")}};const VS=(t,n,e)=>{const o=[];for(const s of e){const e=_S(s);const c=e(t,n);if(c.length>0){o.push(c)}}return o};const jS=(t,n)=>{const{newState:e,oldState:o}=Ko(t);ts(t,e,e);const s=VS(o,e,n);return s};const qS=t=>{const n=Ps(t.id);if(!n){throw new Error("unsupported widget")}return n.add(t)};const GS=t=>{const n=Ps(t.id);if(!n){throw new Error("unsupported widget")}return n.render(t)};const XS=t=>{const n=Ps(t.id);if(!n){throw new Error("unsupported widget")}return n.remove(t)};const ZS={apply(t,n){const{incrementalEdits:e}=n;if(e!==ns){return["setIncrementalEdits",e]}const{differences:o,textInfos:s}=n;n.differences=o;const{highlightedLine:c,minLineY:r}=n;const i=c-r;const a=bS(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 QS={apply:(t,n)=>{const{cursorInfos:e=[],selectionInfos:o=[]}=n;const s=pS(e);const c=LS(o);return["setSelections",s,c]},isEqual:(t,n)=>t.cursorInfos===n.cursorInfos&&t.selectionInfos===n.selectionInfos};const KS={apply(t,n){const e=Vr(n.deltaY,n.finalDeltaY,n.height,n.scrollBarHeight);const o=`0 ${e}px`;const s=`${n.scrollBarHeight}px`;return["setScrollBar",o,s]},isEqual:(t,n)=>t.deltaY===n.deltaY&&t.scrollBarHeight===n.scrollBarHeight};const JS={apply(t,n){const e=jr(n.width,n.longestLineWidth,n.minimumSliderSize);const o=n.deltaX/n.longestLineWidth*n.width;return["setScrollBarHorizontal",o,e,n.deltaX]},isEqual:(t,n)=>t.longestLineWidth===n.longestLineWidth&&t.deltaX===n.deltaX};const tC={apply:(t,n)=>["setFocused",n.focused],isEqual:(t,n)=>t.focused===n.focused};const nC={apply:(t,n)=>[oo,n.uid,n.focus,0,n.uid,"Editor"],isEqual:(t,n)=>t.focus===n.focus};const eC={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 oC={apply(t,n){const e=CS(n.visualDecorations||[]);return["setDecorationsDom",e]},isEqual:(t,n)=>t.visualDecorations===n.visualDecorations};const sC={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=DS(c);return["renderGutter",r]},isEqual:(t,n)=>t.lineNumbers===n.lineNumbers&&t.minLineY===n.minLineY&&t.maxLineY===n.maxLineY};const cC={apply(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=qS(t);if(n.length>0){d.push(...n)}}const l=[];for(const t of o){const n=GS(t);if(n.length>0){l.push(...n)}}const u=[];for(const t of s){const n=XS(t);if(n.length>0){u.push(...n)}}const f=[...d,...l,...u];const h=f.filter(t=>t[0]!=="Viewlet.setFocusContext");return h},isEqual:(t,n)=>t.widgets===n.widgets,multiple:true};const rC=[ZS,QS,JS,KS,tC,oC,sC,cC,nC,eC];const iC=async t=>{const n=Ko(t);if(!n){return[]}const{newState:e,oldState:o}=n;const s=[];ts(t,e,e);for(const t of rC){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 aC=()=>[{name:Gx,params:["handleFocus"]},{name:Zx,params:["handleMouseMove",Xn,Zn,qn]},{name:Yx,params:["handleBlur"]},{name:zx,params:["handleBeforeInput","event.inputType","event.data"],preventDefault:true},{name:_x,params:["compositionStart","event.data"]},{name:Vx,params:["compositionUpdate","event.data"]},{name:Ux,params:["compositionEnd","event.data"]},{name:qx,params:["cut"],preventDefault:true},{name:Qx,params:["paste",'event.clipboardData ? event.clipboardData.getData("text/plain") : ""'],preventDefault:true},{name:Xx,params:["handleMouseDown","event.button","event.altKey","event.ctrlKey",Xn,Zn,"event.detail"]},{name:Kx,params:["handlePointerDown","event.button","event.altKey","event.ctrlKey",Xn,Zn,"event.detail"],trackPointerEvents:[Jx,tE]},{name:Jx,params:["handlePointerMove",Xn,Zn,qn]},{name:tE,params:["handlePointerUp"]},{name:aE,params:["handleWheel",Qn,"event.deltaX",Kn],passive:true},{name:jx,params:["handleContextMenu",Gn,Xn,Zn],preventDefault:true},{name:cE,params:["handleScrollBarVerticalPointerDown",Zn],preventDefault:true,trackPointerEvents:[rE,iE]},{name:rE,params:["handleScrollBarVerticalPointerMove",Zn]},{name:iE,params:["handlePointerUp"]},{name:eE,params:["handleScrollBarHorizontalPointerDown",Xn],trackPointerEvents:[oE,sE]},{name:oE,params:["handleScrollBarHorizontalMove",Xn]},{name:sE,params:["handlePointerUp"]}];const dC=(t,n)=>{const{lines:e}=t;return{lines:e}};const lC=async(t,n,e)=>{await vo(t,e)};const uC=async(t,n)=>{await Po(t,n)};const fC=(t,n)=>t;const hC=(t,n)=>{g(t);g(n);li(t,n)};const gC=async(t,...n)=>{const e=$n(qe);return e.invoke(t,...n)};const mC=async t=>{const n=await gC("RunAndDebug.getHighlight",t);return n};const wC=()=>{const t=Jo();return parseInt(t[0])};const pC=async t=>{const n=await mC(t);const e=wC();const o=Ko(e);if(!o){return}const{newState:s,oldState:c}=o;const r={...s,highlightedLine:n.rowIndex};ts(e,c,r);await yo("Editor.rerender",e)};const yC=t=>async(n,...e)=>{const o=Ko(n);const s=o.newState;const c=await t(s,...e);if(s===c){return c}const r=await fg(s,c);ts(n,s,r);return r};const xC={"ActivateByEvent.activateByEvent":No,"CodeGenerator.accept":zo,"ColorPicker.loadContent":qo,"Editor.addCursorAbove":yC(Ya),"Editor.addCursorBelow":yC(Ua),"Editor.applyDocumentEdits":yC(qa),"Editor.applyEdit":yC(Ga),"Editor.applyEdit2":WI,"Editor.applyWorkspaceEdit":yC(Za),"Editor.braceCompletion":yC(wd),"Editor.cancelSelection":yC(pd),"Editor.closeCodeGenerator":yC(Id),"Editor.closeFind":yC(Sd),"Editor.closeFind2":FI,"Editor.closeRename":yC(Ad),"Editor.closeSourceAction":yC(Fd),"Editor.closeWidget2":PI,"Editor.compositionEnd":yC($d),"Editor.compositionStart":yC(Nd),"Editor.compositionUpdate":yC(Yd),"Editor.contextMenu":yC(Ph),"Editor.copy":yC(jd),"Editor.copyLineDown":yC(qd),"Editor.copyLineUp":yC(Gd),"Editor.create":La,"Editor.create2":ls,"Editor.cursorCharacterLeft":yC(zl),"Editor.cursorCharacterRight":yC(Vl),"Editor.cursorDown":yC(Gl),"Editor.cursorEnd":yC(Xl),"Editor.cursorHome":yC(Zl),"Editor.cursorLeft":yC(zl),"Editor.cursorRight":yC(Vl),"Editor.cursorSet":yC(Ql),"Editor.cursorUp":yC(nu),"Editor.cursorWordLeft":yC(eu),"Editor.cursorWordPartLeft":yC(ou),"Editor.cursorWordPartRight":yC(su),"Editor.cursorWordRight":yC(cu),"Editor.cut":yC(au),"Editor.deleteAll":yC(du),"Editor.deleteAllLeft":yC(mu),"Editor.deleteAllRight":yC(yu),"Editor.deleteCharacterLeft":yC(xu),"Editor.deleteCharacterRight":yC(Eu),"Editor.deleteHorizontalRight":yC(pu),"Editor.deleteLeft":yC(xu),"Editor.deleteRight":yC(Eu),"Editor.deleteWordLeft":yC(Iu),"Editor.deleteWordPartLeft":yC(ku),"Editor.deleteWordPartRight":yC(Su),"Editor.deleteWordRight":yC(Cu),"Editor.diff2":Na,"Editor.executeWidgetCommand":yC(tI),"Editor.findAllReferences":yC(vu),"Editor.format":yC(Pu),"Editor.getCommandIds":Xo,"Editor.getDiagnostics":RI,"Editor.getKeyBindings":BI,"Editor.getKeys":OI,"Editor.getLanguageId":kI,"Editor.getLines2":MI,"Editor.getMenuEntries":YI,"Editor.getMenuEntries2":YI,"Editor.getMenuIds":$I,"Editor.getOffsetAtCursor":SI,"Editor.getPositionAtCursor":EI,"Editor.getProblems":_I,"Editor.getQuickPickMenuEntries":VI,"Editor.getSelections":jI,"Editor.getSelections2":LI,"Editor.getSourceActions":TI,"Editor.getText":qI,"Editor.getUri":II,"Editor.getWordAt":Du,"Editor.getWordAt2":CI,"Editor.getWordAtOffset2":vI,"Editor.getWordBefore":Bu,"Editor.getWordBefore2":bI,"Editor.goToDefinition":yC(dh),"Editor.goToTypeDefinition":yC(mh),"Editor.handleBeforeInput":yC(XI),"Editor.handleBeforeInputFromContentEditable":yC(og),"Editor.handleBlur":yC(Qa),"Editor.handleClickAtPosition":yC(Lh),"Editor.handleContextMenu":yC(Ph),"Editor.handleDoubleClick":yC(Dh),"Editor.handleFocus":yC(Bh),"Editor.handleMouseDown":yC(Vh),"Editor.handleMouseMove":yC(Kh),"Editor.handleMouseMoveWithAltKey":yC(tg),"Editor.handleNativeSelectionChange":sg,"Editor.handlePointerCaptureLost":yC(cg),"Editor.handlePointerDown":yC(rg),"Editor.handlePointerMove":yC(vg),"Editor.handlePointerUp":yC(bg),"Editor.handleScrollBarClick":Tg,"Editor.handleScrollBarHorizontalMove":yC(Lg),"Editor.handleScrollBarHorizontalPointerDown":yC(Ag),"Editor.handleScrollBarMove":yC(Fg),"Editor.handleScrollBarPointerDown":yC(Tg),"Editor.handleScrollBarVerticalMove":yC(Wg),"Editor.handleScrollBarVerticalPointerDown":yC(Tg),"Editor.handleScrollBarVerticalPointerMove":yC(Wg),"Editor.handleSingleClick":yC(zh),"Editor.handleTab":yC(KI),"Editor.handleTouchEnd":yC(Rg),"Editor.handleTouchMove":yC(zg),"Editor.handleTouchStart":yC(Bg),"Editor.handleTripleClick":yC(Uh),"Editor.handleWheel":yC(Yg),"Editor.hotReload":sk,"Editor.indendLess":yC(Ug),"Editor.indentMore":yC(Vg),"Editor.insertLineBreak":yC(Zg),"Editor.loadContent":yC(Bk),"Editor.moveLineDown":yC(Ok),"Editor.moveLineUp":yC(Hk),"Editor.moveRectangleSelection":yC(ig),"Editor.moveRectangleSelectionPx":yC(ag),"Editor.moveSelection":yC(Ig),"Editor.moveSelectionPx":yC(Cg),"Editor.offsetAt":Fr,"Editor.openCodeGenerator":yC(nm),"Editor.openColorPicker":yC(Od),"Editor.openCompletion":yC(rm),"Editor.openFind":yC(pm),"Editor.openFind2":yC(wm),"Editor.openRename":yC(Im),"Editor.organizeImports":yC(Sm),"Editor.paste":yC(vm),"Editor.pasteText":yC(Cm),"Editor.redo":yC(bm),"Editor.render":iC,"Editor.render2":jS,"Editor.renderEventListeners":aC,"Editor.replaceRange":yC(Ka),"Editor.rerender":yC(TE),"Editor.save":yC($m),"Editor.saveState":Qo(dC),"Editor.selectAll":yC(Um),"Editor.selectAllLeft":yC(jm),"Editor.selectAllOccurrences":yC(ow),"Editor.selectAllRight":yC(rw),"Editor.selectCharacterLeft":yC(iw),"Editor.selectCharacterRight":yC(aw),"Editor.selectDown":yC(lw),"Editor.selectInsideString":yC(fw),"Editor.selectionGrow":yC(gw),"Editor.selectLine":yC($h),"Editor.selectNextOccurrence":yC(yw),"Editor.selectPreviousOccurrence":yC(xw),"Editor.selectUp":yC(Iw),"Editor.selectWord":yC(Rh),"Editor.selectWordLeft":yC(kw),"Editor.selectWordRight":yC(Sw),"Editor.setDebugEnabled":yC(fC),"Editor.setDecorations":yC(Cw),"Editor.setDelta":yC(Ng),"Editor.setDeltaY":yC(Og),"Editor.setLanguageId":yC(vw),"Editor.setSelections":yC(bw),"Editor.setSelections2":AI,"Editor.setText":yC(Mw),"Editor.showHover":Bw,"Editor.showHover2":Rw,"Editor.showSourceActions":Uw,"Editor.showSourceActions2":Uw,"Editor.showSourceActions3":Uw,"Editor.sortLinesAscending":yC(Gw),"Editor.tabCompletion":yC(np),"Editor.terminate":e,"Editor.toggleBlockComment":yC(ap),"Editor.toggleComment":yC(hp),"Editor.toggleLineComment":yC(fp),"Editor.type":yC(gp),"Editor.typeWithAutoClosing":yC(Wp),"Editor.undo":yC(Rp),"Editor.unIndent":yC(Dp),"Editor.updateDebugInfo":pC,"Editor.updateDiagnostics":yC(Ma),"EditorCompletion.close":sy,"EditorCompletion.closeDetails":cy,"EditorCompletion.focusFirst":ry,"EditorCompletion.focusIndex":iy,"EditorCompletion.focusNext":dy,"EditorCompletion.focusPrevious":ly,"EditorCompletion.handleEditorBlur":uy,"EditorCompletion.handleEditorClick":fy,"EditorCompletion.handleEditorDeleteLeft":hy,"EditorCompletion.handleEditorType":gy,"EditorCompletion.handlePointerDown":my,"EditorCompletion.handleWheel":wy,"EditorCompletion.openDetails":py,"EditorCompletion.selectCurrent":yy,"EditorCompletion.selectIndex":xy,"EditorCompletion.toggleDetails":Ey,"EditorRename.accept":AE,"EditorRename.close":PE,"EditorRename.handleInput":FE,"EditorSourceAction.close":YE,"EditorSourceAction.closeDetails":$E,"EditorSourceAction.focusFirst":UE,"EditorSourceAction.focusIndex":_E,"EditorSourceAction.focusNext":jE,"EditorSourceAction.focusPrevious":qE,"EditorSourceAction.handleWheel":GE,"EditorSourceAction.selectCurrent":XE,"EditorSourceAction.selectIndex":ZE,"EditorSourceAction.selectItem":QE,"EditorSourceAction.toggleDetails":KE,"EditorSourceActions.focusNext":DE,"ExtensionHostManagement.activateByEvent":No,"FindWidget.close":My,"FindWidget.focusCloseButton":Ly,"FindWidget.focusFind":Ay,"FindWidget.focusNext":Py,"FindWidget.focusNextElement":Fy,"FindWidget.focusNextMatchButton":Wy,"FindWidget.focusPrevious":Ty,"FindWidget.focusPreviousElement":Ry,"FindWidget.focusPreviousMatchButton":Dy,"FindWidget.focusReplace":By,"FindWidget.focusReplaceAllButton":Oy,"FindWidget.focusReplaceButton":Hy,"FindWidget.focusToggleReplace":Ny,"FindWidget.handleBlur":zy,"FindWidget.handleClickButton":Yy,"FindWidget.handleFocus":$y,"FindWidget.handleInput":Uy,"FindWidget.handleReplaceFocus":_y,"FindWidget.handleReplaceInput":Vy,"FindWidget.handleToggleReplaceFocus":jy,"FindWidget.loadContent":gm,"FindWidget.replace":qy,"FindWidget.replaceAll":Gy,"FindWidget.toggleMatchCase":Xy,"FindWidget.toggleMatchWholeWord":Zy,"FindWidget.togglePreserveCase":Qy,"FindWidget.toggleReplace":Ky,"FindWidget.toggleUseRegularExpression":Jy,"Font.ensure":DI,"HandleMessagePort.handleMessagePort":ZI,"Hover.getHoverInfo":hx,"Hover.handleSashPointerDown":mx,"Hover.handleSashPointerMove":wx,"Hover.handleSashPointerUp":px,"Hover.loadContent":gx,"Hover.render":CE,"Initialize.initialize":dk,"Listener.register":Nk,"Listener.registerListener":di,"Listener.unregister":hC,"SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker":lC,"SendMessagePortToExtensionManagementWorker.sendMessagePortToExtensionManagementWorker":uC};for(const[t,n]of Object.entries(xC)){if(t.startsWith("Editor.")){xC["EditorText"+t.slice("Editor".length)]=n}}const EC=async()=>{const t="HandleMessagePort.handleMessagePort2";const n=await Bn({commandMap:{},async send(n){await lC(n,t,Ge)}});return n};const IC=async()=>{const t=await EC();aa(t)};const kC=async()=>{const t=await Bn({commandMap:{},async send(t){await Po(t,Ge)}});return t};const SC=async()=>{try{const t=await kC();uo(t)}catch{}};const CC=t=>ko(t);const vC=async()=>{const t=await Bn({commandMap:{},send:CC});go(t)};const bC=async()=>{const t=await Hn({commandMap:xC});Eo(t)};const MC=t=>Ao(t);const LC=async()=>{const t=await Bn({commandMap:{},send:MC});po(t)};const AC=async()=>{Zo(xC);await Promise.all([bC(),IC(),SC(),LC(),vC()])};const PC="CodeGeneratorInput";const FC=t=>{const n=Af();const e=Pf();return[{childCount:2,className:kS(Nx,Ex),type:dE},{childCount:0,className:kS(yx,Ox),name:PC,placeholder:e,type:lE},{childCount:1,className:xx,type:dE},gE(n)]};const WC={apply(t,n){const e=FC();return[Qp,n.uid,e]},isEqual:(t,n)=>t.questions===n.questions};const TC={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[Gp,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height};const RC={apply:(t,n)=>[Up,".CodeGeneratorInput",n.focusSource],isEqual:(t,n)=>t.focused===n.focused&&t.focusSource===n.focusSource};const DC=[WC,TC,RC];const BC=(t,n)=>{const e=[];for(const o of DC){if(!o.isEqual(t,n)){e.push(o.apply(t,n))}}return e};const OC=t=>{const n=BC(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(t[0]===Qp){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const HC=t=>Op(t,"EditorCodeGenerator",OC);const NC=BE;const zC={__proto__:null,add:HC,remove:NC,render:OC};const YC=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const $C=[Qp,Zp,$p,Xp,_p,Kp];const UC=t=>{const n=YC(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if($C.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const _C=t=>Op(t,"ColorPicker",UC);const VC=BE;const jC={};const qC={__proto__:null,Commands:jC,add:_C,remove:VC,render:UC};const GC=t=>{const n=[{childCount:2,className:"Viewlet EditorCompletionDetails",type:dE},{childCount:1,className:Cx,type:dE},gE(t),{childCount:1,className:Sx,onClick:$x,type:dE},{childCount:0,className:`${Hx} ${Bx}`,type:dE}];return n};const XC=(t,n,e)=>{const o=[];for(const s of t){if(!s.isEqual(n,e)){o.push(s.apply(n,e))}}return o};const ZC={apply(t,n){const e=GC(n.content);return[Qp,n.uid,e]},isEqual:(t,n)=>t.content===n.content};const QC={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[Gp,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height};const KC=[ZC,QC];const JC=(t,n)=>XC(KC,t,n);const tv=(t,n)=>{const{widgets:e}=t;for(const t of e){if(t.id===n){return t.newState}}return undefined};const nv=t=>tv(t,Te);const ev=t=>{const n=JC(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(t[0]===Qp){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const ov=t=>Op(t,"EditorCompletionDetails",ev);const sv=BE;const cv=(t,n)=>{const e=nv(t);if(!e){return t}const{x:o}=ym(t);const s=o+e.width-n.borderSize;return{...n,x:s}};const rv=(t,n)=>cv(t,n);const iv=(t,n)=>cv(t,n);const av={__proto__:null,add:ov,handleEditorDeleteLeft:iv,handleEditorType:rv,remove:sv,render:ev};const dv=[Qp,Zp,$p,Xp,_p,Vp,jp,qp,Kp,"Viewlet.focusSelector"];const lv=t=>{const n=Jp(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(dv.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const uv=t=>Op(t,"EditorCompletion",lv);const fv=t=>[["Viewlet.dispose",t.newState.uid]];const{close:hv}=Yp(["close"],"",Be);const gv={__proto__:null,add:uv,close:hv,remove:fv,render:lv};const mv=()=>{As(We,qC);As(Te,Iy);As(Re,av);As(De,tx);As(Be,gv);As(Oe,WE);As(He,JE);As(Fe,zC)};const wv=t=>{t.preventDefault();console.error(`[editor-worker] Unhandled Rejection: ${t.reason}`)};const pv=(t,n,e,o,s)=>{console.error(`[editor-worker] Unhandled Error: ${s}`);return true};const yv=t=>{t.addEventListener("error",pv);t.addEventListener("unhandledrejection",wv)};const xv=async()=>{yv(globalThis);await AC();mv()};xv();