@agent-spaces/server 0.3.65 → 0.3.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/agent-runtime.js +4 -0
- package/dist/adapters/codex-function-tool-bridge.js +144 -0
- package/dist/adapters/codex-runtime.js +23 -4
- package/dist/adapters/git.js +12 -1
- package/dist/adapters/hermes-runtime.js +210 -0
- package/dist/agents/issue-task-controller.js +69 -2
- package/dist/agents/pull-request-agent.js +115 -0
- package/dist/agents/scheduler-agent.js +1 -1
- package/dist/app.js +6 -2
- package/dist/middleware/auth.js +1 -1
- package/dist/package.json +2 -1
- package/dist/routes/agent-sse.js +1 -0
- package/dist/routes/issue.js +1 -1
- package/dist/routes/notification.js +10 -0
- package/dist/routes/version.js +94 -0
- package/dist/routes/worktree.js +93 -0
- package/dist/services/agent.js +1 -1
- package/dist/services/notification-center.js +9 -0
- package/dist/services/version.js +59 -0
- package/dist/services/workflow-command-runner.js +23 -0
- package/dist/services/workflow.js +25 -8
- package/dist/services/workspace.js +23 -1
- package/dist/services/worktree.js +207 -0
- package/dist/storage/worktree-store.js +33 -0
- package/dist/web/404.html +1 -1
- package/dist/web/__next.__PAGE__.txt +4 -4
- package/dist/web/__next._full.txt +21 -21
- package/dist/web/__next._head.txt +4 -4
- package/dist/web/__next._index.txt +13 -13
- package/dist/web/__next._tree.txt +2 -2
- package/dist/web/_next/static/chunks/{08x85faoz58i7.js → 0-92u-tiuy40a.js} +4 -4
- package/dist/web/_next/static/chunks/{0db14450oqzhg.js → 0-yizd8osmas2.js} +1 -1
- package/dist/web/_next/static/chunks/0.ln~3mnv8.69.js +1 -0
- package/dist/web/_next/static/chunks/{11cchuwoupmbf.js → 01y3e9pemva7b.js} +10 -10
- package/dist/web/_next/static/chunks/02l~tmzrgny.~.js +1 -0
- package/dist/web/_next/static/chunks/03f1bwuynjdmk.js +1 -0
- package/dist/web/_next/static/chunks/04cb4kc9r2pd1.js +1 -0
- package/dist/web/_next/static/chunks/04de6ha5_e3pp.js +1 -0
- package/dist/web/_next/static/chunks/09he0p79ov1rn.js +1 -0
- package/dist/web/_next/static/chunks/09vpocs4zuc8h.js +1 -0
- package/dist/web/_next/static/chunks/0_o2exgr0e_nh.js +1 -0
- package/dist/web/_next/static/chunks/{0xbaakj0dfc0..js → 0_y9nskc-xt2k.js} +1 -1
- package/dist/web/_next/static/chunks/0clnj-1fi6u8j.js +3 -0
- package/dist/web/_next/static/chunks/0gv40by0zzxs_.js +1 -0
- package/dist/web/_next/static/chunks/0iusr8y88.kjg.js +1 -0
- package/dist/web/_next/static/chunks/{0-a.-hl3wv99k.js → 0j-8418fxvkd1.js} +1 -1
- package/dist/web/_next/static/chunks/0j.wxxyoclma5.js +1 -0
- package/dist/web/_next/static/chunks/{0.6b64sy0g5.3.js → 0jq.16sozqik..js} +1 -1
- package/dist/web/_next/static/chunks/0jw8xdk_fpnp0.css +1 -0
- package/dist/web/_next/static/chunks/0l1lkd-wcotma.js +1 -0
- package/dist/web/_next/static/chunks/{0u6h-hqc_i52e.js → 0ncxf_zr4n839.js} +1 -1
- package/dist/web/_next/static/chunks/0ndo7um~v7vco.js +1 -0
- package/dist/web/_next/static/chunks/0ngk.~kan8wq_.js +1 -0
- package/dist/web/_next/static/chunks/0ppr271hz0xoq.js +1 -0
- package/dist/web/_next/static/chunks/0rt9bofnn6qvn.js +1 -0
- package/dist/web/_next/static/chunks/0t64.9jd00hio.js +3 -0
- package/dist/web/_next/static/chunks/0taui9--5n6-5.js +1 -0
- package/dist/web/_next/static/chunks/0ty39169lh~z3.js +1 -0
- package/dist/web/_next/static/chunks/0v8nof~waedlu.js +1 -0
- package/dist/web/_next/static/chunks/{0-pi.67w.ymsr.js → 0vcfoagnpf.aw.js} +1 -1
- package/dist/web/_next/static/chunks/{0vis~lx0nxgn-.js → 0wwwq.gyyz0vg.js} +3 -3
- package/dist/web/_next/static/chunks/0x5lak8yz7pm7.js +1 -0
- package/dist/web/_next/static/chunks/0xon_.4-o0_zq.js +7 -0
- package/dist/web/_next/static/chunks/0zjnrbt7inime.js +1 -0
- package/dist/web/_next/static/chunks/0zwebpitvpuv1.js +1 -0
- package/dist/web/_next/static/chunks/0~02o4g-o6n~m.js +1 -0
- package/dist/web/_next/static/chunks/{0w7.tb29958zj.js → 0~fjezp.k4qk3.js} +1 -1
- package/dist/web/_next/static/chunks/0~sh93re1-_rp.js +1 -0
- package/dist/web/_next/static/chunks/10_niiq0k6o-p.js +5 -0
- package/dist/web/_next/static/chunks/12tjr0_2ccrtq.js +2 -0
- package/dist/web/_next/static/chunks/12x5.go_x9mfk.js +1 -0
- package/dist/web/_next/static/chunks/{0l2w0qz1ea7ql.js → 12~5dk9i9d16t.js} +2 -2
- package/dist/web/_next/static/chunks/13iye4rv5p31b.js +1 -0
- package/dist/web/_next/static/chunks/{01~quun6sefgl.js → 13~y-b.b9rrw4.js} +1 -1
- package/dist/web/_next/static/chunks/151wzhb5q0lo5.js +1 -0
- package/dist/web/_not-found/__next._full.txt +19 -19
- package/dist/web/_not-found/__next._head.txt +4 -4
- package/dist/web/_not-found/__next._index.txt +13 -13
- package/dist/web/_not-found/__next._not-found.__PAGE__.txt +2 -2
- package/dist/web/_not-found/__next._not-found.txt +3 -3
- package/dist/web/_not-found/__next._tree.txt +2 -2
- package/dist/web/_not-found.html +1 -1
- package/dist/web/_not-found.txt +19 -19
- package/dist/web/index.html +1 -1
- package/dist/web/index.txt +21 -21
- package/dist/web/login/__next._full.txt +21 -21
- package/dist/web/login/__next._head.txt +4 -4
- package/dist/web/login/__next._index.txt +13 -13
- package/dist/web/login/__next._tree.txt +2 -2
- package/dist/web/login/__next.login.__PAGE__.txt +4 -4
- package/dist/web/login/__next.login.txt +3 -3
- package/dist/web/login.html +1 -1
- package/dist/web/login.txt +21 -21
- package/dist/web/settings/__next._full.txt +23 -23
- package/dist/web/settings/__next._head.txt +4 -4
- package/dist/web/settings/__next._index.txt +13 -13
- package/dist/web/settings/__next._tree.txt +2 -2
- package/dist/web/settings/__next.settings.__PAGE__.txt +4 -4
- package/dist/web/settings/__next.settings.txt +5 -5
- package/dist/web/settings/agents/__next._full.txt +23 -23
- package/dist/web/settings/agents/__next._head.txt +4 -4
- package/dist/web/settings/agents/__next._index.txt +13 -13
- package/dist/web/settings/agents/__next._tree.txt +2 -2
- package/dist/web/settings/agents/__next.settings.agents.__PAGE__.txt +4 -4
- package/dist/web/settings/agents/__next.settings.agents.txt +3 -3
- package/dist/web/settings/agents/__next.settings.txt +5 -5
- package/dist/web/settings/agents.html +1 -1
- package/dist/web/settings/agents.txt +23 -23
- package/dist/web/settings/mcps/__next._full.txt +23 -23
- package/dist/web/settings/mcps/__next._head.txt +4 -4
- package/dist/web/settings/mcps/__next._index.txt +13 -13
- package/dist/web/settings/mcps/__next._tree.txt +2 -2
- package/dist/web/settings/mcps/__next.settings.mcps.__PAGE__.txt +4 -4
- package/dist/web/settings/mcps/__next.settings.mcps.txt +3 -3
- package/dist/web/settings/mcps/__next.settings.txt +5 -5
- package/dist/web/settings/mcps.html +1 -1
- package/dist/web/settings/mcps.txt +23 -23
- package/dist/web/settings/models/__next._full.txt +23 -23
- package/dist/web/settings/models/__next._head.txt +4 -4
- package/dist/web/settings/models/__next._index.txt +13 -13
- package/dist/web/settings/models/__next._tree.txt +2 -2
- package/dist/web/settings/models/__next.settings.models.__PAGE__.txt +4 -4
- package/dist/web/settings/models/__next.settings.models.txt +3 -3
- package/dist/web/settings/models/__next.settings.txt +5 -5
- package/dist/web/settings/models.html +1 -1
- package/dist/web/settings/models.txt +23 -23
- package/dist/web/settings/output-styles/__next._full.txt +23 -23
- package/dist/web/settings/output-styles/__next._head.txt +4 -4
- package/dist/web/settings/output-styles/__next._index.txt +13 -13
- package/dist/web/settings/output-styles/__next._tree.txt +2 -2
- package/dist/web/settings/output-styles/__next.settings.output-styles.__PAGE__.txt +4 -4
- package/dist/web/settings/output-styles/__next.settings.output-styles.txt +3 -3
- package/dist/web/settings/output-styles/__next.settings.txt +5 -5
- package/dist/web/settings/output-styles.html +1 -1
- package/dist/web/settings/output-styles.txt +23 -23
- package/dist/web/settings/prompts/__next._full.txt +23 -23
- package/dist/web/settings/prompts/__next._head.txt +4 -4
- package/dist/web/settings/prompts/__next._index.txt +13 -13
- package/dist/web/settings/prompts/__next._tree.txt +2 -2
- package/dist/web/settings/prompts/__next.settings.prompts.__PAGE__.txt +4 -4
- package/dist/web/settings/prompts/__next.settings.prompts.txt +3 -3
- package/dist/web/settings/prompts/__next.settings.txt +5 -5
- package/dist/web/settings/prompts.html +1 -1
- package/dist/web/settings/prompts.txt +23 -23
- package/dist/web/settings/providers/__next._full.txt +23 -23
- package/dist/web/settings/providers/__next._head.txt +4 -4
- package/dist/web/settings/providers/__next._index.txt +13 -13
- package/dist/web/settings/providers/__next._tree.txt +2 -2
- package/dist/web/settings/providers/__next.settings.providers.__PAGE__.txt +4 -4
- package/dist/web/settings/providers/__next.settings.providers.txt +3 -3
- package/dist/web/settings/providers/__next.settings.txt +5 -5
- package/dist/web/settings/providers.html +1 -1
- package/dist/web/settings/providers.txt +23 -23
- package/dist/web/settings/skills/__next._full.txt +23 -23
- package/dist/web/settings/skills/__next._head.txt +4 -4
- package/dist/web/settings/skills/__next._index.txt +13 -13
- package/dist/web/settings/skills/__next._tree.txt +2 -2
- package/dist/web/settings/skills/__next.settings.skills.__PAGE__.txt +4 -4
- package/dist/web/settings/skills/__next.settings.skills.txt +3 -3
- package/dist/web/settings/skills/__next.settings.txt +5 -5
- package/dist/web/settings/skills.html +1 -1
- package/dist/web/settings/skills.txt +23 -23
- package/dist/web/settings/tools/__next._full.txt +23 -23
- package/dist/web/settings/tools/__next._head.txt +4 -4
- package/dist/web/settings/tools/__next._index.txt +13 -13
- package/dist/web/settings/tools/__next._tree.txt +2 -2
- package/dist/web/settings/tools/__next.settings.tools.__PAGE__.txt +4 -4
- package/dist/web/settings/tools/__next.settings.tools.txt +3 -3
- package/dist/web/settings/tools/__next.settings.txt +5 -5
- package/dist/web/settings/tools.html +1 -1
- package/dist/web/settings/tools.txt +23 -23
- package/dist/web/settings.html +1 -1
- package/dist/web/settings.txt +23 -23
- package/dist/web/workflows/__next._full.txt +22 -22
- package/dist/web/workflows/__next._head.txt +4 -4
- package/dist/web/workflows/__next._index.txt +13 -13
- package/dist/web/workflows/__next._tree.txt +2 -2
- package/dist/web/workflows/__next.workflows.__PAGE__.txt +4 -4
- package/dist/web/workflows/__next.workflows.txt +3 -3
- package/dist/web/workflows.html +1 -1
- package/dist/web/workflows.txt +22 -22
- package/dist/web/workspace/_/__next._full.txt +20 -20
- package/dist/web/workspace/_/__next._head.txt +4 -4
- package/dist/web/workspace/_/__next._index.txt +13 -13
- package/dist/web/workspace/_/__next._tree.txt +2 -2
- package/dist/web/workspace/_/__next.workspace.$d$id.__PAGE__.txt +3 -3
- package/dist/web/workspace/_/__next.workspace.$d$id.txt +3 -3
- package/dist/web/workspace/_/__next.workspace.txt +3 -3
- package/dist/web/workspace/_.html +1 -1
- package/dist/web/workspace/_.txt +20 -20
- package/dist/web/workspaces/__next._full.txt +21 -21
- package/dist/web/workspaces/__next._head.txt +4 -4
- package/dist/web/workspaces/__next._index.txt +13 -13
- package/dist/web/workspaces/__next._tree.txt +2 -2
- package/dist/web/workspaces/__next.workspaces.__PAGE__.txt +4 -4
- package/dist/web/workspaces/__next.workspaces.txt +3 -3
- package/dist/web/workspaces.html +1 -1
- package/dist/web/workspaces.txt +21 -21
- package/dist/ws/agent-prompt.js +32 -3
- package/dist/ws/agent-runner.js +1 -0
- package/package.json +2 -1
- package/dist/web/_next/static/chunks/0-v_p6j5u3_9l.js +0 -1
- package/dist/web/_next/static/chunks/0.-x29t-8gk0r.js +0 -1
- package/dist/web/_next/static/chunks/0.l5e8~r7_0~p.js +0 -1
- package/dist/web/_next/static/chunks/0.n~yfwf4~6w-.js +0 -1
- package/dist/web/_next/static/chunks/00-syqzi-6zxr.js +0 -1
- package/dist/web/_next/static/chunks/02j4sr9psucf-.js +0 -1
- package/dist/web/_next/static/chunks/06si8l0doqe8p.js +0 -1
- package/dist/web/_next/static/chunks/08kfx8on9oty~.js +0 -1
- package/dist/web/_next/static/chunks/08ugbvzr20drp.js +0 -2
- package/dist/web/_next/static/chunks/0_cqojbge48kq.js +0 -5
- package/dist/web/_next/static/chunks/0d6~~lv0-6kex.js +0 -3
- package/dist/web/_next/static/chunks/0gdwop9cnpmtu.js +0 -1
- package/dist/web/_next/static/chunks/0ghx3j_.-gdyd.js +0 -1
- package/dist/web/_next/static/chunks/0kbvoxla7f751.js +0 -1
- package/dist/web/_next/static/chunks/0paaat8y96ayc.js +0 -7
- package/dist/web/_next/static/chunks/0pq318f8xgafg.js +0 -1
- package/dist/web/_next/static/chunks/0t6s8of0qr6nc.js +0 -1
- package/dist/web/_next/static/chunks/0xt-8wk21gs7g.js +0 -1
- package/dist/web/_next/static/chunks/0yd.m1afqg.2t.js +0 -3
- package/dist/web/_next/static/chunks/0yhbr8hl09b-5.js +0 -1
- package/dist/web/_next/static/chunks/0z~vqzbm_q371.js +0 -1
- package/dist/web/_next/static/chunks/0~~_ltu6dx_ch.js +0 -1
- package/dist/web/_next/static/chunks/12oxcgyhpaxw~.js +0 -1
- package/dist/web/_next/static/chunks/1452eibz62gs6.css +0 -1
- package/dist/web/_next/static/chunks/16zlreiems5cn.js +0 -1
- package/dist/web/_next/static/chunks/18awqjk9-o5m0.js +0 -1
- /package/dist/web/_next/static/{x4-CsKe6qUQyFDWVtfvUg → rGXyAK8rgod1NjF3bLZAY}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{x4-CsKe6qUQyFDWVtfvUg → rGXyAK8rgod1NjF3bLZAY}/_clientMiddlewareManifest.js +0 -0
- /package/dist/web/_next/static/{x4-CsKe6qUQyFDWVtfvUg → rGXyAK8rgod1NjF3bLZAY}/_ssgManifest.js +0 -0
|
@@ -63,9 +63,9 @@ ${JSON.stringify(e,null,4)}`),L.string(e.id)||L.number(e.id)){let t=e.id,i=I.get
|
|
|
63
63
|
|
|
64
64
|
`:"No parameters provided.\n\n"),f.log(`Sending notification '${n.method}'.`,e)}else ea("send-notification",n);return t.write(n).catch(e=>{throw w.error("Sending notification failed."),e})},onNotification:(e,t)=>{let i;return el(),L.func(e)?S=e:t&&(L.string(e)?(i=e,T.set(e,{type:void 0,handler:t})):(i=e.method,T.set(e.method,{type:e,handler:t}))),{dispose:()=>{void 0!==i?T.delete(i):S=void 0}}},onProgress:(e,t,i)=>{if(R.has(t))throw Error(`Progress handler for token ${t} already registered`);return R.set(t,i),{dispose:()=>{R.delete(t)}}},sendProgress:(e,t,i)=>ep.sendNotification(n.type,{token:t,value:i}),onUnhandledProgress:B.event,sendRequest:(e,...i)=>{let r,o,n,s;if(el(),!X())throw Error("Call listen() first.");if(L.string(e)){r=e;let t=i[0],n=i[i.length-1],a=0,l=F.ParameterStructures.auto;F.ParameterStructures.is(t)&&(a=1,l=t);let c=i.length;$.CancellationToken.is(n)&&(c-=1,s=n);let d=c-a;switch(d){case 0:o=void 0;break;case 1:o=eh(l,i[a]);break;default:if(l===F.ParameterStructures.byName)throw Error(`Received ${d} parameters for 'by Name' request parameter structure.`);o=i.slice(a,c).map(e=>ec(e))}}else{r=e.method,o=eg(e,i);let t=e.numberOfParams;s=$.CancellationToken.is(i[t])?i[t]:void 0}let l=x++;s&&(n=s.onCancellationRequested(()=>{let e=Q.sender.sendCancellation(ep,l);return void 0===e?(w.log(`Received no promise from cancellation strategy when cancelling id ${l}`),Promise.resolve()):e.catch(()=>{w.log(`Sending cancellation messages for id ${l} failed`)})}));let d={jsonrpc:"2.0",id:l,method:r,params:o};if(W!==a.Off&&f)if(q===c.Text){let e;(W===a.Verbose||W===a.Compact)&&d.params&&(e=`Params: ${eo(d.params)}
|
|
65
65
|
|
|
66
|
-
`),f.log(`Sending request '${d.method} - (${d.id})'.`,e)}else ea("send-request",d);return"function"==typeof Q.sender.enableCancellation&&Q.sender.enableCancellation(d),new Promise(async(e,i)=>{let o={method:r,timerStart:Date.now(),resolve:t=>{e(t),Q.sender.cleanup(l),n?.dispose()},reject:e=>{i(e),Q.sender.cleanup(l),n?.dispose()}};try{I.set(l,o),await t.write(d)}catch(e){throw I.delete(l),o.reject(new F.ResponseError(F.ErrorCodes.MessageWriteError,e.message?e.message:"Unknown reason")),w.error("Sending request failed."),e}})},onRequest:(e,t)=>{el();let i=null;return s.is(e)?(i=void 0,_=e):L.string(e)?(i=null,void 0!==t&&(i=e,k.set(e,{handler:t,type:void 0}))):void 0!==t&&(i=e.method,k.set(e.method,{type:e,handler:t})),{dispose:()=>{null!==i&&(void 0!==i?k.delete(i):_=void 0)}}},hasPendingResponse:()=>I.size>0,trace:async(e,t,i)=>{let r=!1,o=c.Text;void 0!==i&&(L.boolean(i)?r=i:(r=i.sendNotification||!1,o=i.traceFormat||c.Text)),W=e,q=o,f=W===a.Off?void 0:t,!r||Z()||ee()||await ep.sendNotification(d.type,{value:a.toString(e)})},onError:z.event,onClose:K.event,onUnhandledNotification:V.event,onDispose:G.event,end:()=>{t.end()},dispose:()=>{if(ee())return;j=b.Disposed,G.fire(void 0);let i=new F.ResponseError(F.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let e of I.values())e.reject(i);I=new Map,U=new Map,A=new Set,P=new O.LinkedMap,L.func(t.dispose)&&t.dispose(),L.func(e.dispose)&&e.dispose()},listen:()=>{if(el(),X())throw new H(h.AlreadyListening,"Connection is already listening");j=b.Listening,e.listen(er)},inspect:()=>{(0,M.default)().console.log("inspect")}};return ep.onNotification(u.type,e=>{if(W===a.Off||!f)return;let t=W===a.Verbose||W===a.Compact;f.log(e.message,t?e.verbose:void 0)}),ep.onNotification(n.type,e=>{let t=R.get(e.token);t?t(e.value):B.fire(e)}),ep}},412392,(e,t,i)=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.ProgressType=i.ProgressToken=i.createMessageConnection=i.NullLogger=i.ConnectionOptions=i.ConnectionStrategy=i.AbstractMessageBuffer=i.WriteableStreamMessageWriter=i.AbstractMessageWriter=i.MessageWriter=i.ReadableStreamMessageReader=i.AbstractMessageReader=i.MessageReader=i.SharedArrayReceiverStrategy=i.SharedArraySenderStrategy=i.CancellationToken=i.CancellationTokenSource=i.Emitter=i.Event=i.Disposable=i.LRUCache=i.Touch=i.LinkedMap=i.ParameterStructures=i.NotificationType9=i.NotificationType8=i.NotificationType7=i.NotificationType6=i.NotificationType5=i.NotificationType4=i.NotificationType3=i.NotificationType2=i.NotificationType1=i.NotificationType0=i.NotificationType=i.ErrorCodes=i.ResponseError=i.RequestType9=i.RequestType8=i.RequestType7=i.RequestType6=i.RequestType5=i.RequestType4=i.RequestType3=i.RequestType2=i.RequestType1=i.RequestType0=i.RequestType=i.Message=i.RAL=void 0,i.MessageStrategy=i.CancellationStrategy=i.CancellationSenderStrategy=i.CancellationReceiverStrategy=i.ConnectionError=i.ConnectionErrors=i.LogTraceNotification=i.SetTraceNotification=i.TraceFormat=i.TraceValues=i.Trace=void 0;let r=e.r(257425);Object.defineProperty(i,"Message",{enumerable:!0,get:function(){return r.Message}}),Object.defineProperty(i,"RequestType",{enumerable:!0,get:function(){return r.RequestType}}),Object.defineProperty(i,"RequestType0",{enumerable:!0,get:function(){return r.RequestType0}}),Object.defineProperty(i,"RequestType1",{enumerable:!0,get:function(){return r.RequestType1}}),Object.defineProperty(i,"RequestType2",{enumerable:!0,get:function(){return r.RequestType2}}),Object.defineProperty(i,"RequestType3",{enumerable:!0,get:function(){return r.RequestType3}}),Object.defineProperty(i,"RequestType4",{enumerable:!0,get:function(){return r.RequestType4}}),Object.defineProperty(i,"RequestType5",{enumerable:!0,get:function(){return r.RequestType5}}),Object.defineProperty(i,"RequestType6",{enumerable:!0,get:function(){return r.RequestType6}}),Object.defineProperty(i,"RequestType7",{enumerable:!0,get:function(){return r.RequestType7}}),Object.defineProperty(i,"RequestType8",{enumerable:!0,get:function(){return r.RequestType8}}),Object.defineProperty(i,"RequestType9",{enumerable:!0,get:function(){return r.RequestType9}}),Object.defineProperty(i,"ResponseError",{enumerable:!0,get:function(){return r.ResponseError}}),Object.defineProperty(i,"ErrorCodes",{enumerable:!0,get:function(){return r.ErrorCodes}}),Object.defineProperty(i,"NotificationType",{enumerable:!0,get:function(){return r.NotificationType}}),Object.defineProperty(i,"NotificationType0",{enumerable:!0,get:function(){return r.NotificationType0}}),Object.defineProperty(i,"NotificationType1",{enumerable:!0,get:function(){return r.NotificationType1}}),Object.defineProperty(i,"NotificationType2",{enumerable:!0,get:function(){return r.NotificationType2}}),Object.defineProperty(i,"NotificationType3",{enumerable:!0,get:function(){return r.NotificationType3}}),Object.defineProperty(i,"NotificationType4",{enumerable:!0,get:function(){return r.NotificationType4}}),Object.defineProperty(i,"NotificationType5",{enumerable:!0,get:function(){return r.NotificationType5}}),Object.defineProperty(i,"NotificationType6",{enumerable:!0,get:function(){return r.NotificationType6}}),Object.defineProperty(i,"NotificationType7",{enumerable:!0,get:function(){return r.NotificationType7}}),Object.defineProperty(i,"NotificationType8",{enumerable:!0,get:function(){return r.NotificationType8}}),Object.defineProperty(i,"NotificationType9",{enumerable:!0,get:function(){return r.NotificationType9}}),Object.defineProperty(i,"ParameterStructures",{enumerable:!0,get:function(){return r.ParameterStructures}});let o=e.r(869991);Object.defineProperty(i,"LinkedMap",{enumerable:!0,get:function(){return o.LinkedMap}}),Object.defineProperty(i,"LRUCache",{enumerable:!0,get:function(){return o.LRUCache}}),Object.defineProperty(i,"Touch",{enumerable:!0,get:function(){return o.Touch}});let n=e.r(763636);Object.defineProperty(i,"Disposable",{enumerable:!0,get:function(){return n.Disposable}});let s=e.r(907260);Object.defineProperty(i,"Event",{enumerable:!0,get:function(){return s.Event}}),Object.defineProperty(i,"Emitter",{enumerable:!0,get:function(){return s.Emitter}});let a=e.r(686787);Object.defineProperty(i,"CancellationTokenSource",{enumerable:!0,get:function(){return a.CancellationTokenSource}}),Object.defineProperty(i,"CancellationToken",{enumerable:!0,get:function(){return a.CancellationToken}});let l=e.r(593876);Object.defineProperty(i,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return l.SharedArraySenderStrategy}}),Object.defineProperty(i,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return l.SharedArrayReceiverStrategy}});let c=e.r(57485);Object.defineProperty(i,"MessageReader",{enumerable:!0,get:function(){return c.MessageReader}}),Object.defineProperty(i,"AbstractMessageReader",{enumerable:!0,get:function(){return c.AbstractMessageReader}}),Object.defineProperty(i,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return c.ReadableStreamMessageReader}});let d=e.r(34572);Object.defineProperty(i,"MessageWriter",{enumerable:!0,get:function(){return d.MessageWriter}}),Object.defineProperty(i,"AbstractMessageWriter",{enumerable:!0,get:function(){return d.AbstractMessageWriter}}),Object.defineProperty(i,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return d.WriteableStreamMessageWriter}});let u=e.r(454166);Object.defineProperty(i,"AbstractMessageBuffer",{enumerable:!0,get:function(){return u.AbstractMessageBuffer}});let h=e.r(971320);Object.defineProperty(i,"ConnectionStrategy",{enumerable:!0,get:function(){return h.ConnectionStrategy}}),Object.defineProperty(i,"ConnectionOptions",{enumerable:!0,get:function(){return h.ConnectionOptions}}),Object.defineProperty(i,"NullLogger",{enumerable:!0,get:function(){return h.NullLogger}}),Object.defineProperty(i,"createMessageConnection",{enumerable:!0,get:function(){return h.createMessageConnection}}),Object.defineProperty(i,"ProgressToken",{enumerable:!0,get:function(){return h.ProgressToken}}),Object.defineProperty(i,"ProgressType",{enumerable:!0,get:function(){return h.ProgressType}}),Object.defineProperty(i,"Trace",{enumerable:!0,get:function(){return h.Trace}}),Object.defineProperty(i,"TraceValues",{enumerable:!0,get:function(){return h.TraceValues}}),Object.defineProperty(i,"TraceFormat",{enumerable:!0,get:function(){return h.TraceFormat}}),Object.defineProperty(i,"SetTraceNotification",{enumerable:!0,get:function(){return h.SetTraceNotification}}),Object.defineProperty(i,"LogTraceNotification",{enumerable:!0,get:function(){return h.LogTraceNotification}}),Object.defineProperty(i,"ConnectionErrors",{enumerable:!0,get:function(){return h.ConnectionErrors}}),Object.defineProperty(i,"ConnectionError",{enumerable:!0,get:function(){return h.ConnectionError}}),Object.defineProperty(i,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return h.CancellationReceiverStrategy}}),Object.defineProperty(i,"CancellationSenderStrategy",{enumerable:!0,get:function(){return h.CancellationSenderStrategy}}),Object.defineProperty(i,"CancellationStrategy",{enumerable:!0,get:function(){return h.CancellationStrategy}}),Object.defineProperty(i,"MessageStrategy",{enumerable:!0,get:function(){return h.MessageStrategy}}),i.RAL=e.r(540958).default},592944,(e,t,i)=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0});let r=e.r(412392);class o extends r.AbstractMessageBuffer{constructor(e="utf-8"){super(e),this.asciiDecoder=new TextDecoder("ascii")}emptyBuffer(){return o.emptyBuffer}fromString(e,t){return new TextEncoder().encode(e)}toString(e,t){return"ascii"===t?this.asciiDecoder.decode(e):new TextDecoder(t).decode(e)}asNative(e,t){return void 0===t?e:e.slice(0,t)}allocNative(e){return new Uint8Array(e)}}o.emptyBuffer=new Uint8Array(0);class n{constructor(e){this.socket=e,this._onData=new r.Emitter,this._messageListener=e=>{e.data.arrayBuffer().then(e=>{this._onData.fire(new Uint8Array(e))},()=>{(0,r.RAL)().console.error("Converting blob to array buffer failed.")})},this.socket.addEventListener("message",this._messageListener)}onClose(e){return this.socket.addEventListener("close",e),r.Disposable.create(()=>this.socket.removeEventListener("close",e))}onError(e){return this.socket.addEventListener("error",e),r.Disposable.create(()=>this.socket.removeEventListener("error",e))}onEnd(e){return this.socket.addEventListener("end",e),r.Disposable.create(()=>this.socket.removeEventListener("end",e))}onData(e){return this._onData.event(e)}}class s{constructor(e){this.socket=e}onClose(e){return this.socket.addEventListener("close",e),r.Disposable.create(()=>this.socket.removeEventListener("close",e))}onError(e){return this.socket.addEventListener("error",e),r.Disposable.create(()=>this.socket.removeEventListener("error",e))}onEnd(e){return this.socket.addEventListener("end",e),r.Disposable.create(()=>this.socket.removeEventListener("end",e))}write(e,t){if("string"==typeof e){if(void 0!==t&&"utf-8"!==t)throw Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${t}`);this.socket.send(e)}else this.socket.send(e);return Promise.resolve()}end(){this.socket.close()}}let a=new TextEncoder,l=Object.freeze({messageBuffer:Object.freeze({create:e=>new o(e)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(e,t)=>{if("utf-8"!==t.charset)throw Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${t.charset}`);return Promise.resolve(a.encode(JSON.stringify(e,void 0,0)))}}),decoder:Object.freeze({name:"application/json",decode:(e,t)=>{if(!(e instanceof Uint8Array))throw Error("In a Browser environments only Uint8Arrays are supported.");return Promise.resolve(JSON.parse(new TextDecoder(t.charset).decode(e)))}})}),stream:Object.freeze({asReadableStream:e=>new n(e),asWritableStream:e=>new s(e)}),console:console,timer:Object.freeze({setTimeout(e,t,...i){let r=setTimeout(e,t,...i);return{dispose:()=>clearTimeout(r)}},setImmediate(e,...t){let i=setTimeout(e,0,...t);return{dispose:()=>clearTimeout(i)}},setInterval(e,t,...i){let r=setInterval(e,t,...i);return{dispose:()=>clearInterval(r)}}})});function c(){return l}(c||(c={})).install=function(){r.RAL.install(l)},i.default=c},269213,(e,t,i)=>{"use strict";var r=e.e&&e.e.__createBinding||(Object.create?function(e,t,i,r){void 0===r&&(r=i);var o=Object.getOwnPropertyDescriptor(t,i);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,r,o)}:function(e,t,i,r){void 0===r&&(r=i),e[r]=t[i]}),o=e.e&&e.e.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(i,"__esModule",{value:!0}),i.createMessageConnection=i.BrowserMessageWriter=i.BrowserMessageReader=void 0,e.r(592944).default.install();let n=e.r(412392);o(e.r(412392),i);class s extends n.AbstractMessageReader{constructor(e){super(),this._onData=new n.Emitter,this._messageListener=e=>{this._onData.fire(e.data)},e.addEventListener("error",e=>this.fireError(e)),e.onmessage=this._messageListener}listen(e){return this._onData.event(e)}}i.BrowserMessageReader=s;class a extends n.AbstractMessageWriter{constructor(e){super(),this.port=e,this.errorCount=0,e.addEventListener("error",e=>this.fireError(e))}write(e){try{return this.port.postMessage(e),Promise.resolve()}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){}}i.BrowserMessageWriter=a,i.createMessageConnection=function(e,t,i,r){return void 0===i&&(i=n.NullLogger),n.ConnectionStrategy.is(r)&&(r={connectionStrategy:r}),(0,n.createMessageConnection)(e,t,i,r)}},611219,e=>{"use strict";let t,i,r,o;var n,s,a,l,c,d,u,h,g,p,m,f,_,y,C,S,b,w,x,D,E,k,T,R,P,I,A,M,L,F,O,N,$,H,U=e.i(344180),W=e.i(887836),q=e.i(764556);e.i(462506);let j=new Map;function z(e,t){if(t.workspaceRoot){let i=t.workspaceRoot.replace(/\/+$/,"");if(e.startsWith(`${i}/`))return decodeURIComponent(e.slice(i.length+1))}for(let i of[`/workspace/${t.workspaceId}/`,`/${t.workspaceId}/`])if(e.startsWith(i))return decodeURIComponent(e.slice(i.length));return null}var K=e.i(60293),V=e.i(360112);let B=[{id:"copyPosition",label:"复制代码位置",contextMenuGroupId:"9_cutcopypaste",contextMenuOrder:10,run:(e,t)=>{let i=e.getModel(),r=e.getSelection();if(!i||!r)return;let o=z(i.uri.path,t),n=`${o||i.uri.path}:${r.startLineNumber}:${r.endLineNumber}`;navigator.clipboard.writeText(n).then(()=>{V.toast.success(`已复制: ${n}`)})}},{id:"addToFavorites",label:"添加到代码收藏",contextMenuGroupId:"9_cutcopypaste",contextMenuOrder:11,run:(e,t)=>{let i=e.getModel(),r=e.getSelection();if(!i||!r)return;let o=r.startLineNumber,n=r.startColumn,s=r.endLineNumber,a=r.endColumn,l=z(i.uri.path,t);if(!l)return;let c={startLineNumber:o,startColumn:1,endLineNumber:s,endColumn:i.getLineMaxColumn(s)},d=i.getValueInRange(c).trim();d.length>300&&(d=d.slice(0,300)+"\n…");let u=l.split("/").pop()||l,h=s>o?`${o}-${s}`:`${o}`;K.useCodeFavoritesStore.getState().setPendingFavorite({workspaceId:t.workspaceId,path:l,line:o,column:n,endLine:s,endColumn:a,label:`${u}:${h}`,snippet:d})}}];for(let e of B)j.set(e.id,e);e.i(340642);var G=e.i(564822),Q=e.i(691223),J=e.i(972846),Y=e.i(194228);let X=(0,e.i(433721).default)("pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);var Z=e.i(720247),ee=e.i(775712),et=e.i(67013),ei=e.i(361031),er=e.i(940361),eo=e.i(209988),en=e.i(260218),es=e.i(244073),ea=e.i(359209),el=e.i(465458);let ec=({transform:e})=>({...e,y:0});function ed({file:e,isActive:t,boundDirs:i,commitDiffs:r,onClose:o,onClick:n,onCopy:s,onRevealInFinder:a,onSetRevealPath:l,onTogglePin:c,onCloseOthers:d,onCloseLeft:u,onCloseRight:h,t:g}){let{attributes:p,listeners:m,setNodeRef:f,transform:_,transition:y,isDragging:C}=(0,ee.useSortable)({id:e.path}),S={transform:et.CSS.Transform.toString(_),transition:y};return(0,U.jsxs)(er.ContextMenu,{children:[(0,U.jsx)(er.ContextMenuTrigger,{children:(0,U.jsxs)("div",{ref:f,style:S,...p,...m,className:(0,el.cn)("flex items-center gap-1 px-3 py-1.5 text-xs border-r cursor-grab shrink-0 select-none",t?"bg-background text-foreground border-b-2 border-b-primary":"text-muted-foreground hover:bg-accent",C&&"opacity-50 shadow-lg z-10",e.pinned&&"border-l-2 border-l-primary/60"),onClick:n,children:[e.pinned&&(0,U.jsx)(X,{size:10,className:"text-primary/70 shrink-0 -ml-1 mr-0.5"}),(0,Q.isCommitDiffPath)(e.path)?(0,U.jsx)(Y.GitCommitHorizontal,{size:14,className:"text-blue-500 shrink-0"}):(0,U.jsx)(ea.FileIconImg,{name:e.name}),e.modified&&!e.pinned&&(0,U.jsx)("span",{className:"size-1.5 rounded-full bg-orange-400 shrink-0"}),(0,U.jsx)("span",{className:"truncate max-w-32",children:(0,Q.isCommitDiffPath)(e.path)&&r[(0,Q.getCommitHashFromPath)(e.path)]?.message?.split("\n")[0]?.slice(0,30)||e.name}),(0,U.jsx)("button",{className:"ml-1 hover:bg-accent rounded p-0.5 cursor-pointer",onClick:t=>o(t,e),children:(0,U.jsx)(J.X,{className:"size-3"})})]})}),(0,U.jsxs)(er.ContextMenuContent,{children:[(0,U.jsx)(er.ContextMenuItem,{onClick:()=>l(e.path),children:g("revealInTree")}),(0,U.jsx)(er.ContextMenuItem,{onClick:()=>a(e.path),children:g("revealInFinder")}),(0,U.jsx)(er.ContextMenuSeparator,{}),(0,U.jsx)(er.ContextMenuItem,{onClick:()=>{var t;return s((t=e.path,0===i.length?t:i[0].replace(/\/+$/,"")+"/"+t))},children:g("copyFilePath")}),(0,U.jsx)(er.ContextMenuItem,{onClick:()=>s(e.path),children:g("copyRelativePath")}),(0,U.jsx)(er.ContextMenuSeparator,{}),(0,U.jsx)(er.ContextMenuItem,{onClick:()=>c(e.path),children:g(e.pinned?"unpin":"pin")}),(0,U.jsx)(er.ContextMenuItem,{onClick:()=>d(e.path),children:g("closeOthers")}),(0,U.jsx)(er.ContextMenuItem,{onClick:()=>u(e.path),children:g("closeLeft")}),(0,U.jsx)(er.ContextMenuItem,{onClick:()=>h(e.path),children:g("closeRight")})]})]})}function eu({workspaceId:e}){let{openFiles:t,activeFilePath:i,setActiveFile:r,closeFile:o,saveFile:n,setRevealPath:s,commitDiffs:a,togglePin:l,reorderFiles:c,closeOthers:d,closeToLeft:u,closeToRight:h}=(0,Q.useEditorStore)(),g=(0,ei.useWorkspaceStore)(e=>e.workspaces).find(t=>t.id===e),p=g?.boundDirs??[],m=(0,es.useTranslations)("editor"),[f,_]=(0,q.useState)(null),y=(0,Z.useSensors)((0,Z.useSensor)(Z.PointerSensor,{activationConstraint:{distance:5}}),(0,Z.useSensor)(Z.KeyboardSensor)),C=async e=>{await navigator.clipboard.writeText(e),V.toast.success(m("copied"))},S=t=>{fetch(`/api/workspaces/${e}/files/reveal?path=${encodeURIComponent(t)}`,{method:"POST"})},b=(t,i)=>{t.stopPropagation(),i.modified?_(i):o(e,i.path)},w=async()=>{f&&(await n(e,f.path),o(e,f.path),_(null))},x=(0,q.useCallback)(t=>{let{active:i,over:r}=t;if(!r||i.id===r.id)return;let o=Q.useEditorStore.getState().openFiles,n=o.findIndex(e=>e.path===String(i.id)),s=o.findIndex(e=>e.path===String(r.id));if(-1===n||-1===s)return;let a=(0,ee.arrayMove)(o,n,s),l=a.findIndex(e=>e.path===String(i.id)),d=a[l],u=l>0&&a[l-1].pinned,h=!u&&l<a.length-1&&a[l+1].pinned;d&&(a[l]={...d,pinned:u||h}),c(e,[...a.filter(e=>e.pinned),...a.filter(e=>!e.pinned)])},[e,c]);return 0===t.length?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Z.DndContext,{sensors:y,collisionDetection:Z.closestCenter,modifiers:[ec],onDragEnd:x,children:(0,U.jsx)(ee.SortableContext,{items:t.map(e=>e.path),strategy:ee.horizontalListSortingStrategy,children:(0,U.jsx)("div",{className:"flex items-center border-b bg-muted/30 overflow-x-auto",children:t.map(t=>(0,U.jsx)(ed,{file:t,isActive:t.path===i,boundDirs:p,commitDiffs:a,onClose:b,onClick:()=>r(e,t.path),onCopy:C,onRevealInFinder:S,onSetRevealPath:s,onTogglePin:t=>l(e,t),onCloseOthers:t=>d(e,t),onCloseLeft:t=>u(e,t),onCloseRight:t=>h(e,t),t:e=>m(e)},t.path))})})}),(0,U.jsx)(eo.Dialog,{open:!!f,onOpenChange:e=>!e&&_(null),children:(0,U.jsxs)(eo.DialogContent,{children:[(0,U.jsxs)(eo.DialogHeader,{children:[(0,U.jsx)(eo.DialogTitle,{children:m("saveChangesTitle")}),(0,U.jsx)(eo.DialogDescription,{children:m("saveChangesDesc",{name:f?.name??""})})]}),(0,U.jsxs)(eo.DialogFooter,{children:[(0,U.jsx)(en.Button,{variant:"outline",onClick:()=>_(null),children:m("cancel")}),(0,U.jsx)(en.Button,{variant:"destructive",onClick:()=>{f&&(o(e,f.path),_(null))},children:m("discardChanges")}),(0,U.jsx)(en.Button,{onClick:w,children:m("save")})]})]})})]})}var eh=e.i(917955);function eg({editorRef:e,workspaceId:t,isReadOnly:i,onToggleReadOnly:r,isFullscreen:o,onToggleFullscreen:n,wordWrap:s,onToggleWordWrap:a,minimap:l,onToggleMinimap:c,fontSize:d,onZoomIn:u,onZoomOut:h,onZoomReset:g}){let{saveFile:p,activeFilePath:m}=(0,Q.useEditorStore)(),f=(0,es.useTranslations)("editor"),_=t=>{requestAnimationFrame(()=>{let i=e.current;i&&(i.focus(),i.getAction(t)?.run())})};return(0,U.jsxs)("div",{className:"flex items-center h-7 border-b bg-background shrink-0",children:[(0,U.jsxs)(eh.DropdownMenu,{children:[(0,U.jsx)(eh.DropdownMenuTrigger,{className:"px-3 h-full text-xs hover:bg-accent outline-none cursor-default",children:f("menuFile")}),(0,U.jsx)(eh.DropdownMenuContent,{align:"start",sideOffset:0,children:(0,U.jsxs)(eh.DropdownMenuItem,{onClick:()=>m&&p(t,m),children:[f("menuSave"),(0,U.jsx)(eh.DropdownMenuShortcut,{children:"⌘S"})]})})]}),(0,U.jsxs)(eh.DropdownMenu,{children:[(0,U.jsx)(eh.DropdownMenuTrigger,{className:"px-3 h-full text-xs hover:bg-accent outline-none cursor-default",children:f("menuEdit")}),(0,U.jsxs)(eh.DropdownMenuContent,{align:"start",sideOffset:0,children:[(0,U.jsxs)(eh.DropdownMenuItem,{onClick:()=>_("undo"),children:[f("menuUndo"),(0,U.jsx)(eh.DropdownMenuShortcut,{children:"⌘Z"})]}),(0,U.jsxs)(eh.DropdownMenuItem,{onClick:()=>_("redo"),children:[f("menuRedo"),(0,U.jsx)(eh.DropdownMenuShortcut,{children:"⇧⌘Z"})]}),(0,U.jsx)(eh.DropdownMenuSeparator,{}),(0,U.jsxs)(eh.DropdownMenuItem,{onClick:()=>_("editor.action.clipboardCutAction"),children:[f("menuCut"),(0,U.jsx)(eh.DropdownMenuShortcut,{children:"⌘X"})]}),(0,U.jsxs)(eh.DropdownMenuItem,{onClick:()=>_("editor.action.clipboardCopyAction"),children:[f("menuCopy"),(0,U.jsx)(eh.DropdownMenuShortcut,{children:"⌘C"})]}),(0,U.jsxs)(eh.DropdownMenuItem,{onClick:()=>_("editor.action.clipboardPasteAction"),children:[f("menuPaste"),(0,U.jsx)(eh.DropdownMenuShortcut,{children:"⌘V"})]}),(0,U.jsx)(eh.DropdownMenuSeparator,{}),(0,U.jsxs)(eh.DropdownMenuItem,{onClick:()=>_("actions.find"),children:[f("menuFind"),(0,U.jsx)(eh.DropdownMenuShortcut,{children:"⌘F"})]}),(0,U.jsxs)(eh.DropdownMenuItem,{disabled:i,onClick:()=>_("editor.action.startFindReplaceAction"),children:[f("menuReplace"),(0,U.jsx)(eh.DropdownMenuShortcut,{children:"⌥⌘F"})]})]})]}),(0,U.jsxs)(eh.DropdownMenu,{children:[(0,U.jsx)(eh.DropdownMenuTrigger,{className:"px-3 h-full text-xs hover:bg-accent outline-none cursor-default",children:f("menuView")}),(0,U.jsxs)(eh.DropdownMenuContent,{align:"start",sideOffset:0,children:[(0,U.jsxs)(eh.DropdownMenuItem,{onClick:n,children:[f(o?"exitFullscreen":"menuFullscreen"),(0,U.jsx)(eh.DropdownMenuShortcut,{children:"⌃⌘F"})]}),(0,U.jsx)(eh.DropdownMenuSeparator,{}),(0,U.jsx)(eh.DropdownMenuItem,{onClick:a,children:f(s?"disableWordWrap":"enableWordWrap")}),(0,U.jsx)(eh.DropdownMenuItem,{onClick:c,children:f(l?"disableMinimap":"enableMinimap")}),(0,U.jsx)(eh.DropdownMenuSeparator,{}),(0,U.jsxs)(eh.DropdownMenuItem,{onClick:u,children:[f("zoomIn"),(0,U.jsx)(eh.DropdownMenuShortcut,{children:"⌘+"})]}),(0,U.jsxs)(eh.DropdownMenuItem,{onClick:h,children:[f("zoomOut"),(0,U.jsx)(eh.DropdownMenuShortcut,{children:"⌘-"})]}),(0,U.jsxs)(eh.DropdownMenuItem,{onClick:g,disabled:13===d,children:[f("zoomReset")," (",d,"px)"]})]})]}),(0,U.jsx)("div",{className:"flex-1"}),(0,U.jsx)("button",{onClick:r,className:"flex items-center gap-1 px-2 h-full text-xs text-muted-foreground hover:text-foreground hover:bg-accent outline-none cursor-default cursor-pointer",title:f(i?"enableEdit":"disableEdit"),children:i?"🔒":"✏️"})]})}var ep=e.i(950396),em=e.i(650654),ef=e.i(992764),ev=e.i(381253),e_=e.i(613812);function ey({diffs:e,message:t}){let[i,r]=(0,q.useState)(new Set);return 0===e.length?(0,U.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"No changes"}):(0,U.jsxs)("div",{className:"h-full overflow-auto",children:[(0,U.jsxs)("div",{className:"text-xs text-muted-foreground px-3 py-1.5 border-b bg-muted/30",children:[t.split("\n")[0]," · ",e.length," file",e.length>1?"s":""]}),e.map(e=>{let t=i.has(e.path);return(0,U.jsxs)("div",{className:"border-b last:border-b-0",children:[(0,U.jsxs)("button",{className:"flex items-center gap-1.5 w-full px-2 py-1 text-xs font-mono hover:bg-accent/50 text-left cursor-pointer",onClick:()=>{var t;return t=e.path,void r(e=>{let i=new Set(e);return i.has(t)?i.delete(t):i.add(t),i})},children:[t?(0,U.jsx)(ef.ChevronRight,{size:13}):(0,U.jsx)(em.ChevronDown,{size:13}),(0,U.jsx)(ev.FileCode,{size:13,className:"text-muted-foreground shrink-0"}),(0,U.jsx)("span",{className:"truncate",children:e.path})]}),!t&&(0,U.jsx)("div",{className:"h-64",children:(0,U.jsx)(e_.DiffViewer,{oldContent:e.oldContent,newContent:e.newContent,path:e.path,isBinary:e.isBinary})})]},e.path)})]})}var eC=e.i(303867),eS=e.i(332277);e.i(836406),e.i(859073),e.i(664195),e.i(347410),e.i(768224),e.i(93151),e.i(158555),e.i(517965),e.i(742150),e.i(500127),e.i(874243),e.i(686882),e.i(127819),e.i(640883),e.i(604257),e.i(869416),e.i(116427),e.i(836354),e.i(473864),e.i(318209),e.i(172781),e.i(250182),e.i(131624),e.i(238015),e.i(534662),e.i(433140),e.i(663159),e.i(119260),e.i(877059),e.i(808e3),e.i(645831),e.i(764894),e.i(551501),e.i(337525),e.i(335283),e.i(615239),e.i(324240),e.i(33999),e.i(745026),e.i(637114),e.i(705067),e.i(948539),e.i(768797),e.i(633666),e.i(405261),e.i(231009),e.i(72895),e.i(862215),e.i(273544),e.i(844168),e.i(843210),e.i(767312),e.i(116013),e.i(735564),e.i(44118),e.i(486172),e.i(321915),e.i(171733),e.i(6838),e.i(45048),e.i(526568),e.i(646675),e.i(426208),e.i(772315),e.i(137475),e.i(504183),e.i(656092),e.i(126391),e.i(925665),e.i(756500);var eb=e.i(680590);class ew{constructor(e,t,i){this._onDidChange=new eb.Emitter,this._languageId=e,this.setOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this.options}get options(){return this._options}setOptions(e){this._options=e||Object.create(null),this._onDidChange.fire(this)}setDiagnosticsOptions(e){this.setOptions(e)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}}let ex={validate:!0,lint:{compatibleVendorPrefixes:"ignore",vendorPrefix:"warning",duplicateProperties:"warning",emptyRules:"warning",importStatement:"ignore",boxModel:"ignore",universalSelector:"ignore",zeroUnits:"ignore",fontFaceProperties:"warning",hexColorLength:"error",argumentsInColorFunction:"error",unknownProperties:"warning",ieHack:"ignore",unknownVendorSpecificProperties:"ignore",propertyIgnoredDueToDisplay:"warning",important:"ignore",float:"ignore",idSelector:"ignore"},data:{useDefaultDataProvider:!0},format:{newlineBetweenSelectors:!0,newlineBetweenRules:!0,spaceAroundSelectorSeparator:!1,braceStyle:"collapse",maxPreserveNewLines:void 0,preserveNewLines:!0}},eD={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0,documentFormattingEdits:!0,documentRangeFormattingEdits:!0},eE=new ew("css",ex,eD),ek=new ew("scss",ex,eD),eT=new ew("less",ex,eD);function eR(){return e.A(771485)}eb.languages.onLanguage("less",()=>{eR().then(e=>e.setupMode(eT))}),eb.languages.onLanguage("scss",()=>{eR().then(e=>e.setupMode(ek))}),eb.languages.onLanguage("css",()=>{eR().then(e=>e.setupMode(eE))}),e.s(["cssDefaults",0,eE,"lessDefaults",0,eT,"scssDefaults",0,ek],312705);var eP=e.i(312705);class eI{constructor(e,t,i){this._onDidChange=new eb.Emitter,this._languageId=e,this.setOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get options(){return this._options}get modeConfiguration(){return this._modeConfiguration}setOptions(e){this._options=e||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}}let eA={format:{tabSize:4,insertSpaces:!1,wrapLineLength:120,unformatted:'default": "a, abbr, acronym, b, bdo, big, br, button, cite, code, dfn, em, i, img, input, kbd, label, map, object, q, samp, select, small, span, strong, sub, sup, textarea, tt, var',contentUnformatted:"pre",indentInnerHtml:!1,preserveNewLines:!0,maxPreserveNewLines:void 0,indentHandlebars:!1,endWithNewline:!1,extraLiners:"head, body, /html",wrapAttributes:"auto"},suggest:{},data:{useDefaultDataProvider:!0}};function eM(e){return{completionItems:!0,hovers:!0,documentSymbols:!0,links:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,selectionRanges:!0,diagnostics:e===eL,documentFormattingEdits:e===eL,documentRangeFormattingEdits:e===eL}}let eL="html",eF="handlebars",eO="razor",eN=ej(eL,eA,eM(eL)),e$=eN.defaults,eH=ej(eF,eA,eM(eF)),eU=eH.defaults,eW=ej(eO,eA,eM(eO)),eq=eW.defaults;function ej(t,i=eA,r=eM(t)){let o,n=new eI(t,i,r),s=eb.languages.onLanguage(t,async()=>{o=(await e.A(918487)).setupMode(n)});return{defaults:n,dispose(){s.dispose(),o?.dispose(),o=void 0}}}e.s(["handlebarDefaults",0,eU,"handlebarLanguageService",0,eH,"htmlDefaults",0,e$,"htmlLanguageService",0,eN,"razorDefaults",0,eq,"razorLanguageService",0,eW,"registerHTMLLanguageService",0,ej],994073);var ez=e.i(994073);let eK=new class{constructor(e,t,i){this._onDidChange=new eb.Emitter,this._languageId=e,this.setDiagnosticsOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(e){this._diagnosticsOptions=e||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}}("json",{validate:!0,allowComments:!0,schemas:[],enableSchemaRequest:!1,schemaRequest:"warning",schemaValidation:"warning",comments:"error",trailingCommas:"error"},{documentFormattingEdits:!0,documentRangeFormattingEdits:!0,completionItems:!0,hovers:!0,documentSymbols:!0,tokens:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0});function eV(){return e.A(134924)}eb.languages.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]}),eb.languages.onLanguage("json",()=>{eV().then(e=>e.setupMode(eK))}),e.s(["getWorker",0,()=>eV().then(e=>e.getWorker()),"jsonDefaults",0,eK],632514);var eB=e.i(632514),eG=e.i(551959);let eQ={},eJ={};class eY{static getOrCreate(e){return eJ[e]||(eJ[e]=new eY(e)),eJ[e]}constructor(e){this._languageId=e,this._loadingTriggered=!1,this._lazyLoadPromise=new Promise((e,t)=>{this._lazyLoadPromiseResolve=e,this._lazyLoadPromiseReject=t})}load(){return this._loadingTriggered||(this._loadingTriggered=!0,eQ[this._languageId].loader().then(e=>this._lazyLoadPromiseResolve(e),e=>this._lazyLoadPromiseReject(e))),this._lazyLoadPromise}}function eX(e){let t=e.id;eQ[t]=e,eb.languages.register(e);let i=eY.getOrCreate(t);eb.languages.registerTokensProviderFactory(t,{create:async()=>(await i.load()).language}),eb.languages.onLanguageEncountered(t,async()=>{let e=await i.load();eb.languages.setLanguageConfiguration(t,e.conf)})}eX({id:"abap",extensions:[".abap"],aliases:["abap","ABAP"],loader:()=>e.A(635811)}),eX({id:"apex",extensions:[".cls"],aliases:["Apex","apex"],mimetypes:["text/x-apex-source","text/x-apex"],loader:()=>e.A(264749)}),eX({id:"azcli",extensions:[".azcli"],aliases:["Azure CLI","azcli"],loader:()=>e.A(317605)}),eX({id:"bat",extensions:[".bat",".cmd"],aliases:["Batch","bat"],loader:()=>e.A(704590)}),eX({id:"bicep",extensions:[".bicep"],aliases:["Bicep"],loader:()=>e.A(153742)}),eX({id:"cameligo",extensions:[".mligo"],aliases:["Cameligo"],loader:()=>e.A(629448)}),eX({id:"clojure",extensions:[".clj",".cljs",".cljc",".edn"],aliases:["clojure","Clojure"],loader:()=>e.A(124011)}),eX({id:"coffeescript",extensions:[".coffee"],aliases:["CoffeeScript","coffeescript","coffee"],mimetypes:["text/x-coffeescript","text/coffeescript"],loader:()=>e.A(331538)}),eX({id:"c",extensions:[".c",".h"],aliases:["C","c"],loader:()=>e.A(940085)}),eX({id:"cpp",extensions:[".cpp",".cc",".cxx",".hpp",".hh",".hxx"],aliases:["C++","Cpp","cpp"],loader:()=>e.A(940085)}),eX({id:"csharp",extensions:[".cs",".csx",".cake"],aliases:["C#","csharp"],loader:()=>e.A(158993)}),eX({id:"csp",extensions:[".csp"],aliases:["CSP","csp"],loader:()=>e.A(189140)}),eX({id:"css",extensions:[".css"],aliases:["CSS","css"],mimetypes:["text/css"],loader:()=>e.A(12065)}),eX({id:"cypher",extensions:[".cypher",".cyp"],aliases:["Cypher","OpenCypher"],loader:()=>e.A(546118)}),eX({id:"dart",extensions:[".dart"],aliases:["Dart","dart"],mimetypes:["text/x-dart-source","text/x-dart"],loader:()=>e.A(468355)}),eX({id:"dockerfile",extensions:[".dockerfile"],filenames:["Dockerfile"],aliases:["Dockerfile"],loader:()=>e.A(292453)}),eX({id:"ecl",extensions:[".ecl"],aliases:["ECL","Ecl","ecl"],loader:()=>e.A(699591)}),eX({id:"elixir",extensions:[".ex",".exs"],aliases:["Elixir","elixir","ex"],loader:()=>e.A(357037)}),eX({id:"flow9",extensions:[".flow"],aliases:["Flow9","Flow","flow9","flow"],loader:()=>e.A(766246)}),eX({id:"fsharp",extensions:[".fs",".fsi",".ml",".mli",".fsx",".fsscript"],aliases:["F#","FSharp","fsharp"],loader:()=>e.A(301403)}),eX({id:"freemarker2",extensions:[".ftl",".ftlh",".ftlx"],aliases:["FreeMarker2","Apache FreeMarker2"],loader:()=>e.A(806910).then(e=>e.TagAutoInterpolationDollar)}),eX({id:"freemarker2.tag-angle.interpolation-dollar",aliases:["FreeMarker2 (Angle/Dollar)","Apache FreeMarker2 (Angle/Dollar)"],loader:()=>e.A(806910).then(e=>e.TagAngleInterpolationDollar)}),eX({id:"freemarker2.tag-bracket.interpolation-dollar",aliases:["FreeMarker2 (Bracket/Dollar)","Apache FreeMarker2 (Bracket/Dollar)"],loader:()=>e.A(806910).then(e=>e.TagBracketInterpolationDollar)}),eX({id:"freemarker2.tag-angle.interpolation-bracket",aliases:["FreeMarker2 (Angle/Bracket)","Apache FreeMarker2 (Angle/Bracket)"],loader:()=>e.A(806910).then(e=>e.TagAngleInterpolationBracket)}),eX({id:"freemarker2.tag-bracket.interpolation-bracket",aliases:["FreeMarker2 (Bracket/Bracket)","Apache FreeMarker2 (Bracket/Bracket)"],loader:()=>e.A(806910).then(e=>e.TagBracketInterpolationBracket)}),eX({id:"freemarker2.tag-auto.interpolation-dollar",aliases:["FreeMarker2 (Auto/Dollar)","Apache FreeMarker2 (Auto/Dollar)"],loader:()=>e.A(806910).then(e=>e.TagAutoInterpolationDollar)}),eX({id:"freemarker2.tag-auto.interpolation-bracket",aliases:["FreeMarker2 (Auto/Bracket)","Apache FreeMarker2 (Auto/Bracket)"],loader:()=>e.A(806910).then(e=>e.TagAutoInterpolationBracket)}),eX({id:"go",extensions:[".go"],aliases:["Go"],loader:()=>e.A(961253)}),eX({id:"graphql",extensions:[".graphql",".gql"],aliases:["GraphQL","graphql","gql"],mimetypes:["application/graphql"],loader:()=>e.A(264559)}),eX({id:"handlebars",extensions:[".handlebars",".hbs"],aliases:["Handlebars","handlebars","hbs"],mimetypes:["text/x-handlebars-template"],loader:()=>e.A(30518)}),eX({id:"hcl",extensions:[".tf",".tfvars",".hcl"],aliases:["Terraform","tf","HCL","hcl"],loader:()=>e.A(768474)}),eX({id:"html",extensions:[".html",".htm",".shtml",".xhtml",".mdoc",".jsp",".asp",".aspx",".jshtm"],aliases:["HTML","htm","html","xhtml"],mimetypes:["text/html","text/x-jshtm","text/template","text/ng-template"],loader:()=>e.A(504826)}),eX({id:"ini",extensions:[".ini",".properties",".gitconfig"],filenames:["config",".gitattributes",".gitconfig",".editorconfig"],aliases:["Ini","ini"],loader:()=>e.A(524721)}),eX({id:"java",extensions:[".java",".jav"],aliases:["Java","java"],mimetypes:["text/x-java-source","text/x-java"],loader:()=>e.A(365570)}),eX({id:"javascript",extensions:[".js",".es6",".jsx",".mjs",".cjs"],firstLine:"^#!.*\\bnode",filenames:["jakefile"],aliases:["JavaScript","javascript","js"],mimetypes:["text/javascript"],loader:()=>e.A(787804)}),eX({id:"julia",extensions:[".jl"],aliases:["julia","Julia"],loader:()=>e.A(979480)}),eX({id:"kotlin",extensions:[".kt",".kts"],aliases:["Kotlin","kotlin"],mimetypes:["text/x-kotlin-source","text/x-kotlin"],loader:()=>e.A(850064)}),eX({id:"less",extensions:[".less"],aliases:["Less","less"],mimetypes:["text/x-less","text/less"],loader:()=>e.A(236120)}),eX({id:"lexon",extensions:[".lex"],aliases:["Lexon"],loader:()=>e.A(769302)}),eX({id:"lua",extensions:[".lua"],aliases:["Lua","lua"],loader:()=>e.A(511259)}),eX({id:"liquid",extensions:[".liquid",".html.liquid"],aliases:["Liquid","liquid"],mimetypes:["application/liquid"],loader:()=>e.A(778189)}),eX({id:"m3",extensions:[".m3",".i3",".mg",".ig"],aliases:["Modula-3","Modula3","modula3","m3"],loader:()=>e.A(391583)}),eX({id:"markdown",extensions:[".md",".markdown",".mdown",".mkdn",".mkd",".mdwn",".mdtxt",".mdtext"],aliases:["Markdown","markdown"],loader:()=>e.A(4206)}),eX({id:"mdx",extensions:[".mdx"],aliases:["MDX","mdx"],loader:()=>e.A(816552)}),eX({id:"mips",extensions:[".s"],aliases:["MIPS","MIPS-V"],mimetypes:["text/x-mips","text/mips","text/plaintext"],loader:()=>e.A(718384)}),eX({id:"msdax",extensions:[".dax",".msdax"],aliases:["DAX","MSDAX"],loader:()=>e.A(284913)}),eX({id:"mysql",extensions:[],aliases:["MySQL","mysql"],loader:()=>e.A(581714)}),eX({id:"objective-c",extensions:[".m"],aliases:["Objective-C"],loader:()=>e.A(261034)}),eX({id:"pascal",extensions:[".pas",".p",".pp"],aliases:["Pascal","pas"],mimetypes:["text/x-pascal-source","text/x-pascal"],loader:()=>e.A(93611)}),eX({id:"pascaligo",extensions:[".ligo"],aliases:["Pascaligo","ligo"],loader:()=>e.A(862727)}),eX({id:"perl",extensions:[".pl",".pm"],aliases:["Perl","pl"],loader:()=>e.A(697377)}),eX({id:"pgsql",extensions:[],aliases:["PostgreSQL","postgres","pg","postgre"],loader:()=>e.A(347750)}),eX({id:"php",extensions:[".php",".php4",".php5",".phtml",".ctp"],aliases:["PHP","php"],mimetypes:["application/x-php"],loader:()=>e.A(461792)}),eX({id:"pla",extensions:[".pla"],loader:()=>e.A(84791)}),eX({id:"postiats",extensions:[".dats",".sats",".hats"],aliases:["ATS","ATS/Postiats"],loader:()=>e.A(590375)}),eX({id:"powerquery",extensions:[".pq",".pqm"],aliases:["PQ","M","Power Query","Power Query M"],loader:()=>e.A(146984)}),eX({id:"powershell",extensions:[".ps1",".psm1",".psd1"],aliases:["PowerShell","powershell","ps","ps1"],loader:()=>e.A(64443)}),eX({id:"proto",extensions:[".proto"],aliases:["protobuf","Protocol Buffers"],loader:()=>e.A(402493)}),eX({id:"pug",extensions:[".jade",".pug"],aliases:["Pug","Jade","jade"],loader:()=>e.A(294884)}),eX({id:"python",extensions:[".py",".rpy",".pyw",".cpy",".gyp",".gypi"],aliases:["Python","py"],firstLine:"^#!/.*\\bpython[0-9.-]*\\b",loader:()=>e.A(445468)}),eX({id:"qsharp",extensions:[".qs"],aliases:["Q#","qsharp"],loader:()=>e.A(250392)}),eX({id:"r",extensions:[".r",".rhistory",".rmd",".rprofile",".rt"],aliases:["R","r"],loader:()=>e.A(35431)}),eX({id:"razor",extensions:[".cshtml"],aliases:["Razor","razor"],mimetypes:["text/x-cshtml"],loader:()=>e.A(185498)}),eX({id:"redis",extensions:[".redis"],aliases:["redis"],loader:()=>e.A(288688)}),eX({id:"redshift",extensions:[],aliases:["Redshift","redshift"],loader:()=>e.A(257081)}),eX({id:"restructuredtext",extensions:[".rst"],aliases:["reStructuredText","restructuredtext"],loader:()=>e.A(434615)}),eX({id:"ruby",extensions:[".rb",".rbx",".rjs",".gemspec",".pp"],filenames:["rakefile","Gemfile"],aliases:["Ruby","rb"],loader:()=>e.A(611325)}),eX({id:"rust",extensions:[".rs",".rlib"],aliases:["Rust","rust"],loader:()=>e.A(199304)}),eX({id:"sb",extensions:[".sb"],aliases:["Small Basic","sb"],loader:()=>e.A(424725)}),eX({id:"scala",extensions:[".scala",".sc",".sbt"],aliases:["Scala","scala","SBT","Sbt","sbt","Dotty","dotty"],mimetypes:["text/x-scala-source","text/x-scala","text/x-sbt","text/x-dotty"],loader:()=>e.A(575894)}),eX({id:"scheme",extensions:[".scm",".ss",".sch",".rkt"],aliases:["scheme","Scheme"],loader:()=>e.A(440673)}),eX({id:"scss",extensions:[".scss"],aliases:["Sass","sass","scss"],mimetypes:["text/x-scss","text/scss"],loader:()=>e.A(647192)}),eX({id:"shell",extensions:[".sh",".bash"],aliases:["Shell","sh"],loader:()=>e.A(30427)}),eX({id:"sol",extensions:[".sol"],aliases:["sol","solidity","Solidity"],loader:()=>e.A(509854)}),eX({id:"aes",extensions:[".aes"],aliases:["aes","sophia","Sophia"],loader:()=>e.A(641974)}),eX({id:"sparql",extensions:[".rq"],aliases:["sparql","SPARQL"],loader:()=>e.A(66225)}),eX({id:"sql",extensions:[".sql"],aliases:["SQL"],loader:()=>e.A(252541)}),eX({id:"st",extensions:[".st",".iecst",".iecplc",".lc3lib",".TcPOU",".TcDUT",".TcGVL",".TcIO"],aliases:["StructuredText","scl","stl"],loader:()=>e.A(769837)}),eX({id:"swift",aliases:["Swift","swift"],extensions:[".swift"],mimetypes:["text/swift"],loader:()=>e.A(215611)}),eX({id:"systemverilog",extensions:[".sv",".svh"],aliases:["SV","sv","SystemVerilog","systemverilog"],loader:()=>e.A(316227)}),eX({id:"verilog",extensions:[".v",".vh"],aliases:["V","v","Verilog","verilog"],loader:()=>e.A(316227)}),eX({id:"tcl",extensions:[".tcl"],aliases:["tcl","Tcl","tcltk","TclTk","tcl/tk","Tcl/Tk"],loader:()=>e.A(240972)}),eX({id:"twig",extensions:[".twig"],aliases:["Twig","twig"],mimetypes:["text/x-twig"],loader:()=>e.A(216930)}),eX({id:"typescript",extensions:[".ts",".tsx",".cts",".mts"],aliases:["TypeScript","ts","typescript"],mimetypes:["text/typescript"],loader:()=>e.A(755019)}),eX({id:"typespec",extensions:[".tsp"],aliases:["TypeSpec"],loader:()=>e.A(717277)}),eX({id:"vb",extensions:[".vb"],aliases:["Visual Basic","vb"],loader:()=>e.A(308554)}),eX({id:"wgsl",extensions:[".wgsl"],aliases:["WebGPU Shading Language","WGSL","wgsl"],loader:()=>e.A(943272)}),eX({id:"xml",extensions:[".xml",".xsd",".dtd",".ascx",".csproj",".config",".props",".targets",".wxi",".wxl",".wxs",".xaml",".svg",".svgz",".opf",".xslt",".xsl"],firstLine:"(\\<\\?xml.*)|(\\<svg)|(\\<\\!doctype\\s+svg)",aliases:["XML","xml"],mimetypes:["text/xml","application/xml","application/xaml+xml","application/xml-dtd"],loader:()=>e.A(867512)}),eX({id:"yaml",extensions:[".yaml",".yml"],aliases:["YAML","yaml","YML","yml"],mimetypes:["application/x-yaml","text/x-yaml"],loader:()=>e.A(611958)});var eZ=Object.defineProperty,e0=(e,t,i)=>{let r;return(r="symbol"!=typeof t?t+"":t)in e?eZ(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i};(A||(A={})).create=function(e){return e};var e1=M||(M={});function e2(e){return -32099<=e&&e<=-32e3}e1.parseError=-32700,e1.invalidRequest=-32600,e1.methodNotFound=-32601,e1.invalidParams=-32602,e1.internalError=-32603,e1.isServerError=e2,e1.serverError=function(e){if(!e2(e))throw Error("Invalid range for a server error.");return e},e1.unexpectedServerError=-32e3,e1.isApplicationError=function(e){return!0},e1.applicationError=function(e){return e},e1.genericApplicationError=-320100;var e6=class{constructor(){e0(this,"listeners",new Set),e0(this,"event",e=>(this.listeners.add(e),{dispose:()=>{this.listeners.delete(e)}}))}fire(e){this.listeners.forEach(t=>t(e))}},e3=class{constructor(e){e0(this,"_value"),e0(this,"eventEmitter"),this._value=e,this.eventEmitter=new e6}get value(){return this._value}set value(e){this._value!==e&&(this._value=e,this.eventEmitter.fire(e))}get onChange(){return this.eventEmitter.event}};function e4(e,t,i){return e instanceof Set?e.add(t):e.set(t,i),{dispose:()=>e.delete(t)}}var e5=class{constructor(){e0(this,"_state","none"),e0(this,"promise"),e0(this,"resolve",()=>{}),e0(this,"reject",()=>{}),this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}get state(){return this._state}},e8=(T=class{constructor(){e0(this,"_unprocessedMessages",[]),e0(this,"_messageListener"),e0(this,"id",T.id++),e0(this,"_state",new e3({state:"open"})),e0(this,"state",this._state)}setListener(e){if(this._messageListener=e,e)for(;this._unprocessedMessages.length>0&&void 0!==this._messageListener;){let e=this._unprocessedMessages.shift();this._messageListener(e)}}send(e){return this._sendImpl(e)}_dispatchReceivedMessage(e){0===this._unprocessedMessages.length&&this._messageListener?this._messageListener(e):this._unprocessedMessages.push(e)}_onConnectionClosed(){this._state.value={state:"closed",error:void 0}}log(e){return new e7(this,e??new e9)}},e0(T,"id",0),T),e7=class{constructor(e,t){e0(this,"baseStream"),e0(this,"logger"),this.baseStream=e,this.logger=t}get state(){return this.baseStream.state}setListener(e){void 0===e?this.baseStream.setListener(void 0):this.baseStream.setListener(t=>{this.logger.log(this.baseStream,"incoming",t),e(t)})}send(e){return this.logger.log(this.baseStream,"outgoing",e),this.baseStream.send(e)}toString(){return`StreamLogger/${this.baseStream.toString()}`}},e9=class{log(e,t,i){console.log(`${"incoming"===t?"<-":"->"} [${e.toString()}] ${JSON.stringify(i)}`)}},te=class e{constructor(e){e0(this,"connect"),this.connect=e}mapContext(t){return new e(e=>{var i,r;return this.connect(e?(i=e,r=t,{handleNotification:(e,t)=>i.handleNotification(e,r(t)),handleRequest:(e,t,o)=>i.handleRequest(e,t,r(o))}):void 0)})}},tt=class e{constructor(e,t,i){e0(this,"_stream"),e0(this,"_listener"),e0(this,"_logger"),e0(this,"_unprocessedResponses",new Map),e0(this,"_lastUsedRequestId",0),this._stream=e,this._listener=t,this._logger=i,this._stream.setListener(e=>{void 0!==e.method?void 0===e.id?this._processNotification(e):this._processRequest(e):this._processResponse(e)})}static createChannel(t,i){let r=!1;return new te(o=>{if(r)throw Error(`A channel to the stream ${t} was already constructed!`);return r=!0,new e(t,o,i)})}get state(){return this._stream.state}async _processNotification(e){if(void 0!==e.id)throw Error();if(!this._listener){this._logger&&this._logger.debug({text:"Notification ignored",message:e});return}try{await this._listener.handleNotification({method:e.method,params:e.params||null})}catch(t){this._logger&&this._logger.warn({text:`Exception was thrown while handling notification: ${t}`,exception:t,message:e})}}async _processRequest(e){let t,i;if(void 0===e.id)throw Error();if(this._listener)try{t=await this._listener.handleRequest({method:e.method,params:e.params||null},e.id)}catch(i){this._logger&&this._logger.warn({text:`Exception was thrown while handling request: ${i}`,message:e,exception:i}),t={error:{code:M.internalError,message:"An unexpected exception was thrown.",data:void 0}}}else this._logger&&this._logger.debug({text:"Received request even though not listening for requests",message:e}),t={error:{code:M.methodNotFound,message:"This endpoint does not listen for requests or notifications.",data:void 0}};i="result"in t?{jsonrpc:"2.0",id:e.id,result:t.result}:{jsonrpc:"2.0",id:e.id,error:t.error},await this._stream.send(i)}_processResponse(e){let t=""+e.id,i=this._unprocessedResponses.get(t);if(!i){this._logger&&this._logger.debug({text:"Got an unexpected response message",message:e});return}this._unprocessedResponses.delete(t),i(e)}_newRequestId(){return this._lastUsedRequestId++}sendRequest(e,t,i){let r={jsonrpc:"2.0",id:this._newRequestId(),method:e.method,params:e.params||void 0};return i&&i(r.id),new Promise((e,t)=>{let i=""+r.id;this._unprocessedResponses.set(i,i=>{"result"in i?e({result:i.result}):(i.error||t(Error("Response had neither 'result' nor 'error' field set.")),e({error:i.error}))}),this._stream.send(r).then(void 0,e=>{this._unprocessedResponses.delete(i),t(e)})})}sendNotification(e,t){let i={jsonrpc:"2.0",id:void 0,method:e.method,params:e.params||void 0};return this._stream.send(i)}toString(){return"StreamChannel/"+this._stream.toString()}};(n=L||(L={})).sAny=function(){return{deserializeFromJson:e=>({hasErrors:!1,value:e}),serializeToJson:e=>e}},n.sEmptyObject=function(){return{deserializeFromJson:e=>({hasErrors:!1,value:{}}),serializeToJson:e=>({})}},n.sVoidFromNull=function(){return{deserializeFromJson:e=>({hasErrors:!1,value:void 0}),serializeToJson:e=>null}};let ti=Symbol("OptionalMethodNotFound");var tr=class{contextualize(e){return new to(this,e)}},to=class extends tr{constructor(e,t){super(),e0(this,"underylingTypedChannel"),e0(this,"converters"),this.underylingTypedChannel=e,this.converters=t}async request(e,t,i){let r=await this.converters.getSendContext(i);return this.underylingTypedChannel.request(e,t,r)}async notify(e,t,i){let r=await this.converters.getSendContext(i);return this.underylingTypedChannel.notify(e,t,r)}registerNotificationHandler(e,t){return this.underylingTypedChannel.registerNotificationHandler(e,async(e,i)=>await t(e,await this.converters.getNewContext(i)))}registerRequestHandler(e,t){return this.underylingTypedChannel.registerRequestHandler(e,async(e,i,r)=>await t(e,i,await this.converters.getNewContext(r)))}},tn=class e extends tr{constructor(e,t={}){super(),e0(this,"channelCtor"),e0(this,"_requestSender"),e0(this,"_handler",new Map),e0(this,"_unknownNotificationHandler",new Set),e0(this,"_timeout"),e0(this,"sendExceptionDetails",!1),e0(this,"_logger"),e0(this,"listeningDeferred",new e5),e0(this,"onListening",this.listeningDeferred.promise),e0(this,"_requestDidErrorEventEmitter",new e6),e0(this,"onRequestDidError",this._requestDidErrorEventEmitter.event),this.channelCtor=e,this._logger=t.logger,this.sendExceptionDetails=!!t.sendExceptionDetails,this._timeout=function(e){let t=setTimeout(e,1e3);return{dispose:()=>clearTimeout(t)}}(()=>{this._requestSender||console.warn(`"${this.startListen.name}" has not been called within 1 second after construction of this channel. Did you forget to call it?`,this)})}static fromTransport(t,i={}){return new e(tt.createChannel(t,i.logger),i)}startListen(){if(this._requestSender)throw Error(`"${this.startListen.name}" can be called only once, but it already has been called.`);this._timeout&&(this._timeout.dispose(),this._timeout=void 0),this._requestSender=this.channelCtor.connect({handleRequest:(e,t,i)=>this.handleRequest(e,t,i),handleNotification:(e,t)=>this.handleNotification(e,t)}),this.listeningDeferred.resolve()}checkChannel(e){if(!e)throw Error(`"${this.startListen.name}" must be called before any messages can be sent or received.`);return!0}async handleRequest(e,t,i){let r=this._handler.get(e.method);if(!r)return this._logger&&this._logger.debug({text:`No request handler for "${e.method}".`,data:{requestObject:e}}),{error:{code:M.methodNotFound,message:`No request handler for "${e.method}".`,data:{method:e.method}}};if("request"!=r.kind){let t=`"${e.method}" is registered as notification, but was sent as request.`;return this._logger&&this._logger.debug({text:t,data:{requestObject:e}}),{error:{code:M.invalidRequest,message:t,data:{method:e.method}}}}let o=r.requestType.paramsSerializer.deserializeFromJson(e.params);if(o.hasErrors){let t=`Got invalid params: ${o.errorMessage}`;return this._logger&&this._logger.debug({text:t,data:{requestObject:e,errorMessage:o.errorMessage}}),{error:{code:M.invalidParams,message:t,data:{errors:o.errorMessage}}}}{let n,s=o.value;try{let e=await r.handler(s,t,i);if("error"in e||"errorMessage"in e){let t=e.error?r.requestType.errorSerializer.serializeToJson(e.error):void 0;n={error:{code:e.errorCode||M.genericApplicationError,message:e.errorMessage||"An error was returned",data:t}}}else n={result:r.requestType.resultSerializer.serializeToJson(e.ok)}}catch(t){t instanceof ta?n={error:{code:t.code,message:t.message}}:(this._logger&&this._logger.warn({text:`An exception was thrown while handling a request: ${t}.`,exception:t,data:{requestObject:e}}),n={error:{code:M.unexpectedServerError,message:this.sendExceptionDetails?`An exception was thrown while handling a request: ${t}.`:"Server has thrown an unexpected exception"}})}return n}}async handleNotification(e,t){let i=this._handler.get(e.method);if(!i){for(let t of this._unknownNotificationHandler)t(e);0===this._unknownNotificationHandler.size&&this._logger&&this._logger.debug({text:`Unhandled notification "${e.method}"`,data:{requestObject:e}});return}if("notification"!=i.kind){this._logger&&this._logger.debug({text:`"${e.method}" is registered as request, but was sent as notification.`,data:{requestObject:e}});return}let r=i.notificationType.paramsSerializer.deserializeFromJson(e.params);if(r.hasErrors){this._logger&&this._logger.debug({text:`Got invalid params: ${r}`,data:{requestObject:e,errorMessage:r.errorMessage}});return}let o=r.value;for(let r of i.handlers)try{r(o,t)}catch(t){this._logger&&this._logger.warn({text:`An exception was thrown while handling a notification: ${t}.`,exception:t,data:{requestObject:e}})}}registerUnknownNotificationHandler(e){return e4(this._unknownNotificationHandler,e)}registerRequestHandler(e,t){if(this._handler.get(e.method))throw Error(`Handler with method "${e.method}" already registered.`);return e4(this._handler,e.method,{kind:"request",requestType:e,handler:t})}registerNotificationHandler(e,t){let i=this._handler.get(e.method);if(i){if("notification"!==i.kind)throw Error(`Method "${e.method}" was already registered as request handler.`);if(i.notificationType!==e)throw Error(`Method "${e.method}" was registered for a different type.`)}else i={kind:"notification",notificationType:e,handlers:new Set},this._handler.set(e.method,i);return e4(i.handlers,t)}getRegisteredTypes(){let e=[];for(let t of this._handler.values())"notification"===t.kind?e.push(t.notificationType):"request"===t.kind&&e.push(t.requestType);return e}async request(e,t,i){if(!this.checkChannel(this._requestSender))throw Error("Impossible");let r=e.paramsSerializer.serializeToJson(t);ts(r);let o=await this._requestSender.sendRequest({method:e.method,params:r},i);if("error"in o){let t;if(e.isOptional&&o.error.code===M.methodNotFound)return ti;if(void 0!==o.error.data){let i=e.errorSerializer.deserializeFromJson(o.error.data);if(i.hasErrors)throw Error(i.errorMessage);t=i.value}else t=void 0;let i=new ta(o.error.message,t,o.error.code);throw this._requestDidErrorEventEmitter.fire({error:i}),i}{let t=e.resultSerializer.deserializeFromJson(o.result);if(!t.hasErrors)return t.value;throw Error("Could not deserialize response: "+t.errorMessage+`
|
|
66
|
+
`),f.log(`Sending request '${d.method} - (${d.id})'.`,e)}else ea("send-request",d);return"function"==typeof Q.sender.enableCancellation&&Q.sender.enableCancellation(d),new Promise(async(e,i)=>{let o={method:r,timerStart:Date.now(),resolve:t=>{e(t),Q.sender.cleanup(l),n?.dispose()},reject:e=>{i(e),Q.sender.cleanup(l),n?.dispose()}};try{I.set(l,o),await t.write(d)}catch(e){throw I.delete(l),o.reject(new F.ResponseError(F.ErrorCodes.MessageWriteError,e.message?e.message:"Unknown reason")),w.error("Sending request failed."),e}})},onRequest:(e,t)=>{el();let i=null;return s.is(e)?(i=void 0,_=e):L.string(e)?(i=null,void 0!==t&&(i=e,k.set(e,{handler:t,type:void 0}))):void 0!==t&&(i=e.method,k.set(e.method,{type:e,handler:t})),{dispose:()=>{null!==i&&(void 0!==i?k.delete(i):_=void 0)}}},hasPendingResponse:()=>I.size>0,trace:async(e,t,i)=>{let r=!1,o=c.Text;void 0!==i&&(L.boolean(i)?r=i:(r=i.sendNotification||!1,o=i.traceFormat||c.Text)),W=e,q=o,f=W===a.Off?void 0:t,!r||Z()||ee()||await ep.sendNotification(d.type,{value:a.toString(e)})},onError:z.event,onClose:K.event,onUnhandledNotification:V.event,onDispose:G.event,end:()=>{t.end()},dispose:()=>{if(ee())return;j=b.Disposed,G.fire(void 0);let i=new F.ResponseError(F.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let e of I.values())e.reject(i);I=new Map,U=new Map,A=new Set,P=new O.LinkedMap,L.func(t.dispose)&&t.dispose(),L.func(e.dispose)&&e.dispose()},listen:()=>{if(el(),X())throw new H(h.AlreadyListening,"Connection is already listening");j=b.Listening,e.listen(er)},inspect:()=>{(0,M.default)().console.log("inspect")}};return ep.onNotification(u.type,e=>{if(W===a.Off||!f)return;let t=W===a.Verbose||W===a.Compact;f.log(e.message,t?e.verbose:void 0)}),ep.onNotification(n.type,e=>{let t=R.get(e.token);t?t(e.value):B.fire(e)}),ep}},412392,(e,t,i)=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.ProgressType=i.ProgressToken=i.createMessageConnection=i.NullLogger=i.ConnectionOptions=i.ConnectionStrategy=i.AbstractMessageBuffer=i.WriteableStreamMessageWriter=i.AbstractMessageWriter=i.MessageWriter=i.ReadableStreamMessageReader=i.AbstractMessageReader=i.MessageReader=i.SharedArrayReceiverStrategy=i.SharedArraySenderStrategy=i.CancellationToken=i.CancellationTokenSource=i.Emitter=i.Event=i.Disposable=i.LRUCache=i.Touch=i.LinkedMap=i.ParameterStructures=i.NotificationType9=i.NotificationType8=i.NotificationType7=i.NotificationType6=i.NotificationType5=i.NotificationType4=i.NotificationType3=i.NotificationType2=i.NotificationType1=i.NotificationType0=i.NotificationType=i.ErrorCodes=i.ResponseError=i.RequestType9=i.RequestType8=i.RequestType7=i.RequestType6=i.RequestType5=i.RequestType4=i.RequestType3=i.RequestType2=i.RequestType1=i.RequestType0=i.RequestType=i.Message=i.RAL=void 0,i.MessageStrategy=i.CancellationStrategy=i.CancellationSenderStrategy=i.CancellationReceiverStrategy=i.ConnectionError=i.ConnectionErrors=i.LogTraceNotification=i.SetTraceNotification=i.TraceFormat=i.TraceValues=i.Trace=void 0;let r=e.r(257425);Object.defineProperty(i,"Message",{enumerable:!0,get:function(){return r.Message}}),Object.defineProperty(i,"RequestType",{enumerable:!0,get:function(){return r.RequestType}}),Object.defineProperty(i,"RequestType0",{enumerable:!0,get:function(){return r.RequestType0}}),Object.defineProperty(i,"RequestType1",{enumerable:!0,get:function(){return r.RequestType1}}),Object.defineProperty(i,"RequestType2",{enumerable:!0,get:function(){return r.RequestType2}}),Object.defineProperty(i,"RequestType3",{enumerable:!0,get:function(){return r.RequestType3}}),Object.defineProperty(i,"RequestType4",{enumerable:!0,get:function(){return r.RequestType4}}),Object.defineProperty(i,"RequestType5",{enumerable:!0,get:function(){return r.RequestType5}}),Object.defineProperty(i,"RequestType6",{enumerable:!0,get:function(){return r.RequestType6}}),Object.defineProperty(i,"RequestType7",{enumerable:!0,get:function(){return r.RequestType7}}),Object.defineProperty(i,"RequestType8",{enumerable:!0,get:function(){return r.RequestType8}}),Object.defineProperty(i,"RequestType9",{enumerable:!0,get:function(){return r.RequestType9}}),Object.defineProperty(i,"ResponseError",{enumerable:!0,get:function(){return r.ResponseError}}),Object.defineProperty(i,"ErrorCodes",{enumerable:!0,get:function(){return r.ErrorCodes}}),Object.defineProperty(i,"NotificationType",{enumerable:!0,get:function(){return r.NotificationType}}),Object.defineProperty(i,"NotificationType0",{enumerable:!0,get:function(){return r.NotificationType0}}),Object.defineProperty(i,"NotificationType1",{enumerable:!0,get:function(){return r.NotificationType1}}),Object.defineProperty(i,"NotificationType2",{enumerable:!0,get:function(){return r.NotificationType2}}),Object.defineProperty(i,"NotificationType3",{enumerable:!0,get:function(){return r.NotificationType3}}),Object.defineProperty(i,"NotificationType4",{enumerable:!0,get:function(){return r.NotificationType4}}),Object.defineProperty(i,"NotificationType5",{enumerable:!0,get:function(){return r.NotificationType5}}),Object.defineProperty(i,"NotificationType6",{enumerable:!0,get:function(){return r.NotificationType6}}),Object.defineProperty(i,"NotificationType7",{enumerable:!0,get:function(){return r.NotificationType7}}),Object.defineProperty(i,"NotificationType8",{enumerable:!0,get:function(){return r.NotificationType8}}),Object.defineProperty(i,"NotificationType9",{enumerable:!0,get:function(){return r.NotificationType9}}),Object.defineProperty(i,"ParameterStructures",{enumerable:!0,get:function(){return r.ParameterStructures}});let o=e.r(869991);Object.defineProperty(i,"LinkedMap",{enumerable:!0,get:function(){return o.LinkedMap}}),Object.defineProperty(i,"LRUCache",{enumerable:!0,get:function(){return o.LRUCache}}),Object.defineProperty(i,"Touch",{enumerable:!0,get:function(){return o.Touch}});let n=e.r(763636);Object.defineProperty(i,"Disposable",{enumerable:!0,get:function(){return n.Disposable}});let s=e.r(907260);Object.defineProperty(i,"Event",{enumerable:!0,get:function(){return s.Event}}),Object.defineProperty(i,"Emitter",{enumerable:!0,get:function(){return s.Emitter}});let a=e.r(686787);Object.defineProperty(i,"CancellationTokenSource",{enumerable:!0,get:function(){return a.CancellationTokenSource}}),Object.defineProperty(i,"CancellationToken",{enumerable:!0,get:function(){return a.CancellationToken}});let l=e.r(593876);Object.defineProperty(i,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return l.SharedArraySenderStrategy}}),Object.defineProperty(i,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return l.SharedArrayReceiverStrategy}});let c=e.r(57485);Object.defineProperty(i,"MessageReader",{enumerable:!0,get:function(){return c.MessageReader}}),Object.defineProperty(i,"AbstractMessageReader",{enumerable:!0,get:function(){return c.AbstractMessageReader}}),Object.defineProperty(i,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return c.ReadableStreamMessageReader}});let d=e.r(34572);Object.defineProperty(i,"MessageWriter",{enumerable:!0,get:function(){return d.MessageWriter}}),Object.defineProperty(i,"AbstractMessageWriter",{enumerable:!0,get:function(){return d.AbstractMessageWriter}}),Object.defineProperty(i,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return d.WriteableStreamMessageWriter}});let u=e.r(454166);Object.defineProperty(i,"AbstractMessageBuffer",{enumerable:!0,get:function(){return u.AbstractMessageBuffer}});let h=e.r(971320);Object.defineProperty(i,"ConnectionStrategy",{enumerable:!0,get:function(){return h.ConnectionStrategy}}),Object.defineProperty(i,"ConnectionOptions",{enumerable:!0,get:function(){return h.ConnectionOptions}}),Object.defineProperty(i,"NullLogger",{enumerable:!0,get:function(){return h.NullLogger}}),Object.defineProperty(i,"createMessageConnection",{enumerable:!0,get:function(){return h.createMessageConnection}}),Object.defineProperty(i,"ProgressToken",{enumerable:!0,get:function(){return h.ProgressToken}}),Object.defineProperty(i,"ProgressType",{enumerable:!0,get:function(){return h.ProgressType}}),Object.defineProperty(i,"Trace",{enumerable:!0,get:function(){return h.Trace}}),Object.defineProperty(i,"TraceValues",{enumerable:!0,get:function(){return h.TraceValues}}),Object.defineProperty(i,"TraceFormat",{enumerable:!0,get:function(){return h.TraceFormat}}),Object.defineProperty(i,"SetTraceNotification",{enumerable:!0,get:function(){return h.SetTraceNotification}}),Object.defineProperty(i,"LogTraceNotification",{enumerable:!0,get:function(){return h.LogTraceNotification}}),Object.defineProperty(i,"ConnectionErrors",{enumerable:!0,get:function(){return h.ConnectionErrors}}),Object.defineProperty(i,"ConnectionError",{enumerable:!0,get:function(){return h.ConnectionError}}),Object.defineProperty(i,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return h.CancellationReceiverStrategy}}),Object.defineProperty(i,"CancellationSenderStrategy",{enumerable:!0,get:function(){return h.CancellationSenderStrategy}}),Object.defineProperty(i,"CancellationStrategy",{enumerable:!0,get:function(){return h.CancellationStrategy}}),Object.defineProperty(i,"MessageStrategy",{enumerable:!0,get:function(){return h.MessageStrategy}}),i.RAL=e.r(540958).default},592944,(e,t,i)=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0});let r=e.r(412392);class o extends r.AbstractMessageBuffer{constructor(e="utf-8"){super(e),this.asciiDecoder=new TextDecoder("ascii")}emptyBuffer(){return o.emptyBuffer}fromString(e,t){return new TextEncoder().encode(e)}toString(e,t){return"ascii"===t?this.asciiDecoder.decode(e):new TextDecoder(t).decode(e)}asNative(e,t){return void 0===t?e:e.slice(0,t)}allocNative(e){return new Uint8Array(e)}}o.emptyBuffer=new Uint8Array(0);class n{constructor(e){this.socket=e,this._onData=new r.Emitter,this._messageListener=e=>{e.data.arrayBuffer().then(e=>{this._onData.fire(new Uint8Array(e))},()=>{(0,r.RAL)().console.error("Converting blob to array buffer failed.")})},this.socket.addEventListener("message",this._messageListener)}onClose(e){return this.socket.addEventListener("close",e),r.Disposable.create(()=>this.socket.removeEventListener("close",e))}onError(e){return this.socket.addEventListener("error",e),r.Disposable.create(()=>this.socket.removeEventListener("error",e))}onEnd(e){return this.socket.addEventListener("end",e),r.Disposable.create(()=>this.socket.removeEventListener("end",e))}onData(e){return this._onData.event(e)}}class s{constructor(e){this.socket=e}onClose(e){return this.socket.addEventListener("close",e),r.Disposable.create(()=>this.socket.removeEventListener("close",e))}onError(e){return this.socket.addEventListener("error",e),r.Disposable.create(()=>this.socket.removeEventListener("error",e))}onEnd(e){return this.socket.addEventListener("end",e),r.Disposable.create(()=>this.socket.removeEventListener("end",e))}write(e,t){if("string"==typeof e){if(void 0!==t&&"utf-8"!==t)throw Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${t}`);this.socket.send(e)}else this.socket.send(e);return Promise.resolve()}end(){this.socket.close()}}let a=new TextEncoder,l=Object.freeze({messageBuffer:Object.freeze({create:e=>new o(e)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(e,t)=>{if("utf-8"!==t.charset)throw Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${t.charset}`);return Promise.resolve(a.encode(JSON.stringify(e,void 0,0)))}}),decoder:Object.freeze({name:"application/json",decode:(e,t)=>{if(!(e instanceof Uint8Array))throw Error("In a Browser environments only Uint8Arrays are supported.");return Promise.resolve(JSON.parse(new TextDecoder(t.charset).decode(e)))}})}),stream:Object.freeze({asReadableStream:e=>new n(e),asWritableStream:e=>new s(e)}),console:console,timer:Object.freeze({setTimeout(e,t,...i){let r=setTimeout(e,t,...i);return{dispose:()=>clearTimeout(r)}},setImmediate(e,...t){let i=setTimeout(e,0,...t);return{dispose:()=>clearTimeout(i)}},setInterval(e,t,...i){let r=setInterval(e,t,...i);return{dispose:()=>clearInterval(r)}}})});function c(){return l}(c||(c={})).install=function(){r.RAL.install(l)},i.default=c},269213,(e,t,i)=>{"use strict";var r=e.e&&e.e.__createBinding||(Object.create?function(e,t,i,r){void 0===r&&(r=i);var o=Object.getOwnPropertyDescriptor(t,i);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,r,o)}:function(e,t,i,r){void 0===r&&(r=i),e[r]=t[i]}),o=e.e&&e.e.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||r(t,e,i)};Object.defineProperty(i,"__esModule",{value:!0}),i.createMessageConnection=i.BrowserMessageWriter=i.BrowserMessageReader=void 0,e.r(592944).default.install();let n=e.r(412392);o(e.r(412392),i);class s extends n.AbstractMessageReader{constructor(e){super(),this._onData=new n.Emitter,this._messageListener=e=>{this._onData.fire(e.data)},e.addEventListener("error",e=>this.fireError(e)),e.onmessage=this._messageListener}listen(e){return this._onData.event(e)}}i.BrowserMessageReader=s;class a extends n.AbstractMessageWriter{constructor(e){super(),this.port=e,this.errorCount=0,e.addEventListener("error",e=>this.fireError(e))}write(e){try{return this.port.postMessage(e),Promise.resolve()}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){}}i.BrowserMessageWriter=a,i.createMessageConnection=function(e,t,i,r){return void 0===i&&(i=n.NullLogger),n.ConnectionStrategy.is(r)&&(r={connectionStrategy:r}),(0,n.createMessageConnection)(e,t,i,r)}},611219,e=>{"use strict";let t,i,r,o;var n,s,a,l,c,d,u,h,g,p,m,f,_,y,C,S,b,w,x,D,E,k,T,R,P,I,A,M,L,F,O,N,$,H,U=e.i(344180),W=e.i(887836),q=e.i(764556);e.i(462506);let j=new Map;function z(e,t){if(t.workspaceRoot){let i=t.workspaceRoot.replace(/\/+$/,"");if(e.startsWith(`${i}/`))return decodeURIComponent(e.slice(i.length+1))}for(let i of[`/workspace/${t.workspaceId}/`,`/${t.workspaceId}/`])if(e.startsWith(i))return decodeURIComponent(e.slice(i.length));return null}var K=e.i(60293),V=e.i(230752),B=e.i(360112),G=e.i(684198),Q=e.i(419199);let J={zh:G.default,en:Q.default};function Y(e){return J["en"===("u">typeof localStorage&&localStorage.getItem("agent-spaces-locale")||"zh")?"en":"zh"][e]??e}let X=[{id:"copyPosition",label:Y("copyPosition"),contextMenuGroupId:"9_cutcopypaste",contextMenuOrder:10,run:(e,t)=>{let i=e.getModel(),r=e.getSelection();if(!i||!r)return;let o=z(i.uri.path,t),n=`${o||i.uri.path}:${r.startLineNumber}:${r.endLineNumber}`;navigator.clipboard.writeText(n).then(()=>{B.toast.success(Y("copiedPosition").replace("{pos}",n))})}},{id:"addToFavorites",label:Y("addToFavorites"),contextMenuGroupId:"9_cutcopypaste",contextMenuOrder:11,run:(e,t)=>{let i=e.getModel(),r=e.getSelection();if(!i||!r)return;let o=r.startLineNumber,n=r.startColumn,s=r.endLineNumber,a=r.endColumn,l=z(i.uri.path,t);if(!l)return;let c={startLineNumber:o,startColumn:1,endLineNumber:s,endColumn:i.getLineMaxColumn(s)},d=i.getValueInRange(c).trim();d.length>300&&(d=d.slice(0,300)+"\n…");let u=l.split("/").pop()||l,h=s>o?`${o}-${s}`:`${o}`;K.useCodeFavoritesStore.getState().setPendingFavorite({workspaceId:t.workspaceId,path:l,line:o,column:n,endLine:s,endColumn:a,label:`${u}:${h}`,snippet:d})}},{id:"sendToNewChannel",label:Y("sendToNewChannel"),contextMenuGroupId:"9_cutcopypaste",contextMenuOrder:12,run:(e,t)=>{let i=e.getModel(),r=e.getSelection();if(!i||!r)return;let o=z(i.uri.path,t),n=`${o||i.uri.path}:${r.startLineNumber}:${r.endLineNumber}`;V.useEditorSendStore.getState().setPendingSendToChannel({workspaceId:t.workspaceId,position:n})}},{id:"sendToNewIssue",label:Y("sendToNewIssue"),contextMenuGroupId:"9_cutcopypaste",contextMenuOrder:13,run:(e,t)=>{let i=e.getModel(),r=e.getSelection();if(!i||!r)return;let o=z(i.uri.path,t),n=`${o||i.uri.path}:${r.startLineNumber}:${r.endLineNumber}`;V.useEditorSendStore.getState().setPendingSendToIssue({workspaceId:t.workspaceId,position:n})}}];for(let e of X)j.set(e.id,e);e.i(340642);var Z=e.i(564822),ee=e.i(691223),et=e.i(972846),ei=e.i(194228),er=e.i(433721);let eo=(0,er.default)("pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);var en=e.i(720247),es=e.i(775712),ea=e.i(67013),el=e.i(361031),ec=e.i(940361),ed=e.i(209988),eu=e.i(260218),eh=e.i(244073),eg=e.i(359209),ep=e.i(465458);let em=({transform:e})=>({...e,y:0});function ef({file:e,isActive:t,boundDirs:i,commitDiffs:r,onClose:o,onClick:n,onCopy:s,onRevealInFinder:a,onSetRevealPath:l,onTogglePin:c,onCloseOthers:d,onCloseLeft:u,onCloseRight:h,t:g}){let{attributes:p,listeners:m,setNodeRef:f,transform:_,transition:y,isDragging:C}=(0,es.useSortable)({id:e.path}),S={transform:ea.CSS.Transform.toString(_),transition:y};return(0,U.jsxs)(ec.ContextMenu,{children:[(0,U.jsx)(ec.ContextMenuTrigger,{children:(0,U.jsxs)("div",{ref:f,style:S,...p,...m,className:(0,ep.cn)("flex items-center gap-1 px-3 py-1.5 text-xs border-r cursor-grab shrink-0 select-none",t?"bg-background text-foreground border-b-2 border-b-primary":"text-muted-foreground hover:bg-accent",C&&"opacity-50 shadow-lg z-10",e.pinned&&"border-l-2 border-l-primary/60"),onClick:n,title:e.path,children:[e.pinned&&(0,U.jsx)(eo,{size:10,className:"text-primary/70 shrink-0 -ml-1 mr-0.5"}),(0,ee.isCommitDiffPath)(e.path)?(0,U.jsx)(ei.GitCommitHorizontal,{size:14,className:"text-blue-500 shrink-0"}):(0,U.jsx)(eg.FileIconImg,{name:e.name}),e.modified&&!e.pinned&&(0,U.jsx)("span",{className:"size-1.5 rounded-full bg-orange-400 shrink-0"}),(0,U.jsx)("span",{className:"truncate max-w-32",children:(0,ee.isCommitDiffPath)(e.path)&&r[(0,ee.getCommitHashFromPath)(e.path)]?.message?.split("\n")[0]?.slice(0,30)||e.name}),(0,U.jsx)("button",{className:"ml-1 hover:bg-accent rounded p-0.5 cursor-pointer",onClick:t=>o(t,e),children:(0,U.jsx)(et.X,{className:"size-3"})})]})}),(0,U.jsxs)(ec.ContextMenuContent,{children:[(0,U.jsx)(ec.ContextMenuItem,{onClick:()=>l(e.path),children:g("revealInTree")}),(0,U.jsx)(ec.ContextMenuItem,{onClick:()=>a(e.path),children:g("revealInFinder")}),(0,U.jsx)(ec.ContextMenuSeparator,{}),(0,U.jsx)(ec.ContextMenuItem,{onClick:()=>{var t;return s((t=e.path,0===i.length?t:i[0].replace(/\/+$/,"")+"/"+t))},children:g("copyFilePath")}),(0,U.jsx)(ec.ContextMenuItem,{onClick:()=>s(e.path),children:g("copyRelativePath")}),(0,U.jsx)(ec.ContextMenuSeparator,{}),(0,U.jsx)(ec.ContextMenuItem,{onClick:()=>c(e.path),children:g(e.pinned?"unpin":"pin")}),(0,U.jsx)(ec.ContextMenuItem,{onClick:()=>d(e.path),children:g("closeOthers")}),(0,U.jsx)(ec.ContextMenuItem,{onClick:()=>u(e.path),children:g("closeLeft")}),(0,U.jsx)(ec.ContextMenuItem,{onClick:()=>h(e.path),children:g("closeRight")})]})]})}function ev({workspaceId:e}){let{openFiles:t,activeFilePath:i,setActiveFile:r,closeFile:o,saveFile:n,setRevealPath:s,commitDiffs:a,togglePin:l,reorderFiles:c,closeOthers:d,closeToLeft:u,closeToRight:h}=(0,ee.useEditorStore)(),g=(0,el.useWorkspaceStore)(e=>e.workspaces).find(t=>t.id===e),p=g?.boundDirs??[],m=(0,eh.useTranslations)("editor"),[f,_]=(0,q.useState)(null),y=(0,en.useSensors)((0,en.useSensor)(en.PointerSensor,{activationConstraint:{distance:5}}),(0,en.useSensor)(en.KeyboardSensor)),C=async e=>{await navigator.clipboard.writeText(e),B.toast.success(m("copied"))},S=t=>{fetch(`/api/workspaces/${e}/files/reveal?path=${encodeURIComponent(t)}`,{method:"POST"})},b=(t,i)=>{t.stopPropagation(),i.modified?_(i):o(e,i.path)},w=async()=>{f&&(await n(e,f.path),o(e,f.path),_(null))},x=(0,q.useCallback)(t=>{let{active:i,over:r}=t;if(!r||i.id===r.id)return;let o=ee.useEditorStore.getState().openFiles,n=o.findIndex(e=>e.path===String(i.id)),s=o.findIndex(e=>e.path===String(r.id));if(-1===n||-1===s)return;let a=(0,es.arrayMove)(o,n,s),l=a.findIndex(e=>e.path===String(i.id)),d=a[l],u=l>0&&a[l-1].pinned,h=!u&&l<a.length-1&&a[l+1].pinned;d&&(a[l]={...d,pinned:u||h}),c(e,[...a.filter(e=>e.pinned),...a.filter(e=>!e.pinned)])},[e,c]);return 0===t.length?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(en.DndContext,{sensors:y,collisionDetection:en.closestCenter,modifiers:[em],onDragEnd:x,children:(0,U.jsx)(es.SortableContext,{items:t.map(e=>e.path),strategy:es.horizontalListSortingStrategy,children:(0,U.jsx)("div",{className:"flex items-center border-b bg-muted/30 overflow-x-auto",children:t.map(t=>(0,U.jsx)(ef,{file:t,isActive:t.path===i,boundDirs:p,commitDiffs:a,onClose:b,onClick:()=>r(e,t.path),onCopy:C,onRevealInFinder:S,onSetRevealPath:s,onTogglePin:t=>l(e,t),onCloseOthers:t=>d(e,t),onCloseLeft:t=>u(e,t),onCloseRight:t=>h(e,t),t:e=>m(e)},t.path))})})}),(0,U.jsx)(ed.Dialog,{open:!!f,onOpenChange:e=>!e&&_(null),children:(0,U.jsxs)(ed.DialogContent,{children:[(0,U.jsxs)(ed.DialogHeader,{children:[(0,U.jsx)(ed.DialogTitle,{children:m("saveChangesTitle")}),(0,U.jsx)(ed.DialogDescription,{children:m("saveChangesDesc",{name:f?.name??""})})]}),(0,U.jsxs)(ed.DialogFooter,{children:[(0,U.jsx)(eu.Button,{variant:"outline",onClick:()=>_(null),children:m("cancel")}),(0,U.jsx)(eu.Button,{variant:"destructive",onClick:()=>{f&&(o(e,f.path),_(null))},children:m("discardChanges")}),(0,U.jsx)(eu.Button,{onClick:w,children:m("save")})]})]})})]})}var e_=e.i(917955),ey=e.i(524360);function eC({editorRef:e,workspaceId:t,isReadOnly:i,onToggleReadOnly:r,isFullscreen:o,onToggleFullscreen:n,wordWrap:s,onToggleWordWrap:a,minimap:l,onToggleMinimap:c,fontSize:d,onZoomIn:u,onZoomOut:h,onZoomReset:g}){let{saveFile:p,activeFilePath:m}=(0,ee.useEditorStore)(),f=(0,eh.useTranslations)("editor"),_=t=>{requestAnimationFrame(()=>{let i=e.current;i&&(i.focus(),i.getAction(t)?.run())})};return(0,U.jsxs)("div",{className:"flex items-center h-7 border-b bg-background shrink-0",children:[(0,U.jsxs)(e_.DropdownMenu,{children:[(0,U.jsx)(e_.DropdownMenuTrigger,{className:"px-3 h-full text-xs hover:bg-accent outline-none cursor-default",children:f("menuFile")}),(0,U.jsx)(e_.DropdownMenuContent,{align:"start",sideOffset:0,children:(0,U.jsxs)(e_.DropdownMenuItem,{onClick:()=>m&&p(t,m),children:[f("menuSave"),(0,U.jsx)(e_.DropdownMenuShortcut,{children:"⌘S"})]})})]}),(0,U.jsxs)(e_.DropdownMenu,{children:[(0,U.jsx)(e_.DropdownMenuTrigger,{className:"px-3 h-full text-xs hover:bg-accent outline-none cursor-default",children:f("menuEdit")}),(0,U.jsxs)(e_.DropdownMenuContent,{align:"start",sideOffset:0,children:[(0,U.jsxs)(e_.DropdownMenuItem,{onClick:()=>_("undo"),children:[f("menuUndo"),(0,U.jsx)(e_.DropdownMenuShortcut,{children:"⌘Z"})]}),(0,U.jsxs)(e_.DropdownMenuItem,{onClick:()=>_("redo"),children:[f("menuRedo"),(0,U.jsx)(e_.DropdownMenuShortcut,{children:"⇧⌘Z"})]}),(0,U.jsx)(e_.DropdownMenuSeparator,{}),(0,U.jsxs)(e_.DropdownMenuItem,{onClick:()=>_("editor.action.clipboardCutAction"),children:[f("menuCut"),(0,U.jsx)(e_.DropdownMenuShortcut,{children:"⌘X"})]}),(0,U.jsxs)(e_.DropdownMenuItem,{onClick:()=>_("editor.action.clipboardCopyAction"),children:[f("menuCopy"),(0,U.jsx)(e_.DropdownMenuShortcut,{children:"⌘C"})]}),(0,U.jsxs)(e_.DropdownMenuItem,{onClick:()=>_("editor.action.clipboardPasteAction"),children:[f("menuPaste"),(0,U.jsx)(e_.DropdownMenuShortcut,{children:"⌘V"})]}),(0,U.jsx)(e_.DropdownMenuSeparator,{}),(0,U.jsxs)(e_.DropdownMenuItem,{onClick:()=>_("actions.find"),children:[f("menuFind"),(0,U.jsx)(e_.DropdownMenuShortcut,{children:"⌘F"})]}),(0,U.jsxs)(e_.DropdownMenuItem,{disabled:i,onClick:()=>_("editor.action.startFindReplaceAction"),children:[f("menuReplace"),(0,U.jsx)(e_.DropdownMenuShortcut,{children:"⌥⌘F"})]})]})]}),(0,U.jsxs)(e_.DropdownMenu,{children:[(0,U.jsx)(e_.DropdownMenuTrigger,{className:"px-3 h-full text-xs hover:bg-accent outline-none cursor-default",children:f("menuView")}),(0,U.jsxs)(e_.DropdownMenuContent,{align:"start",sideOffset:0,children:[(0,U.jsxs)(e_.DropdownMenuItem,{onClick:n,children:[f(o?"exitFullscreen":"menuFullscreen"),(0,U.jsx)(e_.DropdownMenuShortcut,{children:"⌃⌘F"})]}),(0,U.jsx)(e_.DropdownMenuSeparator,{}),(0,U.jsx)(e_.DropdownMenuItem,{onClick:a,children:f(s?"disableWordWrap":"enableWordWrap")}),(0,U.jsx)(e_.DropdownMenuItem,{onClick:c,children:f(l?"disableMinimap":"enableMinimap")}),(0,U.jsx)(e_.DropdownMenuSeparator,{}),(0,U.jsxs)(e_.DropdownMenuItem,{onClick:u,children:[f("zoomIn"),(0,U.jsx)(e_.DropdownMenuShortcut,{children:"⌘+"})]}),(0,U.jsxs)(e_.DropdownMenuItem,{onClick:h,children:[f("zoomOut"),(0,U.jsx)(e_.DropdownMenuShortcut,{children:"⌘-"})]}),(0,U.jsxs)(e_.DropdownMenuItem,{onClick:g,disabled:13===d,children:[f("zoomReset")," (",d,"px)"]})]})]}),(0,U.jsxs)(e_.DropdownMenu,{children:[(0,U.jsx)(e_.DropdownMenuTrigger,{className:"px-3 h-full text-xs hover:bg-accent outline-none cursor-default",children:f("menuRun")}),(0,U.jsx)(e_.DropdownMenuContent,{align:"start",sideOffset:0,children:(0,U.jsxs)(e_.DropdownMenuSub,{children:[(0,U.jsx)(e_.DropdownMenuSubTrigger,{children:f("openInTerminal")}),(0,U.jsxs)(e_.DropdownMenuSubContent,{children:[(0,U.jsx)(e_.DropdownMenuItem,{onClick:()=>{let e=ee.useEditorStore.getState().activeFilePath;if(!e)return;let t=e.includes("/")?e.substring(0,e.lastIndexOf("/")):"";ey.useTerminalStore.getState().createSession(void 0,t||void 0)},children:f("openCurrentDir")}),(0,U.jsx)(e_.DropdownMenuItem,{onClick:()=>{ey.useTerminalStore.getState().createSession()},children:f("openWorkspaceRoot")})]})]})})]}),(0,U.jsx)("div",{className:"flex-1"}),(0,U.jsx)("button",{onClick:r,className:"flex items-center gap-1 px-2 h-full text-xs text-muted-foreground hover:text-foreground hover:bg-accent outline-none cursor-default cursor-pointer",title:f(i?"enableEdit":"disableEdit"),children:i?"🔒":"✏️"})]})}var eS=e.i(950396),eb=e.i(650654),ew=e.i(992764),ex=e.i(381253),eD=e.i(613812);function eE({diffs:e,message:t}){let[i,r]=(0,q.useState)(new Set);return 0===e.length?(0,U.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"No changes"}):(0,U.jsxs)("div",{className:"h-full overflow-auto",children:[(0,U.jsxs)("div",{className:"text-xs text-muted-foreground px-3 py-1.5 border-b bg-muted/30",children:[t.split("\n")[0]," · ",e.length," file",e.length>1?"s":""]}),e.map(e=>{let t=i.has(e.path);return(0,U.jsxs)("div",{className:"border-b last:border-b-0",children:[(0,U.jsxs)("button",{className:"flex items-center gap-1.5 w-full px-2 py-1 text-xs font-mono hover:bg-accent/50 text-left cursor-pointer",onClick:()=>{var t;return t=e.path,void r(e=>{let i=new Set(e);return i.has(t)?i.delete(t):i.add(t),i})},children:[t?(0,U.jsx)(ew.ChevronRight,{size:13}):(0,U.jsx)(eb.ChevronDown,{size:13}),(0,U.jsx)(ex.FileCode,{size:13,className:"text-muted-foreground shrink-0"}),(0,U.jsx)("span",{className:"truncate",children:e.path})]}),!t&&(0,U.jsx)("div",{className:"h-64",children:(0,U.jsx)(eD.DiffViewer,{oldContent:e.oldContent,newContent:e.newContent,path:e.path,isBinary:e.isBinary})})]},e.path)})]})}var ek=e.i(303867),eT=e.i(332277),eR=e.i(989484),eP=e.i(106530);let eI=(0,er.default)("binary",[["rect",{x:"14",y:"14",width:"4",height:"6",rx:"2",key:"p02svl"}],["rect",{x:"6",y:"4",width:"4",height:"6",rx:"2",key:"xm4xkj"}],["path",{d:"M6 20h4",key:"1i6q5t"}],["path",{d:"M14 10h4",key:"ru81e7"}],["path",{d:"M6 14h2v6",key:"16z9wg"}],["path",{d:"M14 4h2v6",key:"1idq9u"}]]);e.i(836406),e.i(859073),e.i(664195),e.i(347410),e.i(768224),e.i(93151),e.i(158555),e.i(517965),e.i(742150),e.i(500127),e.i(874243),e.i(686882),e.i(127819),e.i(640883),e.i(604257),e.i(869416),e.i(116427),e.i(836354),e.i(473864),e.i(318209),e.i(172781),e.i(250182),e.i(131624),e.i(238015),e.i(534662),e.i(433140),e.i(663159),e.i(119260),e.i(877059),e.i(808e3),e.i(645831),e.i(764894),e.i(551501),e.i(337525),e.i(335283),e.i(615239),e.i(324240),e.i(33999),e.i(745026),e.i(637114),e.i(705067),e.i(948539),e.i(768797),e.i(633666),e.i(405261),e.i(231009),e.i(72895),e.i(862215),e.i(273544),e.i(844168),e.i(843210),e.i(767312),e.i(116013),e.i(735564),e.i(44118),e.i(486172),e.i(321915),e.i(171733),e.i(6838),e.i(45048),e.i(526568),e.i(646675),e.i(426208),e.i(772315),e.i(137475),e.i(504183),e.i(656092),e.i(126391),e.i(925665),e.i(756500);var eA=e.i(680590);class eM{constructor(e,t,i){this._onDidChange=new eA.Emitter,this._languageId=e,this.setOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this.options}get options(){return this._options}setOptions(e){this._options=e||Object.create(null),this._onDidChange.fire(this)}setDiagnosticsOptions(e){this.setOptions(e)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}}let eL={validate:!0,lint:{compatibleVendorPrefixes:"ignore",vendorPrefix:"warning",duplicateProperties:"warning",emptyRules:"warning",importStatement:"ignore",boxModel:"ignore",universalSelector:"ignore",zeroUnits:"ignore",fontFaceProperties:"warning",hexColorLength:"error",argumentsInColorFunction:"error",unknownProperties:"warning",ieHack:"ignore",unknownVendorSpecificProperties:"ignore",propertyIgnoredDueToDisplay:"warning",important:"ignore",float:"ignore",idSelector:"ignore"},data:{useDefaultDataProvider:!0},format:{newlineBetweenSelectors:!0,newlineBetweenRules:!0,spaceAroundSelectorSeparator:!1,braceStyle:"collapse",maxPreserveNewLines:void 0,preserveNewLines:!0}},eF={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0,documentFormattingEdits:!0,documentRangeFormattingEdits:!0},eO=new eM("css",eL,eF),eN=new eM("scss",eL,eF),e$=new eM("less",eL,eF);function eH(){return e.A(771485)}eA.languages.onLanguage("less",()=>{eH().then(e=>e.setupMode(e$))}),eA.languages.onLanguage("scss",()=>{eH().then(e=>e.setupMode(eN))}),eA.languages.onLanguage("css",()=>{eH().then(e=>e.setupMode(eO))}),e.s(["cssDefaults",0,eO,"lessDefaults",0,e$,"scssDefaults",0,eN],312705);var eU=e.i(312705);class eW{constructor(e,t,i){this._onDidChange=new eA.Emitter,this._languageId=e,this.setOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get options(){return this._options}get modeConfiguration(){return this._modeConfiguration}setOptions(e){this._options=e||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}}let eq={format:{tabSize:4,insertSpaces:!1,wrapLineLength:120,unformatted:'default": "a, abbr, acronym, b, bdo, big, br, button, cite, code, dfn, em, i, img, input, kbd, label, map, object, q, samp, select, small, span, strong, sub, sup, textarea, tt, var',contentUnformatted:"pre",indentInnerHtml:!1,preserveNewLines:!0,maxPreserveNewLines:void 0,indentHandlebars:!1,endWithNewline:!1,extraLiners:"head, body, /html",wrapAttributes:"auto"},suggest:{},data:{useDefaultDataProvider:!0}};function ej(e){return{completionItems:!0,hovers:!0,documentSymbols:!0,links:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,selectionRanges:!0,diagnostics:e===ez,documentFormattingEdits:e===ez,documentRangeFormattingEdits:e===ez}}let ez="html",eK="handlebars",eV="razor",eB=eZ(ez,eq,ej(ez)),eG=eB.defaults,eQ=eZ(eK,eq,ej(eK)),eJ=eQ.defaults,eY=eZ(eV,eq,ej(eV)),eX=eY.defaults;function eZ(t,i=eq,r=ej(t)){let o,n=new eW(t,i,r),s=eA.languages.onLanguage(t,async()=>{o=(await e.A(918487)).setupMode(n)});return{defaults:n,dispose(){s.dispose(),o?.dispose(),o=void 0}}}e.s(["handlebarDefaults",0,eJ,"handlebarLanguageService",0,eQ,"htmlDefaults",0,eG,"htmlLanguageService",0,eB,"razorDefaults",0,eX,"razorLanguageService",0,eY,"registerHTMLLanguageService",0,eZ],994073);var e0=e.i(994073);let e1=new class{constructor(e,t,i){this._onDidChange=new eA.Emitter,this._languageId=e,this.setDiagnosticsOptions(t),this.setModeConfiguration(i)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(e){this._diagnosticsOptions=e||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}}("json",{validate:!0,allowComments:!0,schemas:[],enableSchemaRequest:!1,schemaRequest:"warning",schemaValidation:"warning",comments:"error",trailingCommas:"error"},{documentFormattingEdits:!0,documentRangeFormattingEdits:!0,completionItems:!0,hovers:!0,documentSymbols:!0,tokens:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0});function e2(){return e.A(134924)}eA.languages.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]}),eA.languages.onLanguage("json",()=>{e2().then(e=>e.setupMode(e1))}),e.s(["getWorker",0,()=>e2().then(e=>e.getWorker()),"jsonDefaults",0,e1],632514);var e6=e.i(632514),e3=e.i(551959);let e4={},e5={};class e8{static getOrCreate(e){return e5[e]||(e5[e]=new e8(e)),e5[e]}constructor(e){this._languageId=e,this._loadingTriggered=!1,this._lazyLoadPromise=new Promise((e,t)=>{this._lazyLoadPromiseResolve=e,this._lazyLoadPromiseReject=t})}load(){return this._loadingTriggered||(this._loadingTriggered=!0,e4[this._languageId].loader().then(e=>this._lazyLoadPromiseResolve(e),e=>this._lazyLoadPromiseReject(e))),this._lazyLoadPromise}}function e7(e){let t=e.id;e4[t]=e,eA.languages.register(e);let i=e8.getOrCreate(t);eA.languages.registerTokensProviderFactory(t,{create:async()=>(await i.load()).language}),eA.languages.onLanguageEncountered(t,async()=>{let e=await i.load();eA.languages.setLanguageConfiguration(t,e.conf)})}e7({id:"abap",extensions:[".abap"],aliases:["abap","ABAP"],loader:()=>e.A(635811)}),e7({id:"apex",extensions:[".cls"],aliases:["Apex","apex"],mimetypes:["text/x-apex-source","text/x-apex"],loader:()=>e.A(264749)}),e7({id:"azcli",extensions:[".azcli"],aliases:["Azure CLI","azcli"],loader:()=>e.A(317605)}),e7({id:"bat",extensions:[".bat",".cmd"],aliases:["Batch","bat"],loader:()=>e.A(704590)}),e7({id:"bicep",extensions:[".bicep"],aliases:["Bicep"],loader:()=>e.A(153742)}),e7({id:"cameligo",extensions:[".mligo"],aliases:["Cameligo"],loader:()=>e.A(629448)}),e7({id:"clojure",extensions:[".clj",".cljs",".cljc",".edn"],aliases:["clojure","Clojure"],loader:()=>e.A(124011)}),e7({id:"coffeescript",extensions:[".coffee"],aliases:["CoffeeScript","coffeescript","coffee"],mimetypes:["text/x-coffeescript","text/coffeescript"],loader:()=>e.A(331538)}),e7({id:"c",extensions:[".c",".h"],aliases:["C","c"],loader:()=>e.A(940085)}),e7({id:"cpp",extensions:[".cpp",".cc",".cxx",".hpp",".hh",".hxx"],aliases:["C++","Cpp","cpp"],loader:()=>e.A(940085)}),e7({id:"csharp",extensions:[".cs",".csx",".cake"],aliases:["C#","csharp"],loader:()=>e.A(158993)}),e7({id:"csp",extensions:[".csp"],aliases:["CSP","csp"],loader:()=>e.A(189140)}),e7({id:"css",extensions:[".css"],aliases:["CSS","css"],mimetypes:["text/css"],loader:()=>e.A(12065)}),e7({id:"cypher",extensions:[".cypher",".cyp"],aliases:["Cypher","OpenCypher"],loader:()=>e.A(546118)}),e7({id:"dart",extensions:[".dart"],aliases:["Dart","dart"],mimetypes:["text/x-dart-source","text/x-dart"],loader:()=>e.A(468355)}),e7({id:"dockerfile",extensions:[".dockerfile"],filenames:["Dockerfile"],aliases:["Dockerfile"],loader:()=>e.A(292453)}),e7({id:"ecl",extensions:[".ecl"],aliases:["ECL","Ecl","ecl"],loader:()=>e.A(699591)}),e7({id:"elixir",extensions:[".ex",".exs"],aliases:["Elixir","elixir","ex"],loader:()=>e.A(357037)}),e7({id:"flow9",extensions:[".flow"],aliases:["Flow9","Flow","flow9","flow"],loader:()=>e.A(766246)}),e7({id:"fsharp",extensions:[".fs",".fsi",".ml",".mli",".fsx",".fsscript"],aliases:["F#","FSharp","fsharp"],loader:()=>e.A(301403)}),e7({id:"freemarker2",extensions:[".ftl",".ftlh",".ftlx"],aliases:["FreeMarker2","Apache FreeMarker2"],loader:()=>e.A(806910).then(e=>e.TagAutoInterpolationDollar)}),e7({id:"freemarker2.tag-angle.interpolation-dollar",aliases:["FreeMarker2 (Angle/Dollar)","Apache FreeMarker2 (Angle/Dollar)"],loader:()=>e.A(806910).then(e=>e.TagAngleInterpolationDollar)}),e7({id:"freemarker2.tag-bracket.interpolation-dollar",aliases:["FreeMarker2 (Bracket/Dollar)","Apache FreeMarker2 (Bracket/Dollar)"],loader:()=>e.A(806910).then(e=>e.TagBracketInterpolationDollar)}),e7({id:"freemarker2.tag-angle.interpolation-bracket",aliases:["FreeMarker2 (Angle/Bracket)","Apache FreeMarker2 (Angle/Bracket)"],loader:()=>e.A(806910).then(e=>e.TagAngleInterpolationBracket)}),e7({id:"freemarker2.tag-bracket.interpolation-bracket",aliases:["FreeMarker2 (Bracket/Bracket)","Apache FreeMarker2 (Bracket/Bracket)"],loader:()=>e.A(806910).then(e=>e.TagBracketInterpolationBracket)}),e7({id:"freemarker2.tag-auto.interpolation-dollar",aliases:["FreeMarker2 (Auto/Dollar)","Apache FreeMarker2 (Auto/Dollar)"],loader:()=>e.A(806910).then(e=>e.TagAutoInterpolationDollar)}),e7({id:"freemarker2.tag-auto.interpolation-bracket",aliases:["FreeMarker2 (Auto/Bracket)","Apache FreeMarker2 (Auto/Bracket)"],loader:()=>e.A(806910).then(e=>e.TagAutoInterpolationBracket)}),e7({id:"go",extensions:[".go"],aliases:["Go"],loader:()=>e.A(961253)}),e7({id:"graphql",extensions:[".graphql",".gql"],aliases:["GraphQL","graphql","gql"],mimetypes:["application/graphql"],loader:()=>e.A(264559)}),e7({id:"handlebars",extensions:[".handlebars",".hbs"],aliases:["Handlebars","handlebars","hbs"],mimetypes:["text/x-handlebars-template"],loader:()=>e.A(30518)}),e7({id:"hcl",extensions:[".tf",".tfvars",".hcl"],aliases:["Terraform","tf","HCL","hcl"],loader:()=>e.A(768474)}),e7({id:"html",extensions:[".html",".htm",".shtml",".xhtml",".mdoc",".jsp",".asp",".aspx",".jshtm"],aliases:["HTML","htm","html","xhtml"],mimetypes:["text/html","text/x-jshtm","text/template","text/ng-template"],loader:()=>e.A(504826)}),e7({id:"ini",extensions:[".ini",".properties",".gitconfig"],filenames:["config",".gitattributes",".gitconfig",".editorconfig"],aliases:["Ini","ini"],loader:()=>e.A(524721)}),e7({id:"java",extensions:[".java",".jav"],aliases:["Java","java"],mimetypes:["text/x-java-source","text/x-java"],loader:()=>e.A(365570)}),e7({id:"javascript",extensions:[".js",".es6",".jsx",".mjs",".cjs"],firstLine:"^#!.*\\bnode",filenames:["jakefile"],aliases:["JavaScript","javascript","js"],mimetypes:["text/javascript"],loader:()=>e.A(787804)}),e7({id:"julia",extensions:[".jl"],aliases:["julia","Julia"],loader:()=>e.A(979480)}),e7({id:"kotlin",extensions:[".kt",".kts"],aliases:["Kotlin","kotlin"],mimetypes:["text/x-kotlin-source","text/x-kotlin"],loader:()=>e.A(850064)}),e7({id:"less",extensions:[".less"],aliases:["Less","less"],mimetypes:["text/x-less","text/less"],loader:()=>e.A(236120)}),e7({id:"lexon",extensions:[".lex"],aliases:["Lexon"],loader:()=>e.A(769302)}),e7({id:"lua",extensions:[".lua"],aliases:["Lua","lua"],loader:()=>e.A(511259)}),e7({id:"liquid",extensions:[".liquid",".html.liquid"],aliases:["Liquid","liquid"],mimetypes:["application/liquid"],loader:()=>e.A(778189)}),e7({id:"m3",extensions:[".m3",".i3",".mg",".ig"],aliases:["Modula-3","Modula3","modula3","m3"],loader:()=>e.A(391583)}),e7({id:"markdown",extensions:[".md",".markdown",".mdown",".mkdn",".mkd",".mdwn",".mdtxt",".mdtext"],aliases:["Markdown","markdown"],loader:()=>e.A(4206)}),e7({id:"mdx",extensions:[".mdx"],aliases:["MDX","mdx"],loader:()=>e.A(816552)}),e7({id:"mips",extensions:[".s"],aliases:["MIPS","MIPS-V"],mimetypes:["text/x-mips","text/mips","text/plaintext"],loader:()=>e.A(718384)}),e7({id:"msdax",extensions:[".dax",".msdax"],aliases:["DAX","MSDAX"],loader:()=>e.A(284913)}),e7({id:"mysql",extensions:[],aliases:["MySQL","mysql"],loader:()=>e.A(581714)}),e7({id:"objective-c",extensions:[".m"],aliases:["Objective-C"],loader:()=>e.A(261034)}),e7({id:"pascal",extensions:[".pas",".p",".pp"],aliases:["Pascal","pas"],mimetypes:["text/x-pascal-source","text/x-pascal"],loader:()=>e.A(93611)}),e7({id:"pascaligo",extensions:[".ligo"],aliases:["Pascaligo","ligo"],loader:()=>e.A(862727)}),e7({id:"perl",extensions:[".pl",".pm"],aliases:["Perl","pl"],loader:()=>e.A(697377)}),e7({id:"pgsql",extensions:[],aliases:["PostgreSQL","postgres","pg","postgre"],loader:()=>e.A(347750)}),e7({id:"php",extensions:[".php",".php4",".php5",".phtml",".ctp"],aliases:["PHP","php"],mimetypes:["application/x-php"],loader:()=>e.A(461792)}),e7({id:"pla",extensions:[".pla"],loader:()=>e.A(84791)}),e7({id:"postiats",extensions:[".dats",".sats",".hats"],aliases:["ATS","ATS/Postiats"],loader:()=>e.A(590375)}),e7({id:"powerquery",extensions:[".pq",".pqm"],aliases:["PQ","M","Power Query","Power Query M"],loader:()=>e.A(146984)}),e7({id:"powershell",extensions:[".ps1",".psm1",".psd1"],aliases:["PowerShell","powershell","ps","ps1"],loader:()=>e.A(64443)}),e7({id:"proto",extensions:[".proto"],aliases:["protobuf","Protocol Buffers"],loader:()=>e.A(402493)}),e7({id:"pug",extensions:[".jade",".pug"],aliases:["Pug","Jade","jade"],loader:()=>e.A(294884)}),e7({id:"python",extensions:[".py",".rpy",".pyw",".cpy",".gyp",".gypi"],aliases:["Python","py"],firstLine:"^#!/.*\\bpython[0-9.-]*\\b",loader:()=>e.A(445468)}),e7({id:"qsharp",extensions:[".qs"],aliases:["Q#","qsharp"],loader:()=>e.A(250392)}),e7({id:"r",extensions:[".r",".rhistory",".rmd",".rprofile",".rt"],aliases:["R","r"],loader:()=>e.A(35431)}),e7({id:"razor",extensions:[".cshtml"],aliases:["Razor","razor"],mimetypes:["text/x-cshtml"],loader:()=>e.A(185498)}),e7({id:"redis",extensions:[".redis"],aliases:["redis"],loader:()=>e.A(288688)}),e7({id:"redshift",extensions:[],aliases:["Redshift","redshift"],loader:()=>e.A(257081)}),e7({id:"restructuredtext",extensions:[".rst"],aliases:["reStructuredText","restructuredtext"],loader:()=>e.A(434615)}),e7({id:"ruby",extensions:[".rb",".rbx",".rjs",".gemspec",".pp"],filenames:["rakefile","Gemfile"],aliases:["Ruby","rb"],loader:()=>e.A(611325)}),e7({id:"rust",extensions:[".rs",".rlib"],aliases:["Rust","rust"],loader:()=>e.A(199304)}),e7({id:"sb",extensions:[".sb"],aliases:["Small Basic","sb"],loader:()=>e.A(424725)}),e7({id:"scala",extensions:[".scala",".sc",".sbt"],aliases:["Scala","scala","SBT","Sbt","sbt","Dotty","dotty"],mimetypes:["text/x-scala-source","text/x-scala","text/x-sbt","text/x-dotty"],loader:()=>e.A(575894)}),e7({id:"scheme",extensions:[".scm",".ss",".sch",".rkt"],aliases:["scheme","Scheme"],loader:()=>e.A(440673)}),e7({id:"scss",extensions:[".scss"],aliases:["Sass","sass","scss"],mimetypes:["text/x-scss","text/scss"],loader:()=>e.A(647192)}),e7({id:"shell",extensions:[".sh",".bash"],aliases:["Shell","sh"],loader:()=>e.A(30427)}),e7({id:"sol",extensions:[".sol"],aliases:["sol","solidity","Solidity"],loader:()=>e.A(509854)}),e7({id:"aes",extensions:[".aes"],aliases:["aes","sophia","Sophia"],loader:()=>e.A(641974)}),e7({id:"sparql",extensions:[".rq"],aliases:["sparql","SPARQL"],loader:()=>e.A(66225)}),e7({id:"sql",extensions:[".sql"],aliases:["SQL"],loader:()=>e.A(252541)}),e7({id:"st",extensions:[".st",".iecst",".iecplc",".lc3lib",".TcPOU",".TcDUT",".TcGVL",".TcIO"],aliases:["StructuredText","scl","stl"],loader:()=>e.A(769837)}),e7({id:"swift",aliases:["Swift","swift"],extensions:[".swift"],mimetypes:["text/swift"],loader:()=>e.A(215611)}),e7({id:"systemverilog",extensions:[".sv",".svh"],aliases:["SV","sv","SystemVerilog","systemverilog"],loader:()=>e.A(316227)}),e7({id:"verilog",extensions:[".v",".vh"],aliases:["V","v","Verilog","verilog"],loader:()=>e.A(316227)}),e7({id:"tcl",extensions:[".tcl"],aliases:["tcl","Tcl","tcltk","TclTk","tcl/tk","Tcl/Tk"],loader:()=>e.A(240972)}),e7({id:"twig",extensions:[".twig"],aliases:["Twig","twig"],mimetypes:["text/x-twig"],loader:()=>e.A(216930)}),e7({id:"typescript",extensions:[".ts",".tsx",".cts",".mts"],aliases:["TypeScript","ts","typescript"],mimetypes:["text/typescript"],loader:()=>e.A(755019)}),e7({id:"typespec",extensions:[".tsp"],aliases:["TypeSpec"],loader:()=>e.A(717277)}),e7({id:"vb",extensions:[".vb"],aliases:["Visual Basic","vb"],loader:()=>e.A(308554)}),e7({id:"wgsl",extensions:[".wgsl"],aliases:["WebGPU Shading Language","WGSL","wgsl"],loader:()=>e.A(943272)}),e7({id:"xml",extensions:[".xml",".xsd",".dtd",".ascx",".csproj",".config",".props",".targets",".wxi",".wxl",".wxs",".xaml",".svg",".svgz",".opf",".xslt",".xsl"],firstLine:"(\\<\\?xml.*)|(\\<svg)|(\\<\\!doctype\\s+svg)",aliases:["XML","xml"],mimetypes:["text/xml","application/xml","application/xaml+xml","application/xml-dtd"],loader:()=>e.A(867512)}),e7({id:"yaml",extensions:[".yaml",".yml"],aliases:["YAML","yaml","YML","yml"],mimetypes:["application/x-yaml","text/x-yaml"],loader:()=>e.A(611958)});var e9=Object.defineProperty,te=(e,t,i)=>{let r;return(r="symbol"!=typeof t?t+"":t)in e?e9(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i};(A||(A={})).create=function(e){return e};var tt=M||(M={});function ti(e){return -32099<=e&&e<=-32e3}tt.parseError=-32700,tt.invalidRequest=-32600,tt.methodNotFound=-32601,tt.invalidParams=-32602,tt.internalError=-32603,tt.isServerError=ti,tt.serverError=function(e){if(!ti(e))throw Error("Invalid range for a server error.");return e},tt.unexpectedServerError=-32e3,tt.isApplicationError=function(e){return!0},tt.applicationError=function(e){return e},tt.genericApplicationError=-320100;var tr=class{constructor(){te(this,"listeners",new Set),te(this,"event",e=>(this.listeners.add(e),{dispose:()=>{this.listeners.delete(e)}}))}fire(e){this.listeners.forEach(t=>t(e))}},to=class{constructor(e){te(this,"_value"),te(this,"eventEmitter"),this._value=e,this.eventEmitter=new tr}get value(){return this._value}set value(e){this._value!==e&&(this._value=e,this.eventEmitter.fire(e))}get onChange(){return this.eventEmitter.event}};function tn(e,t,i){return e instanceof Set?e.add(t):e.set(t,i),{dispose:()=>e.delete(t)}}var ts=class{constructor(){te(this,"_state","none"),te(this,"promise"),te(this,"resolve",()=>{}),te(this,"reject",()=>{}),this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}get state(){return this._state}},ta=(T=class{constructor(){te(this,"_unprocessedMessages",[]),te(this,"_messageListener"),te(this,"id",T.id++),te(this,"_state",new to({state:"open"})),te(this,"state",this._state)}setListener(e){if(this._messageListener=e,e)for(;this._unprocessedMessages.length>0&&void 0!==this._messageListener;){let e=this._unprocessedMessages.shift();this._messageListener(e)}}send(e){return this._sendImpl(e)}_dispatchReceivedMessage(e){0===this._unprocessedMessages.length&&this._messageListener?this._messageListener(e):this._unprocessedMessages.push(e)}_onConnectionClosed(){this._state.value={state:"closed",error:void 0}}log(e){return new tl(this,e??new tc)}},te(T,"id",0),T),tl=class{constructor(e,t){te(this,"baseStream"),te(this,"logger"),this.baseStream=e,this.logger=t}get state(){return this.baseStream.state}setListener(e){void 0===e?this.baseStream.setListener(void 0):this.baseStream.setListener(t=>{this.logger.log(this.baseStream,"incoming",t),e(t)})}send(e){return this.logger.log(this.baseStream,"outgoing",e),this.baseStream.send(e)}toString(){return`StreamLogger/${this.baseStream.toString()}`}},tc=class{log(e,t,i){console.log(`${"incoming"===t?"<-":"->"} [${e.toString()}] ${JSON.stringify(i)}`)}},td=class e{constructor(e){te(this,"connect"),this.connect=e}mapContext(t){return new e(e=>{var i,r;return this.connect(e?(i=e,r=t,{handleNotification:(e,t)=>i.handleNotification(e,r(t)),handleRequest:(e,t,o)=>i.handleRequest(e,t,r(o))}):void 0)})}},tu=class e{constructor(e,t,i){te(this,"_stream"),te(this,"_listener"),te(this,"_logger"),te(this,"_unprocessedResponses",new Map),te(this,"_lastUsedRequestId",0),this._stream=e,this._listener=t,this._logger=i,this._stream.setListener(e=>{void 0!==e.method?void 0===e.id?this._processNotification(e):this._processRequest(e):this._processResponse(e)})}static createChannel(t,i){let r=!1;return new td(o=>{if(r)throw Error(`A channel to the stream ${t} was already constructed!`);return r=!0,new e(t,o,i)})}get state(){return this._stream.state}async _processNotification(e){if(void 0!==e.id)throw Error();if(!this._listener){this._logger&&this._logger.debug({text:"Notification ignored",message:e});return}try{await this._listener.handleNotification({method:e.method,params:e.params||null})}catch(t){this._logger&&this._logger.warn({text:`Exception was thrown while handling notification: ${t}`,exception:t,message:e})}}async _processRequest(e){let t,i;if(void 0===e.id)throw Error();if(this._listener)try{t=await this._listener.handleRequest({method:e.method,params:e.params||null},e.id)}catch(i){this._logger&&this._logger.warn({text:`Exception was thrown while handling request: ${i}`,message:e,exception:i}),t={error:{code:M.internalError,message:"An unexpected exception was thrown.",data:void 0}}}else this._logger&&this._logger.debug({text:"Received request even though not listening for requests",message:e}),t={error:{code:M.methodNotFound,message:"This endpoint does not listen for requests or notifications.",data:void 0}};i="result"in t?{jsonrpc:"2.0",id:e.id,result:t.result}:{jsonrpc:"2.0",id:e.id,error:t.error},await this._stream.send(i)}_processResponse(e){let t=""+e.id,i=this._unprocessedResponses.get(t);if(!i){this._logger&&this._logger.debug({text:"Got an unexpected response message",message:e});return}this._unprocessedResponses.delete(t),i(e)}_newRequestId(){return this._lastUsedRequestId++}sendRequest(e,t,i){let r={jsonrpc:"2.0",id:this._newRequestId(),method:e.method,params:e.params||void 0};return i&&i(r.id),new Promise((e,t)=>{let i=""+r.id;this._unprocessedResponses.set(i,i=>{"result"in i?e({result:i.result}):(i.error||t(Error("Response had neither 'result' nor 'error' field set.")),e({error:i.error}))}),this._stream.send(r).then(void 0,e=>{this._unprocessedResponses.delete(i),t(e)})})}sendNotification(e,t){let i={jsonrpc:"2.0",id:void 0,method:e.method,params:e.params||void 0};return this._stream.send(i)}toString(){return"StreamChannel/"+this._stream.toString()}};(n=L||(L={})).sAny=function(){return{deserializeFromJson:e=>({hasErrors:!1,value:e}),serializeToJson:e=>e}},n.sEmptyObject=function(){return{deserializeFromJson:e=>({hasErrors:!1,value:{}}),serializeToJson:e=>({})}},n.sVoidFromNull=function(){return{deserializeFromJson:e=>({hasErrors:!1,value:void 0}),serializeToJson:e=>null}};let th=Symbol("OptionalMethodNotFound");var tg=class{contextualize(e){return new tp(this,e)}},tp=class extends tg{constructor(e,t){super(),te(this,"underylingTypedChannel"),te(this,"converters"),this.underylingTypedChannel=e,this.converters=t}async request(e,t,i){let r=await this.converters.getSendContext(i);return this.underylingTypedChannel.request(e,t,r)}async notify(e,t,i){let r=await this.converters.getSendContext(i);return this.underylingTypedChannel.notify(e,t,r)}registerNotificationHandler(e,t){return this.underylingTypedChannel.registerNotificationHandler(e,async(e,i)=>await t(e,await this.converters.getNewContext(i)))}registerRequestHandler(e,t){return this.underylingTypedChannel.registerRequestHandler(e,async(e,i,r)=>await t(e,i,await this.converters.getNewContext(r)))}},tm=class e extends tg{constructor(e,t={}){super(),te(this,"channelCtor"),te(this,"_requestSender"),te(this,"_handler",new Map),te(this,"_unknownNotificationHandler",new Set),te(this,"_timeout"),te(this,"sendExceptionDetails",!1),te(this,"_logger"),te(this,"listeningDeferred",new ts),te(this,"onListening",this.listeningDeferred.promise),te(this,"_requestDidErrorEventEmitter",new tr),te(this,"onRequestDidError",this._requestDidErrorEventEmitter.event),this.channelCtor=e,this._logger=t.logger,this.sendExceptionDetails=!!t.sendExceptionDetails,this._timeout=function(e){let t=setTimeout(e,1e3);return{dispose:()=>clearTimeout(t)}}(()=>{this._requestSender||console.warn(`"${this.startListen.name}" has not been called within 1 second after construction of this channel. Did you forget to call it?`,this)})}static fromTransport(t,i={}){return new e(tu.createChannel(t,i.logger),i)}startListen(){if(this._requestSender)throw Error(`"${this.startListen.name}" can be called only once, but it already has been called.`);this._timeout&&(this._timeout.dispose(),this._timeout=void 0),this._requestSender=this.channelCtor.connect({handleRequest:(e,t,i)=>this.handleRequest(e,t,i),handleNotification:(e,t)=>this.handleNotification(e,t)}),this.listeningDeferred.resolve()}checkChannel(e){if(!e)throw Error(`"${this.startListen.name}" must be called before any messages can be sent or received.`);return!0}async handleRequest(e,t,i){let r=this._handler.get(e.method);if(!r)return this._logger&&this._logger.debug({text:`No request handler for "${e.method}".`,data:{requestObject:e}}),{error:{code:M.methodNotFound,message:`No request handler for "${e.method}".`,data:{method:e.method}}};if("request"!=r.kind){let t=`"${e.method}" is registered as notification, but was sent as request.`;return this._logger&&this._logger.debug({text:t,data:{requestObject:e}}),{error:{code:M.invalidRequest,message:t,data:{method:e.method}}}}let o=r.requestType.paramsSerializer.deserializeFromJson(e.params);if(o.hasErrors){let t=`Got invalid params: ${o.errorMessage}`;return this._logger&&this._logger.debug({text:t,data:{requestObject:e,errorMessage:o.errorMessage}}),{error:{code:M.invalidParams,message:t,data:{errors:o.errorMessage}}}}{let n,s=o.value;try{let e=await r.handler(s,t,i);if("error"in e||"errorMessage"in e){let t=e.error?r.requestType.errorSerializer.serializeToJson(e.error):void 0;n={error:{code:e.errorCode||M.genericApplicationError,message:e.errorMessage||"An error was returned",data:t}}}else n={result:r.requestType.resultSerializer.serializeToJson(e.ok)}}catch(t){t instanceof tv?n={error:{code:t.code,message:t.message}}:(this._logger&&this._logger.warn({text:`An exception was thrown while handling a request: ${t}.`,exception:t,data:{requestObject:e}}),n={error:{code:M.unexpectedServerError,message:this.sendExceptionDetails?`An exception was thrown while handling a request: ${t}.`:"Server has thrown an unexpected exception"}})}return n}}async handleNotification(e,t){let i=this._handler.get(e.method);if(!i){for(let t of this._unknownNotificationHandler)t(e);0===this._unknownNotificationHandler.size&&this._logger&&this._logger.debug({text:`Unhandled notification "${e.method}"`,data:{requestObject:e}});return}if("notification"!=i.kind){this._logger&&this._logger.debug({text:`"${e.method}" is registered as request, but was sent as notification.`,data:{requestObject:e}});return}let r=i.notificationType.paramsSerializer.deserializeFromJson(e.params);if(r.hasErrors){this._logger&&this._logger.debug({text:`Got invalid params: ${r}`,data:{requestObject:e,errorMessage:r.errorMessage}});return}let o=r.value;for(let r of i.handlers)try{r(o,t)}catch(t){this._logger&&this._logger.warn({text:`An exception was thrown while handling a notification: ${t}.`,exception:t,data:{requestObject:e}})}}registerUnknownNotificationHandler(e){return tn(this._unknownNotificationHandler,e)}registerRequestHandler(e,t){if(this._handler.get(e.method))throw Error(`Handler with method "${e.method}" already registered.`);return tn(this._handler,e.method,{kind:"request",requestType:e,handler:t})}registerNotificationHandler(e,t){let i=this._handler.get(e.method);if(i){if("notification"!==i.kind)throw Error(`Method "${e.method}" was already registered as request handler.`);if(i.notificationType!==e)throw Error(`Method "${e.method}" was registered for a different type.`)}else i={kind:"notification",notificationType:e,handlers:new Set},this._handler.set(e.method,i);return tn(i.handlers,t)}getRegisteredTypes(){let e=[];for(let t of this._handler.values())"notification"===t.kind?e.push(t.notificationType):"request"===t.kind&&e.push(t.requestType);return e}async request(e,t,i){if(!this.checkChannel(this._requestSender))throw Error("Impossible");let r=e.paramsSerializer.serializeToJson(t);tf(r);let o=await this._requestSender.sendRequest({method:e.method,params:r},i);if("error"in o){let t;if(e.isOptional&&o.error.code===M.methodNotFound)return th;if(void 0!==o.error.data){let i=e.errorSerializer.deserializeFromJson(o.error.data);if(i.hasErrors)throw Error(i.errorMessage);t=i.value}else t=void 0;let i=new tv(o.error.message,t,o.error.code);throw this._requestDidErrorEventEmitter.fire({error:i}),i}{let t=e.resultSerializer.deserializeFromJson(o.result);if(!t.hasErrors)return t.value;throw Error("Could not deserialize response: "+t.errorMessage+`
|
|
67
67
|
|
|
68
|
-
${JSON.stringify(o,null,2)}`)}}async notify(e,t,i){if(!this.checkChannel(this._requestSender))throw Error();let r=e.paramsSerializer.serializeToJson(t);ts(r),this._requestSender.sendNotification({method:e.method,params:r},i)}};function ts(e){if(null!==e&&Array.isArray(e)&&"object"!=typeof e)throw Error("Invalid value! Only null, array and object is allowed.")}var ta=class e extends Error{constructor(t,i,r=M.genericApplicationError){super(t),e0(this,"data"),e0(this,"code"),this.data=i,this.code=r,Object.setPrototypeOf(this,e.prototype)}},tl=class e{constructor(e,t,i,r,o=!1){e0(this,"method"),e0(this,"paramsSerializer"),e0(this,"resultSerializer"),e0(this,"errorSerializer"),e0(this,"isOptional"),e0(this,"kind","request"),this.method=e,this.paramsSerializer=t,this.resultSerializer=i,this.errorSerializer=r,this.isOptional=o}withMethod(t){return new e(t,this.paramsSerializer,this.resultSerializer,this.errorSerializer)}optional(){return new e(this.method,this.paramsSerializer,this.resultSerializer,this.errorSerializer,!0)}},tc=class e{constructor(e,t){e0(this,"method"),e0(this,"paramsSerializer"),e0(this,"kind","notification"),this.method=e,this.paramsSerializer=t}withMethod(t){return new e(t,this.paramsSerializer)}};function td(e){return new tl((e||{}).method,L.sAny(),L.sAny(),L.sAny())}function tu(e){return new tc((e||{}).method,L.sAny())}let th=Symbol();var tg=(R=class{constructor(e){e0(this,"error"),e0(this,th),this.error=e}},e0(R,"factory",e=>new R(e)),R);function tp(e){let t={};for(let[i,r]of Object.entries(e)){let e=r.method?r.method:i;t[i]=r.withMethod(e)}return t}var tm=class e{constructor(e=[],t,i){e0(this,"tags"),e0(this,"server"),e0(this,"client"),this.tags=e,this.server=t,this.client=i}_onlyDesignTime(){return Error("This property is not meant to be accessed at runtime")}get TContractObject(){throw this._onlyDesignTime()}get TClientInterface(){throw this._onlyDesignTime()}get TServerInterface(){throw this._onlyDesignTime()}get TClientHandler(){throw this._onlyDesignTime()}get TServerHandler(){throw this._onlyDesignTime()}get TTags(){throw this._onlyDesignTime()}getInterface(e,t,i,r){let o=this.buildCounterpart(e,i),n=this.registerHandlers(e,t,r,o);return{counterpart:o,dispose:()=>n.dispose()}}buildCounterpart(e,t){let i={};for(let[r,o]of Object.entries(t)){let t;t="request"===o.kind?o.isOptional?async(t,i)=>{void 0===t&&(t={});try{return await e.request(o,t,i)}catch(e){if(e&&e.code===M.methodNotFound)return ti;throw e}}:(t,i)=>(void 0===t&&(t={}),e.request(o,t,i)):(t,i)=>(void 0===t&&(t={}),e.notify(o,t,i)),i[r]=t}return i}registerHandlers(e,t,i,r){let o=[];for(let[n,s]of Object.entries(t))if("request"===s.kind){let t=i[n];if(!t)continue;let a=this.createRequestHandler(r,t);o.push(e.registerRequestHandler(s,a))}else{let t=i[n];t&&o.push(e.registerNotificationHandler(s,(e,i)=>{t(e,{context:i,counterpart:r})}))}return{dispose:()=>o.forEach(e=>e.dispose())}}createRequestHandler(e,t){return async(i,r,o)=>{let n=await t(i,{context:o,counterpart:e,newErr:tg.factory,requestId:r});return n instanceof tg?n.error:{ok:n}}}static getServerFromStream(e,t,i,r){let o=tn.fromTransport(t,i),{server:n}=e.getServer(o,r);return o.startListen(),{channel:o,server:n}}static registerServerToStream(e,t,i,r){let o=tn.fromTransport(t,i),{client:n}=e.registerServer(o,r);return o.startListen(),{channel:o,client:n}}getServer(e,t){let{counterpart:i,dispose:r}=this.getInterface(e,this.client,this.server,t);return{server:i,dispose:r}}registerServer(e,t){let{counterpart:i,dispose:r}=this.getInterface(e,this.server,this.client,t);return{client:i,dispose:r}}withContext(){return new e(this.tags,this.server,this.client)}};let tf=((s={}).Comment="comment",s.Imports="imports",s.Region="region",s),tv=((a={})[a.File=1]="File",a[a.Module=2]="Module",a[a.Namespace=3]="Namespace",a[a.Package=4]="Package",a[a.Class=5]="Class",a[a.Method=6]="Method",a[a.Property=7]="Property",a[a.Field=8]="Field",a[a.Constructor=9]="Constructor",a[a.Enum=10]="Enum",a[a.Interface=11]="Interface",a[a.Function=12]="Function",a[a.Variable=13]="Variable",a[a.Constant=14]="Constant",a[a.String=15]="String",a[a.Number=16]="Number",a[a.Boolean=17]="Boolean",a[a.Array=18]="Array",a[a.Object=19]="Object",a[a.Key=20]="Key",a[a.Null=21]="Null",a[a.EnumMember=22]="EnumMember",a[a.Struct=23]="Struct",a[a.Event=24]="Event",a[a.Operator=25]="Operator",a[a.TypeParameter=26]="TypeParameter",a),t_=((l={})[l.Deprecated=1]="Deprecated",l),ty=((c={})[c.Type=1]="Type",c[c.Parameter=2]="Parameter",c),tC=((d={})[d.None=0]="None",d[d.Full=1]="Full",d[d.Incremental=2]="Incremental",d),tS=((u={})[u.Text=1]="Text",u[u.Method=2]="Method",u[u.Function=3]="Function",u[u.Constructor=4]="Constructor",u[u.Field=5]="Field",u[u.Variable=6]="Variable",u[u.Class=7]="Class",u[u.Interface=8]="Interface",u[u.Module=9]="Module",u[u.Property=10]="Property",u[u.Unit=11]="Unit",u[u.Value=12]="Value",u[u.Enum=13]="Enum",u[u.Keyword=14]="Keyword",u[u.Snippet=15]="Snippet",u[u.Color=16]="Color",u[u.File=17]="File",u[u.Reference=18]="Reference",u[u.Folder=19]="Folder",u[u.EnumMember=20]="EnumMember",u[u.Constant=21]="Constant",u[u.Struct=22]="Struct",u[u.Event=23]="Event",u[u.Operator=24]="Operator",u[u.TypeParameter=25]="TypeParameter",u),tb=((h={})[h.Deprecated=1]="Deprecated",h),tw=((g={})[g.PlainText=1]="PlainText",g[g.Snippet=2]="Snippet",g),tx=((p={})[p.Text=1]="Text",p[p.Read=2]="Read",p[p.Write=3]="Write",p),tD=((m={}).Empty="",m.QuickFix="quickfix",m.Refactor="refactor",m.RefactorExtract="refactor.extract",m.RefactorInline="refactor.inline",m.RefactorRewrite="refactor.rewrite",m.Source="source",m.SourceOrganizeImports="source.organizeImports",m.SourceFixAll="source.fixAll",m),tE=((f={}).PlainText="plaintext",f.Markdown="markdown",f),tk=((_={})[_.Error=1]="Error",_[_.Warning=2]="Warning",_[_.Information=3]="Information",_[_.Hint=4]="Hint",_),tT=((y={})[y.Unnecessary=1]="Unnecessary",y[y.Deprecated=2]="Deprecated",y),tR=((C={})[C.Invoked=1]="Invoked",C[C.TriggerCharacter=2]="TriggerCharacter",C[C.TriggerForIncompleteCompletions=3]="TriggerForIncompleteCompletions",C),tP=((S={})[S.Invoked=1]="Invoked",S[S.TriggerCharacter=2]="TriggerCharacter",S[S.ContentChange=3]="ContentChange",S),tI=((b={})[b.Invoked=1]="Invoked",b[b.Automatic=2]="Automatic",b),tA=((w={}).Relative="relative",w);var tM=class{constructor(e){this.method=e}};let tL={textDocumentImplementation:new tM("textDocument/implementation"),textDocumentTypeDefinition:new tM("textDocument/typeDefinition"),textDocumentDocumentColor:new tM("textDocument/documentColor"),textDocumentColorPresentation:new tM("textDocument/colorPresentation"),textDocumentFoldingRange:new tM("textDocument/foldingRange"),textDocumentDeclaration:new tM("textDocument/declaration"),textDocumentSelectionRange:new tM("textDocument/selectionRange"),textDocumentPrepareCallHierarchy:new tM("textDocument/prepareCallHierarchy"),textDocumentSemanticTokensFull:new tM("textDocument/semanticTokens/full"),textDocumentSemanticTokensFullDelta:new tM("textDocument/semanticTokens/full/delta"),textDocumentLinkedEditingRange:new tM("textDocument/linkedEditingRange"),workspaceWillCreateFiles:new tM("workspace/willCreateFiles"),workspaceWillRenameFiles:new tM("workspace/willRenameFiles"),workspaceWillDeleteFiles:new tM("workspace/willDeleteFiles"),textDocumentMoniker:new tM("textDocument/moniker"),textDocumentPrepareTypeHierarchy:new tM("textDocument/prepareTypeHierarchy"),textDocumentInlineValue:new tM("textDocument/inlineValue"),textDocumentInlayHint:new tM("textDocument/inlayHint"),textDocumentDiagnostic:new tM("textDocument/diagnostic"),textDocumentInlineCompletion:new tM("textDocument/inlineCompletion"),textDocumentWillSaveWaitUntil:new tM("textDocument/willSaveWaitUntil"),textDocumentCompletion:new tM("textDocument/completion"),textDocumentHover:new tM("textDocument/hover"),textDocumentSignatureHelp:new tM("textDocument/signatureHelp"),textDocumentDefinition:new tM("textDocument/definition"),textDocumentReferences:new tM("textDocument/references"),textDocumentDocumentHighlight:new tM("textDocument/documentHighlight"),textDocumentDocumentSymbol:new tM("textDocument/documentSymbol"),textDocumentCodeAction:new tM("textDocument/codeAction"),workspaceSymbol:new tM("workspace/symbol"),textDocumentCodeLens:new tM("textDocument/codeLens"),textDocumentDocumentLink:new tM("textDocument/documentLink"),textDocumentFormatting:new tM("textDocument/formatting"),textDocumentRangeFormatting:new tM("textDocument/rangeFormatting"),textDocumentRangesFormatting:new tM("textDocument/rangesFormatting"),textDocumentOnTypeFormatting:new tM("textDocument/onTypeFormatting"),textDocumentRename:new tM("textDocument/rename"),workspaceExecuteCommand:new tM("workspace/executeCommand"),workspaceDidCreateFiles:new tM("workspace/didCreateFiles"),workspaceDidRenameFiles:new tM("workspace/didRenameFiles"),workspaceDidDeleteFiles:new tM("workspace/didDeleteFiles"),workspaceDidChangeConfiguration:new tM("workspace/didChangeConfiguration"),textDocumentDidOpen:new tM("textDocument/didOpen"),textDocumentDidChange:new tM("textDocument/didChange"),textDocumentDidClose:new tM("textDocument/didClose"),textDocumentDidSave:new tM("textDocument/didSave"),textDocumentWillSave:new tM("textDocument/willSave"),workspaceDidChangeWatchedFiles:new tM("workspace/didChangeWatchedFiles")},tF=(r=tp((x={server:{textDocumentImplementation:td({method:"textDocument/implementation"}),textDocumentTypeDefinition:td({method:"textDocument/typeDefinition"}),textDocumentDocumentColor:td({method:"textDocument/documentColor"}),textDocumentColorPresentation:td({method:"textDocument/colorPresentation"}),textDocumentFoldingRange:td({method:"textDocument/foldingRange"}),textDocumentDeclaration:td({method:"textDocument/declaration"}),textDocumentSelectionRange:td({method:"textDocument/selectionRange"}),textDocumentPrepareCallHierarchy:td({method:"textDocument/prepareCallHierarchy"}),callHierarchyIncomingCalls:td({method:"callHierarchy/incomingCalls"}),callHierarchyOutgoingCalls:td({method:"callHierarchy/outgoingCalls"}),textDocumentSemanticTokensFull:td({method:"textDocument/semanticTokens/full"}),textDocumentSemanticTokensFullDelta:td({method:"textDocument/semanticTokens/full/delta"}),textDocumentSemanticTokensRange:td({method:"textDocument/semanticTokens/range"}),textDocumentLinkedEditingRange:td({method:"textDocument/linkedEditingRange"}),workspaceWillCreateFiles:td({method:"workspace/willCreateFiles"}),workspaceWillRenameFiles:td({method:"workspace/willRenameFiles"}),workspaceWillDeleteFiles:td({method:"workspace/willDeleteFiles"}),textDocumentMoniker:td({method:"textDocument/moniker"}),textDocumentPrepareTypeHierarchy:td({method:"textDocument/prepareTypeHierarchy"}),typeHierarchySupertypes:td({method:"typeHierarchy/supertypes"}),typeHierarchySubtypes:td({method:"typeHierarchy/subtypes"}),textDocumentInlineValue:td({method:"textDocument/inlineValue"}),textDocumentInlayHint:td({method:"textDocument/inlayHint"}),inlayHintResolve:td({method:"inlayHint/resolve"}),textDocumentDiagnostic:td({method:"textDocument/diagnostic"}),workspaceDiagnostic:td({method:"workspace/diagnostic"}),textDocumentInlineCompletion:td({method:"textDocument/inlineCompletion"}),initialize:td({method:"initialize"}),shutdown:td({method:"shutdown"}),textDocumentWillSaveWaitUntil:td({method:"textDocument/willSaveWaitUntil"}),textDocumentCompletion:td({method:"textDocument/completion"}),completionItemResolve:td({method:"completionItem/resolve"}),textDocumentHover:td({method:"textDocument/hover"}),textDocumentSignatureHelp:td({method:"textDocument/signatureHelp"}),textDocumentDefinition:td({method:"textDocument/definition"}),textDocumentReferences:td({method:"textDocument/references"}),textDocumentDocumentHighlight:td({method:"textDocument/documentHighlight"}),textDocumentDocumentSymbol:td({method:"textDocument/documentSymbol"}),textDocumentCodeAction:td({method:"textDocument/codeAction"}),codeActionResolve:td({method:"codeAction/resolve"}),workspaceSymbol:td({method:"workspace/symbol"}),workspaceSymbolResolve:td({method:"workspaceSymbol/resolve"}),textDocumentCodeLens:td({method:"textDocument/codeLens"}),codeLensResolve:td({method:"codeLens/resolve"}),textDocumentDocumentLink:td({method:"textDocument/documentLink"}),documentLinkResolve:td({method:"documentLink/resolve"}),textDocumentFormatting:td({method:"textDocument/formatting"}),textDocumentRangeFormatting:td({method:"textDocument/rangeFormatting"}),textDocumentRangesFormatting:td({method:"textDocument/rangesFormatting"}),textDocumentOnTypeFormatting:td({method:"textDocument/onTypeFormatting"}),textDocumentRename:td({method:"textDocument/rename"}),textDocumentPrepareRename:td({method:"textDocument/prepareRename"}),workspaceExecuteCommand:td({method:"workspace/executeCommand"}),workspaceDidChangeWorkspaceFolders:tu({method:"workspace/didChangeWorkspaceFolders"}),windowWorkDoneProgressCancel:tu({method:"window/workDoneProgress/cancel"}),workspaceDidCreateFiles:tu({method:"workspace/didCreateFiles"}),workspaceDidRenameFiles:tu({method:"workspace/didRenameFiles"}),workspaceDidDeleteFiles:tu({method:"workspace/didDeleteFiles"}),notebookDocumentDidOpen:tu({method:"notebookDocument/didOpen"}),notebookDocumentDidChange:tu({method:"notebookDocument/didChange"}),notebookDocumentDidSave:tu({method:"notebookDocument/didSave"}),notebookDocumentDidClose:tu({method:"notebookDocument/didClose"}),initialized:tu({method:"initialized"}),exit:tu({method:"exit"}),workspaceDidChangeConfiguration:tu({method:"workspace/didChangeConfiguration"}),textDocumentDidOpen:tu({method:"textDocument/didOpen"}),textDocumentDidChange:tu({method:"textDocument/didChange"}),textDocumentDidClose:tu({method:"textDocument/didClose"}),textDocumentDidSave:tu({method:"textDocument/didSave"}),textDocumentWillSave:tu({method:"textDocument/willSave"}),workspaceDidChangeWatchedFiles:tu({method:"workspace/didChangeWatchedFiles"}),setTrace:tu({method:"$/setTrace"}),cancelRequest:tu({method:"$/cancelRequest"}),progress:tu({method:"$/progress"})},client:{workspaceWorkspaceFolders:td({method:"workspace/workspaceFolders"}).optional(),workspaceConfiguration:td({method:"workspace/configuration"}).optional(),workspaceFoldingRangeRefresh:td({method:"workspace/foldingRange/refresh"}).optional(),windowWorkDoneProgressCreate:td({method:"window/workDoneProgress/create"}).optional(),workspaceSemanticTokensRefresh:td({method:"workspace/semanticTokens/refresh"}).optional(),windowShowDocument:td({method:"window/showDocument"}).optional(),workspaceInlineValueRefresh:td({method:"workspace/inlineValue/refresh"}).optional(),workspaceInlayHintRefresh:td({method:"workspace/inlayHint/refresh"}).optional(),workspaceDiagnosticRefresh:td({method:"workspace/diagnostic/refresh"}).optional(),clientRegisterCapability:td({method:"client/registerCapability"}).optional(),clientUnregisterCapability:td({method:"client/unregisterCapability"}).optional(),windowShowMessageRequest:td({method:"window/showMessageRequest"}).optional(),workspaceCodeLensRefresh:td({method:"workspace/codeLens/refresh"}).optional(),workspaceApplyEdit:td({method:"workspace/applyEdit"}).optional(),windowShowMessage:tu({method:"window/showMessage"}),windowLogMessage:tu({method:"window/logMessage"}),telemetryEvent:tu({method:"telemetry/event"}),textDocumentPublishDiagnostics:tu({method:"textDocument/publishDiagnostics"}),logTrace:tu({method:"$/logTrace"}),cancelRequest:tu({method:"$/cancelRequest"}),progress:tu({method:"$/progress"})}}).server),o=tp(x.client),new tm(x.tags||[],r,o));function tO(e,t){if(e.textModel!==t)throw Error(`Expected text model to be ${t}, but got ${e.textModel}`);return e}var tN=(P=class{constructor(){e0(this,"_store",new t$)}dispose(){this._store.dispose()}_register(e){if(e===this)throw Error("Cannot register a disposable on itself!");return this._store.add(e)}},e0(P,"None",Object.freeze({dispose(){}})),P),t$=(I=class{constructor(){e0(this,"_toDispose",new Set),e0(this,"_isDisposed",!1)}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}clear(){if(0!==this._toDispose.size)try{for(let e of this._toDispose)e.dispose()}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw Error("Cannot register a disposable on itself!");return this._isDisposed?I.DISABLE_DISPOSED_WARNING||console.warn(Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}},e0(I,"DISABLE_DISPOSED_WARNING",!1),I);let tH=new Map([[tD.Empty,""],[tD.QuickFix,"quickfix"],[tD.Refactor,"refactor"],[tD.RefactorExtract,"refactor.extract"],[tD.RefactorInline,"refactor.inline"],[tD.RefactorRewrite,"refactor.rewrite"],[tD.Source,"source"],[tD.SourceOrganizeImports,"source.organizeImports"],[tD.SourceFixAll,"source.fixAll"]]),tU=new Map([[eb.languages.CodeActionTriggerType.Invoke,tI.Invoked],[eb.languages.CodeActionTriggerType.Auto,tI.Automatic]]),tW=new Map([[tS.Text,eb.languages.CompletionItemKind.Text],[tS.Method,eb.languages.CompletionItemKind.Method],[tS.Function,eb.languages.CompletionItemKind.Function],[tS.Constructor,eb.languages.CompletionItemKind.Constructor],[tS.Field,eb.languages.CompletionItemKind.Field],[tS.Variable,eb.languages.CompletionItemKind.Variable],[tS.Class,eb.languages.CompletionItemKind.Class],[tS.Interface,eb.languages.CompletionItemKind.Interface],[tS.Module,eb.languages.CompletionItemKind.Module],[tS.Property,eb.languages.CompletionItemKind.Property],[tS.Unit,eb.languages.CompletionItemKind.Unit],[tS.Value,eb.languages.CompletionItemKind.Value],[tS.Enum,eb.languages.CompletionItemKind.Enum],[tS.Keyword,eb.languages.CompletionItemKind.Keyword],[tS.Snippet,eb.languages.CompletionItemKind.Snippet],[tS.Color,eb.languages.CompletionItemKind.Color],[tS.File,eb.languages.CompletionItemKind.File],[tS.Reference,eb.languages.CompletionItemKind.Reference],[tS.Folder,eb.languages.CompletionItemKind.Folder],[tS.EnumMember,eb.languages.CompletionItemKind.EnumMember],[tS.Constant,eb.languages.CompletionItemKind.Constant],[tS.Struct,eb.languages.CompletionItemKind.Struct],[tS.Event,eb.languages.CompletionItemKind.Event],[tS.Operator,eb.languages.CompletionItemKind.Operator],[tS.TypeParameter,eb.languages.CompletionItemKind.TypeParameter]]),tq=new Map([[tb.Deprecated,eb.languages.CompletionItemTag.Deprecated]]);function tj(e){return tq.get(e)}let tz=new Map([[eb.languages.CompletionTriggerKind.Invoke,tR.Invoked],[eb.languages.CompletionTriggerKind.TriggerCharacter,tR.TriggerCharacter],[eb.languages.CompletionTriggerKind.TriggerForIncompleteCompletions,tR.TriggerForIncompleteCompletions]]),tK=new Map([[tw.Snippet,eb.languages.CompletionItemInsertTextRule.InsertAsSnippet]]),tV=new Map([[tv.File,eb.languages.SymbolKind.File],[tv.Module,eb.languages.SymbolKind.Module],[tv.Namespace,eb.languages.SymbolKind.Namespace],[tv.Package,eb.languages.SymbolKind.Package],[tv.Class,eb.languages.SymbolKind.Class],[tv.Method,eb.languages.SymbolKind.Method],[tv.Property,eb.languages.SymbolKind.Property],[tv.Field,eb.languages.SymbolKind.Field],[tv.Constructor,eb.languages.SymbolKind.Constructor],[tv.Enum,eb.languages.SymbolKind.Enum],[tv.Interface,eb.languages.SymbolKind.Interface],[tv.Function,eb.languages.SymbolKind.Function],[tv.Variable,eb.languages.SymbolKind.Variable],[tv.Constant,eb.languages.SymbolKind.Constant],[tv.String,eb.languages.SymbolKind.String],[tv.Number,eb.languages.SymbolKind.Number],[tv.Boolean,eb.languages.SymbolKind.Boolean],[tv.Array,eb.languages.SymbolKind.Array],[tv.Object,eb.languages.SymbolKind.Object],[tv.Key,eb.languages.SymbolKind.Key],[tv.Null,eb.languages.SymbolKind.Null],[tv.EnumMember,eb.languages.SymbolKind.EnumMember],[tv.Struct,eb.languages.SymbolKind.Struct],[tv.Event,eb.languages.SymbolKind.Event],[tv.Operator,eb.languages.SymbolKind.Operator],[tv.TypeParameter,eb.languages.SymbolKind.TypeParameter]]);function tB(e){return tV.get(e)??eb.languages.SymbolKind.File}let tG=new Map([[t_.Deprecated,eb.languages.SymbolTag.Deprecated]]),tQ=new Map([[tx.Text,eb.languages.DocumentHighlightKind.Text],[tx.Read,eb.languages.DocumentHighlightKind.Read],[tx.Write,eb.languages.DocumentHighlightKind.Write]]),tJ=new Map([[tf.Comment,eb.languages.FoldingRangeKind.Comment],[tf.Imports,eb.languages.FoldingRangeKind.Imports],[tf.Region,eb.languages.FoldingRangeKind.Region]]),tY=new Map([[eb.MarkerSeverity.Error,tk.Error],[eb.MarkerSeverity.Warning,tk.Warning],[eb.MarkerSeverity.Info,tk.Information],[eb.MarkerSeverity.Hint,tk.Hint]]),tX=new Map([[tk.Error,eb.MarkerSeverity.Error],[tk.Warning,eb.MarkerSeverity.Warning],[tk.Information,eb.MarkerSeverity.Info],[tk.Hint,eb.MarkerSeverity.Hint]]),tZ=new Map([[tT.Unnecessary,eb.MarkerTag.Unnecessary],[tT.Deprecated,eb.MarkerTag.Deprecated]]),t0=new Map([[eb.languages.SignatureHelpTriggerKind.Invoke,tP.Invoked],[eb.languages.SignatureHelpTriggerKind.TriggerCharacter,tP.TriggerCharacter],[eb.languages.SignatureHelpTriggerKind.ContentChange,tP.ContentChange]]);function t1(e){if(e)return{id:e.command,title:e.title,arguments:e.arguments}}let t2=new Map([[ty.Type,eb.languages.InlayHintKind.Type],[ty.Parameter,eb.languages.InlayHintKind.Parameter]]);function t6(e,t){if("targetUri"in e){let i=t.bridge.translateBackRange({uri:e.targetUri},e.targetRange);return{uri:i.textModel.uri,range:i.range,originSelectionRange:e.originSelectionRange?t.bridge.translateBackRange({uri:e.targetUri},e.originSelectionRange).range:void 0,targetSelectionRange:e.targetSelectionRange?t.bridge.translateBackRange({uri:e.targetUri},e.targetSelectionRange).range:void 0}}{let i=t.bridge.translateBackRange({uri:e.uri},e.range);return{uri:i.textModel.uri,range:i.range}}}function t3(e){return e&&0!==e.length?e.map(e=>"notebook"in e?"string"==typeof e.notebook?{notebookType:e.notebook,language:e.language}:{notebookType:e.notebook.notebookType,language:e.language,pattern:e.notebook.pattern,scheme:e.notebook.scheme}:{language:e.language,pattern:e.pattern,scheme:e.scheme}):{language:"*"}}function t4(e){var t;let i={severity:(t=e.severity)?tX.get(t)??eb.MarkerSeverity.Error:eb.MarkerSeverity.Error,startLineNumber:e.range.start.line+1,startColumn:e.range.start.character+1,endLineNumber:e.range.end.line+1,endColumn:e.range.end.character+1,message:e.message,source:e.source,code:"string"==typeof e.code?e.code:e.code?.toString()};return e.tags&&(i.tags=e.tags.map(e=>tZ.get(e)).filter(e=>void 0!==e)),e.relatedInformation&&(i.relatedInformation=e.relatedInformation.map(e=>({resource:eb.Uri.parse(e.location.uri),startLineNumber:e.location.range.start.line+1,startColumn:e.location.range.start.character+1,endLineNumber:e.location.range.end.line+1,endColumn:e.location.range.end.character+1,message:e.message}))),i}var t5=class extends tN{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{completion:{dynamicRegistration:!0,contextSupport:!0,completionItemKind:{valueSet:Array.from(tW.keys())},completionItem:{tagSupport:{valueSet:Array.from(tq.keys())},commitCharactersSupport:!0,deprecatedSupport:!0,preselectSupport:!0}}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tL.textDocumentCompletion,!0,e=>eb.languages.registerCompletionItemProvider(t3(e.documentSelector),new t8(this._connection,e))))}},t8=class{constructor(e,t){e0(this,"resolveCompletionItem"),this._client=e,this._capabilities=t,t.resolveProvider&&(this.resolveCompletionItem=async(e,t)=>(t7(e,await this._client.server.completionItemResolve(e._lspItem),this._client.bridge,e._translated,e._model),e))}get triggerCharacters(){return this._capabilities.triggerCharacters}async provideCompletionItems(e,t,i,r){var o;let n=this._client.bridge.translate(e,t),s=await this._client.server.textDocumentCompletion({textDocument:n.textDocument,position:n.position,context:i.triggerCharacter?{triggerKind:(o=i.triggerKind,tz.get(o)??tR.Invoked),triggerCharacter:i.triggerCharacter}:void 0});return s?{suggestions:(Array.isArray(s)?s:s.items).map(i=>{var r,o,s,a,l,c;let d,u,h;return{...(r=i,o=this._client.bridge,s=n,a=e,l=t,u=r.insertText||r.label,r.textEdit&&("range"in r.textEdit?(u=r.textEdit.newText,d=tO(o.translateBackRange(s.textDocument,r.textEdit.range),a).range):(u=r.textEdit.newText,d={insert:tO(o.translateBackRange(s.textDocument,r.textEdit.insert),a).range,replace:tO(o.translateBackRange(s.textDocument,r.textEdit.replace),a).range})),d||(d=eb.Range.fromPositions(l,l)),t7(h={label:r.label,kind:(c=r.kind)?tW.get(c)??eb.languages.CompletionItemKind.Text:eb.languages.CompletionItemKind.Text,insertText:u,sortText:r.sortText,filterText:r.filterText,preselect:r.preselect,commitCharacters:r.commitCharacters,range:d},r,o,s,a),h),_lspItem:i,_translated:n,_model:e}})}:{suggestions:[]}}};function t7(e,t,i,r,o){void 0!==t.detail&&(e.detail=t.detail),void 0!==t.documentation&&(e.documentation=function(e){if(e)return"string"==typeof e?e:{value:e.value,isTrusted:!0}}(t.documentation)),void 0!==t.insertTextFormat&&(e.insertTextRules=function(e){if(e)return tK.get(e)}(t.insertTextFormat)),t.tags&&t.tags.length>0&&(e.tags=t.tags.map(tj).filter(e=>void 0!==e)),t.additionalTextEdits&&t.additionalTextEdits.length>0&&(e.additionalTextEdits=t.additionalTextEdits.map(e=>({range:tO(i.translateBackRange(r.textDocument,e.range),o).range,text:e.newText}))),t.command&&(e.command=t1(t.command))}var t9=class extends tN{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{hover:{dynamicRegistration:!0,contentFormat:[tE.Markdown,tE.PlainText]}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tL.textDocumentHover,!0,e=>eb.languages.registerHoverProvider(t3(e.documentSelector),new ie(this._connection,e))))}},ie=class{constructor(e,t){this._client=e,this._capabilities=t}async provideHover(e,t,i){var r;let o=this._client.bridge.translate(e,t),n=await this._client.server.textDocumentHover({textDocument:o.textDocument,position:o.position});return n&&n.contents?{contents:Array.isArray(r=n.contents)?r.map(e=>it(e)):[it(r)],range:n.range?this._client.bridge.translateBackRange(o.textDocument,n.range).range:void 0}:null}};function it(e){return"string"==typeof e?{value:e,isTrusted:!0}:"kind"in e?{value:e.value,isTrusted:!0}:{value:`\`\`\`${e.language}
|
|
68
|
+
${JSON.stringify(o,null,2)}`)}}async notify(e,t,i){if(!this.checkChannel(this._requestSender))throw Error();let r=e.paramsSerializer.serializeToJson(t);tf(r),this._requestSender.sendNotification({method:e.method,params:r},i)}};function tf(e){if(null!==e&&Array.isArray(e)&&"object"!=typeof e)throw Error("Invalid value! Only null, array and object is allowed.")}var tv=class e extends Error{constructor(t,i,r=M.genericApplicationError){super(t),te(this,"data"),te(this,"code"),this.data=i,this.code=r,Object.setPrototypeOf(this,e.prototype)}},t_=class e{constructor(e,t,i,r,o=!1){te(this,"method"),te(this,"paramsSerializer"),te(this,"resultSerializer"),te(this,"errorSerializer"),te(this,"isOptional"),te(this,"kind","request"),this.method=e,this.paramsSerializer=t,this.resultSerializer=i,this.errorSerializer=r,this.isOptional=o}withMethod(t){return new e(t,this.paramsSerializer,this.resultSerializer,this.errorSerializer)}optional(){return new e(this.method,this.paramsSerializer,this.resultSerializer,this.errorSerializer,!0)}},ty=class e{constructor(e,t){te(this,"method"),te(this,"paramsSerializer"),te(this,"kind","notification"),this.method=e,this.paramsSerializer=t}withMethod(t){return new e(t,this.paramsSerializer)}};function tC(e){return new t_((e||{}).method,L.sAny(),L.sAny(),L.sAny())}function tS(e){return new ty((e||{}).method,L.sAny())}let tb=Symbol();var tw=(R=class{constructor(e){te(this,"error"),te(this,tb),this.error=e}},te(R,"factory",e=>new R(e)),R);function tx(e){let t={};for(let[i,r]of Object.entries(e)){let e=r.method?r.method:i;t[i]=r.withMethod(e)}return t}var tD=class e{constructor(e=[],t,i){te(this,"tags"),te(this,"server"),te(this,"client"),this.tags=e,this.server=t,this.client=i}_onlyDesignTime(){return Error("This property is not meant to be accessed at runtime")}get TContractObject(){throw this._onlyDesignTime()}get TClientInterface(){throw this._onlyDesignTime()}get TServerInterface(){throw this._onlyDesignTime()}get TClientHandler(){throw this._onlyDesignTime()}get TServerHandler(){throw this._onlyDesignTime()}get TTags(){throw this._onlyDesignTime()}getInterface(e,t,i,r){let o=this.buildCounterpart(e,i),n=this.registerHandlers(e,t,r,o);return{counterpart:o,dispose:()=>n.dispose()}}buildCounterpart(e,t){let i={};for(let[r,o]of Object.entries(t)){let t;t="request"===o.kind?o.isOptional?async(t,i)=>{void 0===t&&(t={});try{return await e.request(o,t,i)}catch(e){if(e&&e.code===M.methodNotFound)return th;throw e}}:(t,i)=>(void 0===t&&(t={}),e.request(o,t,i)):(t,i)=>(void 0===t&&(t={}),e.notify(o,t,i)),i[r]=t}return i}registerHandlers(e,t,i,r){let o=[];for(let[n,s]of Object.entries(t))if("request"===s.kind){let t=i[n];if(!t)continue;let a=this.createRequestHandler(r,t);o.push(e.registerRequestHandler(s,a))}else{let t=i[n];t&&o.push(e.registerNotificationHandler(s,(e,i)=>{t(e,{context:i,counterpart:r})}))}return{dispose:()=>o.forEach(e=>e.dispose())}}createRequestHandler(e,t){return async(i,r,o)=>{let n=await t(i,{context:o,counterpart:e,newErr:tw.factory,requestId:r});return n instanceof tw?n.error:{ok:n}}}static getServerFromStream(e,t,i,r){let o=tm.fromTransport(t,i),{server:n}=e.getServer(o,r);return o.startListen(),{channel:o,server:n}}static registerServerToStream(e,t,i,r){let o=tm.fromTransport(t,i),{client:n}=e.registerServer(o,r);return o.startListen(),{channel:o,client:n}}getServer(e,t){let{counterpart:i,dispose:r}=this.getInterface(e,this.client,this.server,t);return{server:i,dispose:r}}registerServer(e,t){let{counterpart:i,dispose:r}=this.getInterface(e,this.server,this.client,t);return{client:i,dispose:r}}withContext(){return new e(this.tags,this.server,this.client)}};let tE=((s={}).Comment="comment",s.Imports="imports",s.Region="region",s),tk=((a={})[a.File=1]="File",a[a.Module=2]="Module",a[a.Namespace=3]="Namespace",a[a.Package=4]="Package",a[a.Class=5]="Class",a[a.Method=6]="Method",a[a.Property=7]="Property",a[a.Field=8]="Field",a[a.Constructor=9]="Constructor",a[a.Enum=10]="Enum",a[a.Interface=11]="Interface",a[a.Function=12]="Function",a[a.Variable=13]="Variable",a[a.Constant=14]="Constant",a[a.String=15]="String",a[a.Number=16]="Number",a[a.Boolean=17]="Boolean",a[a.Array=18]="Array",a[a.Object=19]="Object",a[a.Key=20]="Key",a[a.Null=21]="Null",a[a.EnumMember=22]="EnumMember",a[a.Struct=23]="Struct",a[a.Event=24]="Event",a[a.Operator=25]="Operator",a[a.TypeParameter=26]="TypeParameter",a),tT=((l={})[l.Deprecated=1]="Deprecated",l),tR=((c={})[c.Type=1]="Type",c[c.Parameter=2]="Parameter",c),tP=((d={})[d.None=0]="None",d[d.Full=1]="Full",d[d.Incremental=2]="Incremental",d),tI=((u={})[u.Text=1]="Text",u[u.Method=2]="Method",u[u.Function=3]="Function",u[u.Constructor=4]="Constructor",u[u.Field=5]="Field",u[u.Variable=6]="Variable",u[u.Class=7]="Class",u[u.Interface=8]="Interface",u[u.Module=9]="Module",u[u.Property=10]="Property",u[u.Unit=11]="Unit",u[u.Value=12]="Value",u[u.Enum=13]="Enum",u[u.Keyword=14]="Keyword",u[u.Snippet=15]="Snippet",u[u.Color=16]="Color",u[u.File=17]="File",u[u.Reference=18]="Reference",u[u.Folder=19]="Folder",u[u.EnumMember=20]="EnumMember",u[u.Constant=21]="Constant",u[u.Struct=22]="Struct",u[u.Event=23]="Event",u[u.Operator=24]="Operator",u[u.TypeParameter=25]="TypeParameter",u),tA=((h={})[h.Deprecated=1]="Deprecated",h),tM=((g={})[g.PlainText=1]="PlainText",g[g.Snippet=2]="Snippet",g),tL=((p={})[p.Text=1]="Text",p[p.Read=2]="Read",p[p.Write=3]="Write",p),tF=((m={}).Empty="",m.QuickFix="quickfix",m.Refactor="refactor",m.RefactorExtract="refactor.extract",m.RefactorInline="refactor.inline",m.RefactorRewrite="refactor.rewrite",m.Source="source",m.SourceOrganizeImports="source.organizeImports",m.SourceFixAll="source.fixAll",m),tO=((f={}).PlainText="plaintext",f.Markdown="markdown",f),tN=((_={})[_.Error=1]="Error",_[_.Warning=2]="Warning",_[_.Information=3]="Information",_[_.Hint=4]="Hint",_),t$=((y={})[y.Unnecessary=1]="Unnecessary",y[y.Deprecated=2]="Deprecated",y),tH=((C={})[C.Invoked=1]="Invoked",C[C.TriggerCharacter=2]="TriggerCharacter",C[C.TriggerForIncompleteCompletions=3]="TriggerForIncompleteCompletions",C),tU=((S={})[S.Invoked=1]="Invoked",S[S.TriggerCharacter=2]="TriggerCharacter",S[S.ContentChange=3]="ContentChange",S),tW=((b={})[b.Invoked=1]="Invoked",b[b.Automatic=2]="Automatic",b),tq=((w={}).Relative="relative",w);var tj=class{constructor(e){this.method=e}};let tz={textDocumentImplementation:new tj("textDocument/implementation"),textDocumentTypeDefinition:new tj("textDocument/typeDefinition"),textDocumentDocumentColor:new tj("textDocument/documentColor"),textDocumentColorPresentation:new tj("textDocument/colorPresentation"),textDocumentFoldingRange:new tj("textDocument/foldingRange"),textDocumentDeclaration:new tj("textDocument/declaration"),textDocumentSelectionRange:new tj("textDocument/selectionRange"),textDocumentPrepareCallHierarchy:new tj("textDocument/prepareCallHierarchy"),textDocumentSemanticTokensFull:new tj("textDocument/semanticTokens/full"),textDocumentSemanticTokensFullDelta:new tj("textDocument/semanticTokens/full/delta"),textDocumentLinkedEditingRange:new tj("textDocument/linkedEditingRange"),workspaceWillCreateFiles:new tj("workspace/willCreateFiles"),workspaceWillRenameFiles:new tj("workspace/willRenameFiles"),workspaceWillDeleteFiles:new tj("workspace/willDeleteFiles"),textDocumentMoniker:new tj("textDocument/moniker"),textDocumentPrepareTypeHierarchy:new tj("textDocument/prepareTypeHierarchy"),textDocumentInlineValue:new tj("textDocument/inlineValue"),textDocumentInlayHint:new tj("textDocument/inlayHint"),textDocumentDiagnostic:new tj("textDocument/diagnostic"),textDocumentInlineCompletion:new tj("textDocument/inlineCompletion"),textDocumentWillSaveWaitUntil:new tj("textDocument/willSaveWaitUntil"),textDocumentCompletion:new tj("textDocument/completion"),textDocumentHover:new tj("textDocument/hover"),textDocumentSignatureHelp:new tj("textDocument/signatureHelp"),textDocumentDefinition:new tj("textDocument/definition"),textDocumentReferences:new tj("textDocument/references"),textDocumentDocumentHighlight:new tj("textDocument/documentHighlight"),textDocumentDocumentSymbol:new tj("textDocument/documentSymbol"),textDocumentCodeAction:new tj("textDocument/codeAction"),workspaceSymbol:new tj("workspace/symbol"),textDocumentCodeLens:new tj("textDocument/codeLens"),textDocumentDocumentLink:new tj("textDocument/documentLink"),textDocumentFormatting:new tj("textDocument/formatting"),textDocumentRangeFormatting:new tj("textDocument/rangeFormatting"),textDocumentRangesFormatting:new tj("textDocument/rangesFormatting"),textDocumentOnTypeFormatting:new tj("textDocument/onTypeFormatting"),textDocumentRename:new tj("textDocument/rename"),workspaceExecuteCommand:new tj("workspace/executeCommand"),workspaceDidCreateFiles:new tj("workspace/didCreateFiles"),workspaceDidRenameFiles:new tj("workspace/didRenameFiles"),workspaceDidDeleteFiles:new tj("workspace/didDeleteFiles"),workspaceDidChangeConfiguration:new tj("workspace/didChangeConfiguration"),textDocumentDidOpen:new tj("textDocument/didOpen"),textDocumentDidChange:new tj("textDocument/didChange"),textDocumentDidClose:new tj("textDocument/didClose"),textDocumentDidSave:new tj("textDocument/didSave"),textDocumentWillSave:new tj("textDocument/willSave"),workspaceDidChangeWatchedFiles:new tj("workspace/didChangeWatchedFiles")},tK=(r=tx((x={server:{textDocumentImplementation:tC({method:"textDocument/implementation"}),textDocumentTypeDefinition:tC({method:"textDocument/typeDefinition"}),textDocumentDocumentColor:tC({method:"textDocument/documentColor"}),textDocumentColorPresentation:tC({method:"textDocument/colorPresentation"}),textDocumentFoldingRange:tC({method:"textDocument/foldingRange"}),textDocumentDeclaration:tC({method:"textDocument/declaration"}),textDocumentSelectionRange:tC({method:"textDocument/selectionRange"}),textDocumentPrepareCallHierarchy:tC({method:"textDocument/prepareCallHierarchy"}),callHierarchyIncomingCalls:tC({method:"callHierarchy/incomingCalls"}),callHierarchyOutgoingCalls:tC({method:"callHierarchy/outgoingCalls"}),textDocumentSemanticTokensFull:tC({method:"textDocument/semanticTokens/full"}),textDocumentSemanticTokensFullDelta:tC({method:"textDocument/semanticTokens/full/delta"}),textDocumentSemanticTokensRange:tC({method:"textDocument/semanticTokens/range"}),textDocumentLinkedEditingRange:tC({method:"textDocument/linkedEditingRange"}),workspaceWillCreateFiles:tC({method:"workspace/willCreateFiles"}),workspaceWillRenameFiles:tC({method:"workspace/willRenameFiles"}),workspaceWillDeleteFiles:tC({method:"workspace/willDeleteFiles"}),textDocumentMoniker:tC({method:"textDocument/moniker"}),textDocumentPrepareTypeHierarchy:tC({method:"textDocument/prepareTypeHierarchy"}),typeHierarchySupertypes:tC({method:"typeHierarchy/supertypes"}),typeHierarchySubtypes:tC({method:"typeHierarchy/subtypes"}),textDocumentInlineValue:tC({method:"textDocument/inlineValue"}),textDocumentInlayHint:tC({method:"textDocument/inlayHint"}),inlayHintResolve:tC({method:"inlayHint/resolve"}),textDocumentDiagnostic:tC({method:"textDocument/diagnostic"}),workspaceDiagnostic:tC({method:"workspace/diagnostic"}),textDocumentInlineCompletion:tC({method:"textDocument/inlineCompletion"}),initialize:tC({method:"initialize"}),shutdown:tC({method:"shutdown"}),textDocumentWillSaveWaitUntil:tC({method:"textDocument/willSaveWaitUntil"}),textDocumentCompletion:tC({method:"textDocument/completion"}),completionItemResolve:tC({method:"completionItem/resolve"}),textDocumentHover:tC({method:"textDocument/hover"}),textDocumentSignatureHelp:tC({method:"textDocument/signatureHelp"}),textDocumentDefinition:tC({method:"textDocument/definition"}),textDocumentReferences:tC({method:"textDocument/references"}),textDocumentDocumentHighlight:tC({method:"textDocument/documentHighlight"}),textDocumentDocumentSymbol:tC({method:"textDocument/documentSymbol"}),textDocumentCodeAction:tC({method:"textDocument/codeAction"}),codeActionResolve:tC({method:"codeAction/resolve"}),workspaceSymbol:tC({method:"workspace/symbol"}),workspaceSymbolResolve:tC({method:"workspaceSymbol/resolve"}),textDocumentCodeLens:tC({method:"textDocument/codeLens"}),codeLensResolve:tC({method:"codeLens/resolve"}),textDocumentDocumentLink:tC({method:"textDocument/documentLink"}),documentLinkResolve:tC({method:"documentLink/resolve"}),textDocumentFormatting:tC({method:"textDocument/formatting"}),textDocumentRangeFormatting:tC({method:"textDocument/rangeFormatting"}),textDocumentRangesFormatting:tC({method:"textDocument/rangesFormatting"}),textDocumentOnTypeFormatting:tC({method:"textDocument/onTypeFormatting"}),textDocumentRename:tC({method:"textDocument/rename"}),textDocumentPrepareRename:tC({method:"textDocument/prepareRename"}),workspaceExecuteCommand:tC({method:"workspace/executeCommand"}),workspaceDidChangeWorkspaceFolders:tS({method:"workspace/didChangeWorkspaceFolders"}),windowWorkDoneProgressCancel:tS({method:"window/workDoneProgress/cancel"}),workspaceDidCreateFiles:tS({method:"workspace/didCreateFiles"}),workspaceDidRenameFiles:tS({method:"workspace/didRenameFiles"}),workspaceDidDeleteFiles:tS({method:"workspace/didDeleteFiles"}),notebookDocumentDidOpen:tS({method:"notebookDocument/didOpen"}),notebookDocumentDidChange:tS({method:"notebookDocument/didChange"}),notebookDocumentDidSave:tS({method:"notebookDocument/didSave"}),notebookDocumentDidClose:tS({method:"notebookDocument/didClose"}),initialized:tS({method:"initialized"}),exit:tS({method:"exit"}),workspaceDidChangeConfiguration:tS({method:"workspace/didChangeConfiguration"}),textDocumentDidOpen:tS({method:"textDocument/didOpen"}),textDocumentDidChange:tS({method:"textDocument/didChange"}),textDocumentDidClose:tS({method:"textDocument/didClose"}),textDocumentDidSave:tS({method:"textDocument/didSave"}),textDocumentWillSave:tS({method:"textDocument/willSave"}),workspaceDidChangeWatchedFiles:tS({method:"workspace/didChangeWatchedFiles"}),setTrace:tS({method:"$/setTrace"}),cancelRequest:tS({method:"$/cancelRequest"}),progress:tS({method:"$/progress"})},client:{workspaceWorkspaceFolders:tC({method:"workspace/workspaceFolders"}).optional(),workspaceConfiguration:tC({method:"workspace/configuration"}).optional(),workspaceFoldingRangeRefresh:tC({method:"workspace/foldingRange/refresh"}).optional(),windowWorkDoneProgressCreate:tC({method:"window/workDoneProgress/create"}).optional(),workspaceSemanticTokensRefresh:tC({method:"workspace/semanticTokens/refresh"}).optional(),windowShowDocument:tC({method:"window/showDocument"}).optional(),workspaceInlineValueRefresh:tC({method:"workspace/inlineValue/refresh"}).optional(),workspaceInlayHintRefresh:tC({method:"workspace/inlayHint/refresh"}).optional(),workspaceDiagnosticRefresh:tC({method:"workspace/diagnostic/refresh"}).optional(),clientRegisterCapability:tC({method:"client/registerCapability"}).optional(),clientUnregisterCapability:tC({method:"client/unregisterCapability"}).optional(),windowShowMessageRequest:tC({method:"window/showMessageRequest"}).optional(),workspaceCodeLensRefresh:tC({method:"workspace/codeLens/refresh"}).optional(),workspaceApplyEdit:tC({method:"workspace/applyEdit"}).optional(),windowShowMessage:tS({method:"window/showMessage"}),windowLogMessage:tS({method:"window/logMessage"}),telemetryEvent:tS({method:"telemetry/event"}),textDocumentPublishDiagnostics:tS({method:"textDocument/publishDiagnostics"}),logTrace:tS({method:"$/logTrace"}),cancelRequest:tS({method:"$/cancelRequest"}),progress:tS({method:"$/progress"})}}).server),o=tx(x.client),new tD(x.tags||[],r,o));function tV(e,t){if(e.textModel!==t)throw Error(`Expected text model to be ${t}, but got ${e.textModel}`);return e}var tB=(P=class{constructor(){te(this,"_store",new tG)}dispose(){this._store.dispose()}_register(e){if(e===this)throw Error("Cannot register a disposable on itself!");return this._store.add(e)}},te(P,"None",Object.freeze({dispose(){}})),P),tG=(I=class{constructor(){te(this,"_toDispose",new Set),te(this,"_isDisposed",!1)}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}clear(){if(0!==this._toDispose.size)try{for(let e of this._toDispose)e.dispose()}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw Error("Cannot register a disposable on itself!");return this._isDisposed?I.DISABLE_DISPOSED_WARNING||console.warn(Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}},te(I,"DISABLE_DISPOSED_WARNING",!1),I);let tQ=new Map([[tF.Empty,""],[tF.QuickFix,"quickfix"],[tF.Refactor,"refactor"],[tF.RefactorExtract,"refactor.extract"],[tF.RefactorInline,"refactor.inline"],[tF.RefactorRewrite,"refactor.rewrite"],[tF.Source,"source"],[tF.SourceOrganizeImports,"source.organizeImports"],[tF.SourceFixAll,"source.fixAll"]]),tJ=new Map([[eA.languages.CodeActionTriggerType.Invoke,tW.Invoked],[eA.languages.CodeActionTriggerType.Auto,tW.Automatic]]),tY=new Map([[tI.Text,eA.languages.CompletionItemKind.Text],[tI.Method,eA.languages.CompletionItemKind.Method],[tI.Function,eA.languages.CompletionItemKind.Function],[tI.Constructor,eA.languages.CompletionItemKind.Constructor],[tI.Field,eA.languages.CompletionItemKind.Field],[tI.Variable,eA.languages.CompletionItemKind.Variable],[tI.Class,eA.languages.CompletionItemKind.Class],[tI.Interface,eA.languages.CompletionItemKind.Interface],[tI.Module,eA.languages.CompletionItemKind.Module],[tI.Property,eA.languages.CompletionItemKind.Property],[tI.Unit,eA.languages.CompletionItemKind.Unit],[tI.Value,eA.languages.CompletionItemKind.Value],[tI.Enum,eA.languages.CompletionItemKind.Enum],[tI.Keyword,eA.languages.CompletionItemKind.Keyword],[tI.Snippet,eA.languages.CompletionItemKind.Snippet],[tI.Color,eA.languages.CompletionItemKind.Color],[tI.File,eA.languages.CompletionItemKind.File],[tI.Reference,eA.languages.CompletionItemKind.Reference],[tI.Folder,eA.languages.CompletionItemKind.Folder],[tI.EnumMember,eA.languages.CompletionItemKind.EnumMember],[tI.Constant,eA.languages.CompletionItemKind.Constant],[tI.Struct,eA.languages.CompletionItemKind.Struct],[tI.Event,eA.languages.CompletionItemKind.Event],[tI.Operator,eA.languages.CompletionItemKind.Operator],[tI.TypeParameter,eA.languages.CompletionItemKind.TypeParameter]]),tX=new Map([[tA.Deprecated,eA.languages.CompletionItemTag.Deprecated]]);function tZ(e){return tX.get(e)}let t0=new Map([[eA.languages.CompletionTriggerKind.Invoke,tH.Invoked],[eA.languages.CompletionTriggerKind.TriggerCharacter,tH.TriggerCharacter],[eA.languages.CompletionTriggerKind.TriggerForIncompleteCompletions,tH.TriggerForIncompleteCompletions]]),t1=new Map([[tM.Snippet,eA.languages.CompletionItemInsertTextRule.InsertAsSnippet]]),t2=new Map([[tk.File,eA.languages.SymbolKind.File],[tk.Module,eA.languages.SymbolKind.Module],[tk.Namespace,eA.languages.SymbolKind.Namespace],[tk.Package,eA.languages.SymbolKind.Package],[tk.Class,eA.languages.SymbolKind.Class],[tk.Method,eA.languages.SymbolKind.Method],[tk.Property,eA.languages.SymbolKind.Property],[tk.Field,eA.languages.SymbolKind.Field],[tk.Constructor,eA.languages.SymbolKind.Constructor],[tk.Enum,eA.languages.SymbolKind.Enum],[tk.Interface,eA.languages.SymbolKind.Interface],[tk.Function,eA.languages.SymbolKind.Function],[tk.Variable,eA.languages.SymbolKind.Variable],[tk.Constant,eA.languages.SymbolKind.Constant],[tk.String,eA.languages.SymbolKind.String],[tk.Number,eA.languages.SymbolKind.Number],[tk.Boolean,eA.languages.SymbolKind.Boolean],[tk.Array,eA.languages.SymbolKind.Array],[tk.Object,eA.languages.SymbolKind.Object],[tk.Key,eA.languages.SymbolKind.Key],[tk.Null,eA.languages.SymbolKind.Null],[tk.EnumMember,eA.languages.SymbolKind.EnumMember],[tk.Struct,eA.languages.SymbolKind.Struct],[tk.Event,eA.languages.SymbolKind.Event],[tk.Operator,eA.languages.SymbolKind.Operator],[tk.TypeParameter,eA.languages.SymbolKind.TypeParameter]]);function t6(e){return t2.get(e)??eA.languages.SymbolKind.File}let t3=new Map([[tT.Deprecated,eA.languages.SymbolTag.Deprecated]]),t4=new Map([[tL.Text,eA.languages.DocumentHighlightKind.Text],[tL.Read,eA.languages.DocumentHighlightKind.Read],[tL.Write,eA.languages.DocumentHighlightKind.Write]]),t5=new Map([[tE.Comment,eA.languages.FoldingRangeKind.Comment],[tE.Imports,eA.languages.FoldingRangeKind.Imports],[tE.Region,eA.languages.FoldingRangeKind.Region]]),t8=new Map([[eA.MarkerSeverity.Error,tN.Error],[eA.MarkerSeverity.Warning,tN.Warning],[eA.MarkerSeverity.Info,tN.Information],[eA.MarkerSeverity.Hint,tN.Hint]]),t7=new Map([[tN.Error,eA.MarkerSeverity.Error],[tN.Warning,eA.MarkerSeverity.Warning],[tN.Information,eA.MarkerSeverity.Info],[tN.Hint,eA.MarkerSeverity.Hint]]),t9=new Map([[t$.Unnecessary,eA.MarkerTag.Unnecessary],[t$.Deprecated,eA.MarkerTag.Deprecated]]),ie=new Map([[eA.languages.SignatureHelpTriggerKind.Invoke,tU.Invoked],[eA.languages.SignatureHelpTriggerKind.TriggerCharacter,tU.TriggerCharacter],[eA.languages.SignatureHelpTriggerKind.ContentChange,tU.ContentChange]]);function it(e){if(e)return{id:e.command,title:e.title,arguments:e.arguments}}let ii=new Map([[tR.Type,eA.languages.InlayHintKind.Type],[tR.Parameter,eA.languages.InlayHintKind.Parameter]]);function ir(e,t){if("targetUri"in e){let i=t.bridge.translateBackRange({uri:e.targetUri},e.targetRange);return{uri:i.textModel.uri,range:i.range,originSelectionRange:e.originSelectionRange?t.bridge.translateBackRange({uri:e.targetUri},e.originSelectionRange).range:void 0,targetSelectionRange:e.targetSelectionRange?t.bridge.translateBackRange({uri:e.targetUri},e.targetSelectionRange).range:void 0}}{let i=t.bridge.translateBackRange({uri:e.uri},e.range);return{uri:i.textModel.uri,range:i.range}}}function io(e){return e&&0!==e.length?e.map(e=>"notebook"in e?"string"==typeof e.notebook?{notebookType:e.notebook,language:e.language}:{notebookType:e.notebook.notebookType,language:e.language,pattern:e.notebook.pattern,scheme:e.notebook.scheme}:{language:e.language,pattern:e.pattern,scheme:e.scheme}):{language:"*"}}function is(e){var t;let i={severity:(t=e.severity)?t7.get(t)??eA.MarkerSeverity.Error:eA.MarkerSeverity.Error,startLineNumber:e.range.start.line+1,startColumn:e.range.start.character+1,endLineNumber:e.range.end.line+1,endColumn:e.range.end.character+1,message:e.message,source:e.source,code:"string"==typeof e.code?e.code:e.code?.toString()};return e.tags&&(i.tags=e.tags.map(e=>t9.get(e)).filter(e=>void 0!==e)),e.relatedInformation&&(i.relatedInformation=e.relatedInformation.map(e=>({resource:eA.Uri.parse(e.location.uri),startLineNumber:e.location.range.start.line+1,startColumn:e.location.range.start.character+1,endLineNumber:e.location.range.end.line+1,endColumn:e.location.range.end.character+1,message:e.message}))),i}var ia=class extends tB{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{completion:{dynamicRegistration:!0,contextSupport:!0,completionItemKind:{valueSet:Array.from(tY.keys())},completionItem:{tagSupport:{valueSet:Array.from(tX.keys())},commitCharactersSupport:!0,deprecatedSupport:!0,preselectSupport:!0}}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tz.textDocumentCompletion,!0,e=>eA.languages.registerCompletionItemProvider(io(e.documentSelector),new il(this._connection,e))))}},il=class{constructor(e,t){te(this,"resolveCompletionItem"),this._client=e,this._capabilities=t,t.resolveProvider&&(this.resolveCompletionItem=async(e,t)=>(ic(e,await this._client.server.completionItemResolve(e._lspItem),this._client.bridge,e._translated,e._model),e))}get triggerCharacters(){return this._capabilities.triggerCharacters}async provideCompletionItems(e,t,i,r){var o;let n=this._client.bridge.translate(e,t),s=await this._client.server.textDocumentCompletion({textDocument:n.textDocument,position:n.position,context:i.triggerCharacter?{triggerKind:(o=i.triggerKind,t0.get(o)??tH.Invoked),triggerCharacter:i.triggerCharacter}:void 0});return s?{suggestions:(Array.isArray(s)?s:s.items).map(i=>{var r,o,s,a,l,c;let d,u,h;return{...(r=i,o=this._client.bridge,s=n,a=e,l=t,u=r.insertText||r.label,r.textEdit&&("range"in r.textEdit?(u=r.textEdit.newText,d=tV(o.translateBackRange(s.textDocument,r.textEdit.range),a).range):(u=r.textEdit.newText,d={insert:tV(o.translateBackRange(s.textDocument,r.textEdit.insert),a).range,replace:tV(o.translateBackRange(s.textDocument,r.textEdit.replace),a).range})),d||(d=eA.Range.fromPositions(l,l)),ic(h={label:r.label,kind:(c=r.kind)?tY.get(c)??eA.languages.CompletionItemKind.Text:eA.languages.CompletionItemKind.Text,insertText:u,sortText:r.sortText,filterText:r.filterText,preselect:r.preselect,commitCharacters:r.commitCharacters,range:d},r,o,s,a),h),_lspItem:i,_translated:n,_model:e}})}:{suggestions:[]}}};function ic(e,t,i,r,o){void 0!==t.detail&&(e.detail=t.detail),void 0!==t.documentation&&(e.documentation=function(e){if(e)return"string"==typeof e?e:{value:e.value,isTrusted:!0}}(t.documentation)),void 0!==t.insertTextFormat&&(e.insertTextRules=function(e){if(e)return t1.get(e)}(t.insertTextFormat)),t.tags&&t.tags.length>0&&(e.tags=t.tags.map(tZ).filter(e=>void 0!==e)),t.additionalTextEdits&&t.additionalTextEdits.length>0&&(e.additionalTextEdits=t.additionalTextEdits.map(e=>({range:tV(i.translateBackRange(r.textDocument,e.range),o).range,text:e.newText}))),t.command&&(e.command=it(t.command))}var id=class extends tB{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{hover:{dynamicRegistration:!0,contentFormat:[tO.Markdown,tO.PlainText]}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tz.textDocumentHover,!0,e=>eA.languages.registerHoverProvider(io(e.documentSelector),new iu(this._connection,e))))}},iu=class{constructor(e,t){this._client=e,this._capabilities=t}async provideHover(e,t,i){var r;let o=this._client.bridge.translate(e,t),n=await this._client.server.textDocumentHover({textDocument:o.textDocument,position:o.position});return n&&n.contents?{contents:Array.isArray(r=n.contents)?r.map(e=>ih(e)):[ih(r)],range:n.range?this._client.bridge.translateBackRange(o.textDocument,n.range).range:void 0}:null}};function ih(e){return"string"==typeof e?{value:e,isTrusted:!0}:"kind"in e?{value:e.value,isTrusted:!0}:{value:`\`\`\`${e.language}
|
|
69
69
|
${e.value}
|
|
70
|
-
\`\`\``,isTrusted:!0}}var ii=class extends tN{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{signatureHelp:{dynamicRegistration:!0,contextSupport:!0,signatureInformation:{documentationFormat:[tE.Markdown,tE.PlainText],parameterInformation:{labelOffsetSupport:!0},activeParameterSupport:!0}}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tL.textDocumentSignatureHelp,!0,e=>eb.languages.registerSignatureHelpProvider(t3(e.documentSelector),new ir(this._connection,e))))}},ir=class{constructor(e,t){e0(this,"signatureHelpTriggerCharacters"),e0(this,"signatureHelpRetriggerCharacters"),this._client=e,this._capabilities=t,this.signatureHelpTriggerCharacters=t.triggerCharacters,this.signatureHelpRetriggerCharacters=t.retriggerCharacters}async provideSignatureHelp(e,t,i,r){var o;let n=this._client.bridge.translate(e,t),s=await this._client.server.textDocumentSignatureHelp({textDocument:n.textDocument,position:n.position,context:{triggerKind:(o=r.triggerKind,t0.get(o)??tP.Invoked),triggerCharacter:r.triggerCharacter,isRetrigger:r.isRetrigger}});return s?{value:{signatures:s.signatures.map(e=>({label:e.label,documentation:io(e.documentation),parameters:e.parameters?.map(e=>({label:e.label,documentation:io(e.documentation)}))||[],activeParameter:e.activeParameter})),activeSignature:s.activeSignature||0,activeParameter:s.activeParameter||0},dispose:()=>{}}:null}};function io(e){if(e)return"string"==typeof e?e:{value:e.value,isTrusted:!0}}var is=class extends tN{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{definition:{dynamicRegistration:!0,linkSupport:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tL.textDocumentDefinition,!0,e=>eb.languages.registerDefinitionProvider(t3(e.documentSelector),new ia(this._connection,e))))}},ia=class{constructor(e,t){this._client=e,this._capabilities=t}async provideDefinition(e,t,i){let r=this._client.bridge.translate(e,t),o=await this._client.server.textDocumentDefinition({textDocument:r.textDocument,position:r.position});return o?Array.isArray(o)?o.map(e=>t6(e,this._client)):t6(o,this._client):null}},il=class extends tN{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{declaration:{dynamicRegistration:!0,linkSupport:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tL.textDocumentDeclaration,!0,e=>eb.languages.registerDeclarationProvider(t3(e.documentSelector),new ic(this._connection,e))))}},ic=class{constructor(e,t){this._client=e,this._capabilities=t}async provideDeclaration(e,t,i){let r=this._client.bridge.translate(e,t),o=await this._client.server.textDocumentDeclaration({textDocument:r.textDocument,position:r.position});return o?Array.isArray(o)?o.map(e=>t6(e,this._client)):t6(o,this._client):null}},id=class extends tN{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{typeDefinition:{dynamicRegistration:!0,linkSupport:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tL.textDocumentTypeDefinition,!0,e=>eb.languages.registerTypeDefinitionProvider(t3(e.documentSelector),new iu(this._connection,e))))}},iu=class{constructor(e,t){this._client=e,this._capabilities=t}async provideTypeDefinition(e,t,i){let r=this._client.bridge.translate(e,t),o=await this._client.server.textDocumentTypeDefinition({textDocument:r.textDocument,position:r.position});return o?Array.isArray(o)?o.map(e=>t6(e,this._client)):t6(o,this._client):null}},ih=class extends tN{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{implementation:{dynamicRegistration:!0,linkSupport:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tL.textDocumentImplementation,!0,e=>eb.languages.registerImplementationProvider(t3(e.documentSelector),new ig(this._connection,e))))}},ig=class{constructor(e,t){this._client=e,this._capabilities=t}async provideImplementation(e,t,i){let r=this._client.bridge.translate(e,t),o=await this._client.server.textDocumentImplementation({textDocument:r.textDocument,position:r.position});return o?Array.isArray(o)?o.map(e=>t6(e,this._client)):t6(o,this._client):null}},ip=class extends tN{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{references:{dynamicRegistration:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tL.textDocumentReferences,!0,e=>eb.languages.registerReferenceProvider(t3(e.documentSelector),new im(this._connection,e))))}},im=class{constructor(e,t){this._client=e,this._capabilities=t}async provideReferences(e,t,i,r){let o=this._client.bridge.translate(e,t),n=await this._client.server.textDocumentReferences({textDocument:o.textDocument,position:o.position,context:{includeDeclaration:i.includeDeclaration}});return n?n.map(e=>{let t=this._client.bridge.translateBackRange({uri:e.uri},e.range);return{uri:t.textModel.uri,range:t.range}}):null}},iv=class extends tN{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{documentHighlight:{dynamicRegistration:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tL.textDocumentDocumentHighlight,!0,e=>eb.languages.registerDocumentHighlightProvider(t3(e.documentSelector),new i_(this._connection,e))))}},i_=class{constructor(e,t){this._client=e,this._capabilities=t}async provideDocumentHighlights(e,t,i){let r=this._client.bridge.translate(e,t),o=await this._client.server.textDocumentDocumentHighlight({textDocument:r.textDocument,position:r.position});return o?o.map(e=>{var t;return{range:this._client.bridge.translateBackRange(r.textDocument,e.range).range,kind:(t=e.kind)?tQ.get(t)??eb.languages.DocumentHighlightKind.Text:eb.languages.DocumentHighlightKind.Text}}):null}},iy=class extends tN{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{documentSymbol:{dynamicRegistration:!0,hierarchicalDocumentSymbolSupport:!0,symbolKind:{valueSet:Array.from(tV.keys())},tagSupport:{valueSet:[t_.Deprecated]}}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tL.textDocumentDocumentSymbol,!0,e=>eb.languages.registerDocumentSymbolProvider(t3(e.documentSelector),new iC(this._connection,e))))}},iC=class{constructor(e,t){this._client=e,this._capabilities=t}async provideDocumentSymbols(e,t){let i=this._client.bridge.translate(e,new eb.Position(1,1)),r=await this._client.server.textDocumentDocumentSymbol({textDocument:i.textDocument});if(!r)return null;if(Array.isArray(r)&&r.length>0)if("location"in r[0])return r.map(e=>{var t,i;return t=e,i=this._client,{name:t.name,detail:"",kind:tB(t.kind),tags:t.tags?.map(e=>tG.get(e)).filter(e=>void 0!==e)||[],range:i.bridge.translateBackRange({uri:t.location.uri},t.location.range).range,selectionRange:i.bridge.translateBackRange({uri:t.location.uri},t.location.range).range,children:[]}});else return r.map(e=>(function e(t,i,r){return{name:t.name,detail:t.detail||"",kind:tB(t.kind),tags:t.tags?.map(e=>tG.get(e)).filter(e=>void 0!==e)||[],range:i.bridge.translateBackRange(r,t.range).range,selectionRange:i.bridge.translateBackRange(r,t.selectionRange).range,children:t.children?.map(t=>e(t,i,r))||[]}})(e,this._client,i.textDocument));return[]}},iS=class extends tN{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{rename:{dynamicRegistration:!0,prepareSupport:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tL.textDocumentRename,!0,e=>eb.languages.registerRenameProvider(t3(e.documentSelector),new ib(this._connection,e))))}},ib=class{constructor(e,t){this._client=e,this._capabilities=t}async provideRenameEdits(e,t,i,r){let o=this._client.bridge.translate(e,t),n=await this._client.server.textDocumentRename({textDocument:o.textDocument,position:o.position,newName:i});return n?function(e,t){let i=[];if(e.changes)for(let r in e.changes)for(let o of e.changes[r]){let e=t.bridge.translateBackRange({uri:r},o.range);i.push({resource:e.textModel.uri,versionId:void 0,textEdit:{range:e.range,text:o.newText}})}if(e.documentChanges){for(let r of e.documentChanges)if("textDocument"in r){let e=r.textDocument.uri;for(let o of r.edits){let n=t.bridge.translateBackRange({uri:e},o.range);i.push({resource:n.textModel.uri,versionId:r.textDocument.version,textEdit:{range:n.range,text:o.newText}})}}}return{edits:i}}(n,this._client):null}async resolveRenameLocation(e,t,i){if(!this._capabilities.prepareProvider)return null;let r=this._client.bridge.translate(e,t),o=await this._client.server.textDocumentPrepareRename({textDocument:r.textDocument,position:r.position});if(!o)return null;if("range"in o&&"placeholder"in o)return{range:this._client.bridge.translateBackRange(r.textDocument,o.range).range,text:o.placeholder};if("defaultBehavior"in o);else if("start"in o&&"end"in o){let t=this._client.bridge.translateBackRange(r.textDocument,o).range;return{range:t,text:e.getValueInRange(t)}}return null}},iw=class extends tN{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{codeAction:{dynamicRegistration:!0,codeActionLiteralSupport:{codeActionKind:{valueSet:Array.from(tH.keys())}},isPreferredSupport:!0,disabledSupport:!0,dataSupport:!0,resolveSupport:{properties:["edit"]}}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tL.textDocumentCodeAction,!0,e=>eb.languages.registerCodeActionProvider(t3(e.documentSelector),new ix(this._connection,e))))}},ix=class{constructor(e,t){e0(this,"resolveCodeAction"),this._client=e,this._capabilities=t,t.resolveProvider&&(this.resolveCodeAction=async(e,t)=>{if(e._lspAction){let t=await this._client.server.codeActionResolve(e._lspAction);t.edit&&(e.edit=iD(t.edit,this._client)),t.command&&(e.command=t1(t.command))}return e})}async provideCodeActions(e,t,i,r){var o;let n=this._client.bridge.translate(e,t.getStartPosition()),s=await this._client.server.textDocumentCodeAction({textDocument:n.textDocument,range:this._client.bridge.translateRange(e,t),context:{diagnostics:i.markers.map(t=>{var i;return{range:this._client.bridge.translateRange(e,eb.Range.lift(t)),message:t.message,severity:(i=t.severity,tY.get(i)??tk.Error)}}),triggerKind:(o=i.trigger,tU.get(o)??tI.Invoked)}});return s?{actions:(Array.isArray(s)?s:[s]).map(e=>"title"in e&&!("kind"in e)?{title:e.title,command:t1(e)}:{title:e.title,kind:function(e){if(e)return tH.get(e)??e}(e.kind),isPreferred:e.isPreferred,disabled:e.disabled?.reason,edit:e.edit?iD(e.edit,this._client):void 0,command:t1(e.command),_lspAction:e}),dispose:()=>{}}:null}};function iD(e,t){let i=[];if(e.changes)for(let r in e.changes)for(let o of e.changes[r]){let e=t.bridge.translateBackRange({uri:r},o.range);i.push({resource:e.textModel.uri,versionId:void 0,textEdit:{range:e.range,text:o.newText}})}if(e.documentChanges){for(let r of e.documentChanges)if("textDocument"in r){let e=r.textDocument.uri;for(let o of r.edits){let n=t.bridge.translateBackRange({uri:e},o.range);i.push({resource:n.textModel.uri,versionId:r.textDocument.version??void 0,textEdit:{range:n.range,text:o.newText}})}}}return{edits:i}}var iE=class extends tN{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{codeLens:{dynamicRegistration:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tL.textDocumentCodeLens,!0,e=>eb.languages.registerCodeLensProvider(t3(e.documentSelector),new ik(this._connection,e))))}},ik=class{constructor(e,t){this._client=e,this._capabilities=t}async provideCodeLenses(e,t){let i=this._client.bridge.translate(e,new eb.Position(1,1)),r=await this._client.server.textDocumentCodeLens({textDocument:i.textDocument});return r?{lenses:r.map(t=>({range:tO(this._client.bridge.translateBackRange(i.textDocument,t.range),e).range,command:t1(t.command),_lspCodeLens:t})),dispose:()=>{}}:null}async resolveCodeLens(e,t,i){if(!this._capabilities.resolveProvider||!t._lspCodeLens)return t;let r=await this._client.server.codeLensResolve(t._lspCodeLens);return r.command&&(t.command={id:r.command.command,title:r.command.title,arguments:r.command.arguments}),t}},iT=class extends tN{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{documentLink:{dynamicRegistration:!0,tooltipSupport:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tL.textDocumentDocumentLink,!0,e=>eb.languages.registerLinkProvider(t3(e.documentSelector),new iR(this._connection,e))))}},iR=class{constructor(e,t){this._client=e,this._capabilities=t}async provideLinks(e,t){let i=this._client.bridge.translate(e,new eb.Position(1,1)),r=await this._client.server.textDocumentDocumentLink({textDocument:i.textDocument});return r?{links:r.map(e=>({range:this._client.bridge.translateBackRange(i.textDocument,e.range).range,url:e.target,tooltip:e.tooltip}))}:null}async resolveLink(e,t){return!this._capabilities.resolveProvider,e}},iP=class extends tN{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{formatting:{dynamicRegistration:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tL.textDocumentFormatting,!0,e=>eb.languages.registerDocumentFormattingEditProvider(t3(e.documentSelector),new iI(this._connection,e))))}},iI=class{constructor(e,t){this._client=e,this._capabilities=t}async provideDocumentFormattingEdits(e,t,i){let r=this._client.bridge.translate(e,new eb.Position(1,1)),o=await this._client.server.textDocumentFormatting({textDocument:r.textDocument,options:{tabSize:t.tabSize,insertSpaces:t.insertSpaces}});return o?o.map(e=>({range:this._client.bridge.translateBackRange(r.textDocument,e.range).range,text:e.newText})):null}},iA=class extends tN{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{rangeFormatting:{dynamicRegistration:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tL.textDocumentRangeFormatting,!0,e=>eb.languages.registerDocumentRangeFormattingEditProvider(t3(e.documentSelector),new iM(this._connection,e))))}},iM=class{constructor(e,t){this._client=e,this._capabilities=t}async provideDocumentRangeFormattingEdits(e,t,i,r){let o=this._client.bridge.translate(e,t.getStartPosition()),n=await this._client.server.textDocumentRangeFormatting({textDocument:o.textDocument,range:this._client.bridge.translateRange(e,t),options:{tabSize:i.tabSize,insertSpaces:i.insertSpaces}});return n?n.map(e=>({range:this._client.bridge.translateBackRange(o.textDocument,e.range).range,text:e.newText})):null}},iL=class extends tN{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{onTypeFormatting:{dynamicRegistration:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tL.textDocumentOnTypeFormatting,!0,e=>eb.languages.registerOnTypeFormattingEditProvider(t3(e.documentSelector),new iF(this._connection,e))))}},iF=class{constructor(e,t){e0(this,"autoFormatTriggerCharacters"),this._client=e,this._capabilities=t,this.autoFormatTriggerCharacters=[t.firstTriggerCharacter,...t.moreTriggerCharacter||[]]}async provideOnTypeFormattingEdits(e,t,i,r,o){let n=this._client.bridge.translate(e,t),s=await this._client.server.textDocumentOnTypeFormatting({textDocument:n.textDocument,position:n.position,ch:i,options:{tabSize:r.tabSize,insertSpaces:r.insertSpaces}});return s?s.map(e=>({range:this._client.bridge.translateBackRange(n.textDocument,e.range).range,text:e.newText})):null}},iO=class extends tN{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{foldingRange:{dynamicRegistration:!0,rangeLimit:5e3,lineFoldingOnly:!1,foldingRangeKind:{valueSet:[tf.Comment,tf.Imports,tf.Region]}}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tL.textDocumentFoldingRange,!0,e=>eb.languages.registerFoldingRangeProvider(t3(e.documentSelector),new iN(this._connection,e))))}},iN=class{constructor(e,t){this._client=e,this._capabilities=t}async provideFoldingRanges(e,t,i){let r=this._client.bridge.translate(e,new eb.Position(1,1)),o=await this._client.server.textDocumentFoldingRange({textDocument:r.textDocument});return o?o.map(e=>({start:e.startLine+1,end:e.endLine+1,kind:function(e){if(e)return tJ.get(e)}(e.kind)})):null}},i$=class extends tN{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{selectionRange:{dynamicRegistration:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tL.textDocumentSelectionRange,!0,e=>eb.languages.registerSelectionRangeProvider(t3(e.documentSelector),new iH(this._connection,e))))}},iH=class{constructor(e,t){this._client=e,this._capabilities=t}async provideSelectionRanges(e,t,i){let r=this._client.bridge.translate(e,t[0]),o=await this._client.server.textDocumentSelectionRange({textDocument:r.textDocument,positions:t.map(t=>this._client.bridge.translate(e,t).position)});return o?o.map(e=>this.convertSelectionRange(e,r.textDocument)):null}convertSelectionRange(e,t){let i=[],r=e;for(;r;)i.push({range:this._client.bridge.translateBackRange(t,r.range).range}),r=r.parent;return i}},iU=class extends tN{constructor(e){super(),e0(this,"_providers",new Set),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{inlayHint:{dynamicRegistration:!0,resolveSupport:{properties:["tooltip","textEdits","label.tooltip","label.location","label.command"]}}},workspace:{inlayHint:{refreshSupport:!0}}})),this._register(this._connection.connection.registerRequestHandler(tF.client.workspaceInlayHintRefresh,async()=>{for(let e of this._providers)e.refresh();return{ok:null}})),this._register(this._connection.capabilities.registerCapabilityHandler(tL.textDocumentInlayHint,!0,e=>{let t=new iW(this._connection,e);this._providers.add(t);let i=eb.languages.registerInlayHintsProvider(t3(e.documentSelector),t);return{dispose:()=>{this._providers.delete(t),i.dispose()}}}))}},iW=class{constructor(e,t){e0(this,"_onDidChangeInlayHints",new eb.Emitter),e0(this,"onDidChangeInlayHints",this._onDidChangeInlayHints.event),e0(this,"resolveInlayHint"),this._client=e,this._capabilities=t,t.resolveProvider&&(this.resolveInlayHint=async(e,t)=>{let i=await this._client.server.inlayHintResolve(e._lspInlayHint);return i.tooltip&&(e.tooltip=iz(i.tooltip)),i.label!==e._lspInlayHint.label&&(e.label=ij(i.label)),i.textEdits&&(e.textEdits=i.textEdits.map(t=>({range:this._client.bridge.translateBackRange({uri:e._targetUri},t.range).range,text:t.newText}))),e})}refresh(){this._onDidChangeInlayHints.fire()}async provideInlayHints(e,t,i){let r=this._client.bridge.translate(e,t.getStartPosition()),o=await iq(async()=>await this._client.server.textDocumentInlayHint({textDocument:r.textDocument,range:this._client.bridge.translateRange(e,t)}));return o?{hints:o.map(t=>{var i;return{label:ij(t.label),position:tO(this._client.bridge.translateBack(r.textDocument,t.position),e).position,kind:(i=t.kind)?t2.get(i)??eb.languages.InlayHintKind.Type:eb.languages.InlayHintKind.Type,tooltip:iz(t.tooltip),paddingLeft:t.paddingLeft,paddingRight:t.paddingRight,textEdits:t.textEdits?.map(t=>({range:tO(this._client.bridge.translateBackRange(r.textDocument,t.range),e).range,text:t.newText})),_lspInlayHint:t,_targetUri:r.textDocument.uri}}),dispose:()=>{}}:null}};async function iq(e){for(let t=3;;t--)try{return await e()}catch(e){if("content modified"===e.message&&t>0)continue;throw e}}function ij(e){return"string"==typeof e?e:e.map(e=>{let t={label:e.value,tooltip:iz(e.tooltip),command:t1(e.command)};return e.location&&(t.location={uri:eb.Uri.parse(e.location.uri),range:new eb.Range(e.location.range.start.line+1,e.location.range.start.character+1,e.location.range.end.line+1,e.location.range.end.character+1)}),t})}function iz(e){if(e)return"string"==typeof e?e:{value:e.value,isTrusted:!0}}var iK=class extends tN{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{semanticTokens:{dynamicRegistration:!0,requests:{range:!0,full:{delta:!0}},tokenTypes:["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","operator","decorator"],tokenModifiers:["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"],formats:[tA.Relative],overlappingTokenSupport:!1,multilineTokenSupport:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tL.textDocumentSemanticTokensFull,!0,e=>eb.languages.registerDocumentSemanticTokensProvider(t3(e.documentSelector),new iV(this._connection,e))))}},iV=class{constructor(e,t){this._client=e,this._capabilities=t}getLegend(){return{tokenTypes:this._capabilities.legend.tokenTypes,tokenModifiers:this._capabilities.legend.tokenModifiers}}releaseDocumentSemanticTokens(e){}async provideDocumentSemanticTokens(e,t,i){let r=this._client.bridge.translate(e,e.getPositionAt(0)),o=this._capabilities.full;if(t&&o&&"object"==typeof o&&o.delta){let e=await this._client.server.textDocumentSemanticTokensFullDelta({textDocument:r.textDocument,previousResultId:t});return e?"edits"in e?{resultId:e.resultId,edits:e.edits.map(e=>({start:e.start,deleteCount:e.deleteCount,data:e.data?new Uint32Array(e.data):void 0}))}:{resultId:e.resultId,data:new Uint32Array(e.data)}:null}let n=await this._client.server.textDocumentSemanticTokensFull({textDocument:r.textDocument});return n?{resultId:n.resultId,data:new Uint32Array(n.data)}:null}async provideDocumentSemanticTokensEdits(e,t,i){return this.provideDocumentSemanticTokens(e,t,i)}},iB=class extends tN{constructor(e){super(),e0(this,"_diagnosticsMarkerOwner","lsp"),e0(this,"_pullDiagnosticProviders",new Map),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{publishDiagnostics:{relatedInformation:!0,tagSupport:{valueSet:[...tZ.keys()]},versionSupport:!0,codeDescriptionSupport:!0,dataSupport:!0},diagnostic:{dynamicRegistration:!0,relatedDocumentSupport:!0}}})),this._register(this._connection.connection.registerNotificationHandler(tF.client.textDocumentPublishDiagnostics,e=>this._handlePublishDiagnostics(e))),this._register(this._connection.capabilities.registerCapabilityHandler(tL.textDocumentDiagnostic,!0,e=>{let t=new t$;for(let i of eb.editor.getModels())this._addPullDiagnosticProvider(i,e,t);return t.add(eb.editor.onDidCreateModel(i=>{this._addPullDiagnosticProvider(i,e,t)})),t}))}_addPullDiagnosticProvider(e,t,i){if(e.getLanguageId(),!function(e,t){if(!t)return!0;let i=e.getLanguageId();if(e.uri.toString(!0),!t||0===t.length)return!0;for(let e of t)if(!e.language||"*"===e.language||e.language===i)return!0;return!1}(e,t.documentSelector))return;let r=new iG(e,this._connection,this._diagnosticsMarkerOwner,t);this._pullDiagnosticProviders.set(e,r),i.add(r),i.add(e.onWillDispose(()=>{this._pullDiagnosticProviders.delete(e)}))}_handlePublishDiagnostics(e){let t=e.uri;try{let i=this._connection.bridge.translateBack({uri:t},{line:0,character:0}).textModel;if(!i||i.isDisposed())return;let r=e.diagnostics.map(e=>t4(e));eb.editor.setModelMarkers(i,this._diagnosticsMarkerOwner,r)}catch(e){console.debug(`Could not set diagnostics for ${t}:`,e)}}},iG=class extends tN{constructor(e,t,i,r){super(),e0(this,"_updateHandle"),e0(this,"_previousResultId"),this._model=e,this._connection=t,this._markerOwner=i,this._capability=r,this._register(this._model.onDidChangeContent(()=>{this._scheduleDiagnosticUpdate()})),this._scheduleDiagnosticUpdate()}_scheduleDiagnosticUpdate(){void 0!==this._updateHandle&&clearTimeout(this._updateHandle),this._updateHandle=window.setTimeout(()=>{this._updateHandle=void 0,this._requestDiagnostics()},500)}async _requestDiagnostics(){if(!this._model.isDisposed())try{let e=this._connection.bridge.translate(this._model,new eb.Position(1,1)),t=await this._connection.server.textDocumentDiagnostic({textDocument:e.textDocument,identifier:this._capability.identifier,previousResultId:this._previousResultId});if(this._model.isDisposed())return;this._handleDiagnosticReport(t)}catch(e){console.error("Error requesting diagnostics:",e)}}_handleDiagnosticReport(e){if("full"===e.kind){this._previousResultId=e.resultId;let t=e.items.map(e=>t4(e));eb.editor.setModelMarkers(this._model,this._markerOwner,t),"relatedDocuments"in e&&e.relatedDocuments&&this._handleRelatedDocuments(e.relatedDocuments)}else"unchanged"===e.kind&&(this._previousResultId=e.resultId)}_handleRelatedDocuments(e){for(let[t,i]of Object.entries(e))try{let e=this._connection.bridge.translateBack({uri:t},{line:0,character:0}).textModel;if(!e||e.isDisposed())continue;if("full"===i.kind){let t=i.items.map(e=>t4(e));eb.editor.setModelMarkers(e,this._markerOwner,t)}}catch(e){console.debug(`Could not set related diagnostics for ${t}:`,e)}}dispose(){void 0!==this._updateHandle&&(clearTimeout(this._updateHandle),this._updateHandle=void 0),super.dispose()}},iQ=class{constructor(e,t,i,r){this.server=e,this.bridge=t,this.capabilities=i,this.connection=r}},iJ=class extends tN{constructor(e){super(),e0(this,"_staticCapabilities",new Set),e0(this,"_dynamicFromStatic",i2.create()),e0(this,"_registrations",new Map),e0(this,"_serverCapabilities"),this._connection=e,this._register(this._connection.registerRequestHandler(tF.client.clientRegisterCapability,async e=>{for(let t of e.registrations){let e=i0(t.method),i=new iX(t.id,e,t.registerOptions,!1);this._registerCapabilityOptions(i)}return{ok:null}})),this._register(this._connection.registerRequestHandler(tF.client.clientUnregisterCapability,async e=>{for(let t of e.unregisterations){let e=i0(t.method),i=this._registrations.get(e),r=i?.registrations.get(t.id);if(!r)throw Error(`No registration for method ${t.method} with id ${t.id}`);r?.handlerDisposables.forEach(e=>e.dispose()),i?.registrations.delete(t.id)}return{ok:null}}))}_registerCapabilityOptions(e){let t=this._registrations.get(e.capability);if(t||(t=new i1,this._registrations.set(e.capability,t)),t.registrations.has(e.id))throw Error(`Handler for method ${e.capability.method} with id ${e.id} already registered`);for(let i of(t.registrations.set(e.id,e),t.handlers))(i.handleStaticCapability||!e.isFromStatic)&&e.handlerDisposables.set(i,i.handler(e.options))}setServerCapabilities(e){if(this._serverCapabilities)throw Error("Server capabilities already set");for(let t of(this._serverCapabilities=e,Object.values(tL))){let i=this._dynamicFromStatic.getOptions(t,e);i&&this._registerCapabilityOptions(new iX(t.method,t,i,!0))}}getClientCapabilities(){let e={};for(let t of this._staticCapabilities)!function e(t,i){for(let r of Object.keys(i)){let o=i[r];if(void 0===o)continue;let n=t[r];if(void 0===n||"object"!=typeof o||null===o||"object"!=typeof n||null===n){t[r]=o;continue}e(n,o)}}(e,t.cap);return e}addStaticClientCapabilities(e){let t={cap:e};return this._staticCapabilities.add(t),{dispose:()=>{this._staticCapabilities.delete(t)}}}registerCapabilityHandler(e,t,i){let r=this._registrations.get(e);r||(r=new i1,this._registrations.set(e,r));let o=new iY(e,t,i);for(let e of(r.handlers.add(o),r.registrations.values()))(o.handleStaticCapability||!e.isFromStatic)&&e.handlerDisposables.set(o,i(e.options));return{dispose:()=>{for(let e of(r.handlers.delete(o),r.registrations.values())){let t=e.handlerDisposables.get(o);t&&(t.dispose(),e.handlerDisposables.delete(o))}}}}},iY=class{constructor(e,t,i){this.capability=e,this.handleStaticCapability=t,this.handler=i}},iX=class{constructor(e,t,i,r){e0(this,"handlerDisposables",new Map),this.id=e,this.capability=t,this.options=i,this.isFromStatic=r}};let iZ=new Map([...Object.values(tL)].map(e=>[e.method,e]));function i0(e){let t=iZ.get(e);if(!t)throw Error(`No capability found for method ${e}`);return t}var i1=class{constructor(){e0(this,"handlers",new Set),e0(this,"registrations",new Map)}},i2=class e{constructor(){e0(this,"_mappings",new Map)}static create(){let t=new e;return t.set(tL.textDocumentDidChange,e=>{if(void 0!==e.textDocumentSync)if("object"==typeof e.textDocumentSync)return{syncKind:e.textDocumentSync.change??tC.None,documentSelector:null};else return{syncKind:e.textDocumentSync,documentSelector:null}}),t.set(tL.textDocumentCompletion,e=>e.completionProvider),t.set(tL.textDocumentHover,e=>e.hoverProvider),t.set(tL.textDocumentSignatureHelp,e=>e.signatureHelpProvider),t.set(tL.textDocumentDefinition,e=>e.definitionProvider),t.set(tL.textDocumentReferences,e=>e.referencesProvider),t.set(tL.textDocumentDocumentHighlight,e=>e.documentHighlightProvider),t.set(tL.textDocumentDocumentSymbol,e=>e.documentSymbolProvider),t.set(tL.textDocumentCodeAction,e=>e.codeActionProvider),t.set(tL.textDocumentCodeLens,e=>e.codeLensProvider),t.set(tL.textDocumentDocumentLink,e=>e.documentLinkProvider),t.set(tL.textDocumentFormatting,e=>e.documentFormattingProvider),t.set(tL.textDocumentRangeFormatting,e=>e.documentRangeFormattingProvider),t.set(tL.textDocumentOnTypeFormatting,e=>e.documentOnTypeFormattingProvider),t.set(tL.textDocumentRename,e=>e.renameProvider),t.set(tL.textDocumentFoldingRange,e=>e.foldingRangeProvider),t.set(tL.textDocumentDeclaration,e=>e.declarationProvider),t.set(tL.textDocumentTypeDefinition,e=>e.typeDefinitionProvider),t.set(tL.textDocumentImplementation,e=>e.implementationProvider),t.set(tL.textDocumentDocumentColor,e=>e.colorProvider),t.set(tL.textDocumentSelectionRange,e=>e.selectionRangeProvider),t.set(tL.textDocumentLinkedEditingRange,e=>e.linkedEditingRangeProvider),t.set(tL.textDocumentPrepareCallHierarchy,e=>e.callHierarchyProvider),t.set(tL.textDocumentSemanticTokensFull,e=>e.semanticTokensProvider),t.set(tL.textDocumentInlayHint,e=>e.inlayHintProvider),t.set(tL.textDocumentInlineValue,e=>e.inlineValueProvider),t.set(tL.textDocumentDiagnostic,e=>e.diagnosticProvider),t.set(tL.textDocumentMoniker,e=>e.monikerProvider),t.set(tL.textDocumentPrepareTypeHierarchy,e=>e.typeHierarchyProvider),t.set(tL.workspaceSymbol,e=>e.workspaceSymbolProvider),t.set(tL.workspaceExecuteCommand,e=>e.executeCommandProvider),t}set(e,t){if(this._mappings.has(e.method))throw Error(`Capability for method ${e.method} already registered`);this._mappings.set(e.method,t)}getOptions(e,t){let i=this._mappings.get(e.method);if(i)return i(t)}},i6=class extends tN{constructor(e,t){super(),e0(this,"_managedModels",new Map),e0(this,"_managedModelsReverse",new Map),e0(this,"_started",!1),this._server=e,this._capabilities=t,this._register(this._capabilities.addStaticClientCapabilities({textDocument:{synchronization:{dynamicRegistration:!0,willSave:!1,willSaveWaitUntil:!1,didSave:!1}}})),this._register(t.registerCapabilityHandler(tL.textDocumentDidChange,!0,e=>{if(this._started)return{dispose:()=>{}};for(let e of(this._started=!0,this._register(eb.editor.onDidCreateModel(e=>{this._getOrCreateManagedModel(e)})),eb.editor.getModels()))this._getOrCreateManagedModel(e);return{dispose:()=>{}}}))}_getOrCreateManagedModel(e){if(!this._started)throw Error("Not started");let t=e.uri.toString(!0).toLowerCase(),i=this._managedModels.get(e);return i||(i=new i3(e,this._server),this._managedModels.set(e,i),this._managedModelsReverse.set(t,e)),e.onWillDispose(()=>{i.dispose(),this._managedModels.delete(e),this._managedModelsReverse.delete(t)}),i}translateBack(e,t){let i=e.uri.toLowerCase(),r=this._managedModelsReverse.get(i);if(!r)throw Error(`No text model for uri ${i}`);return{textModel:r,position:new eb.Position(t.line+1,t.character+1)}}translateBackRange(e,t){let i=e.uri.toLowerCase(),r=this._managedModelsReverse.get(i);if(!r)throw Error(`No text model for uri ${i}`);return{textModel:r,range:new eb.Range(t.start.line+1,t.start.character+1,t.end.line+1,t.end.character+1)}}translate(e,t){return{textDocument:{uri:e.uri.toString(!0)},position:{line:t.lineNumber-1,character:t.column-1}}}translateRange(e,t){return{start:{line:t.startLineNumber-1,character:t.startColumn-1},end:{line:t.endLineNumber-1,character:t.endColumn-1}}}},i3=class extends tN{constructor(e,t){super(),this._textModel=e,this._api=t;const i=e.uri.toString(!0).toLowerCase();this._api.textDocumentDidOpen({textDocument:{languageId:e.getLanguageId(),uri:i,version:e.getVersionId(),text:e.getValue()}}),this._register(e.onDidChangeContent(t=>{let r=t.changes.map(e=>{var t,i;return{range:{start:{line:(i=(t=e).range).startLineNumber-1,character:i.startColumn-1},end:{line:i.endLineNumber-1,character:i.endColumn-1}},rangeLength:t.rangeLength,text:t.text}});this._api.textDocumentDidChange({textDocument:{uri:i,version:e.getVersionId()},contentChanges:r})})),this._register({dispose:()=>{this._api.textDocumentDidClose({textDocument:{uri:i}})}})}},i4=class{constructor(e){e0(this,"_connection"),e0(this,"_capabilitiesRegistry"),e0(this,"_bridge"),e0(this,"_initPromise");const t=tn.fromTransport(e),i=tF.getServer(t,{});t.startListen(),this._capabilitiesRegistry=new iJ(t),this._bridge=new i6(i.server,this._capabilitiesRegistry),this._connection=new iQ(i.server,this._bridge,this._capabilitiesRegistry,t),this.createFeatures(),this._initPromise=this._init()}async _init(){let e=await this._connection.server.initialize({processId:null,capabilities:this._capabilitiesRegistry.getClientCapabilities(),rootUri:null});this._connection.server.initialized({}),this._capabilitiesRegistry.setServerCapabilities(e.capabilities)}createFeatures(){let e=new t$;return e.add(new t5(this._connection)),e.add(new t9(this._connection)),e.add(new ii(this._connection)),e.add(new is(this._connection)),e.add(new il(this._connection)),e.add(new id(this._connection)),e.add(new ih(this._connection)),e.add(new ip(this._connection)),e.add(new iv(this._connection)),e.add(new iy(this._connection)),e.add(new iS(this._connection)),e.add(new iw(this._connection)),e.add(new iE(this._connection)),e.add(new iT(this._connection)),e.add(new iP(this._connection)),e.add(new iA(this._connection)),e.add(new iL(this._connection)),e.add(new iO(this._connection)),e.add(new i$(this._connection)),e.add(new iU(this._connection)),e.add(new iK(this._connection)),e.add(new iB(this._connection)),e}},i5=null,i8=i5="u">typeof WebSocket?WebSocket:"u">typeof MozWebSocket?MozWebSocket:e.g.WebSocket||e.g.MozWebSocket,i7=class e extends e8{constructor(e){super(),e0(this,"socket"),e0(this,"errorEmitter",new e6),e0(this,"onError",this.errorEmitter),this.socket=e,e.onmessage=e=>{try{let t=e.data;if("string"==typeof t){let e=JSON.parse(t);this._dispatchReceivedMessage(e)}else throw Error("Not supported")}catch(e){this.errorEmitter.fire({error:e})}},e.onclose=e=>{this._onConnectionClosed()}}static connectTo(t){let i=new i8(("host"in t?{address:`${t.forceTls?"wss":"ws"}://${t.host}:${t.port}`}:t).address);return new Promise((t,r)=>{i.onerror=e=>{r(e)},i.onopen=()=>{t(new e(i))}})}static fromWebSocket(t){return new e(t)}close(){this.socket.close()}dispose(){this.close()}_sendImpl(e){let t=JSON.stringify(e);return new Promise((e,i)=>{this.socket.send(t,t=>{t?i(t):e()})})}toString(){return`${this.id}@${this.socket.url}`}},i9=class extends e8{constructor(e,t,i){super(),e0(this,"_windowLike"),e0(this,"_source"),e0(this,"_loadingState"),e0(this,"_disposed",!1),e0(this,"_messageHandler",({data:e,source:t})=>{(!this._source||t===this._source)&&"object"==typeof e&&e&&this._dispatchReceivedMessage(e)}),this._windowLike=e,this._source=t,this._loadingState=i,this._windowLike.addEventListener("message",this._messageHandler)}async _sendImpl(e){if(this._disposed)throw Error("Transport is disposed");this._loadingState&&!this._loadingState.loaded&&await this._loadingState.onLoaded,this._windowLike.postMessage(e)}toString(){return`${this.id}@${this._windowLike}`}dispose(){this._disposed||(this._disposed=!0,this._windowLike.removeEventListener("message",this._messageHandler))}};e.s(["MonacoLspClient",0,i4,"WebSocketTransport",0,i7,"createTransportToIFrame",0,function(e){if("u"<typeof window)throw Error("call this function from the main browser thread");return new i9(e.contentWindow,e.contentWindow,{loaded:"complete"===window.document.readyState,onLoaded:new Promise(e=>{window.addEventListener("load",()=>e())})})},"createTransportToWorker",0,function(e){if("u"<typeof window)throw Error("call this function from the main browser thread");return new i9(e)}],733757),e.i(733757),e.i(120276);let re=globalThis.MonacoEnvironment;re?.globalAPI&&(globalThis.monaco=eb),eb.languages.css=eP,eb.languages.html=ez,eb.languages.typescript=eG,eb.languages.json=eB;let rt=new Map;function ri(e,t,i){return i?eb.Uri.file(`${i.replace(/\/+$/,"")}/${t}`):eb.Uri.parse(`file:///workspace/${e}/${t}`)}var rr=e.i(185966);class ro extends rr.BaseLanguageClient{messageTransports;constructor({id:e,name:t,clientOptions:i,messageTransports:r}){super(e??t.toLowerCase(),t,i),this.messageTransports=r}createMessageTransports(e){return Promise.resolve(this.messageTransports)}}var rn=e.i(861593),rs=e.i(69150),ra=e.i(840969),rl=e.i(654295),rc=e.i(865562),rd=e.i(611130),ru=e.i(693205),rh=e.i(802136),rg=e.i(798237),rp=e.i(478697),rm=e.i(79522),rf=e.i(347470);class rv extends rf.EditorWorkerClient{constructor(e,t,i){super(i.worker,i.keepIdleModels||!1,e,t),this._foreignModuleHost=i.host||null,this._foreignProxy=this._getProxy().then(e=>new Proxy({},{get(t,i,r){if("then"!==i){if("string"!=typeof i)throw Error("Not supported");if("then"!==i)return(...t)=>e.$fmr(i,t)}}}))}fhr(e,t){if(!this._foreignModuleHost||"function"!=typeof this._foreignModuleHost[e])return Promise.reject(Error("Missing method "+e+" or missing main thread foreign host."));try{return Promise.resolve(this._foreignModuleHost[e].apply(this._foreignModuleHost,t))}catch(e){return Promise.reject(e)}}getProxy(){return this._foreignProxy}withSyncedResources(e){return this.workerWithSyncedResources(e).then(e=>this.getProxy())}}var r_=e.i(130772),ry=e.i(604634),rC=e.i(600345),rS=e.i(772649),rb=e.i(58762),rw=e.i(429200),rx=e.i(305638),rD=e.i(98342),rE=e.i(326659),rk=e.i(49583),rT=e.i(20848),rR=e.i(561295),rP=e.i(830598),rI=e.i(746244),rA=e.i(343840),rM=e.i(281482),rL=rd;function rF(e){return"string"==typeof e}(D=F||(F={}))[D.None=0]="None",D[D.Open=1]="Open",D[D.Close=-1]="Close";function rO(e,t){return e.ignoreCase&&t?t.toLowerCase():t}function rN(e){return e.replace(/[&<>'"_]/g,"-")}function r$(e,t){return Error(`${e.languageId}: ${t}`)}function rH(e,t,i,r,o){let n=null;return t.replace(/\$((\$)|(#)|(\d\d?)|[sS](\d\d?)|@(\w+))/g,function(t,s,a,l,c,d,u,h,g){return a?"$":l?rO(e,i):c&&c<r.length?rO(e,r[c]):u&&e&&"string"==typeof e[u]?e[u]:(null===n&&(n=o.split(".")).unshift(o),d&&d<n.length)?rO(e,n[d]):""})}function rU(e,t){let i=t;for(;i&&i.length>0;){let t=e.tokenizer[i];if(t)return t;let r=i.lastIndexOf(".");i=r<0?null:i.substr(0,r)}return null}var rW=e.i(731931);class rq{static{this._INSTANCE=new rq(5)}static create(e,t){return this._INSTANCE.create(e,t)}constructor(e){this._maxCacheDepth=e,this._entries=Object.create(null)}create(e,t){if(null!==e&&e.depth>=this._maxCacheDepth)return new rj(e,t);let i=rj.getStackElementId(e);i.length>0&&(i+="|"),i+=t;let r=this._entries[i];return r||(r=new rj(e,t),this._entries[i]=r),r}}class rj{constructor(e,t){this.parent=e,this.state=t,this.depth=(this.parent?this.parent.depth:0)+1}static getStackElementId(e){let t="";for(;null!==e;)t.length>0&&(t+="|"),t+=e.state,e=e.parent;return t}static _equals(e,t){for(;null!==e&&null!==t;){if(e===t)return!0;if(e.state!==t.state)return!1;e=e.parent,t=t.parent}return null===e&&null===t}equals(e){return rj._equals(this,e)}push(e){return rq.create(this,e)}pop(){return this.parent}popall(){let e=this;for(;e.parent;)e=e.parent;return e}switchTo(e){return rq.create(this.parent,e)}}class rz{constructor(e,t){this.languageId=e,this.state=t}equals(e){return this.languageId===e.languageId&&this.state.equals(e.state)}clone(){return this.state.clone()===this.state?this:new rz(this.languageId,this.state)}}class rK{static{this._INSTANCE=new rK(5)}static create(e,t){return this._INSTANCE.create(e,t)}constructor(e){this._maxCacheDepth=e,this._entries=Object.create(null)}create(e,t){if(null!==t||null!==e&&e.depth>=this._maxCacheDepth)return new rV(e,t);let i=rj.getStackElementId(e),r=this._entries[i];return r||(r=new rV(e,null),this._entries[i]=r),r}}class rV{constructor(e,t){this.stack=e,this.embeddedLanguageData=t}clone(){return(this.embeddedLanguageData?this.embeddedLanguageData.clone():null)===this.embeddedLanguageData?this:rK.create(this.stack,this.embeddedLanguageData)}equals(e){return e instanceof rV&&!!this.stack.equals(e.stack)&&(null===this.embeddedLanguageData&&null===e.embeddedLanguageData||null!==this.embeddedLanguageData&&null!==e.embeddedLanguageData&&this.embeddedLanguageData.equals(e.embeddedLanguageData))}}class rB{constructor(){this._tokens=[],this._languageId=null,this._lastTokenType=null,this._lastTokenLanguage=null}enterLanguage(e){this._languageId=e}emit(e,t){(this._lastTokenType!==t||this._lastTokenLanguage!==this._languageId)&&(this._lastTokenType=t,this._lastTokenLanguage=this._languageId,this._tokens.push(new rS.Token(e,t,this._languageId)))}nestedLanguageTokenize(e,t,i,r){let o=i.languageId,n=i.state,s=rS.TokenizationRegistry.get(o);if(!s)return this.enterLanguage(o),this.emit(r,""),n;let a=s.tokenize(e,t,n);if(0!==r)for(let e of a.tokens)this._tokens.push(new rS.Token(e.offset+r,e.type,e.language));else this._tokens=this._tokens.concat(a.tokens);return this._lastTokenType=null,this._lastTokenLanguage=null,this._languageId=null,a.endState}finalize(e){return new rS.TokenizationResult(this._tokens,e)}}class rG{constructor(e,t){this._languageService=e,this._theme=t,this._prependTokens=null,this._tokens=[],this._currentLanguageId=rR.LanguageId.Null,this._lastTokenMetadata=0}enterLanguage(e){this._currentLanguageId=this._languageService.languageIdCodec.encodeLanguageId(e)}emit(e,t){let i=this._theme.match(this._currentLanguageId,t)|rR.MetadataConsts.BALANCED_BRACKETS_MASK;this._lastTokenMetadata!==i&&(this._lastTokenMetadata=i,this._tokens.push(e),this._tokens.push(i))}static _merge(e,t,i){let r=null!==e?e.length:0,o=t.length,n=null!==i?i.length:0;if(0===r&&0===o&&0===n)return new Uint32Array(0);if(0===r&&0===o)return i;if(0===o&&0===n)return e;let s=new Uint32Array(r+o+n);null!==e&&s.set(e);for(let e=0;e<o;e++)s[r+e]=t[e];return null!==i&&s.set(i,r+o),s}nestedLanguageTokenize(e,t,i,r){let o=i.languageId,n=i.state,s=rS.TokenizationRegistry.get(o);if(!s)return this.enterLanguage(o),this.emit(r,""),n;let a=s.tokenizeEncoded(e,t,n);if(0!==r)for(let e=0,t=a.tokens.length;e<t;e+=2)a.tokens[e]+=r;return this._prependTokens=rG._merge(this._prependTokens,this._tokens,a.tokens),this._tokens=[],this._currentLanguageId=0,this._lastTokenMetadata=0,a.endState}finalize(e){return new rS.EncodedTokenizationResult(rG._merge(this._prependTokens,this._tokens,null),[],e)}}let rQ=O=class extends rL.Disposable{constructor(e,t,i,r,o){super(),this._configurationService=o,this._languageService=e,this._standaloneThemeService=t,this._languageId=i,this._lexer=r,this._embeddedLanguages=Object.create(null),this.embeddedLoaded=Promise.resolve(void 0);let n=!1;this._register(rS.TokenizationRegistry.onDidChange(e=>{if(n)return;let t=!1;for(let i=0,r=e.changedLanguages.length;i<r;i++){let r=e.changedLanguages[i];if(this._embeddedLanguages[r]){t=!0;break}}t&&(n=!0,rS.TokenizationRegistry.handleChange([this._languageId]),n=!1)})),this._maxTokenizationLineLength=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:this._languageId}),this._register(this._configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("editor.maxTokenizationLineLength")&&(this._maxTokenizationLineLength=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:this._languageId}))}))}getLoadStatus(){let e=[];for(let t in this._embeddedLanguages){let i=rS.TokenizationRegistry.get(t);if(i){if(i instanceof O){let t=i.getLoadStatus();!1===t.loaded&&e.push(t.promise)}continue}rS.TokenizationRegistry.isResolved(t)||e.push(rS.TokenizationRegistry.getOrCreate(t))}return 0===e.length?{loaded:!0}:{loaded:!1,promise:Promise.all(e).then(e=>void 0)}}getInitialState(){let e=rq.create(null,this._lexer.start);return rK.create(e,null)}tokenize(e,t,i){if(e.length>=this._maxTokenizationLineLength)return(0,rx.nullTokenize)(this._languageId,i);let r=new rB,o=this._tokenize(e,t,i,r);return r.finalize(o)}tokenizeEncoded(e,t,i){if(e.length>=this._maxTokenizationLineLength)return(0,rx.nullTokenizeEncoded)(this._languageService.languageIdCodec.encodeLanguageId(this._languageId),i);let r=new rG(this._languageService,this._standaloneThemeService.getColorTheme().tokenTheme),o=this._tokenize(e,t,i,r);return r.finalize(o)}_tokenize(e,t,i,r){return i.embeddedLanguageData?this._nestedTokenize(e,t,i,0,r):this._myTokenize(e,t,i,0,r)}_findLeavingNestedLanguageOffset(e,t){let i=this._lexer.tokenizer[t.stack.state];if(!i&&!(i=rU(this._lexer,t.stack.state)))throw r$(this._lexer,"tokenizer state is not defined: "+t.stack.state);let r=-1,o=!1;for(let n of i){if(rF(n.action)||!("@pop"===n.action.nextEmbedded||n.action.hasEmbeddedEndInCases))continue;o=!0;let i=n.resolveRegex(t.stack.state),s=i.source;if("^(?:"===s.substr(0,4)&&")"===s.substr(s.length-1,1)){let e=(i.ignoreCase?"i":"")+(i.unicode?"u":"");i=new RegExp(s.substr(4,s.length-5),e)}let a=e.search(i);-1!==a&&(0===a||!n.matchOnlyAtLineStart)&&(-1===r||a<r)&&(r=a)}if(!o)throw r$(this._lexer,'no rule containing nextEmbedded: "@pop" in tokenizer embedded state: '+t.stack.state);return r}_nestedTokenize(e,t,i,r,o){let n=this._findLeavingNestedLanguageOffset(e,i);if(-1===n){let n=o.nestedLanguageTokenize(e,t,i.embeddedLanguageData,r);return rK.create(i.stack,new rz(i.embeddedLanguageData.languageId,n))}let s=e.substring(0,n);s.length>0&&o.nestedLanguageTokenize(s,!1,i.embeddedLanguageData,r);let a=e.substring(n);return this._myTokenize(a,t,i,r+n,o)}_safeRuleName(e){return e?e.name:"(unknown)"}_myTokenize(e,t,i,r,o){o.enterLanguage(this._languageId);let n=e.length,s=t&&this._lexer.includeLF?e+"\n":e,a=s.length,l=i.embeddedLanguageData,c=i.stack,d=0,u=null,h=!0;for(;h||d<a;){let i=d,m=c.depth,f=u?u.groups.length:0,_=c.state,y=null,C=null,S=null,b=null,w=null;if(u){y=u.matches;let e=u.groups.shift();C=e.matched,S=e.action,b=u.rule,0===u.groups.length&&(u=null)}else{if(!h&&d>=a)break;h=!1;let e=this._lexer.tokenizer[_];if(!e&&!(e=rU(this._lexer,_)))throw r$(this._lexer,"tokenizer state is not defined: "+_);let t=s.substr(d);for(let i of e)if((0===d||!i.matchOnlyAtLineStart)&&(y=t.match(i.resolveRegex(_)))){C=y[0],S=i.action;break}}if(y||(y=[""],C=""),S||(d<a&&(C=(y=[s.charAt(d)])[0]),S=this._lexer.defaultToken),null===C)break;for(d+=C.length;!Array.isArray(S)&&!rF(S)&&S.test;)S=S.test(C,y,_,d===a);let x=null;if("string"==typeof S||Array.isArray(S))x=S;else if(S.group)x=S.group;else if(null!==S.token&&void 0!==S.token){var g,p;if(x=S.tokenSubst?rH(this._lexer,S.token,C,y,_):S.token,S.nextEmbedded)if("@pop"===S.nextEmbedded){if(!l)throw r$(this._lexer,"cannot pop embedded language if not inside one");l=null}else if(l)throw r$(this._lexer,"cannot enter embedded language from within an embedded language");else w=rH(this._lexer,S.nextEmbedded,C,y,_);if(S.goBack&&(d=Math.max(0,d-S.goBack)),S.switchTo&&"string"==typeof S.switchTo){let e=rH(this._lexer,S.switchTo,C,y,_);if("@"===e[0]&&(e=e.substr(1)),rU(this._lexer,e))c=c.switchTo(e);else throw r$(this._lexer,"trying to switch to a state '"+e+"' that is undefined in rule: "+this._safeRuleName(b))}else if(S.transform&&"function"==typeof S.transform)throw r$(this._lexer,"action.transform not supported");else if(S.next)if("@push"===S.next)if(c.depth>=this._lexer.maxStack)throw r$(this._lexer,"maximum tokenizer stack size reached: ["+c.state+","+c.parent.state+",...]");else c=c.push(_);else if("@pop"===S.next)if(c.depth<=1)throw r$(this._lexer,"trying to pop an empty stack in rule: "+this._safeRuleName(b));else c=c.pop();else if("@popall"===S.next)c=c.popall();else{let e=rH(this._lexer,S.next,C,y,_);if("@"===e[0]&&(e=e.substr(1)),rU(this._lexer,e))c=c.push(e);else throw r$(this._lexer,"trying to set a next state '"+e+"' that is undefined in rule: "+this._safeRuleName(b))}S.log&&"string"==typeof S.log&&(g=this._lexer,p=this._lexer.languageId+": "+rH(this._lexer,S.log,C,y,_),console.log(`${g.languageId}: ${p}`))}if(null===x)throw r$(this._lexer,"lexer rule has no well-defined action in rule: "+this._safeRuleName(b));let D=i=>{let n=this._languageService.getLanguageIdByLanguageName(i)||this._languageService.getLanguageIdByMimeType(i)||i,s=this._getNestedEmbeddedLanguageData(n);if(!(d<a))return rK.create(c,s);{let i=e.substr(d);return this._nestedTokenize(i,t,rK.create(c,s),r+d,o)}};if(Array.isArray(x)){if(u&&u.groups.length>0)throw r$(this._lexer,"groups cannot be nested: "+this._safeRuleName(b));if(y.length!==x.length+1)throw r$(this._lexer,"matched number of groups does not match the number of actions in rule: "+this._safeRuleName(b));let e=0;for(let t=1;t<y.length;t++)e+=y[t].length;if(e!==C.length)throw r$(this._lexer,"with groups, all characters should be matched in consecutive groups in rule: "+this._safeRuleName(b));u={rule:b,matches:y,groups:[]};for(let e=0;e<x.length;e++)u.groups[e]={action:x[e],matched:y[e+1]};d-=C.length;continue}{if("@rematch"===x&&(d-=C.length,C="",y=null,x="",null!==w))return D(w);if(0===C.length)if(0===a||m!==c.depth||_!==c.state||(u?u.groups.length:0)!==f)continue;else throw r$(this._lexer,"no progress in tokenizer in rule: "+this._safeRuleName(b));let e=null;if(rF(x)&&0===x.indexOf("@brackets")){let t=x.substr(9),i=function(e,t){if(!t)return null;for(let i of(t=rO(e,t),e.brackets))if(i.open===t)return{token:i.token,bracketType:F.Open};else if(i.close===t)return{token:i.token,bracketType:F.Close};return null}(this._lexer,C);if(!i)throw r$(this._lexer,"@brackets token returned but no bracket defined as: "+C);e=rN(i.token+t)}else e=rN(""===x?"":x+this._lexer.tokenPostfix);i<n&&o.emit(i+r,e)}if(null!==w)return D(w)}return rK.create(c,l)}_getNestedEmbeddedLanguageData(e){if(!this._languageService.isRegisteredLanguageId(e))return new rz(e,rx.NullState);e!==this._languageId&&(this._languageService.requestBasicLanguageFeatures(e),rS.TokenizationRegistry.getOrCreate(e),this._embeddedLanguages[e]=!0);let t=rS.TokenizationRegistry.get(e);return t?new rz(e,t.getInitialState()):new rz(e,rx.NullState)}};rQ=O=(0,rM.__decorate)([(0,rM.__param)(4,rW.IConfigurationService)],rQ);let rJ=(0,rT.createTrustedTypesPolicy)("standaloneColorizer",{createHTML:e=>e});class rY{static colorizeElement(e,t,i,r){let o=(r=r||{}).theme||"vs",n=r.mimeType||i.getAttribute("lang")||i.getAttribute("data-lang");if(!n)return console.error("Mode not detected"),Promise.resolve();let s=t.getLanguageIdByMimeType(n)||n;e.setTheme(o);let a=i.firstChild?i.firstChild.nodeValue:"";return i.className+=" "+o,this.colorize(t,a||"",s,r).then(e=>{i.innerHTML=rJ?.createHTML(e)??e},e=>console.error(e))}static async colorize(e,t,i,r){var o,n,s,a;let l=e.languageIdCodec,c=4;r&&"number"==typeof r.tabSize&&(c=r.tabSize),(0,ru.startsWithUTF8BOM)(t)&&(t=t.substr(1));let d=(0,ru.splitLines)(t);if(!e.isRegisteredLanguageId(i))return rX(d,c,l);let u=await rS.TokenizationRegistry.getOrCreate(i);return u?(o=d,n=c,s=u,a=l,new Promise((e,t)=>{let i=()=>{let r=function(e,t,i,r){let o=[],n=i.getInitialState();for(let s=0,a=e.length;s<a;s++){let a=e[s],l=i.tokenizeEncoded(a,!0,n);rP.LineTokens.convertToEndOffset(l.tokens,a.length);let c=new rP.LineTokens(l.tokens,a,r),d=rA.ViewLineRenderingData.isBasicASCII(a,!0),u=rA.ViewLineRenderingData.containsRTL(a,d,!0),h=(0,rI.renderViewLine2)(new rI.RenderLineInput(!1,!0,a,!1,d,u,0,c.inflate(),[],t,0,0,0,0,-1,"none",!1,!1,null,null,0));(o=o.concat(h.html)).push("<br/>"),n=l.endState}return o.join("")}(o,n,s,a);if(s instanceof rQ){let e=s.getLoadStatus();if(!1===e.loaded)return void e.promise.then(i,t)}e(r)};i()})):rX(d,c,l)}static colorizeLine(e,t,i,r,o=4){let n=rA.ViewLineRenderingData.isBasicASCII(e,t),s=rA.ViewLineRenderingData.containsRTL(e,n,i);return(0,rI.renderViewLine2)(new rI.RenderLineInput(!1,!0,e,!1,n,s,0,r,[],o,0,0,0,0,-1,"none",!1,!1,null,null,0)).html}static colorizeModelLine(e,t,i=4){let r=e.getLineContent(t);e.tokenization.forceTokenization(t);let o=e.tokenization.getLineTokens(t).inflate();return this.colorizeLine(r,e.mightContainNonBasicASCII(),e.mightContainRTL(),o,i)}}function rX(e,t,i){let r=[],o=(rR.FontStyle.None<<rR.MetadataConsts.FONT_STYLE_OFFSET|rR.ColorId.DefaultForeground<<rR.MetadataConsts.FOREGROUND_OFFSET|rR.ColorId.DefaultBackground<<rR.MetadataConsts.BACKGROUND_OFFSET)>>>0,n=new Uint32Array(2);n[0]=0,n[1]=o;for(let o=0,s=e.length;o<s;o++){let s=e[o];n[0]=s.length;let a=new rP.LineTokens(n,s,i),l=rA.ViewLineRenderingData.isBasicASCII(s,!0),c=rA.ViewLineRenderingData.containsRTL(s,l,!0),d=(0,rI.renderViewLine2)(new rI.RenderLineInput(!1,!0,s,!1,l,c,0,a,[],t,0,0,0,0,-1,"none",!1,!1,null,null,0));(r=r.concat(d.html)).push("<br/>")}return r.join("")}var rZ=e.i(922292),r0=e.i(487106),r1=e.i(18149),r2=e.i(686380),r6=e.i(318581),r3=e.i(568101),r4=e.i(84513),r5=e.i(206548),r8=e.i(65579),r7=e.i(781808),r9=e.i(58867),oe=rd;e.i(71224);var ot=e.i(488259),oi=e.i(650289),or=e.i(575129);e.i(698014),e.i(140331);var oo=e.i(471999);e.i(900329),e.i(785266),e.i(181268),e.i(70177),e.i(575210),e.i(890787),e.i(67920),(0,or.registerColor)("multiDiffEditor.headerBackground",{dark:"#262626",light:"tab.inactiveBackground",hcDark:"tab.inactiveBackground",hcLight:"tab.inactiveBackground"},(0,oi.localize)(209,"The background color of the diff editor's header")),(0,or.registerColor)("multiDiffEditor.background",oo.editorBackground,(0,oi.localize)(210,"The background color of the multi file diff editor")),(0,or.registerColor)("multiDiffEditor.border",{dark:"sideBarSectionHeader.border",light:"#cccccc",hcDark:"sideBarSectionHeader.border",hcLight:"#cccccc"},(0,oi.localize)(211,"The border color of the multi file diff editor"));var on=e.i(850887),os=e.i(984004),oa=e.i(155652),ol=rd,oc=e.i(2301),od=e.i(159868),ou=e.i(9753),oh=e.i(299051),og=e.i(25797),op=e.i(631524),om=e.i(623012),of=e.i(823288),ov=e.i(532816),o_=e.i(314122),oy=e.i(896344);class oC{constructor(e,t){this.viewModel=e,this.deltaScrollVertical=t}getId(){return this.viewModel}}let oS=class extends ol.Disposable{constructor(e,t,i,r,o){super(),this._container=e,this._overflowWidgetsDomNode=t,this._workbenchUIElementFactory=i,this._instantiationService=r,this._viewModel=(0,ov.observableValue)(this,void 0),this._collapsed=(0,o_.derived)(this,e=>this._viewModel.read(e)?.collapsed.read(e)),this._editorContentHeight=(0,ov.observableValue)(this,500),this.contentHeight=(0,o_.derived)(this,e=>(this._collapsed.read(e)?0:this._editorContentHeight.read(e))+this._outerEditorHeight),this._modifiedContentWidth=(0,ov.observableValue)(this,0),this._modifiedWidth=(0,ov.observableValue)(this,0),this._originalContentWidth=(0,ov.observableValue)(this,0),this._originalWidth=(0,ov.observableValue)(this,0),this.maxScroll=(0,o_.derived)(this,e=>{let t=this._modifiedContentWidth.read(e)-this._modifiedWidth.read(e),i=this._originalContentWidth.read(e)-this._originalWidth.read(e);return t>i?{maxScroll:t,width:this._modifiedWidth.read(e)}:{maxScroll:i,width:this._originalWidth.read(e)}}),this._elements=(0,on.h)("div.multiDiffEntry",[(0,on.h)("div.header@header",[(0,on.h)("div.header-content",[(0,on.h)("div.collapse-button@collapseButton"),(0,on.h)("div.file-path",[(0,on.h)("div.title.modified.show-file-icons@primaryPath",[]),(0,on.h)("div.status.deleted@status",["R"]),(0,on.h)("div.title.original.show-file-icons@secondaryPath",[])]),(0,on.h)("div.actions@actions")])]),(0,on.h)("div.editorParent",[(0,on.h)("div.editorContainer@editor")])]),this.editor=this._register(this._instantiationService.createInstance(op.DiffEditorWidget,this._elements.editor,{overflowWidgetsDomNode:this._overflowWidgetsDomNode,fixedOverflowWidgets:!0},{})),this.isModifedFocused=(0,og.observableCodeEditor)(this.editor.getModifiedEditor()).isFocused,this.isOriginalFocused=(0,og.observableCodeEditor)(this.editor.getOriginalEditor()).isFocused,this.isFocused=(0,o_.derived)(this,e=>this.isModifedFocused.read(e)||this.isOriginalFocused.read(e)),this._resourceLabel=this._workbenchUIElementFactory.createResourceLabel?this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.primaryPath)):void 0,this._resourceLabel2=this._workbenchUIElementFactory.createResourceLabel?this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.secondaryPath)):void 0,this._dataStore=this._register(new ol.DisposableStore),this._headerHeight=40,this._lastScrollTop=-1,this._isSettingScrollTop=!1;const n=new os.Button(this._elements.collapseButton,{});this._register((0,oy.autorun)(e=>{n.element.className="",n.icon=this._collapsed.read(e)?oa.Codicon.chevronRight:oa.Codicon.chevronDown})),this._register(n.onDidClick(()=>{this._viewModel.get()?.collapsed.set(!this._collapsed.get(),void 0)})),this._register((0,oy.autorun)(e=>{this._elements.editor.style.display=this._collapsed.read(e)?"none":"block"})),this._register(this.editor.getModifiedEditor().onDidLayoutChange(e=>{let t=this.editor.getModifiedEditor().getLayoutInfo().contentWidth;this._modifiedWidth.set(t,void 0)})),this._register(this.editor.getOriginalEditor().onDidLayoutChange(e=>{let t=this.editor.getOriginalEditor().getLayoutInfo().contentWidth;this._originalWidth.set(t,void 0)})),this._register(this.editor.onDidContentSizeChange(e=>{(0,of.globalTransaction)(t=>{this._editorContentHeight.set(e.contentHeight,t),this._modifiedContentWidth.set(this.editor.getModifiedEditor().getContentWidth(),t),this._originalContentWidth.set(this.editor.getOriginalEditor().getContentWidth(),t)})})),this._register(this.editor.getOriginalEditor().onDidScrollChange(e=>{if(this._isSettingScrollTop||!e.scrollTopChanged||!this._data)return;let t=e.scrollTop-this._lastScrollTop;this._data.deltaScrollVertical(t)})),this._register((0,oy.autorun)(e=>{let t=this._viewModel.read(e)?.isActive.read(e);this._elements.root.classList.toggle("active",t)})),this._container.appendChild(this._elements.root),this._outerEditorHeight=this._headerHeight,this._contextKeyService=this._register(o.createScoped(this._elements.actions));const s=this._register(this._instantiationService.createChild(new oh.ServiceCollection([ou.IContextKeyService,this._contextKeyService])));this._register(s.createInstance(od.MenuWorkbenchToolBar,this._elements.actions,r2.MenuId.MultiDiffEditorFileToolbar,{actionRunner:this._register(new om.ActionRunnerWithContext(()=>this._viewModel.get()?.modifiedUri??this._viewModel.get()?.originalUri)),menuOptions:{shouldForwardArgs:!0},toolbarOptions:{primaryGroup:e=>e.startsWith("navigation")},actionViewItemProvider:(e,t)=>(0,oc.createActionViewItem)(s,e,t)}))}setScrollLeft(e){this._modifiedContentWidth.get()-this._modifiedWidth.get()>this._originalContentWidth.get()-this._originalWidth.get()?this.editor.getModifiedEditor().setScrollLeft(e):this.editor.getOriginalEditor().setScrollLeft(e)}setData(e){function t(e){return{...e,scrollBeyondLastLine:!1,hideUnchangedRegions:{enabled:!0},scrollbar:{vertical:"hidden",horizontal:"hidden",handleMouseWheel:!1,useShadows:!1},renderOverviewRuler:!1,fixedOverflowWidgets:!0,overviewRulerBorder:!1}}if(this._data=e,!e)return void(0,of.globalTransaction)(e=>{this._viewModel.set(void 0,e),this.editor.setDiffModel(null,e),this._dataStore.clear()});let i=e.viewModel.documentDiffItem;if((0,of.globalTransaction)(r=>{this._resourceLabel?.setUri(e.viewModel.modifiedUri??e.viewModel.originalUri,{strikethrough:void 0===e.viewModel.modifiedUri});let o=!1,n=!1,s=!1,a="";e.viewModel.modifiedUri&&e.viewModel.originalUri&&e.viewModel.modifiedUri.path!==e.viewModel.originalUri.path?(a="R",o=!0):e.viewModel.modifiedUri?e.viewModel.originalUri||(a="A",s=!0):(a="D",n=!0),this._elements.status.classList.toggle("renamed",o),this._elements.status.classList.toggle("deleted",n),this._elements.status.classList.toggle("added",s),this._elements.status.innerText=a,this._resourceLabel2?.setUri(o?e.viewModel.originalUri:void 0,{strikethrough:!0}),this._dataStore.clear(),this._viewModel.set(e.viewModel,r),this.editor.setDiffModel(e.viewModel.diffEditorViewModelRef,r),this.editor.updateOptions(t(i.options??{}))}),i.onOptionsDidChange&&this._dataStore.add(i.onOptionsDidChange(()=>{this.editor.updateOptions(t(i.options??{}))})),e.viewModel.isAlive.recomputeInitiallyAndOnChange(this._dataStore,e=>{e||this.setData(void 0)}),e.viewModel.documentDiffItem.contextKeys)for(let[t,i]of Object.entries(e.viewModel.documentDiffItem.contextKeys))this._contextKeyService.createKey(t,i)}render(e,t,i,r){this._elements.root.style.visibility="visible",this._elements.root.style.top=`${e.start}px`,this._elements.root.style.height=`${e.length}px`,this._elements.root.style.width=`${t}px`,this._elements.root.style.position="absolute";let o=e.length-this._headerHeight,n=Math.max(0,Math.min(r.start-e.start,o));this._elements.header.style.transform=`translateY(${n}px)`,(0,of.globalTransaction)(i=>{this.editor.layout({width:t-16-2,height:e.length-this._outerEditorHeight})});try{this._isSettingScrollTop=!0,this._lastScrollTop=i,this.editor.getOriginalEditor().setScrollTop(i)}finally{this._isSettingScrollTop=!1}this._elements.header.classList.toggle("shadow",n>0||i>0),this._elements.header.classList.toggle("collapsed",n===o)}hide(){this._elements.root.style.top="-100000px",this._elements.root.style.visibility="hidden"}};oS=(0,rM.__decorate)([(0,rM.__param)(3,ot.IInstantiationService),(0,rM.__param)(4,ou.IContextKeyService)],oS);var ob=e.i(235905),ow=e.i(46373),ox=e.i(454514),oD=e.i(237029),oE=e.i(619122),ok=rd,oT=e.i(920042),oR=e.i(103346),oP=e.i(340793),oI=e.i(704409),oA=e.i(955921);class oM{constructor(e){this._create=e,this._unused=new Set,this._used=new Set,this._itemData=new Map}getUnusedObj(e){let t;if(0===this._unused.size)t=this._create(e),this._itemData.set(t,e);else{let i=[...this._unused.values()];t=i.find(t=>this._itemData.get(t).getId()===e.getId())??i[0],this._unused.delete(t),this._itemData.set(t,e),t.setData(e)}return this._used.add(t),{object:t,dispose:()=>{this._used.delete(t),this._unused.size>5?t.dispose():this._unused.add(t)}}}dispose(){for(let e of this._used)e.dispose();for(let e of this._unused)e.dispose();this._used.clear(),this._unused.clear()}}var oL=e.i(229081);(0,rl.registerCss)(void 0);let oF=class extends ok.Disposable{constructor(e,t,i,r,o,n){super(),this._element=e,this._dimension=t,this._viewModel=i,this._workbenchUIElementFactory=r,this._parentContextKeyService=o,this._parentInstantiationService=n,this._scrollableElements=(0,on.h)("div.scrollContent",[(0,on.h)("div@content",{style:{overflow:"hidden"}}),(0,on.h)("div.monaco-editor@overflowWidgetsDomNode",{})]),this._scrollable=this._register(new oT.Scrollable({forceIntegerValues:!1,scheduleAtNextAnimationFrame:e=>(0,on.scheduleAtNextAnimationFrame)((0,on.getWindow)(this._element),e),smoothScrollDuration:100})),this._scrollableElement=this._register(new ow.SmoothScrollableElement(this._scrollableElements.root,{vertical:oT.ScrollbarVisibility.Auto,horizontal:oT.ScrollbarVisibility.Auto,useShadows:!1},this._scrollable)),this._elements=(0,on.h)("div.monaco-component.multiDiffEditor",{},[(0,on.h)("div",{},[this._scrollableElement.getDomNode()]),(0,on.h)("div.placeholder@placeholder",{},[(0,on.h)("div")])]),this._sizeObserver=this._register(new oA.ObservableElementSizeObserver(this._element,void 0)),this._objectPool=this._register(new oM(e=>{let t=this._instantiationService.createInstance(oS,this._scrollableElements.content,this._scrollableElements.overflowWidgetsDomNode,this._workbenchUIElementFactory);return t.setData(e),t})),this.scrollTop=(0,oL.observableFromEvent)(this,this._scrollableElement.onScroll,()=>this._scrollableElement.getScrollPosition().scrollTop),this.scrollLeft=(0,oL.observableFromEvent)(this,this._scrollableElement.onScroll,()=>this._scrollableElement.getScrollPosition().scrollLeft),this._viewItemsInfo=(0,o_.derived)(this,e=>{let t=this._viewModel.read(e);if(!t)return{items:[],getItem:e=>{throw new oE.BugIndicatingError}};let i=t.items.read(e),r=new Map;return{items:i.map(t=>{let i=e.store.add(new oO(t,this._objectPool,this.scrollLeft,e=>{this._scrollableElement.setScrollPosition({scrollTop:this._scrollableElement.getScrollPosition().scrollTop+e})})),o=this._lastDocStates?.[i.getKey()];return o&&(0,of.transaction)(e=>{i.setViewState(o,e)}),r.set(t,i),i}),getItem:e=>r.get(e)}}),this._viewItems=this._viewItemsInfo.map(this,e=>e.items),this._spaceBetweenPx=0,this._totalHeight=this._viewItems.map(this,(e,t)=>e.reduce((e,i)=>e+i.contentHeight.read(t)+this._spaceBetweenPx,0)),this.activeControl=(0,o_.derived)(this,e=>{let t=this._viewModel.read(e)?.activeDiffItem.read(e);if(!t)return;let i=this._viewItemsInfo.read(e).getItem(t);return i.template.read(e)?.editor}),this._contextKeyService=this._register(this._parentContextKeyService.createScoped(this._element)),this._instantiationService=this._register(this._parentInstantiationService.createChild(new oh.ServiceCollection([ou.IContextKeyService,this._contextKeyService]))),this._contextKeyService.createKey(oI.EditorContextKeys.inMultiDiffEditor.key,!0),this._lastDocStates={},this._register((0,oy.autorunWithStore)((e,t)=>{let i=this._viewModel.read(e);if(i&&i.contextKeys)for(let[e,r]of Object.entries(i.contextKeys)){let i=this._contextKeyService.createKey(e,void 0);i.set(r),t.add((0,ok.toDisposable)(()=>i.reset()))}}));const s=this._parentContextKeyService.createKey(oI.EditorContextKeys.multiDiffEditorAllCollapsed.key,!1);this._register((0,oy.autorun)(e=>{let t=this._viewModel.read(e);if(t){let i=t.items.read(e).every(t=>t.collapsed.read(e));s.set(i)}})),this._register((0,oy.autorun)(e=>{let t=this._dimension.read(e);this._sizeObserver.observe(t)}));const a=(0,o_.derived)(e=>{if(this._viewItems.read(e).length>0)return;let t=this._viewModel.read(e);return!t||t.isLoading.read(e)?(0,oi.localize)(212,"Loading..."):(0,oi.localize)(213,"No Changed Files")});this._register((0,oy.autorun)(e=>{let t=a.read(e);this._elements.placeholder.innerText=t??"",this._elements.placeholder.classList.toggle("visible",!!t)})),this._scrollableElements.content.style.position="relative",this._register((0,oy.autorun)(e=>{let t=this._sizeObserver.height.read(e);this._scrollableElements.root.style.height=`${t}px`;let i=this._totalHeight.read(e);this._scrollableElements.content.style.height=`${i}px`;let r=this._sizeObserver.width.read(e),o=r,n=this._viewItems.read(e),s=(0,oD.findFirstMax)(n,(0,ox.compareBy)(t=>t.maxScroll.read(e).maxScroll,ox.numberComparator));s&&(o=r+s.maxScroll.read(e).maxScroll),this._scrollableElement.setScrollDimensions({width:r,height:t,scrollHeight:i,scrollWidth:o})})),e.replaceChildren(this._elements.root),this._register((0,ok.toDisposable)(()=>{e.replaceChildren()})),this._register((0,oy.autorun)(e=>{let t=this._viewModel.read(e);if(t&&!t.isLoading.read(e)){if(0===t.items.read(e).length||t.activeDiffItem.read(e))return;this.goToNextChange()}})),this._register(this._register((0,oy.autorun)(e=>{(0,of.globalTransaction)(t=>{this.render(e)})})))}setScrollState(e){this._scrollableElement.setScrollPosition({scrollLeft:e.left,scrollTop:e.top})}getRootElement(){return this._elements.root}getContextKeyService(){return this._contextKeyService}getScopedInstantiationService(){return this._instantiationService}reveal(e,t){var i,r;let o,n,s=this._viewItems.get(),a=s.findIndex(t=>t.viewModel.originalUri?.toString()===e.original?.toString()&&t.viewModel.modifiedUri?.toString()===e.modified?.toString());if(-1===a)throw new oE.BugIndicatingError("Resource not found in diff editor");let l=s[a];this._viewModel.get().activeDiffItem.setCache(l.viewModel,void 0);let c=0;for(let e=0;e<a;e++)c+=s[e].contentHeight.get()+this._spaceBetweenPx;this._scrollableElement.setScrollPosition({scrollTop:c});let d=l.template.get()?.editor,u="original"in e?d?.getOriginalEditor():d?.getModifiedEditor();u&&t?.range&&(u.revealRangeInCenter(t.range),i=u,r=t.range,o=i.getModel(),n=i.createDecorationsCollection([{range:r,options:{description:"symbol-navigate-action-highlight",className:"symbolHighlight"}}]),setTimeout(()=>{i.getModel()===o&&n.clear()},350))}getViewState(){return{scrollState:{top:this.scrollTop.get(),left:this.scrollLeft.get()},docStates:Object.fromEntries(this._viewItems.get().map(e=>[e.getKey(),e.getViewState()]))}}setViewState(e){this.setScrollState(e.scrollState),this._lastDocStates=e.docStates,(0,of.transaction)(t=>{if(e.docStates)for(let i of this._viewItems.get()){let r=e.docStates[i.getKey()];r&&i.setViewState(r,t)}})}findDocumentDiffItem(e){let t=this._viewItems.get().find(t=>t.viewModel.diffEditorViewModel.model.modified.uri.toString()===e.toString()||t.viewModel.diffEditorViewModel.model.original.uri.toString()===e.toString());return t?.viewModel.documentDiffItem}tryGetCodeEditor(e){let t=this._viewItems.get().find(t=>t.viewModel.diffEditorViewModel.model.modified.uri.toString()===e.toString()||t.viewModel.diffEditorViewModel.model.original.uri.toString()===e.toString()),i=t?.template.get()?.editor;if(i)if(t.viewModel.diffEditorViewModel.model.modified.uri.toString()===e.toString())return{diffEditor:i,editor:i.getModifiedEditor()};else return{diffEditor:i,editor:i.getOriginalEditor()}}goToNextChange(){this._navigateToChange("next")}goToPreviousChange(){this._navigateToChange("previous")}_navigateToChange(e){let t=this._viewItems.get();if(0===t.length)return;let i=this._viewModel.get()?.activeDiffItem.get(),r=i?t.findIndex(e=>e.viewModel===i):-1;if(-1===r)return void this._goToFile(0,"first");let o=t[r];o.viewModel.collapsed.get()&&o.viewModel.collapsed.set(!1,void 0);let n=o.template.get()?.editor;if(n?.getDiffComputationResult()?.changes2?.length){let t=n.getModifiedEditor().getPosition()?.lineNumber||1,i=n.getDiffComputationResult().changes2;if("next"===e?i.some(e=>e.modified.startLineNumber>t):i.some(e=>e.modified.endLineNumberExclusive<=t))return void n.goToDiff(e)}let s=(r+("next"===e?1:-1)+t.length)%t.length;this._goToFile(s,"next"===e?"first":"last")}_goToFile(e,t){let i=this._viewItems.get()[e];i.viewModel.collapsed.get()&&i.viewModel.collapsed.set(!1,void 0),this.reveal({original:i.viewModel.originalUri,modified:i.viewModel.modifiedUri});let r=i.template.get()?.editor;if(r?.getDiffComputationResult()?.changes2?.length)if("first"===t)r.revealFirstDiff();else{let e=r.getDiffComputationResult().changes2.at(-1),t=r.getModifiedEditor();t.setPosition({lineNumber:e.modified.startLineNumber,column:1}),t.revealLineInCenter(e.modified.startLineNumber)}r?.focus()}render(e){let t=this.scrollTop.read(e),i=0,r=0,o=0,n=this._sizeObserver.height.read(e),s=oR.OffsetRange.ofStartAndLength(t,n),a=this._sizeObserver.width.read(e);for(let l of this._viewItems.read(e)){let c=l.contentHeight.read(e),d=Math.min(c,n),u=oR.OffsetRange.ofStartAndLength(r,d),h=oR.OffsetRange.ofStartAndLength(o,c);if(h.isBefore(s))i-=c-d,l.hide();else if(h.isAfter(s))l.hide();else{let e=Math.max(0,Math.min(s.start-h.start,c-d));i-=e;let r=oR.OffsetRange.ofStartAndLength(t+i,n);l.render(u,e,a,r)}r+=d+this._spaceBetweenPx,o+=c+this._spaceBetweenPx}this._scrollableElements.content.style.transform=`translateY(${-(t+i)}px)`}};oF=(0,rM.__decorate)([(0,rM.__param)(4,ou.IContextKeyService),(0,rM.__param)(5,ot.IInstantiationService)],oF);class oO extends ok.Disposable{constructor(e,t,i,r){super(),this.viewModel=e,this._objectPool=t,this._scrollLeft=i,this._deltaScrollVertical=r,this._templateRef=this._register((0,ov.disposableObservableValue)(this,void 0)),this.contentHeight=(0,o_.derived)(this,e=>this._templateRef.read(e)?.object.contentHeight?.read(e)??this.viewModel.lastTemplateData.read(e).contentHeight),this.maxScroll=(0,o_.derived)(this,e=>this._templateRef.read(e)?.object.maxScroll.read(e)??{maxScroll:0,scrollWidth:0}),this.template=(0,o_.derived)(this,e=>this._templateRef.read(e)?.object),this._isHidden=(0,ov.observableValue)(this,!1),this._isFocused=(0,o_.derived)(this,e=>this.template.read(e)?.isFocused.read(e)??!1),this.viewModel.setIsFocused(this._isFocused,void 0),this._register((0,oy.autorun)(e=>{let t=this._scrollLeft.read(e);this._templateRef.read(e)?.object.setScrollLeft(t)})),this._register((0,oy.autorun)(e=>{let t=this._templateRef.read(e);t&&this._isHidden.read(e)&&(t.object.isFocused.read(e)||this._clear())}))}dispose(){this._clear(),super.dispose()}toString(){return`VirtualViewItem(${this.viewModel.documentDiffItem.modified?.uri.toString()})`}getKey(){return this.viewModel.getKey()}getViewState(){return(0,of.transaction)(e=>{this._updateTemplateData(e)}),{collapsed:this.viewModel.collapsed.get(),selections:this.viewModel.lastTemplateData.get().selections}}setViewState(e,t){this.viewModel.collapsed.set(e.collapsed,t),this._updateTemplateData(t);let i=this.viewModel.lastTemplateData.get(),r=e.selections?.map(oP.Selection.liftSelection);this.viewModel.lastTemplateData.set({...i,selections:r},t);let o=this._templateRef.get();o&&r&&o.object.editor.setSelections(r)}_updateTemplateData(e){let t=this._templateRef.get();t&&this.viewModel.lastTemplateData.set({contentHeight:t.object.contentHeight.get(),selections:t.object.editor.getSelections()??void 0},e)}_clear(){let e=this._templateRef.get();e&&(0,of.transaction)(t=>{this._updateTemplateData(t),e.object.hide(),this._templateRef.set(void 0,t)})}hide(){this._isHidden.set(!0,void 0)}render(e,t,i,r){this._isHidden.set(!1,void 0);let o=this._templateRef.get();if(!o){o=this._objectPool.getUnusedObj(new oC(this.viewModel,this._deltaScrollVertical)),this._templateRef.set(o,void 0);let e=this.viewModel.lastTemplateData.get().selections;e&&o.object.editor.setSelections(e)}o.object.render(e,i,t,r)}}var oN=e.i(465376);let o$=class extends oe.Disposable{constructor(e,t,i){super(),this._element=e,this._workbenchUIElementFactory=t,this._instantiationService=i,this._dimension=(0,ov.observableValue)(this,void 0),this._viewModel=(0,ov.observableValue)(this,void 0),this._widgetImpl=(0,o_.derived)(this,e=>e.store.add(this._instantiationService.createInstance((0,r9.readHotReloadableExport)(oF),this._element,this._dimension,this._viewModel,this._workbenchUIElementFactory))),this._activeControl=(0,o_.derived)(this,e=>this._widgetImpl.read(e).activeControl.read(e)),this.onDidChangeActiveControl=r7.Event.fromObservableLight(this._activeControl),this._register((0,oN.recomputeInitiallyAndOnChange)(this._widgetImpl))}reveal(e,t){this._widgetImpl.get().reveal(e,t)}createViewModel(e){return new ob.MultiDiffEditorViewModel(e,this._instantiationService)}setViewModel(e){this._viewModel.set(e,void 0)}layout(e){this._dimension.set(e,void 0)}getActiveControl(){return this._activeControl.get()}getViewState(){return this._widgetImpl.get().getViewState()}setViewState(e){this._widgetImpl.get().setViewState(e)}tryGetCodeEditor(e){return this._widgetImpl.get().tryGetCodeEditor(e)}getRootElement(){return this._widgetImpl.get().getRootElement()}getContextKeyService(){return this._widgetImpl.get().getContextKeyService()}getScopedInstantiationService(){return this._widgetImpl.get().getScopedInstantiationService()}findDocumentDiffItem(e){return this._widgetImpl.get().findDocumentDiffItem(e)}goToNextChange(){this._widgetImpl.get().goToNextChange()}goToPreviousChange(){this._widgetImpl.get().goToPreviousChange()}};o$=(0,rM.__decorate)([(0,rM.__param)(2,ot.IInstantiationService)],o$);var oH=e.i(557941);function oU(e){let t=r0.StandaloneServices.get(r4.IKeybindingService);return t instanceof r0.StandaloneKeybindingService?t.addDynamicKeybindings(e.map(e=>({keybinding:e.keybinding,command:e.command,commandArgs:e.commandArgs,when:r3.ContextKeyExpr.deserialize(e.when)}))):(console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService"),rd.Disposable.None)}(0,rl.registerCss)(void 0);var oW=e.i(144881),oq=e.i(166969),oj=e.i(841836),oz=e.i(407791),oK=e.i(535567);function oV(e,t){return"boolean"==typeof e?e:t}function oB(e,t){return"string"==typeof e?e:t}function oG(e,t=!1){t&&(e=e.map(function(e){return e.toLowerCase()}));let i=function(e){let t={};for(let i of e)t[i]=!0;return t}(e);return t?function(e){return void 0!==i[e.toLowerCase()]&&i.hasOwnProperty(e.toLowerCase())}:function(e){return void 0!==i[e]&&i.hasOwnProperty(e)}}function oQ(e,t,i){let r;t=t.replace(/@@/g,"\x01");let o=0;do r=!1,t=t.replace(/@(\w+)/g,function(i,o){r=!0;let n="";if("string"==typeof e[o])n=e[o];else if(e[o]&&e[o]instanceof RegExp)n=e[o].source;else if(void 0===e[o])throw r$(e,"language definition does not contain attribute '"+o+"', used at: "+t);else throw r$(e,"attribute reference '"+o+"' must be a string, used at: "+t);return n?"(?:"+n+")":""}),o++;while(r&&o<5)t=t.replace(/\x01/g,"@");let n=(e.ignoreCase?"i":"")+(e.unicode?"u":"");if(i&&t.match(/\$[sS](\d\d?)/g)){let i=null,r=null;return o=>{let s;return r&&i===o?r:(i=o,r=new RegExp((s=null,t.replace(/\$[sS](\d\d?)/g,function(t,i){return(null===s&&(s=o.split(".")).unshift(o),i&&i<s.length)?(0,ru.escapeRegExpCharacters)(rO(e,s[i])):""})),n))}}return new RegExp(t,n)}class oJ{constructor(e){this.regex=RegExp(""),this.action={token:""},this.matchOnlyAtLineStart=!1,this.name="",this.name=e}setRegex(e,t){let i;if("string"==typeof t)i=t;else if(t instanceof RegExp)i=t.source;else throw r$(e,"rules must start with a match string or regular expression: "+this.name);this.matchOnlyAtLineStart=i.length>0&&"^"===i[0],this.name=this.name+": "+i,this.regex=oQ(e,"^(?:"+(this.matchOnlyAtLineStart?i.substr(1):i)+")",!0)}setAction(e,t){this.action=function e(t,i,r){if(!r)return{token:""};if("string"==typeof r)return r;if(r.token||""===r.token)if("string"!=typeof r.token)throw r$(t,"a 'token' attribute must be of type string, in rule: "+i);else{let e={token:r.token};if(r.token.indexOf("$")>=0&&(e.tokenSubst=!0),"string"==typeof r.bracket)if("@open"===r.bracket)e.bracket=F.Open;else if("@close"===r.bracket)e.bracket=F.Close;else throw r$(t,"a 'bracket' attribute must be either '@open' or '@close', in rule: "+i);if(r.next)if("string"!=typeof r.next)throw r$(t,"the next state must be a string value in rule: "+i);else{let o=r.next;if(!/^(@pop|@push|@popall)$/.test(o)&&("@"===o[0]&&(o=o.substr(1)),0>o.indexOf("$")&&!function(e,t){let i=t;for(;i&&i.length>0;){if(e.stateNames[i])return!0;let t=i.lastIndexOf(".");i=t<0?null:i.substr(0,t)}return!1}(t,rH(t,o,"",[],""))))throw r$(t,"the next state '"+r.next+"' is not defined in rule: "+i);e.next=o}return"number"==typeof r.goBack&&(e.goBack=r.goBack),"string"==typeof r.switchTo&&(e.switchTo=r.switchTo),"string"==typeof r.log&&(e.log=r.log),"string"==typeof r.nextEmbedded&&(e.nextEmbedded=r.nextEmbedded,t.usesEmbedded=!0),e}if(Array.isArray(r)){let o=[];for(let n=0,s=r.length;n<s;n++)o[n]=e(t,i,r[n]);return{group:o}}if(r.cases){let o=[],n=!1;for(let s in r.cases)if(r.cases.hasOwnProperty(s)){let a=e(t,i,r.cases[s]);"@default"===s||"@"===s||""===s?o.push({test:void 0,value:a,name:s}):"@eos"===s?o.push({test:function(e,t,i,r){return r},value:a,name:s}):o.push(function(e,t,i,r){let o,n=-1,s=i,a=i.match(/^\$(([sS]?)(\d\d?)|#)(.*)$/);a&&(a[3]&&(n=parseInt(a[3]),a[2]&&(n+=100)),s=a[4]);let l="~",c=s;if(s&&0!==s.length?/^\w*$/.test(c)?l="==":(a=s.match(/^(@|!@|~|!~|==|!=)(.*)$/))&&(l=a[1],c=a[2]):(l="!=",c=""),("~"===l||"!~"===l)&&/^(\w|\|)*$/.test(c)){let t=oG(c.split("|"),e.ignoreCase);o=function(e){return"~"===l?t(e):!t(e)}}else if("@"===l||"!@"===l){let i=e[c];if(!i)throw r$(e,"the @ match target '"+c+"' is not defined, in rule: "+t);if(!function(e,t){if(!t||!Array.isArray(t))return!1;for(let i of t)if(!e(i))return!1;return!0}(function(e){return"string"==typeof e},i))throw r$(e,"the @ match target '"+c+"' must be an array of strings, in rule: "+t);let r=oG(i,e.ignoreCase);o=function(e){return"@"===l?r(e):!r(e)}}else if("~"===l||"!~"===l)if(0>c.indexOf("$")){let t=oQ(e,"^"+c+"$",!1);o=function(e){return"~"===l?t.test(e):!t.test(e)}}else o=function(t,i,r,o){return oQ(e,"^"+rH(e,c,i,r,o)+"$",!1).test(t)};else if(0>c.indexOf("$")){let t=rO(e,c);o=function(e){return"=="===l?e===t:e!==t}}else{let t=rO(e,c);o=function(i,r,o,n,s){let a=rH(e,t,r,o,n);return"=="===l?i===a:i!==a}}return -1===n?{name:i,value:r,test:function(e,t,i,r){return o(e,e,t,i,r)}}:{name:i,value:r,test:function(e,t,i,r){let s=function(e,t,i,r){if(r<0)return e;if(r<t.length)return t[r];if(r>=100){r-=100;let e=i.split(".");if(e.unshift(i),r<e.length)return e[r]}return null}(e,t,i,n);return o(s||"",e,t,i,r)}}}(t,i,s,a)),n||(n=!(0,oK.isString)(a)&&(a.hasEmbeddedEndInCases||["@pop","@popall"].includes(a.nextEmbedded||"")))}let s=t.defaultToken;return{hasEmbeddedEndInCases:n,test:function(e,t,i,r){for(let n of o)if(!n.test||n.test(e,t,i,r))return n.value;return s}}}else throw r$(t,"an action must be a string, an object with a 'token' or 'cases' attribute, or an array of actions; in rule: "+i)}(e,this.name,t)}resolveRegex(e){return this.regex instanceof RegExp?this.regex:this.regex(e)}}function oY(e,t){if(!t||"object"!=typeof t)throw Error("Monarch: expecting a language definition object");let i={languageId:e,includeLF:oV(t.includeLF,!1),noThrow:!1,maxStack:100,start:"string"==typeof t.start?t.start:null,ignoreCase:oV(t.ignoreCase,!1),unicode:oV(t.unicode,!1),tokenPostfix:oB(t.tokenPostfix,"."+e),defaultToken:oB(t.defaultToken,"source"),usesEmbedded:!1,stateNames:{},tokenizer:{},brackets:[]};if(t.languageId=e,t.includeLF=i.includeLF,t.ignoreCase=i.ignoreCase,t.unicode=i.unicode,t.noThrow=i.noThrow,t.usesEmbedded=i.usesEmbedded,t.stateNames=t.tokenizer,t.defaultToken=i.defaultToken,!t.tokenizer||"object"!=typeof t.tokenizer)throw r$(i,"a language definition must define the 'tokenizer' attribute as an object");for(let e in i.tokenizer=[],t.tokenizer)if(t.tokenizer.hasOwnProperty(e)){i.start||(i.start=e);let r=t.tokenizer[e];i.tokenizer[e]=[],function e(r,o,n){for(let s of n){let n=s.include;if(n){if("string"!=typeof n)throw r$(i,"an 'include' attribute must be a string at: "+r);if("@"===n[0]&&(n=n.substr(1)),!t.tokenizer[n])throw r$(i,"include target '"+n+"' is not defined at: "+r);e(r+"."+n,o,t.tokenizer[n])}else{let e=new oJ(r);if(Array.isArray(s)&&s.length>=1&&s.length<=3)if(e.setRegex(t,s[0]),s.length>=3)if("string"==typeof s[1])e.setAction(t,{token:s[1],next:s[2]});else if("object"==typeof s[1]){let i=s[1];i.next=s[2],e.setAction(t,i)}else throw r$(i,"a next state as the last element of a rule can only be given if the action is either an object or a string, at: "+r);else e.setAction(t,s[1]);else{if(!s.regex)throw r$(i,"a rule must either be an array, or an object with a 'regex' or 'include' field at: "+r);s.name&&"string"==typeof s.name&&(e.name=s.name),s.matchOnlyAtStart&&(e.matchOnlyAtLineStart=oV(s.matchOnlyAtLineStart,!1)),e.setRegex(t,s.regex),e.setAction(t,s.action)}o.push(e)}}}("tokenizer."+e,i.tokenizer[e],r)}if(i.usesEmbedded=t.usesEmbedded,t.brackets){if(!Array.isArray(t.brackets))throw r$(i,"the 'brackets' attribute must be defined as an array")}else t.brackets=[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"},{open:"<",close:">",token:"delimiter.angle"}];let r=[];for(let e of t.brackets){let t=e;if(t&&Array.isArray(t)&&3===t.length&&(t={token:t[2],open:t[0],close:t[1]}),t.open===t.close)throw r$(i,"open and close brackets in a 'brackets' attribute must be different: "+t.open+"\n hint: use the 'bracket' attribute if matching on equal brackets is required.");if("string"==typeof t.open&&"string"==typeof t.token&&"string"==typeof t.close)r.push({token:t.token+i.tokenPostfix,open:rO(i,t.open),close:rO(i,t.close)});else throw r$(i,"every element in the 'brackets' array must be a '{open,close,token}' object or array")}return i.brackets=r,i.noThrow=!0,i}var oX=e.i(495723);class oZ{constructor(e,t){this._languageId=e,this._actual=t}dispose(){}getInitialState(){return this._actual.getInitialState()}tokenize(e,t,i){if("function"==typeof this._actual.tokenize)return o0.adaptTokenize(this._languageId,this._actual,e,i);throw Error("Not supported!")}tokenizeEncoded(e,t,i){let r=this._actual.tokenizeEncoded(e,i);return new rS.EncodedTokenizationResult(r.tokens,[],r.endState)}}class o0{constructor(e,t,i,r){this._languageId=e,this._actual=t,this._languageService=i,this._standaloneThemeService=r}dispose(){}getInitialState(){return this._actual.getInitialState()}static _toClassicTokens(e,t){let i=[],r=0;for(let o=0,n=e.length;o<n;o++){let n=e[o],s=n.startIndex;0===o?s=0:s<r&&(s=r),i[o]=new rS.Token(s,n.scopes,t),r=s}return i}static adaptTokenize(e,t,i,r){let o,n=t.tokenize(i,r),s=o0._toClassicTokens(n.tokens,e);return o=n.endState.equals(r)?r:n.endState,new rS.TokenizationResult(s,o)}tokenize(e,t,i){return o0.adaptTokenize(this._languageId,this._actual,e,i)}_toBinaryTokens(e,t){let i=e.encodeLanguageId(this._languageId),r=this._standaloneThemeService.getColorTheme().tokenTheme,o=[],n=0,s=0;for(let e=0,a=t.length;e<a;e++){let a=t[e],l=r.match(i,a.scopes)|rR.MetadataConsts.BALANCED_BRACKETS_MASK;if(n>0&&o[n-1]===l)continue;let c=a.startIndex;0===e?c=0:c<s&&(c=s),o[n++]=c,o[n++]=l,s=c}let a=new Uint32Array(n);for(let e=0;e<n;e++)a[e]=o[e];return a}tokenizeEncoded(e,t,i){let r,o=this._actual.tokenize(e,i),n=this._toBinaryTokens(this._languageService.languageIdCodec,o.tokens);return r=o.endState.equals(i)?i:o.endState,new rS.EncodedTokenizationResult(n,[],r)}}function o1(e){return e&&"function"==typeof e.then}function o2(e,t){return"tokenizeEncoded"in t?new oZ(e,t):new o0(e,t,r0.StandaloneServices.get(rb.ILanguageService),r0.StandaloneServices.get(r1.IStandaloneThemeService))}function o6(e,t){let i=new rS.LazyTokenizationSupport(async()=>{let i=await Promise.resolve(t.create());return i?"function"==typeof i.getInitialState?o2(e,i):new rQ(r0.StandaloneServices.get(rb.ILanguageService),r0.StandaloneServices.get(r1.IStandaloneThemeService),e,oY(e,i),r0.StandaloneServices.get(rW.IConfigurationService)):null});return rS.TokenizationRegistry.registerFactory(e,i)}var o3=e.i(264901),o4=e.i(322193);rs.EditorOptions.wrappingIndent.defaultValue=rs.WrappingIndent.None,rs.EditorOptions.glyphMargin.defaultValue=!1,rs.EditorOptions.autoIndent.defaultValue=rs.EditorAutoIndentStrategy.Advanced,rs.EditorOptions.overviewRulerLanes.defaultValue=2,o3.FormattingConflicts.setFormatterSelector((e,t,i)=>Promise.resolve(e[0]));let o5=(0,ra.createMonacoBaseAPI)();o5.editor={create:function(e,t,i){return r0.StandaloneServices.initialize(i||{}).createInstance(rZ.StandaloneEditor,e,t)},getEditors:function(){return r0.StandaloneServices.get(rm.ICodeEditorService).listCodeEditors()},getDiffEditors:function(){return r0.StandaloneServices.get(rm.ICodeEditorService).listDiffEditors()},onDidCreateEditor:function(e){return r0.StandaloneServices.get(rm.ICodeEditorService).onCodeEditorAdd(t=>{e(t)})},onDidCreateDiffEditor:function(e){return r0.StandaloneServices.get(rm.ICodeEditorService).onDiffEditorAdd(t=>{e(t)})},createDiffEditor:function(e,t,i){return r0.StandaloneServices.initialize(i||{}).createInstance(rZ.StandaloneDiffEditor2,e,t)},addCommand:function(e){if("string"!=typeof e.id||"function"!=typeof e.run)throw Error("Invalid command descriptor, `id` and `run` are required properties!");return r6.CommandsRegistry.registerCommand(e.id,e.run)},addEditorAction:function(e){if("string"!=typeof e.id||"string"!=typeof e.label||"function"!=typeof e.run)throw Error("Invalid action descriptor, `id`, `label` and `run` are required properties!");let t=r3.ContextKeyExpr.deserialize(e.precondition),i=new rd.DisposableStore;if(i.add(r6.CommandsRegistry.registerCommand(e.id,(i,...r)=>rp.EditorCommand.runEditorCommand(i,r,t,(t,i,r)=>Promise.resolve(e.run(i,...r))))),e.contextMenuGroupId){let r={command:{id:e.id,title:e.label},when:t,group:e.contextMenuGroupId,order:e.contextMenuOrder||0};i.add(r2.MenuRegistry.appendMenuItem(r2.MenuId.EditorContext,r))}if(Array.isArray(e.keybindings)){let r=r0.StandaloneServices.get(r4.IKeybindingService);if(r instanceof r0.StandaloneKeybindingService){let o=r3.ContextKeyExpr.and(t,r3.ContextKeyExpr.deserialize(e.keybindingContext));i.add(r.addDynamicKeybindings(e.keybindings.map(t=>({keybinding:t,command:e.id,when:o}))))}else console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService")}return i},addKeybindingRule:function(e){return oU([e])},addKeybindingRules:oU,createModel:function(e,t,i){let r=r0.StandaloneServices.get(rb.ILanguageService),o=r.getLanguageIdByMimeType(t)||t;return(0,rZ.createTextModel)(r0.StandaloneServices.get(rE.IModelService),r,e,o,i)},setModelLanguage:function(e,t){let i=r0.StandaloneServices.get(rb.ILanguageService),r=i.getLanguageIdByMimeType(t)||t||rw.PLAINTEXT_LANGUAGE_ID;e.setLanguage(i.createById(r))},setModelMarkers:function(e,t,i){e&&r0.StandaloneServices.get(r5.IMarkerService).changeOne(t,e.uri,i)},getModelMarkers:function(e){return r0.StandaloneServices.get(r5.IMarkerService).read(e)},removeAllMarkers:function(e){r0.StandaloneServices.get(r5.IMarkerService).changeAll(e,[])},onDidChangeMarkers:function(e){return r0.StandaloneServices.get(r5.IMarkerService).onMarkerChanged(e)},getModels:function(){return r0.StandaloneServices.get(rE.IModelService).getModels()},getModel:function(e){return r0.StandaloneServices.get(rE.IModelService).getModel(e)},onDidCreateModel:function(e){return r0.StandaloneServices.get(rE.IModelService).onModelAdded(e)},onWillDisposeModel:function(e){return r0.StandaloneServices.get(rE.IModelService).onModelRemoved(e)},onDidChangeModelLanguage:function(e){return r0.StandaloneServices.get(rE.IModelService).onModelLanguageChanged(t=>{e({model:t.model,oldLanguage:t.oldLanguageId})})},createWebWorker:function(e){var t;return t=r0.StandaloneServices.get(rE.IModelService),new rv(t,r0.StandaloneServices.get(oH.IWebWorkerService),e)},colorizeElement:function(e,t){let i=r0.StandaloneServices.get(rb.ILanguageService),r=r0.StandaloneServices.get(r1.IStandaloneThemeService);return rY.colorizeElement(r,i,e,t).then(()=>{r.registerEditorContainer(e)})},colorize:function(e,t,i){let r=r0.StandaloneServices.get(rb.ILanguageService);return r0.StandaloneServices.get(r1.IStandaloneThemeService).registerEditorContainer(rc.mainWindow.document.body),rY.colorize(r,e,t,i)},colorizeModelLine:function(e,t,i=4){return r0.StandaloneServices.get(r1.IStandaloneThemeService).registerEditorContainer(rc.mainWindow.document.body),rY.colorizeModelLine(e,t,i)},tokenize:function(e,t){let i;rS.TokenizationRegistry.getOrCreate(t);let r=(i=rS.TokenizationRegistry.get(t))||{getInitialState:()=>rx.NullState,tokenize:(e,i,r)=>(0,rx.nullTokenize)(t,r)},o=(0,ru.splitLines)(e),n=[],s=r.getInitialState();for(let e=0,t=o.length;e<t;e++){let t=o[e],i=r.tokenize(t,!0,s);n[e]=i.tokens,s=i.endState}return n},defineTheme:function(e,t){r0.StandaloneServices.get(r1.IStandaloneThemeService).defineTheme(e,t)},setTheme:function(e){r0.StandaloneServices.get(r1.IStandaloneThemeService).setTheme(e)},remeasureFonts:function(){rg.FontMeasurements.clearAllFontInfos()},registerCommand:function(e,t){return r6.CommandsRegistry.registerCommand({id:e,handler:t})},registerLinkOpener:function(e){return r0.StandaloneServices.get(r8.IOpenerService).registerOpener({open:async t=>("string"==typeof t&&(t=rh.URI.parse(t)),e.open(t))})},registerEditorOpener:function(e){return r0.StandaloneServices.get(rm.ICodeEditorService).registerCodeEditorOpenHandler(async(t,i,r)=>{let o;if(!i)return null;let n=t.options?.selection;return(n&&"number"==typeof n.endLineNumber&&"number"==typeof n.endColumn?o=n:n&&(o={lineNumber:n.startLineNumber,column:n.startColumn}),await e.openCodeEditor(i,t.resource,o))?i:null})},AccessibilitySupport:rk.AccessibilitySupport,ContentWidgetPositionPreference:rk.ContentWidgetPositionPreference,CursorChangeReason:rk.CursorChangeReason,DefaultEndOfLine:rk.DefaultEndOfLine,EditorAutoIndentStrategy:rk.EditorAutoIndentStrategy,EditorOption:rk.EditorOption,EndOfLinePreference:rk.EndOfLinePreference,EndOfLineSequence:rk.EndOfLineSequence,MinimapPosition:rk.MinimapPosition,MinimapSectionHeaderStyle:rk.MinimapSectionHeaderStyle,MouseTargetType:rk.MouseTargetType,OverlayWidgetPositionPreference:rk.OverlayWidgetPositionPreference,OverviewRulerLane:rk.OverviewRulerLane,GlyphMarginLane:rk.GlyphMarginLane,RenderLineNumbersType:rk.RenderLineNumbersType,RenderMinimap:rk.RenderMinimap,ScrollbarVisibility:rk.ScrollbarVisibility,ScrollType:rk.ScrollType,TextEditorCursorBlinkingStyle:rk.TextEditorCursorBlinkingStyle,TextEditorCursorStyle:rk.TextEditorCursorStyle,TrackedRangeStickiness:rk.TrackedRangeStickiness,WrappingIndent:rk.WrappingIndent,InjectedTextCursorStops:rk.InjectedTextCursorStops,PositionAffinity:rk.PositionAffinity,ShowLightbulbIconMode:rk.ShowLightbulbIconMode,TextDirection:rk.TextDirection,ConfigurationChangedEvent:rs.ConfigurationChangedEvent,BareFontInfo:ry.BareFontInfo,FontInfo:ry.FontInfo,TextModelResolvedOptions:rD.TextModelResolvedOptions,FindMatch:rD.FindMatch,ApplyUpdateResult:rs.ApplyUpdateResult,EditorZoom:r_.EditorZoom,createMultiFileDiffEditor:function(e,t){let i=r0.StandaloneServices.initialize(t||{});return new o$(e,{},i)},EditorType:rC.EditorType,EditorOptions:rs.EditorOptions},o5.languages={register:function(e){rw.ModesRegistry.registerLanguage(e)},getLanguages:function(){let e=[];return e.concat(rw.ModesRegistry.getLanguages())},onLanguage:function(e,t){return r0.StandaloneServices.withServices(()=>{let i=r0.StandaloneServices.get(rb.ILanguageService).onDidRequestRichLanguageFeatures(r=>{r===e&&(i.dispose(),t())});return i})},onLanguageEncountered:function(e,t){return r0.StandaloneServices.withServices(()=>{let i=r0.StandaloneServices.get(rb.ILanguageService).onDidRequestBasicLanguageFeatures(r=>{r===e&&(i.dispose(),t())});return i})},getEncodedLanguageId:function(e){return r0.StandaloneServices.get(rb.ILanguageService).languageIdCodec.encodeLanguageId(e)},setLanguageConfiguration:function(e,t){if(!r0.StandaloneServices.get(rb.ILanguageService).isRegisteredLanguageId(e))throw Error(`Cannot set configuration for unknown language ${e}`);return r0.StandaloneServices.get(oj.ILanguageConfigurationService).register(e,t,100)},setColorMap:function(e){let t=r0.StandaloneServices.get(r1.IStandaloneThemeService);if(e){let i=[null];for(let t=1,r=e.length;t<r;t++)i[t]=oW.Color.fromHex(e[t]);t.setColorMapOverride(i)}else t.setColorMapOverride(null)},registerTokensProviderFactory:o6,setTokensProvider:function(e,t){if(!r0.StandaloneServices.get(rb.ILanguageService).isRegisteredLanguageId(e))throw Error(`Cannot set tokens provider for unknown language ${e}`);return o1(t)?o6(e,{create:()=>t}):rS.TokenizationRegistry.register(e,o2(e,t))},setMonarchTokensProvider:function(e,t){return o1(t)?o6(e,{create:()=>t}):rS.TokenizationRegistry.register(e,new rQ(r0.StandaloneServices.get(rb.ILanguageService),r0.StandaloneServices.get(r1.IStandaloneThemeService),e,oY(e,t),r0.StandaloneServices.get(rW.IConfigurationService)))},registerReferenceProvider:function(e,t){return r0.StandaloneServices.get(oz.ILanguageFeaturesService).referenceProvider.register(e,t)},registerRenameProvider:function(e,t){return r0.StandaloneServices.get(oz.ILanguageFeaturesService).renameProvider.register(e,t)},registerNewSymbolNameProvider:function(e,t){return r0.StandaloneServices.get(oz.ILanguageFeaturesService).newSymbolNamesProvider.register(e,t)},registerCompletionItemProvider:function(e,t){return r0.StandaloneServices.get(oz.ILanguageFeaturesService).completionProvider.register(e,t)},registerSignatureHelpProvider:function(e,t){return r0.StandaloneServices.get(oz.ILanguageFeaturesService).signatureHelpProvider.register(e,t)},registerHoverProvider:function(e,t){return r0.StandaloneServices.get(oz.ILanguageFeaturesService).hoverProvider.register(e,{provideHover:async(e,i,r,o)=>{let n=e.getWordAtPosition(i);return Promise.resolve(t.provideHover(e,i,r,o)).then(e=>{if(e)return!e.range&&n&&(e.range=new oq.Range(i.lineNumber,n.startColumn,i.lineNumber,n.endColumn)),e.range||(e.range=new oq.Range(i.lineNumber,i.column,i.lineNumber,i.column)),e})}})},registerDocumentSymbolProvider:function(e,t){return r0.StandaloneServices.get(oz.ILanguageFeaturesService).documentSymbolProvider.register(e,t)},registerDocumentHighlightProvider:function(e,t){return r0.StandaloneServices.get(oz.ILanguageFeaturesService).documentHighlightProvider.register(e,t)},registerLinkedEditingRangeProvider:function(e,t){return r0.StandaloneServices.get(oz.ILanguageFeaturesService).linkedEditingRangeProvider.register(e,t)},registerDefinitionProvider:function(e,t){return r0.StandaloneServices.get(oz.ILanguageFeaturesService).definitionProvider.register(e,t)},registerImplementationProvider:function(e,t){return r0.StandaloneServices.get(oz.ILanguageFeaturesService).implementationProvider.register(e,t)},registerTypeDefinitionProvider:function(e,t){return r0.StandaloneServices.get(oz.ILanguageFeaturesService).typeDefinitionProvider.register(e,t)},registerCodeLensProvider:function(e,t){return r0.StandaloneServices.get(oz.ILanguageFeaturesService).codeLensProvider.register(e,t)},registerCodeActionProvider:function(e,t,i){return r0.StandaloneServices.get(oz.ILanguageFeaturesService).codeActionProvider.register(e,{providedCodeActionKinds:i?.providedCodeActionKinds,documentation:i?.documentation,provideCodeActions:(e,i,r,o)=>{let n=r0.StandaloneServices.get(r5.IMarkerService).read({resource:e.uri}).filter(e=>oq.Range.areIntersectingOrTouching(e,i));return t.provideCodeActions(e,i,{markers:n,only:r.only,trigger:r.trigger},o)},resolveCodeAction:t.resolveCodeAction})},registerDocumentFormattingEditProvider:function(e,t){return r0.StandaloneServices.get(oz.ILanguageFeaturesService).documentFormattingEditProvider.register(e,t)},registerDocumentRangeFormattingEditProvider:function(e,t){return r0.StandaloneServices.get(oz.ILanguageFeaturesService).documentRangeFormattingEditProvider.register(e,t)},registerOnTypeFormattingEditProvider:function(e,t){return r0.StandaloneServices.get(oz.ILanguageFeaturesService).onTypeFormattingEditProvider.register(e,t)},registerLinkProvider:function(e,t){return r0.StandaloneServices.get(oz.ILanguageFeaturesService).linkProvider.register(e,t)},registerColorProvider:function(e,t){return r0.StandaloneServices.get(oz.ILanguageFeaturesService).colorProvider.register(e,t)},registerFoldingRangeProvider:function(e,t){return r0.StandaloneServices.get(oz.ILanguageFeaturesService).foldingRangeProvider.register(e,t)},registerDeclarationProvider:function(e,t){return r0.StandaloneServices.get(oz.ILanguageFeaturesService).declarationProvider.register(e,t)},registerSelectionRangeProvider:function(e,t){return r0.StandaloneServices.get(oz.ILanguageFeaturesService).selectionRangeProvider.register(e,t)},registerDocumentSemanticTokensProvider:function(e,t){return r0.StandaloneServices.get(oz.ILanguageFeaturesService).documentSemanticTokensProvider.register(e,t)},registerDocumentRangeSemanticTokensProvider:function(e,t){return r0.StandaloneServices.get(oz.ILanguageFeaturesService).documentRangeSemanticTokensProvider.register(e,t)},registerInlineCompletionsProvider:function(e,t){return r0.StandaloneServices.get(oz.ILanguageFeaturesService).inlineCompletionsProvider.register(e,t)},registerInlayHintsProvider:function(e,t){return r0.StandaloneServices.get(oz.ILanguageFeaturesService).inlayHintsProvider.register(e,t)},DocumentHighlightKind:rk.DocumentHighlightKind,CompletionItemKind:rk.CompletionItemKind,CompletionItemTag:rk.CompletionItemTag,CompletionItemInsertTextRule:rk.CompletionItemInsertTextRule,SymbolKind:rk.SymbolKind,SymbolTag:rk.SymbolTag,IndentAction:rk.IndentAction,CompletionTriggerKind:rk.CompletionTriggerKind,SignatureHelpTriggerKind:rk.SignatureHelpTriggerKind,InlayHintKind:rk.InlayHintKind,InlineCompletionTriggerKind:rk.InlineCompletionTriggerKind,CodeActionTriggerType:rk.CodeActionTriggerType,NewSymbolNameTag:rk.NewSymbolNameTag,NewSymbolNameTriggerKind:rk.NewSymbolNameTriggerKind,PartialAcceptTriggerKind:rk.PartialAcceptTriggerKind,HoverVerbosityAction:rk.HoverVerbosityAction,InlineCompletionEndOfLifeReasonKind:rk.InlineCompletionEndOfLifeReasonKind,InlineCompletionHintStyle:rk.InlineCompletionHintStyle,FoldingRangeKind:rS.FoldingRangeKind,SelectedSuggestionInfo:rS.SelectedSuggestionInfo,EditDeltaInfo:oX.EditDeltaInfo},o5.CancellationTokenSource,o5.Emitter,o5.KeyCode,o5.KeyMod,o5.Position,o5.Range,o5.Selection,o5.SelectionDirection,o5.MarkerSeverity,o5.MarkerTag,o5.Uri,o5.Token;let o8=o5.editor,o7=o5.languages,o9=(0,o4.getMonacoEnvironment)(),ne=globalThis;(o9?.globalAPI||"function"==typeof ne.define&&ne.define.amd)&&(ne.monaco=o5),void 0!==ne.require&&"function"==typeof ne.require.config&&ne.require.config({ignoreDuplicateModules:["vscode-languageserver-types","vscode-languageserver-types/main","vscode-languageserver-textdocument","vscode-languageserver-textdocument/main","vscode-nls","vscode-nls/vscode-nls","jsonc-parser","jsonc-parser/main","vscode-uri","vscode-uri/index","vs/basic-languages/typescript/typescript"]});var nt=e.i(106452);let ni=o7.onLanguage;o7.onLanguage=(e,t)=>(0,rn.withReadyServices)(()=>ni(e,t));let nr=o7.onLanguage;o7.onLanguageEncountered=(e,t)=>(0,rn.withReadyServices)(()=>nr(e,t)),o8.create=nt.createConfiguredEditor,o8.createDiffEditor=nt.createConfiguredDiffEditor,o8.createModelReference=nt.createModelReference,o8.writeFile=nt.writeFile;var no=e.i(290231),nn=e.i(22465),ns=e.i(467724),na=e.i(107043),nl=e.i(702320),nc=e.i(193409),nd=e.i(554250),nu=rd,nh=e.i(819593),ng=e.i(13306);let np=class extends nu.Disposable{constructor(e,t,i){super(),this.configurationService=e,this.modelService=t,this.languageService=i,this._onDidChangeConfiguration=this._register(new r7.Emitter),this.onDidChangeConfiguration=this._onDidChangeConfiguration.event,this._register(this.configurationService.onDidChangeConfiguration(e=>this._onDidChangeConfiguration.fire(this.toResourceConfigurationChangeEvent(e))))}getValue(e,t,i){return"string"==typeof i?this._getValue(e,nh.Position.isIPosition(t)?t:null,i):this._getValue(e,null,"string"==typeof t?t:void 0)}updateValue(e,t,i,r){let o=e?this.getLanguage(e,null):null,n=this.configurationService.inspect(t,{resource:e,overrideIdentifier:o});void 0===r&&(r=this.deriveConfigurationTarget(n,o));let s=o&&n.overrideIdentifiers?.includes(o)?o:void 0;return this.configurationService.updateValue(t,i,{resource:e,overrideIdentifier:s},r)}deriveConfigurationTarget(e,t){if(t){if(e.memory?.override!==void 0)return ng.ConfigurationTarget.MEMORY;if(e.workspaceFolder?.override!==void 0)return ng.ConfigurationTarget.WORKSPACE_FOLDER;if(e.workspace?.override!==void 0)return ng.ConfigurationTarget.WORKSPACE;if(e.userRemote?.override!==void 0)return ng.ConfigurationTarget.USER_REMOTE;if(e.userLocal?.override!==void 0)return ng.ConfigurationTarget.USER_LOCAL}return e.memory?.value!==void 0?ng.ConfigurationTarget.MEMORY:e.workspaceFolder?.value!==void 0?ng.ConfigurationTarget.WORKSPACE_FOLDER:e.workspace?.value!==void 0?ng.ConfigurationTarget.WORKSPACE:e.userRemote?.value!==void 0?ng.ConfigurationTarget.USER_REMOTE:ng.ConfigurationTarget.USER_LOCAL}_getValue(e,t,i){let r=e?this.getLanguage(e,t):void 0;return void 0===i?this.configurationService.getValue({resource:e,overrideIdentifier:r}):this.configurationService.getValue(i,{resource:e,overrideIdentifier:r})}inspect(e,t,i){let r=e?this.getLanguage(e,t):void 0;return this.configurationService.inspect(i,{resource:e,overrideIdentifier:r})}getLanguage(e,t){let i=this.modelService.getModel(e);return i?t?i.getLanguageIdAtPosition(t.lineNumber,t.column):i.getLanguageId():this.languageService.guessLanguageIdByFilepathOrFirstLine(e)}toResourceConfigurationChangeEvent(e){return{affectedKeys:e.affectedKeys,affectsConfiguration:(t,i)=>{let r=t?this.getLanguage(t,null):void 0;return!!e.affectsConfiguration(i,{resource:t,overrideIdentifier:r})||!!r&&e.affectedKeys.has(`[${r}]`)}}}};np=(0,rM.__decorate)([(0,rM.__param)(0,rW.IConfigurationService),(0,rM.__param)(1,rE.IModelService),(0,rM.__param)(2,rb.ILanguageService)],np);var nm=e.i(2267),nf=e.i(553638),nv=e.i(526097),n_=e.i(853457),ny=e.i(990091),nC=e.i(621826),nS=e.i(474320),nb=e.i(991307),nw=e.i(399362),nx=e.i(506986),nD=e.i(107700),nE=e.i(425024),nk=e.i(4160);let nT=".vscode",nR="settings",nP=`${nT}/${nR}.json`,nI="vscode://schemas/settings/workspace",nA=[nm.ConfigurationScope.APPLICATION,nm.ConfigurationScope.APPLICATION_MACHINE],nM=[nm.ConfigurationScope.MACHINE,nm.ConfigurationScope.WINDOW,nm.ConfigurationScope.RESOURCE,nm.ConfigurationScope.LANGUAGE_OVERRIDABLE,nm.ConfigurationScope.MACHINE_OVERRIDABLE],nL=[nm.ConfigurationScope.WINDOW,nm.ConfigurationScope.RESOURCE,nm.ConfigurationScope.LANGUAGE_OVERRIDABLE],nF=[nm.ConfigurationScope.APPLICATION,...nL],nO=[nm.ConfigurationScope.MACHINE,nm.ConfigurationScope.APPLICATION_MACHINE,nm.ConfigurationScope.WINDOW,nm.ConfigurationScope.RESOURCE,nm.ConfigurationScope.LANGUAGE_OVERRIDABLE,nm.ConfigurationScope.MACHINE_OVERRIDABLE],nN=[nm.ConfigurationScope.WINDOW,nm.ConfigurationScope.RESOURCE,nm.ConfigurationScope.LANGUAGE_OVERRIDABLE,nm.ConfigurationScope.MACHINE_OVERRIDABLE],n$=[nm.ConfigurationScope.RESOURCE,nm.ConfigurationScope.LANGUAGE_OVERRIDABLE,nm.ConfigurationScope.MACHINE_OVERRIDABLE],nH="tasks",nU="launch",nW=Object.create(null);nW[nH]=`${nT}/${nH}.json`,nW[nU]=`${nT}/${nU}.json`,nW.mcp=`${nT}/mcp.json`;let nq=Object.create(null);nq[nH]=`${nH}.json`,nq.mcp="mcp.json";let nj="workbench.settings.applyToAllProfiles";var nz=e.i(608326),nK=e.i(888961),nV=rd,nB=e.i(399119),nG=e.i(367835);let nQ=nC.Registry.as(nk.Extensions.JSONContribution),nJ=nC.Registry.as(nm.Extensions.Configuration),nY={type:"object",defaultSnippets:[{body:{title:"",properties:{}}}],properties:{title:{description:(0,oi.localize)(2626,"A title for the current category of settings. This label will be rendered in the Settings editor as a subheading. If the title is the same as the extension display name, then the category will be grouped under the main extension heading."),type:"string"},order:{description:(0,oi.localize)(2627,"When specified, gives the order of this category of settings relative to other categories."),type:"integer"},properties:{description:(0,oi.localize)(2628,"Description of the configuration properties."),type:"object",propertyNames:{pattern:"\\S+",patternErrorMessage:(0,oi.localize)(2629,"Property should not be empty.")},additionalProperties:{anyOf:[{title:(0,oi.localize)(2630,"Schema of the configuration property."),$ref:"http://json-schema.org/draft-07/schema#"},{type:"object",properties:{scope:{type:"string",enum:["application","machine","window","resource","language-overridable","machine-overridable"],default:"window",enumDescriptions:[(0,oi.localize)(2631,"Configuration that can be configured only in the user settings."),(0,oi.localize)(2632,"Configuration that can be configured only in the user settings or only in the remote settings."),(0,oi.localize)(2633,"Configuration that can be configured in the user, remote or workspace settings."),(0,oi.localize)(2634,"Configuration that can be configured in the user, remote, workspace or folder settings."),(0,oi.localize)(2635,"Resource configuration that can be configured in language specific settings."),(0,oi.localize)(2636,"Machine configuration that can be configured also in workspace or folder settings.")],markdownDescription:(0,oi.localize)(2637,"Scope in which the configuration is applicable. Available scopes are `application`, `machine`, `window`, `resource`, and `machine-overridable`.")},enumDescriptions:{type:"array",items:{type:"string"},description:(0,oi.localize)(2638,"Descriptions for enum values")},markdownEnumDescriptions:{type:"array",items:{type:"string"},description:(0,oi.localize)(2639,"Descriptions for enum values in the markdown format.")},enumItemLabels:{type:"array",items:{type:"string"},markdownDescription:(0,oi.localize)(2640,"Labels for enum values to be displayed in the Settings editor. When specified, the {0} values still show after the labels, but less prominently.","`enum`")},markdownDescription:{type:"string",description:(0,oi.localize)(2641,"The description in the markdown format.")},deprecationMessage:{type:"string",description:(0,oi.localize)(2642,"If set, the property is marked as deprecated and the given message is shown as an explanation.")},markdownDeprecationMessage:{type:"string",description:(0,oi.localize)(2643,"If set, the property is marked as deprecated and the given message is shown as an explanation in the markdown format.")},editPresentation:{type:"string",enum:["singlelineText","multilineText"],enumDescriptions:[(0,oi.localize)(2644,"The value will be shown in an inputbox."),(0,oi.localize)(2645,"The value will be shown in a textarea.")],default:"singlelineText",description:(0,oi.localize)(2646,"When specified, controls the presentation format of the string setting.")},order:{type:"integer",description:(0,oi.localize)(2647,"When specified, gives the order of this setting relative to other settings within the same category. Settings with an order property will be placed before settings without this property set.")},ignoreSync:{type:"boolean",description:(0,oi.localize)(2648,"When enabled, Settings Sync will not sync the user value of this configuration by default.")},tags:{type:"array",items:{type:"string",enum:["accessibility","advanced","experimental","telemetry","usesOnlineServices"],enumDescriptions:[(0,oi.localize)(2649,"Accessibility settings"),(0,oi.localize)(2650,"Advanced settings are hidden by default in the Settings editor unless the user chooses to show advanced settings."),(0,oi.localize)(2651,"Experimental settings are subject to change and may be removed in future releases."),(0,oi.localize)(2652,"Preview settings can be used to try out new features before they are finalized."),(0,oi.localize)(2653,"Telemetry settings"),(0,oi.localize)(2654,"Settings that use online services")]},additionalItems:!0,markdownDescription:(0,oi.localize)(2655,"A list of tags under which to place the setting. The tag can then be searched up in the Settings editor. For example, specifying the `experimental` tag allows one to find the setting by searching `@tag:experimental`.")}}}]}}}},nX=nE.ExtensionsRegistry.registerExtensionPoint({extensionPoint:"configurationDefaults",jsonSchema:{$ref:nm.configurationDefaultsSchemaId},canHandleResolver:!0});nX.setHandler((e,{added:i,removed:r})=>{t&&nJ.deltaConfiguration(t);let o=t={};if(queueMicrotask(()=>{t===o&&(nJ.deltaConfiguration(t),t=void 0)}),r.length){let e=r.map(e=>({overrides:(0,nD.deepClone)(e.value),source:{id:e.description.identifier.value,displayName:e.description.displayName}}));t.removedDefaults=e}if(i.length){let e=nJ.getConfigurationProperties(),r=[nm.ConfigurationScope.MACHINE_OVERRIDABLE,nm.ConfigurationScope.WINDOW,nm.ConfigurationScope.RESOURCE,nm.ConfigurationScope.LANGUAGE_OVERRIDABLE],o=i.map(t=>{let i=(0,nD.deepClone)(t.value);for(let o of Object.keys(i)){let n=e[o];if(n?.disallowConfigurationDefault){t.collector.warn((0,oi.localize)(2656,"Cannot register configuration defaults for '{0}'. This setting does not allow contributing configuration defaults.",o)),delete i[o];continue}if(!nm.OVERRIDE_PROPERTY_REGEX.test(o)&&n?.scope&&!r.includes(n.scope)){t.collector.warn((0,oi.localize)(2657,"Cannot register configuration defaults for '{0}'. Only defaults for machine-overridable, window, resource and language overridable scoped settings are supported.",o)),delete i[o];continue}}return{overrides:i,source:{id:t.description.identifier.value,displayName:t.description.displayName}}});t.addedDefaults=o}});let nZ=nE.ExtensionsRegistry.registerExtensionPoint({extensionPoint:"configuration",deps:[nX],jsonSchema:{description:(0,oi.localize)(2658,"Contributes configuration settings."),oneOf:[nY,{type:"array",items:nY}]},canHandleResolver:!0}),n0=new nz.ExtensionIdentifierMap;nZ.setHandler((e,{added:i,removed:r})=>{if(t??={},r.length){let e=[];for(let t of r)e.push(...n0.get(t.description.identifier)||[]),n0.delete(t.description.identifier);t.removedConfigurations=e}let o=new Set;function n(e,t){let i=(0,nD.deepClone)(e);return i.title&&"string"!=typeof i.title&&t.collector.error((0,oi.localize)(2659,"'configuration.title' must be a string")),function e(t,i){let r=t.properties,n=nG.default.extensionConfigurationPolicy;if(r)for(let e in"object"!=typeof r&&(i.collector.error((0,oi.localize)(2660,"'configuration.properties' must be an object")),t.properties={}),r){let t=r[e],s=(0,nm.validateProperty)(e,t,i.description.identifier.value);if(s){delete r[e],i.collector.warn(s);continue}if(o.has(e)&&!nm.EXTENSION_UNIFICATION_EXTENSION_IDS.has(i.description.identifier.value.toLowerCase())){delete r[e],i.collector.warn((0,oi.localize)(2661,"Cannot register '{0}'. This property is already registered.",e));continue}if(!(0,oK.isObject)(t)){delete r[e],i.collector.error((0,oi.localize)(2662,"configuration.properties property '{0}' must be an object",e));continue}n?.[e]&&(t.policy=n?.[e]),t.tags?.some(e=>"onexp"===e.toLowerCase())&&(t.experiment={mode:"startup"}),o.add(e),t.scope=t.scope?(0,nm.parseScope)(t.scope.toString()):nm.ConfigurationScope.WINDOW}let s=t.allOf;if(s)for(let t of(i.collector.error((0,oi.localize)(2663,"'configuration.allOf' is deprecated and should no longer be used. Instead, pass multiple configuration sections as an array to the 'configuration' contribution point.")),s))e(t,i)}(i,t),i.id=e.id||t.description.identifier.value,i.extensionInfo={id:t.description.identifier.value,displayName:t.description.displayName},i.restrictedProperties=t.description.capabilities?.untrustedWorkspaces?.supported==="limited"?t.description.capabilities?.untrustedWorkspaces.restrictedConfigurations:void 0,i.title=i.title||t.description.displayName||t.description.identifier.value,i}if(i.length){let e=[];for(let t of i){let i=[],r=t.value;Array.isArray(r)?r.forEach(e=>i.push(n(e,t))):i.push(n(r,t)),n0.set(t.description.identifier,i),e.push(...i)}t.addedConfigurations=e}nJ.deltaConfiguration(t),t=void 0}),nQ.registerSchema("vscode://schemas/workspaceConfig",{allowComments:!0,allowTrailingCommas:!0,default:{folders:[{path:""}],settings:{}},required:["folders"],properties:{folders:{minItems:0,uniqueItems:!0,description:(0,oi.localize)(2664,"List of folders to be loaded in the workspace."),items:{type:"object",defaultSnippets:[{body:{path:"$1"}}],oneOf:[{properties:{path:{type:"string",description:(0,oi.localize)(2665,"A file path. e.g. `/root/folderA` or `./folderA` for a relative path that will be resolved against the location of the workspace file.")},name:{type:"string",description:(0,oi.localize)(2666,"An optional name for the folder. ")}},required:["path"]},{properties:{uri:{type:"string",description:(0,oi.localize)(2667,"URI of the folder")},name:{type:"string",description:(0,oi.localize)(2666,"An optional name for the folder. ")}},required:["uri"]}]}},settings:{type:"object",default:{},description:(0,oi.localize)(2668,"Workspace settings"),$ref:nI},launch:{type:"object",default:{configurations:[],compounds:[]},description:(0,oi.localize)(2669,"Workspace launch configurations"),$ref:"vscode://schemas/launch"},tasks:{type:"object",default:{version:"2.0.0",tasks:[]},description:(0,oi.localize)(2670,"Workspace task configurations"),$ref:"vscode://schemas/tasks"},mcp:{type:"object",default:{inputs:[],servers:{"mcp-server-time":{command:"uvx",args:["mcp_server_time","--local-timezone=America/Los_Angeles"]}}},description:(0,oi.localize)(2671,"Model Context Protocol server configurations"),$ref:"vscode://schemas/mcp"},extensions:{type:"object",default:{},description:(0,oi.localize)(2672,"Workspace extensions"),$ref:"vscode://schemas/extensions"},remoteAuthority:{type:"string",doNotSuggest:!0,description:(0,oi.localize)(2673,"The remote server where the workspace is located.")},transient:{type:"boolean",doNotSuggest:!0,description:(0,oi.localize)(2674,"A transient workspace will disappear when restarting or reloading.")}},errorMessage:(0,oi.localize)(2675,"Unknown workspace configuration property")});class n1 extends nV.Disposable{constructor(){super(...arguments),this.type="table"}shouldRender(e){return!!e.contributes?.configuration}render(e){let t=e.contributes?.configuration?Array.isArray(e.contributes.configuration)?e.contributes.configuration:[e.contributes.configuration]:[],i=(0,nm.getAllConfigurationProperties)(t),r=i?Object.keys(i):[];return{data:{headers:[(0,oi.localize)(2676,"ID"),(0,oi.localize)(2677,"Description"),(0,oi.localize)(2678,"Default")],rows:r.sort((e,t)=>e.localeCompare(t)).map(e=>[new nB.MarkdownString().appendMarkdown(`\`${e}\``),i[e].markdownDescription?new nB.MarkdownString(i[e].markdownDescription,!1):i[e].description??"",new nB.MarkdownString().appendCodeblock("json",JSON.stringify((0,oK.isUndefined)(i[e].default)?(0,nm.getDefaultValue)(i[e].type):i[e].default,null,2))])},dispose:()=>{}}}}nC.Registry.as(nK.Extensions.ExtensionFeaturesRegistry).registerExtensionFeature({id:"configuration",label:(0,oi.localize)(2679,"Settings"),access:{canToggle:!1},renderer:new nv.SyncDescriptor(n1)});class n2 extends nV.Disposable{constructor(){super(...arguments),this.type="table"}shouldRender(e){return!!e.contributes?.configurationDefaults}render(e){let t=e.contributes?.configurationDefaults??{},i=[(0,oi.localize)(2680,"Languages"),(0,oi.localize)(2681,"Setting"),(0,oi.localize)(2682,"Override Value")],r=[];for(let e of Object.keys(t).sort((e,t)=>e.localeCompare(t))){let i=t[e];if(nm.OVERRIDE_PROPERTY_REGEX.test(e)){let t=(0,nm.overrideIdentifiersFromKey)(e),o=new nB.MarkdownString().appendMarkdown(`${t.join(", ")}`);for(let e of Object.keys(i).sort((e,t)=>e.localeCompare(t))){let t=[];t.push(o),t.push(new nB.MarkdownString().appendMarkdown(`\`${e}\``)),t.push(new nB.MarkdownString().appendCodeblock("json",JSON.stringify(i[e],null,2))),r.push(t)}}else{let t=[];t.push(""),t.push(new nB.MarkdownString().appendMarkdown(`\`${e}\``)),t.push(new nB.MarkdownString().appendCodeblock("json",JSON.stringify(i,null,2))),r.push(t)}}return{data:{headers:i,rows:r},dispose:()=>{}}}}nC.Registry.as(nK.Extensions.ExtensionFeaturesRegistry).registerExtensionFeature({id:"configurationDefaults",label:(0,oi.localize)(2683,"Settings Default Overrides"),access:{canToggle:!1},renderer:new nv.SyncDescriptor(n2)});var n6=e.i(697786),n3=e.i(683578),n4=e.i(578953),n5=rd,n8=e.i(216822),n7=e.i(975445),n9=e.i(693162),se=e.i(74304),st=e.i(428048),si=e.i(701575),sr=e.i(140889),so=e.i(927718),sn=r2,ss=e.i(856884),sa=e.i(51593),sl=e.i(770326);let sc=class extends n5.Disposable{constructor(e,t,i,r,o,n){super(),this.contextService=e,this.notificationService=t,this.fileService=i,this.quickInputService=r,this.hostService=o,this.storageService=n,this.findWorkspaces()}async findWorkspaces(){let e=this.contextService.getWorkspace().folders[0];if(!e||this.contextService.getWorkbenchState()!==n4.WorkbenchState.FOLDER||(0,so.isVirtualWorkspace)(this.contextService.getWorkspace()))return;let t=(await this.fileService.resolve(e.uri)).children?.map(e=>e.name);if(Array.isArray(t)){let i=t.filter(n4.hasWorkspaceFileExtension);i.length>0&&this.doHandleWorkspaceFiles(e.uri,i)}}doHandleWorkspaceFiles(e,t){let i={id:"workspaces.dontPromptToOpen",scope:n8.NeverShowAgainScope.WORKSPACE,isSecondary:!0};if(1===t.length){let r=t[0];this.notificationService.prompt(sl.default.Info,(0,oi.localize)(13579,"This folder contains a workspace file '{0}'. Do you want to open it? [Learn more]({1}) about workspace files.",r,"https://go.microsoft.com/fwlink/?linkid=2025315"),[{label:(0,oi.localize)(13580,"Open Workspace"),run:()=>this.hostService.openWindow([{workspaceUri:(0,n9.joinPath)(e,r)}])}],{neverShowAgain:i,priority:this.storageService.isNew(si.StorageScope.WORKSPACE)?n8.NotificationPriority.OPTIONAL:n8.NotificationPriority.SILENT})}else t.length>1&&this.notificationService.prompt(sl.default.Info,(0,oi.localize)(13581,"This folder contains multiple workspace files. Do you want to open one? [Learn more]({0}) about workspace files.","https://go.microsoft.com/fwlink/?linkid=2025315"),[{label:(0,oi.localize)(13582,"Select Workspace"),run:()=>{this.quickInputService.pick(t.map(e=>({label:e})),{placeHolder:(0,oi.localize)(13583,"Select a workspace to open")}).then(t=>{t&&this.hostService.openWindow([{workspaceUri:(0,n9.joinPath)(e,t.label)}])})}}],{neverShowAgain:i,priority:this.storageService.isNew(si.StorageScope.WORKSPACE)?n8.NotificationPriority.OPTIONAL:n8.NotificationPriority.SILENT})}};sc=(0,rM.__decorate)([(0,rM.__param)(0,nw.IWorkspaceContextService),(0,rM.__param)(1,n7.INotificationService),(0,rM.__param)(2,nf.IFileService),(0,rM.__param)(3,st.IQuickInputService),(0,rM.__param)(4,se.IHostService),(0,rM.__param)(5,sr.IStorageService)],sc),nC.Registry.as(n6.Extensions.Workbench).registerWorkbenchContribution(sc,n3.LifecyclePhase.Eventually),(0,sn.registerAction2)(class extends sn.Action2{constructor(){super({id:"workbench.action.openWorkspaceFromEditor",title:(0,oi.localize2)(13580,"Open Workspace"),f1:!1,menu:{id:sn.MenuId.EditorContent,when:r3.ContextKeyExpr.and(ss.ResourceContextKey.Extension.isEqualTo(n4.WORKSPACE_SUFFIX),ss.ActiveEditorContext.isEqualTo(sa.TEXT_FILE_EDITOR_ID),ss.TemporaryWorkspaceContext.toNegated())}})}async run(e,t){let i=e.get(se.IHostService),r=e.get(nw.IWorkspaceContextService),o=e.get(n7.INotificationService);if(r.getWorkbenchState()===n4.WorkbenchState.WORKSPACE){let e=r.getWorkspace().configuration;if(e&&(0,n9.isEqual)(e,t))return void o.info((0,oi.localize)(13584,"This workspace is already open."))}return i.openWindow([{workspaceUri:t}])}});var sd=e.i(802186),su=rd,sh=e.i(590746),sg=n4,sp=e.i(737917),sm=e.i(378442),sf=sp;class sv extends sf.ConfigurationModelParser{constructor(e,t){super(e,t),this._folders=[],this._transient=!1,this._settingsModelParser=new sf.ConfigurationModelParser(e,t),this._launchModel=sf.ConfigurationModel.createEmptyModel(t),this._tasksModel=sf.ConfigurationModel.createEmptyModel(t)}get folders(){return this._folders}get transient(){return this._transient}get settingsModel(){return this._settingsModelParser.configurationModel}get launchModel(){return this._launchModel}get tasksModel(){return this._tasksModel}reparseWorkspaceSettings(e){this._settingsModelParser.reparse(e)}getRestrictedWorkspaceSettings(){return this._settingsModelParser.restrictedConfigurations}doParseRaw(e,t){return this._folders=e.folders||[],this._transient=(0,oK.isBoolean)(e.transient)&&e.transient,this._settingsModelParser.parseRaw(e.settings,t),this._launchModel=this.createConfigurationModelFrom(e,"launch"),this._tasksModel=this.createConfigurationModelFrom(e,"tasks"),super.doParseRaw(e,t)}createConfigurationModelFrom(e,t){let i=e[t];if(i){let e=(0,ng.toValuesTree)(i,e=>console.error(`Conflict in settings file ${this._name}: ${e}`)),r=Object.create(null);r[t]=e;let o=Object.keys(i).map(e=>`${t}.${e}`);return new sf.ConfigurationModel(r,o,[],void 0,this.logService)}return sf.ConfigurationModel.createEmptyModel(this.logService)}}class s_ extends sf.ConfigurationModelParser{constructor(e,t,i){super(e,i),this.scope=t}doParseRaw(e,t){let i=(0,ng.toValuesTree)(e,e=>console.error(`Conflict in settings file ${this._name}: ${e}`)),r=Object.create(null);return r[this.scope]=i,{contents:r,keys:Object.keys(e).map(e=>`${this.scope}.${e}`),overrides:[]}}}class sy extends sf.Configuration{constructor(e,t,i,r,o,n,s,a,l,c,d){super(e,t,i,r,o,n,s,a,l,d),this._workspace=c}getValue(e,t={}){return super.getValue(e,t,this._workspace)}inspect(e,t={}){return super.inspect(e,t,this._workspace)}keys(){return super.keys(this._workspace)}compareAndDeleteFolderConfiguration(e){return this._workspace&&this._workspace.folders.length>0&&this._workspace.folders[0].uri.toString()===e.toString()?{keys:[],overrides:[]}:super.compareAndDeleteFolderConfiguration(e)}compare(e){let t=(t,i,r)=>{let o=[];return o.push(...i.filter(e=>-1===t.indexOf(e))),o.push(...t.filter(e=>-1===i.indexOf(e))),o.push(...t.filter(t=>-1!==i.indexOf(t)&&(!(0,nD.equals)(this.getValue(t,{overrideIdentifier:r}),e.getValue(t,{overrideIdentifier:r}))||this._workspace&&this._workspace.folders.some(i=>!(0,nD.equals)(this.getValue(t,{resource:i.uri,overrideIdentifier:r}),e.getValue(t,{resource:i.uri,overrideIdentifier:r})))))),o},i=t(this.allKeys(),e.allKeys()),r=[];for(let i of(0,ox.distinct)([...this.allOverrideIdentifiers(),...e.allOverrideIdentifiers()])){let o=t(this.getAllKeysForOverrideIdentifier(i),e.getAllKeysForOverrideIdentifier(i),i);o.length&&r.push([i,o])}return{keys:i,overrides:r}}}var sC=e.i(95940),sS=e.i(292608),sb=e.i(242671),sw=e.i(170774),sx=e.i(386567),sD=e.i(652731),sE=e.i(905670),sk=e.i(362361),sT=e.i(509046),sR=e.i(315380),sP=e.i(17607),sI=oE,sA=e.i(951129);(E=N||(N={}))[E.ERROR_UNKNOWN_KEY=0]="ERROR_UNKNOWN_KEY",E[E.ERROR_INVALID_WORKSPACE_CONFIGURATION_APPLICATION=1]="ERROR_INVALID_WORKSPACE_CONFIGURATION_APPLICATION",E[E.ERROR_INVALID_WORKSPACE_CONFIGURATION_MACHINE=2]="ERROR_INVALID_WORKSPACE_CONFIGURATION_MACHINE",E[E.ERROR_INVALID_FOLDER_CONFIGURATION=3]="ERROR_INVALID_FOLDER_CONFIGURATION",E[E.ERROR_INVALID_USER_TARGET=4]="ERROR_INVALID_USER_TARGET",E[E.ERROR_INVALID_WORKSPACE_TARGET=5]="ERROR_INVALID_WORKSPACE_TARGET",E[E.ERROR_INVALID_FOLDER_TARGET=6]="ERROR_INVALID_FOLDER_TARGET",E[E.ERROR_INVALID_RESOURCE_LANGUAGE_CONFIGURATION=7]="ERROR_INVALID_RESOURCE_LANGUAGE_CONFIGURATION",E[E.ERROR_NO_WORKSPACE_OPENED=8]="ERROR_NO_WORKSPACE_OPENED",E[E.ERROR_CONFIGURATION_FILE_DIRTY=9]="ERROR_CONFIGURATION_FILE_DIRTY",E[E.ERROR_CONFIGURATION_FILE_MODIFIED_SINCE=10]="ERROR_CONFIGURATION_FILE_MODIFIED_SINCE",E[E.ERROR_INVALID_CONFIGURATION=11]="ERROR_INVALID_CONFIGURATION",E[E.ERROR_POLICY_CONFIGURATION=12]="ERROR_POLICY_CONFIGURATION",E[E.ERROR_INTERNAL=13]="ERROR_INTERNAL";class sM extends sI.ErrorNoTelemetry{constructor(e,t){super(e),this.code=t}}(k=$||($={}))[k.USER_LOCAL=1]="USER_LOCAL",k[k.USER_REMOTE=2]="USER_REMOTE",k[k.WORKSPACE=3]="WORKSPACE",k[k.WORKSPACE_FOLDER=4]="WORKSPACE_FOLDER";let sL=class{constructor(e,t,i,r,o,n,s,a,l,c,d,u,h){this.remoteSettingsResource=e,this.configurationService=t,this.contextService=i,this.userDataProfileService=r,this.userDataProfilesService=o,this.fileService=n,this.textModelResolverService=s,this.textFileService=a,this.notificationService=l,this.preferencesService=c,this.editorService=d,this.uriIdentityService=u,this.filesConfigurationService=h,this.queue=new sh.Queue}async writeConfiguration(e,t,i={}){let r=this.getConfigurationEditOperation(e,t,i.scopes||{});return this.queue.queue(async()=>{try{await this.doWriteConfiguration(r,i)}catch(e){if(i.donotNotifyError)throw e;await this.onError(e,r,i.scopes)}})}async doWriteConfiguration(e,t){await this.validate(e.target,e,!t.handleDirtyFile,t.scopes||{});let i=e.resource,r=await this.resolveModelReference(i);try{let i=this.getFormattingOptions(r.object.textEditorModel);await this.updateConfiguration(e,r.object.textEditorModel,i,t)}finally{r.dispose()}}async updateConfiguration(e,t,i,r){if(this.hasParseErrors(t.getValue(),e))throw this.toConfigurationEditingError(N.ERROR_INVALID_CONFIGURATION,e.target,e);if(this.textFileService.isDirty(t.uri)&&r.handleDirtyFile)switch(r.handleDirtyFile){case"save":await this.save(t,e);break;case"revert":await this.textFileService.revert(t.uri)}let o=this.getEdits(e,t.getValue(),i)[0];if(o){let i;try{i=this.filesConfigurationService.enableAutoSaveAfterShortDelay(t.uri),this.applyEditsToBuffer(o,t)&&await this.save(t,e)}finally{i?.dispose()}}}async save(e,t){try{await this.textFileService.save(e.uri,{ignoreErrorHandler:!0})}catch(e){if(e.fileOperationResult===sD.FileOperationResult.FILE_MODIFIED_SINCE)throw this.toConfigurationEditingError(N.ERROR_CONFIGURATION_FILE_MODIFIED_SINCE,t.target,t);throw new sM((0,oi.localize)(13758,"Error while writing to {0}. {1}",this.stringifyTarget(t.target),e.message),N.ERROR_INTERNAL)}}applyEditsToBuffer(e,t){let i=t.getPositionAt(e.offset),r=t.getPositionAt(e.offset+e.length),o=new oq.Range(i.lineNumber,i.column,r.lineNumber,r.column),n=t.getValueInRange(o);if(e.content!==n){let r=n?sR.EditOperation.replace(o,e.content):sR.EditOperation.insert(i,e.content);return t.pushEditOperations([new oP.Selection(i.lineNumber,i.column,i.lineNumber,i.column)],[r],()=>[]),!0}return!1}getEdits({value:e,jsonPath:t},i,r){return t.length?(0,sb.setProperty)(i,t,e,r):[{content:JSON.stringify(e,null,r.insertSpaces&&r.tabSize?" ".repeat(r.tabSize):" "),length:i.length,offset:0}]}getFormattingOptions(e){let{insertSpaces:t,tabSize:i}=e.getOptions();return{insertSpaces:t,tabSize:i,eol:e.getEOL()}}async onError(e,t,i){switch(e.code){case N.ERROR_INVALID_CONFIGURATION:this.onInvalidConfigurationError(e,t);break;case N.ERROR_CONFIGURATION_FILE_DIRTY:this.onConfigurationFileDirtyError(e,t,i);break;case N.ERROR_CONFIGURATION_FILE_MODIFIED_SINCE:return this.doWriteConfiguration(t,{scopes:i,handleDirtyFile:"revert"});default:this.notificationService.error(e.message)}}onInvalidConfigurationError(e,t){let i=t.workspaceStandAloneConfigurationKey===nH?(0,oi.localize)(13759,"Open Tasks Configuration"):t.workspaceStandAloneConfigurationKey===nU?(0,oi.localize)(13760,"Open Launch Configuration"):"mcp"===t.workspaceStandAloneConfigurationKey?(0,oi.localize)(13761,"Open MCP Configuration"):null;i?this.notificationService.prompt(sl.default.Error,e.message,[{label:i,run:()=>this.openFile(t.resource)}]):this.notificationService.prompt(sl.default.Error,e.message,[{label:(0,oi.localize)(13762,"Open Settings"),run:()=>this.openSettings(t)}])}onConfigurationFileDirtyError(e,t,i){let r=t.workspaceStandAloneConfigurationKey===nH?(0,oi.localize)(13759,"Open Tasks Configuration"):t.workspaceStandAloneConfigurationKey===nU?(0,oi.localize)(13760,"Open Launch Configuration"):null;r?this.notificationService.prompt(sl.default.Error,e.message,[{label:(0,oi.localize)(13763,"Save and Retry"),run:()=>{let e=t.key?`${t.workspaceStandAloneConfigurationKey}.${t.key}`:t.workspaceStandAloneConfigurationKey;this.writeConfiguration(t.target,{key:e,value:t.value},{handleDirtyFile:"save",scopes:i})}},{label:r,run:()=>this.openFile(t.resource)}]):this.notificationService.prompt(sl.default.Error,e.message,[{label:(0,oi.localize)(13763,"Save and Retry"),run:()=>this.writeConfiguration(t.target,{key:t.key,value:t.value},{handleDirtyFile:"save",scopes:i})},{label:(0,oi.localize)(13762,"Open Settings"),run:()=>this.openSettings(t)}])}openSettings(e){let t={jsonEditor:!0};switch(e.target){case $.USER_LOCAL:this.preferencesService.openUserSettings(t);break;case $.USER_REMOTE:this.preferencesService.openRemoteSettings(t);break;case $.WORKSPACE:this.preferencesService.openWorkspaceSettings(t);break;case $.WORKSPACE_FOLDER:if(e.resource){let t=this.contextService.getWorkspaceFolder(e.resource);t&&this.preferencesService.openFolderSettings({folderUri:t.uri,jsonEditor:!0})}}}openFile(e){this.editorService.openEditor({resource:e,options:{pinned:!0}})}toConfigurationEditingError(e,t,i){return new sM(this.toErrorMessage(e,t,i),e)}toErrorMessage(e,t,i){switch(e){case N.ERROR_POLICY_CONFIGURATION:return(0,oi.localize)(13764,"Unable to write {0} because it is configured in system policy.",i.key);case N.ERROR_UNKNOWN_KEY:return(0,oi.localize)(13765,"Unable to write to {0} because {1} is not a registered configuration.",this.stringifyTarget(t),i.key);case N.ERROR_INVALID_WORKSPACE_CONFIGURATION_APPLICATION:return(0,oi.localize)(13766,"Unable to write {0} to Workspace Settings. This setting can be written only into User settings.",i.key);case N.ERROR_INVALID_WORKSPACE_CONFIGURATION_MACHINE:return(0,oi.localize)(13767,"Unable to write {0} to Workspace Settings. This setting can be written only into User settings.",i.key);case N.ERROR_INVALID_FOLDER_CONFIGURATION:return(0,oi.localize)(13768,"Unable to write to Folder Settings because {0} does not support the folder resource scope.",i.key);case N.ERROR_INVALID_USER_TARGET:return(0,oi.localize)(13769,"Unable to write to User Settings because {0} does not support for global scope.",i.key);case N.ERROR_INVALID_WORKSPACE_TARGET:return(0,oi.localize)(13770,"Unable to write to Workspace Settings because {0} does not support for workspace scope in a multi folder workspace.",i.key);case N.ERROR_INVALID_FOLDER_TARGET:return(0,oi.localize)(13771,"Unable to write to Folder Settings because no resource is provided.");case N.ERROR_INVALID_RESOURCE_LANGUAGE_CONFIGURATION:return(0,oi.localize)(13772,"Unable to write to Language Settings because {0} is not a resource language setting.",i.key);case N.ERROR_NO_WORKSPACE_OPENED:return(0,oi.localize)(13773,"Unable to write to {0} because no workspace is opened. Please open a workspace first and try again.",this.stringifyTarget(t));case N.ERROR_INVALID_CONFIGURATION:if(i.workspaceStandAloneConfigurationKey===nH)return(0,oi.localize)(13774,"Unable to write into the tasks configuration file. Please open it to correct errors/warnings in it and try again.");if(i.workspaceStandAloneConfigurationKey===nU)return(0,oi.localize)(13775,"Unable to write into the launch configuration file. Please open it to correct errors/warnings in it and try again.");if("mcp"===i.workspaceStandAloneConfigurationKey)return(0,oi.localize)(13776,"Unable to write into the MCP configuration file. Please open it to correct errors/warnings in it and try again.");switch(t){case $.USER_LOCAL:return(0,oi.localize)(13777,"Unable to write into user settings. Please open the user settings to correct errors/warnings in it and try again.");case $.USER_REMOTE:return(0,oi.localize)(13778,"Unable to write into remote user settings. Please open the remote user settings to correct errors/warnings in it and try again.");case $.WORKSPACE:return(0,oi.localize)(13779,"Unable to write into workspace settings. Please open the workspace settings to correct errors/warnings in the file and try again.");case $.WORKSPACE_FOLDER:{let e="<<unknown>>";if(i.resource){let t=this.contextService.getWorkspaceFolder(i.resource);t&&(e=t.name)}return(0,oi.localize)(13780,"Unable to write into folder settings. Please open the '{0}' folder settings to correct errors/warnings in it and try again.",e)}default:return""}case N.ERROR_CONFIGURATION_FILE_DIRTY:if(i.workspaceStandAloneConfigurationKey===nH)return(0,oi.localize)(13781,"Unable to write into tasks configuration file because the file has unsaved changes. Please save it first and then try again.");if(i.workspaceStandAloneConfigurationKey===nU)return(0,oi.localize)(13782,"Unable to write into launch configuration file because the file has unsaved changes. Please save it first and then try again.");if("mcp"===i.workspaceStandAloneConfigurationKey)return(0,oi.localize)(13783,"Unable to write into MCP configuration file because the file has unsaved changes. Please save it first and then try again.");switch(t){case $.USER_LOCAL:return(0,oi.localize)(13784,"Unable to write into user settings because the file has unsaved changes. Please save the user settings file first and then try again.");case $.USER_REMOTE:return(0,oi.localize)(13785,"Unable to write into remote user settings because the file has unsaved changes. Please save the remote user settings file first and then try again.");case $.WORKSPACE:return(0,oi.localize)(13786,"Unable to write into workspace settings because the file has unsaved changes. Please save the workspace settings file first and then try again.");case $.WORKSPACE_FOLDER:{let e="<<unknown>>";if(i.resource){let t=this.contextService.getWorkspaceFolder(i.resource);t&&(e=t.name)}return(0,oi.localize)(13787,"Unable to write into folder settings because the file has unsaved changes. Please save the '{0}' folder settings file first and then try again.",e)}default:return""}case N.ERROR_CONFIGURATION_FILE_MODIFIED_SINCE:if(i.workspaceStandAloneConfigurationKey===nH)return(0,oi.localize)(13788,"Unable to write into tasks configuration file because the content of the file is newer.");if(i.workspaceStandAloneConfigurationKey===nU)return(0,oi.localize)(13789,"Unable to write into launch configuration file because the content of the file is newer.");if("mcp"===i.workspaceStandAloneConfigurationKey)return(0,oi.localize)(13790,"Unable to write into MCP configuration file because the content of the file is newer.");switch(t){case $.USER_LOCAL:return(0,oi.localize)(13791,"Unable to write into user settings because the content of the file is newer.");case $.USER_REMOTE:return(0,oi.localize)(13792,"Unable to write into remote user settings because the content of the file is newer.");case $.WORKSPACE:return(0,oi.localize)(13793,"Unable to write into workspace settings because the content of the file is newer.");case $.WORKSPACE_FOLDER:return(0,oi.localize)(13794,"Unable to write into folder settings because the content of the file is newer.")}case N.ERROR_INTERNAL:return(0,oi.localize)(13795,"Unable to write to {0} because of an internal error.",this.stringifyTarget(t))}}stringifyTarget(e){switch(e){case $.USER_LOCAL:return(0,oi.localize)(13796,"User Settings");case $.USER_REMOTE:return(0,oi.localize)(13797,"Remote User Settings");case $.WORKSPACE:return(0,oi.localize)(13798,"Workspace Settings");case $.WORKSPACE_FOLDER:return(0,oi.localize)(13799,"Folder Settings");default:return""}}defaultResourceValue(e){let t=this.uriIdentityService.extUri.basename(e);return t.substr(0,t.length-this.uriIdentityService.extUri.extname(e).length)===nH?'{\n "version": "2.0.0",\n "tasks": []\n}':"{}"}async resolveModelReference(e){return await this.fileService.exists(e)||await this.textFileService.write(e,this.defaultResourceValue(e),{encoding:"utf8"}),this.textModelResolverService.createModelReference(e)}hasParseErrors(e,t){if(t.workspaceStandAloneConfigurationKey&&!t.key)return!1;let i=[];return(0,sS.parse)(e,i,{allowTrailingComma:!0,allowEmptyContent:!0}),i.length>0}async validate(e,t,i,r){if(void 0!==this.configurationService.inspect(t.key).policyValue)throw this.toConfigurationEditingError(N.ERROR_POLICY_CONFIGURATION,e,t);let o=nC.Registry.as(nm.Extensions.Configuration).getConfigurationProperties(),n=o[t.key]?.scope;if(!t.workspaceStandAloneConfigurationKey&&0>this.configurationService.keys().default.indexOf(t.key)&&!nm.OVERRIDE_PROPERTY_REGEX.test(t.key)&&void 0!==t.value)throw this.toConfigurationEditingError(N.ERROR_UNKNOWN_KEY,e,t);if(t.workspaceStandAloneConfigurationKey&&t.workspaceStandAloneConfigurationKey!==nH&&"mcp"!==t.workspaceStandAloneConfigurationKey&&(e===$.USER_LOCAL||e===$.USER_REMOTE))throw this.toConfigurationEditingError(N.ERROR_INVALID_USER_TARGET,e,t);if((e===$.WORKSPACE||e===$.WORKSPACE_FOLDER)&&this.contextService.getWorkbenchState()===n4.WorkbenchState.EMPTY)throw this.toConfigurationEditingError(N.ERROR_NO_WORKSPACE_OPENED,e,t);if(e===$.WORKSPACE&&!t.workspaceStandAloneConfigurationKey&&!nm.OVERRIDE_PROPERTY_REGEX.test(t.key)){if(n&&nA.includes(n))throw this.toConfigurationEditingError(N.ERROR_INVALID_WORKSPACE_CONFIGURATION_APPLICATION,e,t);if(n===nm.ConfigurationScope.MACHINE)throw this.toConfigurationEditingError(N.ERROR_INVALID_WORKSPACE_CONFIGURATION_MACHINE,e,t)}if(e===$.WORKSPACE_FOLDER){if(!t.resource)throw this.toConfigurationEditingError(N.ERROR_INVALID_FOLDER_TARGET,e,t);if(!t.workspaceStandAloneConfigurationKey&&!nm.OVERRIDE_PROPERTY_REGEX.test(t.key)&&void 0!==n&&!n$.includes(n))throw this.toConfigurationEditingError(N.ERROR_INVALID_FOLDER_CONFIGURATION,e,t)}if(r.overrideIdentifiers?.length&&n!==nm.ConfigurationScope.LANGUAGE_OVERRIDABLE)throw this.toConfigurationEditingError(N.ERROR_INVALID_RESOURCE_LANGUAGE_CONFIGURATION,e,t);if(!t.resource)throw this.toConfigurationEditingError(N.ERROR_INVALID_FOLDER_TARGET,e,t);if(i&&this.textFileService.isDirty(t.resource))throw this.toConfigurationEditingError(N.ERROR_CONFIGURATION_FILE_DIRTY,e,t)}getConfigurationEditOperation(e,t,i){if(t.key){let r=e===$.USER_LOCAL?nq:nW;for(let o of Object.keys(r)){let n=this.getConfigurationFileResource(e,o,r[o],i.resource,void 0);if(t.key===o){let i=this.isWorkspaceConfigurationResource(n)?[o]:[];return{key:i[i.length-1],jsonPath:i,value:t.value,resource:n??void 0,workspaceStandAloneConfigurationKey:o,target:e}}let s=`${o}.`;if(0===t.key.indexOf(s)){let i=this.isWorkspaceConfigurationResource(n)?[o,t.key.substring(s.length)]:[t.key.substring(s.length)];return{key:i[i.length-1],jsonPath:i,value:t.value,resource:n??void 0,workspaceStandAloneConfigurationKey:o,target:e}}}}let r=t.key,o=nC.Registry.as(nm.Extensions.Configuration).getConfigurationProperties(),n=o[r]?.scope,s=i.overrideIdentifiers?.length?[(0,nm.keyFromOverrideIdentifiers)(i.overrideIdentifiers),r]:[r];if(e===$.USER_LOCAL||e===$.USER_REMOTE)return{key:r,jsonPath:s,value:t.value,resource:this.getConfigurationFileResource(e,r,"",null,n)??void 0,target:e};let a=this.getConfigurationFileResource(e,r,nP,i.resource,n);return this.isWorkspaceConfigurationResource(a)&&(s=["settings",...s]),{key:r,jsonPath:s,value:t.value,resource:a??void 0,target:e}}isWorkspaceConfigurationResource(e){let t=this.contextService.getWorkspace();return!!(t.configuration&&e&&t.configuration.fsPath===e.fsPath)}getConfigurationFileResource(e,t,i,r,o){if(e===$.USER_LOCAL)return t===nH?this.userDataProfileService.currentProfile.tasksResource:"mcp"===t?this.userDataProfileService.currentProfile.mcpResource:!this.userDataProfileService.currentProfile.isDefault&&this.configurationService.isSettingAppliedForAllProfiles(t)?this.userDataProfilesService.defaultProfile.settingsResource:this.userDataProfileService.currentProfile.settingsResource;if(e===$.USER_REMOTE)return this.remoteSettingsResource;let n=this.contextService.getWorkbenchState();if(n!==n4.WorkbenchState.EMPTY){let t=this.contextService.getWorkspace();if(e===$.WORKSPACE){if(n===n4.WorkbenchState.WORKSPACE)return t.configuration??null;if(n===n4.WorkbenchState.FOLDER)return t.folders[0].toResource(i)}if(e===$.WORKSPACE_FOLDER&&r){let e=this.contextService.getWorkspaceFolder(r);if(e)return e.toResource(i)}}return null}};sL=(0,rM.__decorate)([(0,rM.__param)(1,sx.IWorkbenchConfigurationService),(0,rM.__param)(2,nw.IWorkspaceContextService),(0,rM.__param)(3,sP.IUserDataProfileService),(0,rM.__param)(4,nb.IUserDataProfilesService),(0,rM.__param)(5,nf.IFileService),(0,rM.__param)(6,sE.ITextModelService),(0,rM.__param)(7,sw.ITextFileService),(0,rM.__param)(8,n7.INotificationService),(0,rM.__param)(9,sT.IPreferencesService),(0,rM.__param)(10,sk.IEditorService),(0,rM.__param)(11,nS.IUriIdentityService),(0,rM.__param)(12,sA.IFilesConfigurationService)],sL);var sF=rd,sO=sp,sN=e.i(182504),s$=sm;class sH extends s$.DefaultConfiguration{static{this.DEFAULT_OVERRIDES_CACHE_EXISTS_KEY="DefaultOverridesCacheExists"}constructor(e,t,i){super(i),this.configurationCache=e,this.configurationRegistry=nC.Registry.as(nm.Extensions.Configuration),this.cachedConfigurationDefaultsOverrides={},this.cacheKey={type:"defaults",key:"configurationDefaultsOverrides"},t.options?.configurationDefaults&&this.configurationRegistry.registerDefaultConfigurations([{overrides:t.options.configurationDefaults}])}getConfigurationDefaultOverrides(){return this.cachedConfigurationDefaultsOverrides}async initialize(){return await this.initializeCachedConfigurationDefaultsOverrides(),super.initialize()}reload(){return this.cachedConfigurationDefaultsOverrides={},this.updateCachedConfigurationDefaultsOverrides(),super.reload()}hasCachedConfigurationDefaultsOverrides(){return!(0,oK.isEmptyObject)(this.cachedConfigurationDefaultsOverrides)}initializeCachedConfigurationDefaultsOverrides(){return this.initiaizeCachedConfigurationDefaultsOverridesPromise||(this.initiaizeCachedConfigurationDefaultsOverridesPromise=(async()=>{try{if(localStorage.getItem(sH.DEFAULT_OVERRIDES_CACHE_EXISTS_KEY)){let e=await this.configurationCache.read(this.cacheKey);e&&(this.cachedConfigurationDefaultsOverrides=JSON.parse(e))}}catch(e){}this.cachedConfigurationDefaultsOverrides=(0,oK.isObject)(this.cachedConfigurationDefaultsOverrides)?this.cachedConfigurationDefaultsOverrides:{}})()),this.initiaizeCachedConfigurationDefaultsOverridesPromise}onDidUpdateConfiguration(e,t){super.onDidUpdateConfiguration(e,t),t&&this.updateCachedConfigurationDefaultsOverrides()}async updateCachedConfigurationDefaultsOverrides(){let e={};for(let[t,i]of this.configurationRegistry.getConfigurationDefaultsOverrides())nm.OVERRIDE_PROPERTY_REGEX.test(t)||void 0===i.value||(e[t]=i.value);try{Object.keys(e).length?(localStorage.setItem(sH.DEFAULT_OVERRIDES_CACHE_EXISTS_KEY,"yes"),await this.configurationCache.write(this.cacheKey,JSON.stringify(e))):(localStorage.removeItem(sH.DEFAULT_OVERRIDES_CACHE_EXISTS_KEY),await this.configurationCache.remove(this.cacheKey))}catch(e){}}}class sU extends sO.UserSettings{constructor(e,t,i,r){super(e.defaultProfile.settingsResource,{scopes:nA,skipUnregistered:!0},i.extUri,t,r),this._onDidChangeConfiguration=this._register(new r7.Emitter),this.onDidChangeConfiguration=this._onDidChangeConfiguration.event,this._register(this.onDidChange(()=>this.reloadConfigurationScheduler.schedule())),this.reloadConfigurationScheduler=this._register(new sh.RunOnceScheduler(()=>this.loadConfiguration().then(e=>this._onDidChangeConfiguration.fire(e)),50))}async initialize(){return this.loadConfiguration()}async loadConfiguration(){let e=await super.loadConfiguration(),t=e.getValue(nj),i=Array.isArray(t)?t:[];return this.parseOptions.include||i.length?this.reparse({...this.parseOptions,include:i}):e}}class sW extends sF.Disposable{get hasTasksLoaded(){return this.userConfiguration.value instanceof sq}constructor(e,t,i,r,o,n,s){super(),this.settingsResource=e,this.tasksResource=t,this.mcpResource=i,this.configurationParseOptions=r,this.fileService=o,this.uriIdentityService=n,this.logService=s,this._onDidChangeConfiguration=this._register(new r7.Emitter),this.onDidChangeConfiguration=this._onDidChangeConfiguration.event,this.userConfiguration=this._register(new sF.MutableDisposable),this.userConfigurationChangeDisposable=this._register(new sF.MutableDisposable),this.userConfiguration.value=new sO.UserSettings(e,this.configurationParseOptions,n.extUri,this.fileService,s),this.userConfigurationChangeDisposable.value=this.userConfiguration.value.onDidChange(()=>this.reloadConfigurationScheduler.schedule()),this.reloadConfigurationScheduler=this._register(new sh.RunOnceScheduler(()=>this.userConfiguration.value.loadConfiguration().then(e=>this._onDidChangeConfiguration.fire(e)),50))}async reset(e,t,i,r){return this.settingsResource=e,this.tasksResource=t,this.mcpResource=i,this.configurationParseOptions=r,this.doReset()}async doReset(e){let t=this.uriIdentityService.extUri.dirname(this.settingsResource),i=[];this.tasksResource&&i.push([nH,this.tasksResource]),this.mcpResource&&i.push(["mcp",this.mcpResource]);let r=new sq(t.toString(),this.settingsResource,i,this.configurationParseOptions,this.fileService,this.uriIdentityService,this.logService),o=await r.loadConfiguration(e);return this.userConfiguration.value=r,this.userConfigurationChangeDisposable.value&&(this.userConfigurationChangeDisposable.value=this.userConfiguration.value.onDidChange(()=>this.reloadConfigurationScheduler.schedule())),o}async initialize(){return this.userConfiguration.value.loadConfiguration()}async reload(e){return this.hasTasksLoaded?this.userConfiguration.value.loadConfiguration():this.doReset(e)}reparse(e){return this.configurationParseOptions={...this.configurationParseOptions,...e},this.userConfiguration.value.reparse(this.configurationParseOptions)}getRestrictedSettings(){return this.userConfiguration.value.getRestrictedSettings()}}class sq extends sF.Disposable{constructor(e,t,i,r,o,n,s){super(),this.settingsResource=t,this.standAloneConfigurationResources=i,this.fileService=o,this.uriIdentityService=n,this.logService=s,this._onDidChange=this._register(new r7.Emitter),this.onDidChange=this._onDidChange.event,this.allResources=[this.settingsResource,...this.standAloneConfigurationResources.map(([,e])=>e)],this._register((0,sF.combinedDisposable)(...this.allResources.map(e=>(0,sF.combinedDisposable)(this.fileService.watch(n.extUri.dirname(e)),this.fileService.watch(e))))),this._folderSettingsModelParser=new sO.ConfigurationModelParser(e,s),this._folderSettingsParseOptions=r,this._standAloneConfigurations=[],this._cache=sO.ConfigurationModel.createEmptyModel(this.logService),this._register(r7.Event.debounce(r7.Event.any(r7.Event.filter(this.fileService.onDidFilesChange,e=>this.handleFileChangesEvent(e)),r7.Event.filter(this.fileService.onDidRunOperation,e=>this.handleFileOperationEvent(e))),()=>void 0,100)(()=>this._onDidChange.fire()))}async resolveContents(e){let t=async e=>Promise.all(e.map(async e=>{try{return(await this.fileService.readFile(e,{atomic:!0})).value.toString()}catch(t){this.logService.trace(`Error while resolving configuration file '${e.toString()}': ${(0,oE.getErrorMessage)(t)}`),t.fileOperationResult!==sD.FileOperationResult.FILE_NOT_FOUND&&t.fileOperationResult!==sD.FileOperationResult.FILE_NOT_DIRECTORY&&this.logService.error(t)}return"{}"})),[[i],r]=await Promise.all([e?Promise.resolve([void 0]):t([this.settingsResource]),t(this.standAloneConfigurationResources.map(([,e])=>e))]);return[i,r.map((e,t)=>[this.standAloneConfigurationResources[t][0],e])]}async loadConfiguration(e){let[t,i]=await this.resolveContents(!!e);this._standAloneConfigurations=[],this._folderSettingsModelParser.parse("",this._folderSettingsParseOptions),void 0!==t&&this._folderSettingsModelParser.parse(t,this._folderSettingsParseOptions);for(let e=0;e<i.length;e++){let t=i[e][1];if(void 0!==t){let i=new s_(this.standAloneConfigurationResources[e][1].toString(),this.standAloneConfigurationResources[e][0],this.logService);i.parse(t),this._standAloneConfigurations.push(i.configurationModel)}}return this.consolidate(e),this._cache}getRestrictedSettings(){return this._folderSettingsModelParser.restrictedConfigurations}reparse(e){let t=this._folderSettingsModelParser.configurationModel.contents;return this._folderSettingsParseOptions=e,this._folderSettingsModelParser.reparse(this._folderSettingsParseOptions),(0,nD.equals)(t,this._folderSettingsModelParser.configurationModel.contents)||this.consolidate(),this._cache}consolidate(e){this._cache=(e??this._folderSettingsModelParser.configurationModel).merge(...this._standAloneConfigurations)}handleFileChangesEvent(e){return!!(this.allResources.some(t=>e.contains(t))||this.allResources.some(t=>e.contains(this.uriIdentityService.extUri.dirname(t),sD.FileChangeType.DELETED)))}handleFileOperationEvent(e){return!!((e.isOperation(sD.FileOperation.CREATE)||e.isOperation(sD.FileOperation.COPY)||e.isOperation(sD.FileOperation.DELETE)||e.isOperation(sD.FileOperation.WRITE))&&this.allResources.some(t=>this.uriIdentityService.extUri.isEqual(e.resource,t))||e.isOperation(sD.FileOperation.DELETE)&&this.allResources.some(t=>this.uriIdentityService.extUri.isEqual(e.resource,this.uriIdentityService.extUri.dirname(t))))}}class sj extends sF.Disposable{constructor(e,t,i,r,o,n){super(),this._userConfigurationInitializationPromise=null,this._onDidChangeConfiguration=this._register(new r7.Emitter),this.onDidChangeConfiguration=this._onDidChangeConfiguration.event,this._onDidInitialize=this._register(new r7.Emitter),this.onDidInitialize=this._onDidInitialize.event,this._fileService=i,this._userConfiguration=this._cachedConfiguration=new sK(e,t,{scopes:nO},n),o.getEnvironment().then(async e=>{if(e){let t=this._register(new sz(e.settingsPath,{scopes:nO},this._fileService,r,n));this._register(t.onDidChangeConfiguration(e=>this.onDidUserConfigurationChange(e))),this._userConfigurationInitializationPromise=t.initialize();let i=await this._userConfigurationInitializationPromise;this._userConfiguration.dispose(),this._userConfiguration=t,this.onDidUserConfigurationChange(i),this._onDidInitialize.fire(i)}})}async initialize(){if(this._userConfiguration instanceof sz)return this._userConfiguration.initialize();let e=await this._userConfiguration.initialize();return this._userConfigurationInitializationPromise&&(e=await this._userConfigurationInitializationPromise,this._userConfigurationInitializationPromise=null),e}reload(){return this._userConfiguration.reload()}reparse(){return this._userConfiguration.reparse({scopes:nO})}getRestrictedSettings(){return this._userConfiguration.getRestrictedSettings()}onDidUserConfigurationChange(e){this.updateCache(),this._onDidChangeConfiguration.fire(e)}async updateCache(){if(this._userConfiguration instanceof sz){let e;try{e=await this._userConfiguration.resolveContent()}catch(e){if(e.fileOperationResult!==sD.FileOperationResult.FILE_NOT_FOUND)return}await this._cachedConfiguration.updateConfiguration(e)}}}class sz extends sF.Disposable{constructor(e,t,i,r,o){super(),this.configurationResource=e,this.fileService=i,this.uriIdentityService=r,this.logService=o,this._onDidChangeConfiguration=this._register(new r7.Emitter),this.onDidChangeConfiguration=this._onDidChangeConfiguration.event,this.fileWatcherDisposable=this._register(new sF.MutableDisposable),this.directoryWatcherDisposable=this._register(new sF.MutableDisposable),this.parser=new sO.ConfigurationModelParser(this.configurationResource.toString(),o),this.parseOptions=t,this._register(i.onDidFilesChange(e=>this.handleFileChangesEvent(e))),this._register(i.onDidRunOperation(e=>this.handleFileOperationEvent(e))),this.reloadConfigurationScheduler=this._register(new sh.RunOnceScheduler(()=>this.reload().then(e=>this._onDidChangeConfiguration.fire(e)),50)),this._register((0,sF.toDisposable)(()=>{this.stopWatchingResource(),this.stopWatchingDirectory()}))}watchResource(){this.fileWatcherDisposable.value=this.fileService.watch(this.configurationResource)}stopWatchingResource(){this.fileWatcherDisposable.value=void 0}watchDirectory(){let e=this.uriIdentityService.extUri.dirname(this.configurationResource);this.directoryWatcherDisposable.value=this.fileService.watch(e)}stopWatchingDirectory(){this.directoryWatcherDisposable.value=void 0}async initialize(){let e=await this.fileService.exists(this.configurationResource);return this.onResourceExists(e),this.reload()}async resolveContent(){return(await this.fileService.readFile(this.configurationResource,{atomic:!0})).value.toString()}async reload(){try{let e=await this.resolveContent();return this.parser.parse(e,this.parseOptions),this.parser.configurationModel}catch(e){return sO.ConfigurationModel.createEmptyModel(this.logService)}}reparse(e){return this.parseOptions=e,this.parser.reparse(this.parseOptions),this.parser.configurationModel}getRestrictedSettings(){return this.parser.restrictedConfigurations}handleFileChangesEvent(e){let t=!1;e.contains(this.configurationResource,sD.FileChangeType.ADDED)?(t=!0,this.onResourceExists(!0)):e.contains(this.configurationResource,sD.FileChangeType.DELETED)?(t=!0,this.onResourceExists(!1)):e.contains(this.configurationResource,sD.FileChangeType.UPDATED)&&(t=!0),t&&this.reloadConfigurationScheduler.schedule()}handleFileOperationEvent(e){(e.isOperation(sD.FileOperation.CREATE)||e.isOperation(sD.FileOperation.COPY)||e.isOperation(sD.FileOperation.DELETE)||e.isOperation(sD.FileOperation.WRITE))&&this.uriIdentityService.extUri.isEqual(e.resource,this.configurationResource)&&this.reloadConfigurationScheduler.schedule()}onResourceExists(e){e?(this.stopWatchingDirectory(),this.watchResource()):(this.stopWatchingResource(),this.watchDirectory())}}class sK extends sF.Disposable{constructor(e,t,i,r){super(),this.configurationCache=t,this._onDidChange=this._register(new r7.Emitter),this.onDidChange=this._onDidChange.event,this.key={type:"user",key:e},this.parser=new sO.ConfigurationModelParser("CachedRemoteUserConfiguration",r),this.parseOptions=i,this.configurationModel=sO.ConfigurationModel.createEmptyModel(r)}getConfigurationModel(){return this.configurationModel}initialize(){return this.reload()}reparse(e){return this.parseOptions=e,this.parser.reparse(this.parseOptions),this.configurationModel=this.parser.configurationModel,this.configurationModel}getRestrictedSettings(){return this.parser.restrictedConfigurations}async reload(){try{let e=await this.configurationCache.read(this.key),t=JSON.parse(e);t.content&&(this.parser.parse(t.content,this.parseOptions),this.configurationModel=this.parser.configurationModel)}catch(e){}return this.configurationModel}async updateConfiguration(e){return e?this.configurationCache.write(this.key,JSON.stringify({content:e})):this.configurationCache.remove(this.key)}}class sV extends sF.Disposable{get initialized(){return this._initialized}constructor(e,t,i,r){super(),this.configurationCache=e,this.fileService=t,this.uriIdentityService=i,this.logService=r,this._workspaceConfigurationDisposables=this._register(new sF.DisposableStore),this._workspaceIdentifier=null,this._isWorkspaceTrusted=!1,this._onDidUpdateConfiguration=this._register(new r7.Emitter),this.onDidUpdateConfiguration=this._onDidUpdateConfiguration.event,this._initialized=!1,this.fileService=t,this._workspaceConfiguration=this._cachedConfiguration=new sG(e,r)}async initialize(e,t){this._workspaceIdentifier=e,this._isWorkspaceTrusted=t,this._initialized||(this.configurationCache.needsCaching(this._workspaceIdentifier.configPath)?(this._workspaceConfiguration=this._cachedConfiguration,this.waitAndInitialize(this._workspaceIdentifier)):this.doInitialize(new sB(this.fileService,this.uriIdentityService,this.logService))),await this.reload()}async reload(){this._workspaceIdentifier&&await this._workspaceConfiguration.load(this._workspaceIdentifier,{scopes:nN,skipRestricted:this.isUntrusted()})}getFolders(){return this._workspaceConfiguration.getFolders()}setFolders(e,t){return this._workspaceIdentifier?t.write(this._workspaceIdentifier.configPath,[{path:["folders"],value:e}],!0).then(()=>this.reload()):Promise.resolve()}isTransient(){return this._workspaceConfiguration.isTransient()}getConfiguration(){return this._workspaceConfiguration.getWorkspaceSettings()}updateWorkspaceTrust(e){return this._isWorkspaceTrusted=e,this.reparseWorkspaceSettings()}reparseWorkspaceSettings(){return this._workspaceConfiguration.reparseWorkspaceSettings({scopes:nN,skipRestricted:this.isUntrusted()}),this.getConfiguration()}getRestrictedSettings(){return this._workspaceConfiguration.getRestrictedSettings()}async waitAndInitialize(e){if(await (0,sD.whenProviderRegistered)(e.configPath,this.fileService),!(this._workspaceConfiguration instanceof sB)){let t=this._register(new sB(this.fileService,this.uriIdentityService,this.logService));await t.load(e,{scopes:nN,skipRestricted:this.isUntrusted()}),this.doInitialize(t),this.onDidWorkspaceConfigurationChange(!1,!0)}}doInitialize(e){this._workspaceConfigurationDisposables.clear(),this._workspaceConfiguration=this._workspaceConfigurationDisposables.add(e),this._workspaceConfigurationDisposables.add(this._workspaceConfiguration.onDidChange(e=>this.onDidWorkspaceConfigurationChange(!0,!1))),this._initialized=!0}isUntrusted(){return!this._isWorkspaceTrusted}async onDidWorkspaceConfigurationChange(e,t){e&&await this.reload(),this.updateCache(),this._onDidUpdateConfiguration.fire(t)}async updateCache(){if(this._workspaceIdentifier&&this.configurationCache.needsCaching(this._workspaceIdentifier.configPath)&&this._workspaceConfiguration instanceof sB){let e=await this._workspaceConfiguration.resolveContent(this._workspaceIdentifier);await this._cachedConfiguration.updateWorkspace(this._workspaceIdentifier,e)}}}class sB extends sF.Disposable{constructor(e,t,i){super(),this.fileService=e,this.logService=i,this._workspaceIdentifier=null,this._onDidChange=this._register(new r7.Emitter),this.onDidChange=this._onDidChange.event,this.workspaceConfigurationModelParser=new sv("",i),this.workspaceSettings=sO.ConfigurationModel.createEmptyModel(i),this._register(r7.Event.any(r7.Event.filter(this.fileService.onDidFilesChange,e=>!!this._workspaceIdentifier&&e.contains(this._workspaceIdentifier.configPath)),r7.Event.filter(this.fileService.onDidRunOperation,e=>!!this._workspaceIdentifier&&(e.isOperation(sD.FileOperation.CREATE)||e.isOperation(sD.FileOperation.COPY)||e.isOperation(sD.FileOperation.DELETE)||e.isOperation(sD.FileOperation.WRITE))&&t.extUri.isEqual(e.resource,this._workspaceIdentifier.configPath)))(()=>this.reloadConfigurationScheduler.schedule())),this.reloadConfigurationScheduler=this._register(new sh.RunOnceScheduler(()=>this._onDidChange.fire(),50)),this.workspaceConfigWatcher=this._register(this.watchWorkspaceConfigurationFile())}get workspaceIdentifier(){return this._workspaceIdentifier}async resolveContent(e){return(await this.fileService.readFile(e.configPath,{atomic:!0})).value.toString()}async load(e,t){this._workspaceIdentifier&&this._workspaceIdentifier.id===e.id||(this._workspaceIdentifier=e,this.workspaceConfigurationModelParser=new sv(this._workspaceIdentifier.id,this.logService),(0,sF.dispose)(this.workspaceConfigWatcher),this.workspaceConfigWatcher=this._register(this.watchWorkspaceConfigurationFile()));let i="";try{i=await this.resolveContent(this._workspaceIdentifier)}catch(e){await this.fileService.exists(this._workspaceIdentifier.configPath)&&this.logService.error(e)}this.workspaceConfigurationModelParser.parse(i,t),this.consolidate()}getConfigurationModel(){return this.workspaceConfigurationModelParser.configurationModel}getFolders(){return this.workspaceConfigurationModelParser.folders}isTransient(){return this.workspaceConfigurationModelParser.transient}getWorkspaceSettings(){return this.workspaceSettings}reparseWorkspaceSettings(e){return this.workspaceConfigurationModelParser.reparseWorkspaceSettings(e),this.consolidate(),this.getWorkspaceSettings()}getRestrictedSettings(){return this.workspaceConfigurationModelParser.getRestrictedWorkspaceSettings()}consolidate(){this.workspaceSettings=this.workspaceConfigurationModelParser.settingsModel.merge(this.workspaceConfigurationModelParser.launchModel,this.workspaceConfigurationModelParser.tasksModel)}watchWorkspaceConfigurationFile(){return this._workspaceIdentifier?this.fileService.watch(this._workspaceIdentifier.configPath):sF.Disposable.None}}class sG{constructor(e,t){this.configurationCache=e,this.logService=t,this.onDidChange=r7.Event.None,this.workspaceConfigurationModelParser=new sv("",t),this.workspaceSettings=sO.ConfigurationModel.createEmptyModel(t)}async load(e,t){try{let i=this.getKey(e),r=await this.configurationCache.read(i),o=JSON.parse(r);o.content&&(this.workspaceConfigurationModelParser=new sv(i.key,this.logService),this.workspaceConfigurationModelParser.parse(o.content,t),this.consolidate())}catch(e){}}get workspaceIdentifier(){return null}getConfigurationModel(){return this.workspaceConfigurationModelParser.configurationModel}getFolders(){return this.workspaceConfigurationModelParser.folders}isTransient(){return this.workspaceConfigurationModelParser.transient}getWorkspaceSettings(){return this.workspaceSettings}reparseWorkspaceSettings(e){return this.workspaceConfigurationModelParser.reparseWorkspaceSettings(e),this.consolidate(),this.getWorkspaceSettings()}getRestrictedSettings(){return this.workspaceConfigurationModelParser.getRestrictedWorkspaceSettings()}consolidate(){this.workspaceSettings=this.workspaceConfigurationModelParser.settingsModel.merge(this.workspaceConfigurationModelParser.launchModel,this.workspaceConfigurationModelParser.tasksModel)}async updateWorkspace(e,t){try{let i=this.getKey(e);t?await this.configurationCache.write(i,JSON.stringify({content:t})):await this.configurationCache.remove(i)}catch(e){}}getKey(e){return{type:"workspaces",key:e.id}}}class sQ{constructor(e,t,i,r,o){this.configurationCache=r,this.logService=o,this.onDidChange=r7.Event.None,this.key={type:"folder",key:(0,sN.hash)((0,n9.joinPath)(e,t).toString()).toString(16)},this._folderSettingsModelParser=new sO.ConfigurationModelParser("CachedFolderConfiguration",o),this._folderSettingsParseOptions=i,this._standAloneConfigurations=[],this.configurationModel=sO.ConfigurationModel.createEmptyModel(o)}async loadConfiguration(){try{let e=await this.configurationCache.read(this.key),{content:t}=JSON.parse(e.toString());if(t)for(let e of Object.keys(t))if(e===nR)this._folderSettingsModelParser.parse(t[e],this._folderSettingsParseOptions);else{let i=new s_(e,e,this.logService);i.parse(t[e]),this._standAloneConfigurations.push(i.configurationModel)}this.consolidate()}catch(e){}return this.configurationModel}async updateConfiguration(e,t){let i={};e&&(i[nR]=e),t.forEach(([e,t])=>{t&&(i[e]=t)}),Object.keys(i).length?await this.configurationCache.write(this.key,JSON.stringify({content:i})):await this.configurationCache.remove(this.key)}getRestrictedSettings(){return this._folderSettingsModelParser.restrictedConfigurations}reparse(e){return this._folderSettingsParseOptions=e,this._folderSettingsModelParser.reparse(this._folderSettingsParseOptions),this.consolidate(),this.configurationModel}consolidate(){this.configurationModel=this._folderSettingsModelParser.configurationModel.merge(...this._standAloneConfigurations)}getUnsupportedKeys(){return[]}}class sJ extends sF.Disposable{constructor(e,t,i,r,o,n,s,a,l){super(),this.workspaceFolder=t,this.workbenchState=r,this.workspaceTrusted=o,this.configurationCache=l,this._onDidChange=this._register(new r7.Emitter),this.onDidChange=this._onDidChange.event,this.scopes=n4.WorkbenchState.WORKSPACE===this.workbenchState?n$:nN,this.configurationFolder=s.extUri.joinPath(t.uri,i),this.cachedFolderConfiguration=new sQ(t.uri,i,{scopes:this.scopes,skipRestricted:this.isUntrusted()},l,a),e&&this.configurationCache.needsCaching(t.uri)?(this.folderConfiguration=this.cachedFolderConfiguration,(0,sD.whenProviderRegistered)(t.uri,n).then(()=>{this.folderConfiguration=this._register(this.createFileServiceBasedConfiguration(n,s,a)),this._register(this.folderConfiguration.onDidChange(e=>this.onDidFolderConfigurationChange())),this.onDidFolderConfigurationChange()})):(this.folderConfiguration=this._register(this.createFileServiceBasedConfiguration(n,s,a)),this._register(this.folderConfiguration.onDidChange(e=>this.onDidFolderConfigurationChange())))}loadConfiguration(){return this.folderConfiguration.loadConfiguration()}updateWorkspaceTrust(e){return this.workspaceTrusted=e,this.reparse()}reparse(){let e=this.folderConfiguration.reparse({scopes:this.scopes,skipRestricted:this.isUntrusted()});return this.updateCache(),e}getRestrictedSettings(){return this.folderConfiguration.getRestrictedSettings()}isUntrusted(){return!this.workspaceTrusted}onDidFolderConfigurationChange(){this.updateCache(),this._onDidChange.fire()}createFileServiceBasedConfiguration(e,t,i){let r=t.extUri.joinPath(this.configurationFolder,`${nR}.json`),o=[nH,nU,"mcp"].map(e=>[e,t.extUri.joinPath(this.configurationFolder,`${e}.json`)]);return new sq(this.configurationFolder.toString(),r,o,{scopes:this.scopes,skipRestricted:this.isUntrusted()},e,t,i)}async updateCache(){if(this.configurationCache.needsCaching(this.configurationFolder)&&this.folderConfiguration instanceof sq){let[e,t]=await this.folderConfiguration.resolveContents();this.cachedFolderConfiguration.updateConfiguration(e,t)}}}var sY=e.i(40577),sX=e.i(772383),sZ=e.i(278725),s0=e.i(431110),s1=e.i(168363),s2=e.i(981399),s6=e.i(967602),s3=e.i(169315),s4=e.i(254686),s5=e.i(803777);function s8(e,t){return e.isDefault||e.useDefaultFlags?.settings?t?nF:void 0:t?nL:nM}class s7 extends sg.Workspace{constructor(){super(...arguments),this.initialized=!1}}class s9 extends su.Disposable{get restrictedSettings(){return this._restrictedSettings}constructor({remoteAuthority:e,configurationCache:t},i,r,o,n,s,a,l,c){if(super(),this.userDataProfileService=r,this.userDataProfilesService=o,this.fileService=n,this.remoteAgentService=s,this.uriIdentityService=a,this.logService=l,this.initialized=!1,this.applicationConfiguration=null,this.remoteUserConfiguration=null,this._onDidChangeConfiguration=this._register(new r7.Emitter),this.onDidChangeConfiguration=this._onDidChangeConfiguration.event,this._onWillChangeWorkspaceFolders=this._register(new r7.Emitter),this.onWillChangeWorkspaceFolders=this._onWillChangeWorkspaceFolders.event,this._onDidChangeWorkspaceFolders=this._register(new r7.Emitter),this.onDidChangeWorkspaceFolders=this._onDidChangeWorkspaceFolders.event,this._onDidChangeWorkspaceName=this._register(new r7.Emitter),this.onDidChangeWorkspaceName=this._onDidChangeWorkspaceName.event,this._onDidChangeWorkbenchState=this._register(new r7.Emitter),this.onDidChangeWorkbenchState=this._onDidChangeWorkbenchState.event,this.isWorkspaceTrusted=!0,this._restrictedSettings={default:[]},this._onDidChangeRestrictedSettings=this._register(new r7.Emitter),this.onDidChangeRestrictedSettings=this._onDidChangeRestrictedSettings.event,this.configurationRegistry=nC.Registry.as(nm.Extensions.Configuration),this.initRemoteUserConfigurationBarrier=new sh.Barrier,this.completeWorkspaceBarrier=new sh.Barrier,this.defaultConfiguration=this._register(new sH(t,i,l)),this.policyConfiguration=c instanceof s3.NullPolicyService?new sm.NullPolicyConfiguration:this._register(new sm.PolicyConfiguration(this.defaultConfiguration,c,l)),this.configurationCache=t,this._configuration=new sy(this.defaultConfiguration.configurationModel,this.policyConfiguration.configurationModel,sp.ConfigurationModel.createEmptyModel(l),sp.ConfigurationModel.createEmptyModel(l),sp.ConfigurationModel.createEmptyModel(l),sp.ConfigurationModel.createEmptyModel(l),new sd.ResourceMap,sp.ConfigurationModel.createEmptyModel(l),new sd.ResourceMap,this.workspace,l),this.applicationConfigurationDisposables=this._register(new su.DisposableStore),this.createApplicationConfiguration(),this.localUserConfiguration=this._register(new sW(r.currentProfile.settingsResource,r.currentProfile.tasksResource,r.currentProfile.mcpResource,{scopes:s8(r.currentProfile,!!e)},n,a,l)),this.cachedFolderConfigs=new sd.ResourceMap,this._register(this.localUserConfiguration.onDidChangeConfiguration(e=>this.onLocalUserConfigurationChanged(e))),e){const i=this.remoteUserConfiguration=this._register(new sj(e,t,n,a,s,l));this._register(i.onDidInitialize(e=>{this._register(i.onDidChangeConfiguration(e=>this.onRemoteUserConfigurationChanged(e))),this.onRemoteUserConfigurationChanged(e),this.initRemoteUserConfigurationBarrier.open()}))}else this.initRemoteUserConfigurationBarrier.open();this.workspaceConfiguration=this._register(new sV(t,n,a,l)),this._register(this.workspaceConfiguration.onDidUpdateConfiguration(e=>{this.onWorkspaceConfigurationChanged(e).then(()=>{this.workspace.initialized=this.workspaceConfiguration.initialized,this.checkAndMarkWorkspaceComplete(e)})})),this._register(this.defaultConfiguration.onDidChangeConfiguration(({properties:e,defaults:t})=>this.onDefaultConfigurationChanged(t,e))),this._register(this.policyConfiguration.onDidChangeConfiguration(e=>this.onPolicyConfigurationChanged(e))),this._register(r.onDidChangeCurrentProfile(e=>this.onUserDataProfileChanged(e))),this.workspaceEditingQueue=new sh.Queue}createApplicationConfiguration(){this.applicationConfigurationDisposables.clear(),this.userDataProfileService.currentProfile.isDefault||this.userDataProfileService.currentProfile.useDefaultFlags?.settings?this.applicationConfiguration=null:(this.applicationConfiguration=this.applicationConfigurationDisposables.add(this._register(new sU(this.userDataProfilesService,this.fileService,this.uriIdentityService,this.logService))),this.applicationConfigurationDisposables.add(this.applicationConfiguration.onDidChangeConfiguration(e=>this.onApplicationConfigurationChanged(e))))}async getCompleteWorkspace(){return await this.completeWorkspaceBarrier.wait(),this.getWorkspace()}getWorkspace(){return this.workspace}getWorkbenchState(){return this.workspace.configuration?sg.WorkbenchState.WORKSPACE:1===this.workspace.folders.length?sg.WorkbenchState.FOLDER:sg.WorkbenchState.EMPTY}getWorkspaceFolder(e){return this.workspace.getFolder(e)}addFolders(e,t){return this.updateFolders(e,[],t)}removeFolders(e){return this.updateFolders([],e)}async updateFolders(e,t,i){return this.workspaceEditingQueue.queue(()=>this.doUpdateFolders(e,t,i))}isInsideWorkspace(e){return!!this.getWorkspaceFolder(e)}isCurrentWorkspace(e){switch(this.getWorkbenchState()){case sg.WorkbenchState.FOLDER:{let t;return rh.URI.isUri(e)?t=e:(0,sg.isSingleFolderWorkspaceIdentifier)(e)&&(t=e.uri),rh.URI.isUri(t)&&this.uriIdentityService.extUri.isEqual(t,this.workspace.folders[0].uri)}case sg.WorkbenchState.WORKSPACE:return(0,sg.isWorkspaceIdentifier)(e)&&this.workspace.id===e.id}return!1}async doUpdateFolders(e,t,i){if(this.getWorkbenchState()!==sg.WorkbenchState.WORKSPACE||e.length+t.length===0)return Promise.resolve(void 0);let r=!1,o=this.getWorkspace().folders,n=o.map(e=>e.raw).filter((e,i)=>!(0,sC.isStoredWorkspaceFolder)(e)||!this.contains(t,o[i].uri));if(r=o.length!==n.length,e.length){let t=this.getWorkspace().configuration,s=this.uriIdentityService.extUri.dirname(t),a=(o=(0,sC.toWorkspaceFolders)(n,t,this.uriIdentityService.extUri)).map(e=>e.uri),l=[];for(let t of e){let e=t.uri;if(!this.contains(a,e)){try{if(!(await this.fileService.stat(e)).isDirectory)continue}catch(e){}l.push((0,sC.getStoredWorkspaceFolder)(e,!1,t.name,s,this.uriIdentityService.extUri))}}l.length>0&&(r=!0,"number"==typeof i&&i>=0&&i<n.length?(n=n.slice(0)).splice(i,0,...l):n=[...n,...l])}return r?this.setFolders(n):Promise.resolve(void 0)}async setFolders(e){if(!this.instantiationService)throw Error("Cannot update workspace folders because workspace service is not yet ready to accept writes.");return await this.instantiationService.invokeFunction(t=>this.workspaceConfiguration.setFolders(e,t.get(s4.IJSONEditingService))),this.onWorkspaceConfigurationChanged(!1)}contains(e,t){return e.some(e=>this.uriIdentityService.extUri.isEqual(e,t))}getConfigurationData(){return this._configuration.toData()}getValue(e,t){let i="string"==typeof e?e:void 0,r=(0,ng.isConfigurationOverrides)(e)?e:(0,ng.isConfigurationOverrides)(t)?t:void 0;return this._configuration.getValue(i,r)}async updateValue(e,t,i,r,o){let n=(0,ng.isConfigurationUpdateOverrides)(i)?i:(0,ng.isConfigurationOverrides)(i)?{resource:i.resource,overrideIdentifiers:i.overrideIdentifier?[i.overrideIdentifier]:void 0}:void 0,s=n?r:i,a=s?[s]:[];if(n?.overrideIdentifiers&&(n.overrideIdentifiers=(0,ox.distinct)(n.overrideIdentifiers),n.overrideIdentifiers=n.overrideIdentifiers.length?n.overrideIdentifiers:void 0),!a.length){if(n?.overrideIdentifiers&&n.overrideIdentifiers.length>1)throw Error("Configuration Target is required while updating the value for multiple override identifiers");let i=this.inspect(e,{resource:n?.resource,overrideIdentifier:n?.overrideIdentifiers?n.overrideIdentifiers[0]:void 0});a.push(...this.deriveConfigurationTargets(e,t,i)),(0,nD.equals)(t,i.defaultValue)&&1===a.length&&(a[0]===ng.ConfigurationTarget.USER||a[0]===ng.ConfigurationTarget.USER_LOCAL)&&(t=void 0)}await sh.Promises.settled(a.map(i=>this.writeConfigurationValue(e,t,i,n,o)))}async reloadConfiguration(e){if(void 0===e){this.reloadDefaultConfiguration();let e=await this.reloadApplicationConfiguration(!0),{local:t,remote:i}=await this.reloadUserConfiguration();await this.reloadWorkspaceConfiguration(),await this.loadConfiguration(e,t,i,!0);return}if((0,sg.isWorkspaceFolder)(e))return void await this.reloadWorkspaceFolderConfiguration(e);switch(e){case ng.ConfigurationTarget.DEFAULT:this.reloadDefaultConfiguration();return;case ng.ConfigurationTarget.USER:{let{local:e,remote:t}=await this.reloadUserConfiguration();await this.loadConfiguration(this._configuration.applicationConfiguration,e,t,!0);return}case ng.ConfigurationTarget.USER_LOCAL:await this.reloadLocalUserConfiguration();return;case ng.ConfigurationTarget.USER_REMOTE:await this.reloadRemoteUserConfiguration();return;case ng.ConfigurationTarget.WORKSPACE:case ng.ConfigurationTarget.WORKSPACE_FOLDER:await this.reloadWorkspaceConfiguration();return}}hasCachedConfigurationDefaultsOverrides(){return this.defaultConfiguration.hasCachedConfigurationDefaultsOverrides()}inspect(e,t){return this._configuration.inspect(e,t)}keys(){return this._configuration.keys()}async whenRemoteConfigurationLoaded(){await this.initRemoteUserConfigurationBarrier.wait()}async initialize(e){(0,sY.mark)("code/willInitWorkspaceService");let t=this.initialized;this.initialized=!1;let i=await this.createWorkspace(e);await this.updateWorkspaceAndInitializeConfiguration(i,t),this.checkAndMarkWorkspaceComplete(!1),(0,sY.mark)("code/didInitWorkspaceService")}updateWorkspaceTrust(e){if(this.isWorkspaceTrusted!==e){this.isWorkspaceTrusted=e;let t=this._configuration.toData(),i=[];for(let e of this.workspace.folders){let t,r=this.cachedFolderConfigs.get(e.uri);r&&(t=r.updateWorkspaceTrust(this.isWorkspaceTrusted),this._configuration.updateFolderConfiguration(e.uri,t)),i.push(t)}this.getWorkbenchState()===sg.WorkbenchState.FOLDER?i[0]&&this._configuration.updateWorkspaceConfiguration(i[0]):this._configuration.updateWorkspaceConfiguration(this.workspaceConfiguration.updateWorkspaceTrust(this.isWorkspaceTrusted)),this.updateRestrictedSettings();let r=[];this.restrictedSettings.userLocal&&r.push(...this.restrictedSettings.userLocal),this.restrictedSettings.userRemote&&r.push(...this.restrictedSettings.userRemote),this.restrictedSettings.workspace&&r.push(...this.restrictedSettings.workspace),this.restrictedSettings.workspaceFolder?.forEach(e=>r.push(...e)),(r=(0,ox.distinct)(r)).length&&this.triggerConfigurationChange({keys:r,overrides:[]},{data:t,workspace:this.workspace},ng.ConfigurationTarget.WORKSPACE)}}acquireInstantiationService(e){this.instantiationService=e}isSettingAppliedForAllProfiles(e){let t=this.configurationRegistry.getConfigurationProperties()[e]?.scope;if(t&&nA.includes(t))return!0;let i=this.getValue(nj)??[];return Array.isArray(i)&&i.includes(e)}async createWorkspace(e){return(0,sg.isWorkspaceIdentifier)(e)?this.createMultiFolderWorkspace(e):(0,sg.isSingleFolderWorkspaceIdentifier)(e)?this.createSingleFolderWorkspace(e):this.createEmptyWorkspace(e)}async createMultiFolderWorkspace(e){await this.workspaceConfiguration.initialize({id:e.id,configPath:e.configPath},this.isWorkspaceTrusted);let t=e.configPath,i=(0,sC.toWorkspaceFolders)(this.workspaceConfiguration.getFolders(),t,this.uriIdentityService.extUri),r=new s7(e.id,i,this.workspaceConfiguration.isTransient(),t,e=>this.uriIdentityService.extUri.ignorePathCasing(e));return r.initialized=this.workspaceConfiguration.initialized,r}createSingleFolderWorkspace(e){let t=new s7(e.id,[(0,sg.toWorkspaceFolder)(e.uri)],!1,null,e=>this.uriIdentityService.extUri.ignorePathCasing(e));return t.initialized=!0,t}createEmptyWorkspace(e){let t=new s7(e.id,[],!1,null,e=>this.uriIdentityService.extUri.ignorePathCasing(e));return t.initialized=!0,Promise.resolve(t)}checkAndMarkWorkspaceComplete(e){!this.completeWorkspaceBarrier.isOpen()&&this.workspace.initialized&&(this.completeWorkspaceBarrier.open(),this.validateWorkspaceFoldersAndReload(e))}async updateWorkspaceAndInitializeConfiguration(e,t){let i,r,o=!!this.workspace,n=[];if(o?(i=this.getWorkbenchState(),r=this.workspace.configuration?this.workspace.configuration.fsPath:void 0,n=this.workspace.folders,this.workspace.update(e)):this.workspace=e,await this.initializeConfiguration(t),o){let e=this.getWorkbenchState();i&&e!==i&&this._onDidChangeWorkbenchState.fire(e);let t=this.workspace.configuration?this.workspace.configuration.fsPath:void 0;(r&&t!==r||e!==i)&&this._onDidChangeWorkspaceName.fire();let o=this.compareFolders(n,this.workspace.folders);o&&(o.added.length||o.removed.length||o.changed.length)&&(await this.handleWillChangeWorkspaceFolders(o,!1),this._onDidChangeWorkspaceFolders.fire(o))}this.localUserConfiguration.hasTasksLoaded||this._register((0,on.runWhenWindowIdle)(rc.mainWindow,()=>this.reloadLocalUserConfiguration(!1,this._configuration.localUserConfiguration)))}compareFolders(e,t){let i={added:[],removed:[],changed:[]};i.added=t.filter(t=>!e.some(e=>t.uri.toString()===e.uri.toString()));for(let r=0;r<e.length;r++){let o=e[r],n=0;for(n=0;n<t.length&&o.uri.toString()!==t[n].uri.toString();n++);n<t.length?(r!==n||o.name!==t[n].name)&&i.changed.push(o):i.removed.push(o)}return i}async initializeConfiguration(e){await this.defaultConfiguration.initialize();let t=this.policyConfiguration.initialize(),i=this.applicationConfiguration?this.applicationConfiguration.initialize():Promise.resolve(sp.ConfigurationModel.createEmptyModel(this.logService)),r=async()=>{(0,sY.mark)("code/willInitUserConfiguration");let e=await Promise.all([this.localUserConfiguration.initialize(),this.remoteUserConfiguration?this.remoteUserConfiguration.initialize():Promise.resolve(sp.ConfigurationModel.createEmptyModel(this.logService))]);if(this.applicationConfiguration){let t=await i;e[0]=this.localUserConfiguration.reparse({exclude:t.getValue(nj)})}return(0,sY.mark)("code/didInitUserConfiguration"),e},[,o,[n,s]]=await Promise.all([t,i,r()]);(0,sY.mark)("code/willInitWorkspaceConfiguration"),await this.loadConfiguration(o,n,s,e),(0,sY.mark)("code/didInitWorkspaceConfiguration")}reloadDefaultConfiguration(){this.onDefaultConfigurationChanged(this.defaultConfiguration.reload())}async reloadApplicationConfiguration(e){if(!this.applicationConfiguration)return sp.ConfigurationModel.createEmptyModel(this.logService);let t=await this.applicationConfiguration.loadConfiguration();return e||this.onApplicationConfigurationChanged(t),t}async reloadUserConfiguration(){let[e,t]=await Promise.all([this.reloadLocalUserConfiguration(!0),this.reloadRemoteUserConfiguration(!0)]);return{local:e,remote:t}}async reloadLocalUserConfiguration(e,t){let i=await this.localUserConfiguration.reload(t);return e||this.onLocalUserConfigurationChanged(i),i}async reloadRemoteUserConfiguration(e){if(this.remoteUserConfiguration){let t=await this.remoteUserConfiguration.reload();return e||this.onRemoteUserConfigurationChanged(t),t}return sp.ConfigurationModel.createEmptyModel(this.logService)}async reloadWorkspaceConfiguration(){let e=this.getWorkbenchState();return e===sg.WorkbenchState.FOLDER?this.onWorkspaceFolderConfigurationChanged(this.workspace.folders[0]):e===sg.WorkbenchState.WORKSPACE?this.workspaceConfiguration.reload().then(()=>this.onWorkspaceConfigurationChanged(!1)):void 0}reloadWorkspaceFolderConfiguration(e){return this.onWorkspaceFolderConfigurationChanged(e)}async loadConfiguration(e,t,i,r){this.cachedFolderConfigs=new sd.ResourceMap;let o=this.workspace.folders,n=await this.loadFolderConfigurations(o),s=this.getWorkspaceConfigurationModel(n),a=new sd.ResourceMap;n.forEach((e,t)=>a.set(o[t].uri,e));let l=this._configuration;if(this._configuration=new sy(this.defaultConfiguration.configurationModel,this.policyConfiguration.configurationModel,e,t,i,s,a,sp.ConfigurationModel.createEmptyModel(this.logService),new sd.ResourceMap,this.workspace,this.logService),this.initialized=!0,r){let e=this._configuration.compare(l);this.triggerConfigurationChange(e,{data:l.toData(),workspace:this.workspace},ng.ConfigurationTarget.WORKSPACE)}this.updateRestrictedSettings()}getWorkspaceConfigurationModel(e){switch(this.getWorkbenchState()){case sg.WorkbenchState.FOLDER:return e[0];case sg.WorkbenchState.WORKSPACE:return this.workspaceConfiguration.getConfiguration();default:return sp.ConfigurationModel.createEmptyModel(this.logService)}}onUserDataProfileChanged(e){e.join((async()=>{let t=[];t.push(this.localUserConfiguration.reset(e.profile.settingsResource,e.profile.tasksResource,e.profile.mcpResource,{scopes:s8(e.profile,!!this.remoteUserConfiguration)})),(e.previous.isDefault!==e.profile.isDefault||!!e.previous.useDefaultFlags?.settings!=!!e.profile.useDefaultFlags?.settings)&&(this.createApplicationConfiguration(),this.applicationConfiguration&&t.push(this.reloadApplicationConfiguration(!0)));let[i,r]=await Promise.all(t);r=r??this._configuration.applicationConfiguration,this.applicationConfiguration&&(i=this.localUserConfiguration.reparse({exclude:r.getValue(nj)})),await this.loadConfiguration(r,i,this._configuration.remoteUserConfiguration,!0)})())}onDefaultConfigurationChanged(e,t){if(this.workspace){let i=this._configuration.toData(),r=this._configuration.compareAndUpdateDefaultConfiguration(e,t);if(this.applicationConfiguration&&this._configuration.updateApplicationConfiguration(this.applicationConfiguration.reparse()),this.remoteUserConfiguration&&(this._configuration.updateLocalUserConfiguration(this.localUserConfiguration.reparse()),this._configuration.updateRemoteUserConfiguration(this.remoteUserConfiguration.reparse())),this.getWorkbenchState()===sg.WorkbenchState.FOLDER){let e=this.cachedFolderConfigs.get(this.workspace.folders[0].uri);e&&(this._configuration.updateWorkspaceConfiguration(e.reparse()),this._configuration.updateFolderConfiguration(this.workspace.folders[0].uri,e.reparse()))}else for(let e of(this._configuration.updateWorkspaceConfiguration(this.workspaceConfiguration.reparseWorkspaceSettings()),this.workspace.folders)){let t=this.cachedFolderConfigs.get(e.uri);t&&this._configuration.updateFolderConfiguration(e.uri,t.reparse())}this.triggerConfigurationChange(r,{data:i,workspace:this.workspace},ng.ConfigurationTarget.DEFAULT),this.updateRestrictedSettings()}}onPolicyConfigurationChanged(e){let t={data:this._configuration.toData(),workspace:this.workspace},i=this._configuration.compareAndUpdatePolicyConfiguration(e);this.triggerConfigurationChange(i,t,ng.ConfigurationTarget.DEFAULT)}onApplicationConfigurationChanged(e){let t={data:this._configuration.toData(),workspace:this.workspace},i=this._configuration.applicationConfiguration.getValue(nj)??[],r=this._configuration.compareAndUpdateApplicationConfiguration(e),o=this.getValue(nj)??[],n=this.configurationRegistry.getConfigurationProperties(),s=[];for(let e of r.keys){let t=n[e]?.scope;if(t&&nA.includes(t)){if(s.push(e),e===nj){for(let e of i)o.includes(e)||s.push(e);for(let e of o)i.includes(e)||s.push(e)}}else o.includes(e)&&s.push(e)}r.keys=s,r.keys.includes(nj)&&this._configuration.updateLocalUserConfiguration(this.localUserConfiguration.reparse({exclude:o})),this.triggerConfigurationChange(r,t,ng.ConfigurationTarget.USER)}onLocalUserConfigurationChanged(e){let t={data:this._configuration.toData(),workspace:this.workspace},i=this._configuration.compareAndUpdateLocalUserConfiguration(e);this.triggerConfigurationChange(i,t,ng.ConfigurationTarget.USER)}onRemoteUserConfigurationChanged(e){let t={data:this._configuration.toData(),workspace:this.workspace},i=this._configuration.compareAndUpdateRemoteUserConfiguration(e);this.triggerConfigurationChange(i,t,ng.ConfigurationTarget.USER)}async onWorkspaceConfigurationChanged(e){if(this.workspace&&this.workspace.configuration){let t=(0,sC.toWorkspaceFolders)(this.workspaceConfiguration.getFolders(),this.workspace.configuration,this.uriIdentityService.extUri);if(this.workspace.initialized){let{added:e,removed:i,changed:r}=this.compareFolders(this.workspace.folders,t);t=e.length||i.length||r.length?await this.toValidWorkspaceFolders(t):this.workspace.folders}await this.updateWorkspaceConfiguration(t,this.workspaceConfiguration.getConfiguration(),e)}}updateRestrictedSettings(){let e=[],t=this.configurationRegistry.getConfigurationProperties(),i=Object.keys(t).filter(e=>t[e].restricted).sort((e,t)=>e.localeCompare(t)),r=(0,ox.delta)(i,this._restrictedSettings.default,(e,t)=>e.localeCompare(t));e.push(...r.added,...r.removed);let o=(this.applicationConfiguration?.getRestrictedSettings()||[]).sort((e,t)=>e.localeCompare(t)),n=(0,ox.delta)(o,this._restrictedSettings.application||[],(e,t)=>e.localeCompare(t));e.push(...n.added,...n.removed);let s=this.localUserConfiguration.getRestrictedSettings().sort((e,t)=>e.localeCompare(t)),a=(0,ox.delta)(s,this._restrictedSettings.userLocal||[],(e,t)=>e.localeCompare(t));e.push(...a.added,...a.removed);let l=(this.remoteUserConfiguration?.getRestrictedSettings()||[]).sort((e,t)=>e.localeCompare(t)),c=(0,ox.delta)(l,this._restrictedSettings.userRemote||[],(e,t)=>e.localeCompare(t));e.push(...c.added,...c.removed);let d=new sd.ResourceMap;for(let t of this.workspace.folders){let i=this.cachedFolderConfigs.get(t.uri),r=(i?.getRestrictedSettings()||[]).sort((e,t)=>e.localeCompare(t));r.length&&d.set(t.uri,r);let o=this._restrictedSettings.workspaceFolder?.get(t.uri)||[],n=(0,ox.delta)(r,o,(e,t)=>e.localeCompare(t));e.push(...n.added,...n.removed)}let u=this.getWorkbenchState()===sg.WorkbenchState.WORKSPACE?this.workspaceConfiguration.getRestrictedSettings().sort((e,t)=>e.localeCompare(t)):this.workspace.folders[0]&&d.get(this.workspace.folders[0].uri)||[],h=(0,ox.delta)(u,this._restrictedSettings.workspace||[],(e,t)=>e.localeCompare(t));e.push(...h.added,...h.removed),e.length&&(this._restrictedSettings={default:i,application:o.length?o:void 0,userLocal:s.length?s:void 0,userRemote:l.length?l:void 0,workspace:u.length?u:void 0,workspaceFolder:d.size?d:void 0},this._onDidChangeRestrictedSettings.fire(this.restrictedSettings))}async updateWorkspaceConfiguration(e,t,i){let r={data:this._configuration.toData(),workspace:this.workspace},o=this._configuration.compareAndUpdateWorkspaceConfiguration(t),n=this.compareFolders(this.workspace.folders,e);if(n.added.length||n.removed.length||n.changed.length){this.workspace.folders=e;let t=await this.onFoldersChanged();await this.handleWillChangeWorkspaceFolders(n,i),this.triggerConfigurationChange(t,r,ng.ConfigurationTarget.WORKSPACE_FOLDER),this._onDidChangeWorkspaceFolders.fire(n)}else this.triggerConfigurationChange(o,r,ng.ConfigurationTarget.WORKSPACE);this.updateRestrictedSettings()}async handleWillChangeWorkspaceFolders(e,t){let i=[];this._onWillChangeWorkspaceFolders.fire({join(e){i.push(e)},changes:e,fromCache:t});try{await sh.Promises.settled(i)}catch(e){}}async onWorkspaceFolderConfigurationChanged(e){let[t]=await this.loadFolderConfigurations([e]),i={data:this._configuration.toData(),workspace:this.workspace},r=this._configuration.compareAndUpdateFolderConfiguration(e.uri,t);if(this.getWorkbenchState()===sg.WorkbenchState.FOLDER){let e=this._configuration.compareAndUpdateWorkspaceConfiguration(t);this.triggerConfigurationChange((0,sp.mergeChanges)(r,e),i,ng.ConfigurationTarget.WORKSPACE)}else this.triggerConfigurationChange(r,i,ng.ConfigurationTarget.WORKSPACE_FOLDER);this.updateRestrictedSettings()}async onFoldersChanged(){let e=[];for(let t of this.cachedFolderConfigs.keys())this.workspace.folders.filter(e=>e.uri.toString()===t.toString())[0]||(this.cachedFolderConfigs.get(t).dispose(),this.cachedFolderConfigs.delete(t),e.push(this._configuration.compareAndDeleteFolderConfiguration(t)));let t=this.workspace.folders.filter(e=>!this.cachedFolderConfigs.has(e.uri));return t.length&&(await this.loadFolderConfigurations(t)).forEach((i,r)=>{e.push(this._configuration.compareAndUpdateFolderConfiguration(t[r].uri,i))}),(0,sp.mergeChanges)(...e)}loadFolderConfigurations(e){return Promise.all([...e.map(e=>{let t=this.cachedFolderConfigs.get(e.uri);return t||(t=new sJ(!this.initialized,e,nT,this.getWorkbenchState(),this.isWorkspaceTrusted,this.fileService,this.uriIdentityService,this.logService,this.configurationCache),this._register(t.onDidChange(()=>this.onWorkspaceFolderConfigurationChanged(e))),this.cachedFolderConfigs.set(e.uri,this._register(t))),t.loadConfiguration()})])}async validateWorkspaceFoldersAndReload(e){let t=await this.toValidWorkspaceFolders(this.workspace.folders),{removed:i}=this.compareFolders(this.workspace.folders,t);i.length&&await this.updateWorkspaceConfiguration(t,this.workspaceConfiguration.getConfiguration(),e)}async toValidWorkspaceFolders(e){let t=[];for(let i of e){try{if(!(await this.fileService.stat(i.uri)).isDirectory)continue}catch(e){this.logService.warn(`Ignoring the error while validating workspace folder ${i.uri.toString()} - ${(0,s0.toErrorMessage)(e)}`)}t.push(i)}return t}async writeConfigurationValue(e,t,i,r,o){if(!this.instantiationService)throw Error("Cannot write configuration because the configuration service is not yet ready to accept writes.");if(i===ng.ConfigurationTarget.DEFAULT)throw Error("Invalid configuration target");if(i===ng.ConfigurationTarget.MEMORY){let o={data:this._configuration.toData(),workspace:this.workspace};this._configuration.updateValue(e,t,r),this.triggerConfigurationChange({keys:r?.overrideIdentifiers?.length?[(0,nm.keyFromOverrideIdentifiers)(r.overrideIdentifiers),e]:[e],overrides:r?.overrideIdentifiers?.length?r.overrideIdentifiers.map(t=>[t,[e]]):[]},o,i);return}let n=this.toEditableConfigurationTarget(i,e);if(!n||n===$.USER_REMOTE&&!this.remoteUserConfiguration)throw Error("Invalid configuration target");if(r?.overrideIdentifiers?.length&&r.overrideIdentifiers.length>1){let e=this.getConfigurationModelForEditableConfigurationTarget(n,r.resource);if(e){let t=r.overrideIdentifiers.sort(),i=e.overrides.find(e=>(0,ox.equals)([...e.identifiers].sort(),t));i&&(r.overrideIdentifiers=i.identifiers)}}switch(this.configurationEditing=this.configurationEditing??this.createConfigurationEditingService(this.instantiationService),await (await this.configurationEditing).writeConfiguration(n,{key:e,value:t},{scopes:r,...o}),n){case $.USER_LOCAL:this.applicationConfiguration&&this.isSettingAppliedForAllProfiles(e)?await this.reloadApplicationConfiguration():await this.reloadLocalUserConfiguration();return;case $.USER_REMOTE:return this.reloadRemoteUserConfiguration().then(()=>void 0);case $.WORKSPACE:return this.reloadWorkspaceConfiguration();case $.WORKSPACE_FOLDER:{let e=r&&r.resource?this.workspace.getFolder(r.resource):null;if(e)return this.reloadWorkspaceFolderConfiguration(e)}}}async createConfigurationEditingService(e){let t=(await this.remoteAgentService.getEnvironment())?.settingsPath??null;return e.createInstance(sL,t)}getConfigurationModelForEditableConfigurationTarget(e,t){switch(e){case $.USER_LOCAL:return this._configuration.localUserConfiguration;case $.USER_REMOTE:return this._configuration.remoteUserConfiguration;case $.WORKSPACE:return this._configuration.workspaceConfiguration;case $.WORKSPACE_FOLDER:return t?this._configuration.folderConfigurations.get(t):void 0}}getConfigurationModel(e,t){switch(e){case ng.ConfigurationTarget.USER_LOCAL:return this._configuration.localUserConfiguration;case ng.ConfigurationTarget.USER_REMOTE:return this._configuration.remoteUserConfiguration;case ng.ConfigurationTarget.WORKSPACE:return this._configuration.workspaceConfiguration;case ng.ConfigurationTarget.WORKSPACE_FOLDER:return t?this._configuration.folderConfigurations.get(t):void 0;default:return}}deriveConfigurationTargets(e,t,i){if((0,nD.equals)(t,i.value))return[];let r=[];return(void 0!==i.workspaceFolderValue&&r.push(ng.ConfigurationTarget.WORKSPACE_FOLDER),void 0!==i.workspaceValue&&r.push(ng.ConfigurationTarget.WORKSPACE),void 0!==i.userRemoteValue&&r.push(ng.ConfigurationTarget.USER_REMOTE),void 0!==i.userLocalValue&&r.push(ng.ConfigurationTarget.USER_LOCAL),void 0!==i.applicationValue&&r.push(ng.ConfigurationTarget.APPLICATION),void 0===t)?r:[r[0]||ng.ConfigurationTarget.USER]}triggerConfigurationChange(e,t,i){if(e.keys.length){i!==ng.ConfigurationTarget.DEFAULT&&this.logService.debug(`Configuration keys changed in ${(0,ng.ConfigurationTargetToString)(i)} target`,...e.keys);let r=new sp.ConfigurationChangeEvent(e,t,this._configuration,this.workspace,this.logService);r.source=i,this._onDidChangeConfiguration.fire(r)}}toEditableConfigurationTarget(e,t){if(e===ng.ConfigurationTarget.APPLICATION)return $.USER_LOCAL;if(e===ng.ConfigurationTarget.USER){if(this.remoteUserConfiguration){let e=this.configurationRegistry.getConfigurationProperties()[t]?.scope;if(e===nm.ConfigurationScope.MACHINE||e===nm.ConfigurationScope.MACHINE_OVERRIDABLE||e===nm.ConfigurationScope.APPLICATION_MACHINE||void 0!==this.inspect(t).userRemoteValue)return $.USER_REMOTE}return $.USER_LOCAL}return e===ng.ConfigurationTarget.USER_LOCAL?$.USER_LOCAL:e===ng.ConfigurationTarget.USER_REMOTE?$.USER_REMOTE:e===ng.ConfigurationTarget.WORKSPACE?$.WORKSPACE:e===ng.ConfigurationTarget.WORKSPACE_FOLDER?$.WORKSPACE_FOLDER:null}}let ae=class extends su.Disposable{constructor(e,t,i,r,o){super(),this.workspaceContextService=e,this.environmentService=t,this.workspaceTrustManagementService=i,r.whenInstalledExtensionsRegistered().then(()=>{this.registerConfigurationSchemas();let e=nC.Registry.as(nm.Extensions.Configuration),t=this._register(new sh.Delayer(50));this._register(r7.Event.any(e.onDidUpdateConfiguration,e.onDidSchemaChange,i.onDidChangeTrust)(()=>t.trigger(()=>this.registerConfigurationSchemas(),o.phase===n3.LifecyclePhase.Eventually?void 0:2500)))})}registerConfigurationSchemas(){let e={properties:nm.allSettings.properties,patternProperties:nm.allSettings.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},t=this.environmentService.remoteAuthority?{properties:Object.assign({},nm.applicationSettings.properties,nm.windowSettings.properties,nm.resourceSettings.properties),patternProperties:nm.allSettings.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0}:e,i={properties:Object.assign({},nm.machineSettings.properties,nm.machineOverridableSettings.properties,nm.windowSettings.properties,nm.resourceSettings.properties),patternProperties:nm.allSettings.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},r={properties:Object.assign({},nm.applicationMachineSettings.properties,nm.machineSettings.properties,nm.machineOverridableSettings.properties,nm.windowSettings.properties,nm.resourceSettings.properties),patternProperties:nm.allSettings.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},o={properties:Object.assign({},this.checkAndFilterPropertiesRequiringTrust(nm.machineOverridableSettings.properties),this.checkAndFilterPropertiesRequiringTrust(nm.windowSettings.properties),this.checkAndFilterPropertiesRequiringTrust(nm.resourceSettings.properties)),patternProperties:nm.allSettings.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},n={properties:Object.keys(nm.allSettings.properties).reduce((e,t)=>(e[t]=Object.assign({deprecationMessage:void 0},nm.allSettings.properties[t]),e),{}),patternProperties:Object.keys(nm.allSettings.patternProperties).reduce((e,t)=>(e[t]=Object.assign({deprecationMessage:void 0},nm.allSettings.patternProperties[t]),e),{}),additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},s=sg.WorkbenchState.WORKSPACE===this.workspaceContextService.getWorkbenchState()?{properties:Object.assign({},this.checkAndFilterPropertiesRequiringTrust(nm.machineOverridableSettings.properties),this.checkAndFilterPropertiesRequiringTrust(nm.resourceSettings.properties)),patternProperties:nm.allSettings.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0}:o,a={type:"object",description:(0,oi.localize)(13756,"Contribute defaults for configurations"),properties:Object.assign({},this.filterDefaultOverridableProperties(nm.machineOverridableSettings.properties),this.filterDefaultOverridableProperties(nm.windowSettings.properties),this.filterDefaultOverridableProperties(nm.resourceSettings.properties)),patternProperties:{[nm.OVERRIDE_PROPERTY_PATTERN]:{type:"object",default:{},$ref:nm.resourceLanguageSettingsSchemaId}},additionalProperties:!1};this.registerSchemas({defaultSettingsSchema:n,userSettingsSchema:t,profileSettingsSchema:i,machineSettingsSchema:r,workspaceSettingsSchema:o,folderSettingsSchema:s,configDefaultsSchema:a})}registerSchemas(e){let t=nC.Registry.as(nk.Extensions.JSONContribution);t.registerSchema("vscode://schemas/settings/default",e.defaultSettingsSchema),t.registerSchema("vscode://schemas/settings/user",e.userSettingsSchema),t.registerSchema("vscode://schemas/settings/profile",e.profileSettingsSchema),t.registerSchema("vscode://schemas/settings/machine",e.machineSettingsSchema),t.registerSchema(nI,e.workspaceSettingsSchema),t.registerSchema("vscode://schemas/settings/folder",e.folderSettingsSchema),t.registerSchema(nm.configurationDefaultsSchemaId,e.configDefaultsSchema)}checkAndFilterPropertiesRequiringTrust(e){if(this.workspaceTrustManagementService.isWorkspaceTrusted())return e;let t={};return Object.entries(e).forEach(([e,i])=>{i.restricted||(t[e]=i)}),t}filterDefaultOverridableProperties(e){let t={};return Object.entries(e).forEach(([e,i])=>{i.disallowConfigurationDefault||(t[e]=i)}),t}};ae=(0,rM.__decorate)([(0,rM.__param)(0,nw.IWorkspaceContextService),(0,rM.__param)(1,sX.IWorkbenchEnvironmentService),(0,rM.__param)(2,s1.IWorkspaceTrustManagementService),(0,rM.__param)(3,s2.IExtensionService),(0,rM.__param)(4,sZ.ILifecycleService)],ae);let at=class extends su.Disposable{static{this.ID="workbench.contrib.configurationDefaultOverridesContribution"}constructor(e,t,i,r){super(),this.workbenchAssignmentService=e,this.extensionService=t,this.configurationService=i,this.logService=r,this.processedExperimentalSettings=new Set,this.autoExperimentalSettings=new Set,this.configurationRegistry=nC.Registry.as(nm.Extensions.Configuration),this.throttler=this._register(new sh.Throttler),this.throttler.queue(()=>this.updateDefaults()),this._register(e.onDidRefetchAssignments(()=>this.throttler.queue(()=>this.processExperimentalSettings(this.autoExperimentalSettings,!0)))),this._register(this.configurationRegistry.onDidUpdateConfiguration(({properties:e})=>this.processExperimentalSettings(e,!1)))}async updateDefaults(){this.logService.trace("ConfigurationService#updateDefaults: begin");try{await this.processExperimentalSettings(Object.keys(this.configurationRegistry.getConfigurationProperties()),!1)}finally{await this.extensionService.whenInstalledExtensionsRegistered(),this.logService.trace("ConfigurationService#updateDefaults: resetting the defaults"),this.configurationService.reloadConfiguration(ng.ConfigurationTarget.DEFAULT)}}async processExperimentalSettings(e,t){let i={},r=this.configurationRegistry.getConfigurationProperties();for(let o of e){let e=r[o];if(e?.experiment&&!(!t&&this.processedExperimentalSettings.has(o))){this.processedExperimentalSettings.add(o),"auto"===e.experiment.mode&&this.autoExperimentalSettings.add(o);try{let t=await this.workbenchAssignmentService.getTreatment(e.experiment.name??`config.${o}`);(0,oK.isUndefined)(t)||(0,nD.equals)(t,e.default)||(i[o]=t)}catch(e){}}}Object.keys(i).length&&this.configurationRegistry.registerDefaultConfigurations([{overrides:i}])}};at=(0,rM.__decorate)([(0,rM.__param)(0,s6.IWorkbenchAssignmentService),(0,rM.__param)(1,s2.IExtensionService),(0,rM.__param)(2,rW.IConfigurationService),(0,rM.__param)(3,n_.ILogService)],at),nC.Registry.as(n6.Extensions.Workbench).registerWorkbenchContribution(ae,n3.LifecyclePhase.Restored),(0,n6.registerWorkbenchContribution2)(at.ID,at,n6.WorkbenchPhase.BlockRestore),nC.Registry.as(nm.Extensions.Configuration).registerConfiguration({...s5.workbenchConfigurationNodeBase,properties:{[nj]:{type:"array",description:(0,oi.localize)(13757,"Configure settings to be applied for all profiles."),default:[],scope:nm.ConfigurationScope.APPLICATION,additionalProperties:!0,uniqueItems:!0}}});class ai{constructor(e,t,i){this.donotCacheResourcesWithSchemes=e,this.fileService=i,this.cachedConfigurations=new Map,this.cacheHome=t.cacheHome}needsCaching(e){return!this.donotCacheResourcesWithSchemes.includes(e.scheme)}read(e){return this.getCachedConfiguration(e).read()}write(e,t){return this.getCachedConfiguration(e).save(t)}remove(e){return this.getCachedConfiguration(e).remove()}getCachedConfiguration({type:e,key:t}){let i=`${e}:${t}`,r=this.cachedConfigurations.get(i);return r||(r=new ar({type:e,key:t},this.cacheHome,this.fileService),this.cachedConfigurations.set(i,r)),r}}class ar{constructor({type:e,key:t},i,r){this.fileService=r,this.cachedConfigurationFolderResource=(0,n9.joinPath)(i,"CachedConfigurations",e,t),this.cachedConfigurationFileResource=(0,n9.joinPath)(this.cachedConfigurationFolderResource,"workspaces"===e?"workspace.json":"configuration.json"),this.queue=new sh.Queue}async read(){try{return(await this.fileService.readFile(this.cachedConfigurationFileResource)).value.toString()}catch(e){return""}}async save(e){await this.createCachedFolder()&&await this.queue.queue(async()=>{await this.fileService.writeFile(this.cachedConfigurationFileResource,na.VSBuffer.fromString(e))})}async remove(){try{await this.queue.queue(()=>this.fileService.del(this.cachedConfigurationFolderResource,{recursive:!0,useTrash:!1}))}catch(e){if(e.fileOperationResult!==sD.FileOperationResult.FILE_NOT_FOUND)throw e}}async createCachedFolder(){if(await this.fileService.exists(this.cachedConfigurationFolderResource))return!0;try{return await this.fileService.createFolder(this.cachedConfigurationFolderResource),!0}catch(e){return!1}}}var ao=e.i(436771),an=e.i(354244);e.i(157255);let as=class{constructor(e,t,i,r){this.configurationService=e,this.environmentService=i,this.storageService=r,this.remoteEnvironment=null,t.getEnvironment().then(e=>this.remoteEnvironment=e)}getEOL(e,t){let i=this.configurationService.getValue("files.eol",{overrideIdentifier:t,resource:e});if(i&&"string"==typeof i&&"auto"!==i)return i;let r=this.getOS(e);return r===an.OperatingSystem.Linux||r===an.OperatingSystem.Macintosh?"\n":"\r\n"}getOS(e){let t=an.OS,i=this.environmentService.remoteAuthority;if(i&&e&&e.scheme!==nl.Schemas.file){let e=`resource.authority.os.${i}`;t=this.remoteEnvironment?this.remoteEnvironment.os:this.storageService.getNumber(e,si.StorageScope.WORKSPACE,an.OS),this.storageService.store(e,t,si.StorageScope.WORKSPACE,si.StorageTarget.MACHINE)}return t}};as=(0,rM.__decorate)([(0,rM.__param)(0,rW.IConfigurationService),(0,rM.__param)(1,ao.IRemoteAgentService),(0,rM.__param)(2,sX.IWorkbenchEnvironmentService),(0,rM.__param)(3,sr.IStorageService)],as);var aa=e.i(431153),al=e.i(846960),ac=e.i(324726),ad=e.i(193391),au=rd;let ah=class extends au.Disposable{constructor(e,t,i,r,o,n,s,a,l,c,d,u,h,g,p,m){super(),this.jsonEditingService=e,this.contextService=t,this.configurationService=i,this.notificationService=r,this.commandService=o,this.fileService=n,this.textFileService=s,this.workspacesService=a,this.environmentService=l,this.fileDialogService=c,this.dialogService=d,this.hostService=u,this.uriIdentityService=h,this.workspaceTrustManagementService=g,this.userDataProfilesService=p,this.userDataProfileService=m}async pickNewWorkspacePath(){let e=[nl.Schemas.file];this.environmentService.remoteAuthority&&e.unshift(nl.Schemas.vscodeRemote);let t=await this.fileDialogService.showSaveDialog({saveLabel:(0,oi.localize)(14660,"Save"),title:(0,oi.localize)(14661,"Save Workspace"),filters:n4.WORKSPACE_FILTER,defaultUri:(0,n9.joinPath)(await this.fileDialogService.defaultWorkspacePath(),this.getNewWorkspaceName()),availableFileSystems:e});if(t)return(0,n4.hasWorkspaceFileExtension)(t)||(t=t.with({path:`${t.path}.${n4.WORKSPACE_EXTENSION}`})),t}getNewWorkspaceName(){let e=this.getCurrentWorkspaceIdentifier()?.configPath;if(e&&(0,n4.isSavedWorkspace)(e,this.environmentService))return(0,n9.basename)(e);let t=this.contextService.getWorkspace().folders.at(0);return t?`${(0,n9.basename)(t.uri)}.${n4.WORKSPACE_EXTENSION}`:`workspace.${n4.WORKSPACE_EXTENSION}`}async updateFolders(e,t,i,r){let o=this.contextService.getWorkspace().folders,n=[];"number"==typeof t&&(n=o.slice(e,e+t).map(e=>e.uri));let s=[];Array.isArray(i)&&(s=i.map(e=>({uri:(0,n9.removeTrailingPathSeparator)(e.uri),name:e.name})));let a=n.length>0,l=s.length>0;if(l||a)return l&&!a?this.doAddFolders(s,e,r):a&&!l?this.removeFolders(n):this.includesSingleFolderWorkspace(n)?this.createAndEnterWorkspace(s):this.contextService.getWorkbenchState()!==n4.WorkbenchState.WORKSPACE?this.doAddFolders(s,e,r):this.doUpdateFolders(s,n,e,r)}async doUpdateFolders(e,t,i,r=!1){try{await this.contextService.updateFolders(e,t,i)}catch(e){if(r)throw e;this.handleWorkspaceConfigurationEditingError(e)}}addFolders(e,t=!1){let i=e.map(e=>({uri:(0,n9.removeTrailingPathSeparator)(e.uri),name:e.name}));return this.doAddFolders(i,void 0,t)}async doAddFolders(e,t,i=!1){let r=this.contextService.getWorkbenchState();if(r!==n4.WorkbenchState.WORKSPACE){let i=this.contextService.getWorkspace().folders.map(e=>({uri:e.uri}));if(i.splice("number"==typeof t?t:i.length,0,...e),i=(0,ox.distinct)(i,e=>this.uriIdentityService.extUri.getComparisonKey(e.uri)),r===n4.WorkbenchState.EMPTY&&0===i.length||r===n4.WorkbenchState.FOLDER&&1===i.length)return;return this.createAndEnterWorkspace(i)}try{await this.contextService.addFolders(e,t)}catch(e){if(i)throw e;this.handleWorkspaceConfigurationEditingError(e)}}async removeFolders(e,t=!1){if(this.includesSingleFolderWorkspace(e))return this.createAndEnterWorkspace([]);try{await this.contextService.removeFolders(e)}catch(e){if(t)throw e;this.handleWorkspaceConfigurationEditingError(e)}}includesSingleFolderWorkspace(e){if(this.contextService.getWorkbenchState()===n4.WorkbenchState.FOLDER){let t=this.contextService.getWorkspace().folders[0];return e.some(e=>this.uriIdentityService.extUri.isEqual(e,t.uri))}return!1}async createAndEnterWorkspace(e,t){if(t&&!await this.isValidTargetWorkspacePath(t))return;let i=this.environmentService.remoteAuthority,r=await this.workspacesService.createUntitledWorkspace(e,i);if(t)try{await this.saveWorkspaceAs(r,t)}finally{await this.workspacesService.deleteUntitledWorkspace(r)}else t=r.configPath,this.userDataProfileService.currentProfile.isDefault||await this.userDataProfilesService.setProfileForWorkspace(r,this.userDataProfileService.currentProfile);return this.enterWorkspace(t)}async saveAndEnterWorkspace(e){let t=this.getCurrentWorkspaceIdentifier();return t?(0,n9.isEqual)(t.configPath,e)?this.saveWorkspace(t):await this.isValidTargetWorkspacePath(e)?(await this.saveWorkspaceAs(t,e),this.enterWorkspace(e)):void 0:void 0}async isValidTargetWorkspacePath(e){return!0}async saveWorkspaceAs(e,t){let i=e.configPath;if(!(0,n4.isUntitledWorkspace)(t,this.environmentService)&&!this.userDataProfileService.currentProfile.isDefault){let e=await this.workspacesService.getWorkspaceIdentifier(t);await this.userDataProfilesService.setProfileForWorkspace(e,this.userDataProfileService.currentProfile)}if(this.uriIdentityService.extUri.isEqual(i,t))return;let r=(0,n4.isUntitledWorkspace)(i,this.environmentService),o=await this.fileService.readFile(i),n=(0,sC.rewriteWorkspaceFileForNewLocation)(o.value.toString(),i,r,t,this.uriIdentityService.extUri);await this.textFileService.create([{resource:t,value:n,options:{overwrite:!0}}]),await this.trustWorkspaceConfiguration(t)}async saveWorkspace(e){let t=e.configPath,i=this.textFileService.files.get(t);if(i)return void await i.save({force:!0,reason:ad.SaveReason.EXPLICIT});if(await this.fileService.exists(t))return;let r=(0,sC.rewriteWorkspaceFileForNewLocation)(JSON.stringify({folders:[]},null," "),t,!1,t,this.uriIdentityService.extUri);await this.textFileService.create([{resource:t,value:r}])}handleWorkspaceConfigurationEditingError(e){e.code===aa.JSONEditingErrorCode.ERROR_INVALID_FILE?this.onInvalidWorkspaceConfigurationFileError():this.notificationService.error(e.message)}onInvalidWorkspaceConfigurationFileError(){let e=(0,oi.localize)(14662,"Unable to write into workspace configuration file. Please open the file to correct errors/warnings in it and try again.");this.askToOpenWorkspaceConfigurationFile(e)}askToOpenWorkspaceConfigurationFile(e){this.notificationService.prompt(sl.default.Error,e,[{label:(0,oi.localize)(14663,"Open Workspace Configuration"),run:()=>this.commandService.executeCommand("workbench.action.openWorkspaceConfigFile")}])}async doEnterWorkspace(e){if(this.environmentService.extensionTestsLocationURI)throw Error("Entering a new workspace is not possible in tests.");let t=await this.workspacesService.getWorkspaceIdentifier(e);return this.contextService.getWorkbenchState()===n4.WorkbenchState.FOLDER&&await this.migrateWorkspaceSettings(t),await this.configurationService.initialize(t),this.workspacesService.enterWorkspace(e)}migrateWorkspaceSettings(e){return this.doCopyWorkspaceSettings(e,e=>e.scope===nm.ConfigurationScope.WINDOW)}copyWorkspaceSettings(e){return this.doCopyWorkspaceSettings(e)}doCopyWorkspaceSettings(e,t){let i=nC.Registry.as(nm.Extensions.Configuration).getConfigurationProperties(),r={};for(let e of this.configurationService.keys().workspace)if(i[e]){if(t&&!t(i[e]))continue;r[e]=this.configurationService.inspect(e).workspaceValue}return this.jsonEditingService.write(e.configPath,[{path:["settings"],value:r}],!0)}async trustWorkspaceConfiguration(e){this.contextService.getWorkbenchState()!==n4.WorkbenchState.EMPTY&&this.workspaceTrustManagementService.isWorkspaceTrusted()&&await this.workspaceTrustManagementService.setUrisTrust([e],!0)}getCurrentWorkspaceIdentifier(){let e=(0,n4.toWorkspaceIdentifier)(this.contextService.getWorkspace());if((0,n4.isWorkspaceIdentifier)(e))return e}};ah=(0,rM.__decorate)([(0,rM.__param)(0,s4.IJSONEditingService),(0,rM.__param)(1,nw.IWorkspaceContextService),(0,rM.__param)(2,sx.IWorkbenchConfigurationService),(0,rM.__param)(3,n7.INotificationService),(0,rM.__param)(4,al.ICommandService),(0,rM.__param)(5,nf.IFileService),(0,rM.__param)(6,sw.ITextFileService),(0,rM.__param)(7,nx.IWorkspacesService),(0,rM.__param)(8,sX.IWorkbenchEnvironmentService),(0,rM.__param)(9,ac.IFileDialogService),(0,rM.__param)(10,ac.IDialogService),(0,rM.__param)(11,se.IHostService),(0,rM.__param)(12,nS.IUriIdentityService),(0,rM.__param)(13,s1.IWorkspaceTrustManagementService),(0,rM.__param)(14,nb.IUserDataProfilesService),(0,rM.__param)(15,sP.IUserDataProfileService)],ah);var ag=rd,ap=e.i(775937);let am=class extends ag.Disposable{static{H=this}static{this.RECENTLY_OPENED_KEY="recently.opened"}constructor(e,t,i,r,o,n){super(),this.storageService=e,this.contextService=t,this.logService=i,this.fileService=r,this.environmentService=o,this.uriIdentityService=n,this._onRecentlyOpenedChange=this._register(new r7.Emitter),this.onDidChangeRecentlyOpened=this._onRecentlyOpenedChange.event,this.addWorkspaceToRecentlyOpened(),this.registerListeners()}registerListeners(){this._register(this.storageService.onDidChangeValue(si.StorageScope.APPLICATION,H.RECENTLY_OPENED_KEY,this._store)(()=>this._onRecentlyOpenedChange.fire())),this._register(this.contextService.onDidChangeWorkspaceFolders(e=>this.onDidChangeWorkspaceFolders(e)))}onDidChangeWorkspaceFolders(e){if((0,n4.isTemporaryWorkspace)(this.contextService.getWorkspace()))for(let t of e.added)this.addRecentlyOpened([{folderUri:t.uri}])}addWorkspaceToRecentlyOpened(){let e=this.contextService.getWorkspace(),t=this.environmentService.remoteAuthority;switch(this.contextService.getWorkbenchState()){case n4.WorkbenchState.FOLDER:this.addRecentlyOpened([{folderUri:e.folders[0].uri,remoteAuthority:t}]);break;case n4.WorkbenchState.WORKSPACE:this.addRecentlyOpened([{workspace:{id:e.id,configPath:e.configuration},remoteAuthority:t}])}}async getRecentlyOpened(){let e=this.storageService.get(H.RECENTLY_OPENED_KEY,si.StorageScope.APPLICATION);if(e){let t=(0,sC.restoreRecentlyOpened)(JSON.parse(e),this.logService);return t.workspaces=t.workspaces.filter(e=>!((0,sC.isRecentFolder)(e)&&e.folderUri.scheme===nl.Schemas.file&&!(0,n4.isTemporaryWorkspace)(this.contextService.getWorkspace())||(0,sC.isRecentWorkspace)(e)&&(0,n4.isTemporaryWorkspace)(e.workspace.configPath))),t}return{workspaces:[],files:[]}}async addRecentlyOpened(e){let t=await this.getRecentlyOpened();for(let i of e)(0,sC.isRecentFile)(i)?(this.doRemoveRecentlyOpened(t,[i.fileUri]),t.files.unshift(i)):((0,sC.isRecentFolder)(i)?this.doRemoveRecentlyOpened(t,[i.folderUri]):this.doRemoveRecentlyOpened(t,[i.workspace.configPath]),t.workspaces.unshift(i));return this.saveRecentlyOpened(t)}async removeRecentlyOpened(e){let t=await this.getRecentlyOpened();return this.doRemoveRecentlyOpened(t,e),this.saveRecentlyOpened(t)}doRemoveRecentlyOpened(e,t){e.files=e.files.filter(e=>!t.some(t=>t.toString()===e.fileUri.toString())),e.workspaces=e.workspaces.filter(e=>!t.some(t=>t.toString()===((0,sC.isRecentFolder)(e)?e.folderUri.toString():e.workspace.configPath.toString())))}async saveRecentlyOpened(e){return this.storageService.store(H.RECENTLY_OPENED_KEY,JSON.stringify((0,sC.toStoreData)(e)),si.StorageScope.APPLICATION,si.StorageTarget.USER)}async clearRecentlyOpened(){this.storageService.remove(H.RECENTLY_OPENED_KEY,si.StorageScope.APPLICATION)}async enterWorkspace(e){return{workspace:await this.getWorkspaceIdentifier(e)}}async createUntitledWorkspace(e,t){let i=(Date.now()+Math.round(1e3*Math.random())).toString(),r=(0,n9.joinPath)(this.environmentService.untitledWorkspacesHome,`Untitled-${i}.${n4.WORKSPACE_EXTENSION}`),o=[];if(e)for(let t of e)o.push((0,sC.getStoredWorkspaceFolder)(t.uri,!0,t.name,this.environmentService.untitledWorkspacesHome,this.uriIdentityService.extUri));return await this.fileService.writeFile(r,na.VSBuffer.fromString(JSON.stringify({folders:o,remoteAuthority:t},null," "))),this.getWorkspaceIdentifier(r)}async deleteUntitledWorkspace(e){try{await this.fileService.del(e.configPath)}catch(e){if(e.fileOperationResult!==sD.FileOperationResult.FILE_NOT_FOUND)throw e}}async getWorkspaceIdentifier(e){return(0,ap.getWorkspaceIdentifier)(e)}async getDirtyWorkspaces(){return[]}};am=H=(0,rM.__decorate)([(0,rM.__param)(0,sr.IStorageService),(0,rM.__param)(1,nw.IWorkspaceContextService),(0,rM.__param)(2,n_.ILogService),(0,rM.__param)(3,nf.IFileService),(0,rM.__param)(4,sX.IWorkbenchEnvironmentService),(0,rM.__param)(5,nS.IUriIdentityService)],am);var af=e.i(973265),av=e.i(370973),a_=e.i(751753),ay=e.i(163731),aC=e.i(108462),aS=e.i(989115),ab=e.i(545341);let aw="configResolveInputLru";class ax extends ab.AbstractVariableResolverService{static{this.INPUT_OR_COMMAND_VARIABLES_PATTERN=/\${((input|command):(.*?))}/g}constructor(e,t,i,r,o,n,s,a,l,c,d){super({getFolderUri:e=>{let t=n.getWorkspace().folders.filter(t=>t.name===e).pop();return t?t.uri:void 0},getWorkspaceFolderCount:()=>n.getWorkspace().folders.length,getConfigurationValue:(e,t)=>r.getValue(t,e?{resource:e}:{}),getAppRoot:()=>e.getAppRoot(),getExecPath:()=>e.getExecPath(),getFilePath:()=>{let e=ad.EditorResourceAccessor.getOriginalUri(i.activeEditor,{supportSideBySide:ad.SideBySideEditor.PRIMARY,filterByScheme:[nl.Schemas.file,nl.Schemas.vscodeUserData,this.pathService.defaultUriScheme]});if(e)return this.labelService.getUriLabel(e,{noPrefix:!0})},getWorkspaceFolderPathForFile:()=>{let e=ad.EditorResourceAccessor.getOriginalUri(i.activeEditor,{supportSideBySide:ad.SideBySideEditor.PRIMARY,filterByScheme:[nl.Schemas.file,nl.Schemas.vscodeUserData,this.pathService.defaultUriScheme]});if(!e)return;let t=n.getWorkspaceFolder(e);if(t)return this.labelService.getUriLabel(t.uri,{noPrefix:!0})},getSelectedText:()=>{let e=i.activeTextEditorControl,t=null;if((0,ay.isCodeEditor)(e))t=e;else if((0,ay.isDiffEditor)(e)){let i=e.getOriginalEditor(),r=e.getModifiedEditor();t=i.hasWidgetFocus()?i:r}let r=t?.getModel(),o=t?.getSelection();if(r&&o)return r.getValueInRange(o)},getLineNumber:()=>{let e=i.activeTextEditorControl;if((0,ay.isCodeEditor)(e)){let t=e.getSelection();if(t)return String(t.positionLineNumber)}},getColumnNumber:()=>{let e=i.activeTextEditorControl;if((0,ay.isCodeEditor)(e)){let t=e.getSelection();if(t)return String(t.positionColumn)}},getExtension:e=>c.getExtension(e)},a,l.userHome().then(e=>e.path),t),this.configurationService=r,this.commandService=o,this.quickInputService=s,this.labelService=a,this.pathService=l,this.storageService=d,this.userInputAccessQueue=new sh.Queue,this.resolvableVariables.add("command"),this.resolvableVariables.add("input")}async resolveWithInteractionReplace(e,t,i,r,o){let n=aS.ConfigurationResolverExpression.parse(t);return await this.resolveWithInteraction(e,n,i,r,o),n.toObject()}async resolveWithInteraction(e,t,i,r,o){let n=aS.ConfigurationResolverExpression.parse(t);for(let t of n.unresolved()){let s;if("command"===t.name){let e=(r?r[t.arg]:void 0)||t.arg,i=await this.commandService.executeCommand(e,n.toObject());if(!(0,oK.isUndefinedOrNull)(i)){if("string"!=typeof i)throw new aC.VariableError(aC.VariableKind.Command,(0,oi.localize)(13801,"Cannot substitute command variable '{0}' because command did not return a result of type string.",e));s={value:i}}}else if("input"===t.name)s=await this.showUserInput(i,t.arg,await this.resolveInputs(e,i,o),r);else if(this._contributedVariables.has(t.inner))s={value:await this._contributedVariables.get(t.inner)()};else{let i=await this.evaluateSingleVariable(t,e?.uri);if(void 0===i)continue;s="string"==typeof i?{value:i}:i}if(void 0===s)return;n.resolve(t,s)}return new Map(a_.Iterable.map(n.resolved(),([e,t])=>[e.inner,t.value]))}async resolveInputs(e,t,i){let r;if(!t)return;let o=e?{resource:e.uri}:{},n=this.configurationService.inspect(t,o);if(n)switch(i){case ng.ConfigurationTarget.MEMORY:r=n.memoryValue?.inputs;break;case ng.ConfigurationTarget.DEFAULT:r=n.defaultValue?.inputs;break;case ng.ConfigurationTarget.USER:r=n.userValue?.inputs;break;case ng.ConfigurationTarget.USER_LOCAL:r=n.userLocalValue?.inputs;break;case ng.ConfigurationTarget.USER_REMOTE:r=n.userRemoteValue?.inputs;break;case ng.ConfigurationTarget.APPLICATION:r=n.applicationValue?.inputs;break;case ng.ConfigurationTarget.WORKSPACE:r=n.workspaceValue?.inputs;break;case ng.ConfigurationTarget.WORKSPACE_FOLDER:default:r=n.workspaceFolderValue?.inputs}return r??this.configurationService.getValue(t,o)?.inputs}readInputLru(){let e=this.storageService.get(aw,si.StorageScope.WORKSPACE),t=new sd.LRUCache(5);try{e&&t.fromJSON(JSON.parse(e))}catch{}return t}storeInputLru(e){this.storageService.store(aw,JSON.stringify(e.toJSON()),si.StorageScope.WORKSPACE,si.StorageTarget.MACHINE)}async showUserInput(e,t,i,r){if(!i)throw new aC.VariableError(aC.VariableKind.Input,(0,oi.localize)(13802,"Variable '{0}' must be defined in an '{1}' section of the debug or task configuration.",t,"inputs"));let o=i.filter(e=>e.id===t).pop();if(o){let i=e=>{throw new aC.VariableError(aC.VariableKind.Input,(0,oi.localize)(13803,"Input variable '{0}' is of type '{1}' and must include '{2}'.",t,o.type,e))},n=this.readInputLru(),s=`${e}.${t}`,a=n.get(s);switch(o.type){case"promptString":{(0,oK.isString)(o.description)||i("description");let e={prompt:o.description,ignoreFocusLost:!0,value:r?.[`input:${t}`]??a??o.default};return o.password&&(e.password=o.password),this.userInputAccessQueue.queue(()=>this.quickInputService.input(e)).then(e=>("string"!=typeof e||o.password||this.storeInputLru(n.set(s,e)),void 0!==e?{value:e,input:o}:void 0))}case"pickString":{if((0,oK.isString)(o.description)||i("description"),Array.isArray(o.options))for(let e of o.options)(0,oK.isString)(e)||(0,oK.isString)(e.value)||i("value");else i("options");let e=[];for(let i of o.options){let n=(0,oK.isString)(i)?i:i.value,s=(0,oK.isString)(i)?void 0:i.label,l={label:s?`${s}: ${n}`:n,value:n},c=r?.[`input:${t}`]??a??o.default;n===o.default?(l.description=(0,oi.localize)(13804,"(Default)"),e.unshift(l)):n===c?e.unshift(l):e.push(l)}let l={placeHolder:o.description,matchOnDetail:!0,ignoreFocusLost:!0};return this.userInputAccessQueue.queue(()=>this.quickInputService.pick(e,l,void 0)).then(e=>{if(e){let t=e.value;return this.storeInputLru(n.set(s,t)),{value:t,input:o}}})}case"command":return(0,oK.isString)(o.command)||i("command"),this.userInputAccessQueue.queue(()=>this.commandService.executeCommand(o.command,o.args)).then(e=>{if("string"==typeof e||(0,oK.isUndefinedOrNull)(e))return{value:e,input:o};throw new aC.VariableError(aC.VariableKind.Input,(0,oi.localize)(13805,"Cannot substitute input variable '{0}' because command '{1}' did not return a result of type string.",t,o.command))});default:throw new aC.VariableError(aC.VariableKind.Input,(0,oi.localize)(13806,"Input variable '{0}' can only be of type 'promptString', 'pickString', or 'command'.",t))}}throw new aC.VariableError(aC.VariableKind.Input,(0,oi.localize)(13807,"Undefined input variable '{0}' encountered. Remove or define '{0}' to continue.",t))}}var aD=e.i(292035);let aE=class extends ax{constructor(e,t,i,r,o,n,s,a,l){super({getAppRoot:()=>void 0,getExecPath:()=>void 0},Promise.resolve(Object.create(null)),e,t,i,r,o,n,s,a,l)}};aE=(0,rM.__decorate)([(0,rM.__param)(0,sk.IEditorService),(0,rM.__param)(1,rW.IConfigurationService),(0,rM.__param)(2,al.ICommandService),(0,rM.__param)(3,nw.IWorkspaceContextService),(0,rM.__param)(4,st.IQuickInputService),(0,rM.__param)(5,av.ILabelService),(0,rM.__param)(6,aD.IPathService),(0,rM.__param)(7,s2.IExtensionService),(0,rM.__param)(8,sr.IStorageService)],aE);var ak=e.i(703175),aT=e.i(68629),aR=e.i(130722),aP=e.i(425761),aI=e.i(63876);let aA=rh.URI.from({scheme:nl.Schemas.vscodeUserData,path:"/User/settings.json"});async function aM(e,t,i=aA){await (0,aT.initFile)(i,e,t)}nC.Registry.as(nm.Extensions.Configuration);let aL=class extends s9{constructor(e,t,i,r,o,n,s,a){super({configurationCache:new ai([nl.Schemas.file,nl.Schemas.vscodeUserData,nl.Schemas.tmp],e,r),remoteAuthority:(0,aI.getWorkbenchConstructionOptions)().remoteAuthority},e,t,i,r,o,n,s,a)}};aL=(0,rM.__decorate)([(0,rM.__param)(0,sX.IWorkbenchEnvironmentService),(0,rM.__param)(1,sP.IUserDataProfileService),(0,rM.__param)(2,nb.IUserDataProfilesService),(0,rM.__param)(3,nf.IFileService),(0,rM.__param)(4,ao.IRemoteAgentService),(0,rM.__param)(5,nS.IUriIdentityService),(0,rM.__param)(6,n_.ILogService),(0,rM.__param)(7,ny.IPolicyService)],aL);class aF extends ah{constructor(){super(...arguments),this.enterWorkspace=aP.unsupported}}(0,aR.registerServiceInitializePreParticipant)(async e=>{let t=e.get(nw.IWorkspaceContextService);t.acquireInstantiationService(e.get(ot.IInstantiationService));let r=i??(0,aI.getWorkspaceIdentifier)();if(rh.URI.isUri(r)){let i=r.with({path:"/workspace.code-workspace"});try{let t=e.get(nf.IFileService);await t.createFolder(r),await t.writeFile(i,na.VSBuffer.fromString(JSON.stringify({folders:[{path:r.path}]})))}catch{}await t.initialize({id:(0,nc.generateUuid)(),configPath:i})}else await t.initialize(r)});let aO=(0,aP.memoizedConstructor)(aL);var aN=e.i(698107),a$=no;let aH=5*sD.ByteSize.MB,aU=class extends a$.AbstractMessageLogger{constructor(e,t,i,r){super(),this.resource=e,this.donotUseFormatters=i,this.fileService=r,this.backupIndex=1,this.buffer="",this.setLevel(t),this.flushDelayer=new sh.ThrottledDelayer(100),this.initializePromise=this.initialize()}async flush(){if(!this.buffer)return;await this.initializePromise;let e=await this.loadContent();e.length>aH&&(await this.fileService.writeFile(this.getBackupResource(),na.VSBuffer.fromString(e)),e=""),this.buffer&&(e+=this.buffer,this.buffer="",await this.fileService.writeFile(this.resource,na.VSBuffer.fromString(e)))}async initialize(){try{await this.fileService.createFile(this.resource)}catch(e){if(e.fileOperationResult!==sD.FileOperationResult.FILE_MODIFIED_SINCE)throw e}}log(e,t){this.donotUseFormatters?this.buffer+=t:this.buffer+=`${this.getCurrentTimestamp()} [${this.stringifyLogLevel(e)}] ${t}
|
|
71
|
-
`,this.flushDelayer.trigger(()=>this.flush())}getCurrentTimestamp(){let e,t=e=>e<10?`0${e}`:e,i=new Date;return`${i.getFullYear()}-${t(i.getMonth()+1)}-${t(i.getDate())} ${t(i.getHours())}:${t(i.getMinutes())}:${t(i.getSeconds())}.${(e=i.getMilliseconds())<10?`00${e}`:e<100?`0${e}`:e}`}getBackupResource(){return this.backupIndex=this.backupIndex>5?1:this.backupIndex,(0,n9.joinPath)((0,n9.dirname)(this.resource),`${(0,n9.basename)(this.resource)}_${this.backupIndex++}`)}async loadContent(){try{return(await this.fileService.readFile(this.resource)).value.toString()}catch(e){return""}}stringifyLogLevel(e){switch(e){case a$.LogLevel.Debug:return"debug";case a$.LogLevel.Error:return"error";case a$.LogLevel.Info:return"info";case a$.LogLevel.Trace:return"trace";case a$.LogLevel.Warning:return"warning"}return""}};aU=(0,rM.__decorate)([(0,rM.__param)(3,nf.IFileService)],aU);class aW extends a$.AbstractLoggerService{constructor(e,t,i){super(e,t),this.fileService=i}doCreateLogger(e,t,i){let r=new aN.BufferLogger(t);return(0,sD.whenProviderRegistered)(e,this.fileService).then(()=>r.logger=new aU(e,r.getLevel(),!!i?.donotUseFormatters,this.fileService)),r}}var aq=e.i(37305),aj=e.i(253642),az=e.i(753062),aK=e.i(885277),aV=rd;let aB=class extends aV.Disposable{constructor(e,t,i,r,o){super(),this.environmentService=e,this.fileService=t,this.jsonEditingService=i,this.logService=r,this.loggerService=o,this._onDidChangeDefaultLogLevels=this._register(new r7.Emitter),this.onDidChangeDefaultLogLevels=this._onDidChangeDefaultLogLevels.event,this._defaultLogLevels={default:this._getDefaultLogLevelFromEnv(),extensions:this._getExtensionsDefaultLogLevelsFromEnv()},this._register(this.fileService.onDidFilesChange(e=>{e.contains(this.environmentService.argvResource)&&this.onDidChangeArgv()}))}async onDidChangeArgv(){let e=await this._parseLogLevelsFromArgv();this.updateDefaultLogLevels(e)}get defaultLogLevels(){return this._defaultLogLevels}updateDefaultLogLevels(e){let t={default:e?.default??this._getDefaultLogLevelFromEnv(),extensions:e?.extensions??this._getExtensionsDefaultLogLevelsFromEnv()};(0,nD.equals)(this._defaultLogLevels,t)||(this._defaultLogLevels=t,this._onDidChangeDefaultLogLevels.fire(this._defaultLogLevels))}getDefaultLogLevel(e){return e?(e=e.toLowerCase(),this._getDefaultLogLevel(this._defaultLogLevels,e)):this._getDefaultLogLevel(this._defaultLogLevels)}async setDefaultLogLevel(e,t){let i=await this._parseLogLevelsFromArgv()??{};if(t){t=t.toLowerCase();let r=this._getDefaultLogLevel(i,t);i.extensions=i.extensions??[];let o=i.extensions.find(([e])=>e===t);for(let{resource:n}of(o?o[1]=e:i.extensions.push([t,e]),await this._writeLogLevelsToArgv(i),[...this.loggerService.getRegisteredLoggers()].filter(e=>e.extensionId&&e.extensionId.toLowerCase()===t)))this.loggerService.getLogLevel(n)===r&&this.loggerService.setLogLevel(n,e)}else{let t=this._getDefaultLogLevel(i);i.default=e,await this._writeLogLevelsToArgv(i),this.loggerService.getLogLevel()===t&&this.loggerService.setLogLevel(e)}this.updateDefaultLogLevels(i)}_getDefaultLogLevel(e,t){if(t){let i=e.extensions?.find(([e])=>e===t);if(i)return i[1]}return e.default??(0,no.getLogLevel)(this.environmentService)}async _writeLogLevelsToArgv(e){let t=[];for(let[i,r]of((0,oK.isUndefined)(e.default)||t.push((0,no.LogLevelToString)(e.default)),e.extensions??[]))t.push(`${i}=${(0,no.LogLevelToString)(r)}`);await this.jsonEditingService.write(this.environmentService.argvResource,[{path:["log-level"],value:t.length?t:void 0}],!0)}async _parseLogLevelsFromArgv(){let e={extensions:[]};for(let t of(await this._readLogLevelsFromArgv())){let i=aK.EXTENSION_IDENTIFIER_WITH_LOG_REGEX.exec(t);if(i&&i[1]&&i[2]){let t=(0,no.parseLogLevel)(i[2]);(0,oK.isUndefined)(t)||e.extensions?.push([i[1].toLowerCase(),t])}else{let i=(0,no.parseLogLevel)(t);(0,oK.isUndefined)(i)||(e.default=i)}}return!(0,oK.isUndefined)(e.default)||e.extensions?.length?e:void 0}async _readLogLevelsFromArgv(){try{let e=await this.fileService.readFile(this.environmentService.argvResource),t=(0,sS.parse)(e.value.toString());return(0,oK.isString)(t["log-level"])?[t["log-level"]]:Array.isArray(t["log-level"])?t["log-level"]:[]}catch(e){(0,sD.toFileOperationResult)(e)!==sD.FileOperationResult.FILE_NOT_FOUND&&this.logService.error(e)}return[]}_getDefaultLogLevelFromEnv(){return(0,no.getLogLevel)(this.environmentService)}_getExtensionsDefaultLogLevelsFromEnv(){let e=[];for(let[t,i]of this.environmentService.extensionLogLevel??[]){let r=(0,no.parseLogLevel)(i);(0,oK.isUndefined)(r)||e.push([t,r])}return e}};aB=(0,rM.__decorate)([(0,rM.__param)(0,sX.IWorkbenchEnvironmentService),(0,rM.__param)(1,nf.IFileService),(0,rM.__param)(2,s4.IJSONEditingService),(0,rM.__param)(3,n_.ILogService),(0,rM.__param)(4,n_.ILoggerService)],aB);var aG=e.i(669827),aQ=e.i(884425);let aJ=(0,oi.localize)(0,"Window");var aY=e.i(262072),aX=r2,aZ=e.i(701898),a0=e.i(558493),a1=e.i(812491),a2=e.i(536367);let a6=class extends aZ.Action{static{this.ID="workbench.action.setLogLevel"}static{this.TITLE=(0,oi.localize2)(8589,"Set Log Level...")}constructor(e,t,i,r,o,n){super(e,t),this.quickInputService=i,this.loggerService=r,this.outputService=o,this.defaultLogLevelsService=n}async run(){let e=await this.selectLogLevelOrChannel();null!==e&&((0,no.isLogLevel)(e)?this.loggerService.setLogLevel(e):await this.setLogLevelForChannel(e))}async selectLogLevelOrChannel(){let e=this.defaultLogLevelsService.defaultLogLevels,t=[],i=[],r=this.loggerService.getLogLevel();for(let e of this.outputService.getChannelDescriptors()){if(!this.outputService.canSetLogLevel(e))continue;let o=(0,a0.isSingleSourceOutputChannelDescriptor)(e)?[e.source]:(0,a0.isMultiSourceOutputChannelDescriptor)(e)?e.source:[];if(!o.length)continue;let n=o.reduce((e,t)=>Math.min(e,this.loggerService.getLogLevel(t.resource)??r),r),s={id:e.id,label:e.label,description:n!==r?this.getLabel(n):void 0,channel:e};e.extensionId?t.push(s):i.push(s)}let o=[];return o.push({type:"separator",label:(0,oi.localize)(8590,"All")}),o.push(...this.getLogLevelEntries(e.default,this.loggerService.getLogLevel(),!0)),t.length&&(o.push({type:"separator",label:(0,oi.localize)(8591,"Extension Logs")}),o.push(...t.sort((e,t)=>e.label.localeCompare(t.label)))),o.push({type:"separator",label:(0,oi.localize)(8592,"Logs")}),o.push(...i.sort((e,t)=>e.label.localeCompare(t.label))),new Promise((e,t)=>{let i,r=new rd.DisposableStore,n=r.add(this.quickInputService.createQuickPick({useSeparators:!0}));n.placeholder=(0,oi.localize)(8593,"Set Log Level"),n.items=o,r.add(n.onDidTriggerItemButton(e=>{n.hide(),this.defaultLogLevelsService.setDefaultLogLevel(e.item.level)})),r.add(n.onDidAccept(e=>{i=n.selectedItems[0],n.hide()})),r.add(n.onDidHide(()=>{let t=i?i.level??i:null;r.dispose(),e(t)})),n.show()})}async setLogLevelForChannel(e){let t=this.defaultLogLevelsService.defaultLogLevels,i=t.extensions.find(t=>t[0]===e.channel.extensionId?.toLowerCase())?.[1]??t.default,r=this.getLogLevelEntries(i,this.outputService.getLogLevel(e.channel)??i,!!e.channel.extensionId);return new Promise((t,i)=>{let o,n=new rd.DisposableStore,s=n.add(this.quickInputService.createQuickPick());s.placeholder=e?(0,oi.localize)(8594," {0}: Select log level",e?.label):(0,oi.localize)(8595,"Select log level"),s.items=r,s.activeItems=r.filter(e=>e.level===this.loggerService.getLogLevel()),n.add(s.onDidTriggerItemButton(t=>{s.hide(),this.defaultLogLevelsService.setDefaultLogLevel(t.item.level,e.channel.extensionId)})),n.add(s.onDidAccept(e=>{o=s.selectedItems[0],s.hide()})),n.add(s.onDidHide(()=>{o&&this.outputService.setLogLevel(e.channel,o.level),n.dispose(),t()})),s.show()})}getLogLevelEntries(e,t,i){let r=i?{iconClass:a2.ThemeIcon.asClassName(oa.Codicon.checkAll),tooltip:(0,oi.localize)(8596,"Set as Default Log Level")}:void 0;return[{label:this.getLabel(no.LogLevel.Trace,t),level:no.LogLevel.Trace,description:this.getDescription(no.LogLevel.Trace,e),buttons:r&&e!==no.LogLevel.Trace?[r]:void 0},{label:this.getLabel(no.LogLevel.Debug,t),level:no.LogLevel.Debug,description:this.getDescription(no.LogLevel.Debug,e),buttons:r&&e!==no.LogLevel.Debug?[r]:void 0},{label:this.getLabel(no.LogLevel.Info,t),level:no.LogLevel.Info,description:this.getDescription(no.LogLevel.Info,e),buttons:r&&e!==no.LogLevel.Info?[r]:void 0},{label:this.getLabel(no.LogLevel.Warning,t),level:no.LogLevel.Warning,description:this.getDescription(no.LogLevel.Warning,e),buttons:r&&e!==no.LogLevel.Warning?[r]:void 0},{label:this.getLabel(no.LogLevel.Error,t),level:no.LogLevel.Error,description:this.getDescription(no.LogLevel.Error,e),buttons:r&&e!==no.LogLevel.Error?[r]:void 0},{label:this.getLabel(no.LogLevel.Off,t),level:no.LogLevel.Off,description:this.getDescription(no.LogLevel.Off,e),buttons:r&&e!==no.LogLevel.Off?[r]:void 0}]}getLabel(e,t){let i=(0,no.LogLevelToLocalizedString)(e).value;return e===t?`$(check) ${i}`:i}getDescription(e,t){return t===e?(0,oi.localize)(8597,"Default"):void 0}};a6=(0,rM.__decorate)([(0,rM.__param)(2,st.IQuickInputService),(0,rM.__param)(3,n_.ILoggerService),(0,rM.__param)(4,a1.IOutputService),(0,rM.__param)(5,aG.IDefaultLogLevelsService)],a6),class extends aZ.Action{static{this.ID="workbench.action.openSessionLogFile"}static{this.TITLE=(0,oi.localize2)(8598,"Open Window Log File (Session)...")}constructor(e,t,i,r,o,n){super(e,t),this.environmentService=i,this.fileService=r,this.quickInputService=o,this.editorService=n}async run(){let e=await this.quickInputService.pick(this.getSessions().then(e=>e.map((e,t)=>({id:e.toString(),label:(0,n9.basename)(e),description:0===t?(0,oi.localize)(8599,"Current"):void 0}))),{canPickMany:!1,placeHolder:(0,oi.localize)(8600,"Select Session")});if(e){let t=await this.quickInputService.pick(this.getLogFiles(rh.URI.parse(e.id)).then(e=>e.map(e=>({id:e.toString(),label:(0,n9.basename)(e)}))),{canPickMany:!1,placeHolder:(0,oi.localize)(8601,"Select Log file")});if(t)return this.editorService.openEditor({resource:rh.URI.parse(t.id),options:{pinned:!0}}).then(()=>void 0)}}async getSessions(){let e=this.environmentService.logsHome.with({scheme:this.environmentService.logFile.scheme}),t=[e],i=await this.fileService.resolve((0,n9.dirname)(e));return i.children&&t.push(...i.children.filter(t=>!(0,n9.isEqual)(t.resource,e)&&t.isDirectory&&/^\d{8}T\d{6}$/.test(t.name)).sort().reverse().map(e=>e.resource)),t}async getLogFiles(e){let t=await this.fileService.resolve(e);return t.children?t.children.filter(e=>!e.isDirectory).map(e=>e.resource):[]}};var a3=rd;(0,aX.registerAction2)(class extends aX.Action2{constructor(){super({id:a6.ID,title:a6.TITLE,category:aY.Categories.Developer,f1:!0})}run(e){let t=e.get(ot.IInstantiationService).createInstance(a6,a6.ID,a6.TITLE.value);return t.run().finally(()=>t.dispose())}}),(0,aX.registerAction2)(class extends aX.Action2{constructor(){super({id:"workbench.action.setDefaultLogLevel",title:(0,oi.localize2)(8586,"Set Default Log Level"),category:aY.Categories.Developer})}run(e,t,i){return e.get(aG.IDefaultLogLevelsService).setDefaultLogLevel(t,i)}});let a4=class extends a3.Disposable{constructor(e,t,i){super(),this.loggerService=e,this.contextKeyService=t,this.uriIdentityService=i,this.contextKeys=new sd.CounterSet,this.outputChannelRegistry=nC.Registry.as(a0.Extensions.OutputChannels);const r=no.CONTEXT_LOG_LEVEL.bindTo(t);r.set((0,no.LogLevelToString)(e.getLogLevel())),this._register(e.onDidChangeLogLevel(t=>{(0,no.isLogLevel)(t)&&r.set((0,no.LogLevelToString)(e.getLogLevel()))})),this.onDidAddLoggers(e.getRegisteredLoggers()),this._register(e.onDidChangeLoggers(({added:e,removed:t})=>{this.onDidAddLoggers(e),this.onDidRemoveLoggers(t)})),this._register(e.onDidChangeVisibility(([t,i])=>{let r=e.getRegisteredLogger(t);r&&(i?this.registerLogChannel(r):this.deregisterLogChannel(r))})),this.registerShowWindowLogAction(),this._register(r7.Event.filter(t.onDidChangeContext,e=>e.affectsSome(this.contextKeys))(()=>this.onDidChangeContext()))}onDidAddLoggers(e){for(let t of e){if(t.when){let e=r3.ContextKeyExpr.deserialize(t.when);if(e){for(let t of e.keys())this.contextKeys.add(t);if(!this.contextKeyService.contextMatchesRules(e))continue}}t.hidden||this.registerLogChannel(t)}}onDidChangeContext(){for(let e of this.loggerService.getRegisteredLoggers())e.when&&(this.contextKeyService.contextMatchesRules(r3.ContextKeyExpr.deserialize(e.when))?this.registerLogChannel(e):this.deregisterLogChannel(e))}onDidRemoveLoggers(e){for(let t of e){if(t.when){let e=r3.ContextKeyExpr.deserialize(t.when);if(e)for(let t of e.keys())this.contextKeys.delete(t)}this.deregisterLogChannel(t)}}registerLogChannel(e){if(e.group)return void this.registerCompoundLogChannel(e.group.id,e.group.name,e);let t=this.outputChannelRegistry.getChannel(e.id);if(t&&(0,a0.isSingleSourceOutputChannelDescriptor)(t)&&this.uriIdentityService.extUri.isEqual(t.source.resource,e.resource))return;let i=this.outputChannelRegistry.getChannel(e.id),r=i&&(0,a0.isSingleSourceOutputChannelDescriptor)(i)&&i.source.resource.scheme===nl.Schemas.vscodeRemote?this.loggerService.getRegisteredLogger(i.source.resource):void 0;r&&this.deregisterLogChannel(r);let o=i&&e.resource.scheme===nl.Schemas.vscodeRemote,n=o?`${e.id}.remote`:e.id,s=o?(0,oi.localize)(8587,"{0} (Remote)",e.name??e.id):e.name??e.id;this.outputChannelRegistry.registerChannel({id:n,label:s,source:{resource:e.resource},log:!0,extensionId:e.extensionId})}registerCompoundLogChannel(e,t,i){let r=this.outputChannelRegistry.getChannel(e),o={resource:i.resource,name:i.name??i.id};r?(0,a0.isMultiSourceOutputChannelDescriptor)(r)&&!r.source.some(({resource:e})=>this.uriIdentityService.extUri.isEqual(e,i.resource))&&this.outputChannelRegistry.updateChannelSources(e,[...r.source,o]):this.outputChannelRegistry.registerChannel({id:e,label:t,log:!0,source:[o]})}deregisterLogChannel(e){if(e.group){let t=this.outputChannelRegistry.getChannel(e.group.id);t&&(0,a0.isMultiSourceOutputChannelDescriptor)(t)&&this.outputChannelRegistry.updateChannelSources(e.group.id,t.source.filter(({resource:t})=>!this.uriIdentityService.extUri.isEqual(t,e.resource)))}else this.outputChannelRegistry.removeChannel(e.id)}registerShowWindowLogAction(){this._register((0,aX.registerAction2)(class extends aX.Action2{constructor(){super({id:az.showWindowLogActionId,title:(0,oi.localize2)(8588,"Show Window Log"),category:aY.Categories.Developer,f1:!0})}async run(e){e.get(a1.IOutputService).showChannel(az.windowLogId)}}))}};a4=(0,rM.__decorate)([(0,rM.__param)(0,n_.ILoggerService),(0,rM.__param)(1,ou.IContextKeyService),(0,rM.__param)(2,nS.IUriIdentityService)],a4),nC.Registry.as(n6.Extensions.Workbench).registerWorkbenchContribution(a4,n3.LifecyclePhase.Restored);let a5=class extends aW{constructor(e,t,i){super(e??(0,no.getLogLevel)(i),aI.logsPath,t)}};a5=(0,rM.__decorate)([(0,rM.__param)(1,nf.IFileService),(0,rM.__param)(2,aj.IEnvironmentService)],a5);let a8=[],a7=class extends aq.LogService{constructor(e,t){super(e.createLogger(t.logFile,{id:az.windowLogId,name:aJ}),a8)}};a7=(0,rM.__decorate)([(0,rM.__param)(0,n_.ILoggerService),(0,rM.__param)(1,sX.IWorkbenchEnvironmentService)],a7);var a9=rd,le=e.i(132485),lt=e.i(445152),li=e.i(935868),lr=e.i(935144),lo=rd,ln=e.i(565280);let ls=class extends lo.Disposable{constructor(e,t,i){super(),this._modelService=e,this._textModelService=t,this._undoRedoService=i,this._register(this._modelService.onModelRemoved(e=>{let t=this._undoRedoService.getElements(e.uri);if(0!==t.past.length||0!==t.future.length){for(let e of t.past)e instanceof ln.MultiModelEditStackElement&&e.setDelegate(this);for(let e of t.future)e instanceof ln.MultiModelEditStackElement&&e.setDelegate(this)}}))}prepareUndoRedo(e){let t=e.getMissingModels();return 0===t.length?lo.Disposable.None:Promise.all(t.map(async e=>{try{return await this._textModelService.createModelReference(e)}catch(e){return lo.Disposable.None}})).then(e=>({dispose:()=>(0,lo.dispose)(e)}))}};ls=(0,rM.__decorate)([(0,rM.__param)(0,rE.IModelService),(0,rM.__param)(1,sE.ITextModelService),(0,rM.__param)(2,lr.IUndoRedoService)],ls);var la=e.i(141103);let ll=class extends a9.ReferenceCollection{constructor(e,t,i,r){super(),this.instantiationService=e,this.textFileService=t,this.fileService=i,this.modelService=r,this.providers=new Map,this.modelsToDispose=new Set}createReferencedObject(e){return this.doCreateReferencedObject(e)}async doCreateReferencedObject(e,t){this.modelsToDispose.delete(e);let i=rh.URI.parse(e);if(i.scheme===nl.Schemas.inMemory){if(!this.modelService.getModel(i))throw Error(`Unable to resolve inMemory resource ${e}`);let t=this.instantiationService.createInstance(le.TextResourceEditorModel,i);if(this.ensureResolvedModel(t,e))return t}if(i.scheme===nl.Schemas.untitled){let t=await this.textFileService.untitled.resolve({untitledResource:i});if(this.ensureResolvedModel(t,e))return t}if(this.fileService.hasProvider(i)){let t=await this.textFileService.files.resolve(i,{reason:lt.TextFileResolveReason.REFERENCE});if(this.ensureResolvedModel(t,e))return t}if(this.providers.has(i.scheme)){await this.resolveTextModelContent(e);let t=this.instantiationService.createInstance(le.TextResourceEditorModel,i);if(this.ensureResolvedModel(t,e))return t}if(!t)return await this.fileService.activateProvider(i.scheme),this.doCreateReferencedObject(e,!0);throw Error(`Unable to resolve resource ${e}`)}ensureResolvedModel(e,t){if(e.textEditorModel)return!0;throw Error(`Unable to resolve resource ${t}`)}destroyReferencedObject(e,t){rh.URI.parse(e).scheme!==nl.Schemas.inMemory&&(this.modelsToDispose.add(e),(async()=>{try{let i=await t;if(!this.modelsToDispose.has(e)||(i instanceof li.TextFileEditorModel?await this.textFileService.files.canDispose(i):i instanceof la.UntitledTextEditorModel&&await this.textFileService.untitled.canDispose(i),!this.modelsToDispose.has(e)))return;i.dispose()}catch(e){}finally{this.modelsToDispose.delete(e)}})())}registerTextModelContentProvider(e,t){let i=this.providers.get(e);return i||(i=[],this.providers.set(e,i)),i.unshift(t),(0,a9.toDisposable)(()=>{let i=this.providers.get(e);if(!i)return;let r=i.indexOf(t);-1!==r&&(i.splice(r,1),0===i.length&&this.providers.delete(e))})}hasTextModelContentProvider(e){return void 0!==this.providers.get(e)}async resolveTextModelContent(e){let t=rh.URI.parse(e);for(let e of this.providers.get(t.scheme)||[]){let i=await e.provideTextContent(t);if(i)return i}throw Error(`Unable to resolve text model content for resource ${e}`)}};ll=(0,rM.__decorate)([(0,rM.__param)(0,ot.IInstantiationService),(0,rM.__param)(1,sw.ITextFileService),(0,rM.__param)(2,nf.IFileService),(0,rM.__param)(3,rE.IModelService)],ll);let lc=class extends a9.Disposable{get resourceModelCollection(){return this._resourceModelCollection||(this._resourceModelCollection=this.instantiationService.createInstance(ll)),this._resourceModelCollection}get asyncModelCollection(){return this._asyncModelCollection||(this._asyncModelCollection=new a9.AsyncReferenceCollection(this.resourceModelCollection)),this._asyncModelCollection}constructor(e,t,i,r,o){super(),this.instantiationService=e,this.fileService=t,this.undoRedoService=i,this.modelService=r,this.uriIdentityService=o,this._resourceModelCollection=void 0,this._asyncModelCollection=void 0,this._register(new ls(this.modelService,this,this.undoRedoService))}async createModelReference(e){return e=this.uriIdentityService.asCanonicalUri(e),await this.asyncModelCollection.acquire(e.toString())}registerTextModelContentProvider(e,t){return this.resourceModelCollection.registerTextModelContentProvider(e,t)}canHandleResource(e){return!!this.fileService.hasProvider(e)||e.scheme===nl.Schemas.untitled||e.scheme===nl.Schemas.inMemory||this.resourceModelCollection.hasTextModelContentProvider(e.scheme)}};lc=(0,rM.__decorate)([(0,rM.__param)(0,ot.IInstantiationService),(0,rM.__param)(1,nf.IFileService),(0,rM.__param)(2,lr.IUndoRedoService),(0,rM.__param)(3,rE.IModelService),(0,rM.__param)(4,nS.IUriIdentityService)],lc);let ld=e=>{if(e instanceof URL)return e.href;{let t=btoa(Array.from(new TextEncoder().encode(e),e=>String.fromCodePoint(e)).join(""));return new URL(`data:text/plain;base64,${t}`).href}},lu=()=>{"u"<typeof MonacoEnvironment&&(globalThis.MonacoEnvironment={});let e=MonacoEnvironment;return void 0===e.vscodeApiInitialising&&(e.vscodeApiInitialising=!1),void 0===e.vscodeApiInitialised&&(e.vscodeApiInitialised=!1),void 0===e.viewServiceType&&(e.viewServiceType="EditorService"),e},lh=(e,t)=>{if(void 0!==t)for(let[i,r]of Object.entries(t))e[i]=r},lg=async(e,t,i,r)=>{r?.info("Received open editor call with parameters: ",e,t,i)};class lp{url;options;constructor(e,t){this.url=e,this.options=t}}let lm=e=>{let t=lu();t.getWorkerUrl=(t,i)=>(e.logger?.info(`getWorkerUrl: workerId: ${t} label: ${i}`),e.workerLoaders?.[i]?.().url.toString()),t.getWorkerOptions=(t,i)=>(e.logger?.info(`getWorkerOptions: moduleId: ${t} label: ${i}`),e.workerLoaders?.[i]?.().options)},lf=t=>{lm({workerLoaders:{editorWorkerService:()=>new lp(new e.U(e.r(310336)),{type:"module"}),extensionHostWorkerMain:()=>new lp(new e.U(e.r(969663)),{type:"module"}),TextMateWorker:()=>new lp(new e.U(e.r(859546)),{type:"module"}),OutputLinkDetectionWorker:void 0,LanguageDetectionWorker:void 0,NotebookEditorWorker:void 0,LocalFileSearchWorker:void 0},logger:t})};var lv=e.i(663544);e.i(610504);class l_{logger=new no.ConsoleLogger;extensionRegisterResults=new Map;disposableStore=new rd.DisposableStore;apiConfig;constructor(e){this.apiConfig={...e,serviceOverrides:e.serviceOverrides??{},logLevel:e.logLevel??no.LogLevel.Off},this.logger.setLevel(this.apiConfig.logLevel)}getExtensionRegisterResult(e){return this.extensionRegisterResults.get(e)}getMonacoVscodeApiConfig(){return this.apiConfig}configureMonacoWorkers(){"function"==typeof this.apiConfig.monacoWorkerFactory?this.apiConfig.monacoWorkerFactory(this.logger):lm({logger:this.logger})}performErrorHandling=e=>{throw lu().vscodeApiInitialising=!1,Error(e)};async configureHighlightingServices(){if("extended"===this.apiConfig.$type){let t=(await e.A(940730)).default,i=(await e.A(509433)).default,r=(await e.A(545594)).default;lh(this.apiConfig.serviceOverrides,{...r(),...t(),...i()})}else{let t=(await e.A(963197)).default;lh(this.apiConfig.serviceOverrides,{...t()})}}async configureViewsServices(){let t=this.apiConfig.viewsConfig.$type;("ViewsService"===t||"WorkbenchService"===t)&&("classic"===this.apiConfig.$type&&this.performErrorHandling(`View Service Type "${t}" cannot be used with classic configuration.`),void 0===this.apiConfig.viewsConfig.htmlContainer&&this.performErrorHandling(`View Service Type "${t}" requires a HTMLElement.`));let i=lu();if("ViewsService"===t){let t=(await e.A(974099)).default;lh(this.apiConfig.serviceOverrides,{...t(this.apiConfig.viewsConfig.openEditorFunc??lg)}),i.viewServiceType="ViewsService"}else if("WorkbenchService"===t){let t=(await e.A(924017)).default;lh(this.apiConfig.serviceOverrides,{...t()}),i.viewServiceType="WorkbenchService"}else{let t=(await e.A(872082)).default;lh(this.apiConfig.serviceOverrides,{...t(this.apiConfig.viewsConfig.openEditorFunc??lg)}),i.viewServiceType="EditorService"}}async applyViewsPostConfig(){let e=this.apiConfig.viewsConfig.$type;("ViewsService"===e||"WorkbenchService"===e)&&(this.apiConfig.viewsConfig.htmlAugmentationInstructions?.(this.apiConfig.viewsConfig.htmlContainer),await this.apiConfig.viewsConfig.viewsInitFunc?.())}configureWorkspaceConfig(){void 0===this.apiConfig.workspaceConfig&&(this.apiConfig.workspaceConfig={workspaceProvider:{trusted:!0,workspace:{workspaceUri:lv.Uri.file("/workspace.code-workspace")},open:async()=>(window.open(window.location.href),!0)}})}configureDevLogLevel(){let e=this.apiConfig.workspaceConfig?.developmentOptions?.logLevel;if(void 0===e){let e={...this.apiConfig.workspaceConfig.developmentOptions};e.logLevel=this.apiConfig.logLevel,this.apiConfig.workspaceConfig.developmentOptions=Object.assign({},e)}else e!==this.apiConfig.logLevel?this.performErrorHandling(`You have configured mismatching logLevels: ${this.apiConfig.logLevel} (wrapperConfig) ${e} (workspaceConfig.developmentOptions)`):this.logger.debug("Development log level and api log level are in aligned.")}configureSemanticHighlighting(){if(this.apiConfig.advanced?.enforceSemanticHighlighting===!0){let e={...this.apiConfig.workspaceConfig.configurationDefaults??{}};e["editor.semanticHighlighting.enabled"]=!0,this.apiConfig.workspaceConfig.configurationDefaults=Object.assign({},e)}}async initUserConfiguration(){this.apiConfig.userConfiguration?.json!==void 0&&await aM(this.apiConfig.userConfiguration.json)}async supplyRequiredServices(){return{...(i=void 0,{...(0,aT.default)(),[rW.IConfigurationService.toString()]:new nv.SyncDescriptor(aO,[],!0),[nw.IWorkspaceContextService.toString()]:new nv.SyncDescriptor(aO,[],!0),[nd.ITextResourceConfigurationService.toString()]:new nv.SyncDescriptor(np,[],!0),[af.IWorkspaceEditingService.toString()]:new nv.SyncDescriptor(aF,[],!0),[nx.IWorkspacesService.toString()]:new nv.SyncDescriptor(am,[],!0),[nd.ITextResourcePropertiesService.toString()]:new nv.SyncDescriptor(as,[],!0),[ak.IConfigurationResolverService.toString()]:new nv.SyncDescriptor(aE,[],!0)}),...{...(0,aQ.default)(),[n_.ILoggerService.toString()]:new nv.SyncDescriptor(a5,[void 0],!0),[n_.ILogService.toString()]:new nv.SyncDescriptor(a7,[],!0),[aG.IDefaultLogLevelsService.toString()]:new nv.SyncDescriptor(aB,[],!0)},...{[sE.ITextModelService.toString()]:new nv.SyncDescriptor(lc,[],!0)}}}checkServiceConsistency(){let e=this.apiConfig.serviceOverrides,t=Object.keys(e).includes("themeService"),i=Object.keys(e).includes("textMateTokenizationFeature"),r=Object.keys(e).includes("markersService"),o=Object.keys(e).includes("viewsService");t&&!i&&this.performErrorHandling('"theme" service requires "textmate" service. Please add it to the "userServices".'),r&&!o&&this.performErrorHandling('"markers" service requires "views" service. Please add it to the "userServices".')}async initAllServices(t){let i=await this.supplyRequiredServices();if(lh(i,this.apiConfig.serviceOverrides),this.apiConfig.advanced?.loadExtensionServices===void 0||!0===this.apiConfig.advanced.loadExtensionServices){let{default:t}=await e.A(473446);lh(i,{...t({enableWorkerExtensionHost:this.apiConfig.advanced?.enableExtHostWorker===!0})})}var r=this.logger;for(let e of Object.keys(i))r?.debug(`Loading service: ${e}`);(t??!0)&&this.checkServiceConsistency(),"ViewsService"===this.apiConfig.viewsConfig.$type||"WorkbenchService"===this.apiConfig.viewsConfig.$type?await (0,rn.initialize)(i,this.apiConfig.viewsConfig.htmlContainer,this.apiConfig.workspaceConfig,this.apiConfig.envOptions):await (0,rn.initialize)(i,void 0,this.apiConfig.workspaceConfig,this.apiConfig.envOptions),(0,oE.setUnexpectedErrorHandler)(e=>{this.logger.getLevel()!==no.LogLevel.Off&&this.logger.error("Unexpected error",e)})}async initExtensions(){"extended"===this.apiConfig.$type&&(this.apiConfig.advanced?.loadThemes===void 0||!0===this.apiConfig.advanced.loadThemes)&&await e.A(876468);let t=this.apiConfig.extensions;if(this.apiConfig.extensions){let e=[],i=[];for(let r of((0,nn.getBuiltinExtensions)().forEach(e=>{i.push(e.identifier.id)}),t??[]))i.includes(`${r.config.publisher}.${r.config.name}`)||e.push(this.initExtension(r,i));await Promise.all(e)}}initExtension(e,t){if(t.includes(`${e.config.publisher}.${e.config.name}`))return Promise.resolve();{let t=e.config,i=(0,nn.registerExtension)(t,ns.ExtensionHostKind.LocalProcess);if(this.extensionRegisterResults.set(t.name,i),e.filesOrContents&&Object.hasOwn(i,"registerFileUrl"))for(let t of e.filesOrContents)this.disposableStore.add(i.registerFileUrl(t[0],ld(t[1])));return i.whenReady()}}markGlobalInit(){this.logger.debug("markGlobalInit");let e=lu();e.vscodeApiGlobalInitAwait=new Promise(t=>{e.vscodeApiGlobalInitResolve=t})}markGlobalInitDone(){let e=lu();e.vscodeApiGlobalInitResolve?.(),e.vscodeApiInitialised=!0,e.vscodeApiGlobalInitAwait=void 0,e.vscodeApiGlobalInitResolve=void 0,this.logger.debug("markGlobalInitDone")}async start(e){let t=lu();!0===t.vscodeApiInitialised?this.logger.warn("Initialization of monaco-vscode api can only performed once!"):!0!==t.vscodeApiInitialising?(t.vscodeApiInitialising=!0,this.markGlobalInit(),this.configureWorkspaceConfig(),this.configureDevLogLevel(),this.logger.info(`Initializing monaco-vscode api. Caller: ${e?.caller??"unknown"}`),await this.configureMonacoWorkers(),await this.configureHighlightingServices(),await this.configureViewsServices(),this.configureSemanticHighlighting(),await this.initUserConfiguration(),await this.initAllServices(e?.performServiceConsistencyChecks),await this.applyViewsPostConfig(),await this.initExtensions(),this.markGlobalInitDone(),this.logger.debug("Initialization of monaco-vscode api completed successfully.")):this.logger.debug("Initialization of monaco-vscode api is already ongoing.")}dispose(){this.extensionRegisterResults.forEach(e=>e.dispose()),this.disposableStore.dispose(),this.disposableStore=new rd.DisposableStore}}var ly=e.i(269213),lC=ly;class lS extends lC.AbstractMessageReader{socket;state="initial";callback;events=[];constructor(e){super(),this.socket=e,this.socket.onMessage(e=>this.readMessage(e)),this.socket.onError(e=>this.fireError(e)),this.socket.onClose((e,t)=>{if(1e3!==e){let i={name:""+e,message:`Error during socket reconnect: code = ${e}, reason = ${t}`};this.fireError(i)}this.fireClose()})}listen(e){if("initial"===this.state)for(this.state="listening",this.callback=e;0!==this.events.length;){let e=this.events.pop();void 0!==e.message?this.readMessage(e.message):void 0!==e.error?this.fireError(e.error):this.fireClose()}return{dispose:()=>{this.callback===e&&(this.state="initial",this.callback=void 0)}}}dispose(){super.dispose(),this.state="initial",this.callback=void 0,this.events.splice(0,this.events.length)}readMessage(e){if("initial"===this.state)this.events.splice(0,0,{message:e});else if("listening"===this.state)try{let t=JSON.parse(e);this.callback(t)}catch(t){let e={name:"400",message:`Error during message parsing, reason = ${"object"==typeof t?t.message:"unknown"}`};this.fireError(e)}}fireError(e){"initial"===this.state?this.events.splice(0,0,{error:e}):"listening"===this.state&&super.fireError(e)}fireClose(){"initial"===this.state?this.events.splice(0,0,{}):"listening"===this.state&&super.fireClose(),this.state="closed"}}var lb=ly;class lw extends lb.AbstractMessageWriter{errorCount=0;socket;constructor(e){super(),this.socket=e}end(){}async write(e){try{let t=JSON.stringify(e);this.socket.send(t)}catch(t){this.errorCount++,this.fireError(t,e,this.errorCount)}}}var lx=e.i(437122),lD=e.i(523592);let lE=new Map,lk=null;function lT(e,t){let i,r;if(lE.has(e))return;let o=new WebSocket(((i=new URL("/ws/lsp/typescript",(0,lD.getActiveServerUrl)()??window.location.origin)).protocol="https:"===i.protocol?"wss:":"ws:",i.searchParams.set("workspaceId",e),(r=(0,lx.getToken)())&&i.searchParams.set("token",r),i.toString()));o.onopen=async()=>{console.info("[monaco-language-client] TypeScript websocket opened",{workspaceId:e,workspaceRoot:t}),await (lk||(lk=new l_({$type:"classic",viewsConfig:{$type:"EditorService"},userConfiguration:{json:JSON.stringify({"editor.wordBasedSuggestions":"off","typescript.tsserver.useSyntaxServer":"auto"})},monacoWorkerFactory:lf}).start({caller:"agent-spaces-monaco-language-client"})));let i={send:e=>o.send(e),onMessage:e=>{o.onmessage=t=>e(t.data)},onError:e=>{o.onerror=t=>{Object.hasOwn(t,"message")&&e(t.message)}},onClose:e=>{o.onclose=t=>e(t.code,t.reason)},dispose:()=>o.close()},r={reader:new lS(i),writer:new lw(i)},n=new ro({id:`typescript-${e}`,name:"TypeScript Language Server",clientOptions:{documentSelector:[{language:"typescript",scheme:"file"},{language:"javascript",scheme:"file"}],workspaceFolder:{index:0,name:e,uri:t?lv.Uri.file(t):lv.Uri.parse(`file:///workspace/${e}`)},errorHandler:{error:()=>({action:rr.ErrorAction.Continue}),closed:()=>({action:rr.CloseAction.DoNotRestart})}},messageTransports:r});lE.set(e,n),n.start().catch(t=>{console.warn("[monaco-language-client] failed to start TypeScript client:",t),lE.delete(e),o.close()})},o.onerror=()=>{console.warn("[monaco-language-client] TypeScript language server websocket failed")},o.onclose=()=>{let t=lE.get(e);lE.delete(e),t?.stop()}}function lR(e){return e.replace(/\\/g,"/").replace(/^\/?([a-zA-Z]):\//,(e,t)=>e.replace(t,t.toLowerCase())).replace(/\/+$/,"")}function lP(e){try{return decodeURIComponent(e)}catch{return e}}function lI(e,t,i,r){if(!e)return null;let o=lR(i||r||""),n=lR(e.path),s=lR(lP(e.path));for(let e of/^[a-zA-Z]:\//.test(o)?[o,`/${o}`]:[o]){if(e&&s.startsWith(`${e}/`))return s.slice(e.length+1);if(e&&n.startsWith(`${e}/`))return lP(n.slice(e.length+1))}if(!n)return null;let a=`/workspace/${t}/`;if(n.startsWith(a))return decodeURIComponent(n.slice(a.length));let l=`/${t}/`;return n.startsWith(l)?decodeURIComponent(n.slice(l.length)):null}let lA=["",".tsx",".ts",".jsx",".js",".mjs",".cjs",".json"],lM=["index.tsx","index.ts","index.jsx","index.js","index.mjs","index.cjs","index.json"];async function lL(e,t){try{let i=await fetch(`/api/workspaces/${e}/files/exists?path=${encodeURIComponent(t)}`);return!!(await i.json()).exists}catch{return!1}}async function lF(e,t){for(let i of lA){let r=`${t}${i}`;if(await lL(e,r))return r}for(let i of lM){let r=`${t}/${i}`;if(await lL(e,r))return r}return null}async function lO(e,t,i){if(!i.startsWith(".")&&!i.startsWith("@/"))return null;let r=t.split("/").slice(0,-1).join("/"),o=t.split("/").lastIndexOf("src"),n=o>=0?t.split("/").slice(0,o+1).join("/"):"src",s=function(e){let t=[];for(let i of e.split("/"))if(i&&"."!==i)if(".."===i){if(0===t.length)return null;t.pop()}else t.push(i);return t.join("/")}(i.startsWith("@/")?`${n}/${i.slice(2)}`:`${r}/${i}`);return s?lF(e,s):null}async function lN(e,t){try{let i=await fetch(`/api/workspaces/${e}/files/content?path=${encodeURIComponent(t)}`);if(!i.ok)return null;let r=await i.json();return"string"==typeof r.content?r.content:null}catch{return null}}function l$(e){let t=e.split(".").pop()?.toLowerCase(),i=e.split("/").pop()?.toLowerCase()||"";return"dockerfile"===i||i.startsWith("dockerfile.")?"dockerfile":"makefile"===i||"gnumakefile"===i?"makefile":"cmakelists.txt"===i||i.endsWith(".cmake")?"cmake":".gitignore"===i||".dockerignore"===i||".eslintignore"===i?"plaintext":({ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",json:"json",jsonc:"json",css:"css",scss:"scss",less:"less",html:"html",htm:"html",vue:"html",svg:"xml",xml:"xml",yaml:"yaml",yml:"yaml",toml:"ini",ini:"ini",env:"ini",py:"python",pyw:"python",rb:"ruby",pl:"perl",pm:"perl",php:"php",lua:"lua",sh:"shell",bash:"shell",zsh:"shell",fish:"shell",ps1:"powershell",psm1:"powershell",bat:"bat",cmd:"bat",rs:"rust",go:"go",c:"c",h:"c",cpp:"cpp",cc:"cpp",cxx:"cpp",hpp:"cpp",hh:"cpp",hxx:"cpp",cs:"csharp",java:"java",kt:"kotlin",kts:"kotlin",swift:"swift",dart:"dart",scala:"scala",hs:"haskell",lhs:"haskell",ex:"elixir",exs:"elixir",erl:"erlang",clj:"clojure",cljs:"clojure",groovy:"groovy",gradle:"groovy",md:"markdown",mdx:"markdown",tex:"latex",sql:"sql",graphql:"graphql",gql:"graphql",dockerfile:"dockerfile",r:"r",d:"d",zig:"zig"})[t||""]||"plaintext"}function lH(e){let t=e?.getDomNode(),i=document.activeElement;t&&i instanceof HTMLElement&&t.contains(i)&&i.blur()}function lU(e){let t=e?.getModel(),i=e?.getSelection();if(!t||!i||i.isEmpty()||i.startLineNumber!==i.endLineNumber)return!1;let r=t.getValueInRange(i);if(!r||/\s/.test(r))return!1;let o=t.getWordAtPosition({lineNumber:i.startLineNumber,column:i.startColumn});return!!o&&o.word===r&&i.startColumn===o.startColumn&&i.endColumn===o.endColumn}function lW(e){let t=e?.getModel(),i=e?.getSelection(),r=e?.getDomNode();if(!e||!t||!i||!r||!lU(e))return null;let o=e.getScrolledVisiblePosition({lineNumber:i.endLineNumber,column:i.endColumn}),n=r.getBoundingClientRect(),s=t.getValueInRange(i);return{x:o?n.left+o.left:n.left+n.width/2,y:o?n.top+o.top+o.height:n.top+n.height/2,selectedText:s,canNavigate:!0}}function lq(e){let t=e?.getPosition();e&&t&&e.setSelections([{selectionStartLineNumber:t.lineNumber,selectionStartColumn:t.column,positionLineNumber:t.lineNumber,positionColumn:t.column}],"agentSpaces.mobileContextMenu")}function lj({activeContent:e,wordWrap:t,mobileSelectionMode:i,mobileReadonlyMenu:r,mobileSelectionPreMetrics:o,mobileSelectionPreRef:n,mobileReadonlyMenuRef:s,onContextMenu:a,onEnterSelectionMode:l,onCloseSelectionMode:c,onCopySelection:d,onRunEditorAction:u,onRunBuiltinAction:h}){return(0,U.jsxs)(U.Fragment,{children:[i?(0,U.jsx)("pre",{ref:n,className:"absolute inset-0 z-20 m-0 overflow-auto bg-background py-2 text-foreground select-text",style:{paddingLeft:o?.contentLeft??0,paddingRight:o?.contentRight??0,fontFamily:o?.fontFamily,fontWeight:o?.fontWeight,fontSize:o?.fontSize,lineHeight:o?`${o.lineHeight}px`:void 0,letterSpacing:o?.letterSpacing,fontFeatureSettings:o?.fontFeatureSettings,fontVariationSettings:o?.fontVariationSettings,whiteSpace:t?"pre-wrap":"pre",overflowWrap:t?"anywhere":"normal"},onContextMenu:a,children:e}):null,r?(0,U.jsxs)("div",{ref:s,className:"fixed z-[80] min-w-40 select-none rounded-md border bg-popover p-1 text-popover-foreground shadow-md",style:{left:Math.min(Math.max(8,r.x),window.innerWidth-168),top:Math.min(Math.max(8,r.y),window.innerHeight-180)},onPointerDown:e=>e.stopPropagation(),children:[i?null:(0,U.jsx)("button",{type:"button",className:"flex w-full items-center rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent cursor-pointer",onClick:l,children:"选择模式"}),(0,U.jsx)("button",{type:"button",className:"flex w-full items-center rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent cursor-pointer",onClick:d,children:"复制代码"}),r.canNavigate?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("button",{type:"button",className:"flex w-full items-center rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent cursor-pointer",onClick:()=>u("editor.action.revealDefinition"),children:"Go to Definition"}),(0,U.jsx)("button",{type:"button",className:"flex w-full items-center rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent cursor-pointer",onClick:()=>u("editor.action.goToReferences"),children:"Go to References"})]}):null,B.map(e=>(0,U.jsx)("button",{type:"button",className:"flex w-full items-center rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent cursor-pointer",onClick:()=>h(e.id),children:e.label},e.id)),i?(0,U.jsx)("button",{type:"button",className:"flex w-full items-center rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent cursor-pointer",onClick:c,children:"完成"}):null]}):null]})}var lz=e.i(555060);function lK(){let e=(0,es.useTranslations)("editor");return(0,U.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:e("loadingEditor")})}let lV=(0,W.default)(()=>e.A(863812).then(e=>e.default),{loadableGenerated:{modules:[158480]},ssr:!1,loading:()=>(0,U.jsx)(lK,{})}),lB=!1;e.s(["CodeEditor",0,function({workspaceId:e}){lB||(lB=!0,window.addEventListener("unhandledrejection",e=>{(e.reason?.name==="Canceled"||"Canceled"===String(e.reason))&&e.preventDefault()}));let{openFiles:t,modifiedFileContents:i,activeFilePath:r,updateContent:o,saveFile:n,refreshFile:s,jumpToPosition:a,pendingJump:l,clearPendingJump:c,commitDiffs:d}=(0,Q.useEditorStore)(),{resolvedTheme:u}=(0,ep.useTheme)(),h=(0,es.useTranslations)("editor"),g=(0,G.useIsMobile)(),p=(0,ei.useWorkspaceStore)(t=>t.workspaces.find(t=>t.id===e)?.boundDirs?.[0]),m=(0,q.useRef)(null),f=(0,q.useRef)(null),_=(0,q.useRef)([]),y=(0,q.useRef)([]),C=(0,q.useRef)([]),S=(0,q.useRef)(null),[b,w]=(0,q.useState)(!0),[x,D]=(0,q.useState)(!1),[E,k]=(0,q.useState)(()=>"true"===localStorage.getItem("editor-word-wrap")),[T,R]=(0,q.useState)(()=>"true"===localStorage.getItem("editor-minimap")),[P,I]=(0,q.useState)(()=>{let e=localStorage.getItem("editor-font-size");return e?parseInt(e,10):13}),[A,M]=(0,q.useState)(0),[L,F]=(0,q.useState)(0),[O,N]=(0,q.useState)(!0),$=t.find(e=>e.path===r),H=$?i[$.path]??$.content:"",W=!!r&&(0,Q.isCommitDiffPath)(r),z=W&&r?d[(0,Q.getCommitHashFromPath)(r)]:null,J=$?.mediaType??(r?(0,Q.getMediaType)(r):null),Y="image"===J||"video"===J||"audio"===J||"svg"===J||"markdown"===J,X="svg"===J||"markdown"===J,Z=r&&J?`/api/workspaces/${e}/files/content?path=${encodeURIComponent(r)}&raw=true`:null;(0,q.useEffect)(()=>{N(!0)},[r]);let ee=function({editorRef:e,monacoRef:t,activeContent:i,workspaceId:r,workspaceRoot:o,isMobile:n,isReadOnly:s,isCommitDiff:a,hasActiveFile:l,editorReadyTick:c,wordWrap:d}){let u=(0,q.useRef)(null),h=(0,q.useRef)(null),g=(0,q.useRef)(null),p=(0,q.useRef)(null),m=(0,q.useRef)(null),f=(0,q.useRef)(!1),_=(0,q.useRef)(!1),y=(0,q.useRef)(!1),[C,S]=(0,q.useState)(!1),[b,w]=(0,q.useState)(null),[x,D]=(0,q.useState)(null),E=n&&s&&!a&&l,k=(0,q.useCallback)(()=>{null!=p.current&&(window.clearTimeout(p.current),p.current=null),null!=m.current&&(window.clearTimeout(m.current),m.current=null),S(!1),w(null),D(null),window.getSelection()?.removeAllRanges()},[]),T=(0,q.useCallback)(()=>{let e=g.current;e&&(window.clearTimeout(e.timer),g.current=null)},[]),R=(0,q.useCallback)(()=>{null!=p.current&&(window.clearTimeout(p.current),p.current=null)},[]),P=(0,q.useCallback)(()=>{null!=m.current&&(window.clearTimeout(m.current),m.current=null)},[]),I=(0,q.useCallback)(t=>{E&&!C&&(t.preventDefault(),t.stopPropagation(),lH(e.current),w({x:t.clientX,y:t.clientY,selectedText:"",canNavigate:lU(e.current)}))},[e,C,E]),A=(0,q.useCallback)(()=>{f.current||E&&!C&&lH(e.current)},[e,C,E]),M=(0,q.useCallback)(t=>{if(!E||C||"mouse"===t.pointerType||h.current?.contains(t.target))return;let i=e.current,r=i?.getTargetAtClientPoint(t.clientX,t.clientY),o=i?.getSelection();if(o&&r?.position&&!o.isEmpty()&&o.containsPosition(r.position)){t.preventDefault(),t.stopPropagation();let e=lW(i);e&&w(e);return}w(null),T();let n=t.clientX,s=t.clientY;g.current={x:n,y:s,timer:window.setTimeout(()=>{lH(e.current),w({x:n,y:s,selectedText:"",canNavigate:lU(i)}),g.current=null},520)}},[T,e,C,E]),L=(0,q.useCallback)(e=>{!E||h.current?.contains(e.target)||(w(null),M(e))},[M,E]),F=(0,q.useCallback)(e=>{let t=g.current;!t||Math.hypot(e.clientX-t.x,e.clientY-t.y)>10&&T()},[T]),O=(0,q.useCallback)(()=>{T()},[T]),N=(0,q.useCallback)(t=>{if(!C)return;let i=window.getSelection(),r=i?.toString()??"";if(!r)return void w(null);let o=u.current,n=i?.rangeCount?i.getRangeAt(0):null;if(o&&n&&o.contains(n.commonAncestorContainer)){let t=document.createRange();t.selectNodeContents(o),t.setEnd(n.startContainer,n.startOffset);let i=document.createRange();i.selectNodeContents(o),i.setEnd(n.endContainer,n.endOffset);let r=t.toString().length,s=i.toString().length,a=e.current?.getModel();if(a){let t=a.getPositionAt(r),i=a.getPositionAt(s);e.current?.setSelection({startLineNumber:t.lineNumber,startColumn:t.column,endLineNumber:i.lineNumber,endColumn:i.column})}}if(!t)return;let s=n?.getBoundingClientRect();w({x:s?s.left+s.width/2:window.innerWidth/2,y:s?s.bottom:window.innerHeight/2,selectedText:r,canNavigate:lU(e.current)})},[e,C]),$=(0,q.useCallback)(()=>{R(),w(null),p.current=window.setTimeout(()=>{p.current=null,N(!0)},1400)},[R,N]),H=(0,q.useCallback)(e=>{C&&(e.preventDefault(),e.stopPropagation(),$())},[C,$]),U=(0,q.useCallback)(()=>{let i=e.current;if(i&&t.current){let e=i.getLayoutInfo(),r=i.getOption(t.current.editor.EditorOption.fontInfo);D({scrollLeft:i.getScrollLeft(),scrollTop:i.getScrollTop(),contentLeft:e.contentLeft,contentRight:Math.max(0,e.width-e.contentLeft-e.contentWidth),fontFamily:r.fontFamily,fontWeight:r.fontWeight,fontSize:r.fontSize,lineHeight:r.lineHeight,letterSpacing:r.letterSpacing,fontFeatureSettings:r.fontFeatureSettings,fontVariationSettings:r.fontVariationSettings})}else D(null);S(!0),w(null)},[e,t]),W=(0,q.useCallback)(async()=>{let e=b?.selectedText||i;e&&(await navigator.clipboard.writeText(e),V.toast.success(b?.selectedText?"已复制选中文本":"已复制代码"),k())},[i,k,b]),j=(0,q.useCallback)(t=>{let i=e.current,n=B.find(e=>e.id===t);i&&n&&(n.run(i,{workspaceId:r,workspaceRoot:o}),k())},[k,e,r,o]),z=(0,q.useCallback)(t=>{let i=e.current;if(!i)return;let r=i.getSelection(),o=r?.getStartPosition()??i.getPosition();w(null),P(),_.current=!0,y.current=!0,f.current=!0,o&&(i.setSelections([{selectionStartLineNumber:o.lineNumber,selectionStartColumn:o.column,positionLineNumber:o.lineNumber,positionColumn:o.column}],"agentSpaces.mobileContextMenu"),i.setPosition(o)),i.focus(),requestAnimationFrame(()=>{for(let r of(i.trigger("agentSpaces.mobileContextMenu",t,void 0),[250,700,1200]))window.setTimeout(()=>{lq(e.current),w(null)},r);window.setTimeout(()=>{lq(e.current),w(null),f.current=!1,_.current=!1,y.current=!1,lH(e.current)},1600)})},[P,e]);return(0,q.useEffect)(()=>{E||(k(),T())},[T,k,E]),(0,q.useEffect)(()=>{if(!C)return;let e=()=>{window.setTimeout(()=>{N(!1),$()},0)};return document.addEventListener("selectionchange",e),()=>document.removeEventListener("selectionchange",e)},[C,$,N]),(0,q.useEffect)(()=>{if(!C)return;let e=u.current;e&&x&&(e.scrollLeft=x.scrollLeft,e.scrollTop=x.scrollTop)},[C,x]),(0,q.useEffect)(()=>{let t=e.current;if(!t||!E||C)return void P();let i=t.onDidChangeCursorSelection(()=>{(P(),_.current)?w(null):lU(t)?m.current=window.setTimeout(()=>{m.current=null;let e=lW(t);e&&w(e)},500):w(e=>e?.canNavigate?null:e)});return()=>{i.dispose(),P()}},[P,c,e,C,E]),{showMobileReadonlyOverlay:E,mobileSelectionMode:C,mobileReadonlyMenu:b,mobileSelectionPreMetrics:x,mobileSelectionPreRef:u,mobileReadonlyMenuRef:h,pendingNavigationSelectionCleanup:y,containerProps:{onContextMenuCapture:I,onFocusCapture:A,onPointerDownCapture:L,onPointerMoveCapture:F,onPointerUpCapture:O,onPointerCancelCapture:O},enterMobileSelectionMode:U,closeMobileSelectionMode:k,copyMobileSelection:W,runMobileEditorAction:z,runMobileBuiltinAction:j,handleMobileSelectionContextMenu:H}}({editorRef:m,monacoRef:f,activeContent:H,workspaceId:e,workspaceRoot:p,isMobile:g,isReadOnly:b,isCommitDiff:W,hasActiveFile:!!$,editorReadyTick:A,wordWrap:E}),et=(0,q.useCallback)(()=>{r&&n(e,r)},[r,n,e]),er=(0,q.useRef)(et);(0,q.useEffect)(()=>{er.current=et},[et]);let eo=(0,q.useCallback)((e,t)=>{e.updateOptions({readOnly:t})},[]),en=(0,q.useCallback)((t,i)=>{!function(e,t,i,r){for(let e of i)e.dispose();i.length=0;let{activeFilePath:o,workspaceId:n,workspaceRoot:s,jumpToPosition:a}=r;i.push(e.onContextMenu(t=>{let i=t.target.position;if(!i)return;let r=e.getSelection();r&&!r.isEmpty()&&r.containsPosition(i)||e.setPosition(i),console.info("[monaco-navigation] context menu position",{uri:e.getModel()?.uri.toString(),lineNumber:i.lineNumber,column:i.column,word:e.getModel()?.getWordAtPosition(i)?.word})}),t.editor.registerEditorOpener({openCodeEditor:async(e,t,i)=>{let r=function(e,t){if(!e||"file"!==e.scheme||!t)return null;let i=`/${t}`;return e.path.endsWith(i)?decodeURIComponent(e.path.slice(0,-i.length)):null}(e.getModel()?.uri,o??null),l=lI(t,n,s,r);if(!l)return console.warn("[monaco-navigation] failed to map target uri",{uri:t.toString(),workspaceRoot:s,inferredRoot:r,activeFilePath:o}),!1;let c=lI(e.getModel()?.uri,n,s,r),d=i&&"lineNumber"in i?i.lineNumber:i?.startLineNumber,u=i&&"column"in i?i.column:i?.startColumn;if(console.info("[monaco-navigation] open target",{uri:t.toString(),targetPath:l,sourcePath:c,line:d,column:u}),c===l&&d){let t,i=e.getModel(),r=i?(t=i.getLineContent(d).match(/\bfrom\s+['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)|require\s*\(\s*['"]([^'"]+)['"]\s*\)|^\s*import\s+['"]([^'"]+)['"]/),t?.[1]||t?.[2]||t?.[3]||t?.[4]||null):null,o=r?await lO(n,c,r):null;if(o&&o!==c){let t=i?.getWordAtPosition(e.getPosition()??{lineNumber:d,column:u||1})?.word,s=t?await lN(n,o):null,l=s&&t?function(e,t){let i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=[RegExp(`\\bexport\\s+default\\s+function\\s+(${i})\\b`),RegExp(`\\bexport\\s+function\\s+(${i})\\b`),RegExp(`\\bexport\\s+(?:const|let|var|class)\\s+(${i})\\b`),RegExp(`\\bfunction\\s+(${i})\\b`),RegExp(`\\b(?:const|let|var|class)\\s+(${i})\\b`),RegExp(`\\bexport\\s+default\\s+(${i})\\b`)],o=e.split(/\r?\n/);for(let e=0;e<o.length;e+=1){let i=o[e];for(let o of r){let r=o.exec(i);if(!r||null==r.index)continue;let n=r[1]?i.indexOf(r[1],r.index):r.index;if(!(n<0))return{line:e+1,column:n+1,endColumn:n+t.length+1}}}return null}(s,t):null;return console.info("[monaco-navigation] resolved import target",{specifier:r,sourcePath:c,resolvedPath:o,symbolName:t,symbolPosition:l}),window.setTimeout(()=>{a(n,o,l?.line??1,l?.column??1,l?.line,l?.endColumn).then(()=>{console.info("[monaco-navigation] jumped to resolved import target",{resolvedPath:o})})},0),!0}}return d?c===l?(e.setPosition({lineNumber:d,column:u||1}),e.revealLineInCenter(d)):window.setTimeout(()=>{a(n,l,d,u)},0):await Q.useEditorStore.getState().openFile(n,l),!0}}),e.addAction({id:"agentSpaces.showDefinition",label:"Show Definition",contextMenuGroupId:"navigation",contextMenuOrder:1.11,run:e=>e.getAction("editor.action.peekDefinition")?.run()}),e.addAction({id:"agentSpaces.showReferences",label:"Show References",contextMenuGroupId:"navigation",contextMenuOrder:1.46,run:e=>e.getAction("editor.action.referenceSearch.trigger")?.run()}),e.addAction({id:"agentSpaces.find",label:"Find",keybindings:[t.KeyMod.CtrlCmd|t.KeyCode.KeyF],run:e=>e.getAction("actions.find")?.run()}),e.addAction({id:"agentSpaces.replace",label:"Replace",keybindings:[t.KeyMod.CtrlCmd|t.KeyCode.KeyH],run:e=>e.getAction("editor.action.startFindReplaceAction")?.run()}),e.addAction({id:"agentSpaces.findInFiles",label:"Find in Files",keybindings:[t.KeyMod.CtrlCmd|t.KeyMod.Shift|t.KeyCode.KeyF],run:()=>{Q.useEditorStore.getState().setRevealPath("__search_panel__")}}),e.addAction({id:"agentSpaces.goToLine",label:"Go to Line...",keybindings:[t.KeyMod.CtrlCmd|t.KeyCode.KeyG],run:e=>e.getAction("editor.action.gotoLine")?.run()}),e.addAction({id:"agentSpaces.formatDocument",label:"Format Document",keybindings:[t.KeyMod.CtrlCmd|t.KeyMod.Shift|t.KeyCode.KeyI],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:e=>e.getAction("editor.action.formatDocument")?.run()}))}(t,i,_.current,{activeFilePath:r,workspaceId:e,workspaceRoot:p,jumpToPosition:a})},[r,a,e,p]),ea=(0,q.useCallback)(e=>{S.current?.();let t=e.getDomNode();if(!t)return;let i=e=>{(e.ctrlKey||e.metaKey)&&(e.preventDefault(),e.stopPropagation(),I(t=>{let i=Math.min(Math.max(t+(e.deltaY<0?1:-1),8),40);return localStorage.setItem("editor-font-size",String(i)),i}))};t.addEventListener("wheel",i,{passive:!1,capture:!0}),S.current=()=>{t.removeEventListener("wheel",i,!0)}},[]),el=(0,q.useCallback)((t,i)=>{for(let r of(m.current=t,f.current=i,p&&lT(e,p),eo(t,b),t.updateOptions({fontSize:P}),en(t,i),ea(t),y.current))r.dispose();y.current=function(e,t){let i=[];for(let r of j.values())i.push(e.addAction({...r,run:e=>r.run(e,t)}));return i}(t,{workspaceId:e,workspaceRoot:p}),M(e=>e+1),t.addAction({id:"agentSpaces.saveFile",label:"Save File",keybindings:[2097],run:()=>er.current()})},[ea,b,en,eo,e,p,P]);(0,q.useEffect)(()=>{m.current&&p&&lT(e,p)},[e,p]),(0,q.useEffect)(()=>{m.current&&f.current&&en(m.current,f.current)},[en]),(0,q.useEffect)(()=>()=>{let t;(t=lE.get(e))&&(lE.delete(e),t.stop())},[e]),(0,q.useEffect)(()=>()=>{for(let e of(S.current?.(),S.current=null,_.current))e.dispose();for(let e of(_.current=[],y.current))e.dispose();y.current=[],C.current=[]},[]);let ec=(0,K.useCodeFavoritesStore)(e=>e.favorites);(0,q.useEffect)(()=>{let t=m.current,i=f.current;if(!t||!i||!r){t&&(C.current=t.deltaDecorations(C.current,[]));return}let o=ec.filter(t=>t.path===r&&t.workspaceId===e);if(0===o.length){C.current=t.deltaDecorations(C.current,[]);return}let n=o.map(e=>({range:new i.Range(e.line,1,e.endLine||e.line,1),options:{isWholeLine:!0,glyphMarginClassName:"favorite-glyph",glyphMarginHoverMessage:{value:e.label||`${e.path}:${e.line}`},className:"favorite-line-bg"}}));C.current=t.deltaDecorations(C.current,n)},[r,ec,e,A]),(0,q.useEffect)(()=>{if(!r||!$||$.modified||W)return;let t=setInterval(()=>{s(e,r)},3e3);return()=>clearInterval(t)},[$,r,$?.modified,W,e,s]),(0,q.useEffect)(()=>{let e=m.current;e&&eo(e,b)},[b,eo]),(0,q.useEffect)(()=>{ee.pendingNavigationSelectionCleanup.current&&window.setTimeout(()=>{ee.pendingNavigationSelectionCleanup.current&&(lq(m.current),ee.closeMobileSelectionMode())},0)},[r,A,ee]),(0,q.useEffect)(()=>{let e=m.current;e&&e.updateOptions({wordWrap:E?"on":"off"})},[E]),(0,q.useEffect)(()=>{let e=m.current;e&&e.updateOptions({minimap:{enabled:T}})},[T]),(0,q.useEffect)(()=>{let e=m.current;e&&e.updateOptions({fontSize:P})},[P]),(0,q.useEffect)(()=>{$&&r&&function(e,t,i,r){let o=i??"",n=ri(e,t,r),s=eb.editor.getModel(n);if(s)s.getValue()!==o&&s.setValue(o);else{let e,i;s=eb.editor.createModel(o,(e=t.split("/").pop()?.toLowerCase()||"",i=e.split(".").pop()?.toLowerCase()||"","dockerfile"===e||e.startsWith("dockerfile.")?"dockerfile":"makefile"===e||"gnumakefile"===e?"makefile":"cmakelists.txt"===e||e.endsWith(".cmake")?"cmake":({ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",json:"json",jsonc:"json",css:"css",scss:"scss",less:"less",html:"html",htm:"html",vue:"html",svg:"xml",xml:"xml",yaml:"yaml",yml:"yaml",toml:"ini",ini:"ini",env:"ini",py:"python",pyw:"python",rb:"ruby",pl:"perl",pm:"perl",php:"php",lua:"lua",sh:"shell",bash:"shell",zsh:"shell",fish:"shell",ps1:"powershell",psm1:"powershell",bat:"bat",cmd:"bat",rs:"rust",go:"go",c:"c",h:"c",cpp:"cpp",cc:"cpp",cxx:"cpp",hpp:"cpp",hh:"cpp",hxx:"cpp",cs:"csharp",java:"java",kt:"kotlin",kts:"kotlin",swift:"swift",dart:"dart",scala:"scala",hs:"haskell",lhs:"haskell",ex:"elixir",exs:"elixir",erl:"erlang",clj:"clojure",cljs:"clojure",groovy:"groovy",gradle:"groovy",md:"markdown",mdx:"markdown",tex:"latex",sql:"sql",graphql:"graphql",gql:"graphql",r:"r",d:"d",zig:"zig",dockerfile:"dockerfile"})[i]||"plaintext"),n)}rt.set(t,s)}(e,r,H,p)},[$,r,H,e,p]),(0,q.useEffect)(()=>{if(!l||!r||l.path!==r||!m.current)return;let{line:t,column:i,endLine:o,endColumn:n,path:s}=l,a=m.current,d=a.getModel(),u=ri(e,s,p).path;if(!d||d.uri.path!==u){let e=window.setTimeout(()=>{F(e=>e+1)},30);return()=>window.clearTimeout(e)}let h=Math.min(Math.max(1,t),d.getLineCount()),g=Math.min(Math.max(1,i||1),d.getLineMaxColumn(h)),f=o?Math.min(Math.max(1,o),d.getLineCount()):h,_=n?Math.min(Math.max(1,n),d.getLineMaxColumn(f)):g,y={startLineNumber:h,startColumn:g,endLineNumber:f,endColumn:_};a.setSelection(y),a.setPosition({lineNumber:h,column:g}),a.revealLineInCenter(h);let C=a.createDecorationsCollection([{range:y,options:{className:"symbolHighlight",stickiness:1}}]);window.setTimeout(()=>C.clear(),700),b||a.focus(),c()},[l,r,e,p,A,L,c,b]);let ed=r?ri(e,r,p).toString():void 0;return(0,U.jsxs)("div",{className:`flex flex-col h-full ${x?"fixed inset-0 z-50 bg-background":""}`,children:[(0,U.jsx)(eu,{workspaceId:e}),(0,U.jsx)(eg,{editorRef:m,workspaceId:e,isReadOnly:b,onToggleReadOnly:()=>w(e=>!e),isFullscreen:x,onToggleFullscreen:()=>D(e=>!e),wordWrap:E,onToggleWordWrap:()=>{let e=!E;k(e),localStorage.setItem("editor-word-wrap",String(e))},minimap:T,onToggleMinimap:()=>{let e=!T;R(e),localStorage.setItem("editor-minimap",String(e))},fontSize:P,onZoomIn:()=>I(e=>{let t=Math.min(e+1,40);return localStorage.setItem("editor-font-size",String(t)),t}),onZoomOut:()=>I(e=>{let t=Math.max(e-1,8);return localStorage.setItem("editor-font-size",String(t)),t}),onZoomReset:()=>{I(13),localStorage.setItem("editor-font-size","13")}}),(0,U.jsx)("div",{className:"relative flex-1 min-h-0",...ee.containerProps,children:W&&z?(0,U.jsx)(ey,{diffs:z.diffs,message:z.message}):Y&&O&&(Z||"markdown"===J)?(0,U.jsxs)("div",{className:"relative flex justify-center h-full bg-muted/20 overflow-auto p-4",children:[X&&(0,U.jsxs)("button",{onClick:()=>N(!1),className:"absolute top-2 right-2 z-10 flex items-center gap-1.5 px-2.5 py-1.5 rounded-md bg-background/90 border text-xs text-muted-foreground hover:text-foreground hover:bg-background shadow-sm transition-colors cursor-pointer",title:h("switchToCode"),children:[(0,U.jsx)(eC.Code,{size:14}),h("code")]}),"image"===J&&(0,U.jsx)("img",{src:Z,alt:$?.name,className:"max-w-full max-h-full object-contain"}),"video"===J&&(0,U.jsx)("video",{src:Z,controls:!0,className:"max-w-full max-h-full"}),"audio"===J&&(0,U.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,U.jsx)("div",{className:"text-muted-foreground text-sm",children:$?.name}),(0,U.jsx)("audio",{src:Z,controls:!0})]}),"svg"===J&&(0,U.jsx)("img",{src:Z,alt:$?.name,className:"max-w-full max-h-full object-contain"}),"markdown"===J&&H&&(0,U.jsx)("div",{className:"prose prose-sm dark:prose-invert max-w-none w-full max-w-4xl mx-auto",children:(0,U.jsx)(lz.Markdown,{content:H,workspaceId:e})})]}):$&&X&&!O?(0,U.jsxs)("div",{className:"relative flex flex-col h-full",children:[(0,U.jsxs)("button",{onClick:()=>N(!0),className:"absolute top-2 right-2 z-10 flex items-center gap-1.5 px-2.5 py-1.5 rounded-md bg-background/90 border text-xs text-muted-foreground hover:text-foreground hover:bg-background shadow-sm transition-colors cursor-pointer",title:h("switchToPreview"),children:[(0,U.jsx)(eS.Eye,{size:14}),h("preview")]}),(0,U.jsx)(lV,{height:"100%",language:l$($.path),value:H,path:ed,onChange:(t,i)=>{if(i.isFlush)return;let r=lI(m.current?.getModel()?.uri,e,p);r&&r===$.path&&o(r,t||"")},onMount:el,options:{fontSize:P,minimap:{enabled:T},scrollBeyondLastLine:!1,glyphMargin:!0,lineNumbersMinChars:3,padding:{top:8},renderLineHighlight:"gutter",readOnly:b,wordWrap:E?"on":"off"},theme:"dark"===u?"vs-dark":"vs"})]}):$?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(lV,{height:"100%",language:l$($.path),value:H,path:ed,onChange:(t,i)=>{if(i.isFlush)return;let r=lI(m.current?.getModel()?.uri,e,p);r&&r===$.path&&o(r,t||"")},onMount:el,options:{fontSize:P,minimap:{enabled:T},scrollBeyondLastLine:!1,glyphMargin:!0,lineNumbersMinChars:3,padding:{top:8},renderLineHighlight:"gutter",readOnly:b,wordWrap:E?"on":"off",gotoLocation:{multipleDefinitions:"goto",multipleTypeDefinitions:"goto",multipleDeclarations:"goto",multipleImplementations:"goto",multipleReferences:"goto"}},theme:"dark"===u?"vs-dark":"vs"}),ee.showMobileReadonlyOverlay?(0,U.jsx)(lj,{activeContent:H,wordWrap:E,mobileSelectionMode:ee.mobileSelectionMode,mobileReadonlyMenu:ee.mobileReadonlyMenu,mobileSelectionPreMetrics:ee.mobileSelectionPreMetrics,mobileSelectionPreRef:ee.mobileSelectionPreRef,mobileReadonlyMenuRef:ee.mobileReadonlyMenuRef,onContextMenu:ee.handleMobileSelectionContextMenu,onEnterSelectionMode:ee.enterMobileSelectionMode,onCloseSelectionMode:ee.closeMobileSelectionMode,onCopySelection:ee.copyMobileSelection,onRunEditorAction:ee.runMobileEditorAction,onRunBuiltinAction:ee.runMobileBuiltinAction}):null]}):(0,U.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:h("openFileToEdit")})})]})}],611219)},538691,e=>{e.n(e.i(611219))}]);
|
|
70
|
+
\`\`\``,isTrusted:!0}}var ig=class extends tB{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{signatureHelp:{dynamicRegistration:!0,contextSupport:!0,signatureInformation:{documentationFormat:[tO.Markdown,tO.PlainText],parameterInformation:{labelOffsetSupport:!0},activeParameterSupport:!0}}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tz.textDocumentSignatureHelp,!0,e=>eA.languages.registerSignatureHelpProvider(io(e.documentSelector),new ip(this._connection,e))))}},ip=class{constructor(e,t){te(this,"signatureHelpTriggerCharacters"),te(this,"signatureHelpRetriggerCharacters"),this._client=e,this._capabilities=t,this.signatureHelpTriggerCharacters=t.triggerCharacters,this.signatureHelpRetriggerCharacters=t.retriggerCharacters}async provideSignatureHelp(e,t,i,r){var o;let n=this._client.bridge.translate(e,t),s=await this._client.server.textDocumentSignatureHelp({textDocument:n.textDocument,position:n.position,context:{triggerKind:(o=r.triggerKind,ie.get(o)??tU.Invoked),triggerCharacter:r.triggerCharacter,isRetrigger:r.isRetrigger}});return s?{value:{signatures:s.signatures.map(e=>({label:e.label,documentation:im(e.documentation),parameters:e.parameters?.map(e=>({label:e.label,documentation:im(e.documentation)}))||[],activeParameter:e.activeParameter})),activeSignature:s.activeSignature||0,activeParameter:s.activeParameter||0},dispose:()=>{}}:null}};function im(e){if(e)return"string"==typeof e?e:{value:e.value,isTrusted:!0}}var iv=class extends tB{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{definition:{dynamicRegistration:!0,linkSupport:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tz.textDocumentDefinition,!0,e=>eA.languages.registerDefinitionProvider(io(e.documentSelector),new i_(this._connection,e))))}},i_=class{constructor(e,t){this._client=e,this._capabilities=t}async provideDefinition(e,t,i){let r=this._client.bridge.translate(e,t),o=await this._client.server.textDocumentDefinition({textDocument:r.textDocument,position:r.position});return o?Array.isArray(o)?o.map(e=>ir(e,this._client)):ir(o,this._client):null}},iy=class extends tB{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{declaration:{dynamicRegistration:!0,linkSupport:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tz.textDocumentDeclaration,!0,e=>eA.languages.registerDeclarationProvider(io(e.documentSelector),new iC(this._connection,e))))}},iC=class{constructor(e,t){this._client=e,this._capabilities=t}async provideDeclaration(e,t,i){let r=this._client.bridge.translate(e,t),o=await this._client.server.textDocumentDeclaration({textDocument:r.textDocument,position:r.position});return o?Array.isArray(o)?o.map(e=>ir(e,this._client)):ir(o,this._client):null}},iS=class extends tB{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{typeDefinition:{dynamicRegistration:!0,linkSupport:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tz.textDocumentTypeDefinition,!0,e=>eA.languages.registerTypeDefinitionProvider(io(e.documentSelector),new ib(this._connection,e))))}},ib=class{constructor(e,t){this._client=e,this._capabilities=t}async provideTypeDefinition(e,t,i){let r=this._client.bridge.translate(e,t),o=await this._client.server.textDocumentTypeDefinition({textDocument:r.textDocument,position:r.position});return o?Array.isArray(o)?o.map(e=>ir(e,this._client)):ir(o,this._client):null}},iw=class extends tB{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{implementation:{dynamicRegistration:!0,linkSupport:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tz.textDocumentImplementation,!0,e=>eA.languages.registerImplementationProvider(io(e.documentSelector),new ix(this._connection,e))))}},ix=class{constructor(e,t){this._client=e,this._capabilities=t}async provideImplementation(e,t,i){let r=this._client.bridge.translate(e,t),o=await this._client.server.textDocumentImplementation({textDocument:r.textDocument,position:r.position});return o?Array.isArray(o)?o.map(e=>ir(e,this._client)):ir(o,this._client):null}},iD=class extends tB{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{references:{dynamicRegistration:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tz.textDocumentReferences,!0,e=>eA.languages.registerReferenceProvider(io(e.documentSelector),new iE(this._connection,e))))}},iE=class{constructor(e,t){this._client=e,this._capabilities=t}async provideReferences(e,t,i,r){let o=this._client.bridge.translate(e,t),n=await this._client.server.textDocumentReferences({textDocument:o.textDocument,position:o.position,context:{includeDeclaration:i.includeDeclaration}});return n?n.map(e=>{let t=this._client.bridge.translateBackRange({uri:e.uri},e.range);return{uri:t.textModel.uri,range:t.range}}):null}},ik=class extends tB{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{documentHighlight:{dynamicRegistration:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tz.textDocumentDocumentHighlight,!0,e=>eA.languages.registerDocumentHighlightProvider(io(e.documentSelector),new iT(this._connection,e))))}},iT=class{constructor(e,t){this._client=e,this._capabilities=t}async provideDocumentHighlights(e,t,i){let r=this._client.bridge.translate(e,t),o=await this._client.server.textDocumentDocumentHighlight({textDocument:r.textDocument,position:r.position});return o?o.map(e=>{var t;return{range:this._client.bridge.translateBackRange(r.textDocument,e.range).range,kind:(t=e.kind)?t4.get(t)??eA.languages.DocumentHighlightKind.Text:eA.languages.DocumentHighlightKind.Text}}):null}},iR=class extends tB{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{documentSymbol:{dynamicRegistration:!0,hierarchicalDocumentSymbolSupport:!0,symbolKind:{valueSet:Array.from(t2.keys())},tagSupport:{valueSet:[tT.Deprecated]}}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tz.textDocumentDocumentSymbol,!0,e=>eA.languages.registerDocumentSymbolProvider(io(e.documentSelector),new iP(this._connection,e))))}},iP=class{constructor(e,t){this._client=e,this._capabilities=t}async provideDocumentSymbols(e,t){let i=this._client.bridge.translate(e,new eA.Position(1,1)),r=await this._client.server.textDocumentDocumentSymbol({textDocument:i.textDocument});if(!r)return null;if(Array.isArray(r)&&r.length>0)if("location"in r[0])return r.map(e=>{var t,i;return t=e,i=this._client,{name:t.name,detail:"",kind:t6(t.kind),tags:t.tags?.map(e=>t3.get(e)).filter(e=>void 0!==e)||[],range:i.bridge.translateBackRange({uri:t.location.uri},t.location.range).range,selectionRange:i.bridge.translateBackRange({uri:t.location.uri},t.location.range).range,children:[]}});else return r.map(e=>(function e(t,i,r){return{name:t.name,detail:t.detail||"",kind:t6(t.kind),tags:t.tags?.map(e=>t3.get(e)).filter(e=>void 0!==e)||[],range:i.bridge.translateBackRange(r,t.range).range,selectionRange:i.bridge.translateBackRange(r,t.selectionRange).range,children:t.children?.map(t=>e(t,i,r))||[]}})(e,this._client,i.textDocument));return[]}},iI=class extends tB{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{rename:{dynamicRegistration:!0,prepareSupport:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tz.textDocumentRename,!0,e=>eA.languages.registerRenameProvider(io(e.documentSelector),new iA(this._connection,e))))}},iA=class{constructor(e,t){this._client=e,this._capabilities=t}async provideRenameEdits(e,t,i,r){let o=this._client.bridge.translate(e,t),n=await this._client.server.textDocumentRename({textDocument:o.textDocument,position:o.position,newName:i});return n?function(e,t){let i=[];if(e.changes)for(let r in e.changes)for(let o of e.changes[r]){let e=t.bridge.translateBackRange({uri:r},o.range);i.push({resource:e.textModel.uri,versionId:void 0,textEdit:{range:e.range,text:o.newText}})}if(e.documentChanges){for(let r of e.documentChanges)if("textDocument"in r){let e=r.textDocument.uri;for(let o of r.edits){let n=t.bridge.translateBackRange({uri:e},o.range);i.push({resource:n.textModel.uri,versionId:r.textDocument.version,textEdit:{range:n.range,text:o.newText}})}}}return{edits:i}}(n,this._client):null}async resolveRenameLocation(e,t,i){if(!this._capabilities.prepareProvider)return null;let r=this._client.bridge.translate(e,t),o=await this._client.server.textDocumentPrepareRename({textDocument:r.textDocument,position:r.position});if(!o)return null;if("range"in o&&"placeholder"in o)return{range:this._client.bridge.translateBackRange(r.textDocument,o.range).range,text:o.placeholder};if("defaultBehavior"in o);else if("start"in o&&"end"in o){let t=this._client.bridge.translateBackRange(r.textDocument,o).range;return{range:t,text:e.getValueInRange(t)}}return null}},iM=class extends tB{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{codeAction:{dynamicRegistration:!0,codeActionLiteralSupport:{codeActionKind:{valueSet:Array.from(tQ.keys())}},isPreferredSupport:!0,disabledSupport:!0,dataSupport:!0,resolveSupport:{properties:["edit"]}}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tz.textDocumentCodeAction,!0,e=>eA.languages.registerCodeActionProvider(io(e.documentSelector),new iL(this._connection,e))))}},iL=class{constructor(e,t){te(this,"resolveCodeAction"),this._client=e,this._capabilities=t,t.resolveProvider&&(this.resolveCodeAction=async(e,t)=>{if(e._lspAction){let t=await this._client.server.codeActionResolve(e._lspAction);t.edit&&(e.edit=iF(t.edit,this._client)),t.command&&(e.command=it(t.command))}return e})}async provideCodeActions(e,t,i,r){var o;let n=this._client.bridge.translate(e,t.getStartPosition()),s=await this._client.server.textDocumentCodeAction({textDocument:n.textDocument,range:this._client.bridge.translateRange(e,t),context:{diagnostics:i.markers.map(t=>{var i;return{range:this._client.bridge.translateRange(e,eA.Range.lift(t)),message:t.message,severity:(i=t.severity,t8.get(i)??tN.Error)}}),triggerKind:(o=i.trigger,tJ.get(o)??tW.Invoked)}});return s?{actions:(Array.isArray(s)?s:[s]).map(e=>"title"in e&&!("kind"in e)?{title:e.title,command:it(e)}:{title:e.title,kind:function(e){if(e)return tQ.get(e)??e}(e.kind),isPreferred:e.isPreferred,disabled:e.disabled?.reason,edit:e.edit?iF(e.edit,this._client):void 0,command:it(e.command),_lspAction:e}),dispose:()=>{}}:null}};function iF(e,t){let i=[];if(e.changes)for(let r in e.changes)for(let o of e.changes[r]){let e=t.bridge.translateBackRange({uri:r},o.range);i.push({resource:e.textModel.uri,versionId:void 0,textEdit:{range:e.range,text:o.newText}})}if(e.documentChanges){for(let r of e.documentChanges)if("textDocument"in r){let e=r.textDocument.uri;for(let o of r.edits){let n=t.bridge.translateBackRange({uri:e},o.range);i.push({resource:n.textModel.uri,versionId:r.textDocument.version??void 0,textEdit:{range:n.range,text:o.newText}})}}}return{edits:i}}var iO=class extends tB{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{codeLens:{dynamicRegistration:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tz.textDocumentCodeLens,!0,e=>eA.languages.registerCodeLensProvider(io(e.documentSelector),new iN(this._connection,e))))}},iN=class{constructor(e,t){this._client=e,this._capabilities=t}async provideCodeLenses(e,t){let i=this._client.bridge.translate(e,new eA.Position(1,1)),r=await this._client.server.textDocumentCodeLens({textDocument:i.textDocument});return r?{lenses:r.map(t=>({range:tV(this._client.bridge.translateBackRange(i.textDocument,t.range),e).range,command:it(t.command),_lspCodeLens:t})),dispose:()=>{}}:null}async resolveCodeLens(e,t,i){if(!this._capabilities.resolveProvider||!t._lspCodeLens)return t;let r=await this._client.server.codeLensResolve(t._lspCodeLens);return r.command&&(t.command={id:r.command.command,title:r.command.title,arguments:r.command.arguments}),t}},i$=class extends tB{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{documentLink:{dynamicRegistration:!0,tooltipSupport:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tz.textDocumentDocumentLink,!0,e=>eA.languages.registerLinkProvider(io(e.documentSelector),new iH(this._connection,e))))}},iH=class{constructor(e,t){this._client=e,this._capabilities=t}async provideLinks(e,t){let i=this._client.bridge.translate(e,new eA.Position(1,1)),r=await this._client.server.textDocumentDocumentLink({textDocument:i.textDocument});return r?{links:r.map(e=>({range:this._client.bridge.translateBackRange(i.textDocument,e.range).range,url:e.target,tooltip:e.tooltip}))}:null}async resolveLink(e,t){return!this._capabilities.resolveProvider,e}},iU=class extends tB{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{formatting:{dynamicRegistration:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tz.textDocumentFormatting,!0,e=>eA.languages.registerDocumentFormattingEditProvider(io(e.documentSelector),new iW(this._connection,e))))}},iW=class{constructor(e,t){this._client=e,this._capabilities=t}async provideDocumentFormattingEdits(e,t,i){let r=this._client.bridge.translate(e,new eA.Position(1,1)),o=await this._client.server.textDocumentFormatting({textDocument:r.textDocument,options:{tabSize:t.tabSize,insertSpaces:t.insertSpaces}});return o?o.map(e=>({range:this._client.bridge.translateBackRange(r.textDocument,e.range).range,text:e.newText})):null}},iq=class extends tB{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{rangeFormatting:{dynamicRegistration:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tz.textDocumentRangeFormatting,!0,e=>eA.languages.registerDocumentRangeFormattingEditProvider(io(e.documentSelector),new ij(this._connection,e))))}},ij=class{constructor(e,t){this._client=e,this._capabilities=t}async provideDocumentRangeFormattingEdits(e,t,i,r){let o=this._client.bridge.translate(e,t.getStartPosition()),n=await this._client.server.textDocumentRangeFormatting({textDocument:o.textDocument,range:this._client.bridge.translateRange(e,t),options:{tabSize:i.tabSize,insertSpaces:i.insertSpaces}});return n?n.map(e=>({range:this._client.bridge.translateBackRange(o.textDocument,e.range).range,text:e.newText})):null}},iz=class extends tB{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{onTypeFormatting:{dynamicRegistration:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tz.textDocumentOnTypeFormatting,!0,e=>eA.languages.registerOnTypeFormattingEditProvider(io(e.documentSelector),new iK(this._connection,e))))}},iK=class{constructor(e,t){te(this,"autoFormatTriggerCharacters"),this._client=e,this._capabilities=t,this.autoFormatTriggerCharacters=[t.firstTriggerCharacter,...t.moreTriggerCharacter||[]]}async provideOnTypeFormattingEdits(e,t,i,r,o){let n=this._client.bridge.translate(e,t),s=await this._client.server.textDocumentOnTypeFormatting({textDocument:n.textDocument,position:n.position,ch:i,options:{tabSize:r.tabSize,insertSpaces:r.insertSpaces}});return s?s.map(e=>({range:this._client.bridge.translateBackRange(n.textDocument,e.range).range,text:e.newText})):null}},iV=class extends tB{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{foldingRange:{dynamicRegistration:!0,rangeLimit:5e3,lineFoldingOnly:!1,foldingRangeKind:{valueSet:[tE.Comment,tE.Imports,tE.Region]}}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tz.textDocumentFoldingRange,!0,e=>eA.languages.registerFoldingRangeProvider(io(e.documentSelector),new iB(this._connection,e))))}},iB=class{constructor(e,t){this._client=e,this._capabilities=t}async provideFoldingRanges(e,t,i){let r=this._client.bridge.translate(e,new eA.Position(1,1)),o=await this._client.server.textDocumentFoldingRange({textDocument:r.textDocument});return o?o.map(e=>({start:e.startLine+1,end:e.endLine+1,kind:function(e){if(e)return t5.get(e)}(e.kind)})):null}},iG=class extends tB{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{selectionRange:{dynamicRegistration:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tz.textDocumentSelectionRange,!0,e=>eA.languages.registerSelectionRangeProvider(io(e.documentSelector),new iQ(this._connection,e))))}},iQ=class{constructor(e,t){this._client=e,this._capabilities=t}async provideSelectionRanges(e,t,i){let r=this._client.bridge.translate(e,t[0]),o=await this._client.server.textDocumentSelectionRange({textDocument:r.textDocument,positions:t.map(t=>this._client.bridge.translate(e,t).position)});return o?o.map(e=>this.convertSelectionRange(e,r.textDocument)):null}convertSelectionRange(e,t){let i=[],r=e;for(;r;)i.push({range:this._client.bridge.translateBackRange(t,r.range).range}),r=r.parent;return i}},iJ=class extends tB{constructor(e){super(),te(this,"_providers",new Set),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{inlayHint:{dynamicRegistration:!0,resolveSupport:{properties:["tooltip","textEdits","label.tooltip","label.location","label.command"]}}},workspace:{inlayHint:{refreshSupport:!0}}})),this._register(this._connection.connection.registerRequestHandler(tK.client.workspaceInlayHintRefresh,async()=>{for(let e of this._providers)e.refresh();return{ok:null}})),this._register(this._connection.capabilities.registerCapabilityHandler(tz.textDocumentInlayHint,!0,e=>{let t=new iY(this._connection,e);this._providers.add(t);let i=eA.languages.registerInlayHintsProvider(io(e.documentSelector),t);return{dispose:()=>{this._providers.delete(t),i.dispose()}}}))}},iY=class{constructor(e,t){te(this,"_onDidChangeInlayHints",new eA.Emitter),te(this,"onDidChangeInlayHints",this._onDidChangeInlayHints.event),te(this,"resolveInlayHint"),this._client=e,this._capabilities=t,t.resolveProvider&&(this.resolveInlayHint=async(e,t)=>{let i=await this._client.server.inlayHintResolve(e._lspInlayHint);return i.tooltip&&(e.tooltip=i0(i.tooltip)),i.label!==e._lspInlayHint.label&&(e.label=iZ(i.label)),i.textEdits&&(e.textEdits=i.textEdits.map(t=>({range:this._client.bridge.translateBackRange({uri:e._targetUri},t.range).range,text:t.newText}))),e})}refresh(){this._onDidChangeInlayHints.fire()}async provideInlayHints(e,t,i){let r=this._client.bridge.translate(e,t.getStartPosition()),o=await iX(async()=>await this._client.server.textDocumentInlayHint({textDocument:r.textDocument,range:this._client.bridge.translateRange(e,t)}));return o?{hints:o.map(t=>{var i;return{label:iZ(t.label),position:tV(this._client.bridge.translateBack(r.textDocument,t.position),e).position,kind:(i=t.kind)?ii.get(i)??eA.languages.InlayHintKind.Type:eA.languages.InlayHintKind.Type,tooltip:i0(t.tooltip),paddingLeft:t.paddingLeft,paddingRight:t.paddingRight,textEdits:t.textEdits?.map(t=>({range:tV(this._client.bridge.translateBackRange(r.textDocument,t.range),e).range,text:t.newText})),_lspInlayHint:t,_targetUri:r.textDocument.uri}}),dispose:()=>{}}:null}};async function iX(e){for(let t=3;;t--)try{return await e()}catch(e){if("content modified"===e.message&&t>0)continue;throw e}}function iZ(e){return"string"==typeof e?e:e.map(e=>{let t={label:e.value,tooltip:i0(e.tooltip),command:it(e.command)};return e.location&&(t.location={uri:eA.Uri.parse(e.location.uri),range:new eA.Range(e.location.range.start.line+1,e.location.range.start.character+1,e.location.range.end.line+1,e.location.range.end.character+1)}),t})}function i0(e){if(e)return"string"==typeof e?e:{value:e.value,isTrusted:!0}}var i1=class extends tB{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{semanticTokens:{dynamicRegistration:!0,requests:{range:!0,full:{delta:!0}},tokenTypes:["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","operator","decorator"],tokenModifiers:["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"],formats:[tq.Relative],overlappingTokenSupport:!1,multilineTokenSupport:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(tz.textDocumentSemanticTokensFull,!0,e=>eA.languages.registerDocumentSemanticTokensProvider(io(e.documentSelector),new i2(this._connection,e))))}},i2=class{constructor(e,t){this._client=e,this._capabilities=t}getLegend(){return{tokenTypes:this._capabilities.legend.tokenTypes,tokenModifiers:this._capabilities.legend.tokenModifiers}}releaseDocumentSemanticTokens(e){}async provideDocumentSemanticTokens(e,t,i){let r=this._client.bridge.translate(e,e.getPositionAt(0)),o=this._capabilities.full;if(t&&o&&"object"==typeof o&&o.delta){let e=await this._client.server.textDocumentSemanticTokensFullDelta({textDocument:r.textDocument,previousResultId:t});return e?"edits"in e?{resultId:e.resultId,edits:e.edits.map(e=>({start:e.start,deleteCount:e.deleteCount,data:e.data?new Uint32Array(e.data):void 0}))}:{resultId:e.resultId,data:new Uint32Array(e.data)}:null}let n=await this._client.server.textDocumentSemanticTokensFull({textDocument:r.textDocument});return n?{resultId:n.resultId,data:new Uint32Array(n.data)}:null}async provideDocumentSemanticTokensEdits(e,t,i){return this.provideDocumentSemanticTokens(e,t,i)}},i6=class extends tB{constructor(e){super(),te(this,"_diagnosticsMarkerOwner","lsp"),te(this,"_pullDiagnosticProviders",new Map),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{publishDiagnostics:{relatedInformation:!0,tagSupport:{valueSet:[...t9.keys()]},versionSupport:!0,codeDescriptionSupport:!0,dataSupport:!0},diagnostic:{dynamicRegistration:!0,relatedDocumentSupport:!0}}})),this._register(this._connection.connection.registerNotificationHandler(tK.client.textDocumentPublishDiagnostics,e=>this._handlePublishDiagnostics(e))),this._register(this._connection.capabilities.registerCapabilityHandler(tz.textDocumentDiagnostic,!0,e=>{let t=new tG;for(let i of eA.editor.getModels())this._addPullDiagnosticProvider(i,e,t);return t.add(eA.editor.onDidCreateModel(i=>{this._addPullDiagnosticProvider(i,e,t)})),t}))}_addPullDiagnosticProvider(e,t,i){if(e.getLanguageId(),!function(e,t){if(!t)return!0;let i=e.getLanguageId();if(e.uri.toString(!0),!t||0===t.length)return!0;for(let e of t)if(!e.language||"*"===e.language||e.language===i)return!0;return!1}(e,t.documentSelector))return;let r=new i3(e,this._connection,this._diagnosticsMarkerOwner,t);this._pullDiagnosticProviders.set(e,r),i.add(r),i.add(e.onWillDispose(()=>{this._pullDiagnosticProviders.delete(e)}))}_handlePublishDiagnostics(e){let t=e.uri;try{let i=this._connection.bridge.translateBack({uri:t},{line:0,character:0}).textModel;if(!i||i.isDisposed())return;let r=e.diagnostics.map(e=>is(e));eA.editor.setModelMarkers(i,this._diagnosticsMarkerOwner,r)}catch(e){console.debug(`Could not set diagnostics for ${t}:`,e)}}},i3=class extends tB{constructor(e,t,i,r){super(),te(this,"_updateHandle"),te(this,"_previousResultId"),this._model=e,this._connection=t,this._markerOwner=i,this._capability=r,this._register(this._model.onDidChangeContent(()=>{this._scheduleDiagnosticUpdate()})),this._scheduleDiagnosticUpdate()}_scheduleDiagnosticUpdate(){void 0!==this._updateHandle&&clearTimeout(this._updateHandle),this._updateHandle=window.setTimeout(()=>{this._updateHandle=void 0,this._requestDiagnostics()},500)}async _requestDiagnostics(){if(!this._model.isDisposed())try{let e=this._connection.bridge.translate(this._model,new eA.Position(1,1)),t=await this._connection.server.textDocumentDiagnostic({textDocument:e.textDocument,identifier:this._capability.identifier,previousResultId:this._previousResultId});if(this._model.isDisposed())return;this._handleDiagnosticReport(t)}catch(e){console.error("Error requesting diagnostics:",e)}}_handleDiagnosticReport(e){if("full"===e.kind){this._previousResultId=e.resultId;let t=e.items.map(e=>is(e));eA.editor.setModelMarkers(this._model,this._markerOwner,t),"relatedDocuments"in e&&e.relatedDocuments&&this._handleRelatedDocuments(e.relatedDocuments)}else"unchanged"===e.kind&&(this._previousResultId=e.resultId)}_handleRelatedDocuments(e){for(let[t,i]of Object.entries(e))try{let e=this._connection.bridge.translateBack({uri:t},{line:0,character:0}).textModel;if(!e||e.isDisposed())continue;if("full"===i.kind){let t=i.items.map(e=>is(e));eA.editor.setModelMarkers(e,this._markerOwner,t)}}catch(e){console.debug(`Could not set related diagnostics for ${t}:`,e)}}dispose(){void 0!==this._updateHandle&&(clearTimeout(this._updateHandle),this._updateHandle=void 0),super.dispose()}},i4=class{constructor(e,t,i,r){this.server=e,this.bridge=t,this.capabilities=i,this.connection=r}},i5=class extends tB{constructor(e){super(),te(this,"_staticCapabilities",new Set),te(this,"_dynamicFromStatic",ri.create()),te(this,"_registrations",new Map),te(this,"_serverCapabilities"),this._connection=e,this._register(this._connection.registerRequestHandler(tK.client.clientRegisterCapability,async e=>{for(let t of e.registrations){let e=re(t.method),i=new i7(t.id,e,t.registerOptions,!1);this._registerCapabilityOptions(i)}return{ok:null}})),this._register(this._connection.registerRequestHandler(tK.client.clientUnregisterCapability,async e=>{for(let t of e.unregisterations){let e=re(t.method),i=this._registrations.get(e),r=i?.registrations.get(t.id);if(!r)throw Error(`No registration for method ${t.method} with id ${t.id}`);r?.handlerDisposables.forEach(e=>e.dispose()),i?.registrations.delete(t.id)}return{ok:null}}))}_registerCapabilityOptions(e){let t=this._registrations.get(e.capability);if(t||(t=new rt,this._registrations.set(e.capability,t)),t.registrations.has(e.id))throw Error(`Handler for method ${e.capability.method} with id ${e.id} already registered`);for(let i of(t.registrations.set(e.id,e),t.handlers))(i.handleStaticCapability||!e.isFromStatic)&&e.handlerDisposables.set(i,i.handler(e.options))}setServerCapabilities(e){if(this._serverCapabilities)throw Error("Server capabilities already set");for(let t of(this._serverCapabilities=e,Object.values(tz))){let i=this._dynamicFromStatic.getOptions(t,e);i&&this._registerCapabilityOptions(new i7(t.method,t,i,!0))}}getClientCapabilities(){let e={};for(let t of this._staticCapabilities)!function e(t,i){for(let r of Object.keys(i)){let o=i[r];if(void 0===o)continue;let n=t[r];if(void 0===n||"object"!=typeof o||null===o||"object"!=typeof n||null===n){t[r]=o;continue}e(n,o)}}(e,t.cap);return e}addStaticClientCapabilities(e){let t={cap:e};return this._staticCapabilities.add(t),{dispose:()=>{this._staticCapabilities.delete(t)}}}registerCapabilityHandler(e,t,i){let r=this._registrations.get(e);r||(r=new rt,this._registrations.set(e,r));let o=new i8(e,t,i);for(let e of(r.handlers.add(o),r.registrations.values()))(o.handleStaticCapability||!e.isFromStatic)&&e.handlerDisposables.set(o,i(e.options));return{dispose:()=>{for(let e of(r.handlers.delete(o),r.registrations.values())){let t=e.handlerDisposables.get(o);t&&(t.dispose(),e.handlerDisposables.delete(o))}}}}},i8=class{constructor(e,t,i){this.capability=e,this.handleStaticCapability=t,this.handler=i}},i7=class{constructor(e,t,i,r){te(this,"handlerDisposables",new Map),this.id=e,this.capability=t,this.options=i,this.isFromStatic=r}};let i9=new Map([...Object.values(tz)].map(e=>[e.method,e]));function re(e){let t=i9.get(e);if(!t)throw Error(`No capability found for method ${e}`);return t}var rt=class{constructor(){te(this,"handlers",new Set),te(this,"registrations",new Map)}},ri=class e{constructor(){te(this,"_mappings",new Map)}static create(){let t=new e;return t.set(tz.textDocumentDidChange,e=>{if(void 0!==e.textDocumentSync)if("object"==typeof e.textDocumentSync)return{syncKind:e.textDocumentSync.change??tP.None,documentSelector:null};else return{syncKind:e.textDocumentSync,documentSelector:null}}),t.set(tz.textDocumentCompletion,e=>e.completionProvider),t.set(tz.textDocumentHover,e=>e.hoverProvider),t.set(tz.textDocumentSignatureHelp,e=>e.signatureHelpProvider),t.set(tz.textDocumentDefinition,e=>e.definitionProvider),t.set(tz.textDocumentReferences,e=>e.referencesProvider),t.set(tz.textDocumentDocumentHighlight,e=>e.documentHighlightProvider),t.set(tz.textDocumentDocumentSymbol,e=>e.documentSymbolProvider),t.set(tz.textDocumentCodeAction,e=>e.codeActionProvider),t.set(tz.textDocumentCodeLens,e=>e.codeLensProvider),t.set(tz.textDocumentDocumentLink,e=>e.documentLinkProvider),t.set(tz.textDocumentFormatting,e=>e.documentFormattingProvider),t.set(tz.textDocumentRangeFormatting,e=>e.documentRangeFormattingProvider),t.set(tz.textDocumentOnTypeFormatting,e=>e.documentOnTypeFormattingProvider),t.set(tz.textDocumentRename,e=>e.renameProvider),t.set(tz.textDocumentFoldingRange,e=>e.foldingRangeProvider),t.set(tz.textDocumentDeclaration,e=>e.declarationProvider),t.set(tz.textDocumentTypeDefinition,e=>e.typeDefinitionProvider),t.set(tz.textDocumentImplementation,e=>e.implementationProvider),t.set(tz.textDocumentDocumentColor,e=>e.colorProvider),t.set(tz.textDocumentSelectionRange,e=>e.selectionRangeProvider),t.set(tz.textDocumentLinkedEditingRange,e=>e.linkedEditingRangeProvider),t.set(tz.textDocumentPrepareCallHierarchy,e=>e.callHierarchyProvider),t.set(tz.textDocumentSemanticTokensFull,e=>e.semanticTokensProvider),t.set(tz.textDocumentInlayHint,e=>e.inlayHintProvider),t.set(tz.textDocumentInlineValue,e=>e.inlineValueProvider),t.set(tz.textDocumentDiagnostic,e=>e.diagnosticProvider),t.set(tz.textDocumentMoniker,e=>e.monikerProvider),t.set(tz.textDocumentPrepareTypeHierarchy,e=>e.typeHierarchyProvider),t.set(tz.workspaceSymbol,e=>e.workspaceSymbolProvider),t.set(tz.workspaceExecuteCommand,e=>e.executeCommandProvider),t}set(e,t){if(this._mappings.has(e.method))throw Error(`Capability for method ${e.method} already registered`);this._mappings.set(e.method,t)}getOptions(e,t){let i=this._mappings.get(e.method);if(i)return i(t)}},rr=class extends tB{constructor(e,t){super(),te(this,"_managedModels",new Map),te(this,"_managedModelsReverse",new Map),te(this,"_started",!1),this._server=e,this._capabilities=t,this._register(this._capabilities.addStaticClientCapabilities({textDocument:{synchronization:{dynamicRegistration:!0,willSave:!1,willSaveWaitUntil:!1,didSave:!1}}})),this._register(t.registerCapabilityHandler(tz.textDocumentDidChange,!0,e=>{if(this._started)return{dispose:()=>{}};for(let e of(this._started=!0,this._register(eA.editor.onDidCreateModel(e=>{this._getOrCreateManagedModel(e)})),eA.editor.getModels()))this._getOrCreateManagedModel(e);return{dispose:()=>{}}}))}_getOrCreateManagedModel(e){if(!this._started)throw Error("Not started");let t=e.uri.toString(!0).toLowerCase(),i=this._managedModels.get(e);return i||(i=new ro(e,this._server),this._managedModels.set(e,i),this._managedModelsReverse.set(t,e)),e.onWillDispose(()=>{i.dispose(),this._managedModels.delete(e),this._managedModelsReverse.delete(t)}),i}translateBack(e,t){let i=e.uri.toLowerCase(),r=this._managedModelsReverse.get(i);if(!r)throw Error(`No text model for uri ${i}`);return{textModel:r,position:new eA.Position(t.line+1,t.character+1)}}translateBackRange(e,t){let i=e.uri.toLowerCase(),r=this._managedModelsReverse.get(i);if(!r)throw Error(`No text model for uri ${i}`);return{textModel:r,range:new eA.Range(t.start.line+1,t.start.character+1,t.end.line+1,t.end.character+1)}}translate(e,t){return{textDocument:{uri:e.uri.toString(!0)},position:{line:t.lineNumber-1,character:t.column-1}}}translateRange(e,t){return{start:{line:t.startLineNumber-1,character:t.startColumn-1},end:{line:t.endLineNumber-1,character:t.endColumn-1}}}},ro=class extends tB{constructor(e,t){super(),this._textModel=e,this._api=t;const i=e.uri.toString(!0).toLowerCase();this._api.textDocumentDidOpen({textDocument:{languageId:e.getLanguageId(),uri:i,version:e.getVersionId(),text:e.getValue()}}),this._register(e.onDidChangeContent(t=>{let r=t.changes.map(e=>{var t,i;return{range:{start:{line:(i=(t=e).range).startLineNumber-1,character:i.startColumn-1},end:{line:i.endLineNumber-1,character:i.endColumn-1}},rangeLength:t.rangeLength,text:t.text}});this._api.textDocumentDidChange({textDocument:{uri:i,version:e.getVersionId()},contentChanges:r})})),this._register({dispose:()=>{this._api.textDocumentDidClose({textDocument:{uri:i}})}})}},rn=class{constructor(e){te(this,"_connection"),te(this,"_capabilitiesRegistry"),te(this,"_bridge"),te(this,"_initPromise");const t=tm.fromTransport(e),i=tK.getServer(t,{});t.startListen(),this._capabilitiesRegistry=new i5(t),this._bridge=new rr(i.server,this._capabilitiesRegistry),this._connection=new i4(i.server,this._bridge,this._capabilitiesRegistry,t),this.createFeatures(),this._initPromise=this._init()}async _init(){let e=await this._connection.server.initialize({processId:null,capabilities:this._capabilitiesRegistry.getClientCapabilities(),rootUri:null});this._connection.server.initialized({}),this._capabilitiesRegistry.setServerCapabilities(e.capabilities)}createFeatures(){let e=new tG;return e.add(new ia(this._connection)),e.add(new id(this._connection)),e.add(new ig(this._connection)),e.add(new iv(this._connection)),e.add(new iy(this._connection)),e.add(new iS(this._connection)),e.add(new iw(this._connection)),e.add(new iD(this._connection)),e.add(new ik(this._connection)),e.add(new iR(this._connection)),e.add(new iI(this._connection)),e.add(new iM(this._connection)),e.add(new iO(this._connection)),e.add(new i$(this._connection)),e.add(new iU(this._connection)),e.add(new iq(this._connection)),e.add(new iz(this._connection)),e.add(new iV(this._connection)),e.add(new iG(this._connection)),e.add(new iJ(this._connection)),e.add(new i1(this._connection)),e.add(new i6(this._connection)),e}},rs=null,ra=rs="u">typeof WebSocket?WebSocket:"u">typeof MozWebSocket?MozWebSocket:e.g.WebSocket||e.g.MozWebSocket,rl=class e extends ta{constructor(e){super(),te(this,"socket"),te(this,"errorEmitter",new tr),te(this,"onError",this.errorEmitter),this.socket=e,e.onmessage=e=>{try{let t=e.data;if("string"==typeof t){let e=JSON.parse(t);this._dispatchReceivedMessage(e)}else throw Error("Not supported")}catch(e){this.errorEmitter.fire({error:e})}},e.onclose=e=>{this._onConnectionClosed()}}static connectTo(t){let i=new ra(("host"in t?{address:`${t.forceTls?"wss":"ws"}://${t.host}:${t.port}`}:t).address);return new Promise((t,r)=>{i.onerror=e=>{r(e)},i.onopen=()=>{t(new e(i))}})}static fromWebSocket(t){return new e(t)}close(){this.socket.close()}dispose(){this.close()}_sendImpl(e){let t=JSON.stringify(e);return new Promise((e,i)=>{this.socket.send(t,t=>{t?i(t):e()})})}toString(){return`${this.id}@${this.socket.url}`}},rc=class extends ta{constructor(e,t,i){super(),te(this,"_windowLike"),te(this,"_source"),te(this,"_loadingState"),te(this,"_disposed",!1),te(this,"_messageHandler",({data:e,source:t})=>{(!this._source||t===this._source)&&"object"==typeof e&&e&&this._dispatchReceivedMessage(e)}),this._windowLike=e,this._source=t,this._loadingState=i,this._windowLike.addEventListener("message",this._messageHandler)}async _sendImpl(e){if(this._disposed)throw Error("Transport is disposed");this._loadingState&&!this._loadingState.loaded&&await this._loadingState.onLoaded,this._windowLike.postMessage(e)}toString(){return`${this.id}@${this._windowLike}`}dispose(){this._disposed||(this._disposed=!0,this._windowLike.removeEventListener("message",this._messageHandler))}};e.s(["MonacoLspClient",0,rn,"WebSocketTransport",0,rl,"createTransportToIFrame",0,function(e){if("u"<typeof window)throw Error("call this function from the main browser thread");return new rc(e.contentWindow,e.contentWindow,{loaded:"complete"===window.document.readyState,onLoaded:new Promise(e=>{window.addEventListener("load",()=>e())})})},"createTransportToWorker",0,function(e){if("u"<typeof window)throw Error("call this function from the main browser thread");return new rc(e)}],733757),e.i(733757),e.i(120276);let rd=globalThis.MonacoEnvironment;rd?.globalAPI&&(globalThis.monaco=eA),eA.languages.css=eU,eA.languages.html=e0,eA.languages.typescript=e3,eA.languages.json=e6;let ru=new Map;function rh(e,t,i){return i?eA.Uri.file(`${i.replace(/\/+$/,"")}/${t}`):eA.Uri.parse(`file:///workspace/${e}/${t}`)}var rg=e.i(185966);class rp extends rg.BaseLanguageClient{messageTransports;constructor({id:e,name:t,clientOptions:i,messageTransports:r}){super(e??t.toLowerCase(),t,i),this.messageTransports=r}createMessageTransports(e){return Promise.resolve(this.messageTransports)}}var rm=e.i(861593),rf=e.i(69150),rv=e.i(840969),r_=e.i(654295),ry=e.i(865562),rC=e.i(611130),rS=e.i(693205),rb=e.i(802136),rw=e.i(798237),rx=e.i(478697),rD=e.i(79522),rE=e.i(347470);class rk extends rE.EditorWorkerClient{constructor(e,t,i){super(i.worker,i.keepIdleModels||!1,e,t),this._foreignModuleHost=i.host||null,this._foreignProxy=this._getProxy().then(e=>new Proxy({},{get(t,i,r){if("then"!==i){if("string"!=typeof i)throw Error("Not supported");if("then"!==i)return(...t)=>e.$fmr(i,t)}}}))}fhr(e,t){if(!this._foreignModuleHost||"function"!=typeof this._foreignModuleHost[e])return Promise.reject(Error("Missing method "+e+" or missing main thread foreign host."));try{return Promise.resolve(this._foreignModuleHost[e].apply(this._foreignModuleHost,t))}catch(e){return Promise.reject(e)}}getProxy(){return this._foreignProxy}withSyncedResources(e){return this.workerWithSyncedResources(e).then(e=>this.getProxy())}}var rT=e.i(130772),rR=e.i(604634),rP=e.i(600345),rI=e.i(772649),rA=e.i(58762),rM=e.i(429200),rL=e.i(305638),rF=e.i(98342),rO=e.i(326659),rN=e.i(49583),r$=e.i(20848),rH=e.i(561295),rU=e.i(830598),rW=e.i(746244),rq=e.i(343840),rj=e.i(281482),rz=rC;function rK(e){return"string"==typeof e}(D=F||(F={}))[D.None=0]="None",D[D.Open=1]="Open",D[D.Close=-1]="Close";function rV(e,t){return e.ignoreCase&&t?t.toLowerCase():t}function rB(e){return e.replace(/[&<>'"_]/g,"-")}function rG(e,t){return Error(`${e.languageId}: ${t}`)}function rQ(e,t,i,r,o){let n=null;return t.replace(/\$((\$)|(#)|(\d\d?)|[sS](\d\d?)|@(\w+))/g,function(t,s,a,l,c,d,u,h,g){return a?"$":l?rV(e,i):c&&c<r.length?rV(e,r[c]):u&&e&&"string"==typeof e[u]?e[u]:(null===n&&(n=o.split(".")).unshift(o),d&&d<n.length)?rV(e,n[d]):""})}function rJ(e,t){let i=t;for(;i&&i.length>0;){let t=e.tokenizer[i];if(t)return t;let r=i.lastIndexOf(".");i=r<0?null:i.substr(0,r)}return null}var rY=e.i(731931);class rX{static{this._INSTANCE=new rX(5)}static create(e,t){return this._INSTANCE.create(e,t)}constructor(e){this._maxCacheDepth=e,this._entries=Object.create(null)}create(e,t){if(null!==e&&e.depth>=this._maxCacheDepth)return new rZ(e,t);let i=rZ.getStackElementId(e);i.length>0&&(i+="|"),i+=t;let r=this._entries[i];return r||(r=new rZ(e,t),this._entries[i]=r),r}}class rZ{constructor(e,t){this.parent=e,this.state=t,this.depth=(this.parent?this.parent.depth:0)+1}static getStackElementId(e){let t="";for(;null!==e;)t.length>0&&(t+="|"),t+=e.state,e=e.parent;return t}static _equals(e,t){for(;null!==e&&null!==t;){if(e===t)return!0;if(e.state!==t.state)return!1;e=e.parent,t=t.parent}return null===e&&null===t}equals(e){return rZ._equals(this,e)}push(e){return rX.create(this,e)}pop(){return this.parent}popall(){let e=this;for(;e.parent;)e=e.parent;return e}switchTo(e){return rX.create(this.parent,e)}}class r0{constructor(e,t){this.languageId=e,this.state=t}equals(e){return this.languageId===e.languageId&&this.state.equals(e.state)}clone(){return this.state.clone()===this.state?this:new r0(this.languageId,this.state)}}class r1{static{this._INSTANCE=new r1(5)}static create(e,t){return this._INSTANCE.create(e,t)}constructor(e){this._maxCacheDepth=e,this._entries=Object.create(null)}create(e,t){if(null!==t||null!==e&&e.depth>=this._maxCacheDepth)return new r2(e,t);let i=rZ.getStackElementId(e),r=this._entries[i];return r||(r=new r2(e,null),this._entries[i]=r),r}}class r2{constructor(e,t){this.stack=e,this.embeddedLanguageData=t}clone(){return(this.embeddedLanguageData?this.embeddedLanguageData.clone():null)===this.embeddedLanguageData?this:r1.create(this.stack,this.embeddedLanguageData)}equals(e){return e instanceof r2&&!!this.stack.equals(e.stack)&&(null===this.embeddedLanguageData&&null===e.embeddedLanguageData||null!==this.embeddedLanguageData&&null!==e.embeddedLanguageData&&this.embeddedLanguageData.equals(e.embeddedLanguageData))}}class r6{constructor(){this._tokens=[],this._languageId=null,this._lastTokenType=null,this._lastTokenLanguage=null}enterLanguage(e){this._languageId=e}emit(e,t){(this._lastTokenType!==t||this._lastTokenLanguage!==this._languageId)&&(this._lastTokenType=t,this._lastTokenLanguage=this._languageId,this._tokens.push(new rI.Token(e,t,this._languageId)))}nestedLanguageTokenize(e,t,i,r){let o=i.languageId,n=i.state,s=rI.TokenizationRegistry.get(o);if(!s)return this.enterLanguage(o),this.emit(r,""),n;let a=s.tokenize(e,t,n);if(0!==r)for(let e of a.tokens)this._tokens.push(new rI.Token(e.offset+r,e.type,e.language));else this._tokens=this._tokens.concat(a.tokens);return this._lastTokenType=null,this._lastTokenLanguage=null,this._languageId=null,a.endState}finalize(e){return new rI.TokenizationResult(this._tokens,e)}}class r3{constructor(e,t){this._languageService=e,this._theme=t,this._prependTokens=null,this._tokens=[],this._currentLanguageId=rH.LanguageId.Null,this._lastTokenMetadata=0}enterLanguage(e){this._currentLanguageId=this._languageService.languageIdCodec.encodeLanguageId(e)}emit(e,t){let i=this._theme.match(this._currentLanguageId,t)|rH.MetadataConsts.BALANCED_BRACKETS_MASK;this._lastTokenMetadata!==i&&(this._lastTokenMetadata=i,this._tokens.push(e),this._tokens.push(i))}static _merge(e,t,i){let r=null!==e?e.length:0,o=t.length,n=null!==i?i.length:0;if(0===r&&0===o&&0===n)return new Uint32Array(0);if(0===r&&0===o)return i;if(0===o&&0===n)return e;let s=new Uint32Array(r+o+n);null!==e&&s.set(e);for(let e=0;e<o;e++)s[r+e]=t[e];return null!==i&&s.set(i,r+o),s}nestedLanguageTokenize(e,t,i,r){let o=i.languageId,n=i.state,s=rI.TokenizationRegistry.get(o);if(!s)return this.enterLanguage(o),this.emit(r,""),n;let a=s.tokenizeEncoded(e,t,n);if(0!==r)for(let e=0,t=a.tokens.length;e<t;e+=2)a.tokens[e]+=r;return this._prependTokens=r3._merge(this._prependTokens,this._tokens,a.tokens),this._tokens=[],this._currentLanguageId=0,this._lastTokenMetadata=0,a.endState}finalize(e){return new rI.EncodedTokenizationResult(r3._merge(this._prependTokens,this._tokens,null),[],e)}}let r4=O=class extends rz.Disposable{constructor(e,t,i,r,o){super(),this._configurationService=o,this._languageService=e,this._standaloneThemeService=t,this._languageId=i,this._lexer=r,this._embeddedLanguages=Object.create(null),this.embeddedLoaded=Promise.resolve(void 0);let n=!1;this._register(rI.TokenizationRegistry.onDidChange(e=>{if(n)return;let t=!1;for(let i=0,r=e.changedLanguages.length;i<r;i++){let r=e.changedLanguages[i];if(this._embeddedLanguages[r]){t=!0;break}}t&&(n=!0,rI.TokenizationRegistry.handleChange([this._languageId]),n=!1)})),this._maxTokenizationLineLength=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:this._languageId}),this._register(this._configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("editor.maxTokenizationLineLength")&&(this._maxTokenizationLineLength=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:this._languageId}))}))}getLoadStatus(){let e=[];for(let t in this._embeddedLanguages){let i=rI.TokenizationRegistry.get(t);if(i){if(i instanceof O){let t=i.getLoadStatus();!1===t.loaded&&e.push(t.promise)}continue}rI.TokenizationRegistry.isResolved(t)||e.push(rI.TokenizationRegistry.getOrCreate(t))}return 0===e.length?{loaded:!0}:{loaded:!1,promise:Promise.all(e).then(e=>void 0)}}getInitialState(){let e=rX.create(null,this._lexer.start);return r1.create(e,null)}tokenize(e,t,i){if(e.length>=this._maxTokenizationLineLength)return(0,rL.nullTokenize)(this._languageId,i);let r=new r6,o=this._tokenize(e,t,i,r);return r.finalize(o)}tokenizeEncoded(e,t,i){if(e.length>=this._maxTokenizationLineLength)return(0,rL.nullTokenizeEncoded)(this._languageService.languageIdCodec.encodeLanguageId(this._languageId),i);let r=new r3(this._languageService,this._standaloneThemeService.getColorTheme().tokenTheme),o=this._tokenize(e,t,i,r);return r.finalize(o)}_tokenize(e,t,i,r){return i.embeddedLanguageData?this._nestedTokenize(e,t,i,0,r):this._myTokenize(e,t,i,0,r)}_findLeavingNestedLanguageOffset(e,t){let i=this._lexer.tokenizer[t.stack.state];if(!i&&!(i=rJ(this._lexer,t.stack.state)))throw rG(this._lexer,"tokenizer state is not defined: "+t.stack.state);let r=-1,o=!1;for(let n of i){if(rK(n.action)||!("@pop"===n.action.nextEmbedded||n.action.hasEmbeddedEndInCases))continue;o=!0;let i=n.resolveRegex(t.stack.state),s=i.source;if("^(?:"===s.substr(0,4)&&")"===s.substr(s.length-1,1)){let e=(i.ignoreCase?"i":"")+(i.unicode?"u":"");i=new RegExp(s.substr(4,s.length-5),e)}let a=e.search(i);-1!==a&&(0===a||!n.matchOnlyAtLineStart)&&(-1===r||a<r)&&(r=a)}if(!o)throw rG(this._lexer,'no rule containing nextEmbedded: "@pop" in tokenizer embedded state: '+t.stack.state);return r}_nestedTokenize(e,t,i,r,o){let n=this._findLeavingNestedLanguageOffset(e,i);if(-1===n){let n=o.nestedLanguageTokenize(e,t,i.embeddedLanguageData,r);return r1.create(i.stack,new r0(i.embeddedLanguageData.languageId,n))}let s=e.substring(0,n);s.length>0&&o.nestedLanguageTokenize(s,!1,i.embeddedLanguageData,r);let a=e.substring(n);return this._myTokenize(a,t,i,r+n,o)}_safeRuleName(e){return e?e.name:"(unknown)"}_myTokenize(e,t,i,r,o){o.enterLanguage(this._languageId);let n=e.length,s=t&&this._lexer.includeLF?e+"\n":e,a=s.length,l=i.embeddedLanguageData,c=i.stack,d=0,u=null,h=!0;for(;h||d<a;){let i=d,m=c.depth,f=u?u.groups.length:0,_=c.state,y=null,C=null,S=null,b=null,w=null;if(u){y=u.matches;let e=u.groups.shift();C=e.matched,S=e.action,b=u.rule,0===u.groups.length&&(u=null)}else{if(!h&&d>=a)break;h=!1;let e=this._lexer.tokenizer[_];if(!e&&!(e=rJ(this._lexer,_)))throw rG(this._lexer,"tokenizer state is not defined: "+_);let t=s.substr(d);for(let i of e)if((0===d||!i.matchOnlyAtLineStart)&&(y=t.match(i.resolveRegex(_)))){C=y[0],S=i.action;break}}if(y||(y=[""],C=""),S||(d<a&&(C=(y=[s.charAt(d)])[0]),S=this._lexer.defaultToken),null===C)break;for(d+=C.length;!Array.isArray(S)&&!rK(S)&&S.test;)S=S.test(C,y,_,d===a);let x=null;if("string"==typeof S||Array.isArray(S))x=S;else if(S.group)x=S.group;else if(null!==S.token&&void 0!==S.token){var g,p;if(x=S.tokenSubst?rQ(this._lexer,S.token,C,y,_):S.token,S.nextEmbedded)if("@pop"===S.nextEmbedded){if(!l)throw rG(this._lexer,"cannot pop embedded language if not inside one");l=null}else if(l)throw rG(this._lexer,"cannot enter embedded language from within an embedded language");else w=rQ(this._lexer,S.nextEmbedded,C,y,_);if(S.goBack&&(d=Math.max(0,d-S.goBack)),S.switchTo&&"string"==typeof S.switchTo){let e=rQ(this._lexer,S.switchTo,C,y,_);if("@"===e[0]&&(e=e.substr(1)),rJ(this._lexer,e))c=c.switchTo(e);else throw rG(this._lexer,"trying to switch to a state '"+e+"' that is undefined in rule: "+this._safeRuleName(b))}else if(S.transform&&"function"==typeof S.transform)throw rG(this._lexer,"action.transform not supported");else if(S.next)if("@push"===S.next)if(c.depth>=this._lexer.maxStack)throw rG(this._lexer,"maximum tokenizer stack size reached: ["+c.state+","+c.parent.state+",...]");else c=c.push(_);else if("@pop"===S.next)if(c.depth<=1)throw rG(this._lexer,"trying to pop an empty stack in rule: "+this._safeRuleName(b));else c=c.pop();else if("@popall"===S.next)c=c.popall();else{let e=rQ(this._lexer,S.next,C,y,_);if("@"===e[0]&&(e=e.substr(1)),rJ(this._lexer,e))c=c.push(e);else throw rG(this._lexer,"trying to set a next state '"+e+"' that is undefined in rule: "+this._safeRuleName(b))}S.log&&"string"==typeof S.log&&(g=this._lexer,p=this._lexer.languageId+": "+rQ(this._lexer,S.log,C,y,_),console.log(`${g.languageId}: ${p}`))}if(null===x)throw rG(this._lexer,"lexer rule has no well-defined action in rule: "+this._safeRuleName(b));let D=i=>{let n=this._languageService.getLanguageIdByLanguageName(i)||this._languageService.getLanguageIdByMimeType(i)||i,s=this._getNestedEmbeddedLanguageData(n);if(!(d<a))return r1.create(c,s);{let i=e.substr(d);return this._nestedTokenize(i,t,r1.create(c,s),r+d,o)}};if(Array.isArray(x)){if(u&&u.groups.length>0)throw rG(this._lexer,"groups cannot be nested: "+this._safeRuleName(b));if(y.length!==x.length+1)throw rG(this._lexer,"matched number of groups does not match the number of actions in rule: "+this._safeRuleName(b));let e=0;for(let t=1;t<y.length;t++)e+=y[t].length;if(e!==C.length)throw rG(this._lexer,"with groups, all characters should be matched in consecutive groups in rule: "+this._safeRuleName(b));u={rule:b,matches:y,groups:[]};for(let e=0;e<x.length;e++)u.groups[e]={action:x[e],matched:y[e+1]};d-=C.length;continue}{if("@rematch"===x&&(d-=C.length,C="",y=null,x="",null!==w))return D(w);if(0===C.length)if(0===a||m!==c.depth||_!==c.state||(u?u.groups.length:0)!==f)continue;else throw rG(this._lexer,"no progress in tokenizer in rule: "+this._safeRuleName(b));let e=null;if(rK(x)&&0===x.indexOf("@brackets")){let t=x.substr(9),i=function(e,t){if(!t)return null;for(let i of(t=rV(e,t),e.brackets))if(i.open===t)return{token:i.token,bracketType:F.Open};else if(i.close===t)return{token:i.token,bracketType:F.Close};return null}(this._lexer,C);if(!i)throw rG(this._lexer,"@brackets token returned but no bracket defined as: "+C);e=rB(i.token+t)}else e=rB(""===x?"":x+this._lexer.tokenPostfix);i<n&&o.emit(i+r,e)}if(null!==w)return D(w)}return r1.create(c,l)}_getNestedEmbeddedLanguageData(e){if(!this._languageService.isRegisteredLanguageId(e))return new r0(e,rL.NullState);e!==this._languageId&&(this._languageService.requestBasicLanguageFeatures(e),rI.TokenizationRegistry.getOrCreate(e),this._embeddedLanguages[e]=!0);let t=rI.TokenizationRegistry.get(e);return t?new r0(e,t.getInitialState()):new r0(e,rL.NullState)}};r4=O=(0,rj.__decorate)([(0,rj.__param)(4,rY.IConfigurationService)],r4);let r5=(0,r$.createTrustedTypesPolicy)("standaloneColorizer",{createHTML:e=>e});class r8{static colorizeElement(e,t,i,r){let o=(r=r||{}).theme||"vs",n=r.mimeType||i.getAttribute("lang")||i.getAttribute("data-lang");if(!n)return console.error("Mode not detected"),Promise.resolve();let s=t.getLanguageIdByMimeType(n)||n;e.setTheme(o);let a=i.firstChild?i.firstChild.nodeValue:"";return i.className+=" "+o,this.colorize(t,a||"",s,r).then(e=>{i.innerHTML=r5?.createHTML(e)??e},e=>console.error(e))}static async colorize(e,t,i,r){var o,n,s,a;let l=e.languageIdCodec,c=4;r&&"number"==typeof r.tabSize&&(c=r.tabSize),(0,rS.startsWithUTF8BOM)(t)&&(t=t.substr(1));let d=(0,rS.splitLines)(t);if(!e.isRegisteredLanguageId(i))return r7(d,c,l);let u=await rI.TokenizationRegistry.getOrCreate(i);return u?(o=d,n=c,s=u,a=l,new Promise((e,t)=>{let i=()=>{let r=function(e,t,i,r){let o=[],n=i.getInitialState();for(let s=0,a=e.length;s<a;s++){let a=e[s],l=i.tokenizeEncoded(a,!0,n);rU.LineTokens.convertToEndOffset(l.tokens,a.length);let c=new rU.LineTokens(l.tokens,a,r),d=rq.ViewLineRenderingData.isBasicASCII(a,!0),u=rq.ViewLineRenderingData.containsRTL(a,d,!0),h=(0,rW.renderViewLine2)(new rW.RenderLineInput(!1,!0,a,!1,d,u,0,c.inflate(),[],t,0,0,0,0,-1,"none",!1,!1,null,null,0));(o=o.concat(h.html)).push("<br/>"),n=l.endState}return o.join("")}(o,n,s,a);if(s instanceof r4){let e=s.getLoadStatus();if(!1===e.loaded)return void e.promise.then(i,t)}e(r)};i()})):r7(d,c,l)}static colorizeLine(e,t,i,r,o=4){let n=rq.ViewLineRenderingData.isBasicASCII(e,t),s=rq.ViewLineRenderingData.containsRTL(e,n,i);return(0,rW.renderViewLine2)(new rW.RenderLineInput(!1,!0,e,!1,n,s,0,r,[],o,0,0,0,0,-1,"none",!1,!1,null,null,0)).html}static colorizeModelLine(e,t,i=4){let r=e.getLineContent(t);e.tokenization.forceTokenization(t);let o=e.tokenization.getLineTokens(t).inflate();return this.colorizeLine(r,e.mightContainNonBasicASCII(),e.mightContainRTL(),o,i)}}function r7(e,t,i){let r=[],o=(rH.FontStyle.None<<rH.MetadataConsts.FONT_STYLE_OFFSET|rH.ColorId.DefaultForeground<<rH.MetadataConsts.FOREGROUND_OFFSET|rH.ColorId.DefaultBackground<<rH.MetadataConsts.BACKGROUND_OFFSET)>>>0,n=new Uint32Array(2);n[0]=0,n[1]=o;for(let o=0,s=e.length;o<s;o++){let s=e[o];n[0]=s.length;let a=new rU.LineTokens(n,s,i),l=rq.ViewLineRenderingData.isBasicASCII(s,!0),c=rq.ViewLineRenderingData.containsRTL(s,l,!0),d=(0,rW.renderViewLine2)(new rW.RenderLineInput(!1,!0,s,!1,l,c,0,a,[],t,0,0,0,0,-1,"none",!1,!1,null,null,0));(r=r.concat(d.html)).push("<br/>")}return r.join("")}var r9=e.i(922292),oe=e.i(487106),ot=e.i(18149),oi=e.i(686380),or=e.i(318581),oo=e.i(568101),on=e.i(84513),os=e.i(206548),oa=e.i(65579),ol=e.i(781808),oc=e.i(58867),od=rC;e.i(71224);var ou=e.i(488259),oh=e.i(650289),og=e.i(575129);e.i(698014),e.i(140331);var op=e.i(471999);e.i(900329),e.i(785266),e.i(181268),e.i(70177),e.i(575210),e.i(890787),e.i(67920),(0,og.registerColor)("multiDiffEditor.headerBackground",{dark:"#262626",light:"tab.inactiveBackground",hcDark:"tab.inactiveBackground",hcLight:"tab.inactiveBackground"},(0,oh.localize)(209,"The background color of the diff editor's header")),(0,og.registerColor)("multiDiffEditor.background",op.editorBackground,(0,oh.localize)(210,"The background color of the multi file diff editor")),(0,og.registerColor)("multiDiffEditor.border",{dark:"sideBarSectionHeader.border",light:"#cccccc",hcDark:"sideBarSectionHeader.border",hcLight:"#cccccc"},(0,oh.localize)(211,"The border color of the multi file diff editor"));var om=e.i(850887),of=e.i(984004),ov=e.i(155652),o_=rC,oy=e.i(2301),oC=e.i(159868),oS=e.i(9753),ob=e.i(299051),ow=e.i(25797),ox=e.i(631524),oD=e.i(623012),oE=e.i(823288),ok=e.i(532816),oT=e.i(314122),oR=e.i(896344);class oP{constructor(e,t){this.viewModel=e,this.deltaScrollVertical=t}getId(){return this.viewModel}}let oI=class extends o_.Disposable{constructor(e,t,i,r,o){super(),this._container=e,this._overflowWidgetsDomNode=t,this._workbenchUIElementFactory=i,this._instantiationService=r,this._viewModel=(0,ok.observableValue)(this,void 0),this._collapsed=(0,oT.derived)(this,e=>this._viewModel.read(e)?.collapsed.read(e)),this._editorContentHeight=(0,ok.observableValue)(this,500),this.contentHeight=(0,oT.derived)(this,e=>(this._collapsed.read(e)?0:this._editorContentHeight.read(e))+this._outerEditorHeight),this._modifiedContentWidth=(0,ok.observableValue)(this,0),this._modifiedWidth=(0,ok.observableValue)(this,0),this._originalContentWidth=(0,ok.observableValue)(this,0),this._originalWidth=(0,ok.observableValue)(this,0),this.maxScroll=(0,oT.derived)(this,e=>{let t=this._modifiedContentWidth.read(e)-this._modifiedWidth.read(e),i=this._originalContentWidth.read(e)-this._originalWidth.read(e);return t>i?{maxScroll:t,width:this._modifiedWidth.read(e)}:{maxScroll:i,width:this._originalWidth.read(e)}}),this._elements=(0,om.h)("div.multiDiffEntry",[(0,om.h)("div.header@header",[(0,om.h)("div.header-content",[(0,om.h)("div.collapse-button@collapseButton"),(0,om.h)("div.file-path",[(0,om.h)("div.title.modified.show-file-icons@primaryPath",[]),(0,om.h)("div.status.deleted@status",["R"]),(0,om.h)("div.title.original.show-file-icons@secondaryPath",[])]),(0,om.h)("div.actions@actions")])]),(0,om.h)("div.editorParent",[(0,om.h)("div.editorContainer@editor")])]),this.editor=this._register(this._instantiationService.createInstance(ox.DiffEditorWidget,this._elements.editor,{overflowWidgetsDomNode:this._overflowWidgetsDomNode,fixedOverflowWidgets:!0},{})),this.isModifedFocused=(0,ow.observableCodeEditor)(this.editor.getModifiedEditor()).isFocused,this.isOriginalFocused=(0,ow.observableCodeEditor)(this.editor.getOriginalEditor()).isFocused,this.isFocused=(0,oT.derived)(this,e=>this.isModifedFocused.read(e)||this.isOriginalFocused.read(e)),this._resourceLabel=this._workbenchUIElementFactory.createResourceLabel?this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.primaryPath)):void 0,this._resourceLabel2=this._workbenchUIElementFactory.createResourceLabel?this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.secondaryPath)):void 0,this._dataStore=this._register(new o_.DisposableStore),this._headerHeight=40,this._lastScrollTop=-1,this._isSettingScrollTop=!1;const n=new of.Button(this._elements.collapseButton,{});this._register((0,oR.autorun)(e=>{n.element.className="",n.icon=this._collapsed.read(e)?ov.Codicon.chevronRight:ov.Codicon.chevronDown})),this._register(n.onDidClick(()=>{this._viewModel.get()?.collapsed.set(!this._collapsed.get(),void 0)})),this._register((0,oR.autorun)(e=>{this._elements.editor.style.display=this._collapsed.read(e)?"none":"block"})),this._register(this.editor.getModifiedEditor().onDidLayoutChange(e=>{let t=this.editor.getModifiedEditor().getLayoutInfo().contentWidth;this._modifiedWidth.set(t,void 0)})),this._register(this.editor.getOriginalEditor().onDidLayoutChange(e=>{let t=this.editor.getOriginalEditor().getLayoutInfo().contentWidth;this._originalWidth.set(t,void 0)})),this._register(this.editor.onDidContentSizeChange(e=>{(0,oE.globalTransaction)(t=>{this._editorContentHeight.set(e.contentHeight,t),this._modifiedContentWidth.set(this.editor.getModifiedEditor().getContentWidth(),t),this._originalContentWidth.set(this.editor.getOriginalEditor().getContentWidth(),t)})})),this._register(this.editor.getOriginalEditor().onDidScrollChange(e=>{if(this._isSettingScrollTop||!e.scrollTopChanged||!this._data)return;let t=e.scrollTop-this._lastScrollTop;this._data.deltaScrollVertical(t)})),this._register((0,oR.autorun)(e=>{let t=this._viewModel.read(e)?.isActive.read(e);this._elements.root.classList.toggle("active",t)})),this._container.appendChild(this._elements.root),this._outerEditorHeight=this._headerHeight,this._contextKeyService=this._register(o.createScoped(this._elements.actions));const s=this._register(this._instantiationService.createChild(new ob.ServiceCollection([oS.IContextKeyService,this._contextKeyService])));this._register(s.createInstance(oC.MenuWorkbenchToolBar,this._elements.actions,oi.MenuId.MultiDiffEditorFileToolbar,{actionRunner:this._register(new oD.ActionRunnerWithContext(()=>this._viewModel.get()?.modifiedUri??this._viewModel.get()?.originalUri)),menuOptions:{shouldForwardArgs:!0},toolbarOptions:{primaryGroup:e=>e.startsWith("navigation")},actionViewItemProvider:(e,t)=>(0,oy.createActionViewItem)(s,e,t)}))}setScrollLeft(e){this._modifiedContentWidth.get()-this._modifiedWidth.get()>this._originalContentWidth.get()-this._originalWidth.get()?this.editor.getModifiedEditor().setScrollLeft(e):this.editor.getOriginalEditor().setScrollLeft(e)}setData(e){function t(e){return{...e,scrollBeyondLastLine:!1,hideUnchangedRegions:{enabled:!0},scrollbar:{vertical:"hidden",horizontal:"hidden",handleMouseWheel:!1,useShadows:!1},renderOverviewRuler:!1,fixedOverflowWidgets:!0,overviewRulerBorder:!1}}if(this._data=e,!e)return void(0,oE.globalTransaction)(e=>{this._viewModel.set(void 0,e),this.editor.setDiffModel(null,e),this._dataStore.clear()});let i=e.viewModel.documentDiffItem;if((0,oE.globalTransaction)(r=>{this._resourceLabel?.setUri(e.viewModel.modifiedUri??e.viewModel.originalUri,{strikethrough:void 0===e.viewModel.modifiedUri});let o=!1,n=!1,s=!1,a="";e.viewModel.modifiedUri&&e.viewModel.originalUri&&e.viewModel.modifiedUri.path!==e.viewModel.originalUri.path?(a="R",o=!0):e.viewModel.modifiedUri?e.viewModel.originalUri||(a="A",s=!0):(a="D",n=!0),this._elements.status.classList.toggle("renamed",o),this._elements.status.classList.toggle("deleted",n),this._elements.status.classList.toggle("added",s),this._elements.status.innerText=a,this._resourceLabel2?.setUri(o?e.viewModel.originalUri:void 0,{strikethrough:!0}),this._dataStore.clear(),this._viewModel.set(e.viewModel,r),this.editor.setDiffModel(e.viewModel.diffEditorViewModelRef,r),this.editor.updateOptions(t(i.options??{}))}),i.onOptionsDidChange&&this._dataStore.add(i.onOptionsDidChange(()=>{this.editor.updateOptions(t(i.options??{}))})),e.viewModel.isAlive.recomputeInitiallyAndOnChange(this._dataStore,e=>{e||this.setData(void 0)}),e.viewModel.documentDiffItem.contextKeys)for(let[t,i]of Object.entries(e.viewModel.documentDiffItem.contextKeys))this._contextKeyService.createKey(t,i)}render(e,t,i,r){this._elements.root.style.visibility="visible",this._elements.root.style.top=`${e.start}px`,this._elements.root.style.height=`${e.length}px`,this._elements.root.style.width=`${t}px`,this._elements.root.style.position="absolute";let o=e.length-this._headerHeight,n=Math.max(0,Math.min(r.start-e.start,o));this._elements.header.style.transform=`translateY(${n}px)`,(0,oE.globalTransaction)(i=>{this.editor.layout({width:t-16-2,height:e.length-this._outerEditorHeight})});try{this._isSettingScrollTop=!0,this._lastScrollTop=i,this.editor.getOriginalEditor().setScrollTop(i)}finally{this._isSettingScrollTop=!1}this._elements.header.classList.toggle("shadow",n>0||i>0),this._elements.header.classList.toggle("collapsed",n===o)}hide(){this._elements.root.style.top="-100000px",this._elements.root.style.visibility="hidden"}};oI=(0,rj.__decorate)([(0,rj.__param)(3,ou.IInstantiationService),(0,rj.__param)(4,oS.IContextKeyService)],oI);var oA=e.i(235905),oM=e.i(46373),oL=e.i(454514),oF=e.i(237029),oO=e.i(619122),oN=rC,o$=e.i(920042),oH=e.i(103346),oU=e.i(340793),oW=e.i(704409),oq=e.i(955921);class oj{constructor(e){this._create=e,this._unused=new Set,this._used=new Set,this._itemData=new Map}getUnusedObj(e){let t;if(0===this._unused.size)t=this._create(e),this._itemData.set(t,e);else{let i=[...this._unused.values()];t=i.find(t=>this._itemData.get(t).getId()===e.getId())??i[0],this._unused.delete(t),this._itemData.set(t,e),t.setData(e)}return this._used.add(t),{object:t,dispose:()=>{this._used.delete(t),this._unused.size>5?t.dispose():this._unused.add(t)}}}dispose(){for(let e of this._used)e.dispose();for(let e of this._unused)e.dispose();this._used.clear(),this._unused.clear()}}var oz=e.i(229081);(0,r_.registerCss)(void 0);let oK=class extends oN.Disposable{constructor(e,t,i,r,o,n){super(),this._element=e,this._dimension=t,this._viewModel=i,this._workbenchUIElementFactory=r,this._parentContextKeyService=o,this._parentInstantiationService=n,this._scrollableElements=(0,om.h)("div.scrollContent",[(0,om.h)("div@content",{style:{overflow:"hidden"}}),(0,om.h)("div.monaco-editor@overflowWidgetsDomNode",{})]),this._scrollable=this._register(new o$.Scrollable({forceIntegerValues:!1,scheduleAtNextAnimationFrame:e=>(0,om.scheduleAtNextAnimationFrame)((0,om.getWindow)(this._element),e),smoothScrollDuration:100})),this._scrollableElement=this._register(new oM.SmoothScrollableElement(this._scrollableElements.root,{vertical:o$.ScrollbarVisibility.Auto,horizontal:o$.ScrollbarVisibility.Auto,useShadows:!1},this._scrollable)),this._elements=(0,om.h)("div.monaco-component.multiDiffEditor",{},[(0,om.h)("div",{},[this._scrollableElement.getDomNode()]),(0,om.h)("div.placeholder@placeholder",{},[(0,om.h)("div")])]),this._sizeObserver=this._register(new oq.ObservableElementSizeObserver(this._element,void 0)),this._objectPool=this._register(new oj(e=>{let t=this._instantiationService.createInstance(oI,this._scrollableElements.content,this._scrollableElements.overflowWidgetsDomNode,this._workbenchUIElementFactory);return t.setData(e),t})),this.scrollTop=(0,oz.observableFromEvent)(this,this._scrollableElement.onScroll,()=>this._scrollableElement.getScrollPosition().scrollTop),this.scrollLeft=(0,oz.observableFromEvent)(this,this._scrollableElement.onScroll,()=>this._scrollableElement.getScrollPosition().scrollLeft),this._viewItemsInfo=(0,oT.derived)(this,e=>{let t=this._viewModel.read(e);if(!t)return{items:[],getItem:e=>{throw new oO.BugIndicatingError}};let i=t.items.read(e),r=new Map;return{items:i.map(t=>{let i=e.store.add(new oV(t,this._objectPool,this.scrollLeft,e=>{this._scrollableElement.setScrollPosition({scrollTop:this._scrollableElement.getScrollPosition().scrollTop+e})})),o=this._lastDocStates?.[i.getKey()];return o&&(0,oE.transaction)(e=>{i.setViewState(o,e)}),r.set(t,i),i}),getItem:e=>r.get(e)}}),this._viewItems=this._viewItemsInfo.map(this,e=>e.items),this._spaceBetweenPx=0,this._totalHeight=this._viewItems.map(this,(e,t)=>e.reduce((e,i)=>e+i.contentHeight.read(t)+this._spaceBetweenPx,0)),this.activeControl=(0,oT.derived)(this,e=>{let t=this._viewModel.read(e)?.activeDiffItem.read(e);if(!t)return;let i=this._viewItemsInfo.read(e).getItem(t);return i.template.read(e)?.editor}),this._contextKeyService=this._register(this._parentContextKeyService.createScoped(this._element)),this._instantiationService=this._register(this._parentInstantiationService.createChild(new ob.ServiceCollection([oS.IContextKeyService,this._contextKeyService]))),this._contextKeyService.createKey(oW.EditorContextKeys.inMultiDiffEditor.key,!0),this._lastDocStates={},this._register((0,oR.autorunWithStore)((e,t)=>{let i=this._viewModel.read(e);if(i&&i.contextKeys)for(let[e,r]of Object.entries(i.contextKeys)){let i=this._contextKeyService.createKey(e,void 0);i.set(r),t.add((0,oN.toDisposable)(()=>i.reset()))}}));const s=this._parentContextKeyService.createKey(oW.EditorContextKeys.multiDiffEditorAllCollapsed.key,!1);this._register((0,oR.autorun)(e=>{let t=this._viewModel.read(e);if(t){let i=t.items.read(e).every(t=>t.collapsed.read(e));s.set(i)}})),this._register((0,oR.autorun)(e=>{let t=this._dimension.read(e);this._sizeObserver.observe(t)}));const a=(0,oT.derived)(e=>{if(this._viewItems.read(e).length>0)return;let t=this._viewModel.read(e);return!t||t.isLoading.read(e)?(0,oh.localize)(212,"Loading..."):(0,oh.localize)(213,"No Changed Files")});this._register((0,oR.autorun)(e=>{let t=a.read(e);this._elements.placeholder.innerText=t??"",this._elements.placeholder.classList.toggle("visible",!!t)})),this._scrollableElements.content.style.position="relative",this._register((0,oR.autorun)(e=>{let t=this._sizeObserver.height.read(e);this._scrollableElements.root.style.height=`${t}px`;let i=this._totalHeight.read(e);this._scrollableElements.content.style.height=`${i}px`;let r=this._sizeObserver.width.read(e),o=r,n=this._viewItems.read(e),s=(0,oF.findFirstMax)(n,(0,oL.compareBy)(t=>t.maxScroll.read(e).maxScroll,oL.numberComparator));s&&(o=r+s.maxScroll.read(e).maxScroll),this._scrollableElement.setScrollDimensions({width:r,height:t,scrollHeight:i,scrollWidth:o})})),e.replaceChildren(this._elements.root),this._register((0,oN.toDisposable)(()=>{e.replaceChildren()})),this._register((0,oR.autorun)(e=>{let t=this._viewModel.read(e);if(t&&!t.isLoading.read(e)){if(0===t.items.read(e).length||t.activeDiffItem.read(e))return;this.goToNextChange()}})),this._register(this._register((0,oR.autorun)(e=>{(0,oE.globalTransaction)(t=>{this.render(e)})})))}setScrollState(e){this._scrollableElement.setScrollPosition({scrollLeft:e.left,scrollTop:e.top})}getRootElement(){return this._elements.root}getContextKeyService(){return this._contextKeyService}getScopedInstantiationService(){return this._instantiationService}reveal(e,t){var i,r;let o,n,s=this._viewItems.get(),a=s.findIndex(t=>t.viewModel.originalUri?.toString()===e.original?.toString()&&t.viewModel.modifiedUri?.toString()===e.modified?.toString());if(-1===a)throw new oO.BugIndicatingError("Resource not found in diff editor");let l=s[a];this._viewModel.get().activeDiffItem.setCache(l.viewModel,void 0);let c=0;for(let e=0;e<a;e++)c+=s[e].contentHeight.get()+this._spaceBetweenPx;this._scrollableElement.setScrollPosition({scrollTop:c});let d=l.template.get()?.editor,u="original"in e?d?.getOriginalEditor():d?.getModifiedEditor();u&&t?.range&&(u.revealRangeInCenter(t.range),i=u,r=t.range,o=i.getModel(),n=i.createDecorationsCollection([{range:r,options:{description:"symbol-navigate-action-highlight",className:"symbolHighlight"}}]),setTimeout(()=>{i.getModel()===o&&n.clear()},350))}getViewState(){return{scrollState:{top:this.scrollTop.get(),left:this.scrollLeft.get()},docStates:Object.fromEntries(this._viewItems.get().map(e=>[e.getKey(),e.getViewState()]))}}setViewState(e){this.setScrollState(e.scrollState),this._lastDocStates=e.docStates,(0,oE.transaction)(t=>{if(e.docStates)for(let i of this._viewItems.get()){let r=e.docStates[i.getKey()];r&&i.setViewState(r,t)}})}findDocumentDiffItem(e){let t=this._viewItems.get().find(t=>t.viewModel.diffEditorViewModel.model.modified.uri.toString()===e.toString()||t.viewModel.diffEditorViewModel.model.original.uri.toString()===e.toString());return t?.viewModel.documentDiffItem}tryGetCodeEditor(e){let t=this._viewItems.get().find(t=>t.viewModel.diffEditorViewModel.model.modified.uri.toString()===e.toString()||t.viewModel.diffEditorViewModel.model.original.uri.toString()===e.toString()),i=t?.template.get()?.editor;if(i)if(t.viewModel.diffEditorViewModel.model.modified.uri.toString()===e.toString())return{diffEditor:i,editor:i.getModifiedEditor()};else return{diffEditor:i,editor:i.getOriginalEditor()}}goToNextChange(){this._navigateToChange("next")}goToPreviousChange(){this._navigateToChange("previous")}_navigateToChange(e){let t=this._viewItems.get();if(0===t.length)return;let i=this._viewModel.get()?.activeDiffItem.get(),r=i?t.findIndex(e=>e.viewModel===i):-1;if(-1===r)return void this._goToFile(0,"first");let o=t[r];o.viewModel.collapsed.get()&&o.viewModel.collapsed.set(!1,void 0);let n=o.template.get()?.editor;if(n?.getDiffComputationResult()?.changes2?.length){let t=n.getModifiedEditor().getPosition()?.lineNumber||1,i=n.getDiffComputationResult().changes2;if("next"===e?i.some(e=>e.modified.startLineNumber>t):i.some(e=>e.modified.endLineNumberExclusive<=t))return void n.goToDiff(e)}let s=(r+("next"===e?1:-1)+t.length)%t.length;this._goToFile(s,"next"===e?"first":"last")}_goToFile(e,t){let i=this._viewItems.get()[e];i.viewModel.collapsed.get()&&i.viewModel.collapsed.set(!1,void 0),this.reveal({original:i.viewModel.originalUri,modified:i.viewModel.modifiedUri});let r=i.template.get()?.editor;if(r?.getDiffComputationResult()?.changes2?.length)if("first"===t)r.revealFirstDiff();else{let e=r.getDiffComputationResult().changes2.at(-1),t=r.getModifiedEditor();t.setPosition({lineNumber:e.modified.startLineNumber,column:1}),t.revealLineInCenter(e.modified.startLineNumber)}r?.focus()}render(e){let t=this.scrollTop.read(e),i=0,r=0,o=0,n=this._sizeObserver.height.read(e),s=oH.OffsetRange.ofStartAndLength(t,n),a=this._sizeObserver.width.read(e);for(let l of this._viewItems.read(e)){let c=l.contentHeight.read(e),d=Math.min(c,n),u=oH.OffsetRange.ofStartAndLength(r,d),h=oH.OffsetRange.ofStartAndLength(o,c);if(h.isBefore(s))i-=c-d,l.hide();else if(h.isAfter(s))l.hide();else{let e=Math.max(0,Math.min(s.start-h.start,c-d));i-=e;let r=oH.OffsetRange.ofStartAndLength(t+i,n);l.render(u,e,a,r)}r+=d+this._spaceBetweenPx,o+=c+this._spaceBetweenPx}this._scrollableElements.content.style.transform=`translateY(${-(t+i)}px)`}};oK=(0,rj.__decorate)([(0,rj.__param)(4,oS.IContextKeyService),(0,rj.__param)(5,ou.IInstantiationService)],oK);class oV extends oN.Disposable{constructor(e,t,i,r){super(),this.viewModel=e,this._objectPool=t,this._scrollLeft=i,this._deltaScrollVertical=r,this._templateRef=this._register((0,ok.disposableObservableValue)(this,void 0)),this.contentHeight=(0,oT.derived)(this,e=>this._templateRef.read(e)?.object.contentHeight?.read(e)??this.viewModel.lastTemplateData.read(e).contentHeight),this.maxScroll=(0,oT.derived)(this,e=>this._templateRef.read(e)?.object.maxScroll.read(e)??{maxScroll:0,scrollWidth:0}),this.template=(0,oT.derived)(this,e=>this._templateRef.read(e)?.object),this._isHidden=(0,ok.observableValue)(this,!1),this._isFocused=(0,oT.derived)(this,e=>this.template.read(e)?.isFocused.read(e)??!1),this.viewModel.setIsFocused(this._isFocused,void 0),this._register((0,oR.autorun)(e=>{let t=this._scrollLeft.read(e);this._templateRef.read(e)?.object.setScrollLeft(t)})),this._register((0,oR.autorun)(e=>{let t=this._templateRef.read(e);t&&this._isHidden.read(e)&&(t.object.isFocused.read(e)||this._clear())}))}dispose(){this._clear(),super.dispose()}toString(){return`VirtualViewItem(${this.viewModel.documentDiffItem.modified?.uri.toString()})`}getKey(){return this.viewModel.getKey()}getViewState(){return(0,oE.transaction)(e=>{this._updateTemplateData(e)}),{collapsed:this.viewModel.collapsed.get(),selections:this.viewModel.lastTemplateData.get().selections}}setViewState(e,t){this.viewModel.collapsed.set(e.collapsed,t),this._updateTemplateData(t);let i=this.viewModel.lastTemplateData.get(),r=e.selections?.map(oU.Selection.liftSelection);this.viewModel.lastTemplateData.set({...i,selections:r},t);let o=this._templateRef.get();o&&r&&o.object.editor.setSelections(r)}_updateTemplateData(e){let t=this._templateRef.get();t&&this.viewModel.lastTemplateData.set({contentHeight:t.object.contentHeight.get(),selections:t.object.editor.getSelections()??void 0},e)}_clear(){let e=this._templateRef.get();e&&(0,oE.transaction)(t=>{this._updateTemplateData(t),e.object.hide(),this._templateRef.set(void 0,t)})}hide(){this._isHidden.set(!0,void 0)}render(e,t,i,r){this._isHidden.set(!1,void 0);let o=this._templateRef.get();if(!o){o=this._objectPool.getUnusedObj(new oP(this.viewModel,this._deltaScrollVertical)),this._templateRef.set(o,void 0);let e=this.viewModel.lastTemplateData.get().selections;e&&o.object.editor.setSelections(e)}o.object.render(e,i,t,r)}}var oB=e.i(465376);let oG=class extends od.Disposable{constructor(e,t,i){super(),this._element=e,this._workbenchUIElementFactory=t,this._instantiationService=i,this._dimension=(0,ok.observableValue)(this,void 0),this._viewModel=(0,ok.observableValue)(this,void 0),this._widgetImpl=(0,oT.derived)(this,e=>e.store.add(this._instantiationService.createInstance((0,oc.readHotReloadableExport)(oK),this._element,this._dimension,this._viewModel,this._workbenchUIElementFactory))),this._activeControl=(0,oT.derived)(this,e=>this._widgetImpl.read(e).activeControl.read(e)),this.onDidChangeActiveControl=ol.Event.fromObservableLight(this._activeControl),this._register((0,oB.recomputeInitiallyAndOnChange)(this._widgetImpl))}reveal(e,t){this._widgetImpl.get().reveal(e,t)}createViewModel(e){return new oA.MultiDiffEditorViewModel(e,this._instantiationService)}setViewModel(e){this._viewModel.set(e,void 0)}layout(e){this._dimension.set(e,void 0)}getActiveControl(){return this._activeControl.get()}getViewState(){return this._widgetImpl.get().getViewState()}setViewState(e){this._widgetImpl.get().setViewState(e)}tryGetCodeEditor(e){return this._widgetImpl.get().tryGetCodeEditor(e)}getRootElement(){return this._widgetImpl.get().getRootElement()}getContextKeyService(){return this._widgetImpl.get().getContextKeyService()}getScopedInstantiationService(){return this._widgetImpl.get().getScopedInstantiationService()}findDocumentDiffItem(e){return this._widgetImpl.get().findDocumentDiffItem(e)}goToNextChange(){this._widgetImpl.get().goToNextChange()}goToPreviousChange(){this._widgetImpl.get().goToPreviousChange()}};oG=(0,rj.__decorate)([(0,rj.__param)(2,ou.IInstantiationService)],oG);var oQ=e.i(557941);function oJ(e){let t=oe.StandaloneServices.get(on.IKeybindingService);return t instanceof oe.StandaloneKeybindingService?t.addDynamicKeybindings(e.map(e=>({keybinding:e.keybinding,command:e.command,commandArgs:e.commandArgs,when:oo.ContextKeyExpr.deserialize(e.when)}))):(console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService"),rC.Disposable.None)}(0,r_.registerCss)(void 0);var oY=e.i(144881),oX=e.i(166969),oZ=e.i(841836),o0=e.i(407791),o1=e.i(535567);function o2(e,t){return"boolean"==typeof e?e:t}function o6(e,t){return"string"==typeof e?e:t}function o3(e,t=!1){t&&(e=e.map(function(e){return e.toLowerCase()}));let i=function(e){let t={};for(let i of e)t[i]=!0;return t}(e);return t?function(e){return void 0!==i[e.toLowerCase()]&&i.hasOwnProperty(e.toLowerCase())}:function(e){return void 0!==i[e]&&i.hasOwnProperty(e)}}function o4(e,t,i){let r;t=t.replace(/@@/g,"\x01");let o=0;do r=!1,t=t.replace(/@(\w+)/g,function(i,o){r=!0;let n="";if("string"==typeof e[o])n=e[o];else if(e[o]&&e[o]instanceof RegExp)n=e[o].source;else if(void 0===e[o])throw rG(e,"language definition does not contain attribute '"+o+"', used at: "+t);else throw rG(e,"attribute reference '"+o+"' must be a string, used at: "+t);return n?"(?:"+n+")":""}),o++;while(r&&o<5)t=t.replace(/\x01/g,"@");let n=(e.ignoreCase?"i":"")+(e.unicode?"u":"");if(i&&t.match(/\$[sS](\d\d?)/g)){let i=null,r=null;return o=>{let s;return r&&i===o?r:(i=o,r=new RegExp((s=null,t.replace(/\$[sS](\d\d?)/g,function(t,i){return(null===s&&(s=o.split(".")).unshift(o),i&&i<s.length)?(0,rS.escapeRegExpCharacters)(rV(e,s[i])):""})),n))}}return new RegExp(t,n)}class o5{constructor(e){this.regex=RegExp(""),this.action={token:""},this.matchOnlyAtLineStart=!1,this.name="",this.name=e}setRegex(e,t){let i;if("string"==typeof t)i=t;else if(t instanceof RegExp)i=t.source;else throw rG(e,"rules must start with a match string or regular expression: "+this.name);this.matchOnlyAtLineStart=i.length>0&&"^"===i[0],this.name=this.name+": "+i,this.regex=o4(e,"^(?:"+(this.matchOnlyAtLineStart?i.substr(1):i)+")",!0)}setAction(e,t){this.action=function e(t,i,r){if(!r)return{token:""};if("string"==typeof r)return r;if(r.token||""===r.token)if("string"!=typeof r.token)throw rG(t,"a 'token' attribute must be of type string, in rule: "+i);else{let e={token:r.token};if(r.token.indexOf("$")>=0&&(e.tokenSubst=!0),"string"==typeof r.bracket)if("@open"===r.bracket)e.bracket=F.Open;else if("@close"===r.bracket)e.bracket=F.Close;else throw rG(t,"a 'bracket' attribute must be either '@open' or '@close', in rule: "+i);if(r.next)if("string"!=typeof r.next)throw rG(t,"the next state must be a string value in rule: "+i);else{let o=r.next;if(!/^(@pop|@push|@popall)$/.test(o)&&("@"===o[0]&&(o=o.substr(1)),0>o.indexOf("$")&&!function(e,t){let i=t;for(;i&&i.length>0;){if(e.stateNames[i])return!0;let t=i.lastIndexOf(".");i=t<0?null:i.substr(0,t)}return!1}(t,rQ(t,o,"",[],""))))throw rG(t,"the next state '"+r.next+"' is not defined in rule: "+i);e.next=o}return"number"==typeof r.goBack&&(e.goBack=r.goBack),"string"==typeof r.switchTo&&(e.switchTo=r.switchTo),"string"==typeof r.log&&(e.log=r.log),"string"==typeof r.nextEmbedded&&(e.nextEmbedded=r.nextEmbedded,t.usesEmbedded=!0),e}if(Array.isArray(r)){let o=[];for(let n=0,s=r.length;n<s;n++)o[n]=e(t,i,r[n]);return{group:o}}if(r.cases){let o=[],n=!1;for(let s in r.cases)if(r.cases.hasOwnProperty(s)){let a=e(t,i,r.cases[s]);"@default"===s||"@"===s||""===s?o.push({test:void 0,value:a,name:s}):"@eos"===s?o.push({test:function(e,t,i,r){return r},value:a,name:s}):o.push(function(e,t,i,r){let o,n=-1,s=i,a=i.match(/^\$(([sS]?)(\d\d?)|#)(.*)$/);a&&(a[3]&&(n=parseInt(a[3]),a[2]&&(n+=100)),s=a[4]);let l="~",c=s;if(s&&0!==s.length?/^\w*$/.test(c)?l="==":(a=s.match(/^(@|!@|~|!~|==|!=)(.*)$/))&&(l=a[1],c=a[2]):(l="!=",c=""),("~"===l||"!~"===l)&&/^(\w|\|)*$/.test(c)){let t=o3(c.split("|"),e.ignoreCase);o=function(e){return"~"===l?t(e):!t(e)}}else if("@"===l||"!@"===l){let i=e[c];if(!i)throw rG(e,"the @ match target '"+c+"' is not defined, in rule: "+t);if(!function(e,t){if(!t||!Array.isArray(t))return!1;for(let i of t)if(!e(i))return!1;return!0}(function(e){return"string"==typeof e},i))throw rG(e,"the @ match target '"+c+"' must be an array of strings, in rule: "+t);let r=o3(i,e.ignoreCase);o=function(e){return"@"===l?r(e):!r(e)}}else if("~"===l||"!~"===l)if(0>c.indexOf("$")){let t=o4(e,"^"+c+"$",!1);o=function(e){return"~"===l?t.test(e):!t.test(e)}}else o=function(t,i,r,o){return o4(e,"^"+rQ(e,c,i,r,o)+"$",!1).test(t)};else if(0>c.indexOf("$")){let t=rV(e,c);o=function(e){return"=="===l?e===t:e!==t}}else{let t=rV(e,c);o=function(i,r,o,n,s){let a=rQ(e,t,r,o,n);return"=="===l?i===a:i!==a}}return -1===n?{name:i,value:r,test:function(e,t,i,r){return o(e,e,t,i,r)}}:{name:i,value:r,test:function(e,t,i,r){let s=function(e,t,i,r){if(r<0)return e;if(r<t.length)return t[r];if(r>=100){r-=100;let e=i.split(".");if(e.unshift(i),r<e.length)return e[r]}return null}(e,t,i,n);return o(s||"",e,t,i,r)}}}(t,i,s,a)),n||(n=!(0,o1.isString)(a)&&(a.hasEmbeddedEndInCases||["@pop","@popall"].includes(a.nextEmbedded||"")))}let s=t.defaultToken;return{hasEmbeddedEndInCases:n,test:function(e,t,i,r){for(let n of o)if(!n.test||n.test(e,t,i,r))return n.value;return s}}}else throw rG(t,"an action must be a string, an object with a 'token' or 'cases' attribute, or an array of actions; in rule: "+i)}(e,this.name,t)}resolveRegex(e){return this.regex instanceof RegExp?this.regex:this.regex(e)}}function o8(e,t){if(!t||"object"!=typeof t)throw Error("Monarch: expecting a language definition object");let i={languageId:e,includeLF:o2(t.includeLF,!1),noThrow:!1,maxStack:100,start:"string"==typeof t.start?t.start:null,ignoreCase:o2(t.ignoreCase,!1),unicode:o2(t.unicode,!1),tokenPostfix:o6(t.tokenPostfix,"."+e),defaultToken:o6(t.defaultToken,"source"),usesEmbedded:!1,stateNames:{},tokenizer:{},brackets:[]};if(t.languageId=e,t.includeLF=i.includeLF,t.ignoreCase=i.ignoreCase,t.unicode=i.unicode,t.noThrow=i.noThrow,t.usesEmbedded=i.usesEmbedded,t.stateNames=t.tokenizer,t.defaultToken=i.defaultToken,!t.tokenizer||"object"!=typeof t.tokenizer)throw rG(i,"a language definition must define the 'tokenizer' attribute as an object");for(let e in i.tokenizer=[],t.tokenizer)if(t.tokenizer.hasOwnProperty(e)){i.start||(i.start=e);let r=t.tokenizer[e];i.tokenizer[e]=[],function e(r,o,n){for(let s of n){let n=s.include;if(n){if("string"!=typeof n)throw rG(i,"an 'include' attribute must be a string at: "+r);if("@"===n[0]&&(n=n.substr(1)),!t.tokenizer[n])throw rG(i,"include target '"+n+"' is not defined at: "+r);e(r+"."+n,o,t.tokenizer[n])}else{let e=new o5(r);if(Array.isArray(s)&&s.length>=1&&s.length<=3)if(e.setRegex(t,s[0]),s.length>=3)if("string"==typeof s[1])e.setAction(t,{token:s[1],next:s[2]});else if("object"==typeof s[1]){let i=s[1];i.next=s[2],e.setAction(t,i)}else throw rG(i,"a next state as the last element of a rule can only be given if the action is either an object or a string, at: "+r);else e.setAction(t,s[1]);else{if(!s.regex)throw rG(i,"a rule must either be an array, or an object with a 'regex' or 'include' field at: "+r);s.name&&"string"==typeof s.name&&(e.name=s.name),s.matchOnlyAtStart&&(e.matchOnlyAtLineStart=o2(s.matchOnlyAtLineStart,!1)),e.setRegex(t,s.regex),e.setAction(t,s.action)}o.push(e)}}}("tokenizer."+e,i.tokenizer[e],r)}if(i.usesEmbedded=t.usesEmbedded,t.brackets){if(!Array.isArray(t.brackets))throw rG(i,"the 'brackets' attribute must be defined as an array")}else t.brackets=[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"},{open:"<",close:">",token:"delimiter.angle"}];let r=[];for(let e of t.brackets){let t=e;if(t&&Array.isArray(t)&&3===t.length&&(t={token:t[2],open:t[0],close:t[1]}),t.open===t.close)throw rG(i,"open and close brackets in a 'brackets' attribute must be different: "+t.open+"\n hint: use the 'bracket' attribute if matching on equal brackets is required.");if("string"==typeof t.open&&"string"==typeof t.token&&"string"==typeof t.close)r.push({token:t.token+i.tokenPostfix,open:rV(i,t.open),close:rV(i,t.close)});else throw rG(i,"every element in the 'brackets' array must be a '{open,close,token}' object or array")}return i.brackets=r,i.noThrow=!0,i}var o7=e.i(495723);class o9{constructor(e,t){this._languageId=e,this._actual=t}dispose(){}getInitialState(){return this._actual.getInitialState()}tokenize(e,t,i){if("function"==typeof this._actual.tokenize)return ne.adaptTokenize(this._languageId,this._actual,e,i);throw Error("Not supported!")}tokenizeEncoded(e,t,i){let r=this._actual.tokenizeEncoded(e,i);return new rI.EncodedTokenizationResult(r.tokens,[],r.endState)}}class ne{constructor(e,t,i,r){this._languageId=e,this._actual=t,this._languageService=i,this._standaloneThemeService=r}dispose(){}getInitialState(){return this._actual.getInitialState()}static _toClassicTokens(e,t){let i=[],r=0;for(let o=0,n=e.length;o<n;o++){let n=e[o],s=n.startIndex;0===o?s=0:s<r&&(s=r),i[o]=new rI.Token(s,n.scopes,t),r=s}return i}static adaptTokenize(e,t,i,r){let o,n=t.tokenize(i,r),s=ne._toClassicTokens(n.tokens,e);return o=n.endState.equals(r)?r:n.endState,new rI.TokenizationResult(s,o)}tokenize(e,t,i){return ne.adaptTokenize(this._languageId,this._actual,e,i)}_toBinaryTokens(e,t){let i=e.encodeLanguageId(this._languageId),r=this._standaloneThemeService.getColorTheme().tokenTheme,o=[],n=0,s=0;for(let e=0,a=t.length;e<a;e++){let a=t[e],l=r.match(i,a.scopes)|rH.MetadataConsts.BALANCED_BRACKETS_MASK;if(n>0&&o[n-1]===l)continue;let c=a.startIndex;0===e?c=0:c<s&&(c=s),o[n++]=c,o[n++]=l,s=c}let a=new Uint32Array(n);for(let e=0;e<n;e++)a[e]=o[e];return a}tokenizeEncoded(e,t,i){let r,o=this._actual.tokenize(e,i),n=this._toBinaryTokens(this._languageService.languageIdCodec,o.tokens);return r=o.endState.equals(i)?i:o.endState,new rI.EncodedTokenizationResult(n,[],r)}}function nt(e){return e&&"function"==typeof e.then}function ni(e,t){return"tokenizeEncoded"in t?new o9(e,t):new ne(e,t,oe.StandaloneServices.get(rA.ILanguageService),oe.StandaloneServices.get(ot.IStandaloneThemeService))}function nr(e,t){let i=new rI.LazyTokenizationSupport(async()=>{let i=await Promise.resolve(t.create());return i?"function"==typeof i.getInitialState?ni(e,i):new r4(oe.StandaloneServices.get(rA.ILanguageService),oe.StandaloneServices.get(ot.IStandaloneThemeService),e,o8(e,i),oe.StandaloneServices.get(rY.IConfigurationService)):null});return rI.TokenizationRegistry.registerFactory(e,i)}var no=e.i(264901),nn=e.i(322193);rf.EditorOptions.wrappingIndent.defaultValue=rf.WrappingIndent.None,rf.EditorOptions.glyphMargin.defaultValue=!1,rf.EditorOptions.autoIndent.defaultValue=rf.EditorAutoIndentStrategy.Advanced,rf.EditorOptions.overviewRulerLanes.defaultValue=2,no.FormattingConflicts.setFormatterSelector((e,t,i)=>Promise.resolve(e[0]));let ns=(0,rv.createMonacoBaseAPI)();ns.editor={create:function(e,t,i){return oe.StandaloneServices.initialize(i||{}).createInstance(r9.StandaloneEditor,e,t)},getEditors:function(){return oe.StandaloneServices.get(rD.ICodeEditorService).listCodeEditors()},getDiffEditors:function(){return oe.StandaloneServices.get(rD.ICodeEditorService).listDiffEditors()},onDidCreateEditor:function(e){return oe.StandaloneServices.get(rD.ICodeEditorService).onCodeEditorAdd(t=>{e(t)})},onDidCreateDiffEditor:function(e){return oe.StandaloneServices.get(rD.ICodeEditorService).onDiffEditorAdd(t=>{e(t)})},createDiffEditor:function(e,t,i){return oe.StandaloneServices.initialize(i||{}).createInstance(r9.StandaloneDiffEditor2,e,t)},addCommand:function(e){if("string"!=typeof e.id||"function"!=typeof e.run)throw Error("Invalid command descriptor, `id` and `run` are required properties!");return or.CommandsRegistry.registerCommand(e.id,e.run)},addEditorAction:function(e){if("string"!=typeof e.id||"string"!=typeof e.label||"function"!=typeof e.run)throw Error("Invalid action descriptor, `id`, `label` and `run` are required properties!");let t=oo.ContextKeyExpr.deserialize(e.precondition),i=new rC.DisposableStore;if(i.add(or.CommandsRegistry.registerCommand(e.id,(i,...r)=>rx.EditorCommand.runEditorCommand(i,r,t,(t,i,r)=>Promise.resolve(e.run(i,...r))))),e.contextMenuGroupId){let r={command:{id:e.id,title:e.label},when:t,group:e.contextMenuGroupId,order:e.contextMenuOrder||0};i.add(oi.MenuRegistry.appendMenuItem(oi.MenuId.EditorContext,r))}if(Array.isArray(e.keybindings)){let r=oe.StandaloneServices.get(on.IKeybindingService);if(r instanceof oe.StandaloneKeybindingService){let o=oo.ContextKeyExpr.and(t,oo.ContextKeyExpr.deserialize(e.keybindingContext));i.add(r.addDynamicKeybindings(e.keybindings.map(t=>({keybinding:t,command:e.id,when:o}))))}else console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService")}return i},addKeybindingRule:function(e){return oJ([e])},addKeybindingRules:oJ,createModel:function(e,t,i){let r=oe.StandaloneServices.get(rA.ILanguageService),o=r.getLanguageIdByMimeType(t)||t;return(0,r9.createTextModel)(oe.StandaloneServices.get(rO.IModelService),r,e,o,i)},setModelLanguage:function(e,t){let i=oe.StandaloneServices.get(rA.ILanguageService),r=i.getLanguageIdByMimeType(t)||t||rM.PLAINTEXT_LANGUAGE_ID;e.setLanguage(i.createById(r))},setModelMarkers:function(e,t,i){e&&oe.StandaloneServices.get(os.IMarkerService).changeOne(t,e.uri,i)},getModelMarkers:function(e){return oe.StandaloneServices.get(os.IMarkerService).read(e)},removeAllMarkers:function(e){oe.StandaloneServices.get(os.IMarkerService).changeAll(e,[])},onDidChangeMarkers:function(e){return oe.StandaloneServices.get(os.IMarkerService).onMarkerChanged(e)},getModels:function(){return oe.StandaloneServices.get(rO.IModelService).getModels()},getModel:function(e){return oe.StandaloneServices.get(rO.IModelService).getModel(e)},onDidCreateModel:function(e){return oe.StandaloneServices.get(rO.IModelService).onModelAdded(e)},onWillDisposeModel:function(e){return oe.StandaloneServices.get(rO.IModelService).onModelRemoved(e)},onDidChangeModelLanguage:function(e){return oe.StandaloneServices.get(rO.IModelService).onModelLanguageChanged(t=>{e({model:t.model,oldLanguage:t.oldLanguageId})})},createWebWorker:function(e){var t;return t=oe.StandaloneServices.get(rO.IModelService),new rk(t,oe.StandaloneServices.get(oQ.IWebWorkerService),e)},colorizeElement:function(e,t){let i=oe.StandaloneServices.get(rA.ILanguageService),r=oe.StandaloneServices.get(ot.IStandaloneThemeService);return r8.colorizeElement(r,i,e,t).then(()=>{r.registerEditorContainer(e)})},colorize:function(e,t,i){let r=oe.StandaloneServices.get(rA.ILanguageService);return oe.StandaloneServices.get(ot.IStandaloneThemeService).registerEditorContainer(ry.mainWindow.document.body),r8.colorize(r,e,t,i)},colorizeModelLine:function(e,t,i=4){return oe.StandaloneServices.get(ot.IStandaloneThemeService).registerEditorContainer(ry.mainWindow.document.body),r8.colorizeModelLine(e,t,i)},tokenize:function(e,t){let i;rI.TokenizationRegistry.getOrCreate(t);let r=(i=rI.TokenizationRegistry.get(t))||{getInitialState:()=>rL.NullState,tokenize:(e,i,r)=>(0,rL.nullTokenize)(t,r)},o=(0,rS.splitLines)(e),n=[],s=r.getInitialState();for(let e=0,t=o.length;e<t;e++){let t=o[e],i=r.tokenize(t,!0,s);n[e]=i.tokens,s=i.endState}return n},defineTheme:function(e,t){oe.StandaloneServices.get(ot.IStandaloneThemeService).defineTheme(e,t)},setTheme:function(e){oe.StandaloneServices.get(ot.IStandaloneThemeService).setTheme(e)},remeasureFonts:function(){rw.FontMeasurements.clearAllFontInfos()},registerCommand:function(e,t){return or.CommandsRegistry.registerCommand({id:e,handler:t})},registerLinkOpener:function(e){return oe.StandaloneServices.get(oa.IOpenerService).registerOpener({open:async t=>("string"==typeof t&&(t=rb.URI.parse(t)),e.open(t))})},registerEditorOpener:function(e){return oe.StandaloneServices.get(rD.ICodeEditorService).registerCodeEditorOpenHandler(async(t,i,r)=>{let o;if(!i)return null;let n=t.options?.selection;return(n&&"number"==typeof n.endLineNumber&&"number"==typeof n.endColumn?o=n:n&&(o={lineNumber:n.startLineNumber,column:n.startColumn}),await e.openCodeEditor(i,t.resource,o))?i:null})},AccessibilitySupport:rN.AccessibilitySupport,ContentWidgetPositionPreference:rN.ContentWidgetPositionPreference,CursorChangeReason:rN.CursorChangeReason,DefaultEndOfLine:rN.DefaultEndOfLine,EditorAutoIndentStrategy:rN.EditorAutoIndentStrategy,EditorOption:rN.EditorOption,EndOfLinePreference:rN.EndOfLinePreference,EndOfLineSequence:rN.EndOfLineSequence,MinimapPosition:rN.MinimapPosition,MinimapSectionHeaderStyle:rN.MinimapSectionHeaderStyle,MouseTargetType:rN.MouseTargetType,OverlayWidgetPositionPreference:rN.OverlayWidgetPositionPreference,OverviewRulerLane:rN.OverviewRulerLane,GlyphMarginLane:rN.GlyphMarginLane,RenderLineNumbersType:rN.RenderLineNumbersType,RenderMinimap:rN.RenderMinimap,ScrollbarVisibility:rN.ScrollbarVisibility,ScrollType:rN.ScrollType,TextEditorCursorBlinkingStyle:rN.TextEditorCursorBlinkingStyle,TextEditorCursorStyle:rN.TextEditorCursorStyle,TrackedRangeStickiness:rN.TrackedRangeStickiness,WrappingIndent:rN.WrappingIndent,InjectedTextCursorStops:rN.InjectedTextCursorStops,PositionAffinity:rN.PositionAffinity,ShowLightbulbIconMode:rN.ShowLightbulbIconMode,TextDirection:rN.TextDirection,ConfigurationChangedEvent:rf.ConfigurationChangedEvent,BareFontInfo:rR.BareFontInfo,FontInfo:rR.FontInfo,TextModelResolvedOptions:rF.TextModelResolvedOptions,FindMatch:rF.FindMatch,ApplyUpdateResult:rf.ApplyUpdateResult,EditorZoom:rT.EditorZoom,createMultiFileDiffEditor:function(e,t){let i=oe.StandaloneServices.initialize(t||{});return new oG(e,{},i)},EditorType:rP.EditorType,EditorOptions:rf.EditorOptions},ns.languages={register:function(e){rM.ModesRegistry.registerLanguage(e)},getLanguages:function(){let e=[];return e.concat(rM.ModesRegistry.getLanguages())},onLanguage:function(e,t){return oe.StandaloneServices.withServices(()=>{let i=oe.StandaloneServices.get(rA.ILanguageService).onDidRequestRichLanguageFeatures(r=>{r===e&&(i.dispose(),t())});return i})},onLanguageEncountered:function(e,t){return oe.StandaloneServices.withServices(()=>{let i=oe.StandaloneServices.get(rA.ILanguageService).onDidRequestBasicLanguageFeatures(r=>{r===e&&(i.dispose(),t())});return i})},getEncodedLanguageId:function(e){return oe.StandaloneServices.get(rA.ILanguageService).languageIdCodec.encodeLanguageId(e)},setLanguageConfiguration:function(e,t){if(!oe.StandaloneServices.get(rA.ILanguageService).isRegisteredLanguageId(e))throw Error(`Cannot set configuration for unknown language ${e}`);return oe.StandaloneServices.get(oZ.ILanguageConfigurationService).register(e,t,100)},setColorMap:function(e){let t=oe.StandaloneServices.get(ot.IStandaloneThemeService);if(e){let i=[null];for(let t=1,r=e.length;t<r;t++)i[t]=oY.Color.fromHex(e[t]);t.setColorMapOverride(i)}else t.setColorMapOverride(null)},registerTokensProviderFactory:nr,setTokensProvider:function(e,t){if(!oe.StandaloneServices.get(rA.ILanguageService).isRegisteredLanguageId(e))throw Error(`Cannot set tokens provider for unknown language ${e}`);return nt(t)?nr(e,{create:()=>t}):rI.TokenizationRegistry.register(e,ni(e,t))},setMonarchTokensProvider:function(e,t){return nt(t)?nr(e,{create:()=>t}):rI.TokenizationRegistry.register(e,new r4(oe.StandaloneServices.get(rA.ILanguageService),oe.StandaloneServices.get(ot.IStandaloneThemeService),e,o8(e,t),oe.StandaloneServices.get(rY.IConfigurationService)))},registerReferenceProvider:function(e,t){return oe.StandaloneServices.get(o0.ILanguageFeaturesService).referenceProvider.register(e,t)},registerRenameProvider:function(e,t){return oe.StandaloneServices.get(o0.ILanguageFeaturesService).renameProvider.register(e,t)},registerNewSymbolNameProvider:function(e,t){return oe.StandaloneServices.get(o0.ILanguageFeaturesService).newSymbolNamesProvider.register(e,t)},registerCompletionItemProvider:function(e,t){return oe.StandaloneServices.get(o0.ILanguageFeaturesService).completionProvider.register(e,t)},registerSignatureHelpProvider:function(e,t){return oe.StandaloneServices.get(o0.ILanguageFeaturesService).signatureHelpProvider.register(e,t)},registerHoverProvider:function(e,t){return oe.StandaloneServices.get(o0.ILanguageFeaturesService).hoverProvider.register(e,{provideHover:async(e,i,r,o)=>{let n=e.getWordAtPosition(i);return Promise.resolve(t.provideHover(e,i,r,o)).then(e=>{if(e)return!e.range&&n&&(e.range=new oX.Range(i.lineNumber,n.startColumn,i.lineNumber,n.endColumn)),e.range||(e.range=new oX.Range(i.lineNumber,i.column,i.lineNumber,i.column)),e})}})},registerDocumentSymbolProvider:function(e,t){return oe.StandaloneServices.get(o0.ILanguageFeaturesService).documentSymbolProvider.register(e,t)},registerDocumentHighlightProvider:function(e,t){return oe.StandaloneServices.get(o0.ILanguageFeaturesService).documentHighlightProvider.register(e,t)},registerLinkedEditingRangeProvider:function(e,t){return oe.StandaloneServices.get(o0.ILanguageFeaturesService).linkedEditingRangeProvider.register(e,t)},registerDefinitionProvider:function(e,t){return oe.StandaloneServices.get(o0.ILanguageFeaturesService).definitionProvider.register(e,t)},registerImplementationProvider:function(e,t){return oe.StandaloneServices.get(o0.ILanguageFeaturesService).implementationProvider.register(e,t)},registerTypeDefinitionProvider:function(e,t){return oe.StandaloneServices.get(o0.ILanguageFeaturesService).typeDefinitionProvider.register(e,t)},registerCodeLensProvider:function(e,t){return oe.StandaloneServices.get(o0.ILanguageFeaturesService).codeLensProvider.register(e,t)},registerCodeActionProvider:function(e,t,i){return oe.StandaloneServices.get(o0.ILanguageFeaturesService).codeActionProvider.register(e,{providedCodeActionKinds:i?.providedCodeActionKinds,documentation:i?.documentation,provideCodeActions:(e,i,r,o)=>{let n=oe.StandaloneServices.get(os.IMarkerService).read({resource:e.uri}).filter(e=>oX.Range.areIntersectingOrTouching(e,i));return t.provideCodeActions(e,i,{markers:n,only:r.only,trigger:r.trigger},o)},resolveCodeAction:t.resolveCodeAction})},registerDocumentFormattingEditProvider:function(e,t){return oe.StandaloneServices.get(o0.ILanguageFeaturesService).documentFormattingEditProvider.register(e,t)},registerDocumentRangeFormattingEditProvider:function(e,t){return oe.StandaloneServices.get(o0.ILanguageFeaturesService).documentRangeFormattingEditProvider.register(e,t)},registerOnTypeFormattingEditProvider:function(e,t){return oe.StandaloneServices.get(o0.ILanguageFeaturesService).onTypeFormattingEditProvider.register(e,t)},registerLinkProvider:function(e,t){return oe.StandaloneServices.get(o0.ILanguageFeaturesService).linkProvider.register(e,t)},registerColorProvider:function(e,t){return oe.StandaloneServices.get(o0.ILanguageFeaturesService).colorProvider.register(e,t)},registerFoldingRangeProvider:function(e,t){return oe.StandaloneServices.get(o0.ILanguageFeaturesService).foldingRangeProvider.register(e,t)},registerDeclarationProvider:function(e,t){return oe.StandaloneServices.get(o0.ILanguageFeaturesService).declarationProvider.register(e,t)},registerSelectionRangeProvider:function(e,t){return oe.StandaloneServices.get(o0.ILanguageFeaturesService).selectionRangeProvider.register(e,t)},registerDocumentSemanticTokensProvider:function(e,t){return oe.StandaloneServices.get(o0.ILanguageFeaturesService).documentSemanticTokensProvider.register(e,t)},registerDocumentRangeSemanticTokensProvider:function(e,t){return oe.StandaloneServices.get(o0.ILanguageFeaturesService).documentRangeSemanticTokensProvider.register(e,t)},registerInlineCompletionsProvider:function(e,t){return oe.StandaloneServices.get(o0.ILanguageFeaturesService).inlineCompletionsProvider.register(e,t)},registerInlayHintsProvider:function(e,t){return oe.StandaloneServices.get(o0.ILanguageFeaturesService).inlayHintsProvider.register(e,t)},DocumentHighlightKind:rN.DocumentHighlightKind,CompletionItemKind:rN.CompletionItemKind,CompletionItemTag:rN.CompletionItemTag,CompletionItemInsertTextRule:rN.CompletionItemInsertTextRule,SymbolKind:rN.SymbolKind,SymbolTag:rN.SymbolTag,IndentAction:rN.IndentAction,CompletionTriggerKind:rN.CompletionTriggerKind,SignatureHelpTriggerKind:rN.SignatureHelpTriggerKind,InlayHintKind:rN.InlayHintKind,InlineCompletionTriggerKind:rN.InlineCompletionTriggerKind,CodeActionTriggerType:rN.CodeActionTriggerType,NewSymbolNameTag:rN.NewSymbolNameTag,NewSymbolNameTriggerKind:rN.NewSymbolNameTriggerKind,PartialAcceptTriggerKind:rN.PartialAcceptTriggerKind,HoverVerbosityAction:rN.HoverVerbosityAction,InlineCompletionEndOfLifeReasonKind:rN.InlineCompletionEndOfLifeReasonKind,InlineCompletionHintStyle:rN.InlineCompletionHintStyle,FoldingRangeKind:rI.FoldingRangeKind,SelectedSuggestionInfo:rI.SelectedSuggestionInfo,EditDeltaInfo:o7.EditDeltaInfo},ns.CancellationTokenSource,ns.Emitter,ns.KeyCode,ns.KeyMod,ns.Position,ns.Range,ns.Selection,ns.SelectionDirection,ns.MarkerSeverity,ns.MarkerTag,ns.Uri,ns.Token;let na=ns.editor,nl=ns.languages,nc=(0,nn.getMonacoEnvironment)(),nd=globalThis;(nc?.globalAPI||"function"==typeof nd.define&&nd.define.amd)&&(nd.monaco=ns),void 0!==nd.require&&"function"==typeof nd.require.config&&nd.require.config({ignoreDuplicateModules:["vscode-languageserver-types","vscode-languageserver-types/main","vscode-languageserver-textdocument","vscode-languageserver-textdocument/main","vscode-nls","vscode-nls/vscode-nls","jsonc-parser","jsonc-parser/main","vscode-uri","vscode-uri/index","vs/basic-languages/typescript/typescript"]});var nu=e.i(106452);let nh=nl.onLanguage;nl.onLanguage=(e,t)=>(0,rm.withReadyServices)(()=>nh(e,t));let ng=nl.onLanguage;nl.onLanguageEncountered=(e,t)=>(0,rm.withReadyServices)(()=>ng(e,t)),na.create=nu.createConfiguredEditor,na.createDiffEditor=nu.createConfiguredDiffEditor,na.createModelReference=nu.createModelReference,na.writeFile=nu.writeFile;var np=e.i(290231),nm=e.i(22465),nf=e.i(467724),nv=e.i(107043),n_=e.i(702320),ny=e.i(193409),nC=e.i(554250),nS=rC,nb=e.i(819593),nw=e.i(13306);let nx=class extends nS.Disposable{constructor(e,t,i){super(),this.configurationService=e,this.modelService=t,this.languageService=i,this._onDidChangeConfiguration=this._register(new ol.Emitter),this.onDidChangeConfiguration=this._onDidChangeConfiguration.event,this._register(this.configurationService.onDidChangeConfiguration(e=>this._onDidChangeConfiguration.fire(this.toResourceConfigurationChangeEvent(e))))}getValue(e,t,i){return"string"==typeof i?this._getValue(e,nb.Position.isIPosition(t)?t:null,i):this._getValue(e,null,"string"==typeof t?t:void 0)}updateValue(e,t,i,r){let o=e?this.getLanguage(e,null):null,n=this.configurationService.inspect(t,{resource:e,overrideIdentifier:o});void 0===r&&(r=this.deriveConfigurationTarget(n,o));let s=o&&n.overrideIdentifiers?.includes(o)?o:void 0;return this.configurationService.updateValue(t,i,{resource:e,overrideIdentifier:s},r)}deriveConfigurationTarget(e,t){if(t){if(e.memory?.override!==void 0)return nw.ConfigurationTarget.MEMORY;if(e.workspaceFolder?.override!==void 0)return nw.ConfigurationTarget.WORKSPACE_FOLDER;if(e.workspace?.override!==void 0)return nw.ConfigurationTarget.WORKSPACE;if(e.userRemote?.override!==void 0)return nw.ConfigurationTarget.USER_REMOTE;if(e.userLocal?.override!==void 0)return nw.ConfigurationTarget.USER_LOCAL}return e.memory?.value!==void 0?nw.ConfigurationTarget.MEMORY:e.workspaceFolder?.value!==void 0?nw.ConfigurationTarget.WORKSPACE_FOLDER:e.workspace?.value!==void 0?nw.ConfigurationTarget.WORKSPACE:e.userRemote?.value!==void 0?nw.ConfigurationTarget.USER_REMOTE:nw.ConfigurationTarget.USER_LOCAL}_getValue(e,t,i){let r=e?this.getLanguage(e,t):void 0;return void 0===i?this.configurationService.getValue({resource:e,overrideIdentifier:r}):this.configurationService.getValue(i,{resource:e,overrideIdentifier:r})}inspect(e,t,i){let r=e?this.getLanguage(e,t):void 0;return this.configurationService.inspect(i,{resource:e,overrideIdentifier:r})}getLanguage(e,t){let i=this.modelService.getModel(e);return i?t?i.getLanguageIdAtPosition(t.lineNumber,t.column):i.getLanguageId():this.languageService.guessLanguageIdByFilepathOrFirstLine(e)}toResourceConfigurationChangeEvent(e){return{affectedKeys:e.affectedKeys,affectsConfiguration:(t,i)=>{let r=t?this.getLanguage(t,null):void 0;return!!e.affectsConfiguration(i,{resource:t,overrideIdentifier:r})||!!r&&e.affectedKeys.has(`[${r}]`)}}}};nx=(0,rj.__decorate)([(0,rj.__param)(0,rY.IConfigurationService),(0,rj.__param)(1,rO.IModelService),(0,rj.__param)(2,rA.ILanguageService)],nx);var nD=e.i(2267),nE=e.i(553638),nk=e.i(526097),nT=e.i(853457),nR=e.i(990091),nP=e.i(621826),nI=e.i(474320),nA=e.i(991307),nM=e.i(399362),nL=e.i(506986),nF=e.i(107700),nO=e.i(425024),nN=e.i(4160);let n$=".vscode",nH="settings",nU=`${n$}/${nH}.json`,nW="vscode://schemas/settings/workspace",nq=[nD.ConfigurationScope.APPLICATION,nD.ConfigurationScope.APPLICATION_MACHINE],nj=[nD.ConfigurationScope.MACHINE,nD.ConfigurationScope.WINDOW,nD.ConfigurationScope.RESOURCE,nD.ConfigurationScope.LANGUAGE_OVERRIDABLE,nD.ConfigurationScope.MACHINE_OVERRIDABLE],nz=[nD.ConfigurationScope.WINDOW,nD.ConfigurationScope.RESOURCE,nD.ConfigurationScope.LANGUAGE_OVERRIDABLE],nK=[nD.ConfigurationScope.APPLICATION,...nz],nV=[nD.ConfigurationScope.MACHINE,nD.ConfigurationScope.APPLICATION_MACHINE,nD.ConfigurationScope.WINDOW,nD.ConfigurationScope.RESOURCE,nD.ConfigurationScope.LANGUAGE_OVERRIDABLE,nD.ConfigurationScope.MACHINE_OVERRIDABLE],nB=[nD.ConfigurationScope.WINDOW,nD.ConfigurationScope.RESOURCE,nD.ConfigurationScope.LANGUAGE_OVERRIDABLE,nD.ConfigurationScope.MACHINE_OVERRIDABLE],nG=[nD.ConfigurationScope.RESOURCE,nD.ConfigurationScope.LANGUAGE_OVERRIDABLE,nD.ConfigurationScope.MACHINE_OVERRIDABLE],nQ="tasks",nJ="launch",nY=Object.create(null);nY[nQ]=`${n$}/${nQ}.json`,nY[nJ]=`${n$}/${nJ}.json`,nY.mcp=`${n$}/mcp.json`;let nX=Object.create(null);nX[nQ]=`${nQ}.json`,nX.mcp="mcp.json";let nZ="workbench.settings.applyToAllProfiles";var n0=e.i(608326),n1=e.i(888961),n2=rC,n6=e.i(399119),n3=e.i(367835);let n4=nP.Registry.as(nN.Extensions.JSONContribution),n5=nP.Registry.as(nD.Extensions.Configuration),n8={type:"object",defaultSnippets:[{body:{title:"",properties:{}}}],properties:{title:{description:(0,oh.localize)(2626,"A title for the current category of settings. This label will be rendered in the Settings editor as a subheading. If the title is the same as the extension display name, then the category will be grouped under the main extension heading."),type:"string"},order:{description:(0,oh.localize)(2627,"When specified, gives the order of this category of settings relative to other categories."),type:"integer"},properties:{description:(0,oh.localize)(2628,"Description of the configuration properties."),type:"object",propertyNames:{pattern:"\\S+",patternErrorMessage:(0,oh.localize)(2629,"Property should not be empty.")},additionalProperties:{anyOf:[{title:(0,oh.localize)(2630,"Schema of the configuration property."),$ref:"http://json-schema.org/draft-07/schema#"},{type:"object",properties:{scope:{type:"string",enum:["application","machine","window","resource","language-overridable","machine-overridable"],default:"window",enumDescriptions:[(0,oh.localize)(2631,"Configuration that can be configured only in the user settings."),(0,oh.localize)(2632,"Configuration that can be configured only in the user settings or only in the remote settings."),(0,oh.localize)(2633,"Configuration that can be configured in the user, remote or workspace settings."),(0,oh.localize)(2634,"Configuration that can be configured in the user, remote, workspace or folder settings."),(0,oh.localize)(2635,"Resource configuration that can be configured in language specific settings."),(0,oh.localize)(2636,"Machine configuration that can be configured also in workspace or folder settings.")],markdownDescription:(0,oh.localize)(2637,"Scope in which the configuration is applicable. Available scopes are `application`, `machine`, `window`, `resource`, and `machine-overridable`.")},enumDescriptions:{type:"array",items:{type:"string"},description:(0,oh.localize)(2638,"Descriptions for enum values")},markdownEnumDescriptions:{type:"array",items:{type:"string"},description:(0,oh.localize)(2639,"Descriptions for enum values in the markdown format.")},enumItemLabels:{type:"array",items:{type:"string"},markdownDescription:(0,oh.localize)(2640,"Labels for enum values to be displayed in the Settings editor. When specified, the {0} values still show after the labels, but less prominently.","`enum`")},markdownDescription:{type:"string",description:(0,oh.localize)(2641,"The description in the markdown format.")},deprecationMessage:{type:"string",description:(0,oh.localize)(2642,"If set, the property is marked as deprecated and the given message is shown as an explanation.")},markdownDeprecationMessage:{type:"string",description:(0,oh.localize)(2643,"If set, the property is marked as deprecated and the given message is shown as an explanation in the markdown format.")},editPresentation:{type:"string",enum:["singlelineText","multilineText"],enumDescriptions:[(0,oh.localize)(2644,"The value will be shown in an inputbox."),(0,oh.localize)(2645,"The value will be shown in a textarea.")],default:"singlelineText",description:(0,oh.localize)(2646,"When specified, controls the presentation format of the string setting.")},order:{type:"integer",description:(0,oh.localize)(2647,"When specified, gives the order of this setting relative to other settings within the same category. Settings with an order property will be placed before settings without this property set.")},ignoreSync:{type:"boolean",description:(0,oh.localize)(2648,"When enabled, Settings Sync will not sync the user value of this configuration by default.")},tags:{type:"array",items:{type:"string",enum:["accessibility","advanced","experimental","telemetry","usesOnlineServices"],enumDescriptions:[(0,oh.localize)(2649,"Accessibility settings"),(0,oh.localize)(2650,"Advanced settings are hidden by default in the Settings editor unless the user chooses to show advanced settings."),(0,oh.localize)(2651,"Experimental settings are subject to change and may be removed in future releases."),(0,oh.localize)(2652,"Preview settings can be used to try out new features before they are finalized."),(0,oh.localize)(2653,"Telemetry settings"),(0,oh.localize)(2654,"Settings that use online services")]},additionalItems:!0,markdownDescription:(0,oh.localize)(2655,"A list of tags under which to place the setting. The tag can then be searched up in the Settings editor. For example, specifying the `experimental` tag allows one to find the setting by searching `@tag:experimental`.")}}}]}}}},n7=nO.ExtensionsRegistry.registerExtensionPoint({extensionPoint:"configurationDefaults",jsonSchema:{$ref:nD.configurationDefaultsSchemaId},canHandleResolver:!0});n7.setHandler((e,{added:i,removed:r})=>{t&&n5.deltaConfiguration(t);let o=t={};if(queueMicrotask(()=>{t===o&&(n5.deltaConfiguration(t),t=void 0)}),r.length){let e=r.map(e=>({overrides:(0,nF.deepClone)(e.value),source:{id:e.description.identifier.value,displayName:e.description.displayName}}));t.removedDefaults=e}if(i.length){let e=n5.getConfigurationProperties(),r=[nD.ConfigurationScope.MACHINE_OVERRIDABLE,nD.ConfigurationScope.WINDOW,nD.ConfigurationScope.RESOURCE,nD.ConfigurationScope.LANGUAGE_OVERRIDABLE],o=i.map(t=>{let i=(0,nF.deepClone)(t.value);for(let o of Object.keys(i)){let n=e[o];if(n?.disallowConfigurationDefault){t.collector.warn((0,oh.localize)(2656,"Cannot register configuration defaults for '{0}'. This setting does not allow contributing configuration defaults.",o)),delete i[o];continue}if(!nD.OVERRIDE_PROPERTY_REGEX.test(o)&&n?.scope&&!r.includes(n.scope)){t.collector.warn((0,oh.localize)(2657,"Cannot register configuration defaults for '{0}'. Only defaults for machine-overridable, window, resource and language overridable scoped settings are supported.",o)),delete i[o];continue}}return{overrides:i,source:{id:t.description.identifier.value,displayName:t.description.displayName}}});t.addedDefaults=o}});let n9=nO.ExtensionsRegistry.registerExtensionPoint({extensionPoint:"configuration",deps:[n7],jsonSchema:{description:(0,oh.localize)(2658,"Contributes configuration settings."),oneOf:[n8,{type:"array",items:n8}]},canHandleResolver:!0}),se=new n0.ExtensionIdentifierMap;n9.setHandler((e,{added:i,removed:r})=>{if(t??={},r.length){let e=[];for(let t of r)e.push(...se.get(t.description.identifier)||[]),se.delete(t.description.identifier);t.removedConfigurations=e}let o=new Set;function n(e,t){let i=(0,nF.deepClone)(e);return i.title&&"string"!=typeof i.title&&t.collector.error((0,oh.localize)(2659,"'configuration.title' must be a string")),function e(t,i){let r=t.properties,n=n3.default.extensionConfigurationPolicy;if(r)for(let e in"object"!=typeof r&&(i.collector.error((0,oh.localize)(2660,"'configuration.properties' must be an object")),t.properties={}),r){let t=r[e],s=(0,nD.validateProperty)(e,t,i.description.identifier.value);if(s){delete r[e],i.collector.warn(s);continue}if(o.has(e)&&!nD.EXTENSION_UNIFICATION_EXTENSION_IDS.has(i.description.identifier.value.toLowerCase())){delete r[e],i.collector.warn((0,oh.localize)(2661,"Cannot register '{0}'. This property is already registered.",e));continue}if(!(0,o1.isObject)(t)){delete r[e],i.collector.error((0,oh.localize)(2662,"configuration.properties property '{0}' must be an object",e));continue}n?.[e]&&(t.policy=n?.[e]),t.tags?.some(e=>"onexp"===e.toLowerCase())&&(t.experiment={mode:"startup"}),o.add(e),t.scope=t.scope?(0,nD.parseScope)(t.scope.toString()):nD.ConfigurationScope.WINDOW}let s=t.allOf;if(s)for(let t of(i.collector.error((0,oh.localize)(2663,"'configuration.allOf' is deprecated and should no longer be used. Instead, pass multiple configuration sections as an array to the 'configuration' contribution point.")),s))e(t,i)}(i,t),i.id=e.id||t.description.identifier.value,i.extensionInfo={id:t.description.identifier.value,displayName:t.description.displayName},i.restrictedProperties=t.description.capabilities?.untrustedWorkspaces?.supported==="limited"?t.description.capabilities?.untrustedWorkspaces.restrictedConfigurations:void 0,i.title=i.title||t.description.displayName||t.description.identifier.value,i}if(i.length){let e=[];for(let t of i){let i=[],r=t.value;Array.isArray(r)?r.forEach(e=>i.push(n(e,t))):i.push(n(r,t)),se.set(t.description.identifier,i),e.push(...i)}t.addedConfigurations=e}n5.deltaConfiguration(t),t=void 0}),n4.registerSchema("vscode://schemas/workspaceConfig",{allowComments:!0,allowTrailingCommas:!0,default:{folders:[{path:""}],settings:{}},required:["folders"],properties:{folders:{minItems:0,uniqueItems:!0,description:(0,oh.localize)(2664,"List of folders to be loaded in the workspace."),items:{type:"object",defaultSnippets:[{body:{path:"$1"}}],oneOf:[{properties:{path:{type:"string",description:(0,oh.localize)(2665,"A file path. e.g. `/root/folderA` or `./folderA` for a relative path that will be resolved against the location of the workspace file.")},name:{type:"string",description:(0,oh.localize)(2666,"An optional name for the folder. ")}},required:["path"]},{properties:{uri:{type:"string",description:(0,oh.localize)(2667,"URI of the folder")},name:{type:"string",description:(0,oh.localize)(2666,"An optional name for the folder. ")}},required:["uri"]}]}},settings:{type:"object",default:{},description:(0,oh.localize)(2668,"Workspace settings"),$ref:nW},launch:{type:"object",default:{configurations:[],compounds:[]},description:(0,oh.localize)(2669,"Workspace launch configurations"),$ref:"vscode://schemas/launch"},tasks:{type:"object",default:{version:"2.0.0",tasks:[]},description:(0,oh.localize)(2670,"Workspace task configurations"),$ref:"vscode://schemas/tasks"},mcp:{type:"object",default:{inputs:[],servers:{"mcp-server-time":{command:"uvx",args:["mcp_server_time","--local-timezone=America/Los_Angeles"]}}},description:(0,oh.localize)(2671,"Model Context Protocol server configurations"),$ref:"vscode://schemas/mcp"},extensions:{type:"object",default:{},description:(0,oh.localize)(2672,"Workspace extensions"),$ref:"vscode://schemas/extensions"},remoteAuthority:{type:"string",doNotSuggest:!0,description:(0,oh.localize)(2673,"The remote server where the workspace is located.")},transient:{type:"boolean",doNotSuggest:!0,description:(0,oh.localize)(2674,"A transient workspace will disappear when restarting or reloading.")}},errorMessage:(0,oh.localize)(2675,"Unknown workspace configuration property")});class st extends n2.Disposable{constructor(){super(...arguments),this.type="table"}shouldRender(e){return!!e.contributes?.configuration}render(e){let t=e.contributes?.configuration?Array.isArray(e.contributes.configuration)?e.contributes.configuration:[e.contributes.configuration]:[],i=(0,nD.getAllConfigurationProperties)(t),r=i?Object.keys(i):[];return{data:{headers:[(0,oh.localize)(2676,"ID"),(0,oh.localize)(2677,"Description"),(0,oh.localize)(2678,"Default")],rows:r.sort((e,t)=>e.localeCompare(t)).map(e=>[new n6.MarkdownString().appendMarkdown(`\`${e}\``),i[e].markdownDescription?new n6.MarkdownString(i[e].markdownDescription,!1):i[e].description??"",new n6.MarkdownString().appendCodeblock("json",JSON.stringify((0,o1.isUndefined)(i[e].default)?(0,nD.getDefaultValue)(i[e].type):i[e].default,null,2))])},dispose:()=>{}}}}nP.Registry.as(n1.Extensions.ExtensionFeaturesRegistry).registerExtensionFeature({id:"configuration",label:(0,oh.localize)(2679,"Settings"),access:{canToggle:!1},renderer:new nk.SyncDescriptor(st)});class si extends n2.Disposable{constructor(){super(...arguments),this.type="table"}shouldRender(e){return!!e.contributes?.configurationDefaults}render(e){let t=e.contributes?.configurationDefaults??{},i=[(0,oh.localize)(2680,"Languages"),(0,oh.localize)(2681,"Setting"),(0,oh.localize)(2682,"Override Value")],r=[];for(let e of Object.keys(t).sort((e,t)=>e.localeCompare(t))){let i=t[e];if(nD.OVERRIDE_PROPERTY_REGEX.test(e)){let t=(0,nD.overrideIdentifiersFromKey)(e),o=new n6.MarkdownString().appendMarkdown(`${t.join(", ")}`);for(let e of Object.keys(i).sort((e,t)=>e.localeCompare(t))){let t=[];t.push(o),t.push(new n6.MarkdownString().appendMarkdown(`\`${e}\``)),t.push(new n6.MarkdownString().appendCodeblock("json",JSON.stringify(i[e],null,2))),r.push(t)}}else{let t=[];t.push(""),t.push(new n6.MarkdownString().appendMarkdown(`\`${e}\``)),t.push(new n6.MarkdownString().appendCodeblock("json",JSON.stringify(i,null,2))),r.push(t)}}return{data:{headers:i,rows:r},dispose:()=>{}}}}nP.Registry.as(n1.Extensions.ExtensionFeaturesRegistry).registerExtensionFeature({id:"configurationDefaults",label:(0,oh.localize)(2683,"Settings Default Overrides"),access:{canToggle:!1},renderer:new nk.SyncDescriptor(si)});var sr=e.i(697786),so=e.i(683578),sn=e.i(578953),ss=rC,sa=e.i(216822),sl=e.i(975445),sc=e.i(693162),sd=e.i(74304),su=e.i(428048),sh=e.i(701575),sg=e.i(140889),sp=e.i(927718),sm=oi,sf=e.i(856884),sv=e.i(51593),s_=e.i(770326);let sy=class extends ss.Disposable{constructor(e,t,i,r,o,n){super(),this.contextService=e,this.notificationService=t,this.fileService=i,this.quickInputService=r,this.hostService=o,this.storageService=n,this.findWorkspaces()}async findWorkspaces(){let e=this.contextService.getWorkspace().folders[0];if(!e||this.contextService.getWorkbenchState()!==sn.WorkbenchState.FOLDER||(0,sp.isVirtualWorkspace)(this.contextService.getWorkspace()))return;let t=(await this.fileService.resolve(e.uri)).children?.map(e=>e.name);if(Array.isArray(t)){let i=t.filter(sn.hasWorkspaceFileExtension);i.length>0&&this.doHandleWorkspaceFiles(e.uri,i)}}doHandleWorkspaceFiles(e,t){let i={id:"workspaces.dontPromptToOpen",scope:sa.NeverShowAgainScope.WORKSPACE,isSecondary:!0};if(1===t.length){let r=t[0];this.notificationService.prompt(s_.default.Info,(0,oh.localize)(13579,"This folder contains a workspace file '{0}'. Do you want to open it? [Learn more]({1}) about workspace files.",r,"https://go.microsoft.com/fwlink/?linkid=2025315"),[{label:(0,oh.localize)(13580,"Open Workspace"),run:()=>this.hostService.openWindow([{workspaceUri:(0,sc.joinPath)(e,r)}])}],{neverShowAgain:i,priority:this.storageService.isNew(sh.StorageScope.WORKSPACE)?sa.NotificationPriority.OPTIONAL:sa.NotificationPriority.SILENT})}else t.length>1&&this.notificationService.prompt(s_.default.Info,(0,oh.localize)(13581,"This folder contains multiple workspace files. Do you want to open one? [Learn more]({0}) about workspace files.","https://go.microsoft.com/fwlink/?linkid=2025315"),[{label:(0,oh.localize)(13582,"Select Workspace"),run:()=>{this.quickInputService.pick(t.map(e=>({label:e})),{placeHolder:(0,oh.localize)(13583,"Select a workspace to open")}).then(t=>{t&&this.hostService.openWindow([{workspaceUri:(0,sc.joinPath)(e,t.label)}])})}}],{neverShowAgain:i,priority:this.storageService.isNew(sh.StorageScope.WORKSPACE)?sa.NotificationPriority.OPTIONAL:sa.NotificationPriority.SILENT})}};sy=(0,rj.__decorate)([(0,rj.__param)(0,nM.IWorkspaceContextService),(0,rj.__param)(1,sl.INotificationService),(0,rj.__param)(2,nE.IFileService),(0,rj.__param)(3,su.IQuickInputService),(0,rj.__param)(4,sd.IHostService),(0,rj.__param)(5,sg.IStorageService)],sy),nP.Registry.as(sr.Extensions.Workbench).registerWorkbenchContribution(sy,so.LifecyclePhase.Eventually),(0,sm.registerAction2)(class extends sm.Action2{constructor(){super({id:"workbench.action.openWorkspaceFromEditor",title:(0,oh.localize2)(13580,"Open Workspace"),f1:!1,menu:{id:sm.MenuId.EditorContent,when:oo.ContextKeyExpr.and(sf.ResourceContextKey.Extension.isEqualTo(sn.WORKSPACE_SUFFIX),sf.ActiveEditorContext.isEqualTo(sv.TEXT_FILE_EDITOR_ID),sf.TemporaryWorkspaceContext.toNegated())}})}async run(e,t){let i=e.get(sd.IHostService),r=e.get(nM.IWorkspaceContextService),o=e.get(sl.INotificationService);if(r.getWorkbenchState()===sn.WorkbenchState.WORKSPACE){let e=r.getWorkspace().configuration;if(e&&(0,sc.isEqual)(e,t))return void o.info((0,oh.localize)(13584,"This workspace is already open."))}return i.openWindow([{workspaceUri:t}])}});var sC=e.i(802186),sS=rC,sb=e.i(590746),sw=sn,sx=e.i(737917),sD=e.i(378442),sE=sx;class sk extends sE.ConfigurationModelParser{constructor(e,t){super(e,t),this._folders=[],this._transient=!1,this._settingsModelParser=new sE.ConfigurationModelParser(e,t),this._launchModel=sE.ConfigurationModel.createEmptyModel(t),this._tasksModel=sE.ConfigurationModel.createEmptyModel(t)}get folders(){return this._folders}get transient(){return this._transient}get settingsModel(){return this._settingsModelParser.configurationModel}get launchModel(){return this._launchModel}get tasksModel(){return this._tasksModel}reparseWorkspaceSettings(e){this._settingsModelParser.reparse(e)}getRestrictedWorkspaceSettings(){return this._settingsModelParser.restrictedConfigurations}doParseRaw(e,t){return this._folders=e.folders||[],this._transient=(0,o1.isBoolean)(e.transient)&&e.transient,this._settingsModelParser.parseRaw(e.settings,t),this._launchModel=this.createConfigurationModelFrom(e,"launch"),this._tasksModel=this.createConfigurationModelFrom(e,"tasks"),super.doParseRaw(e,t)}createConfigurationModelFrom(e,t){let i=e[t];if(i){let e=(0,nw.toValuesTree)(i,e=>console.error(`Conflict in settings file ${this._name}: ${e}`)),r=Object.create(null);r[t]=e;let o=Object.keys(i).map(e=>`${t}.${e}`);return new sE.ConfigurationModel(r,o,[],void 0,this.logService)}return sE.ConfigurationModel.createEmptyModel(this.logService)}}class sT extends sE.ConfigurationModelParser{constructor(e,t,i){super(e,i),this.scope=t}doParseRaw(e,t){let i=(0,nw.toValuesTree)(e,e=>console.error(`Conflict in settings file ${this._name}: ${e}`)),r=Object.create(null);return r[this.scope]=i,{contents:r,keys:Object.keys(e).map(e=>`${this.scope}.${e}`),overrides:[]}}}class sR extends sE.Configuration{constructor(e,t,i,r,o,n,s,a,l,c,d){super(e,t,i,r,o,n,s,a,l,d),this._workspace=c}getValue(e,t={}){return super.getValue(e,t,this._workspace)}inspect(e,t={}){return super.inspect(e,t,this._workspace)}keys(){return super.keys(this._workspace)}compareAndDeleteFolderConfiguration(e){return this._workspace&&this._workspace.folders.length>0&&this._workspace.folders[0].uri.toString()===e.toString()?{keys:[],overrides:[]}:super.compareAndDeleteFolderConfiguration(e)}compare(e){let t=(t,i,r)=>{let o=[];return o.push(...i.filter(e=>-1===t.indexOf(e))),o.push(...t.filter(e=>-1===i.indexOf(e))),o.push(...t.filter(t=>-1!==i.indexOf(t)&&(!(0,nF.equals)(this.getValue(t,{overrideIdentifier:r}),e.getValue(t,{overrideIdentifier:r}))||this._workspace&&this._workspace.folders.some(i=>!(0,nF.equals)(this.getValue(t,{resource:i.uri,overrideIdentifier:r}),e.getValue(t,{resource:i.uri,overrideIdentifier:r})))))),o},i=t(this.allKeys(),e.allKeys()),r=[];for(let i of(0,oL.distinct)([...this.allOverrideIdentifiers(),...e.allOverrideIdentifiers()])){let o=t(this.getAllKeysForOverrideIdentifier(i),e.getAllKeysForOverrideIdentifier(i),i);o.length&&r.push([i,o])}return{keys:i,overrides:r}}}var sP=e.i(95940),sI=e.i(292608),sA=e.i(242671),sM=e.i(170774),sL=e.i(386567),sF=e.i(652731),sO=e.i(905670),sN=e.i(362361),s$=e.i(509046),sH=e.i(315380),sU=e.i(17607),sW=oO,sq=e.i(951129);(E=N||(N={}))[E.ERROR_UNKNOWN_KEY=0]="ERROR_UNKNOWN_KEY",E[E.ERROR_INVALID_WORKSPACE_CONFIGURATION_APPLICATION=1]="ERROR_INVALID_WORKSPACE_CONFIGURATION_APPLICATION",E[E.ERROR_INVALID_WORKSPACE_CONFIGURATION_MACHINE=2]="ERROR_INVALID_WORKSPACE_CONFIGURATION_MACHINE",E[E.ERROR_INVALID_FOLDER_CONFIGURATION=3]="ERROR_INVALID_FOLDER_CONFIGURATION",E[E.ERROR_INVALID_USER_TARGET=4]="ERROR_INVALID_USER_TARGET",E[E.ERROR_INVALID_WORKSPACE_TARGET=5]="ERROR_INVALID_WORKSPACE_TARGET",E[E.ERROR_INVALID_FOLDER_TARGET=6]="ERROR_INVALID_FOLDER_TARGET",E[E.ERROR_INVALID_RESOURCE_LANGUAGE_CONFIGURATION=7]="ERROR_INVALID_RESOURCE_LANGUAGE_CONFIGURATION",E[E.ERROR_NO_WORKSPACE_OPENED=8]="ERROR_NO_WORKSPACE_OPENED",E[E.ERROR_CONFIGURATION_FILE_DIRTY=9]="ERROR_CONFIGURATION_FILE_DIRTY",E[E.ERROR_CONFIGURATION_FILE_MODIFIED_SINCE=10]="ERROR_CONFIGURATION_FILE_MODIFIED_SINCE",E[E.ERROR_INVALID_CONFIGURATION=11]="ERROR_INVALID_CONFIGURATION",E[E.ERROR_POLICY_CONFIGURATION=12]="ERROR_POLICY_CONFIGURATION",E[E.ERROR_INTERNAL=13]="ERROR_INTERNAL";class sj extends sW.ErrorNoTelemetry{constructor(e,t){super(e),this.code=t}}(k=$||($={}))[k.USER_LOCAL=1]="USER_LOCAL",k[k.USER_REMOTE=2]="USER_REMOTE",k[k.WORKSPACE=3]="WORKSPACE",k[k.WORKSPACE_FOLDER=4]="WORKSPACE_FOLDER";let sz=class{constructor(e,t,i,r,o,n,s,a,l,c,d,u,h){this.remoteSettingsResource=e,this.configurationService=t,this.contextService=i,this.userDataProfileService=r,this.userDataProfilesService=o,this.fileService=n,this.textModelResolverService=s,this.textFileService=a,this.notificationService=l,this.preferencesService=c,this.editorService=d,this.uriIdentityService=u,this.filesConfigurationService=h,this.queue=new sb.Queue}async writeConfiguration(e,t,i={}){let r=this.getConfigurationEditOperation(e,t,i.scopes||{});return this.queue.queue(async()=>{try{await this.doWriteConfiguration(r,i)}catch(e){if(i.donotNotifyError)throw e;await this.onError(e,r,i.scopes)}})}async doWriteConfiguration(e,t){await this.validate(e.target,e,!t.handleDirtyFile,t.scopes||{});let i=e.resource,r=await this.resolveModelReference(i);try{let i=this.getFormattingOptions(r.object.textEditorModel);await this.updateConfiguration(e,r.object.textEditorModel,i,t)}finally{r.dispose()}}async updateConfiguration(e,t,i,r){if(this.hasParseErrors(t.getValue(),e))throw this.toConfigurationEditingError(N.ERROR_INVALID_CONFIGURATION,e.target,e);if(this.textFileService.isDirty(t.uri)&&r.handleDirtyFile)switch(r.handleDirtyFile){case"save":await this.save(t,e);break;case"revert":await this.textFileService.revert(t.uri)}let o=this.getEdits(e,t.getValue(),i)[0];if(o){let i;try{i=this.filesConfigurationService.enableAutoSaveAfterShortDelay(t.uri),this.applyEditsToBuffer(o,t)&&await this.save(t,e)}finally{i?.dispose()}}}async save(e,t){try{await this.textFileService.save(e.uri,{ignoreErrorHandler:!0})}catch(e){if(e.fileOperationResult===sF.FileOperationResult.FILE_MODIFIED_SINCE)throw this.toConfigurationEditingError(N.ERROR_CONFIGURATION_FILE_MODIFIED_SINCE,t.target,t);throw new sj((0,oh.localize)(13758,"Error while writing to {0}. {1}",this.stringifyTarget(t.target),e.message),N.ERROR_INTERNAL)}}applyEditsToBuffer(e,t){let i=t.getPositionAt(e.offset),r=t.getPositionAt(e.offset+e.length),o=new oX.Range(i.lineNumber,i.column,r.lineNumber,r.column),n=t.getValueInRange(o);if(e.content!==n){let r=n?sH.EditOperation.replace(o,e.content):sH.EditOperation.insert(i,e.content);return t.pushEditOperations([new oU.Selection(i.lineNumber,i.column,i.lineNumber,i.column)],[r],()=>[]),!0}return!1}getEdits({value:e,jsonPath:t},i,r){return t.length?(0,sA.setProperty)(i,t,e,r):[{content:JSON.stringify(e,null,r.insertSpaces&&r.tabSize?" ".repeat(r.tabSize):" "),length:i.length,offset:0}]}getFormattingOptions(e){let{insertSpaces:t,tabSize:i}=e.getOptions();return{insertSpaces:t,tabSize:i,eol:e.getEOL()}}async onError(e,t,i){switch(e.code){case N.ERROR_INVALID_CONFIGURATION:this.onInvalidConfigurationError(e,t);break;case N.ERROR_CONFIGURATION_FILE_DIRTY:this.onConfigurationFileDirtyError(e,t,i);break;case N.ERROR_CONFIGURATION_FILE_MODIFIED_SINCE:return this.doWriteConfiguration(t,{scopes:i,handleDirtyFile:"revert"});default:this.notificationService.error(e.message)}}onInvalidConfigurationError(e,t){let i=t.workspaceStandAloneConfigurationKey===nQ?(0,oh.localize)(13759,"Open Tasks Configuration"):t.workspaceStandAloneConfigurationKey===nJ?(0,oh.localize)(13760,"Open Launch Configuration"):"mcp"===t.workspaceStandAloneConfigurationKey?(0,oh.localize)(13761,"Open MCP Configuration"):null;i?this.notificationService.prompt(s_.default.Error,e.message,[{label:i,run:()=>this.openFile(t.resource)}]):this.notificationService.prompt(s_.default.Error,e.message,[{label:(0,oh.localize)(13762,"Open Settings"),run:()=>this.openSettings(t)}])}onConfigurationFileDirtyError(e,t,i){let r=t.workspaceStandAloneConfigurationKey===nQ?(0,oh.localize)(13759,"Open Tasks Configuration"):t.workspaceStandAloneConfigurationKey===nJ?(0,oh.localize)(13760,"Open Launch Configuration"):null;r?this.notificationService.prompt(s_.default.Error,e.message,[{label:(0,oh.localize)(13763,"Save and Retry"),run:()=>{let e=t.key?`${t.workspaceStandAloneConfigurationKey}.${t.key}`:t.workspaceStandAloneConfigurationKey;this.writeConfiguration(t.target,{key:e,value:t.value},{handleDirtyFile:"save",scopes:i})}},{label:r,run:()=>this.openFile(t.resource)}]):this.notificationService.prompt(s_.default.Error,e.message,[{label:(0,oh.localize)(13763,"Save and Retry"),run:()=>this.writeConfiguration(t.target,{key:t.key,value:t.value},{handleDirtyFile:"save",scopes:i})},{label:(0,oh.localize)(13762,"Open Settings"),run:()=>this.openSettings(t)}])}openSettings(e){let t={jsonEditor:!0};switch(e.target){case $.USER_LOCAL:this.preferencesService.openUserSettings(t);break;case $.USER_REMOTE:this.preferencesService.openRemoteSettings(t);break;case $.WORKSPACE:this.preferencesService.openWorkspaceSettings(t);break;case $.WORKSPACE_FOLDER:if(e.resource){let t=this.contextService.getWorkspaceFolder(e.resource);t&&this.preferencesService.openFolderSettings({folderUri:t.uri,jsonEditor:!0})}}}openFile(e){this.editorService.openEditor({resource:e,options:{pinned:!0}})}toConfigurationEditingError(e,t,i){return new sj(this.toErrorMessage(e,t,i),e)}toErrorMessage(e,t,i){switch(e){case N.ERROR_POLICY_CONFIGURATION:return(0,oh.localize)(13764,"Unable to write {0} because it is configured in system policy.",i.key);case N.ERROR_UNKNOWN_KEY:return(0,oh.localize)(13765,"Unable to write to {0} because {1} is not a registered configuration.",this.stringifyTarget(t),i.key);case N.ERROR_INVALID_WORKSPACE_CONFIGURATION_APPLICATION:return(0,oh.localize)(13766,"Unable to write {0} to Workspace Settings. This setting can be written only into User settings.",i.key);case N.ERROR_INVALID_WORKSPACE_CONFIGURATION_MACHINE:return(0,oh.localize)(13767,"Unable to write {0} to Workspace Settings. This setting can be written only into User settings.",i.key);case N.ERROR_INVALID_FOLDER_CONFIGURATION:return(0,oh.localize)(13768,"Unable to write to Folder Settings because {0} does not support the folder resource scope.",i.key);case N.ERROR_INVALID_USER_TARGET:return(0,oh.localize)(13769,"Unable to write to User Settings because {0} does not support for global scope.",i.key);case N.ERROR_INVALID_WORKSPACE_TARGET:return(0,oh.localize)(13770,"Unable to write to Workspace Settings because {0} does not support for workspace scope in a multi folder workspace.",i.key);case N.ERROR_INVALID_FOLDER_TARGET:return(0,oh.localize)(13771,"Unable to write to Folder Settings because no resource is provided.");case N.ERROR_INVALID_RESOURCE_LANGUAGE_CONFIGURATION:return(0,oh.localize)(13772,"Unable to write to Language Settings because {0} is not a resource language setting.",i.key);case N.ERROR_NO_WORKSPACE_OPENED:return(0,oh.localize)(13773,"Unable to write to {0} because no workspace is opened. Please open a workspace first and try again.",this.stringifyTarget(t));case N.ERROR_INVALID_CONFIGURATION:if(i.workspaceStandAloneConfigurationKey===nQ)return(0,oh.localize)(13774,"Unable to write into the tasks configuration file. Please open it to correct errors/warnings in it and try again.");if(i.workspaceStandAloneConfigurationKey===nJ)return(0,oh.localize)(13775,"Unable to write into the launch configuration file. Please open it to correct errors/warnings in it and try again.");if("mcp"===i.workspaceStandAloneConfigurationKey)return(0,oh.localize)(13776,"Unable to write into the MCP configuration file. Please open it to correct errors/warnings in it and try again.");switch(t){case $.USER_LOCAL:return(0,oh.localize)(13777,"Unable to write into user settings. Please open the user settings to correct errors/warnings in it and try again.");case $.USER_REMOTE:return(0,oh.localize)(13778,"Unable to write into remote user settings. Please open the remote user settings to correct errors/warnings in it and try again.");case $.WORKSPACE:return(0,oh.localize)(13779,"Unable to write into workspace settings. Please open the workspace settings to correct errors/warnings in the file and try again.");case $.WORKSPACE_FOLDER:{let e="<<unknown>>";if(i.resource){let t=this.contextService.getWorkspaceFolder(i.resource);t&&(e=t.name)}return(0,oh.localize)(13780,"Unable to write into folder settings. Please open the '{0}' folder settings to correct errors/warnings in it and try again.",e)}default:return""}case N.ERROR_CONFIGURATION_FILE_DIRTY:if(i.workspaceStandAloneConfigurationKey===nQ)return(0,oh.localize)(13781,"Unable to write into tasks configuration file because the file has unsaved changes. Please save it first and then try again.");if(i.workspaceStandAloneConfigurationKey===nJ)return(0,oh.localize)(13782,"Unable to write into launch configuration file because the file has unsaved changes. Please save it first and then try again.");if("mcp"===i.workspaceStandAloneConfigurationKey)return(0,oh.localize)(13783,"Unable to write into MCP configuration file because the file has unsaved changes. Please save it first and then try again.");switch(t){case $.USER_LOCAL:return(0,oh.localize)(13784,"Unable to write into user settings because the file has unsaved changes. Please save the user settings file first and then try again.");case $.USER_REMOTE:return(0,oh.localize)(13785,"Unable to write into remote user settings because the file has unsaved changes. Please save the remote user settings file first and then try again.");case $.WORKSPACE:return(0,oh.localize)(13786,"Unable to write into workspace settings because the file has unsaved changes. Please save the workspace settings file first and then try again.");case $.WORKSPACE_FOLDER:{let e="<<unknown>>";if(i.resource){let t=this.contextService.getWorkspaceFolder(i.resource);t&&(e=t.name)}return(0,oh.localize)(13787,"Unable to write into folder settings because the file has unsaved changes. Please save the '{0}' folder settings file first and then try again.",e)}default:return""}case N.ERROR_CONFIGURATION_FILE_MODIFIED_SINCE:if(i.workspaceStandAloneConfigurationKey===nQ)return(0,oh.localize)(13788,"Unable to write into tasks configuration file because the content of the file is newer.");if(i.workspaceStandAloneConfigurationKey===nJ)return(0,oh.localize)(13789,"Unable to write into launch configuration file because the content of the file is newer.");if("mcp"===i.workspaceStandAloneConfigurationKey)return(0,oh.localize)(13790,"Unable to write into MCP configuration file because the content of the file is newer.");switch(t){case $.USER_LOCAL:return(0,oh.localize)(13791,"Unable to write into user settings because the content of the file is newer.");case $.USER_REMOTE:return(0,oh.localize)(13792,"Unable to write into remote user settings because the content of the file is newer.");case $.WORKSPACE:return(0,oh.localize)(13793,"Unable to write into workspace settings because the content of the file is newer.");case $.WORKSPACE_FOLDER:return(0,oh.localize)(13794,"Unable to write into folder settings because the content of the file is newer.")}case N.ERROR_INTERNAL:return(0,oh.localize)(13795,"Unable to write to {0} because of an internal error.",this.stringifyTarget(t))}}stringifyTarget(e){switch(e){case $.USER_LOCAL:return(0,oh.localize)(13796,"User Settings");case $.USER_REMOTE:return(0,oh.localize)(13797,"Remote User Settings");case $.WORKSPACE:return(0,oh.localize)(13798,"Workspace Settings");case $.WORKSPACE_FOLDER:return(0,oh.localize)(13799,"Folder Settings");default:return""}}defaultResourceValue(e){let t=this.uriIdentityService.extUri.basename(e);return t.substr(0,t.length-this.uriIdentityService.extUri.extname(e).length)===nQ?'{\n "version": "2.0.0",\n "tasks": []\n}':"{}"}async resolveModelReference(e){return await this.fileService.exists(e)||await this.textFileService.write(e,this.defaultResourceValue(e),{encoding:"utf8"}),this.textModelResolverService.createModelReference(e)}hasParseErrors(e,t){if(t.workspaceStandAloneConfigurationKey&&!t.key)return!1;let i=[];return(0,sI.parse)(e,i,{allowTrailingComma:!0,allowEmptyContent:!0}),i.length>0}async validate(e,t,i,r){if(void 0!==this.configurationService.inspect(t.key).policyValue)throw this.toConfigurationEditingError(N.ERROR_POLICY_CONFIGURATION,e,t);let o=nP.Registry.as(nD.Extensions.Configuration).getConfigurationProperties(),n=o[t.key]?.scope;if(!t.workspaceStandAloneConfigurationKey&&0>this.configurationService.keys().default.indexOf(t.key)&&!nD.OVERRIDE_PROPERTY_REGEX.test(t.key)&&void 0!==t.value)throw this.toConfigurationEditingError(N.ERROR_UNKNOWN_KEY,e,t);if(t.workspaceStandAloneConfigurationKey&&t.workspaceStandAloneConfigurationKey!==nQ&&"mcp"!==t.workspaceStandAloneConfigurationKey&&(e===$.USER_LOCAL||e===$.USER_REMOTE))throw this.toConfigurationEditingError(N.ERROR_INVALID_USER_TARGET,e,t);if((e===$.WORKSPACE||e===$.WORKSPACE_FOLDER)&&this.contextService.getWorkbenchState()===sn.WorkbenchState.EMPTY)throw this.toConfigurationEditingError(N.ERROR_NO_WORKSPACE_OPENED,e,t);if(e===$.WORKSPACE&&!t.workspaceStandAloneConfigurationKey&&!nD.OVERRIDE_PROPERTY_REGEX.test(t.key)){if(n&&nq.includes(n))throw this.toConfigurationEditingError(N.ERROR_INVALID_WORKSPACE_CONFIGURATION_APPLICATION,e,t);if(n===nD.ConfigurationScope.MACHINE)throw this.toConfigurationEditingError(N.ERROR_INVALID_WORKSPACE_CONFIGURATION_MACHINE,e,t)}if(e===$.WORKSPACE_FOLDER){if(!t.resource)throw this.toConfigurationEditingError(N.ERROR_INVALID_FOLDER_TARGET,e,t);if(!t.workspaceStandAloneConfigurationKey&&!nD.OVERRIDE_PROPERTY_REGEX.test(t.key)&&void 0!==n&&!nG.includes(n))throw this.toConfigurationEditingError(N.ERROR_INVALID_FOLDER_CONFIGURATION,e,t)}if(r.overrideIdentifiers?.length&&n!==nD.ConfigurationScope.LANGUAGE_OVERRIDABLE)throw this.toConfigurationEditingError(N.ERROR_INVALID_RESOURCE_LANGUAGE_CONFIGURATION,e,t);if(!t.resource)throw this.toConfigurationEditingError(N.ERROR_INVALID_FOLDER_TARGET,e,t);if(i&&this.textFileService.isDirty(t.resource))throw this.toConfigurationEditingError(N.ERROR_CONFIGURATION_FILE_DIRTY,e,t)}getConfigurationEditOperation(e,t,i){if(t.key){let r=e===$.USER_LOCAL?nX:nY;for(let o of Object.keys(r)){let n=this.getConfigurationFileResource(e,o,r[o],i.resource,void 0);if(t.key===o){let i=this.isWorkspaceConfigurationResource(n)?[o]:[];return{key:i[i.length-1],jsonPath:i,value:t.value,resource:n??void 0,workspaceStandAloneConfigurationKey:o,target:e}}let s=`${o}.`;if(0===t.key.indexOf(s)){let i=this.isWorkspaceConfigurationResource(n)?[o,t.key.substring(s.length)]:[t.key.substring(s.length)];return{key:i[i.length-1],jsonPath:i,value:t.value,resource:n??void 0,workspaceStandAloneConfigurationKey:o,target:e}}}}let r=t.key,o=nP.Registry.as(nD.Extensions.Configuration).getConfigurationProperties(),n=o[r]?.scope,s=i.overrideIdentifiers?.length?[(0,nD.keyFromOverrideIdentifiers)(i.overrideIdentifiers),r]:[r];if(e===$.USER_LOCAL||e===$.USER_REMOTE)return{key:r,jsonPath:s,value:t.value,resource:this.getConfigurationFileResource(e,r,"",null,n)??void 0,target:e};let a=this.getConfigurationFileResource(e,r,nU,i.resource,n);return this.isWorkspaceConfigurationResource(a)&&(s=["settings",...s]),{key:r,jsonPath:s,value:t.value,resource:a??void 0,target:e}}isWorkspaceConfigurationResource(e){let t=this.contextService.getWorkspace();return!!(t.configuration&&e&&t.configuration.fsPath===e.fsPath)}getConfigurationFileResource(e,t,i,r,o){if(e===$.USER_LOCAL)return t===nQ?this.userDataProfileService.currentProfile.tasksResource:"mcp"===t?this.userDataProfileService.currentProfile.mcpResource:!this.userDataProfileService.currentProfile.isDefault&&this.configurationService.isSettingAppliedForAllProfiles(t)?this.userDataProfilesService.defaultProfile.settingsResource:this.userDataProfileService.currentProfile.settingsResource;if(e===$.USER_REMOTE)return this.remoteSettingsResource;let n=this.contextService.getWorkbenchState();if(n!==sn.WorkbenchState.EMPTY){let t=this.contextService.getWorkspace();if(e===$.WORKSPACE){if(n===sn.WorkbenchState.WORKSPACE)return t.configuration??null;if(n===sn.WorkbenchState.FOLDER)return t.folders[0].toResource(i)}if(e===$.WORKSPACE_FOLDER&&r){let e=this.contextService.getWorkspaceFolder(r);if(e)return e.toResource(i)}}return null}};sz=(0,rj.__decorate)([(0,rj.__param)(1,sL.IWorkbenchConfigurationService),(0,rj.__param)(2,nM.IWorkspaceContextService),(0,rj.__param)(3,sU.IUserDataProfileService),(0,rj.__param)(4,nA.IUserDataProfilesService),(0,rj.__param)(5,nE.IFileService),(0,rj.__param)(6,sO.ITextModelService),(0,rj.__param)(7,sM.ITextFileService),(0,rj.__param)(8,sl.INotificationService),(0,rj.__param)(9,s$.IPreferencesService),(0,rj.__param)(10,sN.IEditorService),(0,rj.__param)(11,nI.IUriIdentityService),(0,rj.__param)(12,sq.IFilesConfigurationService)],sz);var sK=rC,sV=sx,sB=e.i(182504),sG=sD;class sQ extends sG.DefaultConfiguration{static{this.DEFAULT_OVERRIDES_CACHE_EXISTS_KEY="DefaultOverridesCacheExists"}constructor(e,t,i){super(i),this.configurationCache=e,this.configurationRegistry=nP.Registry.as(nD.Extensions.Configuration),this.cachedConfigurationDefaultsOverrides={},this.cacheKey={type:"defaults",key:"configurationDefaultsOverrides"},t.options?.configurationDefaults&&this.configurationRegistry.registerDefaultConfigurations([{overrides:t.options.configurationDefaults}])}getConfigurationDefaultOverrides(){return this.cachedConfigurationDefaultsOverrides}async initialize(){return await this.initializeCachedConfigurationDefaultsOverrides(),super.initialize()}reload(){return this.cachedConfigurationDefaultsOverrides={},this.updateCachedConfigurationDefaultsOverrides(),super.reload()}hasCachedConfigurationDefaultsOverrides(){return!(0,o1.isEmptyObject)(this.cachedConfigurationDefaultsOverrides)}initializeCachedConfigurationDefaultsOverrides(){return this.initiaizeCachedConfigurationDefaultsOverridesPromise||(this.initiaizeCachedConfigurationDefaultsOverridesPromise=(async()=>{try{if(localStorage.getItem(sQ.DEFAULT_OVERRIDES_CACHE_EXISTS_KEY)){let e=await this.configurationCache.read(this.cacheKey);e&&(this.cachedConfigurationDefaultsOverrides=JSON.parse(e))}}catch(e){}this.cachedConfigurationDefaultsOverrides=(0,o1.isObject)(this.cachedConfigurationDefaultsOverrides)?this.cachedConfigurationDefaultsOverrides:{}})()),this.initiaizeCachedConfigurationDefaultsOverridesPromise}onDidUpdateConfiguration(e,t){super.onDidUpdateConfiguration(e,t),t&&this.updateCachedConfigurationDefaultsOverrides()}async updateCachedConfigurationDefaultsOverrides(){let e={};for(let[t,i]of this.configurationRegistry.getConfigurationDefaultsOverrides())nD.OVERRIDE_PROPERTY_REGEX.test(t)||void 0===i.value||(e[t]=i.value);try{Object.keys(e).length?(localStorage.setItem(sQ.DEFAULT_OVERRIDES_CACHE_EXISTS_KEY,"yes"),await this.configurationCache.write(this.cacheKey,JSON.stringify(e))):(localStorage.removeItem(sQ.DEFAULT_OVERRIDES_CACHE_EXISTS_KEY),await this.configurationCache.remove(this.cacheKey))}catch(e){}}}class sJ extends sV.UserSettings{constructor(e,t,i,r){super(e.defaultProfile.settingsResource,{scopes:nq,skipUnregistered:!0},i.extUri,t,r),this._onDidChangeConfiguration=this._register(new ol.Emitter),this.onDidChangeConfiguration=this._onDidChangeConfiguration.event,this._register(this.onDidChange(()=>this.reloadConfigurationScheduler.schedule())),this.reloadConfigurationScheduler=this._register(new sb.RunOnceScheduler(()=>this.loadConfiguration().then(e=>this._onDidChangeConfiguration.fire(e)),50))}async initialize(){return this.loadConfiguration()}async loadConfiguration(){let e=await super.loadConfiguration(),t=e.getValue(nZ),i=Array.isArray(t)?t:[];return this.parseOptions.include||i.length?this.reparse({...this.parseOptions,include:i}):e}}class sY extends sK.Disposable{get hasTasksLoaded(){return this.userConfiguration.value instanceof sX}constructor(e,t,i,r,o,n,s){super(),this.settingsResource=e,this.tasksResource=t,this.mcpResource=i,this.configurationParseOptions=r,this.fileService=o,this.uriIdentityService=n,this.logService=s,this._onDidChangeConfiguration=this._register(new ol.Emitter),this.onDidChangeConfiguration=this._onDidChangeConfiguration.event,this.userConfiguration=this._register(new sK.MutableDisposable),this.userConfigurationChangeDisposable=this._register(new sK.MutableDisposable),this.userConfiguration.value=new sV.UserSettings(e,this.configurationParseOptions,n.extUri,this.fileService,s),this.userConfigurationChangeDisposable.value=this.userConfiguration.value.onDidChange(()=>this.reloadConfigurationScheduler.schedule()),this.reloadConfigurationScheduler=this._register(new sb.RunOnceScheduler(()=>this.userConfiguration.value.loadConfiguration().then(e=>this._onDidChangeConfiguration.fire(e)),50))}async reset(e,t,i,r){return this.settingsResource=e,this.tasksResource=t,this.mcpResource=i,this.configurationParseOptions=r,this.doReset()}async doReset(e){let t=this.uriIdentityService.extUri.dirname(this.settingsResource),i=[];this.tasksResource&&i.push([nQ,this.tasksResource]),this.mcpResource&&i.push(["mcp",this.mcpResource]);let r=new sX(t.toString(),this.settingsResource,i,this.configurationParseOptions,this.fileService,this.uriIdentityService,this.logService),o=await r.loadConfiguration(e);return this.userConfiguration.value=r,this.userConfigurationChangeDisposable.value&&(this.userConfigurationChangeDisposable.value=this.userConfiguration.value.onDidChange(()=>this.reloadConfigurationScheduler.schedule())),o}async initialize(){return this.userConfiguration.value.loadConfiguration()}async reload(e){return this.hasTasksLoaded?this.userConfiguration.value.loadConfiguration():this.doReset(e)}reparse(e){return this.configurationParseOptions={...this.configurationParseOptions,...e},this.userConfiguration.value.reparse(this.configurationParseOptions)}getRestrictedSettings(){return this.userConfiguration.value.getRestrictedSettings()}}class sX extends sK.Disposable{constructor(e,t,i,r,o,n,s){super(),this.settingsResource=t,this.standAloneConfigurationResources=i,this.fileService=o,this.uriIdentityService=n,this.logService=s,this._onDidChange=this._register(new ol.Emitter),this.onDidChange=this._onDidChange.event,this.allResources=[this.settingsResource,...this.standAloneConfigurationResources.map(([,e])=>e)],this._register((0,sK.combinedDisposable)(...this.allResources.map(e=>(0,sK.combinedDisposable)(this.fileService.watch(n.extUri.dirname(e)),this.fileService.watch(e))))),this._folderSettingsModelParser=new sV.ConfigurationModelParser(e,s),this._folderSettingsParseOptions=r,this._standAloneConfigurations=[],this._cache=sV.ConfigurationModel.createEmptyModel(this.logService),this._register(ol.Event.debounce(ol.Event.any(ol.Event.filter(this.fileService.onDidFilesChange,e=>this.handleFileChangesEvent(e)),ol.Event.filter(this.fileService.onDidRunOperation,e=>this.handleFileOperationEvent(e))),()=>void 0,100)(()=>this._onDidChange.fire()))}async resolveContents(e){let t=async e=>Promise.all(e.map(async e=>{try{return(await this.fileService.readFile(e,{atomic:!0})).value.toString()}catch(t){this.logService.trace(`Error while resolving configuration file '${e.toString()}': ${(0,oO.getErrorMessage)(t)}`),t.fileOperationResult!==sF.FileOperationResult.FILE_NOT_FOUND&&t.fileOperationResult!==sF.FileOperationResult.FILE_NOT_DIRECTORY&&this.logService.error(t)}return"{}"})),[[i],r]=await Promise.all([e?Promise.resolve([void 0]):t([this.settingsResource]),t(this.standAloneConfigurationResources.map(([,e])=>e))]);return[i,r.map((e,t)=>[this.standAloneConfigurationResources[t][0],e])]}async loadConfiguration(e){let[t,i]=await this.resolveContents(!!e);this._standAloneConfigurations=[],this._folderSettingsModelParser.parse("",this._folderSettingsParseOptions),void 0!==t&&this._folderSettingsModelParser.parse(t,this._folderSettingsParseOptions);for(let e=0;e<i.length;e++){let t=i[e][1];if(void 0!==t){let i=new sT(this.standAloneConfigurationResources[e][1].toString(),this.standAloneConfigurationResources[e][0],this.logService);i.parse(t),this._standAloneConfigurations.push(i.configurationModel)}}return this.consolidate(e),this._cache}getRestrictedSettings(){return this._folderSettingsModelParser.restrictedConfigurations}reparse(e){let t=this._folderSettingsModelParser.configurationModel.contents;return this._folderSettingsParseOptions=e,this._folderSettingsModelParser.reparse(this._folderSettingsParseOptions),(0,nF.equals)(t,this._folderSettingsModelParser.configurationModel.contents)||this.consolidate(),this._cache}consolidate(e){this._cache=(e??this._folderSettingsModelParser.configurationModel).merge(...this._standAloneConfigurations)}handleFileChangesEvent(e){return!!(this.allResources.some(t=>e.contains(t))||this.allResources.some(t=>e.contains(this.uriIdentityService.extUri.dirname(t),sF.FileChangeType.DELETED)))}handleFileOperationEvent(e){return!!((e.isOperation(sF.FileOperation.CREATE)||e.isOperation(sF.FileOperation.COPY)||e.isOperation(sF.FileOperation.DELETE)||e.isOperation(sF.FileOperation.WRITE))&&this.allResources.some(t=>this.uriIdentityService.extUri.isEqual(e.resource,t))||e.isOperation(sF.FileOperation.DELETE)&&this.allResources.some(t=>this.uriIdentityService.extUri.isEqual(e.resource,this.uriIdentityService.extUri.dirname(t))))}}class sZ extends sK.Disposable{constructor(e,t,i,r,o,n){super(),this._userConfigurationInitializationPromise=null,this._onDidChangeConfiguration=this._register(new ol.Emitter),this.onDidChangeConfiguration=this._onDidChangeConfiguration.event,this._onDidInitialize=this._register(new ol.Emitter),this.onDidInitialize=this._onDidInitialize.event,this._fileService=i,this._userConfiguration=this._cachedConfiguration=new s1(e,t,{scopes:nV},n),o.getEnvironment().then(async e=>{if(e){let t=this._register(new s0(e.settingsPath,{scopes:nV},this._fileService,r,n));this._register(t.onDidChangeConfiguration(e=>this.onDidUserConfigurationChange(e))),this._userConfigurationInitializationPromise=t.initialize();let i=await this._userConfigurationInitializationPromise;this._userConfiguration.dispose(),this._userConfiguration=t,this.onDidUserConfigurationChange(i),this._onDidInitialize.fire(i)}})}async initialize(){if(this._userConfiguration instanceof s0)return this._userConfiguration.initialize();let e=await this._userConfiguration.initialize();return this._userConfigurationInitializationPromise&&(e=await this._userConfigurationInitializationPromise,this._userConfigurationInitializationPromise=null),e}reload(){return this._userConfiguration.reload()}reparse(){return this._userConfiguration.reparse({scopes:nV})}getRestrictedSettings(){return this._userConfiguration.getRestrictedSettings()}onDidUserConfigurationChange(e){this.updateCache(),this._onDidChangeConfiguration.fire(e)}async updateCache(){if(this._userConfiguration instanceof s0){let e;try{e=await this._userConfiguration.resolveContent()}catch(e){if(e.fileOperationResult!==sF.FileOperationResult.FILE_NOT_FOUND)return}await this._cachedConfiguration.updateConfiguration(e)}}}class s0 extends sK.Disposable{constructor(e,t,i,r,o){super(),this.configurationResource=e,this.fileService=i,this.uriIdentityService=r,this.logService=o,this._onDidChangeConfiguration=this._register(new ol.Emitter),this.onDidChangeConfiguration=this._onDidChangeConfiguration.event,this.fileWatcherDisposable=this._register(new sK.MutableDisposable),this.directoryWatcherDisposable=this._register(new sK.MutableDisposable),this.parser=new sV.ConfigurationModelParser(this.configurationResource.toString(),o),this.parseOptions=t,this._register(i.onDidFilesChange(e=>this.handleFileChangesEvent(e))),this._register(i.onDidRunOperation(e=>this.handleFileOperationEvent(e))),this.reloadConfigurationScheduler=this._register(new sb.RunOnceScheduler(()=>this.reload().then(e=>this._onDidChangeConfiguration.fire(e)),50)),this._register((0,sK.toDisposable)(()=>{this.stopWatchingResource(),this.stopWatchingDirectory()}))}watchResource(){this.fileWatcherDisposable.value=this.fileService.watch(this.configurationResource)}stopWatchingResource(){this.fileWatcherDisposable.value=void 0}watchDirectory(){let e=this.uriIdentityService.extUri.dirname(this.configurationResource);this.directoryWatcherDisposable.value=this.fileService.watch(e)}stopWatchingDirectory(){this.directoryWatcherDisposable.value=void 0}async initialize(){let e=await this.fileService.exists(this.configurationResource);return this.onResourceExists(e),this.reload()}async resolveContent(){return(await this.fileService.readFile(this.configurationResource,{atomic:!0})).value.toString()}async reload(){try{let e=await this.resolveContent();return this.parser.parse(e,this.parseOptions),this.parser.configurationModel}catch(e){return sV.ConfigurationModel.createEmptyModel(this.logService)}}reparse(e){return this.parseOptions=e,this.parser.reparse(this.parseOptions),this.parser.configurationModel}getRestrictedSettings(){return this.parser.restrictedConfigurations}handleFileChangesEvent(e){let t=!1;e.contains(this.configurationResource,sF.FileChangeType.ADDED)?(t=!0,this.onResourceExists(!0)):e.contains(this.configurationResource,sF.FileChangeType.DELETED)?(t=!0,this.onResourceExists(!1)):e.contains(this.configurationResource,sF.FileChangeType.UPDATED)&&(t=!0),t&&this.reloadConfigurationScheduler.schedule()}handleFileOperationEvent(e){(e.isOperation(sF.FileOperation.CREATE)||e.isOperation(sF.FileOperation.COPY)||e.isOperation(sF.FileOperation.DELETE)||e.isOperation(sF.FileOperation.WRITE))&&this.uriIdentityService.extUri.isEqual(e.resource,this.configurationResource)&&this.reloadConfigurationScheduler.schedule()}onResourceExists(e){e?(this.stopWatchingDirectory(),this.watchResource()):(this.stopWatchingResource(),this.watchDirectory())}}class s1 extends sK.Disposable{constructor(e,t,i,r){super(),this.configurationCache=t,this._onDidChange=this._register(new ol.Emitter),this.onDidChange=this._onDidChange.event,this.key={type:"user",key:e},this.parser=new sV.ConfigurationModelParser("CachedRemoteUserConfiguration",r),this.parseOptions=i,this.configurationModel=sV.ConfigurationModel.createEmptyModel(r)}getConfigurationModel(){return this.configurationModel}initialize(){return this.reload()}reparse(e){return this.parseOptions=e,this.parser.reparse(this.parseOptions),this.configurationModel=this.parser.configurationModel,this.configurationModel}getRestrictedSettings(){return this.parser.restrictedConfigurations}async reload(){try{let e=await this.configurationCache.read(this.key),t=JSON.parse(e);t.content&&(this.parser.parse(t.content,this.parseOptions),this.configurationModel=this.parser.configurationModel)}catch(e){}return this.configurationModel}async updateConfiguration(e){return e?this.configurationCache.write(this.key,JSON.stringify({content:e})):this.configurationCache.remove(this.key)}}class s2 extends sK.Disposable{get initialized(){return this._initialized}constructor(e,t,i,r){super(),this.configurationCache=e,this.fileService=t,this.uriIdentityService=i,this.logService=r,this._workspaceConfigurationDisposables=this._register(new sK.DisposableStore),this._workspaceIdentifier=null,this._isWorkspaceTrusted=!1,this._onDidUpdateConfiguration=this._register(new ol.Emitter),this.onDidUpdateConfiguration=this._onDidUpdateConfiguration.event,this._initialized=!1,this.fileService=t,this._workspaceConfiguration=this._cachedConfiguration=new s3(e,r)}async initialize(e,t){this._workspaceIdentifier=e,this._isWorkspaceTrusted=t,this._initialized||(this.configurationCache.needsCaching(this._workspaceIdentifier.configPath)?(this._workspaceConfiguration=this._cachedConfiguration,this.waitAndInitialize(this._workspaceIdentifier)):this.doInitialize(new s6(this.fileService,this.uriIdentityService,this.logService))),await this.reload()}async reload(){this._workspaceIdentifier&&await this._workspaceConfiguration.load(this._workspaceIdentifier,{scopes:nB,skipRestricted:this.isUntrusted()})}getFolders(){return this._workspaceConfiguration.getFolders()}setFolders(e,t){return this._workspaceIdentifier?t.write(this._workspaceIdentifier.configPath,[{path:["folders"],value:e}],!0).then(()=>this.reload()):Promise.resolve()}isTransient(){return this._workspaceConfiguration.isTransient()}getConfiguration(){return this._workspaceConfiguration.getWorkspaceSettings()}updateWorkspaceTrust(e){return this._isWorkspaceTrusted=e,this.reparseWorkspaceSettings()}reparseWorkspaceSettings(){return this._workspaceConfiguration.reparseWorkspaceSettings({scopes:nB,skipRestricted:this.isUntrusted()}),this.getConfiguration()}getRestrictedSettings(){return this._workspaceConfiguration.getRestrictedSettings()}async waitAndInitialize(e){if(await (0,sF.whenProviderRegistered)(e.configPath,this.fileService),!(this._workspaceConfiguration instanceof s6)){let t=this._register(new s6(this.fileService,this.uriIdentityService,this.logService));await t.load(e,{scopes:nB,skipRestricted:this.isUntrusted()}),this.doInitialize(t),this.onDidWorkspaceConfigurationChange(!1,!0)}}doInitialize(e){this._workspaceConfigurationDisposables.clear(),this._workspaceConfiguration=this._workspaceConfigurationDisposables.add(e),this._workspaceConfigurationDisposables.add(this._workspaceConfiguration.onDidChange(e=>this.onDidWorkspaceConfigurationChange(!0,!1))),this._initialized=!0}isUntrusted(){return!this._isWorkspaceTrusted}async onDidWorkspaceConfigurationChange(e,t){e&&await this.reload(),this.updateCache(),this._onDidUpdateConfiguration.fire(t)}async updateCache(){if(this._workspaceIdentifier&&this.configurationCache.needsCaching(this._workspaceIdentifier.configPath)&&this._workspaceConfiguration instanceof s6){let e=await this._workspaceConfiguration.resolveContent(this._workspaceIdentifier);await this._cachedConfiguration.updateWorkspace(this._workspaceIdentifier,e)}}}class s6 extends sK.Disposable{constructor(e,t,i){super(),this.fileService=e,this.logService=i,this._workspaceIdentifier=null,this._onDidChange=this._register(new ol.Emitter),this.onDidChange=this._onDidChange.event,this.workspaceConfigurationModelParser=new sk("",i),this.workspaceSettings=sV.ConfigurationModel.createEmptyModel(i),this._register(ol.Event.any(ol.Event.filter(this.fileService.onDidFilesChange,e=>!!this._workspaceIdentifier&&e.contains(this._workspaceIdentifier.configPath)),ol.Event.filter(this.fileService.onDidRunOperation,e=>!!this._workspaceIdentifier&&(e.isOperation(sF.FileOperation.CREATE)||e.isOperation(sF.FileOperation.COPY)||e.isOperation(sF.FileOperation.DELETE)||e.isOperation(sF.FileOperation.WRITE))&&t.extUri.isEqual(e.resource,this._workspaceIdentifier.configPath)))(()=>this.reloadConfigurationScheduler.schedule())),this.reloadConfigurationScheduler=this._register(new sb.RunOnceScheduler(()=>this._onDidChange.fire(),50)),this.workspaceConfigWatcher=this._register(this.watchWorkspaceConfigurationFile())}get workspaceIdentifier(){return this._workspaceIdentifier}async resolveContent(e){return(await this.fileService.readFile(e.configPath,{atomic:!0})).value.toString()}async load(e,t){this._workspaceIdentifier&&this._workspaceIdentifier.id===e.id||(this._workspaceIdentifier=e,this.workspaceConfigurationModelParser=new sk(this._workspaceIdentifier.id,this.logService),(0,sK.dispose)(this.workspaceConfigWatcher),this.workspaceConfigWatcher=this._register(this.watchWorkspaceConfigurationFile()));let i="";try{i=await this.resolveContent(this._workspaceIdentifier)}catch(e){await this.fileService.exists(this._workspaceIdentifier.configPath)&&this.logService.error(e)}this.workspaceConfigurationModelParser.parse(i,t),this.consolidate()}getConfigurationModel(){return this.workspaceConfigurationModelParser.configurationModel}getFolders(){return this.workspaceConfigurationModelParser.folders}isTransient(){return this.workspaceConfigurationModelParser.transient}getWorkspaceSettings(){return this.workspaceSettings}reparseWorkspaceSettings(e){return this.workspaceConfigurationModelParser.reparseWorkspaceSettings(e),this.consolidate(),this.getWorkspaceSettings()}getRestrictedSettings(){return this.workspaceConfigurationModelParser.getRestrictedWorkspaceSettings()}consolidate(){this.workspaceSettings=this.workspaceConfigurationModelParser.settingsModel.merge(this.workspaceConfigurationModelParser.launchModel,this.workspaceConfigurationModelParser.tasksModel)}watchWorkspaceConfigurationFile(){return this._workspaceIdentifier?this.fileService.watch(this._workspaceIdentifier.configPath):sK.Disposable.None}}class s3{constructor(e,t){this.configurationCache=e,this.logService=t,this.onDidChange=ol.Event.None,this.workspaceConfigurationModelParser=new sk("",t),this.workspaceSettings=sV.ConfigurationModel.createEmptyModel(t)}async load(e,t){try{let i=this.getKey(e),r=await this.configurationCache.read(i),o=JSON.parse(r);o.content&&(this.workspaceConfigurationModelParser=new sk(i.key,this.logService),this.workspaceConfigurationModelParser.parse(o.content,t),this.consolidate())}catch(e){}}get workspaceIdentifier(){return null}getConfigurationModel(){return this.workspaceConfigurationModelParser.configurationModel}getFolders(){return this.workspaceConfigurationModelParser.folders}isTransient(){return this.workspaceConfigurationModelParser.transient}getWorkspaceSettings(){return this.workspaceSettings}reparseWorkspaceSettings(e){return this.workspaceConfigurationModelParser.reparseWorkspaceSettings(e),this.consolidate(),this.getWorkspaceSettings()}getRestrictedSettings(){return this.workspaceConfigurationModelParser.getRestrictedWorkspaceSettings()}consolidate(){this.workspaceSettings=this.workspaceConfigurationModelParser.settingsModel.merge(this.workspaceConfigurationModelParser.launchModel,this.workspaceConfigurationModelParser.tasksModel)}async updateWorkspace(e,t){try{let i=this.getKey(e);t?await this.configurationCache.write(i,JSON.stringify({content:t})):await this.configurationCache.remove(i)}catch(e){}}getKey(e){return{type:"workspaces",key:e.id}}}class s4{constructor(e,t,i,r,o){this.configurationCache=r,this.logService=o,this.onDidChange=ol.Event.None,this.key={type:"folder",key:(0,sB.hash)((0,sc.joinPath)(e,t).toString()).toString(16)},this._folderSettingsModelParser=new sV.ConfigurationModelParser("CachedFolderConfiguration",o),this._folderSettingsParseOptions=i,this._standAloneConfigurations=[],this.configurationModel=sV.ConfigurationModel.createEmptyModel(o)}async loadConfiguration(){try{let e=await this.configurationCache.read(this.key),{content:t}=JSON.parse(e.toString());if(t)for(let e of Object.keys(t))if(e===nH)this._folderSettingsModelParser.parse(t[e],this._folderSettingsParseOptions);else{let i=new sT(e,e,this.logService);i.parse(t[e]),this._standAloneConfigurations.push(i.configurationModel)}this.consolidate()}catch(e){}return this.configurationModel}async updateConfiguration(e,t){let i={};e&&(i[nH]=e),t.forEach(([e,t])=>{t&&(i[e]=t)}),Object.keys(i).length?await this.configurationCache.write(this.key,JSON.stringify({content:i})):await this.configurationCache.remove(this.key)}getRestrictedSettings(){return this._folderSettingsModelParser.restrictedConfigurations}reparse(e){return this._folderSettingsParseOptions=e,this._folderSettingsModelParser.reparse(this._folderSettingsParseOptions),this.consolidate(),this.configurationModel}consolidate(){this.configurationModel=this._folderSettingsModelParser.configurationModel.merge(...this._standAloneConfigurations)}getUnsupportedKeys(){return[]}}class s5 extends sK.Disposable{constructor(e,t,i,r,o,n,s,a,l){super(),this.workspaceFolder=t,this.workbenchState=r,this.workspaceTrusted=o,this.configurationCache=l,this._onDidChange=this._register(new ol.Emitter),this.onDidChange=this._onDidChange.event,this.scopes=sn.WorkbenchState.WORKSPACE===this.workbenchState?nG:nB,this.configurationFolder=s.extUri.joinPath(t.uri,i),this.cachedFolderConfiguration=new s4(t.uri,i,{scopes:this.scopes,skipRestricted:this.isUntrusted()},l,a),e&&this.configurationCache.needsCaching(t.uri)?(this.folderConfiguration=this.cachedFolderConfiguration,(0,sF.whenProviderRegistered)(t.uri,n).then(()=>{this.folderConfiguration=this._register(this.createFileServiceBasedConfiguration(n,s,a)),this._register(this.folderConfiguration.onDidChange(e=>this.onDidFolderConfigurationChange())),this.onDidFolderConfigurationChange()})):(this.folderConfiguration=this._register(this.createFileServiceBasedConfiguration(n,s,a)),this._register(this.folderConfiguration.onDidChange(e=>this.onDidFolderConfigurationChange())))}loadConfiguration(){return this.folderConfiguration.loadConfiguration()}updateWorkspaceTrust(e){return this.workspaceTrusted=e,this.reparse()}reparse(){let e=this.folderConfiguration.reparse({scopes:this.scopes,skipRestricted:this.isUntrusted()});return this.updateCache(),e}getRestrictedSettings(){return this.folderConfiguration.getRestrictedSettings()}isUntrusted(){return!this.workspaceTrusted}onDidFolderConfigurationChange(){this.updateCache(),this._onDidChange.fire()}createFileServiceBasedConfiguration(e,t,i){let r=t.extUri.joinPath(this.configurationFolder,`${nH}.json`),o=[nQ,nJ,"mcp"].map(e=>[e,t.extUri.joinPath(this.configurationFolder,`${e}.json`)]);return new sX(this.configurationFolder.toString(),r,o,{scopes:this.scopes,skipRestricted:this.isUntrusted()},e,t,i)}async updateCache(){if(this.configurationCache.needsCaching(this.configurationFolder)&&this.folderConfiguration instanceof sX){let[e,t]=await this.folderConfiguration.resolveContents();this.cachedFolderConfiguration.updateConfiguration(e,t)}}}var s8=e.i(40577),s7=e.i(772383),s9=e.i(278725),ae=e.i(431110),at=e.i(168363),ai=e.i(981399),ar=e.i(967602),ao=e.i(169315),an=e.i(254686),as=e.i(803777);function aa(e,t){return e.isDefault||e.useDefaultFlags?.settings?t?nK:void 0:t?nz:nj}class al extends sw.Workspace{constructor(){super(...arguments),this.initialized=!1}}class ac extends sS.Disposable{get restrictedSettings(){return this._restrictedSettings}constructor({remoteAuthority:e,configurationCache:t},i,r,o,n,s,a,l,c){if(super(),this.userDataProfileService=r,this.userDataProfilesService=o,this.fileService=n,this.remoteAgentService=s,this.uriIdentityService=a,this.logService=l,this.initialized=!1,this.applicationConfiguration=null,this.remoteUserConfiguration=null,this._onDidChangeConfiguration=this._register(new ol.Emitter),this.onDidChangeConfiguration=this._onDidChangeConfiguration.event,this._onWillChangeWorkspaceFolders=this._register(new ol.Emitter),this.onWillChangeWorkspaceFolders=this._onWillChangeWorkspaceFolders.event,this._onDidChangeWorkspaceFolders=this._register(new ol.Emitter),this.onDidChangeWorkspaceFolders=this._onDidChangeWorkspaceFolders.event,this._onDidChangeWorkspaceName=this._register(new ol.Emitter),this.onDidChangeWorkspaceName=this._onDidChangeWorkspaceName.event,this._onDidChangeWorkbenchState=this._register(new ol.Emitter),this.onDidChangeWorkbenchState=this._onDidChangeWorkbenchState.event,this.isWorkspaceTrusted=!0,this._restrictedSettings={default:[]},this._onDidChangeRestrictedSettings=this._register(new ol.Emitter),this.onDidChangeRestrictedSettings=this._onDidChangeRestrictedSettings.event,this.configurationRegistry=nP.Registry.as(nD.Extensions.Configuration),this.initRemoteUserConfigurationBarrier=new sb.Barrier,this.completeWorkspaceBarrier=new sb.Barrier,this.defaultConfiguration=this._register(new sQ(t,i,l)),this.policyConfiguration=c instanceof ao.NullPolicyService?new sD.NullPolicyConfiguration:this._register(new sD.PolicyConfiguration(this.defaultConfiguration,c,l)),this.configurationCache=t,this._configuration=new sR(this.defaultConfiguration.configurationModel,this.policyConfiguration.configurationModel,sx.ConfigurationModel.createEmptyModel(l),sx.ConfigurationModel.createEmptyModel(l),sx.ConfigurationModel.createEmptyModel(l),sx.ConfigurationModel.createEmptyModel(l),new sC.ResourceMap,sx.ConfigurationModel.createEmptyModel(l),new sC.ResourceMap,this.workspace,l),this.applicationConfigurationDisposables=this._register(new sS.DisposableStore),this.createApplicationConfiguration(),this.localUserConfiguration=this._register(new sY(r.currentProfile.settingsResource,r.currentProfile.tasksResource,r.currentProfile.mcpResource,{scopes:aa(r.currentProfile,!!e)},n,a,l)),this.cachedFolderConfigs=new sC.ResourceMap,this._register(this.localUserConfiguration.onDidChangeConfiguration(e=>this.onLocalUserConfigurationChanged(e))),e){const i=this.remoteUserConfiguration=this._register(new sZ(e,t,n,a,s,l));this._register(i.onDidInitialize(e=>{this._register(i.onDidChangeConfiguration(e=>this.onRemoteUserConfigurationChanged(e))),this.onRemoteUserConfigurationChanged(e),this.initRemoteUserConfigurationBarrier.open()}))}else this.initRemoteUserConfigurationBarrier.open();this.workspaceConfiguration=this._register(new s2(t,n,a,l)),this._register(this.workspaceConfiguration.onDidUpdateConfiguration(e=>{this.onWorkspaceConfigurationChanged(e).then(()=>{this.workspace.initialized=this.workspaceConfiguration.initialized,this.checkAndMarkWorkspaceComplete(e)})})),this._register(this.defaultConfiguration.onDidChangeConfiguration(({properties:e,defaults:t})=>this.onDefaultConfigurationChanged(t,e))),this._register(this.policyConfiguration.onDidChangeConfiguration(e=>this.onPolicyConfigurationChanged(e))),this._register(r.onDidChangeCurrentProfile(e=>this.onUserDataProfileChanged(e))),this.workspaceEditingQueue=new sb.Queue}createApplicationConfiguration(){this.applicationConfigurationDisposables.clear(),this.userDataProfileService.currentProfile.isDefault||this.userDataProfileService.currentProfile.useDefaultFlags?.settings?this.applicationConfiguration=null:(this.applicationConfiguration=this.applicationConfigurationDisposables.add(this._register(new sJ(this.userDataProfilesService,this.fileService,this.uriIdentityService,this.logService))),this.applicationConfigurationDisposables.add(this.applicationConfiguration.onDidChangeConfiguration(e=>this.onApplicationConfigurationChanged(e))))}async getCompleteWorkspace(){return await this.completeWorkspaceBarrier.wait(),this.getWorkspace()}getWorkspace(){return this.workspace}getWorkbenchState(){return this.workspace.configuration?sw.WorkbenchState.WORKSPACE:1===this.workspace.folders.length?sw.WorkbenchState.FOLDER:sw.WorkbenchState.EMPTY}getWorkspaceFolder(e){return this.workspace.getFolder(e)}addFolders(e,t){return this.updateFolders(e,[],t)}removeFolders(e){return this.updateFolders([],e)}async updateFolders(e,t,i){return this.workspaceEditingQueue.queue(()=>this.doUpdateFolders(e,t,i))}isInsideWorkspace(e){return!!this.getWorkspaceFolder(e)}isCurrentWorkspace(e){switch(this.getWorkbenchState()){case sw.WorkbenchState.FOLDER:{let t;return rb.URI.isUri(e)?t=e:(0,sw.isSingleFolderWorkspaceIdentifier)(e)&&(t=e.uri),rb.URI.isUri(t)&&this.uriIdentityService.extUri.isEqual(t,this.workspace.folders[0].uri)}case sw.WorkbenchState.WORKSPACE:return(0,sw.isWorkspaceIdentifier)(e)&&this.workspace.id===e.id}return!1}async doUpdateFolders(e,t,i){if(this.getWorkbenchState()!==sw.WorkbenchState.WORKSPACE||e.length+t.length===0)return Promise.resolve(void 0);let r=!1,o=this.getWorkspace().folders,n=o.map(e=>e.raw).filter((e,i)=>!(0,sP.isStoredWorkspaceFolder)(e)||!this.contains(t,o[i].uri));if(r=o.length!==n.length,e.length){let t=this.getWorkspace().configuration,s=this.uriIdentityService.extUri.dirname(t),a=(o=(0,sP.toWorkspaceFolders)(n,t,this.uriIdentityService.extUri)).map(e=>e.uri),l=[];for(let t of e){let e=t.uri;if(!this.contains(a,e)){try{if(!(await this.fileService.stat(e)).isDirectory)continue}catch(e){}l.push((0,sP.getStoredWorkspaceFolder)(e,!1,t.name,s,this.uriIdentityService.extUri))}}l.length>0&&(r=!0,"number"==typeof i&&i>=0&&i<n.length?(n=n.slice(0)).splice(i,0,...l):n=[...n,...l])}return r?this.setFolders(n):Promise.resolve(void 0)}async setFolders(e){if(!this.instantiationService)throw Error("Cannot update workspace folders because workspace service is not yet ready to accept writes.");return await this.instantiationService.invokeFunction(t=>this.workspaceConfiguration.setFolders(e,t.get(an.IJSONEditingService))),this.onWorkspaceConfigurationChanged(!1)}contains(e,t){return e.some(e=>this.uriIdentityService.extUri.isEqual(e,t))}getConfigurationData(){return this._configuration.toData()}getValue(e,t){let i="string"==typeof e?e:void 0,r=(0,nw.isConfigurationOverrides)(e)?e:(0,nw.isConfigurationOverrides)(t)?t:void 0;return this._configuration.getValue(i,r)}async updateValue(e,t,i,r,o){let n=(0,nw.isConfigurationUpdateOverrides)(i)?i:(0,nw.isConfigurationOverrides)(i)?{resource:i.resource,overrideIdentifiers:i.overrideIdentifier?[i.overrideIdentifier]:void 0}:void 0,s=n?r:i,a=s?[s]:[];if(n?.overrideIdentifiers&&(n.overrideIdentifiers=(0,oL.distinct)(n.overrideIdentifiers),n.overrideIdentifiers=n.overrideIdentifiers.length?n.overrideIdentifiers:void 0),!a.length){if(n?.overrideIdentifiers&&n.overrideIdentifiers.length>1)throw Error("Configuration Target is required while updating the value for multiple override identifiers");let i=this.inspect(e,{resource:n?.resource,overrideIdentifier:n?.overrideIdentifiers?n.overrideIdentifiers[0]:void 0});a.push(...this.deriveConfigurationTargets(e,t,i)),(0,nF.equals)(t,i.defaultValue)&&1===a.length&&(a[0]===nw.ConfigurationTarget.USER||a[0]===nw.ConfigurationTarget.USER_LOCAL)&&(t=void 0)}await sb.Promises.settled(a.map(i=>this.writeConfigurationValue(e,t,i,n,o)))}async reloadConfiguration(e){if(void 0===e){this.reloadDefaultConfiguration();let e=await this.reloadApplicationConfiguration(!0),{local:t,remote:i}=await this.reloadUserConfiguration();await this.reloadWorkspaceConfiguration(),await this.loadConfiguration(e,t,i,!0);return}if((0,sw.isWorkspaceFolder)(e))return void await this.reloadWorkspaceFolderConfiguration(e);switch(e){case nw.ConfigurationTarget.DEFAULT:this.reloadDefaultConfiguration();return;case nw.ConfigurationTarget.USER:{let{local:e,remote:t}=await this.reloadUserConfiguration();await this.loadConfiguration(this._configuration.applicationConfiguration,e,t,!0);return}case nw.ConfigurationTarget.USER_LOCAL:await this.reloadLocalUserConfiguration();return;case nw.ConfigurationTarget.USER_REMOTE:await this.reloadRemoteUserConfiguration();return;case nw.ConfigurationTarget.WORKSPACE:case nw.ConfigurationTarget.WORKSPACE_FOLDER:await this.reloadWorkspaceConfiguration();return}}hasCachedConfigurationDefaultsOverrides(){return this.defaultConfiguration.hasCachedConfigurationDefaultsOverrides()}inspect(e,t){return this._configuration.inspect(e,t)}keys(){return this._configuration.keys()}async whenRemoteConfigurationLoaded(){await this.initRemoteUserConfigurationBarrier.wait()}async initialize(e){(0,s8.mark)("code/willInitWorkspaceService");let t=this.initialized;this.initialized=!1;let i=await this.createWorkspace(e);await this.updateWorkspaceAndInitializeConfiguration(i,t),this.checkAndMarkWorkspaceComplete(!1),(0,s8.mark)("code/didInitWorkspaceService")}updateWorkspaceTrust(e){if(this.isWorkspaceTrusted!==e){this.isWorkspaceTrusted=e;let t=this._configuration.toData(),i=[];for(let e of this.workspace.folders){let t,r=this.cachedFolderConfigs.get(e.uri);r&&(t=r.updateWorkspaceTrust(this.isWorkspaceTrusted),this._configuration.updateFolderConfiguration(e.uri,t)),i.push(t)}this.getWorkbenchState()===sw.WorkbenchState.FOLDER?i[0]&&this._configuration.updateWorkspaceConfiguration(i[0]):this._configuration.updateWorkspaceConfiguration(this.workspaceConfiguration.updateWorkspaceTrust(this.isWorkspaceTrusted)),this.updateRestrictedSettings();let r=[];this.restrictedSettings.userLocal&&r.push(...this.restrictedSettings.userLocal),this.restrictedSettings.userRemote&&r.push(...this.restrictedSettings.userRemote),this.restrictedSettings.workspace&&r.push(...this.restrictedSettings.workspace),this.restrictedSettings.workspaceFolder?.forEach(e=>r.push(...e)),(r=(0,oL.distinct)(r)).length&&this.triggerConfigurationChange({keys:r,overrides:[]},{data:t,workspace:this.workspace},nw.ConfigurationTarget.WORKSPACE)}}acquireInstantiationService(e){this.instantiationService=e}isSettingAppliedForAllProfiles(e){let t=this.configurationRegistry.getConfigurationProperties()[e]?.scope;if(t&&nq.includes(t))return!0;let i=this.getValue(nZ)??[];return Array.isArray(i)&&i.includes(e)}async createWorkspace(e){return(0,sw.isWorkspaceIdentifier)(e)?this.createMultiFolderWorkspace(e):(0,sw.isSingleFolderWorkspaceIdentifier)(e)?this.createSingleFolderWorkspace(e):this.createEmptyWorkspace(e)}async createMultiFolderWorkspace(e){await this.workspaceConfiguration.initialize({id:e.id,configPath:e.configPath},this.isWorkspaceTrusted);let t=e.configPath,i=(0,sP.toWorkspaceFolders)(this.workspaceConfiguration.getFolders(),t,this.uriIdentityService.extUri),r=new al(e.id,i,this.workspaceConfiguration.isTransient(),t,e=>this.uriIdentityService.extUri.ignorePathCasing(e));return r.initialized=this.workspaceConfiguration.initialized,r}createSingleFolderWorkspace(e){let t=new al(e.id,[(0,sw.toWorkspaceFolder)(e.uri)],!1,null,e=>this.uriIdentityService.extUri.ignorePathCasing(e));return t.initialized=!0,t}createEmptyWorkspace(e){let t=new al(e.id,[],!1,null,e=>this.uriIdentityService.extUri.ignorePathCasing(e));return t.initialized=!0,Promise.resolve(t)}checkAndMarkWorkspaceComplete(e){!this.completeWorkspaceBarrier.isOpen()&&this.workspace.initialized&&(this.completeWorkspaceBarrier.open(),this.validateWorkspaceFoldersAndReload(e))}async updateWorkspaceAndInitializeConfiguration(e,t){let i,r,o=!!this.workspace,n=[];if(o?(i=this.getWorkbenchState(),r=this.workspace.configuration?this.workspace.configuration.fsPath:void 0,n=this.workspace.folders,this.workspace.update(e)):this.workspace=e,await this.initializeConfiguration(t),o){let e=this.getWorkbenchState();i&&e!==i&&this._onDidChangeWorkbenchState.fire(e);let t=this.workspace.configuration?this.workspace.configuration.fsPath:void 0;(r&&t!==r||e!==i)&&this._onDidChangeWorkspaceName.fire();let o=this.compareFolders(n,this.workspace.folders);o&&(o.added.length||o.removed.length||o.changed.length)&&(await this.handleWillChangeWorkspaceFolders(o,!1),this._onDidChangeWorkspaceFolders.fire(o))}this.localUserConfiguration.hasTasksLoaded||this._register((0,om.runWhenWindowIdle)(ry.mainWindow,()=>this.reloadLocalUserConfiguration(!1,this._configuration.localUserConfiguration)))}compareFolders(e,t){let i={added:[],removed:[],changed:[]};i.added=t.filter(t=>!e.some(e=>t.uri.toString()===e.uri.toString()));for(let r=0;r<e.length;r++){let o=e[r],n=0;for(n=0;n<t.length&&o.uri.toString()!==t[n].uri.toString();n++);n<t.length?(r!==n||o.name!==t[n].name)&&i.changed.push(o):i.removed.push(o)}return i}async initializeConfiguration(e){await this.defaultConfiguration.initialize();let t=this.policyConfiguration.initialize(),i=this.applicationConfiguration?this.applicationConfiguration.initialize():Promise.resolve(sx.ConfigurationModel.createEmptyModel(this.logService)),r=async()=>{(0,s8.mark)("code/willInitUserConfiguration");let e=await Promise.all([this.localUserConfiguration.initialize(),this.remoteUserConfiguration?this.remoteUserConfiguration.initialize():Promise.resolve(sx.ConfigurationModel.createEmptyModel(this.logService))]);if(this.applicationConfiguration){let t=await i;e[0]=this.localUserConfiguration.reparse({exclude:t.getValue(nZ)})}return(0,s8.mark)("code/didInitUserConfiguration"),e},[,o,[n,s]]=await Promise.all([t,i,r()]);(0,s8.mark)("code/willInitWorkspaceConfiguration"),await this.loadConfiguration(o,n,s,e),(0,s8.mark)("code/didInitWorkspaceConfiguration")}reloadDefaultConfiguration(){this.onDefaultConfigurationChanged(this.defaultConfiguration.reload())}async reloadApplicationConfiguration(e){if(!this.applicationConfiguration)return sx.ConfigurationModel.createEmptyModel(this.logService);let t=await this.applicationConfiguration.loadConfiguration();return e||this.onApplicationConfigurationChanged(t),t}async reloadUserConfiguration(){let[e,t]=await Promise.all([this.reloadLocalUserConfiguration(!0),this.reloadRemoteUserConfiguration(!0)]);return{local:e,remote:t}}async reloadLocalUserConfiguration(e,t){let i=await this.localUserConfiguration.reload(t);return e||this.onLocalUserConfigurationChanged(i),i}async reloadRemoteUserConfiguration(e){if(this.remoteUserConfiguration){let t=await this.remoteUserConfiguration.reload();return e||this.onRemoteUserConfigurationChanged(t),t}return sx.ConfigurationModel.createEmptyModel(this.logService)}async reloadWorkspaceConfiguration(){let e=this.getWorkbenchState();return e===sw.WorkbenchState.FOLDER?this.onWorkspaceFolderConfigurationChanged(this.workspace.folders[0]):e===sw.WorkbenchState.WORKSPACE?this.workspaceConfiguration.reload().then(()=>this.onWorkspaceConfigurationChanged(!1)):void 0}reloadWorkspaceFolderConfiguration(e){return this.onWorkspaceFolderConfigurationChanged(e)}async loadConfiguration(e,t,i,r){this.cachedFolderConfigs=new sC.ResourceMap;let o=this.workspace.folders,n=await this.loadFolderConfigurations(o),s=this.getWorkspaceConfigurationModel(n),a=new sC.ResourceMap;n.forEach((e,t)=>a.set(o[t].uri,e));let l=this._configuration;if(this._configuration=new sR(this.defaultConfiguration.configurationModel,this.policyConfiguration.configurationModel,e,t,i,s,a,sx.ConfigurationModel.createEmptyModel(this.logService),new sC.ResourceMap,this.workspace,this.logService),this.initialized=!0,r){let e=this._configuration.compare(l);this.triggerConfigurationChange(e,{data:l.toData(),workspace:this.workspace},nw.ConfigurationTarget.WORKSPACE)}this.updateRestrictedSettings()}getWorkspaceConfigurationModel(e){switch(this.getWorkbenchState()){case sw.WorkbenchState.FOLDER:return e[0];case sw.WorkbenchState.WORKSPACE:return this.workspaceConfiguration.getConfiguration();default:return sx.ConfigurationModel.createEmptyModel(this.logService)}}onUserDataProfileChanged(e){e.join((async()=>{let t=[];t.push(this.localUserConfiguration.reset(e.profile.settingsResource,e.profile.tasksResource,e.profile.mcpResource,{scopes:aa(e.profile,!!this.remoteUserConfiguration)})),(e.previous.isDefault!==e.profile.isDefault||!!e.previous.useDefaultFlags?.settings!=!!e.profile.useDefaultFlags?.settings)&&(this.createApplicationConfiguration(),this.applicationConfiguration&&t.push(this.reloadApplicationConfiguration(!0)));let[i,r]=await Promise.all(t);r=r??this._configuration.applicationConfiguration,this.applicationConfiguration&&(i=this.localUserConfiguration.reparse({exclude:r.getValue(nZ)})),await this.loadConfiguration(r,i,this._configuration.remoteUserConfiguration,!0)})())}onDefaultConfigurationChanged(e,t){if(this.workspace){let i=this._configuration.toData(),r=this._configuration.compareAndUpdateDefaultConfiguration(e,t);if(this.applicationConfiguration&&this._configuration.updateApplicationConfiguration(this.applicationConfiguration.reparse()),this.remoteUserConfiguration&&(this._configuration.updateLocalUserConfiguration(this.localUserConfiguration.reparse()),this._configuration.updateRemoteUserConfiguration(this.remoteUserConfiguration.reparse())),this.getWorkbenchState()===sw.WorkbenchState.FOLDER){let e=this.cachedFolderConfigs.get(this.workspace.folders[0].uri);e&&(this._configuration.updateWorkspaceConfiguration(e.reparse()),this._configuration.updateFolderConfiguration(this.workspace.folders[0].uri,e.reparse()))}else for(let e of(this._configuration.updateWorkspaceConfiguration(this.workspaceConfiguration.reparseWorkspaceSettings()),this.workspace.folders)){let t=this.cachedFolderConfigs.get(e.uri);t&&this._configuration.updateFolderConfiguration(e.uri,t.reparse())}this.triggerConfigurationChange(r,{data:i,workspace:this.workspace},nw.ConfigurationTarget.DEFAULT),this.updateRestrictedSettings()}}onPolicyConfigurationChanged(e){let t={data:this._configuration.toData(),workspace:this.workspace},i=this._configuration.compareAndUpdatePolicyConfiguration(e);this.triggerConfigurationChange(i,t,nw.ConfigurationTarget.DEFAULT)}onApplicationConfigurationChanged(e){let t={data:this._configuration.toData(),workspace:this.workspace},i=this._configuration.applicationConfiguration.getValue(nZ)??[],r=this._configuration.compareAndUpdateApplicationConfiguration(e),o=this.getValue(nZ)??[],n=this.configurationRegistry.getConfigurationProperties(),s=[];for(let e of r.keys){let t=n[e]?.scope;if(t&&nq.includes(t)){if(s.push(e),e===nZ){for(let e of i)o.includes(e)||s.push(e);for(let e of o)i.includes(e)||s.push(e)}}else o.includes(e)&&s.push(e)}r.keys=s,r.keys.includes(nZ)&&this._configuration.updateLocalUserConfiguration(this.localUserConfiguration.reparse({exclude:o})),this.triggerConfigurationChange(r,t,nw.ConfigurationTarget.USER)}onLocalUserConfigurationChanged(e){let t={data:this._configuration.toData(),workspace:this.workspace},i=this._configuration.compareAndUpdateLocalUserConfiguration(e);this.triggerConfigurationChange(i,t,nw.ConfigurationTarget.USER)}onRemoteUserConfigurationChanged(e){let t={data:this._configuration.toData(),workspace:this.workspace},i=this._configuration.compareAndUpdateRemoteUserConfiguration(e);this.triggerConfigurationChange(i,t,nw.ConfigurationTarget.USER)}async onWorkspaceConfigurationChanged(e){if(this.workspace&&this.workspace.configuration){let t=(0,sP.toWorkspaceFolders)(this.workspaceConfiguration.getFolders(),this.workspace.configuration,this.uriIdentityService.extUri);if(this.workspace.initialized){let{added:e,removed:i,changed:r}=this.compareFolders(this.workspace.folders,t);t=e.length||i.length||r.length?await this.toValidWorkspaceFolders(t):this.workspace.folders}await this.updateWorkspaceConfiguration(t,this.workspaceConfiguration.getConfiguration(),e)}}updateRestrictedSettings(){let e=[],t=this.configurationRegistry.getConfigurationProperties(),i=Object.keys(t).filter(e=>t[e].restricted).sort((e,t)=>e.localeCompare(t)),r=(0,oL.delta)(i,this._restrictedSettings.default,(e,t)=>e.localeCompare(t));e.push(...r.added,...r.removed);let o=(this.applicationConfiguration?.getRestrictedSettings()||[]).sort((e,t)=>e.localeCompare(t)),n=(0,oL.delta)(o,this._restrictedSettings.application||[],(e,t)=>e.localeCompare(t));e.push(...n.added,...n.removed);let s=this.localUserConfiguration.getRestrictedSettings().sort((e,t)=>e.localeCompare(t)),a=(0,oL.delta)(s,this._restrictedSettings.userLocal||[],(e,t)=>e.localeCompare(t));e.push(...a.added,...a.removed);let l=(this.remoteUserConfiguration?.getRestrictedSettings()||[]).sort((e,t)=>e.localeCompare(t)),c=(0,oL.delta)(l,this._restrictedSettings.userRemote||[],(e,t)=>e.localeCompare(t));e.push(...c.added,...c.removed);let d=new sC.ResourceMap;for(let t of this.workspace.folders){let i=this.cachedFolderConfigs.get(t.uri),r=(i?.getRestrictedSettings()||[]).sort((e,t)=>e.localeCompare(t));r.length&&d.set(t.uri,r);let o=this._restrictedSettings.workspaceFolder?.get(t.uri)||[],n=(0,oL.delta)(r,o,(e,t)=>e.localeCompare(t));e.push(...n.added,...n.removed)}let u=this.getWorkbenchState()===sw.WorkbenchState.WORKSPACE?this.workspaceConfiguration.getRestrictedSettings().sort((e,t)=>e.localeCompare(t)):this.workspace.folders[0]&&d.get(this.workspace.folders[0].uri)||[],h=(0,oL.delta)(u,this._restrictedSettings.workspace||[],(e,t)=>e.localeCompare(t));e.push(...h.added,...h.removed),e.length&&(this._restrictedSettings={default:i,application:o.length?o:void 0,userLocal:s.length?s:void 0,userRemote:l.length?l:void 0,workspace:u.length?u:void 0,workspaceFolder:d.size?d:void 0},this._onDidChangeRestrictedSettings.fire(this.restrictedSettings))}async updateWorkspaceConfiguration(e,t,i){let r={data:this._configuration.toData(),workspace:this.workspace},o=this._configuration.compareAndUpdateWorkspaceConfiguration(t),n=this.compareFolders(this.workspace.folders,e);if(n.added.length||n.removed.length||n.changed.length){this.workspace.folders=e;let t=await this.onFoldersChanged();await this.handleWillChangeWorkspaceFolders(n,i),this.triggerConfigurationChange(t,r,nw.ConfigurationTarget.WORKSPACE_FOLDER),this._onDidChangeWorkspaceFolders.fire(n)}else this.triggerConfigurationChange(o,r,nw.ConfigurationTarget.WORKSPACE);this.updateRestrictedSettings()}async handleWillChangeWorkspaceFolders(e,t){let i=[];this._onWillChangeWorkspaceFolders.fire({join(e){i.push(e)},changes:e,fromCache:t});try{await sb.Promises.settled(i)}catch(e){}}async onWorkspaceFolderConfigurationChanged(e){let[t]=await this.loadFolderConfigurations([e]),i={data:this._configuration.toData(),workspace:this.workspace},r=this._configuration.compareAndUpdateFolderConfiguration(e.uri,t);if(this.getWorkbenchState()===sw.WorkbenchState.FOLDER){let e=this._configuration.compareAndUpdateWorkspaceConfiguration(t);this.triggerConfigurationChange((0,sx.mergeChanges)(r,e),i,nw.ConfigurationTarget.WORKSPACE)}else this.triggerConfigurationChange(r,i,nw.ConfigurationTarget.WORKSPACE_FOLDER);this.updateRestrictedSettings()}async onFoldersChanged(){let e=[];for(let t of this.cachedFolderConfigs.keys())this.workspace.folders.filter(e=>e.uri.toString()===t.toString())[0]||(this.cachedFolderConfigs.get(t).dispose(),this.cachedFolderConfigs.delete(t),e.push(this._configuration.compareAndDeleteFolderConfiguration(t)));let t=this.workspace.folders.filter(e=>!this.cachedFolderConfigs.has(e.uri));return t.length&&(await this.loadFolderConfigurations(t)).forEach((i,r)=>{e.push(this._configuration.compareAndUpdateFolderConfiguration(t[r].uri,i))}),(0,sx.mergeChanges)(...e)}loadFolderConfigurations(e){return Promise.all([...e.map(e=>{let t=this.cachedFolderConfigs.get(e.uri);return t||(t=new s5(!this.initialized,e,n$,this.getWorkbenchState(),this.isWorkspaceTrusted,this.fileService,this.uriIdentityService,this.logService,this.configurationCache),this._register(t.onDidChange(()=>this.onWorkspaceFolderConfigurationChanged(e))),this.cachedFolderConfigs.set(e.uri,this._register(t))),t.loadConfiguration()})])}async validateWorkspaceFoldersAndReload(e){let t=await this.toValidWorkspaceFolders(this.workspace.folders),{removed:i}=this.compareFolders(this.workspace.folders,t);i.length&&await this.updateWorkspaceConfiguration(t,this.workspaceConfiguration.getConfiguration(),e)}async toValidWorkspaceFolders(e){let t=[];for(let i of e){try{if(!(await this.fileService.stat(i.uri)).isDirectory)continue}catch(e){this.logService.warn(`Ignoring the error while validating workspace folder ${i.uri.toString()} - ${(0,ae.toErrorMessage)(e)}`)}t.push(i)}return t}async writeConfigurationValue(e,t,i,r,o){if(!this.instantiationService)throw Error("Cannot write configuration because the configuration service is not yet ready to accept writes.");if(i===nw.ConfigurationTarget.DEFAULT)throw Error("Invalid configuration target");if(i===nw.ConfigurationTarget.MEMORY){let o={data:this._configuration.toData(),workspace:this.workspace};this._configuration.updateValue(e,t,r),this.triggerConfigurationChange({keys:r?.overrideIdentifiers?.length?[(0,nD.keyFromOverrideIdentifiers)(r.overrideIdentifiers),e]:[e],overrides:r?.overrideIdentifiers?.length?r.overrideIdentifiers.map(t=>[t,[e]]):[]},o,i);return}let n=this.toEditableConfigurationTarget(i,e);if(!n||n===$.USER_REMOTE&&!this.remoteUserConfiguration)throw Error("Invalid configuration target");if(r?.overrideIdentifiers?.length&&r.overrideIdentifiers.length>1){let e=this.getConfigurationModelForEditableConfigurationTarget(n,r.resource);if(e){let t=r.overrideIdentifiers.sort(),i=e.overrides.find(e=>(0,oL.equals)([...e.identifiers].sort(),t));i&&(r.overrideIdentifiers=i.identifiers)}}switch(this.configurationEditing=this.configurationEditing??this.createConfigurationEditingService(this.instantiationService),await (await this.configurationEditing).writeConfiguration(n,{key:e,value:t},{scopes:r,...o}),n){case $.USER_LOCAL:this.applicationConfiguration&&this.isSettingAppliedForAllProfiles(e)?await this.reloadApplicationConfiguration():await this.reloadLocalUserConfiguration();return;case $.USER_REMOTE:return this.reloadRemoteUserConfiguration().then(()=>void 0);case $.WORKSPACE:return this.reloadWorkspaceConfiguration();case $.WORKSPACE_FOLDER:{let e=r&&r.resource?this.workspace.getFolder(r.resource):null;if(e)return this.reloadWorkspaceFolderConfiguration(e)}}}async createConfigurationEditingService(e){let t=(await this.remoteAgentService.getEnvironment())?.settingsPath??null;return e.createInstance(sz,t)}getConfigurationModelForEditableConfigurationTarget(e,t){switch(e){case $.USER_LOCAL:return this._configuration.localUserConfiguration;case $.USER_REMOTE:return this._configuration.remoteUserConfiguration;case $.WORKSPACE:return this._configuration.workspaceConfiguration;case $.WORKSPACE_FOLDER:return t?this._configuration.folderConfigurations.get(t):void 0}}getConfigurationModel(e,t){switch(e){case nw.ConfigurationTarget.USER_LOCAL:return this._configuration.localUserConfiguration;case nw.ConfigurationTarget.USER_REMOTE:return this._configuration.remoteUserConfiguration;case nw.ConfigurationTarget.WORKSPACE:return this._configuration.workspaceConfiguration;case nw.ConfigurationTarget.WORKSPACE_FOLDER:return t?this._configuration.folderConfigurations.get(t):void 0;default:return}}deriveConfigurationTargets(e,t,i){if((0,nF.equals)(t,i.value))return[];let r=[];return(void 0!==i.workspaceFolderValue&&r.push(nw.ConfigurationTarget.WORKSPACE_FOLDER),void 0!==i.workspaceValue&&r.push(nw.ConfigurationTarget.WORKSPACE),void 0!==i.userRemoteValue&&r.push(nw.ConfigurationTarget.USER_REMOTE),void 0!==i.userLocalValue&&r.push(nw.ConfigurationTarget.USER_LOCAL),void 0!==i.applicationValue&&r.push(nw.ConfigurationTarget.APPLICATION),void 0===t)?r:[r[0]||nw.ConfigurationTarget.USER]}triggerConfigurationChange(e,t,i){if(e.keys.length){i!==nw.ConfigurationTarget.DEFAULT&&this.logService.debug(`Configuration keys changed in ${(0,nw.ConfigurationTargetToString)(i)} target`,...e.keys);let r=new sx.ConfigurationChangeEvent(e,t,this._configuration,this.workspace,this.logService);r.source=i,this._onDidChangeConfiguration.fire(r)}}toEditableConfigurationTarget(e,t){if(e===nw.ConfigurationTarget.APPLICATION)return $.USER_LOCAL;if(e===nw.ConfigurationTarget.USER){if(this.remoteUserConfiguration){let e=this.configurationRegistry.getConfigurationProperties()[t]?.scope;if(e===nD.ConfigurationScope.MACHINE||e===nD.ConfigurationScope.MACHINE_OVERRIDABLE||e===nD.ConfigurationScope.APPLICATION_MACHINE||void 0!==this.inspect(t).userRemoteValue)return $.USER_REMOTE}return $.USER_LOCAL}return e===nw.ConfigurationTarget.USER_LOCAL?$.USER_LOCAL:e===nw.ConfigurationTarget.USER_REMOTE?$.USER_REMOTE:e===nw.ConfigurationTarget.WORKSPACE?$.WORKSPACE:e===nw.ConfigurationTarget.WORKSPACE_FOLDER?$.WORKSPACE_FOLDER:null}}let ad=class extends sS.Disposable{constructor(e,t,i,r,o){super(),this.workspaceContextService=e,this.environmentService=t,this.workspaceTrustManagementService=i,r.whenInstalledExtensionsRegistered().then(()=>{this.registerConfigurationSchemas();let e=nP.Registry.as(nD.Extensions.Configuration),t=this._register(new sb.Delayer(50));this._register(ol.Event.any(e.onDidUpdateConfiguration,e.onDidSchemaChange,i.onDidChangeTrust)(()=>t.trigger(()=>this.registerConfigurationSchemas(),o.phase===so.LifecyclePhase.Eventually?void 0:2500)))})}registerConfigurationSchemas(){let e={properties:nD.allSettings.properties,patternProperties:nD.allSettings.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},t=this.environmentService.remoteAuthority?{properties:Object.assign({},nD.applicationSettings.properties,nD.windowSettings.properties,nD.resourceSettings.properties),patternProperties:nD.allSettings.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0}:e,i={properties:Object.assign({},nD.machineSettings.properties,nD.machineOverridableSettings.properties,nD.windowSettings.properties,nD.resourceSettings.properties),patternProperties:nD.allSettings.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},r={properties:Object.assign({},nD.applicationMachineSettings.properties,nD.machineSettings.properties,nD.machineOverridableSettings.properties,nD.windowSettings.properties,nD.resourceSettings.properties),patternProperties:nD.allSettings.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},o={properties:Object.assign({},this.checkAndFilterPropertiesRequiringTrust(nD.machineOverridableSettings.properties),this.checkAndFilterPropertiesRequiringTrust(nD.windowSettings.properties),this.checkAndFilterPropertiesRequiringTrust(nD.resourceSettings.properties)),patternProperties:nD.allSettings.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},n={properties:Object.keys(nD.allSettings.properties).reduce((e,t)=>(e[t]=Object.assign({deprecationMessage:void 0},nD.allSettings.properties[t]),e),{}),patternProperties:Object.keys(nD.allSettings.patternProperties).reduce((e,t)=>(e[t]=Object.assign({deprecationMessage:void 0},nD.allSettings.patternProperties[t]),e),{}),additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},s=sw.WorkbenchState.WORKSPACE===this.workspaceContextService.getWorkbenchState()?{properties:Object.assign({},this.checkAndFilterPropertiesRequiringTrust(nD.machineOverridableSettings.properties),this.checkAndFilterPropertiesRequiringTrust(nD.resourceSettings.properties)),patternProperties:nD.allSettings.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0}:o,a={type:"object",description:(0,oh.localize)(13756,"Contribute defaults for configurations"),properties:Object.assign({},this.filterDefaultOverridableProperties(nD.machineOverridableSettings.properties),this.filterDefaultOverridableProperties(nD.windowSettings.properties),this.filterDefaultOverridableProperties(nD.resourceSettings.properties)),patternProperties:{[nD.OVERRIDE_PROPERTY_PATTERN]:{type:"object",default:{},$ref:nD.resourceLanguageSettingsSchemaId}},additionalProperties:!1};this.registerSchemas({defaultSettingsSchema:n,userSettingsSchema:t,profileSettingsSchema:i,machineSettingsSchema:r,workspaceSettingsSchema:o,folderSettingsSchema:s,configDefaultsSchema:a})}registerSchemas(e){let t=nP.Registry.as(nN.Extensions.JSONContribution);t.registerSchema("vscode://schemas/settings/default",e.defaultSettingsSchema),t.registerSchema("vscode://schemas/settings/user",e.userSettingsSchema),t.registerSchema("vscode://schemas/settings/profile",e.profileSettingsSchema),t.registerSchema("vscode://schemas/settings/machine",e.machineSettingsSchema),t.registerSchema(nW,e.workspaceSettingsSchema),t.registerSchema("vscode://schemas/settings/folder",e.folderSettingsSchema),t.registerSchema(nD.configurationDefaultsSchemaId,e.configDefaultsSchema)}checkAndFilterPropertiesRequiringTrust(e){if(this.workspaceTrustManagementService.isWorkspaceTrusted())return e;let t={};return Object.entries(e).forEach(([e,i])=>{i.restricted||(t[e]=i)}),t}filterDefaultOverridableProperties(e){let t={};return Object.entries(e).forEach(([e,i])=>{i.disallowConfigurationDefault||(t[e]=i)}),t}};ad=(0,rj.__decorate)([(0,rj.__param)(0,nM.IWorkspaceContextService),(0,rj.__param)(1,s7.IWorkbenchEnvironmentService),(0,rj.__param)(2,at.IWorkspaceTrustManagementService),(0,rj.__param)(3,ai.IExtensionService),(0,rj.__param)(4,s9.ILifecycleService)],ad);let au=class extends sS.Disposable{static{this.ID="workbench.contrib.configurationDefaultOverridesContribution"}constructor(e,t,i,r){super(),this.workbenchAssignmentService=e,this.extensionService=t,this.configurationService=i,this.logService=r,this.processedExperimentalSettings=new Set,this.autoExperimentalSettings=new Set,this.configurationRegistry=nP.Registry.as(nD.Extensions.Configuration),this.throttler=this._register(new sb.Throttler),this.throttler.queue(()=>this.updateDefaults()),this._register(e.onDidRefetchAssignments(()=>this.throttler.queue(()=>this.processExperimentalSettings(this.autoExperimentalSettings,!0)))),this._register(this.configurationRegistry.onDidUpdateConfiguration(({properties:e})=>this.processExperimentalSettings(e,!1)))}async updateDefaults(){this.logService.trace("ConfigurationService#updateDefaults: begin");try{await this.processExperimentalSettings(Object.keys(this.configurationRegistry.getConfigurationProperties()),!1)}finally{await this.extensionService.whenInstalledExtensionsRegistered(),this.logService.trace("ConfigurationService#updateDefaults: resetting the defaults"),this.configurationService.reloadConfiguration(nw.ConfigurationTarget.DEFAULT)}}async processExperimentalSettings(e,t){let i={},r=this.configurationRegistry.getConfigurationProperties();for(let o of e){let e=r[o];if(e?.experiment&&!(!t&&this.processedExperimentalSettings.has(o))){this.processedExperimentalSettings.add(o),"auto"===e.experiment.mode&&this.autoExperimentalSettings.add(o);try{let t=await this.workbenchAssignmentService.getTreatment(e.experiment.name??`config.${o}`);(0,o1.isUndefined)(t)||(0,nF.equals)(t,e.default)||(i[o]=t)}catch(e){}}}Object.keys(i).length&&this.configurationRegistry.registerDefaultConfigurations([{overrides:i}])}};au=(0,rj.__decorate)([(0,rj.__param)(0,ar.IWorkbenchAssignmentService),(0,rj.__param)(1,ai.IExtensionService),(0,rj.__param)(2,rY.IConfigurationService),(0,rj.__param)(3,nT.ILogService)],au),nP.Registry.as(sr.Extensions.Workbench).registerWorkbenchContribution(ad,so.LifecyclePhase.Restored),(0,sr.registerWorkbenchContribution2)(au.ID,au,sr.WorkbenchPhase.BlockRestore),nP.Registry.as(nD.Extensions.Configuration).registerConfiguration({...as.workbenchConfigurationNodeBase,properties:{[nZ]:{type:"array",description:(0,oh.localize)(13757,"Configure settings to be applied for all profiles."),default:[],scope:nD.ConfigurationScope.APPLICATION,additionalProperties:!0,uniqueItems:!0}}});class ah{constructor(e,t,i){this.donotCacheResourcesWithSchemes=e,this.fileService=i,this.cachedConfigurations=new Map,this.cacheHome=t.cacheHome}needsCaching(e){return!this.donotCacheResourcesWithSchemes.includes(e.scheme)}read(e){return this.getCachedConfiguration(e).read()}write(e,t){return this.getCachedConfiguration(e).save(t)}remove(e){return this.getCachedConfiguration(e).remove()}getCachedConfiguration({type:e,key:t}){let i=`${e}:${t}`,r=this.cachedConfigurations.get(i);return r||(r=new ag({type:e,key:t},this.cacheHome,this.fileService),this.cachedConfigurations.set(i,r)),r}}class ag{constructor({type:e,key:t},i,r){this.fileService=r,this.cachedConfigurationFolderResource=(0,sc.joinPath)(i,"CachedConfigurations",e,t),this.cachedConfigurationFileResource=(0,sc.joinPath)(this.cachedConfigurationFolderResource,"workspaces"===e?"workspace.json":"configuration.json"),this.queue=new sb.Queue}async read(){try{return(await this.fileService.readFile(this.cachedConfigurationFileResource)).value.toString()}catch(e){return""}}async save(e){await this.createCachedFolder()&&await this.queue.queue(async()=>{await this.fileService.writeFile(this.cachedConfigurationFileResource,nv.VSBuffer.fromString(e))})}async remove(){try{await this.queue.queue(()=>this.fileService.del(this.cachedConfigurationFolderResource,{recursive:!0,useTrash:!1}))}catch(e){if(e.fileOperationResult!==sF.FileOperationResult.FILE_NOT_FOUND)throw e}}async createCachedFolder(){if(await this.fileService.exists(this.cachedConfigurationFolderResource))return!0;try{return await this.fileService.createFolder(this.cachedConfigurationFolderResource),!0}catch(e){return!1}}}var ap=e.i(436771),am=e.i(354244);e.i(157255);let af=class{constructor(e,t,i,r){this.configurationService=e,this.environmentService=i,this.storageService=r,this.remoteEnvironment=null,t.getEnvironment().then(e=>this.remoteEnvironment=e)}getEOL(e,t){let i=this.configurationService.getValue("files.eol",{overrideIdentifier:t,resource:e});if(i&&"string"==typeof i&&"auto"!==i)return i;let r=this.getOS(e);return r===am.OperatingSystem.Linux||r===am.OperatingSystem.Macintosh?"\n":"\r\n"}getOS(e){let t=am.OS,i=this.environmentService.remoteAuthority;if(i&&e&&e.scheme!==n_.Schemas.file){let e=`resource.authority.os.${i}`;t=this.remoteEnvironment?this.remoteEnvironment.os:this.storageService.getNumber(e,sh.StorageScope.WORKSPACE,am.OS),this.storageService.store(e,t,sh.StorageScope.WORKSPACE,sh.StorageTarget.MACHINE)}return t}};af=(0,rj.__decorate)([(0,rj.__param)(0,rY.IConfigurationService),(0,rj.__param)(1,ap.IRemoteAgentService),(0,rj.__param)(2,s7.IWorkbenchEnvironmentService),(0,rj.__param)(3,sg.IStorageService)],af);var av=e.i(431153),a_=e.i(846960),ay=e.i(324726),aC=e.i(193391),aS=rC;let ab=class extends aS.Disposable{constructor(e,t,i,r,o,n,s,a,l,c,d,u,h,g,p,m){super(),this.jsonEditingService=e,this.contextService=t,this.configurationService=i,this.notificationService=r,this.commandService=o,this.fileService=n,this.textFileService=s,this.workspacesService=a,this.environmentService=l,this.fileDialogService=c,this.dialogService=d,this.hostService=u,this.uriIdentityService=h,this.workspaceTrustManagementService=g,this.userDataProfilesService=p,this.userDataProfileService=m}async pickNewWorkspacePath(){let e=[n_.Schemas.file];this.environmentService.remoteAuthority&&e.unshift(n_.Schemas.vscodeRemote);let t=await this.fileDialogService.showSaveDialog({saveLabel:(0,oh.localize)(14660,"Save"),title:(0,oh.localize)(14661,"Save Workspace"),filters:sn.WORKSPACE_FILTER,defaultUri:(0,sc.joinPath)(await this.fileDialogService.defaultWorkspacePath(),this.getNewWorkspaceName()),availableFileSystems:e});if(t)return(0,sn.hasWorkspaceFileExtension)(t)||(t=t.with({path:`${t.path}.${sn.WORKSPACE_EXTENSION}`})),t}getNewWorkspaceName(){let e=this.getCurrentWorkspaceIdentifier()?.configPath;if(e&&(0,sn.isSavedWorkspace)(e,this.environmentService))return(0,sc.basename)(e);let t=this.contextService.getWorkspace().folders.at(0);return t?`${(0,sc.basename)(t.uri)}.${sn.WORKSPACE_EXTENSION}`:`workspace.${sn.WORKSPACE_EXTENSION}`}async updateFolders(e,t,i,r){let o=this.contextService.getWorkspace().folders,n=[];"number"==typeof t&&(n=o.slice(e,e+t).map(e=>e.uri));let s=[];Array.isArray(i)&&(s=i.map(e=>({uri:(0,sc.removeTrailingPathSeparator)(e.uri),name:e.name})));let a=n.length>0,l=s.length>0;if(l||a)return l&&!a?this.doAddFolders(s,e,r):a&&!l?this.removeFolders(n):this.includesSingleFolderWorkspace(n)?this.createAndEnterWorkspace(s):this.contextService.getWorkbenchState()!==sn.WorkbenchState.WORKSPACE?this.doAddFolders(s,e,r):this.doUpdateFolders(s,n,e,r)}async doUpdateFolders(e,t,i,r=!1){try{await this.contextService.updateFolders(e,t,i)}catch(e){if(r)throw e;this.handleWorkspaceConfigurationEditingError(e)}}addFolders(e,t=!1){let i=e.map(e=>({uri:(0,sc.removeTrailingPathSeparator)(e.uri),name:e.name}));return this.doAddFolders(i,void 0,t)}async doAddFolders(e,t,i=!1){let r=this.contextService.getWorkbenchState();if(r!==sn.WorkbenchState.WORKSPACE){let i=this.contextService.getWorkspace().folders.map(e=>({uri:e.uri}));if(i.splice("number"==typeof t?t:i.length,0,...e),i=(0,oL.distinct)(i,e=>this.uriIdentityService.extUri.getComparisonKey(e.uri)),r===sn.WorkbenchState.EMPTY&&0===i.length||r===sn.WorkbenchState.FOLDER&&1===i.length)return;return this.createAndEnterWorkspace(i)}try{await this.contextService.addFolders(e,t)}catch(e){if(i)throw e;this.handleWorkspaceConfigurationEditingError(e)}}async removeFolders(e,t=!1){if(this.includesSingleFolderWorkspace(e))return this.createAndEnterWorkspace([]);try{await this.contextService.removeFolders(e)}catch(e){if(t)throw e;this.handleWorkspaceConfigurationEditingError(e)}}includesSingleFolderWorkspace(e){if(this.contextService.getWorkbenchState()===sn.WorkbenchState.FOLDER){let t=this.contextService.getWorkspace().folders[0];return e.some(e=>this.uriIdentityService.extUri.isEqual(e,t.uri))}return!1}async createAndEnterWorkspace(e,t){if(t&&!await this.isValidTargetWorkspacePath(t))return;let i=this.environmentService.remoteAuthority,r=await this.workspacesService.createUntitledWorkspace(e,i);if(t)try{await this.saveWorkspaceAs(r,t)}finally{await this.workspacesService.deleteUntitledWorkspace(r)}else t=r.configPath,this.userDataProfileService.currentProfile.isDefault||await this.userDataProfilesService.setProfileForWorkspace(r,this.userDataProfileService.currentProfile);return this.enterWorkspace(t)}async saveAndEnterWorkspace(e){let t=this.getCurrentWorkspaceIdentifier();return t?(0,sc.isEqual)(t.configPath,e)?this.saveWorkspace(t):await this.isValidTargetWorkspacePath(e)?(await this.saveWorkspaceAs(t,e),this.enterWorkspace(e)):void 0:void 0}async isValidTargetWorkspacePath(e){return!0}async saveWorkspaceAs(e,t){let i=e.configPath;if(!(0,sn.isUntitledWorkspace)(t,this.environmentService)&&!this.userDataProfileService.currentProfile.isDefault){let e=await this.workspacesService.getWorkspaceIdentifier(t);await this.userDataProfilesService.setProfileForWorkspace(e,this.userDataProfileService.currentProfile)}if(this.uriIdentityService.extUri.isEqual(i,t))return;let r=(0,sn.isUntitledWorkspace)(i,this.environmentService),o=await this.fileService.readFile(i),n=(0,sP.rewriteWorkspaceFileForNewLocation)(o.value.toString(),i,r,t,this.uriIdentityService.extUri);await this.textFileService.create([{resource:t,value:n,options:{overwrite:!0}}]),await this.trustWorkspaceConfiguration(t)}async saveWorkspace(e){let t=e.configPath,i=this.textFileService.files.get(t);if(i)return void await i.save({force:!0,reason:aC.SaveReason.EXPLICIT});if(await this.fileService.exists(t))return;let r=(0,sP.rewriteWorkspaceFileForNewLocation)(JSON.stringify({folders:[]},null," "),t,!1,t,this.uriIdentityService.extUri);await this.textFileService.create([{resource:t,value:r}])}handleWorkspaceConfigurationEditingError(e){e.code===av.JSONEditingErrorCode.ERROR_INVALID_FILE?this.onInvalidWorkspaceConfigurationFileError():this.notificationService.error(e.message)}onInvalidWorkspaceConfigurationFileError(){let e=(0,oh.localize)(14662,"Unable to write into workspace configuration file. Please open the file to correct errors/warnings in it and try again.");this.askToOpenWorkspaceConfigurationFile(e)}askToOpenWorkspaceConfigurationFile(e){this.notificationService.prompt(s_.default.Error,e,[{label:(0,oh.localize)(14663,"Open Workspace Configuration"),run:()=>this.commandService.executeCommand("workbench.action.openWorkspaceConfigFile")}])}async doEnterWorkspace(e){if(this.environmentService.extensionTestsLocationURI)throw Error("Entering a new workspace is not possible in tests.");let t=await this.workspacesService.getWorkspaceIdentifier(e);return this.contextService.getWorkbenchState()===sn.WorkbenchState.FOLDER&&await this.migrateWorkspaceSettings(t),await this.configurationService.initialize(t),this.workspacesService.enterWorkspace(e)}migrateWorkspaceSettings(e){return this.doCopyWorkspaceSettings(e,e=>e.scope===nD.ConfigurationScope.WINDOW)}copyWorkspaceSettings(e){return this.doCopyWorkspaceSettings(e)}doCopyWorkspaceSettings(e,t){let i=nP.Registry.as(nD.Extensions.Configuration).getConfigurationProperties(),r={};for(let e of this.configurationService.keys().workspace)if(i[e]){if(t&&!t(i[e]))continue;r[e]=this.configurationService.inspect(e).workspaceValue}return this.jsonEditingService.write(e.configPath,[{path:["settings"],value:r}],!0)}async trustWorkspaceConfiguration(e){this.contextService.getWorkbenchState()!==sn.WorkbenchState.EMPTY&&this.workspaceTrustManagementService.isWorkspaceTrusted()&&await this.workspaceTrustManagementService.setUrisTrust([e],!0)}getCurrentWorkspaceIdentifier(){let e=(0,sn.toWorkspaceIdentifier)(this.contextService.getWorkspace());if((0,sn.isWorkspaceIdentifier)(e))return e}};ab=(0,rj.__decorate)([(0,rj.__param)(0,an.IJSONEditingService),(0,rj.__param)(1,nM.IWorkspaceContextService),(0,rj.__param)(2,sL.IWorkbenchConfigurationService),(0,rj.__param)(3,sl.INotificationService),(0,rj.__param)(4,a_.ICommandService),(0,rj.__param)(5,nE.IFileService),(0,rj.__param)(6,sM.ITextFileService),(0,rj.__param)(7,nL.IWorkspacesService),(0,rj.__param)(8,s7.IWorkbenchEnvironmentService),(0,rj.__param)(9,ay.IFileDialogService),(0,rj.__param)(10,ay.IDialogService),(0,rj.__param)(11,sd.IHostService),(0,rj.__param)(12,nI.IUriIdentityService),(0,rj.__param)(13,at.IWorkspaceTrustManagementService),(0,rj.__param)(14,nA.IUserDataProfilesService),(0,rj.__param)(15,sU.IUserDataProfileService)],ab);var aw=rC,ax=e.i(775937);let aD=class extends aw.Disposable{static{H=this}static{this.RECENTLY_OPENED_KEY="recently.opened"}constructor(e,t,i,r,o,n){super(),this.storageService=e,this.contextService=t,this.logService=i,this.fileService=r,this.environmentService=o,this.uriIdentityService=n,this._onRecentlyOpenedChange=this._register(new ol.Emitter),this.onDidChangeRecentlyOpened=this._onRecentlyOpenedChange.event,this.addWorkspaceToRecentlyOpened(),this.registerListeners()}registerListeners(){this._register(this.storageService.onDidChangeValue(sh.StorageScope.APPLICATION,H.RECENTLY_OPENED_KEY,this._store)(()=>this._onRecentlyOpenedChange.fire())),this._register(this.contextService.onDidChangeWorkspaceFolders(e=>this.onDidChangeWorkspaceFolders(e)))}onDidChangeWorkspaceFolders(e){if((0,sn.isTemporaryWorkspace)(this.contextService.getWorkspace()))for(let t of e.added)this.addRecentlyOpened([{folderUri:t.uri}])}addWorkspaceToRecentlyOpened(){let e=this.contextService.getWorkspace(),t=this.environmentService.remoteAuthority;switch(this.contextService.getWorkbenchState()){case sn.WorkbenchState.FOLDER:this.addRecentlyOpened([{folderUri:e.folders[0].uri,remoteAuthority:t}]);break;case sn.WorkbenchState.WORKSPACE:this.addRecentlyOpened([{workspace:{id:e.id,configPath:e.configuration},remoteAuthority:t}])}}async getRecentlyOpened(){let e=this.storageService.get(H.RECENTLY_OPENED_KEY,sh.StorageScope.APPLICATION);if(e){let t=(0,sP.restoreRecentlyOpened)(JSON.parse(e),this.logService);return t.workspaces=t.workspaces.filter(e=>!((0,sP.isRecentFolder)(e)&&e.folderUri.scheme===n_.Schemas.file&&!(0,sn.isTemporaryWorkspace)(this.contextService.getWorkspace())||(0,sP.isRecentWorkspace)(e)&&(0,sn.isTemporaryWorkspace)(e.workspace.configPath))),t}return{workspaces:[],files:[]}}async addRecentlyOpened(e){let t=await this.getRecentlyOpened();for(let i of e)(0,sP.isRecentFile)(i)?(this.doRemoveRecentlyOpened(t,[i.fileUri]),t.files.unshift(i)):((0,sP.isRecentFolder)(i)?this.doRemoveRecentlyOpened(t,[i.folderUri]):this.doRemoveRecentlyOpened(t,[i.workspace.configPath]),t.workspaces.unshift(i));return this.saveRecentlyOpened(t)}async removeRecentlyOpened(e){let t=await this.getRecentlyOpened();return this.doRemoveRecentlyOpened(t,e),this.saveRecentlyOpened(t)}doRemoveRecentlyOpened(e,t){e.files=e.files.filter(e=>!t.some(t=>t.toString()===e.fileUri.toString())),e.workspaces=e.workspaces.filter(e=>!t.some(t=>t.toString()===((0,sP.isRecentFolder)(e)?e.folderUri.toString():e.workspace.configPath.toString())))}async saveRecentlyOpened(e){return this.storageService.store(H.RECENTLY_OPENED_KEY,JSON.stringify((0,sP.toStoreData)(e)),sh.StorageScope.APPLICATION,sh.StorageTarget.USER)}async clearRecentlyOpened(){this.storageService.remove(H.RECENTLY_OPENED_KEY,sh.StorageScope.APPLICATION)}async enterWorkspace(e){return{workspace:await this.getWorkspaceIdentifier(e)}}async createUntitledWorkspace(e,t){let i=(Date.now()+Math.round(1e3*Math.random())).toString(),r=(0,sc.joinPath)(this.environmentService.untitledWorkspacesHome,`Untitled-${i}.${sn.WORKSPACE_EXTENSION}`),o=[];if(e)for(let t of e)o.push((0,sP.getStoredWorkspaceFolder)(t.uri,!0,t.name,this.environmentService.untitledWorkspacesHome,this.uriIdentityService.extUri));return await this.fileService.writeFile(r,nv.VSBuffer.fromString(JSON.stringify({folders:o,remoteAuthority:t},null," "))),this.getWorkspaceIdentifier(r)}async deleteUntitledWorkspace(e){try{await this.fileService.del(e.configPath)}catch(e){if(e.fileOperationResult!==sF.FileOperationResult.FILE_NOT_FOUND)throw e}}async getWorkspaceIdentifier(e){return(0,ax.getWorkspaceIdentifier)(e)}async getDirtyWorkspaces(){return[]}};aD=H=(0,rj.__decorate)([(0,rj.__param)(0,sg.IStorageService),(0,rj.__param)(1,nM.IWorkspaceContextService),(0,rj.__param)(2,nT.ILogService),(0,rj.__param)(3,nE.IFileService),(0,rj.__param)(4,s7.IWorkbenchEnvironmentService),(0,rj.__param)(5,nI.IUriIdentityService)],aD);var aE=e.i(973265),ak=e.i(370973),aT=e.i(751753),aR=e.i(163731),aP=e.i(108462),aI=e.i(989115),aA=e.i(545341);let aM="configResolveInputLru";class aL extends aA.AbstractVariableResolverService{static{this.INPUT_OR_COMMAND_VARIABLES_PATTERN=/\${((input|command):(.*?))}/g}constructor(e,t,i,r,o,n,s,a,l,c,d){super({getFolderUri:e=>{let t=n.getWorkspace().folders.filter(t=>t.name===e).pop();return t?t.uri:void 0},getWorkspaceFolderCount:()=>n.getWorkspace().folders.length,getConfigurationValue:(e,t)=>r.getValue(t,e?{resource:e}:{}),getAppRoot:()=>e.getAppRoot(),getExecPath:()=>e.getExecPath(),getFilePath:()=>{let e=aC.EditorResourceAccessor.getOriginalUri(i.activeEditor,{supportSideBySide:aC.SideBySideEditor.PRIMARY,filterByScheme:[n_.Schemas.file,n_.Schemas.vscodeUserData,this.pathService.defaultUriScheme]});if(e)return this.labelService.getUriLabel(e,{noPrefix:!0})},getWorkspaceFolderPathForFile:()=>{let e=aC.EditorResourceAccessor.getOriginalUri(i.activeEditor,{supportSideBySide:aC.SideBySideEditor.PRIMARY,filterByScheme:[n_.Schemas.file,n_.Schemas.vscodeUserData,this.pathService.defaultUriScheme]});if(!e)return;let t=n.getWorkspaceFolder(e);if(t)return this.labelService.getUriLabel(t.uri,{noPrefix:!0})},getSelectedText:()=>{let e=i.activeTextEditorControl,t=null;if((0,aR.isCodeEditor)(e))t=e;else if((0,aR.isDiffEditor)(e)){let i=e.getOriginalEditor(),r=e.getModifiedEditor();t=i.hasWidgetFocus()?i:r}let r=t?.getModel(),o=t?.getSelection();if(r&&o)return r.getValueInRange(o)},getLineNumber:()=>{let e=i.activeTextEditorControl;if((0,aR.isCodeEditor)(e)){let t=e.getSelection();if(t)return String(t.positionLineNumber)}},getColumnNumber:()=>{let e=i.activeTextEditorControl;if((0,aR.isCodeEditor)(e)){let t=e.getSelection();if(t)return String(t.positionColumn)}},getExtension:e=>c.getExtension(e)},a,l.userHome().then(e=>e.path),t),this.configurationService=r,this.commandService=o,this.quickInputService=s,this.labelService=a,this.pathService=l,this.storageService=d,this.userInputAccessQueue=new sb.Queue,this.resolvableVariables.add("command"),this.resolvableVariables.add("input")}async resolveWithInteractionReplace(e,t,i,r,o){let n=aI.ConfigurationResolverExpression.parse(t);return await this.resolveWithInteraction(e,n,i,r,o),n.toObject()}async resolveWithInteraction(e,t,i,r,o){let n=aI.ConfigurationResolverExpression.parse(t);for(let t of n.unresolved()){let s;if("command"===t.name){let e=(r?r[t.arg]:void 0)||t.arg,i=await this.commandService.executeCommand(e,n.toObject());if(!(0,o1.isUndefinedOrNull)(i)){if("string"!=typeof i)throw new aP.VariableError(aP.VariableKind.Command,(0,oh.localize)(13801,"Cannot substitute command variable '{0}' because command did not return a result of type string.",e));s={value:i}}}else if("input"===t.name)s=await this.showUserInput(i,t.arg,await this.resolveInputs(e,i,o),r);else if(this._contributedVariables.has(t.inner))s={value:await this._contributedVariables.get(t.inner)()};else{let i=await this.evaluateSingleVariable(t,e?.uri);if(void 0===i)continue;s="string"==typeof i?{value:i}:i}if(void 0===s)return;n.resolve(t,s)}return new Map(aT.Iterable.map(n.resolved(),([e,t])=>[e.inner,t.value]))}async resolveInputs(e,t,i){let r;if(!t)return;let o=e?{resource:e.uri}:{},n=this.configurationService.inspect(t,o);if(n)switch(i){case nw.ConfigurationTarget.MEMORY:r=n.memoryValue?.inputs;break;case nw.ConfigurationTarget.DEFAULT:r=n.defaultValue?.inputs;break;case nw.ConfigurationTarget.USER:r=n.userValue?.inputs;break;case nw.ConfigurationTarget.USER_LOCAL:r=n.userLocalValue?.inputs;break;case nw.ConfigurationTarget.USER_REMOTE:r=n.userRemoteValue?.inputs;break;case nw.ConfigurationTarget.APPLICATION:r=n.applicationValue?.inputs;break;case nw.ConfigurationTarget.WORKSPACE:r=n.workspaceValue?.inputs;break;case nw.ConfigurationTarget.WORKSPACE_FOLDER:default:r=n.workspaceFolderValue?.inputs}return r??this.configurationService.getValue(t,o)?.inputs}readInputLru(){let e=this.storageService.get(aM,sh.StorageScope.WORKSPACE),t=new sC.LRUCache(5);try{e&&t.fromJSON(JSON.parse(e))}catch{}return t}storeInputLru(e){this.storageService.store(aM,JSON.stringify(e.toJSON()),sh.StorageScope.WORKSPACE,sh.StorageTarget.MACHINE)}async showUserInput(e,t,i,r){if(!i)throw new aP.VariableError(aP.VariableKind.Input,(0,oh.localize)(13802,"Variable '{0}' must be defined in an '{1}' section of the debug or task configuration.",t,"inputs"));let o=i.filter(e=>e.id===t).pop();if(o){let i=e=>{throw new aP.VariableError(aP.VariableKind.Input,(0,oh.localize)(13803,"Input variable '{0}' is of type '{1}' and must include '{2}'.",t,o.type,e))},n=this.readInputLru(),s=`${e}.${t}`,a=n.get(s);switch(o.type){case"promptString":{(0,o1.isString)(o.description)||i("description");let e={prompt:o.description,ignoreFocusLost:!0,value:r?.[`input:${t}`]??a??o.default};return o.password&&(e.password=o.password),this.userInputAccessQueue.queue(()=>this.quickInputService.input(e)).then(e=>("string"!=typeof e||o.password||this.storeInputLru(n.set(s,e)),void 0!==e?{value:e,input:o}:void 0))}case"pickString":{if((0,o1.isString)(o.description)||i("description"),Array.isArray(o.options))for(let e of o.options)(0,o1.isString)(e)||(0,o1.isString)(e.value)||i("value");else i("options");let e=[];for(let i of o.options){let n=(0,o1.isString)(i)?i:i.value,s=(0,o1.isString)(i)?void 0:i.label,l={label:s?`${s}: ${n}`:n,value:n},c=r?.[`input:${t}`]??a??o.default;n===o.default?(l.description=(0,oh.localize)(13804,"(Default)"),e.unshift(l)):n===c?e.unshift(l):e.push(l)}let l={placeHolder:o.description,matchOnDetail:!0,ignoreFocusLost:!0};return this.userInputAccessQueue.queue(()=>this.quickInputService.pick(e,l,void 0)).then(e=>{if(e){let t=e.value;return this.storeInputLru(n.set(s,t)),{value:t,input:o}}})}case"command":return(0,o1.isString)(o.command)||i("command"),this.userInputAccessQueue.queue(()=>this.commandService.executeCommand(o.command,o.args)).then(e=>{if("string"==typeof e||(0,o1.isUndefinedOrNull)(e))return{value:e,input:o};throw new aP.VariableError(aP.VariableKind.Input,(0,oh.localize)(13805,"Cannot substitute input variable '{0}' because command '{1}' did not return a result of type string.",t,o.command))});default:throw new aP.VariableError(aP.VariableKind.Input,(0,oh.localize)(13806,"Input variable '{0}' can only be of type 'promptString', 'pickString', or 'command'.",t))}}throw new aP.VariableError(aP.VariableKind.Input,(0,oh.localize)(13807,"Undefined input variable '{0}' encountered. Remove or define '{0}' to continue.",t))}}var aF=e.i(292035);let aO=class extends aL{constructor(e,t,i,r,o,n,s,a,l){super({getAppRoot:()=>void 0,getExecPath:()=>void 0},Promise.resolve(Object.create(null)),e,t,i,r,o,n,s,a,l)}};aO=(0,rj.__decorate)([(0,rj.__param)(0,sN.IEditorService),(0,rj.__param)(1,rY.IConfigurationService),(0,rj.__param)(2,a_.ICommandService),(0,rj.__param)(3,nM.IWorkspaceContextService),(0,rj.__param)(4,su.IQuickInputService),(0,rj.__param)(5,ak.ILabelService),(0,rj.__param)(6,aF.IPathService),(0,rj.__param)(7,ai.IExtensionService),(0,rj.__param)(8,sg.IStorageService)],aO);var aN=e.i(703175),a$=e.i(68629),aH=e.i(130722),aU=e.i(425761),aW=e.i(63876);let aq=rb.URI.from({scheme:n_.Schemas.vscodeUserData,path:"/User/settings.json"});async function aj(e,t,i=aq){await (0,a$.initFile)(i,e,t)}nP.Registry.as(nD.Extensions.Configuration);let az=class extends ac{constructor(e,t,i,r,o,n,s,a){super({configurationCache:new ah([n_.Schemas.file,n_.Schemas.vscodeUserData,n_.Schemas.tmp],e,r),remoteAuthority:(0,aW.getWorkbenchConstructionOptions)().remoteAuthority},e,t,i,r,o,n,s,a)}};az=(0,rj.__decorate)([(0,rj.__param)(0,s7.IWorkbenchEnvironmentService),(0,rj.__param)(1,sU.IUserDataProfileService),(0,rj.__param)(2,nA.IUserDataProfilesService),(0,rj.__param)(3,nE.IFileService),(0,rj.__param)(4,ap.IRemoteAgentService),(0,rj.__param)(5,nI.IUriIdentityService),(0,rj.__param)(6,nT.ILogService),(0,rj.__param)(7,nR.IPolicyService)],az);class aK extends ab{constructor(){super(...arguments),this.enterWorkspace=aU.unsupported}}(0,aH.registerServiceInitializePreParticipant)(async e=>{let t=e.get(nM.IWorkspaceContextService);t.acquireInstantiationService(e.get(ou.IInstantiationService));let r=i??(0,aW.getWorkspaceIdentifier)();if(rb.URI.isUri(r)){let i=r.with({path:"/workspace.code-workspace"});try{let t=e.get(nE.IFileService);await t.createFolder(r),await t.writeFile(i,nv.VSBuffer.fromString(JSON.stringify({folders:[{path:r.path}]})))}catch{}await t.initialize({id:(0,ny.generateUuid)(),configPath:i})}else await t.initialize(r)});let aV=(0,aU.memoizedConstructor)(az);var aB=e.i(698107),aG=np;let aQ=5*sF.ByteSize.MB,aJ=class extends aG.AbstractMessageLogger{constructor(e,t,i,r){super(),this.resource=e,this.donotUseFormatters=i,this.fileService=r,this.backupIndex=1,this.buffer="",this.setLevel(t),this.flushDelayer=new sb.ThrottledDelayer(100),this.initializePromise=this.initialize()}async flush(){if(!this.buffer)return;await this.initializePromise;let e=await this.loadContent();e.length>aQ&&(await this.fileService.writeFile(this.getBackupResource(),nv.VSBuffer.fromString(e)),e=""),this.buffer&&(e+=this.buffer,this.buffer="",await this.fileService.writeFile(this.resource,nv.VSBuffer.fromString(e)))}async initialize(){try{await this.fileService.createFile(this.resource)}catch(e){if(e.fileOperationResult!==sF.FileOperationResult.FILE_MODIFIED_SINCE)throw e}}log(e,t){this.donotUseFormatters?this.buffer+=t:this.buffer+=`${this.getCurrentTimestamp()} [${this.stringifyLogLevel(e)}] ${t}
|
|
71
|
+
`,this.flushDelayer.trigger(()=>this.flush())}getCurrentTimestamp(){let e,t=e=>e<10?`0${e}`:e,i=new Date;return`${i.getFullYear()}-${t(i.getMonth()+1)}-${t(i.getDate())} ${t(i.getHours())}:${t(i.getMinutes())}:${t(i.getSeconds())}.${(e=i.getMilliseconds())<10?`00${e}`:e<100?`0${e}`:e}`}getBackupResource(){return this.backupIndex=this.backupIndex>5?1:this.backupIndex,(0,sc.joinPath)((0,sc.dirname)(this.resource),`${(0,sc.basename)(this.resource)}_${this.backupIndex++}`)}async loadContent(){try{return(await this.fileService.readFile(this.resource)).value.toString()}catch(e){return""}}stringifyLogLevel(e){switch(e){case aG.LogLevel.Debug:return"debug";case aG.LogLevel.Error:return"error";case aG.LogLevel.Info:return"info";case aG.LogLevel.Trace:return"trace";case aG.LogLevel.Warning:return"warning"}return""}};aJ=(0,rj.__decorate)([(0,rj.__param)(3,nE.IFileService)],aJ);class aY extends aG.AbstractLoggerService{constructor(e,t,i){super(e,t),this.fileService=i}doCreateLogger(e,t,i){let r=new aB.BufferLogger(t);return(0,sF.whenProviderRegistered)(e,this.fileService).then(()=>r.logger=new aJ(e,r.getLevel(),!!i?.donotUseFormatters,this.fileService)),r}}var aX=e.i(37305),aZ=e.i(253642),a0=e.i(753062),a1=e.i(885277),a2=rC;let a6=class extends a2.Disposable{constructor(e,t,i,r,o){super(),this.environmentService=e,this.fileService=t,this.jsonEditingService=i,this.logService=r,this.loggerService=o,this._onDidChangeDefaultLogLevels=this._register(new ol.Emitter),this.onDidChangeDefaultLogLevels=this._onDidChangeDefaultLogLevels.event,this._defaultLogLevels={default:this._getDefaultLogLevelFromEnv(),extensions:this._getExtensionsDefaultLogLevelsFromEnv()},this._register(this.fileService.onDidFilesChange(e=>{e.contains(this.environmentService.argvResource)&&this.onDidChangeArgv()}))}async onDidChangeArgv(){let e=await this._parseLogLevelsFromArgv();this.updateDefaultLogLevels(e)}get defaultLogLevels(){return this._defaultLogLevels}updateDefaultLogLevels(e){let t={default:e?.default??this._getDefaultLogLevelFromEnv(),extensions:e?.extensions??this._getExtensionsDefaultLogLevelsFromEnv()};(0,nF.equals)(this._defaultLogLevels,t)||(this._defaultLogLevels=t,this._onDidChangeDefaultLogLevels.fire(this._defaultLogLevels))}getDefaultLogLevel(e){return e?(e=e.toLowerCase(),this._getDefaultLogLevel(this._defaultLogLevels,e)):this._getDefaultLogLevel(this._defaultLogLevels)}async setDefaultLogLevel(e,t){let i=await this._parseLogLevelsFromArgv()??{};if(t){t=t.toLowerCase();let r=this._getDefaultLogLevel(i,t);i.extensions=i.extensions??[];let o=i.extensions.find(([e])=>e===t);for(let{resource:n}of(o?o[1]=e:i.extensions.push([t,e]),await this._writeLogLevelsToArgv(i),[...this.loggerService.getRegisteredLoggers()].filter(e=>e.extensionId&&e.extensionId.toLowerCase()===t)))this.loggerService.getLogLevel(n)===r&&this.loggerService.setLogLevel(n,e)}else{let t=this._getDefaultLogLevel(i);i.default=e,await this._writeLogLevelsToArgv(i),this.loggerService.getLogLevel()===t&&this.loggerService.setLogLevel(e)}this.updateDefaultLogLevels(i)}_getDefaultLogLevel(e,t){if(t){let i=e.extensions?.find(([e])=>e===t);if(i)return i[1]}return e.default??(0,np.getLogLevel)(this.environmentService)}async _writeLogLevelsToArgv(e){let t=[];for(let[i,r]of((0,o1.isUndefined)(e.default)||t.push((0,np.LogLevelToString)(e.default)),e.extensions??[]))t.push(`${i}=${(0,np.LogLevelToString)(r)}`);await this.jsonEditingService.write(this.environmentService.argvResource,[{path:["log-level"],value:t.length?t:void 0}],!0)}async _parseLogLevelsFromArgv(){let e={extensions:[]};for(let t of(await this._readLogLevelsFromArgv())){let i=a1.EXTENSION_IDENTIFIER_WITH_LOG_REGEX.exec(t);if(i&&i[1]&&i[2]){let t=(0,np.parseLogLevel)(i[2]);(0,o1.isUndefined)(t)||e.extensions?.push([i[1].toLowerCase(),t])}else{let i=(0,np.parseLogLevel)(t);(0,o1.isUndefined)(i)||(e.default=i)}}return!(0,o1.isUndefined)(e.default)||e.extensions?.length?e:void 0}async _readLogLevelsFromArgv(){try{let e=await this.fileService.readFile(this.environmentService.argvResource),t=(0,sI.parse)(e.value.toString());return(0,o1.isString)(t["log-level"])?[t["log-level"]]:Array.isArray(t["log-level"])?t["log-level"]:[]}catch(e){(0,sF.toFileOperationResult)(e)!==sF.FileOperationResult.FILE_NOT_FOUND&&this.logService.error(e)}return[]}_getDefaultLogLevelFromEnv(){return(0,np.getLogLevel)(this.environmentService)}_getExtensionsDefaultLogLevelsFromEnv(){let e=[];for(let[t,i]of this.environmentService.extensionLogLevel??[]){let r=(0,np.parseLogLevel)(i);(0,o1.isUndefined)(r)||e.push([t,r])}return e}};a6=(0,rj.__decorate)([(0,rj.__param)(0,s7.IWorkbenchEnvironmentService),(0,rj.__param)(1,nE.IFileService),(0,rj.__param)(2,an.IJSONEditingService),(0,rj.__param)(3,nT.ILogService),(0,rj.__param)(4,nT.ILoggerService)],a6);var a3=e.i(669827),a4=e.i(884425);let a5=(0,oh.localize)(0,"Window");var a8=e.i(262072),a7=oi,a9=e.i(701898),le=e.i(558493),lt=e.i(812491),li=e.i(536367);let lr=class extends a9.Action{static{this.ID="workbench.action.setLogLevel"}static{this.TITLE=(0,oh.localize2)(8589,"Set Log Level...")}constructor(e,t,i,r,o,n){super(e,t),this.quickInputService=i,this.loggerService=r,this.outputService=o,this.defaultLogLevelsService=n}async run(){let e=await this.selectLogLevelOrChannel();null!==e&&((0,np.isLogLevel)(e)?this.loggerService.setLogLevel(e):await this.setLogLevelForChannel(e))}async selectLogLevelOrChannel(){let e=this.defaultLogLevelsService.defaultLogLevels,t=[],i=[],r=this.loggerService.getLogLevel();for(let e of this.outputService.getChannelDescriptors()){if(!this.outputService.canSetLogLevel(e))continue;let o=(0,le.isSingleSourceOutputChannelDescriptor)(e)?[e.source]:(0,le.isMultiSourceOutputChannelDescriptor)(e)?e.source:[];if(!o.length)continue;let n=o.reduce((e,t)=>Math.min(e,this.loggerService.getLogLevel(t.resource)??r),r),s={id:e.id,label:e.label,description:n!==r?this.getLabel(n):void 0,channel:e};e.extensionId?t.push(s):i.push(s)}let o=[];return o.push({type:"separator",label:(0,oh.localize)(8590,"All")}),o.push(...this.getLogLevelEntries(e.default,this.loggerService.getLogLevel(),!0)),t.length&&(o.push({type:"separator",label:(0,oh.localize)(8591,"Extension Logs")}),o.push(...t.sort((e,t)=>e.label.localeCompare(t.label)))),o.push({type:"separator",label:(0,oh.localize)(8592,"Logs")}),o.push(...i.sort((e,t)=>e.label.localeCompare(t.label))),new Promise((e,t)=>{let i,r=new rC.DisposableStore,n=r.add(this.quickInputService.createQuickPick({useSeparators:!0}));n.placeholder=(0,oh.localize)(8593,"Set Log Level"),n.items=o,r.add(n.onDidTriggerItemButton(e=>{n.hide(),this.defaultLogLevelsService.setDefaultLogLevel(e.item.level)})),r.add(n.onDidAccept(e=>{i=n.selectedItems[0],n.hide()})),r.add(n.onDidHide(()=>{let t=i?i.level??i:null;r.dispose(),e(t)})),n.show()})}async setLogLevelForChannel(e){let t=this.defaultLogLevelsService.defaultLogLevels,i=t.extensions.find(t=>t[0]===e.channel.extensionId?.toLowerCase())?.[1]??t.default,r=this.getLogLevelEntries(i,this.outputService.getLogLevel(e.channel)??i,!!e.channel.extensionId);return new Promise((t,i)=>{let o,n=new rC.DisposableStore,s=n.add(this.quickInputService.createQuickPick());s.placeholder=e?(0,oh.localize)(8594," {0}: Select log level",e?.label):(0,oh.localize)(8595,"Select log level"),s.items=r,s.activeItems=r.filter(e=>e.level===this.loggerService.getLogLevel()),n.add(s.onDidTriggerItemButton(t=>{s.hide(),this.defaultLogLevelsService.setDefaultLogLevel(t.item.level,e.channel.extensionId)})),n.add(s.onDidAccept(e=>{o=s.selectedItems[0],s.hide()})),n.add(s.onDidHide(()=>{o&&this.outputService.setLogLevel(e.channel,o.level),n.dispose(),t()})),s.show()})}getLogLevelEntries(e,t,i){let r=i?{iconClass:li.ThemeIcon.asClassName(ov.Codicon.checkAll),tooltip:(0,oh.localize)(8596,"Set as Default Log Level")}:void 0;return[{label:this.getLabel(np.LogLevel.Trace,t),level:np.LogLevel.Trace,description:this.getDescription(np.LogLevel.Trace,e),buttons:r&&e!==np.LogLevel.Trace?[r]:void 0},{label:this.getLabel(np.LogLevel.Debug,t),level:np.LogLevel.Debug,description:this.getDescription(np.LogLevel.Debug,e),buttons:r&&e!==np.LogLevel.Debug?[r]:void 0},{label:this.getLabel(np.LogLevel.Info,t),level:np.LogLevel.Info,description:this.getDescription(np.LogLevel.Info,e),buttons:r&&e!==np.LogLevel.Info?[r]:void 0},{label:this.getLabel(np.LogLevel.Warning,t),level:np.LogLevel.Warning,description:this.getDescription(np.LogLevel.Warning,e),buttons:r&&e!==np.LogLevel.Warning?[r]:void 0},{label:this.getLabel(np.LogLevel.Error,t),level:np.LogLevel.Error,description:this.getDescription(np.LogLevel.Error,e),buttons:r&&e!==np.LogLevel.Error?[r]:void 0},{label:this.getLabel(np.LogLevel.Off,t),level:np.LogLevel.Off,description:this.getDescription(np.LogLevel.Off,e),buttons:r&&e!==np.LogLevel.Off?[r]:void 0}]}getLabel(e,t){let i=(0,np.LogLevelToLocalizedString)(e).value;return e===t?`$(check) ${i}`:i}getDescription(e,t){return t===e?(0,oh.localize)(8597,"Default"):void 0}};lr=(0,rj.__decorate)([(0,rj.__param)(2,su.IQuickInputService),(0,rj.__param)(3,nT.ILoggerService),(0,rj.__param)(4,lt.IOutputService),(0,rj.__param)(5,a3.IDefaultLogLevelsService)],lr),class extends a9.Action{static{this.ID="workbench.action.openSessionLogFile"}static{this.TITLE=(0,oh.localize2)(8598,"Open Window Log File (Session)...")}constructor(e,t,i,r,o,n){super(e,t),this.environmentService=i,this.fileService=r,this.quickInputService=o,this.editorService=n}async run(){let e=await this.quickInputService.pick(this.getSessions().then(e=>e.map((e,t)=>({id:e.toString(),label:(0,sc.basename)(e),description:0===t?(0,oh.localize)(8599,"Current"):void 0}))),{canPickMany:!1,placeHolder:(0,oh.localize)(8600,"Select Session")});if(e){let t=await this.quickInputService.pick(this.getLogFiles(rb.URI.parse(e.id)).then(e=>e.map(e=>({id:e.toString(),label:(0,sc.basename)(e)}))),{canPickMany:!1,placeHolder:(0,oh.localize)(8601,"Select Log file")});if(t)return this.editorService.openEditor({resource:rb.URI.parse(t.id),options:{pinned:!0}}).then(()=>void 0)}}async getSessions(){let e=this.environmentService.logsHome.with({scheme:this.environmentService.logFile.scheme}),t=[e],i=await this.fileService.resolve((0,sc.dirname)(e));return i.children&&t.push(...i.children.filter(t=>!(0,sc.isEqual)(t.resource,e)&&t.isDirectory&&/^\d{8}T\d{6}$/.test(t.name)).sort().reverse().map(e=>e.resource)),t}async getLogFiles(e){let t=await this.fileService.resolve(e);return t.children?t.children.filter(e=>!e.isDirectory).map(e=>e.resource):[]}};var lo=rC;(0,a7.registerAction2)(class extends a7.Action2{constructor(){super({id:lr.ID,title:lr.TITLE,category:a8.Categories.Developer,f1:!0})}run(e){let t=e.get(ou.IInstantiationService).createInstance(lr,lr.ID,lr.TITLE.value);return t.run().finally(()=>t.dispose())}}),(0,a7.registerAction2)(class extends a7.Action2{constructor(){super({id:"workbench.action.setDefaultLogLevel",title:(0,oh.localize2)(8586,"Set Default Log Level"),category:a8.Categories.Developer})}run(e,t,i){return e.get(a3.IDefaultLogLevelsService).setDefaultLogLevel(t,i)}});let ln=class extends lo.Disposable{constructor(e,t,i){super(),this.loggerService=e,this.contextKeyService=t,this.uriIdentityService=i,this.contextKeys=new sC.CounterSet,this.outputChannelRegistry=nP.Registry.as(le.Extensions.OutputChannels);const r=np.CONTEXT_LOG_LEVEL.bindTo(t);r.set((0,np.LogLevelToString)(e.getLogLevel())),this._register(e.onDidChangeLogLevel(t=>{(0,np.isLogLevel)(t)&&r.set((0,np.LogLevelToString)(e.getLogLevel()))})),this.onDidAddLoggers(e.getRegisteredLoggers()),this._register(e.onDidChangeLoggers(({added:e,removed:t})=>{this.onDidAddLoggers(e),this.onDidRemoveLoggers(t)})),this._register(e.onDidChangeVisibility(([t,i])=>{let r=e.getRegisteredLogger(t);r&&(i?this.registerLogChannel(r):this.deregisterLogChannel(r))})),this.registerShowWindowLogAction(),this._register(ol.Event.filter(t.onDidChangeContext,e=>e.affectsSome(this.contextKeys))(()=>this.onDidChangeContext()))}onDidAddLoggers(e){for(let t of e){if(t.when){let e=oo.ContextKeyExpr.deserialize(t.when);if(e){for(let t of e.keys())this.contextKeys.add(t);if(!this.contextKeyService.contextMatchesRules(e))continue}}t.hidden||this.registerLogChannel(t)}}onDidChangeContext(){for(let e of this.loggerService.getRegisteredLoggers())e.when&&(this.contextKeyService.contextMatchesRules(oo.ContextKeyExpr.deserialize(e.when))?this.registerLogChannel(e):this.deregisterLogChannel(e))}onDidRemoveLoggers(e){for(let t of e){if(t.when){let e=oo.ContextKeyExpr.deserialize(t.when);if(e)for(let t of e.keys())this.contextKeys.delete(t)}this.deregisterLogChannel(t)}}registerLogChannel(e){if(e.group)return void this.registerCompoundLogChannel(e.group.id,e.group.name,e);let t=this.outputChannelRegistry.getChannel(e.id);if(t&&(0,le.isSingleSourceOutputChannelDescriptor)(t)&&this.uriIdentityService.extUri.isEqual(t.source.resource,e.resource))return;let i=this.outputChannelRegistry.getChannel(e.id),r=i&&(0,le.isSingleSourceOutputChannelDescriptor)(i)&&i.source.resource.scheme===n_.Schemas.vscodeRemote?this.loggerService.getRegisteredLogger(i.source.resource):void 0;r&&this.deregisterLogChannel(r);let o=i&&e.resource.scheme===n_.Schemas.vscodeRemote,n=o?`${e.id}.remote`:e.id,s=o?(0,oh.localize)(8587,"{0} (Remote)",e.name??e.id):e.name??e.id;this.outputChannelRegistry.registerChannel({id:n,label:s,source:{resource:e.resource},log:!0,extensionId:e.extensionId})}registerCompoundLogChannel(e,t,i){let r=this.outputChannelRegistry.getChannel(e),o={resource:i.resource,name:i.name??i.id};r?(0,le.isMultiSourceOutputChannelDescriptor)(r)&&!r.source.some(({resource:e})=>this.uriIdentityService.extUri.isEqual(e,i.resource))&&this.outputChannelRegistry.updateChannelSources(e,[...r.source,o]):this.outputChannelRegistry.registerChannel({id:e,label:t,log:!0,source:[o]})}deregisterLogChannel(e){if(e.group){let t=this.outputChannelRegistry.getChannel(e.group.id);t&&(0,le.isMultiSourceOutputChannelDescriptor)(t)&&this.outputChannelRegistry.updateChannelSources(e.group.id,t.source.filter(({resource:t})=>!this.uriIdentityService.extUri.isEqual(t,e.resource)))}else this.outputChannelRegistry.removeChannel(e.id)}registerShowWindowLogAction(){this._register((0,a7.registerAction2)(class extends a7.Action2{constructor(){super({id:a0.showWindowLogActionId,title:(0,oh.localize2)(8588,"Show Window Log"),category:a8.Categories.Developer,f1:!0})}async run(e){e.get(lt.IOutputService).showChannel(a0.windowLogId)}}))}};ln=(0,rj.__decorate)([(0,rj.__param)(0,nT.ILoggerService),(0,rj.__param)(1,oS.IContextKeyService),(0,rj.__param)(2,nI.IUriIdentityService)],ln),nP.Registry.as(sr.Extensions.Workbench).registerWorkbenchContribution(ln,so.LifecyclePhase.Restored);let ls=class extends aY{constructor(e,t,i){super(e??(0,np.getLogLevel)(i),aW.logsPath,t)}};ls=(0,rj.__decorate)([(0,rj.__param)(1,nE.IFileService),(0,rj.__param)(2,aZ.IEnvironmentService)],ls);let la=[],ll=class extends aX.LogService{constructor(e,t){super(e.createLogger(t.logFile,{id:a0.windowLogId,name:a5}),la)}};ll=(0,rj.__decorate)([(0,rj.__param)(0,nT.ILoggerService),(0,rj.__param)(1,s7.IWorkbenchEnvironmentService)],ll);var lc=rC,ld=e.i(132485),lu=e.i(445152),lh=e.i(935868),lg=e.i(935144),lp=rC,lm=e.i(565280);let lf=class extends lp.Disposable{constructor(e,t,i){super(),this._modelService=e,this._textModelService=t,this._undoRedoService=i,this._register(this._modelService.onModelRemoved(e=>{let t=this._undoRedoService.getElements(e.uri);if(0!==t.past.length||0!==t.future.length){for(let e of t.past)e instanceof lm.MultiModelEditStackElement&&e.setDelegate(this);for(let e of t.future)e instanceof lm.MultiModelEditStackElement&&e.setDelegate(this)}}))}prepareUndoRedo(e){let t=e.getMissingModels();return 0===t.length?lp.Disposable.None:Promise.all(t.map(async e=>{try{return await this._textModelService.createModelReference(e)}catch(e){return lp.Disposable.None}})).then(e=>({dispose:()=>(0,lp.dispose)(e)}))}};lf=(0,rj.__decorate)([(0,rj.__param)(0,rO.IModelService),(0,rj.__param)(1,sO.ITextModelService),(0,rj.__param)(2,lg.IUndoRedoService)],lf);var lv=e.i(141103);let l_=class extends lc.ReferenceCollection{constructor(e,t,i,r){super(),this.instantiationService=e,this.textFileService=t,this.fileService=i,this.modelService=r,this.providers=new Map,this.modelsToDispose=new Set}createReferencedObject(e){return this.doCreateReferencedObject(e)}async doCreateReferencedObject(e,t){this.modelsToDispose.delete(e);let i=rb.URI.parse(e);if(i.scheme===n_.Schemas.inMemory){if(!this.modelService.getModel(i))throw Error(`Unable to resolve inMemory resource ${e}`);let t=this.instantiationService.createInstance(ld.TextResourceEditorModel,i);if(this.ensureResolvedModel(t,e))return t}if(i.scheme===n_.Schemas.untitled){let t=await this.textFileService.untitled.resolve({untitledResource:i});if(this.ensureResolvedModel(t,e))return t}if(this.fileService.hasProvider(i)){let t=await this.textFileService.files.resolve(i,{reason:lu.TextFileResolveReason.REFERENCE});if(this.ensureResolvedModel(t,e))return t}if(this.providers.has(i.scheme)){await this.resolveTextModelContent(e);let t=this.instantiationService.createInstance(ld.TextResourceEditorModel,i);if(this.ensureResolvedModel(t,e))return t}if(!t)return await this.fileService.activateProvider(i.scheme),this.doCreateReferencedObject(e,!0);throw Error(`Unable to resolve resource ${e}`)}ensureResolvedModel(e,t){if(e.textEditorModel)return!0;throw Error(`Unable to resolve resource ${t}`)}destroyReferencedObject(e,t){rb.URI.parse(e).scheme!==n_.Schemas.inMemory&&(this.modelsToDispose.add(e),(async()=>{try{let i=await t;if(!this.modelsToDispose.has(e)||(i instanceof lh.TextFileEditorModel?await this.textFileService.files.canDispose(i):i instanceof lv.UntitledTextEditorModel&&await this.textFileService.untitled.canDispose(i),!this.modelsToDispose.has(e)))return;i.dispose()}catch(e){}finally{this.modelsToDispose.delete(e)}})())}registerTextModelContentProvider(e,t){let i=this.providers.get(e);return i||(i=[],this.providers.set(e,i)),i.unshift(t),(0,lc.toDisposable)(()=>{let i=this.providers.get(e);if(!i)return;let r=i.indexOf(t);-1!==r&&(i.splice(r,1),0===i.length&&this.providers.delete(e))})}hasTextModelContentProvider(e){return void 0!==this.providers.get(e)}async resolveTextModelContent(e){let t=rb.URI.parse(e);for(let e of this.providers.get(t.scheme)||[]){let i=await e.provideTextContent(t);if(i)return i}throw Error(`Unable to resolve text model content for resource ${e}`)}};l_=(0,rj.__decorate)([(0,rj.__param)(0,ou.IInstantiationService),(0,rj.__param)(1,sM.ITextFileService),(0,rj.__param)(2,nE.IFileService),(0,rj.__param)(3,rO.IModelService)],l_);let ly=class extends lc.Disposable{get resourceModelCollection(){return this._resourceModelCollection||(this._resourceModelCollection=this.instantiationService.createInstance(l_)),this._resourceModelCollection}get asyncModelCollection(){return this._asyncModelCollection||(this._asyncModelCollection=new lc.AsyncReferenceCollection(this.resourceModelCollection)),this._asyncModelCollection}constructor(e,t,i,r,o){super(),this.instantiationService=e,this.fileService=t,this.undoRedoService=i,this.modelService=r,this.uriIdentityService=o,this._resourceModelCollection=void 0,this._asyncModelCollection=void 0,this._register(new lf(this.modelService,this,this.undoRedoService))}async createModelReference(e){return e=this.uriIdentityService.asCanonicalUri(e),await this.asyncModelCollection.acquire(e.toString())}registerTextModelContentProvider(e,t){return this.resourceModelCollection.registerTextModelContentProvider(e,t)}canHandleResource(e){return!!this.fileService.hasProvider(e)||e.scheme===n_.Schemas.untitled||e.scheme===n_.Schemas.inMemory||this.resourceModelCollection.hasTextModelContentProvider(e.scheme)}};ly=(0,rj.__decorate)([(0,rj.__param)(0,ou.IInstantiationService),(0,rj.__param)(1,nE.IFileService),(0,rj.__param)(2,lg.IUndoRedoService),(0,rj.__param)(3,rO.IModelService),(0,rj.__param)(4,nI.IUriIdentityService)],ly);let lC=e=>{if(e instanceof URL)return e.href;{let t=btoa(Array.from(new TextEncoder().encode(e),e=>String.fromCodePoint(e)).join(""));return new URL(`data:text/plain;base64,${t}`).href}},lS=()=>{"u"<typeof MonacoEnvironment&&(globalThis.MonacoEnvironment={});let e=MonacoEnvironment;return void 0===e.vscodeApiInitialising&&(e.vscodeApiInitialising=!1),void 0===e.vscodeApiInitialised&&(e.vscodeApiInitialised=!1),void 0===e.viewServiceType&&(e.viewServiceType="EditorService"),e},lb=(e,t)=>{if(void 0!==t)for(let[i,r]of Object.entries(t))e[i]=r},lw=async(e,t,i,r)=>{r?.info("Received open editor call with parameters: ",e,t,i)};class lx{url;options;constructor(e,t){this.url=e,this.options=t}}let lD=e=>{let t=lS();t.getWorkerUrl=(t,i)=>(e.logger?.info(`getWorkerUrl: workerId: ${t} label: ${i}`),e.workerLoaders?.[i]?.().url.toString()),t.getWorkerOptions=(t,i)=>(e.logger?.info(`getWorkerOptions: moduleId: ${t} label: ${i}`),e.workerLoaders?.[i]?.().options)},lE=t=>{lD({workerLoaders:{editorWorkerService:()=>new lx(new e.U(e.r(310336)),{type:"module"}),extensionHostWorkerMain:()=>new lx(new e.U(e.r(969663)),{type:"module"}),TextMateWorker:()=>new lx(new e.U(e.r(859546)),{type:"module"}),OutputLinkDetectionWorker:void 0,LanguageDetectionWorker:void 0,NotebookEditorWorker:void 0,LocalFileSearchWorker:void 0},logger:t})};var lk=e.i(663544);e.i(610504);class lT{logger=new np.ConsoleLogger;extensionRegisterResults=new Map;disposableStore=new rC.DisposableStore;apiConfig;constructor(e){this.apiConfig={...e,serviceOverrides:e.serviceOverrides??{},logLevel:e.logLevel??np.LogLevel.Off},this.logger.setLevel(this.apiConfig.logLevel)}getExtensionRegisterResult(e){return this.extensionRegisterResults.get(e)}getMonacoVscodeApiConfig(){return this.apiConfig}configureMonacoWorkers(){"function"==typeof this.apiConfig.monacoWorkerFactory?this.apiConfig.monacoWorkerFactory(this.logger):lD({logger:this.logger})}performErrorHandling=e=>{throw lS().vscodeApiInitialising=!1,Error(e)};async configureHighlightingServices(){if("extended"===this.apiConfig.$type){let t=(await e.A(940730)).default,i=(await e.A(509433)).default,r=(await e.A(545594)).default;lb(this.apiConfig.serviceOverrides,{...r(),...t(),...i()})}else{let t=(await e.A(963197)).default;lb(this.apiConfig.serviceOverrides,{...t()})}}async configureViewsServices(){let t=this.apiConfig.viewsConfig.$type;("ViewsService"===t||"WorkbenchService"===t)&&("classic"===this.apiConfig.$type&&this.performErrorHandling(`View Service Type "${t}" cannot be used with classic configuration.`),void 0===this.apiConfig.viewsConfig.htmlContainer&&this.performErrorHandling(`View Service Type "${t}" requires a HTMLElement.`));let i=lS();if("ViewsService"===t){let t=(await e.A(974099)).default;lb(this.apiConfig.serviceOverrides,{...t(this.apiConfig.viewsConfig.openEditorFunc??lw)}),i.viewServiceType="ViewsService"}else if("WorkbenchService"===t){let t=(await e.A(924017)).default;lb(this.apiConfig.serviceOverrides,{...t()}),i.viewServiceType="WorkbenchService"}else{let t=(await e.A(872082)).default;lb(this.apiConfig.serviceOverrides,{...t(this.apiConfig.viewsConfig.openEditorFunc??lw)}),i.viewServiceType="EditorService"}}async applyViewsPostConfig(){let e=this.apiConfig.viewsConfig.$type;("ViewsService"===e||"WorkbenchService"===e)&&(this.apiConfig.viewsConfig.htmlAugmentationInstructions?.(this.apiConfig.viewsConfig.htmlContainer),await this.apiConfig.viewsConfig.viewsInitFunc?.())}configureWorkspaceConfig(){void 0===this.apiConfig.workspaceConfig&&(this.apiConfig.workspaceConfig={workspaceProvider:{trusted:!0,workspace:{workspaceUri:lk.Uri.file("/workspace.code-workspace")},open:async()=>(window.open(window.location.href),!0)}})}configureDevLogLevel(){let e=this.apiConfig.workspaceConfig?.developmentOptions?.logLevel;if(void 0===e){let e={...this.apiConfig.workspaceConfig.developmentOptions};e.logLevel=this.apiConfig.logLevel,this.apiConfig.workspaceConfig.developmentOptions=Object.assign({},e)}else e!==this.apiConfig.logLevel?this.performErrorHandling(`You have configured mismatching logLevels: ${this.apiConfig.logLevel} (wrapperConfig) ${e} (workspaceConfig.developmentOptions)`):this.logger.debug("Development log level and api log level are in aligned.")}configureSemanticHighlighting(){if(this.apiConfig.advanced?.enforceSemanticHighlighting===!0){let e={...this.apiConfig.workspaceConfig.configurationDefaults??{}};e["editor.semanticHighlighting.enabled"]=!0,this.apiConfig.workspaceConfig.configurationDefaults=Object.assign({},e)}}async initUserConfiguration(){this.apiConfig.userConfiguration?.json!==void 0&&await aj(this.apiConfig.userConfiguration.json)}async supplyRequiredServices(){return{...(i=void 0,{...(0,a$.default)(),[rY.IConfigurationService.toString()]:new nk.SyncDescriptor(aV,[],!0),[nM.IWorkspaceContextService.toString()]:new nk.SyncDescriptor(aV,[],!0),[nC.ITextResourceConfigurationService.toString()]:new nk.SyncDescriptor(nx,[],!0),[aE.IWorkspaceEditingService.toString()]:new nk.SyncDescriptor(aK,[],!0),[nL.IWorkspacesService.toString()]:new nk.SyncDescriptor(aD,[],!0),[nC.ITextResourcePropertiesService.toString()]:new nk.SyncDescriptor(af,[],!0),[aN.IConfigurationResolverService.toString()]:new nk.SyncDescriptor(aO,[],!0)}),...{...(0,a4.default)(),[nT.ILoggerService.toString()]:new nk.SyncDescriptor(ls,[void 0],!0),[nT.ILogService.toString()]:new nk.SyncDescriptor(ll,[],!0),[a3.IDefaultLogLevelsService.toString()]:new nk.SyncDescriptor(a6,[],!0)},...{[sO.ITextModelService.toString()]:new nk.SyncDescriptor(ly,[],!0)}}}checkServiceConsistency(){let e=this.apiConfig.serviceOverrides,t=Object.keys(e).includes("themeService"),i=Object.keys(e).includes("textMateTokenizationFeature"),r=Object.keys(e).includes("markersService"),o=Object.keys(e).includes("viewsService");t&&!i&&this.performErrorHandling('"theme" service requires "textmate" service. Please add it to the "userServices".'),r&&!o&&this.performErrorHandling('"markers" service requires "views" service. Please add it to the "userServices".')}async initAllServices(t){let i=await this.supplyRequiredServices();if(lb(i,this.apiConfig.serviceOverrides),this.apiConfig.advanced?.loadExtensionServices===void 0||!0===this.apiConfig.advanced.loadExtensionServices){let{default:t}=await e.A(473446);lb(i,{...t({enableWorkerExtensionHost:this.apiConfig.advanced?.enableExtHostWorker===!0})})}var r=this.logger;for(let e of Object.keys(i))r?.debug(`Loading service: ${e}`);(t??!0)&&this.checkServiceConsistency(),"ViewsService"===this.apiConfig.viewsConfig.$type||"WorkbenchService"===this.apiConfig.viewsConfig.$type?await (0,rm.initialize)(i,this.apiConfig.viewsConfig.htmlContainer,this.apiConfig.workspaceConfig,this.apiConfig.envOptions):await (0,rm.initialize)(i,void 0,this.apiConfig.workspaceConfig,this.apiConfig.envOptions),(0,oO.setUnexpectedErrorHandler)(e=>{this.logger.getLevel()!==np.LogLevel.Off&&this.logger.error("Unexpected error",e)})}async initExtensions(){"extended"===this.apiConfig.$type&&(this.apiConfig.advanced?.loadThemes===void 0||!0===this.apiConfig.advanced.loadThemes)&&await e.A(876468);let t=this.apiConfig.extensions;if(this.apiConfig.extensions){let e=[],i=[];for(let r of((0,nm.getBuiltinExtensions)().forEach(e=>{i.push(e.identifier.id)}),t??[]))i.includes(`${r.config.publisher}.${r.config.name}`)||e.push(this.initExtension(r,i));await Promise.all(e)}}initExtension(e,t){if(t.includes(`${e.config.publisher}.${e.config.name}`))return Promise.resolve();{let t=e.config,i=(0,nm.registerExtension)(t,nf.ExtensionHostKind.LocalProcess);if(this.extensionRegisterResults.set(t.name,i),e.filesOrContents&&Object.hasOwn(i,"registerFileUrl"))for(let t of e.filesOrContents)this.disposableStore.add(i.registerFileUrl(t[0],lC(t[1])));return i.whenReady()}}markGlobalInit(){this.logger.debug("markGlobalInit");let e=lS();e.vscodeApiGlobalInitAwait=new Promise(t=>{e.vscodeApiGlobalInitResolve=t})}markGlobalInitDone(){let e=lS();e.vscodeApiGlobalInitResolve?.(),e.vscodeApiInitialised=!0,e.vscodeApiGlobalInitAwait=void 0,e.vscodeApiGlobalInitResolve=void 0,this.logger.debug("markGlobalInitDone")}async start(e){let t=lS();!0===t.vscodeApiInitialised?this.logger.warn("Initialization of monaco-vscode api can only performed once!"):!0!==t.vscodeApiInitialising?(t.vscodeApiInitialising=!0,this.markGlobalInit(),this.configureWorkspaceConfig(),this.configureDevLogLevel(),this.logger.info(`Initializing monaco-vscode api. Caller: ${e?.caller??"unknown"}`),await this.configureMonacoWorkers(),await this.configureHighlightingServices(),await this.configureViewsServices(),this.configureSemanticHighlighting(),await this.initUserConfiguration(),await this.initAllServices(e?.performServiceConsistencyChecks),await this.applyViewsPostConfig(),await this.initExtensions(),this.markGlobalInitDone(),this.logger.debug("Initialization of monaco-vscode api completed successfully.")):this.logger.debug("Initialization of monaco-vscode api is already ongoing.")}dispose(){this.extensionRegisterResults.forEach(e=>e.dispose()),this.disposableStore.dispose(),this.disposableStore=new rC.DisposableStore}}var lR=e.i(269213),lP=lR;class lI extends lP.AbstractMessageReader{socket;state="initial";callback;events=[];constructor(e){super(),this.socket=e,this.socket.onMessage(e=>this.readMessage(e)),this.socket.onError(e=>this.fireError(e)),this.socket.onClose((e,t)=>{if(1e3!==e){let i={name:""+e,message:`Error during socket reconnect: code = ${e}, reason = ${t}`};this.fireError(i)}this.fireClose()})}listen(e){if("initial"===this.state)for(this.state="listening",this.callback=e;0!==this.events.length;){let e=this.events.pop();void 0!==e.message?this.readMessage(e.message):void 0!==e.error?this.fireError(e.error):this.fireClose()}return{dispose:()=>{this.callback===e&&(this.state="initial",this.callback=void 0)}}}dispose(){super.dispose(),this.state="initial",this.callback=void 0,this.events.splice(0,this.events.length)}readMessage(e){if("initial"===this.state)this.events.splice(0,0,{message:e});else if("listening"===this.state)try{let t=JSON.parse(e);this.callback(t)}catch(t){let e={name:"400",message:`Error during message parsing, reason = ${"object"==typeof t?t.message:"unknown"}`};this.fireError(e)}}fireError(e){"initial"===this.state?this.events.splice(0,0,{error:e}):"listening"===this.state&&super.fireError(e)}fireClose(){"initial"===this.state?this.events.splice(0,0,{}):"listening"===this.state&&super.fireClose(),this.state="closed"}}var lA=lR;class lM extends lA.AbstractMessageWriter{errorCount=0;socket;constructor(e){super(),this.socket=e}end(){}async write(e){try{let t=JSON.stringify(e);this.socket.send(t)}catch(t){this.errorCount++,this.fireError(t,e,this.errorCount)}}}var lL=e.i(437122),lF=e.i(523592);let lO=new Map,lN=null;function l$(e,t){let i,r;if(lO.has(e))return;let o=new WebSocket(((i=new URL("/ws/lsp/typescript",(0,lF.getActiveServerUrl)()??window.location.origin)).protocol="https:"===i.protocol?"wss:":"ws:",i.searchParams.set("workspaceId",e),(r=(0,lL.getToken)())&&i.searchParams.set("token",r),i.toString()));o.onopen=async()=>{console.info("[monaco-language-client] TypeScript websocket opened",{workspaceId:e,workspaceRoot:t}),await (lN||(lN=new lT({$type:"classic",viewsConfig:{$type:"EditorService"},userConfiguration:{json:JSON.stringify({"editor.wordBasedSuggestions":"off","typescript.tsserver.useSyntaxServer":"auto"})},monacoWorkerFactory:lE}).start({caller:"agent-spaces-monaco-language-client"})));let i={send:e=>o.send(e),onMessage:e=>{o.onmessage=t=>e(t.data)},onError:e=>{o.onerror=t=>{Object.hasOwn(t,"message")&&e(t.message)}},onClose:e=>{o.onclose=t=>e(t.code,t.reason)},dispose:()=>o.close()},r={reader:new lI(i),writer:new lM(i)},n=new rp({id:`typescript-${e}`,name:"TypeScript Language Server",clientOptions:{documentSelector:[{language:"typescript",scheme:"file"},{language:"javascript",scheme:"file"}],workspaceFolder:{index:0,name:e,uri:t?lk.Uri.file(t):lk.Uri.parse(`file:///workspace/${e}`)},errorHandler:{error:()=>({action:rg.ErrorAction.Continue}),closed:()=>({action:rg.CloseAction.DoNotRestart})}},messageTransports:r});lO.set(e,n),n.start().catch(t=>{console.warn("[monaco-language-client] failed to start TypeScript client:",t),lO.delete(e),o.close()})},o.onerror=()=>{console.warn("[monaco-language-client] TypeScript language server websocket failed")},o.onclose=()=>{let t=lO.get(e);lO.delete(e),t?.stop()}}function lH(e){return e.replace(/\\/g,"/").replace(/^\/?([a-zA-Z]):\//,(e,t)=>e.replace(t,t.toLowerCase())).replace(/\/+$/,"")}function lU(e){try{return decodeURIComponent(e)}catch{return e}}function lW(e,t,i,r){if(!e)return null;let o=lH(i||r||""),n=lH(e.path),s=lH(lU(e.path));for(let e of/^[a-zA-Z]:\//.test(o)?[o,`/${o}`]:[o]){if(e&&s.startsWith(`${e}/`))return s.slice(e.length+1);if(e&&n.startsWith(`${e}/`))return lU(n.slice(e.length+1))}if(!n)return null;let a=`/workspace/${t}/`;if(n.startsWith(a))return decodeURIComponent(n.slice(a.length));let l=`/${t}/`;return n.startsWith(l)?decodeURIComponent(n.slice(l.length)):null}let lq=["",".tsx",".ts",".jsx",".js",".mjs",".cjs",".json"],lj=["index.tsx","index.ts","index.jsx","index.js","index.mjs","index.cjs","index.json"];async function lz(e,t){try{let i=await fetch(`/api/workspaces/${e}/files/exists?path=${encodeURIComponent(t)}`);return!!(await i.json()).exists}catch{return!1}}async function lK(e,t){for(let i of lq){let r=`${t}${i}`;if(await lz(e,r))return r}for(let i of lj){let r=`${t}/${i}`;if(await lz(e,r))return r}return null}async function lV(e,t,i){if(!i.startsWith(".")&&!i.startsWith("@/"))return null;let r=t.split("/").slice(0,-1).join("/"),o=t.split("/").lastIndexOf("src"),n=o>=0?t.split("/").slice(0,o+1).join("/"):"src",s=function(e){let t=[];for(let i of e.split("/"))if(i&&"."!==i)if(".."===i){if(0===t.length)return null;t.pop()}else t.push(i);return t.join("/")}(i.startsWith("@/")?`${n}/${i.slice(2)}`:`${r}/${i}`);return s?lK(e,s):null}async function lB(e,t){try{let i=await fetch(`/api/workspaces/${e}/files/content?path=${encodeURIComponent(t)}`);if(!i.ok)return null;let r=await i.json();return"string"==typeof r.content?r.content:null}catch{return null}}function lG(e){let t=e.split(".").pop()?.toLowerCase(),i=e.split("/").pop()?.toLowerCase()||"";return"dockerfile"===i||i.startsWith("dockerfile.")?"dockerfile":"makefile"===i||"gnumakefile"===i?"makefile":"cmakelists.txt"===i||i.endsWith(".cmake")?"cmake":".gitignore"===i||".dockerignore"===i||".eslintignore"===i?"plaintext":({ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",json:"json",jsonc:"json",css:"css",scss:"scss",less:"less",html:"html",htm:"html",vue:"html",svg:"xml",xml:"xml",yaml:"yaml",yml:"yaml",toml:"ini",ini:"ini",env:"ini",py:"python",pyw:"python",rb:"ruby",pl:"perl",pm:"perl",php:"php",lua:"lua",sh:"shell",bash:"shell",zsh:"shell",fish:"shell",ps1:"powershell",psm1:"powershell",bat:"bat",cmd:"bat",rs:"rust",go:"go",c:"c",h:"c",cpp:"cpp",cc:"cpp",cxx:"cpp",hpp:"cpp",hh:"cpp",hxx:"cpp",cs:"csharp",java:"java",kt:"kotlin",kts:"kotlin",swift:"swift",dart:"dart",scala:"scala",hs:"haskell",lhs:"haskell",ex:"elixir",exs:"elixir",erl:"erlang",clj:"clojure",cljs:"clojure",groovy:"groovy",gradle:"groovy",md:"markdown",mdx:"markdown",tex:"latex",sql:"sql",graphql:"graphql",gql:"graphql",dockerfile:"dockerfile",r:"r",d:"d",zig:"zig"})[t||""]||"plaintext"}function lQ(e){let t=e?.getDomNode(),i=document.activeElement;t&&i instanceof HTMLElement&&t.contains(i)&&i.blur()}function lJ(e){let t=e?.getModel(),i=e?.getSelection();if(!t||!i||i.isEmpty()||i.startLineNumber!==i.endLineNumber)return!1;let r=t.getValueInRange(i);if(!r||/\s/.test(r))return!1;let o=t.getWordAtPosition({lineNumber:i.startLineNumber,column:i.startColumn});return!!o&&o.word===r&&i.startColumn===o.startColumn&&i.endColumn===o.endColumn}function lY(e){let t=e?.getModel(),i=e?.getSelection(),r=e?.getDomNode();if(!e||!t||!i||!r||!lJ(e))return null;let o=e.getScrolledVisiblePosition({lineNumber:i.endLineNumber,column:i.endColumn}),n=r.getBoundingClientRect(),s=t.getValueInRange(i);return{x:o?n.left+o.left:n.left+n.width/2,y:o?n.top+o.top+o.height:n.top+n.height/2,selectedText:s,canNavigate:!0}}function lX(e){let t=e?.getPosition();e&&t&&e.setSelections([{selectionStartLineNumber:t.lineNumber,selectionStartColumn:t.column,positionLineNumber:t.lineNumber,positionColumn:t.column}],"agentSpaces.mobileContextMenu")}function lZ({activeContent:e,wordWrap:t,mobileSelectionMode:i,mobileReadonlyMenu:r,mobileSelectionPreMetrics:o,mobileSelectionPreRef:n,mobileReadonlyMenuRef:s,onContextMenu:a,onEnterSelectionMode:l,onCloseSelectionMode:c,onCopySelection:d,onRunEditorAction:u,onRunBuiltinAction:h}){return(0,U.jsxs)(U.Fragment,{children:[i?(0,U.jsx)("pre",{ref:n,className:"absolute inset-0 z-20 m-0 overflow-auto bg-background py-2 text-foreground select-text",style:{paddingLeft:o?.contentLeft??0,paddingRight:o?.contentRight??0,fontFamily:o?.fontFamily,fontWeight:o?.fontWeight,fontSize:o?.fontSize,lineHeight:o?`${o.lineHeight}px`:void 0,letterSpacing:o?.letterSpacing,fontFeatureSettings:o?.fontFeatureSettings,fontVariationSettings:o?.fontVariationSettings,whiteSpace:t?"pre-wrap":"pre",overflowWrap:t?"anywhere":"normal"},onContextMenu:a,children:e}):null,r?(0,U.jsxs)("div",{ref:s,className:"fixed z-[80] min-w-40 select-none rounded-md border bg-popover p-1 text-popover-foreground shadow-md",style:{left:Math.min(Math.max(8,r.x),window.innerWidth-168),top:Math.min(Math.max(8,r.y),window.innerHeight-180)},onPointerDown:e=>e.stopPropagation(),children:[i?null:(0,U.jsx)("button",{type:"button",className:"flex w-full items-center rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent cursor-pointer",onClick:l,children:"选择模式"}),(0,U.jsx)("button",{type:"button",className:"flex w-full items-center rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent cursor-pointer",onClick:d,children:"复制代码"}),r.canNavigate?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("button",{type:"button",className:"flex w-full items-center rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent cursor-pointer",onClick:()=>u("editor.action.revealDefinition"),children:"Go to Definition"}),(0,U.jsx)("button",{type:"button",className:"flex w-full items-center rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent cursor-pointer",onClick:()=>u("editor.action.goToReferences"),children:"Go to References"})]}):null,X.map(e=>(0,U.jsx)("button",{type:"button",className:"flex w-full items-center rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent cursor-pointer",onClick:()=>h(e.id),children:e.label},e.id)),i?(0,U.jsx)("button",{type:"button",className:"flex w-full items-center rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent cursor-pointer",onClick:c,children:"完成"}):null]}):null]})}var l0=e.i(555060);function l1(){let e=(0,eh.useTranslations)("editor");return(0,U.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:e("loadingEditor")})}function l2({file:e,content:t,t:i}){let r=t?t.split("\n").length:0,o=new Blob([t]).size,n=/^[\x00-\x7F]*$/.test(t)?"ASCII":"UTF-8";return(0,U.jsxs)("div",{className:"flex items-center px-3 py-1 text-[11px] text-muted-foreground border-t bg-muted/30 select-none shrink-0 overflow-hidden",children:[(0,U.jsxs)("span",{className:"truncate flex items-center gap-1",title:e.path,children:[(0,U.jsx)(eR.FileText,{size:11,className:"shrink-0"}),e.path]}),(0,U.jsxs)("div",{className:"ml-auto flex items-center gap-3 shrink-0",children:[(0,U.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,U.jsx)(eI,{size:11}),o<1024?`${o} B`:o<1048576?`${(o/1024).toFixed(1)} KB`:`${(o/1048576).toFixed(1)} MB`]}),(0,U.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,U.jsx)(eP.AlignLeft,{size:11}),r," ",i("lines")]}),(0,U.jsx)("span",{children:n})]})]})}let l6=(0,W.default)(()=>e.A(863812).then(e=>e.default),{loadableGenerated:{modules:[158480]},ssr:!1,loading:()=>(0,U.jsx)(l1,{})}),l3=!1;e.s(["CodeEditor",0,function({workspaceId:e}){l3||(l3=!0,window.addEventListener("unhandledrejection",e=>{(e.reason?.name==="Canceled"||"Canceled"===String(e.reason))&&e.preventDefault()}));let{openFiles:t,modifiedFileContents:i,activeFilePath:r,updateContent:o,saveFile:n,refreshFile:s,jumpToPosition:a,pendingJump:l,clearPendingJump:c,commitDiffs:d}=(0,ee.useEditorStore)(),{resolvedTheme:u}=(0,eS.useTheme)(),h=(0,eh.useTranslations)("editor"),g=(0,Z.useIsMobile)(),p=(0,el.useWorkspaceStore)(t=>t.workspaces.find(t=>t.id===e)?.boundDirs?.[0]),m=(0,q.useRef)(null),f=(0,q.useRef)(null),_=(0,q.useRef)([]),y=(0,q.useRef)([]),C=(0,q.useRef)([]),S=(0,q.useRef)(null),[b,w]=(0,q.useState)(!0),[x,D]=(0,q.useState)(!1),[E,k]=(0,q.useState)(()=>"true"===localStorage.getItem("editor-word-wrap")),[T,R]=(0,q.useState)(()=>"true"===localStorage.getItem("editor-minimap")),[P,I]=(0,q.useState)(()=>{let e=localStorage.getItem("editor-font-size");return e?parseInt(e,10):13}),[A,M]=(0,q.useState)(0),[L,F]=(0,q.useState)(0),[O,N]=(0,q.useState)(!0),$=t.find(e=>e.path===r),H=$?i[$.path]??$.content:"",W=!!r&&(0,ee.isCommitDiffPath)(r),z=W&&r?d[(0,ee.getCommitHashFromPath)(r)]:null,V=$?.mediaType??(r?(0,ee.getMediaType)(r):null),G="image"===V||"video"===V||"audio"===V||"svg"===V||"markdown"===V,Q="svg"===V||"markdown"===V,J=r&&V?`/api/workspaces/${e}/files/content?path=${encodeURIComponent(r)}&raw=true`:null;(0,q.useEffect)(()=>{N(!0)},[r]);let Y=function({editorRef:e,monacoRef:t,activeContent:i,workspaceId:r,workspaceRoot:o,isMobile:n,isReadOnly:s,isCommitDiff:a,hasActiveFile:l,editorReadyTick:c,wordWrap:d}){let u=(0,q.useRef)(null),h=(0,q.useRef)(null),g=(0,q.useRef)(null),p=(0,q.useRef)(null),m=(0,q.useRef)(null),f=(0,q.useRef)(!1),_=(0,q.useRef)(!1),y=(0,q.useRef)(!1),[C,S]=(0,q.useState)(!1),[b,w]=(0,q.useState)(null),[x,D]=(0,q.useState)(null),E=n&&s&&!a&&l,k=(0,q.useCallback)(()=>{null!=p.current&&(window.clearTimeout(p.current),p.current=null),null!=m.current&&(window.clearTimeout(m.current),m.current=null),S(!1),w(null),D(null),window.getSelection()?.removeAllRanges()},[]),T=(0,q.useCallback)(()=>{let e=g.current;e&&(window.clearTimeout(e.timer),g.current=null)},[]),R=(0,q.useCallback)(()=>{null!=p.current&&(window.clearTimeout(p.current),p.current=null)},[]),P=(0,q.useCallback)(()=>{null!=m.current&&(window.clearTimeout(m.current),m.current=null)},[]),I=(0,q.useCallback)(t=>{E&&!C&&(t.preventDefault(),t.stopPropagation(),lQ(e.current),w({x:t.clientX,y:t.clientY,selectedText:"",canNavigate:lJ(e.current)}))},[e,C,E]),A=(0,q.useCallback)(()=>{f.current||E&&!C&&lQ(e.current)},[e,C,E]),M=(0,q.useCallback)(t=>{if(!E||C||"mouse"===t.pointerType||h.current?.contains(t.target))return;let i=e.current,r=i?.getTargetAtClientPoint(t.clientX,t.clientY),o=i?.getSelection();if(o&&r?.position&&!o.isEmpty()&&o.containsPosition(r.position)){t.preventDefault(),t.stopPropagation();let e=lY(i);e&&w(e);return}w(null),T();let n=t.clientX,s=t.clientY;g.current={x:n,y:s,timer:window.setTimeout(()=>{lQ(e.current),w({x:n,y:s,selectedText:"",canNavigate:lJ(i)}),g.current=null},520)}},[T,e,C,E]),L=(0,q.useCallback)(e=>{!E||h.current?.contains(e.target)||(w(null),M(e))},[M,E]),F=(0,q.useCallback)(e=>{let t=g.current;!t||Math.hypot(e.clientX-t.x,e.clientY-t.y)>10&&T()},[T]),O=(0,q.useCallback)(()=>{T()},[T]),N=(0,q.useCallback)(t=>{if(!C)return;let i=window.getSelection(),r=i?.toString()??"";if(!r)return void w(null);let o=u.current,n=i?.rangeCount?i.getRangeAt(0):null;if(o&&n&&o.contains(n.commonAncestorContainer)){let t=document.createRange();t.selectNodeContents(o),t.setEnd(n.startContainer,n.startOffset);let i=document.createRange();i.selectNodeContents(o),i.setEnd(n.endContainer,n.endOffset);let r=t.toString().length,s=i.toString().length,a=e.current?.getModel();if(a){let t=a.getPositionAt(r),i=a.getPositionAt(s);e.current?.setSelection({startLineNumber:t.lineNumber,startColumn:t.column,endLineNumber:i.lineNumber,endColumn:i.column})}}if(!t)return;let s=n?.getBoundingClientRect();w({x:s?s.left+s.width/2:window.innerWidth/2,y:s?s.bottom:window.innerHeight/2,selectedText:r,canNavigate:lJ(e.current)})},[e,C]),$=(0,q.useCallback)(()=>{R(),w(null),p.current=window.setTimeout(()=>{p.current=null,N(!0)},1400)},[R,N]),H=(0,q.useCallback)(e=>{C&&(e.preventDefault(),e.stopPropagation(),$())},[C,$]),U=(0,q.useCallback)(()=>{let i=e.current;if(i&&t.current){let e=i.getLayoutInfo(),r=i.getOption(t.current.editor.EditorOption.fontInfo);D({scrollLeft:i.getScrollLeft(),scrollTop:i.getScrollTop(),contentLeft:e.contentLeft,contentRight:Math.max(0,e.width-e.contentLeft-e.contentWidth),fontFamily:r.fontFamily,fontWeight:r.fontWeight,fontSize:r.fontSize,lineHeight:r.lineHeight,letterSpacing:r.letterSpacing,fontFeatureSettings:r.fontFeatureSettings,fontVariationSettings:r.fontVariationSettings})}else D(null);S(!0),w(null)},[e,t]),W=(0,q.useCallback)(async()=>{let e=b?.selectedText||i;e&&(await navigator.clipboard.writeText(e),B.toast.success(b?.selectedText?"已复制选中文本":"已复制代码"),k())},[i,k,b]),j=(0,q.useCallback)(t=>{let i=e.current,n=X.find(e=>e.id===t);i&&n&&(n.run(i,{workspaceId:r,workspaceRoot:o}),k())},[k,e,r,o]),z=(0,q.useCallback)(t=>{let i=e.current;if(!i)return;let r=i.getSelection(),o=r?.getStartPosition()??i.getPosition();w(null),P(),_.current=!0,y.current=!0,f.current=!0,o&&(i.setSelections([{selectionStartLineNumber:o.lineNumber,selectionStartColumn:o.column,positionLineNumber:o.lineNumber,positionColumn:o.column}],"agentSpaces.mobileContextMenu"),i.setPosition(o)),i.focus(),requestAnimationFrame(()=>{for(let r of(i.trigger("agentSpaces.mobileContextMenu",t,void 0),[250,700,1200]))window.setTimeout(()=>{lX(e.current),w(null)},r);window.setTimeout(()=>{lX(e.current),w(null),f.current=!1,_.current=!1,y.current=!1,lQ(e.current)},1600)})},[P,e]);return(0,q.useEffect)(()=>{E||(k(),T())},[T,k,E]),(0,q.useEffect)(()=>{if(!C)return;let e=()=>{window.setTimeout(()=>{N(!1),$()},0)};return document.addEventListener("selectionchange",e),()=>document.removeEventListener("selectionchange",e)},[C,$,N]),(0,q.useEffect)(()=>{if(!C)return;let e=u.current;e&&x&&(e.scrollLeft=x.scrollLeft,e.scrollTop=x.scrollTop)},[C,x]),(0,q.useEffect)(()=>{let t=e.current;if(!t||!E||C)return void P();let i=t.onDidChangeCursorSelection(()=>{(P(),_.current)?w(null):lJ(t)?m.current=window.setTimeout(()=>{m.current=null;let e=lY(t);e&&w(e)},500):w(e=>e?.canNavigate?null:e)});return()=>{i.dispose(),P()}},[P,c,e,C,E]),{showMobileReadonlyOverlay:E,mobileSelectionMode:C,mobileReadonlyMenu:b,mobileSelectionPreMetrics:x,mobileSelectionPreRef:u,mobileReadonlyMenuRef:h,pendingNavigationSelectionCleanup:y,containerProps:{onContextMenuCapture:I,onFocusCapture:A,onPointerDownCapture:L,onPointerMoveCapture:F,onPointerUpCapture:O,onPointerCancelCapture:O},enterMobileSelectionMode:U,closeMobileSelectionMode:k,copyMobileSelection:W,runMobileEditorAction:z,runMobileBuiltinAction:j,handleMobileSelectionContextMenu:H}}({editorRef:m,monacoRef:f,activeContent:H,workspaceId:e,workspaceRoot:p,isMobile:g,isReadOnly:b,isCommitDiff:W,hasActiveFile:!!$,editorReadyTick:A,wordWrap:E}),et=(0,q.useCallback)(()=>{r&&n(e,r)},[r,n,e]),ei=(0,q.useRef)(et);(0,q.useEffect)(()=>{ei.current=et},[et]);let er=(0,q.useCallback)((e,t)=>{e.updateOptions({readOnly:t})},[]),eo=(0,q.useCallback)((t,i)=>{!function(e,t,i,r){for(let e of i)e.dispose();i.length=0;let{activeFilePath:o,workspaceId:n,workspaceRoot:s,jumpToPosition:a}=r;i.push(e.onContextMenu(t=>{let i=t.target.position;if(!i)return;let r=e.getSelection();r&&!r.isEmpty()&&r.containsPosition(i)||e.setPosition(i),console.info("[monaco-navigation] context menu position",{uri:e.getModel()?.uri.toString(),lineNumber:i.lineNumber,column:i.column,word:e.getModel()?.getWordAtPosition(i)?.word})}),t.editor.registerEditorOpener({openCodeEditor:async(e,t,i)=>{let r=function(e,t){if(!e||"file"!==e.scheme||!t)return null;let i=`/${t}`;return e.path.endsWith(i)?decodeURIComponent(e.path.slice(0,-i.length)):null}(e.getModel()?.uri,o??null),l=lW(t,n,s,r);if(!l)return console.warn("[monaco-navigation] failed to map target uri",{uri:t.toString(),workspaceRoot:s,inferredRoot:r,activeFilePath:o}),!1;let c=lW(e.getModel()?.uri,n,s,r),d=i&&"lineNumber"in i?i.lineNumber:i?.startLineNumber,u=i&&"column"in i?i.column:i?.startColumn;if(console.info("[monaco-navigation] open target",{uri:t.toString(),targetPath:l,sourcePath:c,line:d,column:u}),c===l&&d){let t,i=e.getModel(),r=i?(t=i.getLineContent(d).match(/\bfrom\s+['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)|require\s*\(\s*['"]([^'"]+)['"]\s*\)|^\s*import\s+['"]([^'"]+)['"]/),t?.[1]||t?.[2]||t?.[3]||t?.[4]||null):null,o=r?await lV(n,c,r):null;if(o&&o!==c){let t=i?.getWordAtPosition(e.getPosition()??{lineNumber:d,column:u||1})?.word,s=t?await lB(n,o):null,l=s&&t?function(e,t){let i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=[RegExp(`\\bexport\\s+default\\s+function\\s+(${i})\\b`),RegExp(`\\bexport\\s+function\\s+(${i})\\b`),RegExp(`\\bexport\\s+(?:const|let|var|class)\\s+(${i})\\b`),RegExp(`\\bfunction\\s+(${i})\\b`),RegExp(`\\b(?:const|let|var|class)\\s+(${i})\\b`),RegExp(`\\bexport\\s+default\\s+(${i})\\b`)],o=e.split(/\r?\n/);for(let e=0;e<o.length;e+=1){let i=o[e];for(let o of r){let r=o.exec(i);if(!r||null==r.index)continue;let n=r[1]?i.indexOf(r[1],r.index):r.index;if(!(n<0))return{line:e+1,column:n+1,endColumn:n+t.length+1}}}return null}(s,t):null;return console.info("[monaco-navigation] resolved import target",{specifier:r,sourcePath:c,resolvedPath:o,symbolName:t,symbolPosition:l}),window.setTimeout(()=>{a(n,o,l?.line??1,l?.column??1,l?.line,l?.endColumn).then(()=>{console.info("[monaco-navigation] jumped to resolved import target",{resolvedPath:o})})},0),!0}}return d?c===l?(e.setPosition({lineNumber:d,column:u||1}),e.revealLineInCenter(d)):window.setTimeout(()=>{a(n,l,d,u)},0):await ee.useEditorStore.getState().openFile(n,l),!0}}),e.addAction({id:"agentSpaces.showDefinition",label:"Show Definition",contextMenuGroupId:"navigation",contextMenuOrder:1.11,run:e=>e.getAction("editor.action.peekDefinition")?.run()}),e.addAction({id:"agentSpaces.showReferences",label:"Show References",contextMenuGroupId:"navigation",contextMenuOrder:1.46,run:e=>e.getAction("editor.action.referenceSearch.trigger")?.run()}),e.addAction({id:"agentSpaces.find",label:"Find",keybindings:[t.KeyMod.CtrlCmd|t.KeyCode.KeyF],run:e=>e.getAction("actions.find")?.run()}),e.addAction({id:"agentSpaces.replace",label:"Replace",keybindings:[t.KeyMod.CtrlCmd|t.KeyCode.KeyH],run:e=>e.getAction("editor.action.startFindReplaceAction")?.run()}),e.addAction({id:"agentSpaces.findInFiles",label:"Find in Files",keybindings:[t.KeyMod.CtrlCmd|t.KeyMod.Shift|t.KeyCode.KeyF],run:()=>{ee.useEditorStore.getState().setRevealPath("__search_panel__")}}),e.addAction({id:"agentSpaces.goToLine",label:"Go to Line...",keybindings:[t.KeyMod.CtrlCmd|t.KeyCode.KeyG],run:e=>e.getAction("editor.action.gotoLine")?.run()}),e.addAction({id:"agentSpaces.formatDocument",label:"Format Document",keybindings:[t.KeyMod.CtrlCmd|t.KeyMod.Shift|t.KeyCode.KeyI],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:e=>e.getAction("editor.action.formatDocument")?.run()}))}(t,i,_.current,{activeFilePath:r,workspaceId:e,workspaceRoot:p,jumpToPosition:a})},[r,a,e,p]),en=(0,q.useCallback)(e=>{S.current?.();let t=e.getDomNode();if(!t)return;let i=e=>{(e.ctrlKey||e.metaKey)&&(e.preventDefault(),e.stopPropagation(),I(t=>{let i=Math.min(Math.max(t+(e.deltaY<0?1:-1),8),40);return localStorage.setItem("editor-font-size",String(i)),i}))};t.addEventListener("wheel",i,{passive:!1,capture:!0}),S.current=()=>{t.removeEventListener("wheel",i,!0)}},[]),es=(0,q.useCallback)((t,i)=>{for(let r of(m.current=t,f.current=i,p&&l$(e,p),er(t,b),t.updateOptions({fontSize:P}),eo(t,i),en(t),y.current))r.dispose();y.current=function(e,t){let i=[];for(let r of j.values())i.push(e.addAction({...r,run:e=>r.run(e,t)}));return i}(t,{workspaceId:e,workspaceRoot:p}),M(e=>e+1),t.addAction({id:"agentSpaces.saveFile",label:"Save File",keybindings:[2097],run:()=>ei.current()})},[en,b,eo,er,e,p,P]);(0,q.useEffect)(()=>{m.current&&p&&l$(e,p)},[e,p]),(0,q.useEffect)(()=>{m.current&&f.current&&eo(m.current,f.current)},[eo]),(0,q.useEffect)(()=>()=>{let t;(t=lO.get(e))&&(lO.delete(e),t.stop())},[e]),(0,q.useEffect)(()=>()=>{for(let e of(S.current?.(),S.current=null,_.current))e.dispose();for(let e of(_.current=[],y.current))e.dispose();y.current=[],C.current=[]},[]);let ea=(0,K.useCodeFavoritesStore)(e=>e.favorites);(0,q.useEffect)(()=>{let t=m.current,i=f.current;if(!t||!i||!r){t&&(C.current=t.deltaDecorations(C.current,[]));return}let o=ea.filter(t=>t.path===r&&t.workspaceId===e);if(0===o.length){C.current=t.deltaDecorations(C.current,[]);return}let n=o.map(e=>({range:new i.Range(e.line,1,e.endLine||e.line,1),options:{isWholeLine:!0,glyphMarginClassName:"favorite-glyph",glyphMarginHoverMessage:{value:e.label||`${e.path}:${e.line}`},className:"favorite-line-bg"}}));C.current=t.deltaDecorations(C.current,n)},[r,ea,e,A]),(0,q.useEffect)(()=>{if(!r||!$||$.modified||W)return;let t=setInterval(()=>{s(e,r)},3e3);return()=>clearInterval(t)},[$,r,$?.modified,W,e,s]),(0,q.useEffect)(()=>{let e=m.current;e&&er(e,b)},[b,er]),(0,q.useEffect)(()=>{Y.pendingNavigationSelectionCleanup.current&&window.setTimeout(()=>{Y.pendingNavigationSelectionCleanup.current&&(lX(m.current),Y.closeMobileSelectionMode())},0)},[r,A,Y]),(0,q.useEffect)(()=>{let e=m.current;e&&e.updateOptions({wordWrap:E?"on":"off"})},[E]),(0,q.useEffect)(()=>{let e=m.current;e&&e.updateOptions({minimap:{enabled:T}})},[T]),(0,q.useEffect)(()=>{let e=m.current;e&&e.updateOptions({fontSize:P})},[P]),(0,q.useEffect)(()=>{$&&r&&function(e,t,i,r){let o=i??"",n=rh(e,t,r),s=eA.editor.getModel(n);if(s)s.getValue()!==o&&s.setValue(o);else{let e,i;s=eA.editor.createModel(o,(e=t.split("/").pop()?.toLowerCase()||"",i=e.split(".").pop()?.toLowerCase()||"","dockerfile"===e||e.startsWith("dockerfile.")?"dockerfile":"makefile"===e||"gnumakefile"===e?"makefile":"cmakelists.txt"===e||e.endsWith(".cmake")?"cmake":({ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",json:"json",jsonc:"json",css:"css",scss:"scss",less:"less",html:"html",htm:"html",vue:"html",svg:"xml",xml:"xml",yaml:"yaml",yml:"yaml",toml:"ini",ini:"ini",env:"ini",py:"python",pyw:"python",rb:"ruby",pl:"perl",pm:"perl",php:"php",lua:"lua",sh:"shell",bash:"shell",zsh:"shell",fish:"shell",ps1:"powershell",psm1:"powershell",bat:"bat",cmd:"bat",rs:"rust",go:"go",c:"c",h:"c",cpp:"cpp",cc:"cpp",cxx:"cpp",hpp:"cpp",hh:"cpp",hxx:"cpp",cs:"csharp",java:"java",kt:"kotlin",kts:"kotlin",swift:"swift",dart:"dart",scala:"scala",hs:"haskell",lhs:"haskell",ex:"elixir",exs:"elixir",erl:"erlang",clj:"clojure",cljs:"clojure",groovy:"groovy",gradle:"groovy",md:"markdown",mdx:"markdown",tex:"latex",sql:"sql",graphql:"graphql",gql:"graphql",r:"r",d:"d",zig:"zig",dockerfile:"dockerfile"})[i]||"plaintext"),n)}ru.set(t,s)}(e,r,H,p)},[$,r,H,e,p]),(0,q.useEffect)(()=>{if(!l||!r||l.path!==r||!m.current)return;let{line:t,column:i,endLine:o,endColumn:n,path:s}=l,a=m.current,d=a.getModel(),u=rh(e,s,p).path;if(!d||d.uri.path!==u){let e=window.setTimeout(()=>{F(e=>e+1)},30);return()=>window.clearTimeout(e)}let h=Math.min(Math.max(1,t),d.getLineCount()),g=Math.min(Math.max(1,i||1),d.getLineMaxColumn(h)),f=o?Math.min(Math.max(1,o),d.getLineCount()):h,_=n?Math.min(Math.max(1,n),d.getLineMaxColumn(f)):g,y={startLineNumber:h,startColumn:g,endLineNumber:f,endColumn:_};a.setSelection(y),a.setPosition({lineNumber:h,column:g}),a.revealLineInCenter(h);let C=a.createDecorationsCollection([{range:y,options:{className:"symbolHighlight",stickiness:1}}]);window.setTimeout(()=>C.clear(),700),b||a.focus(),c()},[l,r,e,p,A,L,c,b]);let ec=r?rh(e,r,p).toString():void 0;return(0,U.jsxs)("div",{className:`flex flex-col h-full ${x?"fixed inset-0 z-50 bg-background":""}`,children:[(0,U.jsx)(ev,{workspaceId:e}),(0,U.jsx)(eC,{editorRef:m,workspaceId:e,isReadOnly:b,onToggleReadOnly:()=>w(e=>!e),isFullscreen:x,onToggleFullscreen:()=>D(e=>!e),wordWrap:E,onToggleWordWrap:()=>{let e=!E;k(e),localStorage.setItem("editor-word-wrap",String(e))},minimap:T,onToggleMinimap:()=>{let e=!T;R(e),localStorage.setItem("editor-minimap",String(e))},fontSize:P,onZoomIn:()=>I(e=>{let t=Math.min(e+1,40);return localStorage.setItem("editor-font-size",String(t)),t}),onZoomOut:()=>I(e=>{let t=Math.max(e-1,8);return localStorage.setItem("editor-font-size",String(t)),t}),onZoomReset:()=>{I(13),localStorage.setItem("editor-font-size","13")}}),(0,U.jsx)("div",{className:"relative flex-1 min-h-0",...Y.containerProps,children:W&&z?(0,U.jsx)(eE,{diffs:z.diffs,message:z.message}):G&&O&&(J||"markdown"===V)?(0,U.jsxs)("div",{className:"relative flex justify-center h-full bg-muted/20 overflow-auto p-4",children:[Q&&(0,U.jsxs)("button",{onClick:()=>N(!1),className:"absolute top-2 right-2 z-10 flex items-center gap-1.5 px-2.5 py-1.5 rounded-md bg-background/90 border text-xs text-muted-foreground hover:text-foreground hover:bg-background shadow-sm transition-colors cursor-pointer",title:h("switchToCode"),children:[(0,U.jsx)(ek.Code,{size:14}),h("code")]}),"image"===V&&(0,U.jsx)("img",{src:J,alt:$?.name,className:"max-w-full max-h-full object-contain"}),"video"===V&&(0,U.jsx)("video",{src:J,controls:!0,className:"max-w-full max-h-full"}),"audio"===V&&(0,U.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,U.jsx)("div",{className:"text-muted-foreground text-sm",children:$?.name}),(0,U.jsx)("audio",{src:J,controls:!0})]}),"svg"===V&&(0,U.jsx)("img",{src:J,alt:$?.name,className:"max-w-full max-h-full object-contain"}),"markdown"===V&&H&&(0,U.jsx)("div",{className:"prose prose-sm dark:prose-invert max-w-none w-full max-w-4xl mx-auto",children:(0,U.jsx)(l0.Markdown,{content:H,workspaceId:e})})]}):$&&Q&&!O?(0,U.jsxs)("div",{className:"relative flex flex-col h-full",children:[(0,U.jsxs)("button",{onClick:()=>N(!0),className:"absolute top-2 right-2 z-10 flex items-center gap-1.5 px-2.5 py-1.5 rounded-md bg-background/90 border text-xs text-muted-foreground hover:text-foreground hover:bg-background shadow-sm transition-colors cursor-pointer",title:h("switchToPreview"),children:[(0,U.jsx)(eT.Eye,{size:14}),h("preview")]}),(0,U.jsx)(l6,{height:"100%",language:lG($.path),value:H,path:ec,onChange:(t,i)=>{if(i.isFlush)return;let r=lW(m.current?.getModel()?.uri,e,p);r&&r===$.path&&o(r,t||"")},onMount:es,options:{fontSize:P,minimap:{enabled:T},scrollBeyondLastLine:!1,glyphMargin:!0,lineNumbersMinChars:3,padding:{top:8},renderLineHighlight:"gutter",readOnly:b,wordWrap:E?"on":"off"},theme:"dark"===u?"vs-dark":"vs"})]}):$?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(l6,{height:"100%",language:lG($.path),value:H,path:ec,onChange:(t,i)=>{if(i.isFlush)return;let r=lW(m.current?.getModel()?.uri,e,p);r&&r===$.path&&o(r,t||"")},onMount:es,options:{fontSize:P,minimap:{enabled:T},scrollBeyondLastLine:!1,glyphMargin:!0,lineNumbersMinChars:3,padding:{top:8},renderLineHighlight:"gutter",readOnly:b,wordWrap:E?"on":"off",gotoLocation:{multipleDefinitions:"goto",multipleTypeDefinitions:"goto",multipleDeclarations:"goto",multipleImplementations:"goto",multipleReferences:"goto"}},theme:"dark"===u?"vs-dark":"vs"}),Y.showMobileReadonlyOverlay?(0,U.jsx)(lZ,{activeContent:H,wordWrap:E,mobileSelectionMode:Y.mobileSelectionMode,mobileReadonlyMenu:Y.mobileReadonlyMenu,mobileSelectionPreMetrics:Y.mobileSelectionPreMetrics,mobileSelectionPreRef:Y.mobileSelectionPreRef,mobileReadonlyMenuRef:Y.mobileReadonlyMenuRef,onContextMenu:Y.handleMobileSelectionContextMenu,onEnterSelectionMode:Y.enterMobileSelectionMode,onCloseSelectionMode:Y.closeMobileSelectionMode,onCopySelection:Y.copyMobileSelection,onRunEditorAction:Y.runMobileEditorAction,onRunBuiltinAction:Y.runMobileBuiltinAction}):null]}):(0,U.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:h("openFileToEdit")})}),$&&!W&&(0,U.jsx)(l2,{file:$,content:H,t:h})]})}],611219)},538691,e=>{e.n(e.i(611219))}]);
|