dsh-code-server-app 0.3.51 → 0.3.54

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/README.md CHANGED
@@ -109,6 +109,9 @@ DSH 用**资源地址**命名文件,`openFile` 只负责把地址交给右侧栏
109
109
  即可(Office 与可执行文件重新进 IDE,预览友好那几类仍留给 DSH)。
110
110
  - 三组清单是导出的常量(`PREVIEW_FRIENDLY_EXTENSIONS` / `EXECUTABLE_EXTENSIONS` / `OFFICE_EXTENSIONS`),
111
111
  默认值就是它们的并集;设置卡里的「实际规则」摘要会点名"含可执行文件、Office 文档"。
112
+ - **控件形态(0.3.52)**:认领类型是**多行文本域**(按内容自动长高:默认值 542 字符 → 9 行,上限 12 行,可手动纵向拉伸);
113
+ 下面依次是语法提示、「实际规则」摘要、三组说明,以及**折成多行**的默认值代码块 ——
114
+ 换行与分号在解析器里等价,那段连换行一起复制回输入框,得到的策略与默认值逐字相同(有单测钉住)。
112
115
  - 三种实际形态:纯白名单(`py;ts`,无 `*` → 其余不认领)、兜底(`*`)、兜底加排除(默认)。
113
116
  - 语法、默认值与解析都在 `lib/claim-types.js`(host 的 `Config` 默认值与客户端 `canOpen` 共用同一份,
114
117
  随包发布,不会两边漂移);单测 `scripts/test-claim-types.mjs`。
@@ -478,6 +481,8 @@ pnpm test:client-seat # 设置卡住哪个座位:插件页 plugins.bundle
478
481
  pnpm test:fullscreen # 打开标签即全屏
479
482
  pnpm test:vendored # 重打包表 ↔ 插件依赖表一致(无 npm: 别名 / 无聚合包 / vendored.json 进了 files)
480
483
  pnpm test:dsh-resolve # 部署位置表:各平台全局装布局(npm --prefix / nvm / pnpm global / %APPDATA%)都能找到 DSH 部署
484
+ pnpm test:child-node # Electron 宿主(桌面版)下给 IDE 子进程挑真 Node:候选顺序 / 剥离 ELECTRON_RUN_AS_NODE / 找不到时如实退回
485
+ pnpm test:package-files # 发布物白名单守卫:files 里的模块**递归**import 到的本地文件也必须在 files 里(0.3.53 漏 lib/child-node.mjs 的事故)
481
486
  pnpm test:installed # 安装冒烟:对**已装进 profile 的产物**做断言(默认 <DSH_HOME>/profiles/web)
482
487
  # files 白名单每条都在 / 重打包包在当前平台齐全 / 原生模块无缺失 /
483
488
  # 已安装副本能 import / 树在位 —— 仓库回归看不出这一类
@@ -959,6 +964,21 @@ desktop profile 由 `apps/desktop-host` 把 `/api/*` 交给同一个 `createShar
959
964
 
960
965
  ## DSH Desktop(无 webServer)
961
966
 
967
+ - **IDE 子进程必须用真 Node 跑(0.3.53 起;桌面版特有的硬约束)**:DSH Desktop 的宿主进程是
968
+ **Electron 的 Node 模式**(`ELECTRON_RUN_AS_NODE=1`,`process.execPath` = Electron 二进制)。VS Code 的
969
+ `server-main.js` 会注册一段**只在 Electron / `ELECTRON_RUN_AS_NODE` 下生效**的 asar 解析钩子:凡是解析结果
970
+ 落在"应用根"之外的包,它就去 `node_modules.asar` 里找,找不到直接抛
971
+ `Cannot find package 'X' within the application resources`。本插件的原生包都是**树外**的 pnpm 目录,
972
+ 所以启动路径上的 `@vscode/spdlog` / `@vscode/deviceid` / `@vscode/windows-registry` 三个 ESM import 必被拒
973
+ ⇒ launcher 打 `FATAL 加载 VS Code server 失败` ⇒ 面板显示「**code-server 意外退出(exit 2)**」(界面上的
974
+ 报错只有栈尾,首行被日志尾部截断,所以看不出是哪个包)。修法:`lib/child-node.mjs` 检测到 Electron 宿主时,
975
+ 改用**应用自带的真 Node**(`resources/runtime/primary-runtime/dependencies/node/bin/node.exe`,实测 v24.21.0),
976
+ 并把 `ELECTRON_RUN_AS_NODE` 从子进程环境里剥掉;web/CLI 的普通 node 宿主行为一字不变。
977
+ - 试过但不能用的兜底:`VSCODE_DEV=1`(绕过了钩子,却切到 dev 引导路径 → 报 `<树>/lib/vscode/out/bootstrap-import.js` 缺失);
978
+ 往树里补 junction(Node 的 ESM 解析会 realpath,链接建在树里也仍被判为"应用根之外")。
979
+ - 回归:`pnpm test:child-node`(9 项)。
980
+ - **与端口冲突的区别**:端口冲突的签名是 `FATAL 监听失败({...}): listen EADDRINUSE`(发生在**加载成功之后**
981
+ 绑端口阶段),而上面这个是加载阶段就死 —— 用随机端口(随机端口也会炸)即可区分。
962
982
  - host 半部 `inject = ['connection', 'settings']`(**不含 `webServer`**)——desktop profile 关掉了 webserver/web-runtime,
963
983
  本插件照常工作;`/api/*` 请求由 Electron `dsh-app://` 协议处理器 → IPC 帧管道 → `createSharedFetchHandler('/api')`。
964
984
  - 右侧栏标签、guide 入口框、文件地址认领、设置卡片在 desktop 下与 web 相同(code-server 仍是本机 `http://127.0.0.1:<port>` 的 iframe;
@@ -12,7 +12,7 @@
12
12
  | react | 18.3.1 | MIT |
13
13
  | react-dom | 18.3.1 | MIT |
14
14
 
15
- 生成时间:2026-09-18T11:22:52.142Z
15
+ 生成时间:2026-09-18T15:59:04.573Z
16
16
  渲染器:@deepseek-ai/dsh-client-ui-primitives@0.1.6-alpha.1(DSH 部署的界面版本:未知)
17
17
  设计令牌:@deepseek-ai/dsh-client-ui-theme@0.1.6-alpha.1(11 段)
18
18
  KaTeX:已打包(公式排版与 DSH 界面一致)
@@ -0,0 +1,138 @@
1
+ /**
2
+ * lib/child-node.mjs — 给「VS Code server 子进程」挑一个**真 Node**(0.3.53)。
3
+ *
4
+ * 为什么必须挑:DSH Desktop 的宿主进程是用 **Electron 的 Node 模式**跑的
5
+ * (`ELECTRON_RUN_AS_NODE=1`,`process.execPath` = Electron 二进制;见 harness 的
6
+ * `apps/desktop/src/node-environment.ts` 与 `host-process.ts`)。插件 spawn launcher 时若照旧用
7
+ * `process.execPath`,VS Code 的 server-main 会在启动时注册自己的 ESM 解析钩子,而那段钩子
8
+ * **只在 Electron / ELECTRON_RUN_AS_NODE 下生效**:
9
+ *
10
+ * if (!process.env.ELECTRON_RUN_AS_NODE && !process.versions.electron) return;
11
+ * ...
12
+ * const L = <默认解析结果>;
13
+ * if (!L.startsWith(<应用根>)) { // 树外 → 去 node_modules.asar 找,找不到就抛
14
+ * throw new Error(`Cannot find package '${name}' within the application resources`);
15
+ * }
16
+ *
17
+ * 本插件的原生包是**树外**的 pnpm 目录(`<profile>/node_modules/.pnpm/…`),于是启动路径上的
18
+ * `@vscode/spdlog` / `@vscode/deviceid` / `@vscode/windows-registry` 三个 ESM import 被拒,
19
+ * launcher 打 `FATAL 加载 VS Code server 失败` 后退出 ⇒ 面板显示「code-server 意外退出(exit 2)」。
20
+ * 2026-09-18 实测(同一棵树、同一份 launcher):
21
+ * · Electron(Node 模式)→ 必炸(首行 `Cannot find package '@vscode/spdlog' within the application resources`);
22
+ * · 桌面版自带的 `resources/runtime/primary-runtime/dependencies/node/bin/node.exe`(v24.21.0)→
23
+ * 一次启动成功(`Extension host agent started` + `dshcs-ready`),stderr 全空。
24
+ *
25
+ * 所以这里只做一件事:宿主是 Electron 时**找一个真 Node** 给子进程用,并从子进程环境里删掉
26
+ * `ELECTRON_RUN_AS_NODE`(留着它,真 Node 也会被判成 Electron,钩子照样生效)。普通 node 宿主
27
+ * (web / CLI)原样返回 `process.execPath`,行为一字不变。找不到真 Node 时退回 Electron(与旧行为一致)
28
+ * 并由调用方**明确告警**,不再让人对着 exit 2 猜。
29
+ *
30
+ * 试过但**不能用**的兜底(2026-09-18 实测,别再走一遍):
31
+ * · `VSCODE_DEV=1`:钩子确实被绕过(`s = process.env.VSCODE_DEV ? undefined : …`),但 VS Code 同时切到
32
+ * dev 引导路径,转头就报 `Cannot find module '<树>/lib/vscode/out/bootstrap-import.js'` —— 精简树里没这文件。
33
+ * · 往树内补 junction:Node 的 ESM 解析会 **realpath**(实测 `import.meta.resolve('@vscode/spdlog')` 返回的是
34
+ * pnpm store 路径),所以链接建在树里也仍旧"落在应用根之外",钩子照样拒。
35
+ *
36
+ * 纯路径/环境判断,不碰进程 → 可离线单测(scripts/test-child-node.mjs)。
37
+ */
38
+
39
+ import { existsSync } from 'node:fs';
40
+ import { posix, win32 } from 'node:path';
41
+
42
+ /** 宿主是不是 Electron(含 Node 模式的两个判据)。 */
43
+ export function isElectronHost(versions = process.versions, env = process.env) {
44
+ const flag = env.ELECTRON_RUN_AS_NODE;
45
+ const flagged = typeof flag === 'string' && flag !== '' && flag !== '0' && flag !== 'false';
46
+ return Boolean(versions !== null && versions !== undefined && versions.electron) || flagged;
47
+ }
48
+
49
+ /** 真 Node 的文件名(平台惯例)。 */
50
+ export function nodeBinaryName(platform = process.platform) {
51
+ return platform === 'win32' ? 'node.exe' : 'node';
52
+ }
53
+
54
+ /**
55
+ * 真 Node 候选表(按优先级)。每条都带 `source` 便于日志/断言。
56
+ * @param options.execPath - 宿主可执行文件(通常是 Electron)。
57
+ * @param options.resourcesPath - Electron 的 `process.resourcesPath`(可能 undefined)。
58
+ * @param options.env - 环境变量(PATH / DSH_DESKTOP_NODE_EXECUTABLE)。
59
+ */
60
+ export function childNodeCandidates(options = {}) {
61
+ const execPath = typeof options.execPath === 'string' ? options.execPath : process.execPath;
62
+ const env = options.env ?? process.env;
63
+ const platform = options.platform ?? process.platform;
64
+ const resourcesPath = typeof options.resourcesPath === 'string' ? options.resourcesPath : undefined;
65
+ const bin = nodeBinaryName(platform);
66
+ // 路径风格跟着 platform 走(而不是跟着"跑测试的这台机器"),Linux/macOS 形态才测得到
67
+ const paths = platform === 'win32' ? win32 : posix;
68
+ const join = paths.join;
69
+ const out = [];
70
+ const push = (source, path) => {
71
+ if (typeof path !== 'string' || path === '' || path === execPath) return;
72
+ if (out.some((entry) => entry.path === path)) return;
73
+ out.push({ source, path });
74
+ };
75
+
76
+ if (resourcesPath !== undefined) {
77
+ // ① 桌面版当前布局:主运行时自带的 Node(实测 v24.21.0,唯一被验证可用的那条)
78
+ push('app-primary-runtime-node', join(resourcesPath, 'runtime', 'primary-runtime', 'dependencies', 'node', 'bin', bin));
79
+ // ② 旧布局(0.1.5 及更早):应用自带一份 node
80
+ push('app-runtime-node', join(resourcesPath, 'runtime', 'node', bin));
81
+ // ③ 通用布局
82
+ push('app-resources-node', join(resourcesPath, 'node', bin));
83
+ }
84
+ // ④ resourcesPath 拿不到时,从可执行文件旁边推
85
+ push('exec-side-runtime-node', join(paths.dirname(execPath), 'resources', 'runtime', 'primary-runtime', 'dependencies', 'node', 'bin', bin));
86
+ push('exec-side-node', join(paths.dirname(execPath), 'resources', 'runtime', 'node', bin));
87
+
88
+ // ⑤ 上游可能直接给了 node 的路径 —— 只有当它**看起来就是 node 二进制**时才认
89
+ // (实测 `DSH_DESKTOP_NODE_EXECUTABLE` 指向的是 Electron 自身,不能用)
90
+ const hinted = env.DSH_DESKTOP_NODE_EXECUTABLE;
91
+ if (typeof hinted === 'string' && hinted !== '' && /^node(\.exe)?$/i.test(hinted.replace(/\\/g, '/').split('/').pop() ?? '')) {
92
+ push('env-dsh-desktop-node', hinted);
93
+ }
94
+
95
+ // ⑥ PATH 上的真 Node(跳过应用自己的 resources —— 那里的 `node`/`node.cmd` 是"再调 Electron"的 shim)
96
+ const pathValue = typeof env.PATH === 'string' ? env.PATH : (typeof env.Path === 'string' ? env.Path : '');
97
+ for (const dir of pathValue.split(paths.delimiter)) {
98
+ if (dir === '') continue;
99
+ if (resourcesPath !== undefined && dir.toLowerCase().startsWith(resourcesPath.toLowerCase())) continue;
100
+ push('path-node', join(dir, bin));
101
+ }
102
+ return out;
103
+ }
104
+
105
+ /**
106
+ * 给子进程挑解释器。
107
+ * @returns {{command:string, electronHost:boolean, swapped:boolean, source:string}}
108
+ * · 非 Electron 宿主:`{ command: process.execPath, swapped: false, source: 'host-node' }`(行为不变);
109
+ * · Electron 宿主且找到真 Node:`swapped: true`(调用方须用 childNodeEnv 剥掉 ELECTRON_RUN_AS_NODE);
110
+ * · Electron 宿主但一个候选都不在:`source: 'electron-fallback'`(与旧行为一致,调用方应告警)。
111
+ */
112
+ export function resolveChildNode(options = {}) {
113
+ const execPath = typeof options.execPath === 'string' ? options.execPath : process.execPath;
114
+ const versions = options.versions ?? process.versions;
115
+ const env = options.env ?? process.env;
116
+ const exists = typeof options.exists === 'function' ? options.exists : existsSync;
117
+ const electronHost = isElectronHost(versions, env);
118
+ if (!electronHost) return { command: execPath, electronHost: false, swapped: false, source: 'host-node' };
119
+ for (const candidate of childNodeCandidates({ execPath, resourcesPath: options.resourcesPath ?? process.resourcesPath, env, platform: options.platform })) {
120
+ try {
121
+ if (exists(candidate.path)) {
122
+ return { command: candidate.path, electronHost: true, swapped: true, source: candidate.source };
123
+ }
124
+ } catch { /* 下一个候选 */ }
125
+ }
126
+ return { command: execPath, electronHost: true, swapped: false, source: 'electron-fallback' };
127
+ }
128
+
129
+ /**
130
+ * 子进程环境:用真 Node 时**必须**删掉 `ELECTRON_RUN_AS_NODE`,否则 VS Code 的 asar 解析钩子照样生效
131
+ * (钩子的判据是"环境变量或 versions.electron 二者之一")。退回 Electron 时反而要留着它,否则
132
+ * Electron 会当 GUI 应用启动。
133
+ */
134
+ export function childNodeEnv(resolved, env = process.env) {
135
+ const next = { ...env };
136
+ if (resolved !== null && resolved !== undefined && resolved.swapped === true) delete next.ELECTRON_RUN_AS_NODE;
137
+ return next;
138
+ }
package/lib/client.js CHANGED
@@ -1,5 +1,6 @@
1
1
  window.__ModuleLoader__.load({id:'dsh-code-server-app',factory:function(require){var module={exports:{}};var exports=module.exports;
2
- var X=Object.defineProperty;var _e=Object.getOwnPropertyDescriptor;var He=Object.getOwnPropertyNames;var Ue=Object.prototype.hasOwnProperty;var Be=(e,r)=>{for(var n in r)X(e,n,{get:r[n],enumerable:!0})},Fe=(e,r,n,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of He(r))!Ue.call(e,a)&&a!==n&&X(e,a,{get:()=>r[a],enumerable:!(t=_e(r,a))||t.enumerable});return e};var We=e=>Fe(X({},"__esModule",{value:!0}),e);var Fr={};Be(Fr,{apply:()=>_r,inject:()=>Ur,name:()=>Br});module.exports=We(Fr);var ie="dsh-resource://file/",Ge="sidebar://";function Q(e){return typeof e=="string"&&e.startsWith(Ge)}function U(e){if(typeof e!="string"||!e.startsWith(ie))return null;for(var r=e.length,n=0;n<e.length;n+=1){var t=e.charAt(n);if(t==="?"||t==="#"){r=n;break}}var a=e.slice(ie.length,r).split("/"),l=a.shift();try{if(l==="session"){var o=a.shift();return o===void 0||o===""||a.length===0?null:{scope:"session",sessionId:decodeURIComponent(o),path:le(a)}}if(l==="absolute"){var c=a[0]===""&&a.length>1,p=c?a.slice(1):a,f=le(p);return(f===""||f.charAt(0)==="/")&&!c?null:c?{scope:"absolute",path:"//"+f}:f===""?null:{scope:"absolute",path:oe(f)?f:"/"+f}}}catch(x){return null}return null}function le(e){for(var r=[],n=0;n<e.length;n+=1)r.push(decodeURIComponent(e[n]));return r.join("/")}function oe(e){return/^[A-Za-z]:($|\/)/.test(e)}function Ye(e){return typeof e!="string"||e===""?!1:e.charAt(0)==="/"?!0:oe(e)}function ce(e){var r=U(e);if(r===null)return"";var n=r.path.replace(/[/\\]+$/,""),t=Math.max(n.lastIndexOf("/"),n.lastIndexOf("\\")),a=t===-1?n:n.slice(t+1);return a}function de(e,r){if(e===null||e==null)return null;var n=typeof e.path=="string"?e.path:"";if(n==="")return null;if(Ye(n))return n;if(typeof r!="string"||r==="")return null;var t=r.indexOf("\\")!==-1?"\\":"/",a=r.replace(/[\\/]+$/,"");return a+t+(t==="\\"?n.replace(/\//g,"\\"):n)}var Xe=["md","markdown","html","htm","png","jpg","jpeg","gif","webp","bmp","ico","svg","pdf"],fe=["exe","com","msi","msix","msixbundle","appx","appxbundle","dll","sys","scr","cpl","ocx","drv","efi","mui","obj","o","a","lib","pdb","class","jar","pyc","pyo","wasm","node","so","dylib","ko","elf","bin","out","apk","ipa","deb","rpm","dmg","iso","img","cab"],pe=["doc","docx","docm","dot","dotx","dotm","docb","rtf","odt","xls","xlsx","xlsm","xlsb","xlt","xltx","xltm","xla","xlam","ods","ppt","pptx","pptm","pot","potx","potm","pps","ppsx","ppam","odp","vsd","vsdx","vssx","vstx","vsdm","vssm","vstm","one","onetoc2","mpt","mpp","pub","msg","xps","oxps","odg"],I=["*"].concat(Xe).concat(fe).concat(pe).map(function(e,r){return r===0?e:"!"+e}).join(";"),Qe=/[;,\s]+/;function Je(e){return String(e).replace(/!\s+/g,"!").split(Qe)}function Ze(e){var r=typeof e=="string"?e.trim():"";if(r==="")return"";var n=r.charAt(0)==="!",t=n?r.slice(1).trim():r;return t==="*"?n?"!*":"*":(t.slice(0,2)==="*."?t=t.slice(2):t.charAt(0)==="."&&(t=t.slice(1)),t=t.toLowerCase(),t===""?"":n?"!"+t:t)}function A(e){if(typeof e!="string")return"";for(var r=Je(e),n=[],t=0;t<r.length;t+=1){var a=Ze(r[t]);a===""||a==="!*"||n.indexOf(a)===-1&&n.push(a)}return n.join(";")}function B(e){for(var r=A(e),n=r===""?[]:r.split(";"),t=!1,a=[],l=[],o=0;o<n.length;o+=1){var c=n[o];if(c==="*"){t=!0;continue}c.charAt(0)==="!"?l.push(c.slice(1)):a.push(c)}return{all:t,allow:a,deny:l}}function Ke(e){if(typeof e!="string"||e==="")return"";var r=e.replace(/[/\\]+$/,""),n=Math.max(r.lastIndexOf("/"),r.lastIndexOf("\\"));n!==-1&&(r=r.slice(n+1));var t=r.lastIndexOf(".");return t<=0?"":r.slice(t+1).toLowerCase()}function Ve(e,r){if(r==null)return!1;var n=Ke(e);return n!==""&&r.deny.indexOf(n)!==-1?!1:n!==""&&r.allow.indexOf(n)!==-1?!0:r.all===!0}function ve(e,r){return e===null||e==null?!1:Ve(e.path,r)}function me(e){var r=B(e),n=[];if(r.all&&n.push("\u5176\u4F59\u7C7B\u578B\u5168\u90E8\u8BA4\u9886"),r.allow.length>0&&n.push("\u6307\u5B9A\u8BA4\u9886 "+r.allow.length+" \u9879"),r.deny.length>0){var t=[];ue(r.deny,fe)&&t.push("\u53EF\u6267\u884C\u6587\u4EF6"),ue(r.deny,pe)&&t.push("Office \u6587\u6863"),n.push("\u6392\u9664 "+r.deny.length+" \u9879"+(t.length>0?"(\u542B"+t.join("\u3001")+")":""))}return n.length===0?"\u4E0D\u8BA4\u9886\u4EFB\u4F55\u6587\u4EF6(\u53EA\u6709\u9875\u9762\u6807\u7B7E)":n.join(" \xB7 ")}function ue(e,r){for(var n=new Set(r),t=0;t<e.length;t+=1)if(n.has(e[t]))return!0;return!1}var qe="[data-sidebar-right-panel]",$e='[data-sidebar-right-mode="fullscreen"]';function he(e){if(e==null||typeof e.closest!="function")return"no-root";var r,n;try{if(r=e.closest(qe),r==null||typeof r.querySelector!="function")return"no-panel";n=r.querySelector($e)}catch(t){return"lookup-failed"}if(n==null||typeof n.click!="function")return"no-control";try{n.click()}catch(t){return"click-failed"}return"clicked"}function ge(e,r){if(!(e==null||e.byId==null)&&!(typeof r!="string"||r==="")){var n=e.byId[r];if(n!=null)return typeof n.cwd=="string"&&n.cwd!==""?n.cwd:void 0}}function J(e,r){if(!(e==null||!Array.isArray(e.items))&&!(typeof r!="string"||r===""))for(var n=0;n<e.items.length;n+=1){var t=e.items[n];if(!(t==null||!Array.isArray(t.sessionIds))&&t.sessionIds.indexOf(r)!==-1&&typeof t.path=="string"&&t.path!=="")return t.path}}function Z(e){var r=e==null?{}:e,n=r.sessions==null?null:r.sessions,t=r.workspaces==null?null:r.workspaces,a=typeof r.sessionId=="string"&&r.sessionId!==""?r.sessionId:void 0,l=ge(n,a);if(l!==void 0)return l;var o=n==null?void 0:n.current,c=ge(n,o);if(c!==void 0)return c;var p=J(t,a);if(p!==void 0)return p;var f=J(t,typeof o=="string"?o:void 0);if(f!==void 0)return f;var x=n!=null&&Array.isArray(n.ids)?n.ids[0]:void 0,v=J(t,typeof x=="string"?x:void 0);if(v!==void 0)return v;if(t!=null&&Array.isArray(t.items)&&t.recentWorkspaceId!==void 0)for(var w=0;w<t.items.length;w+=1){var d=t.items[w];if(!(d==null||d.workspaceId!==t.recentWorkspaceId)&&typeof d.path=="string"&&d.path!=="")return d.path}if(t!=null&&Array.isArray(t.items)&&t.items.length>0){var m=t.items[0];if(m!=null&&typeof m.path=="string"&&m.path!=="")return m.path}}var R=typeof Element!="undefined"&&typeof Element.prototype.moveBefore=="function",er=-2e4,s={park:null,frame:null,currentSrc:null,sameOrigin:null,owner:null,lastRect:null,parkStrategy:"offscreen",degraded:!1,preloaded:!1,nudgeCount:0,nudgeEnabled:!0,lastNudgeAt:0,listeners:new Set};function K(){return{ready:s.frame!==null,docked:s.owner!==null,owner:s.owner,src:s.currentSrc,sameOrigin:s.sameOrigin,parkStrategy:s.parkStrategy,degraded:s.degraded,preloaded:s.preloaded,supportsMoveBefore:R,nudgeCount:s.nudgeCount,lastNudgeAt:s.lastNudgeAt}}function j(){var e=K();s.listeners.forEach(function(r){try{r(e)}catch(n){}})}function be(e){return s.listeners.add(e),function(){s.listeners.delete(e)}}function ye(){return K()}function rr(e){e!=="offscreen"&&e!=="behind"||s.parkStrategy!==e&&(s.parkStrategy=e,s.frame!==null&&s.owner===null&&V(),j())}function nr(){return s.parkStrategy}function tr(){var e=s.lastRect;e!==null&&(s.park.style.width=Math.max(1,Math.round(e.width))+"px",s.park.style.height=Math.max(1,Math.round(e.height))+"px")}function V(){if(s.park!==null){if(tr(),s.parkStrategy==="behind"&&s.lastRect!==null){s.park.style.left=Math.round(s.lastRect.left)+"px",s.park.style.top=Math.round(s.lastRect.top)+"px",s.park.style.visibility="visible",s.park.style.zIndex="0";return}s.park.style.left=er+"px",s.park.style.top="0px",s.park.style.visibility="hidden",s.park.style.zIndex="0"}}function xe(){s.frame!==null&&(s.frame.setAttribute("inert",""),s.frame.setAttribute("aria-hidden","true"))}function ar(){s.frame!==null&&(s.frame.removeAttribute("inert"),s.frame.removeAttribute("aria-hidden"))}function sr(){var e=document.createElement("div");e.className="dshcs-park",e.setAttribute("data-dshcs-park",""),e.setAttribute("aria-hidden","true");var r=document.createElement("iframe");return r.className="dshcs-frame",r.setAttribute("title","code-server"),r.setAttribute("allow","clipboard-read; clipboard-write"),r.setAttribute("data-dshcs-resident",""),r.src="about:blank",e.appendChild(r),document.body.appendChild(e),s.park=e,s.frame=r,s.currentSrc="about:blank",s.owner=null,V(),xe(),r}function ir(e){var r=s.frame;if(r!==null){var n=s.sameOrigin!==e;!n&&r.hasAttribute("data-dshcs-attrs")||(e===!0?r.removeAttribute("sandbox"):e===!1&&r.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms allow-modals allow-popups allow-pointer-lock allow-clipboard-read allow-clipboard-write"),r.setAttribute("data-dshcs-attrs",e===!0?"same-origin":"cross-origin"),s.sameOrigin=e)}}function q(e){var r=e||{};return s.frame===null&&sr(),typeof r.sameOrigin=="boolean"&&ir(r.sameOrigin),typeof r.src=="string"&&r.src!==""&&r.src!==s.currentSrc&&lr(r.src),s.frame}function lr(e){s.frame===null||typeof e!="string"||e===""||e===s.currentSrc||(s.currentSrc=e,s.frame.src=e,j())}function we(){var e=s.frame;if(s.nudgeEnabled!==!0||e===null||e.isConnected!==!0)return!1;var r=e.style.display;return e.style.display="none",e.offsetHeight,e.style.display=r,s.nudgeCount+=1,s.lastNudgeAt=Date.now(),!0}function or(e){return s.nudgeEnabled=e!==!1,s.nudgeEnabled}function ke(e){if(s.frame!==null){if(R)try{e.moveBefore(s.frame,null);return}catch(r){s.degraded=!0,s.lastMoveError=(r&&r.name?r.name+": ":"")+(r&&r.message?r.message:String(r))}else s.degraded=!0;e.appendChild(s.frame)}}function $(e,r){if(!(s.frame===null||e==null)){var n=s.owner===null,t=e.getBoundingClientRect();t.width>=1&&t.height>=1&&(s.lastRect={left:t.left,top:t.top,width:t.width,height:t.height}),s.owner=r===void 0?null:r,ar(),s.park.setAttribute("aria-hidden","true"),ke(e),n&&we(),j()}}function D(e){s.frame!==null&&(e!==void 0&&s.owner!==e||(s.owner=null,V(),xe(),s.park.setAttribute("aria-hidden","true"),ke(s.park),j()))}function ee(e){var r=e||{};return q(r),s.owner===null&&(typeof r.src=="string"&&r.src!==""&&(s.preloaded=!0),D()),s.frame}function cr(){s.park!==null&&s.park.parentNode!==null&&s.park.parentNode.removeChild(s.park),s.park=null,s.frame=null,s.currentSrc=null,s.sameOrigin=null,s.owner=null,s.lastRect=null,s.degraded=!1,s.preloaded=!1,s.nudgeCount=0,s.lastNudgeAt=0,j()}typeof window!="undefined"&&(window.__dshcsSurface={snapshot:K,setParkStrategy:rr,getParkStrategy:nr,preload:ee,dock:$,park:D,nudge:we,setNudgeEnabled:or,destroy:cr});var i=require("react"),te=new Set,z={status:null,busy:!1,sidebarUi:"unknown",sidebarRegisterFailed:!1};function L(e){z=Object.assign({},z,e),te.forEach(function(r){r()})}function dr(e){return te.add(e),function(){te.delete(e)}}function ur(){return z}function se(){return i.useSyncExternalStore(dr,ur)}var fr="/api",pr="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMTQ3IDE0NyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8c3R5bGU+QG1lZGlhIChwcmVmZXJzLWNvbG9yLXNjaGVtZTogZGFyaykgeyogeyBmaWxsOiB3aGl0ZTsgfX08L3N0eWxlPgogIDxwYXRoIGQ9Im00Mi40MjE0LDM5LjY1NWMtMjQuNDA1NywwIC00Mi4xNTU0LDEzLjE3MjEgLTQyLjE1NTQsMzMuODQ1YzAsMjAuNTgxNCAxOC40ODkyLDMzLjg0NSA0Mi4xNTU0LDMzLjg0NWMyMy42NjYyLDAgMzguMTgwMywtMTEuNjE3MSAzOC43MzQ5LC0yOC43MjI1bC0yMS4wNzc3LC0wLjQ1NzRjLTAuOTI0NCw5LjMzMDMgLTkuMTA1OSwxNS4xODQ1IC0xNy42NTcyLDE1LjE4NDVjLTExLjc0MDYsMCAtMjAuNDMwNiwtNy41OTIyIC0yMC40MzA2LC0xOS44NDk2YzAsLTEyLjI1NzQgOC42OSwtMTkuOTg2OCAyMC40MzA2LC0yMC4yMTU1YzguNTUxMywtMC4xODMgMTYuOTE3Nyw1Ljk0NTcgMTcuNDcyMywxNS4yNzZsMjEuMDc3NywtMC42NDAzYy0wLjQ2MjIsLTE2LjgzMTEgLTE0LjE0NDIsLTI4LjI2NTIgLTM4LjU1LC0yOC4yNjUyem00OC44NDQ2LDJsNTUuNDY4LDBsMCw2NC4wMzExbC01NS40NjgsMGwwLC02NC4wMzExeiIgY2xpcC1ydWxlPSJldmVub2RkIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiLz4KPC9zdmc+Cg==";async function y(e,r){var n={method:r===void 0?"GET":"POST",headers:{}};r!==void 0&&(n.headers["content-type"]="application/json",n.body=JSON.stringify(r));var t=await fetch(fr+e,n),a=await t.text(),l=null;try{l=a===""?null:JSON.parse(a)}catch(o){l=null}return t.ok?l!==null?l:{ok:!1,error:"invalid JSON response"}:{ok:!1,error:"HTTP "+t.status+(l!==null&&l.error!==void 0?": "+l.error:"")}}function Ee(){}function Me(e){var r=typeof e.useSessions=="function"?e.useSessions:Ee,n=typeof e.useWorkspaces=="function"?e.useWorkspaces:Ee;return{sessions:r(function(t){return t}),workspaces:n(function(t){return t})}}function Ie(e,r){if(e==null||typeof e.url!="string"||e.url==="")return null;var n=e.pid!=null?String(e.pid):e.startedAt!=null?String(e.startedAt):"0",t=e.url+"?s="+encodeURIComponent(n),a=typeof r=="string"&&r!==""?r:e!=null&&e.cwd!=null?e.cwd:null;if(a==null||a==="")return t;var l=a.replace(/\\/g,"/"),o=l;return(/^[A-Za-z]:\//.test(l)||l.charCodeAt(0)!==47)&&(o="/"+l),t+"&folder="+encodeURIComponent(o)}function vr(e){var r=e.status,n=e.pageUrl,t=e.reloadTick,a=e.owner,l=i.useRef(null),o=r!=null&&r.ok===!0&&r.running===!0,c=r!=null&&r.status==="starting",p=r!=null&&r.ok===!1,f=r!=null&&r.serve==="dsh";if(i.useLayoutEffect(function(){if(!o||n===null){D(a);return}q({src:n,sameOrigin:f}),l.current!==null&&$(l.current,a)},[o,n,f,t,a]),i.useLayoutEffect(function(){return function(){D(a)}},[a]),o&&n!==null)return i.createElement("div",{ref:l,className:"dshcs-slot","data-code-server-slot":a!=null?a:"code-server"});if(c)return i.createElement("div",{className:"dshcs-loading"},"\u6B63\u5728\u542F\u52A8 code-server\u2026");var x=p&&r!=null&&r.error?r.error:"code-server \u672A\u8FD0\u884C",v=f?"\u5F53\u524D\u4EE5 DSH \u540C\u6E90\u8DEF\u5F84 "+(r!=null&&r.url||"/code-server/")+" \u63D0\u4F9B(\u65E0\u72EC\u7ACB\u7AEF\u53E3)\u3002":"\u5F53\u524D\u4EE5\u72EC\u7ACB\u56DE\u73AF\u7AEF\u53E3\u63D0\u4F9B(\u7AEF\u53E3 "+(r!=null&&r.port!=null?r.port:"\u968F\u673A")+" + \u8DEF\u5F84\u4EE4\u724C;\u8981\u5728\u65B0\u6807\u7B7E\u9875\u6253\u5F00,\u590D\u5236\u8BBE\u7F6E\u5361\u91CC\u7684\u5B8C\u6574\u5730\u5740 \u2014\u2014 \u7F3A\u4E86\u4EE4\u724C\u90A3\u6BB5\u4F1A 404)\u3002",w=R?"\u5E38\u9A7B\u9762:\u53EF\u7528(\u5207\u6807\u7B7E/\u6536\u8D77\u4FA7\u680F\u4E0D\u91CD\u8F7D)\u3002":"\u5E38\u9A7B\u9762:\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 Element.moveBefore \u2014\u2014 \u5207\u6807\u7B7E\u4F1A\u6574\u9875\u91CD\u8F7D(\u5347\u7EA7\u6D4F\u89C8\u5668\u540E\u81EA\u52A8\u53EF\u7528)\u3002";return i.createElement("div",{className:"dshcs-empty"},i.createElement("div",{className:"dshcs-emptybox"},i.createElement("div",null,p?"code-server \u542F\u52A8\u5931\u8D25":"code-server \u672A\u8FD0\u884C"),i.createElement("pre",{className:"dshcs-error"},x),i.createElement("p",{className:"dshcs-hint"},"VS Code \u6811\u968F\u63D2\u4EF6\u5305\u5185\u7F6E\u3001\u5C31\u5730\u8FD0\u884C(\u65E0\u9700\u5168\u5C40\u5B89\u88C5\u3001\u65E0\u9700\u8054\u7F51\u5B89\u88C5\u3001\u65E0\u300C\u5B89\u88C5\u73AF\u5883\u300D\u6B65\u9AA4);\u5185\u90E8\u4F9D\u8D56\u4E0E\u9884\u7F16\u8BD1\u539F\u751F\u6A21\u5757\u7531\u5305\u7BA1\u7406\u5668\u5728\u5B89\u88C5\u63D2\u4EF6\u65F6\u4E00\u5E76\u88C5\u597D(\u65E0\u9700 C++ \u5DE5\u5177\u94FE)\u3002\u82E5\u6B64\u5904\u957F\u671F\u672A\u8FD0\u884C,\u8BF7\u67E5\u770B DSH host \u65E5\u5FD7\u91CC\u7684 [code-server] \u8F93\u51FA(\u6216\u5728\u8BBE\u7F6E\u5361\u7247\u91CC\u5207\u6362\u300C\u540E\u53F0\u5E38\u9A7B\u300D\u89E6\u53D1\u4E00\u6B21\u542F\u52A8)\u3002"+v+w)))}function mr(e){var r=se(),n=r.status,t=n!=null&&n.ok===!0&&n.running===!0,a=n!=null&&n.keepResident===!0,l=Me(e!=null?e:{}),o=Z({sessions:l.sessions,workspaces:l.workspaces}),c=t?Ie(n,o):null;return i.useEffect(function(){!a||!t||c===null||ee({src:c,sameOrigin:n!=null&&n.serve==="dsh"})},[a,t,c,n!=null?n.serve:null]),null}var hr=".dshcs-frame{display:block;position:absolute;inset:0;z-index:1;width:100%;height:100%;border:0;background:var(--dsw-alias-bg-base,#fff)}.dshcs-tabroot{position:relative;display:flex;flex-direction:column;width:100%;height:100%;min-width:0;min-height:0;background:var(--dsw-alias-bg-base,#fff)}.dshcs-slot{position:relative;display:block;width:100%;height:100%;min-width:0;min-height:0;overflow:hidden;background:var(--dsw-alias-bg-base,#fff)}.dshcs-park{position:fixed;left:-20000px;top:0;width:320px;height:200px;overflow:hidden;pointer-events:none;z-index:0;visibility:hidden;contain:strict}.dshcs-loading{position:absolute;inset:0;z-index:2;display:grid;place-items:center;background:var(--dsw-alias-bg-base,#fff);color:var(--dsw-alias-label-tertiary,#7d8798);font-size:13px}.dshcs-empty{position:relative;z-index:2;flex:1;display:flex;align-items:center;justify-content:center;padding:44px 24px 24px}.dshcs-emptybox{max-width:560px;text-align:left;background:var(--dsw-alias-bg-layer-2,#f7f8fb);border:1px solid var(--dsw-alias-border-l2,#dfe3eb);border-radius:12px;padding:16px 18px}.dshcs-error{color:var(--dsw-alias-label-error,#d92d20);white-space:pre-wrap;word-break:break-all;font-family:ui-monospace,Consolas,monospace;font-size:12px;margin:8px 0 0}.dshcs-hint{color:var(--dsw-alias-label-tertiary,#7d8798);font-size:12px;margin:6px 0 0}.dshcs-legacy{color:var(--dsw-alias-label-warning,#b54708);font-size:12px;font-weight:600;margin:0 0 6px}",Se="dsh-code-server/styles";typeof document!="undefined"&&document.querySelector("style[data-dshcs="+JSON.stringify(Se)+"]")===null&&(F=document.createElement("style"),F.setAttribute("data-dshcs",Se),F.textContent=hr,document.head.appendChild(F));var F,Ce="code-server",Ne="dsh-code-server-app",gr="dsh-code-server-app",br="\u5728\u53F3\u4FA7\u680F\u6807\u7B7E\u91CC\u8FD0\u884C VS Code \u7F51\u9875\u7248,\u8DDF\u968F\u5F53\u524D\u4F1A\u8BDD\u5DE5\u4F5C\u533A;\u8BA4\u9886\u7C7B\u578B\u3001\u6253\u5F00\u5373\u5168\u5C4F\u3001\u540E\u53F0\u5E38\u9A7B\u90FD\u5728\u8FD9\u91CC\u8BBE\u3002",yr=2500,xr=1e4,wr=1500;function kr(e){var r=e!=null&&typeof e.size=="number"?e.size:16;return i.createElement("img",{src:pr,alt:"","aria-hidden":!0,draggable:!1,className:e!=null?e.className:void 0,style:{width:r,height:r,display:"block",objectFit:"contain",WebkitUserDrag:"none",userSelect:"none"}})}var Er=B("");function Sr(){var e=z.status;return e==null||typeof e.claimExtensions!="string"?Er:B(e.claimExtensions)}function Cr(e){var r=e.useTabInfo(),n=r.tab,t=se(),a=t.status,l=n.navigation,o=l!=null&&typeof l.revision=="number"?l.revision:0,c=l!=null&&typeof l.address=="string"?l.address:"",p=Q(c)?null:U(c),f=Me(e),x=p!=null&&typeof p.sessionId=="string"?p.sessionId:void 0,v=Z({sessions:f.sessions,workspaces:f.workspaces,sessionId:x!==void 0?x:e.sessionId}),w=i.useRef(!1),d=de(p,v),m=l!=null&&l.params!=null&&typeof l.params.line=="number"?l.params.line:null,h=i.useRef(void 0),[E,Y]=i.useState(0),P=i.useRef(null),C=i.useRef(!1),_=r.tab!=null&&r.tab.visible===!0,H=r.sidebar!=null&&r.sidebar.fullscreen===!0,M=a!=null&&a.fullscreenOnOpen!==!1;return i.useLayoutEffect(function(){if(!_){C.current=!1;return}if(!(!M||H||C.current)){C.current=!0;var b=he(P.current);b!=="clicked"&&console.warn("[code-server] \u672A\u80FD\u81EA\u52A8\u5207\u5230\u5168\u5C4F\u53F3\u4FA7\u680F("+b+");\u672C\u6B21\u6253\u5F00\u4FDD\u6301\u539F\u6A21\u5F0F")}},[_,H,M]),i.useEffect(function(){if(!(typeof v!="string"||v==="")&&h.current!==v){var b=h.current!==void 0;h.current=v;var S=!1;return y("/code-server/start",{cwd:v}).then(function(N){S||(L({status:N}),b&&N!=null&&N.ok===!0&&N.running===!0&&Y(function(g){return g+1}))}).catch(function(){}),function(){S=!0}}},[v]),i.useEffect(function(){typeof v=="string"&&v!==""||w.current||(w.current=!0,console.warn("[code-server] \u672A\u80FD\u89E3\u6790\u5F53\u524D\u5DE5\u4F5C\u533A\u76EE\u5F55(\u4F1A\u8BDD\u65E0 cwd / \u6807\u51C6 prop \u65E0 sessionId / \u5DE5\u4F5C\u533A\u8868\u4E5F\u6CA1\u5339\u914D\u4E0A):\u672C\u6B21\u4E0D\u5411\u5BBF\u4E3B\u53D1\u9001 cwd,IDE \u4F1A\u4EE5\u7A7A\u5DE5\u4F5C\u533A\u6253\u5F00"))},[v]),i.useEffect(function(){y("/code-server/status").then(function(S){S!=null&&L({status:S})}).catch(function(){});var b=window.setInterval(function(){y("/code-server/status").then(function(S){L({status:S})}).catch(function(){})},3e3);return function(){window.clearInterval(b)}},[]),i.useEffect(function(){d!==null&&y("/code-server/open-file",m===null?{file:d}:{file:d,line:m}).catch(function(){})},[o,d,m]),i.createElement("div",{className:"dshcs-tabroot","data-code-server-tab":"body",ref:P},i.createElement(vr,{status:a,pageUrl:Ie(a,v),reloadTick:E,owner:"tab:"+n.id}))}function re(e,r){if(e==null)return null;var n=e[r];if(n!=null)return n;if(typeof e.get=="function"){var t=e.get(r);if(t!=null)return t}return null}function Nr(e){var r=re(e,"sidebarRightTabs"),n=re(e,"sidebarRight");if(r==null||n==null)return console.error("[code-server] \u53F3\u4FA7\u680F\u670D\u52A1\u4E0A\u4E0B\u6587\u4E0D\u53EF\u89C1(sidebarRightTabs="+(r!=null)+", sidebarRight="+(n!=null)+"):\u8DF3\u8FC7\u4FA7\u680F\u6CE8\u518C"),!1;var t=re(e,"slots");if(e.effect(function(){return r.register({id:Ne,kind:Ce,priority:"extension",patterns:["dsh-resource://file/**"],canOpen:function(a){return ve(U(a),Sr())},title:function(a){if(Q(a)||a===void 0||a===null||a==="")return"Code Server";var l=ce(a);return l===""?"Code Server":l},guide:[{order:20,title:function(){return"Code Server"},description:function(){return"\u5728\u53F3\u4FA7\u680F\u6807\u7B7E\u91CC\u8FD0\u884C VS Code \u7F51\u9875\u7248,\u8DDF\u968F\u5F53\u524D\u4F1A\u8BDD\u5DE5\u4F5C\u533A;\u4EA7\u7269/\u4EA4\u4ED8\u6587\u4EF6\u70B9\u51FB\u540E\u5728\u6B64\u6253\u5F00\u3002"},icon:kr}]})},"code-server: sidebar tab type"),t!=null)e.effect(function(){return t.inject("sidebar.right.pane.tab",function(){return t.register({name:"sidebar.right.pane.tab",key:Ne},Cr)})},"code-server: sidebar tab body");else return console.error("[code-server] slots \u670D\u52A1\u4E0D\u53EF\u89C1:\u4FA7\u680F\u6807\u7B7E body \u672A\u6CE8\u518C"),!1;return e.effect(function(){return function(){L({sidebarUi:"unknown"})}},"code-server: sidebar mode reset"),console.log("[code-server] right-sidebar tab registered (kind="+Ce+")"),!0}var Or=".dshcs-card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:12px;list-style:none;transition:border-color .16s,background .16s}.dshcs-card:hover{border-color:var(--dsw-alias-label-dimmed,var(--dsw-alias-border-l2))}.dshcs-cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed,var(--dsw-alias-border-l2))}.dshcs-cardHeader{appearance:none;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:12px;align-items:center;gap:12px;padding:14px 16px;display:flex}.dshcs-cardHeader:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}.dshcs-cardHeadText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}.dshcs-cardName{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}.dshcs-cardDescription{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));font-size:13px;line-height:1.5}.dshcs-cardChevron{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));flex:none;transition:transform .16s;display:inline-flex}.dshcs-cardChevronOpen{transform:rotate(180deg)}.dshcs-cardBody{border-top:1px solid var(--dsw-alias-border-l2);margin:0 16px;padding-bottom:8px}.dshcs-cardReadOnly{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));margin:12px 0 0;font-size:12px;line-height:1.5}.dshcs-pending{white-space:nowrap;background:var(--dsw-alias-bg-module-platform,var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-label-secondary);border-radius:999px;flex:none;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.dshcs-cardFooter{border-top:1px solid var(--dsw-alias-border-l2);justify-content:flex-end;align-items:center;gap:8px;padding:12px 0 4px;display:flex}.dshcs-cardFailed{min-width:0;color:var(--dsw-alias-label-error,var(--dsw-alias-state-error-primary));flex:1;margin:0;font-size:12px;line-height:1.5}.dshcs-cbtn{appearance:none;font:inherit;cursor:pointer;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5;border:1px solid transparent;transition:color .12s ease,background .12s ease}.dshcs-cbtn:disabled{opacity:.4;cursor:default}.dshcs-cbtn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}.dshcs-cbtnOutline{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);background:0 0}.dshcs-cbtnOutline:hover:not(:disabled){color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover,transparent)}.dshcs-cbtnPrimary{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3);border-color:var(--dsw-alias-label-primary);font-weight:600}.dshcs-cbtnPrimary:hover:not(:disabled){filter:brightness(.95)}.dshcs-cbtnPrimary:active:not(:disabled){filter:brightness(.9)}.dshcs-field{flex-direction:column;gap:6px;padding:12px 0;display:flex}.dshcs-field+.dshcs-field{border-top:1px solid var(--dsw-alias-border-l2)}.dshcs-fieldHead{align-items:center;gap:8px;display:flex}.dshcs-fieldLabel{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13px;font-weight:500;line-height:1.5}.dshcs-card .dshcs-hint{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));margin:0;font-size:12px;line-height:1.5}.dshcs-check{display:flex;align-items:center;gap:8px;cursor:pointer}.dshcs-check input{accent-color:var(--dsw-alias-brand-primary);width:15px;height:15px;margin:0;flex:none}.dshcs-check input:disabled{cursor:default}.dshcs-text{display:flex}.dshcs-text input{font:12px/1.5 ui-monospace,Consolas,monospace;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-3,transparent);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;padding:5px 8px;width:100%;min-width:0}.dshcs-text input:disabled{opacity:.5;cursor:default}.dshcs-text input:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-1px}.dshcs-badges{align-items:center;gap:8px;display:inline-flex}.dshcs-badge{white-space:nowrap;background:var(--dsw-alias-bg-module-platform,var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-label-secondary);border-radius:999px;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.dshcs-reset{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;padding:0;font-size:12px;line-height:1.5}.dshcs-reset:hover:not(:disabled){color:var(--dsw-alias-label-primary)}.dshcs-reset:disabled{cursor:default}.dshcs-cfgpage{display:flex;flex-direction:column;gap:0}.dshcs-cfgfoot{justify-content:flex-end;align-items:center;gap:8px;padding:12px 0 4px;display:flex}",Lr="dsh-code-server/Card.module.css";function Ar(e,r){if(typeof document!="undefined"&&document.querySelector("style[data-plugin-css="+JSON.stringify(e)+"]")===null){var n=document.createElement("style");n.dataset.plugin="dsh-code-server",n.dataset.pluginCss=e,n.textContent=r,document.head.appendChild(n)}}Ar(Lr,Or);function Tr(e){return i.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none","aria-hidden":!0,className:e.className},i.createElement("path",{d:"M3.5 5.25L7 8.75L10.5 5.25",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))}function W(e){return i.createElement("button",{type:"button",className:"dshcs-cbtn "+(e.variant==="primary"?"dshcs-cbtnPrimary":"dshcs-cbtnOutline"),disabled:e.disabled===!0,onClick:e.onClick},e.children)}function Oe(e){return i.createElement("label",{className:"dshcs-check"},i.createElement("input",{type:"checkbox",checked:e.checked===!0,disabled:e.disabled===!0,onChange:function(r){e.onChange(r.target.checked)}}),i.createElement("span",{className:"dshcs-hint"},e.children))}function Mr(e){return i.createElement("label",{className:"dshcs-text"},i.createElement("input",{type:"text",value:e.value,disabled:e.disabled===!0,spellCheck:!1,autoComplete:"off",placeholder:e.placeholder,onChange:function(r){e.onChange(r.target.value)}}))}function ne(e){var r=[];return e.overridden===!0&&(r.push(i.createElement("span",{className:"dshcs-badge"},e.overriddenLabel)),r.push(i.createElement("button",{type:"button",className:"dshcs-reset",disabled:e.disabled===!0,onClick:e.onReset},e.resetLabel))),r.length===0?null:i.createElement("span",{className:"dshcs-badges"},...r)}function Le(e){var[r,n]=i.useState(e.defaultOpen===!0),t=e.state;if(t==null||t.available!==!0)return null;var a=e.title,l=e.noticeOnly===!0,o=t.dirty!==!0||t.invalid===!0||t.saving===!0;return i.createElement("li",{className:"dshcs-card"+(r?" dshcs-cardOpen":"")},i.createElement("button",{type:"button",className:"dshcs-cardHeader","aria-expanded":r,onClick:function(){n(!r)}},i.createElement("span",{className:"dshcs-cardHeadText"},i.createElement("span",{className:"dshcs-cardName"},a),i.createElement("span",{className:"dshcs-cardDescription"},e.description)),t.dirty===!0?i.createElement("span",{className:"dshcs-pending"},e.unsavedLabel):null,i.createElement(Tr,{className:"dshcs-cardChevron"+(r?" dshcs-cardChevronOpen":"")})),r===!0?i.createElement("div",{className:"dshcs-cardBody"},l===!0?null:t.writable!==!0?i.createElement("p",{className:"dshcs-cardReadOnly",role:"status"},e.readOnlyLabel):null,e.children,l===!0?null:i.createElement("div",{className:"dshcs-cardFooter"},t.failed===!0?i.createElement("p",{className:"dshcs-cardFailed",role:"status"},e.saveFailedLabel):null,i.createElement(W,{disabled:t.dirty!==!0||t.saving===!0,onClick:e.onDiscard},e.discardLabel),i.createElement(W,{variant:"primary",disabled:o,onClick:e.onSave},t.saving===!0?e.savingLabel:e.saveLabel))):null)}function Re(e){try{let b=function(){y("/code-server/status").then(function(g){g!=null&&typeof g=="object"&&L({status:g})}).catch(function(){})};var r=e.scope,[n,t]=i.useState(function(){return r!==void 0?r.getSnapshot():null}),[a,l]=i.useState(null),[o,c]=i.useState(!1),[p,f]=i.useState(!1),x=se(),[v,w]=i.useState(ye());if(i.useEffect(function(){return be(function(g){w(g)})},[]),i.useEffect(function(){if(r===void 0||typeof r.subscribe!="function")return;function g(){try{t(r.getSnapshot())}catch(Wr){}}var k=r.subscribe(g);return function(){typeof k=="function"&&k()}},[r]),r===void 0)return console.error("[code-server] card scope missing"),null;if(n==null||n.status!=="ready")return n!=null&&n.status==="unavailable"&&console.warn("[code-server] settings scope unavailable:",n.status),null;var d=n.value!==void 0&&n.value!==null?n.value:{},m=n.user,h={keepResident:d.keepResident!==!1,claimExtensions:typeof d.claimExtensions=="string"?d.claimExtensions:I,fullscreenOnOpen:d.fullscreenOnOpen!==!1};if(x!=null&&x.sidebarUi==="legacy")return i.createElement(Le,{title:"Code Server",description:"\u5F53\u524D DSH \u7248\u672C\u4E0D\u53D7\u652F\u6301(\u7F3A\u5C11\u53F3\u4FA7\u680F\u670D\u52A1)",defaultOpen:!0,noticeOnly:!0,state:{available:!0,writable:!1,dirty:!1,invalid:!1,saving:!1,failed:!1}},i.createElement("div",{className:"dshcs-field"},i.createElement("div",{className:"dshcs-legacy"},"\u672C\u63D2\u4EF6\u81EA 0.2.3 \u8D77\u4E0D\u518D\u517C\u5BB9\u65E7\u7248 DSH\u3002"),i.createElement("div",{className:"dshcs-hint",style:{marginTop:0}},`\u672A\u68C0\u6D4B\u5230\u53F3\u4FA7\u680F\u63D2\u4EF6\u670D\u52A1 sidebarRightTabs / sidebarRight,\u56E0\u6B64\u63D2\u4EF6\u4E0D\u63D0\u4F9B\u4EFB\u4F55\u5165\u53E3(\u65E7\u7248\u7684\u60AC\u6D6E\u7403\u4E0E\u6D6E\u52A8\u7A97\u53E3\u5DF2\u79FB\u9664),\u4E5F\u4E0D\u4F1A\u540E\u53F0\u542F\u52A8 IDE\u3002
3
- \u5347\u7EA7 DSH \u5230\u5E26\u53F3\u4FA7\u680F\u7684\u7248\u672C(\u2265 0.1.5-alpha.1)\u540E,Code Server \u4F1A\u51FA\u73B0\u5728\u53F3\u4FA7\u680F\u6807\u7B7E\u91CC,\u672C\u9875\u540C\u65F6\u663E\u793A\u5B8C\u6574\u8BBE\u7F6E\u9879;\u5347\u7EA7\u540E\u65E0\u9700\u91CD\u88C5\u672C\u63D2\u4EF6,\u5237\u65B0\u9875\u9762\u5373\u53EF\u3002`)));var E=m!=null&&Object.prototype.hasOwnProperty.call(m,"keepResident"),Y=m!=null&&Object.prototype.hasOwnProperty.call(m,"claimExtensions"),P=m!=null&&Object.prototype.hasOwnProperty.call(m,"fullscreenOnOpen"),C=a!==null&&(a.keepResident!==h.keepResident||A(a.claimExtensions)!==A(h.claimExtensions)||a.fullscreenOnOpen!==h.fullscreenOnOpen),_=!C||o,H={available:!0,writable:n.writable,dirty:C,invalid:!1,saving:o,failed:p};async function S(){if(C&&!o){c(!0),f(!1);try{var g=a!==null?a:h;await e.scope.set("keepResident",g.keepResident===!0),await e.scope.set("claimExtensions",A(g.claimExtensions)),await e.scope.set("fullscreenOnOpen",g.fullscreenOnOpen===!0),l(null),b()}catch(k){f(!0)}c(!1)}}async function N(){if(!(o||n.writable!==!0)){c(!0),f(!1);try{typeof e.scope.unset=="function"?(await e.scope.unset("keepResident"),await e.scope.unset("claimExtensions"),await e.scope.unset("fullscreenOnOpen")):(await e.scope.set("keepResident",d.keepResident===void 0||d.keepResident===null?!0:d.keepResident),await e.scope.set("claimExtensions",typeof d.claimExtensions=="string"?A(d.claimExtensions):I),await e.scope.set("fullscreenOnOpen",d.fullscreenOnOpen===void 0||d.fullscreenOnOpen===null?!0:d.fullscreenOnOpen)),l(null),b()}catch(g){f(!0)}c(!1)}}var M=[i.createElement("div",{className:"dshcs-field"},i.createElement("div",{className:"dshcs-fieldHead"},i.createElement("span",{className:"dshcs-fieldLabel"},"\u8BA4\u9886\u7C7B\u578B(\u6309\u6269\u5C55\u540D,\u5206\u53F7\u5206\u9694)"),Y===!0?i.createElement(ne,{overridden:!0,disabled:n.writable!==!0,overriddenLabel:"\u5DF2\u8986\u76D6",resetLabel:"\u6062\u590D\u9ED8\u8BA4",onReset:function(){N()}}):null),i.createElement(Mr,{value:a!==null?a.claimExtensions:h.claimExtensions,disabled:n.writable!==!0,placeholder:I,onChange:function(g){l(function(k){return Object.assign({},k!==null?k:h,{claimExtensions:g})}),f(!1)}}),i.createElement("div",{className:"dshcs-hint",style:{marginTop:4}},"\u5199\u6269\u5C55\u540D(\u4E0D\u5E26\u70B9,\u5927\u5C0F\u5199\u968F\u610F);`*` = \u5176\u4F59\u7C7B\u578B\u4E5F\u8BA4\u9886;`!ext` = \u4E0D\u8BA4\u9886(\u6392\u9664\u4F18\u5148)\u3002\u4E0D\u518D\u533A\u5206\u4F1A\u8BDD\u5185/\u7EDD\u5BF9\u8DEF\u5F84 \u2014\u2014 \u6240\u6709 `dsh-resource://file/**` \u4E00\u89C6\u540C\u4EC1,\u672A\u8BA4\u9886\u7684\u843D\u56DE DSH \u81EA\u5E26\u9884\u89C8\u3002"),i.createElement("div",{className:"dshcs-hint",style:{marginTop:2}},"\u9ED8\u8BA4\u6392\u9664\u4E09\u7C7B:DSH \u9884\u89C8\u6E32\u67D3\u5F97\u597D\u7684 markdown/html/\u56FE\u7247/PDF\u3001**\u53EF\u6267\u884C\u6587\u4EF6\u4E0E\u4E8C\u8FDB\u5236\u4EA7\u7269**(exe/dll/msi/jar/so\u2026)\u3001**Office \u4E0E\u7248\u5F0F\u6587\u6863**(docx/xlsx/pptx/vsdx\u2026)\u3002\u6587\u672C\u5F62\u6001\u7684\u811A\u672C(bat/cmd/ps1/sh/py)\u4E0E csv/tsv \u4ECD\u8FDB IDE\u3002"),i.createElement("div",{className:"dshcs-hint",style:{marginTop:2}},"\u5B9E\u9645\u89C4\u5219:"+me(a!==null?a.claimExtensions:h.claimExtensions)+(A(a!==null?a.claimExtensions:h.claimExtensions)!==(a!==null?a.claimExtensions:h.claimExtensions)?"(\u4FDD\u5B58\u540E\u5F52\u4E00\u5316)":"")+" \xB7 \u9ED8\u8BA4 "+I)),i.createElement("div",{className:"dshcs-field"},i.createElement("div",{className:"dshcs-fieldHead"},i.createElement("span",{className:"dshcs-fieldLabel"},"\u6253\u5F00\u5373\u5168\u5C4F(\u53F3\u4FA7\u680F\u94FA\u6EE1\u7A97\u53E3)"),P===!0?i.createElement(ne,{overridden:!0,disabled:n.writable!==!0,overriddenLabel:"\u5DF2\u8986\u76D6",resetLabel:"\u6062\u590D\u9ED8\u8BA4",onReset:function(){N()}}):null),i.createElement(Oe,{checked:a!==null?a.fullscreenOnOpen:h.fullscreenOnOpen,disabled:n.writable!==!0,onChange:function(g){l(function(k){return Object.assign({},k!==null?k:h,{fullscreenOnOpen:g===!0})}),f(!1)}},'\u6253\u5F00 Code Server \u6807\u7B7E(\u542B\u70B9\u5F00\u4EA7\u7269/\u4EA4\u4ED8\u6587\u4EF6)\u65F6,\u81EA\u52A8\u628A\u53F3\u4FA7\u680F\u4ECE"\u4E0E\u5BF9\u8BDD\u5E76\u6392"\u5207\u5230\u5168\u5C4F;\u60F3\u540C\u65F6\u770B\u5BF9\u8BDD\u5C31\u5173\u6389\u5B83,\u6216\u968F\u65F6\u70B9\u53F3\u4FA7\u680F\u7684\u300C\u9000\u51FA\u5168\u5C4F\u300D\u2014\u2014 \u672C\u6B21\u6253\u5F00\u4E0D\u4F1A\u88AB\u62A2\u56DE\u53BB'),i.createElement("div",{className:"dshcs-hint",style:{marginTop:4}},'\u53EA\u5F71\u54CD"\u6253\u5F00\u90A3\u4E00\u523B":\u5207\u8D70\u518D\u5207\u56DE\u3001\u518D\u6B21\u6253\u5F00\u6587\u4EF6 tab \u4F1A\u91CD\u65B0\u5207\u5168\u5C4F;DSH \u672A\u5411\u63D2\u4EF6\u5F00\u653E\u6A21\u5F0F\u63A5\u53E3,\u672C\u9879\u7531\u70B9\u51FB\u53F3\u4FA7\u680F\u81EA\u8EAB\u7684\u300C\u5168\u5C4F\u300D\u6309\u94AE\u5B9E\u73B0\u3002')),i.createElement("div",{className:"dshcs-field"},i.createElement("div",{className:"dshcs-fieldHead"},i.createElement("span",{className:"dshcs-fieldLabel"},"\u540E\u53F0\u5E38\u9A7B(\u5207\u6807\u7B7E\u4E0D\u91CD\u8F7D)"),E===!0?i.createElement(ne,{overridden:!0,disabled:n.writable!==!0,overriddenLabel:"\u5DF2\u8986\u76D6",resetLabel:"\u6062\u590D\u9ED8\u8BA4",onReset:function(){N()}}):null),i.createElement(Oe,{checked:a!==null?a.keepResident:h.keepResident,disabled:n.writable!==!0,onChange:function(g){l(function(k){return Object.assign({},k!==null?k:h,{keepResident:g===!0})}),f(!1)}},'\u5F00\u542F\u540E\u5BBF\u4E3B\u542F\u52A8\u5373\u628A IDE \u52A0\u8F7D\u5230\u540E\u53F0"\u505C\u653E\u533A":\u5207\u6362\u53F3\u4FA7\u680F\u6807\u7B7E\u3001\u6536\u8D77/\u5C55\u5F00\u4FA7\u680F\u3001\u62D6\u6210\u6D6E\u52A8\u7A97\u53E3\u90FD\u4E0D\u518D\u91CD\u8F7D,\u9996\u6B21\u6253\u5F00\u514D\u7B49\u5F85;\u5173\u95ED\u5219\u53EA\u5728\u6253\u5F00\u9762\u677F\u65F6\u52A0\u8F7D(\u7701\u5185\u5B58)'),i.createElement("div",{className:"dshcs-hint",style:{marginTop:4}},R?"\u5E38\u9A7B\u9762:"+(v.docked?"\u5DF2\u505C\u9760":v.ready?"\u5DF2\u505C\u653E(\u540E\u53F0\u8FD0\u884C\u4E2D)":"\u672A\u542F\u52A8")+(v.degraded?" \xB7 \u672C\u6B21\u53D1\u751F\u8FC7\u964D\u7EA7\u91CD\u8F7D":""):"\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 Element.moveBefore(Chromium <133)\u2192 \u5E38\u9A7B\u4E0D\u53EF\u7528,\u5207\u6807\u7B7E\u4ECD\u4F1A\u6574\u9875\u91CD\u8F7D(\u5347\u7EA7\u6D4F\u89C8\u5668\u540E\u81EA\u52A8\u751F\u6548)"))];return e.seat==="bundle-config"?i.createElement("div",{className:"dshcs-cfgpage","data-code-server-config":"page"},n.writable!==!0?i.createElement("p",{className:"dshcs-cardReadOnly",role:"status"},"\u672C\u90E8\u7F72\u7684\u8BBE\u7F6E\u4E3A\u53EA\u8BFB\u3002"):null,...M,p===!0?i.createElement("p",{className:"dshcs-cardFailed",role:"status"},"\u672C\u90E8\u7F72\u6CA1\u6709\u63A5\u53D7\u8FD9\u4E9B\u503C\uFF0C\u5DF2\u4FDD\u7559\u4F9B\u4F60\u4FEE\u6539\u3002"):null,i.createElement("div",{className:"dshcs-cfgfoot"},i.createElement(W,{disabled:!C||o,onClick:function(){l(null),f(!1)}},"\u653E\u5F03\u4FEE\u6539"),i.createElement(W,{variant:"primary",disabled:_,onClick:function(){S()}},o===!0?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58"))):i.createElement(Le,{title:"Code Server",description:"\u5165\u53E3:\u53F3\u4FA7\u680F\u6807\u7B7E(DSH \u2265 0.1.5-alpha.1);\u8BA4\u9886\u7C7B\u578B\u51B3\u5B9A\u54EA\u4E9B\u6587\u4EF6\u4EA4\u7ED9 Code Server \u6253\u5F00",state:H,unsavedLabel:"\u672A\u4FDD\u5B58",readOnlyLabel:"\u672C\u90E8\u7F72\u7684\u8BBE\u7F6E\u4E3A\u53EA\u8BFB\u3002",saveFailedLabel:"\u672C\u90E8\u7F72\u6CA1\u6709\u63A5\u53D7\u8FD9\u4E9B\u503C\uFF0C\u5DF2\u4FDD\u7559\u4F9B\u4F60\u4FEE\u6539\u3002",discardLabel:"\u653E\u5F03\u4FEE\u6539",saveLabel:"\u4FDD\u5B58",savingLabel:"\u4FDD\u5B58\u4E2D\u2026",onSave:S,onDiscard:function(){l(null),f(!1)}},...M)}catch(b){return console.error("[code-server] card render error:",b!=null&&b.message!==void 0?b.message:String(b)),null}}function Ir(e){return e!=null&&e.view==="summary"?br:i.createElement(Re,Object.assign({},e,{seat:"bundle-config"}))}var Ae=900,u={rev:-1,open:!1,mounted:!1,pending:null,el:null,body:null,title:null,timer:null,loading:!1};function Rr(e){if(!(e===null||typeof e!="object")){if(e.type==="ready"){T(!0);return}if(e.type==="ask"&&typeof e.text=="string"){y("/code-server/ask/send",{text:e.text,mode:u.pending===null?void 0:u.pending.mode}).then(function(r){u.rev=-1,T(!0)}).catch(function(){});return}if(e.type==="approve"&&typeof e.id=="string"){y("/code-server/ask/approve",{id:e.id,outcome:e.outcome}).then(function(r){r!=null&&r.ok===!1&&G(r.error||"\u6388\u6743\u63D0\u4EA4\u5931\u8D25"),u.rev=-1,T(!0)}).catch(function(r){G("\u6388\u6743\u63D0\u4EA4\u5931\u8D25:"+String(r&&r.message?r.message:r))});return}e.type==="close"&&je()}}function T(e){if(u.el!==null){var r=window.__DSHCS_ASK_PUSH__;typeof r=="function"?r(u.pending):e===!0&&setTimeout(function(){T(!1)},120)}}function G(e){console.warn("[code-server] ask dialog:",e)}function je(){u.open=!1,u.el!==null&&(u.el.style.display="none"),y("/code-server/ask/close",{}).catch(function(){})}function De(){if(u.el===null){var e=document.createElement("div");e.className="dshcs-dialog",e.setAttribute("data-dshcs-dialog","ask"),e.style.cssText=["position:fixed","right:24px","bottom:24px","width:460px","height:600px","min-width:320px","min-height:280px","max-width:96vw","max-height:92vh","resize:both","overflow:hidden","display:none","z-index:2147483000","border-radius:10px","box-shadow:0 18px 48px rgba(0,0,0,.45)","border:1px solid var(--dsw-alias-border-l2, rgba(128,128,128,.4))","background:var(--dsw-alias-bg-base, var(--vscode-editor-background, #1e1e1e))"].join(";");var r=document.createElement("div");r.style.cssText="display:flex;align-items:center;gap:8px;padding:6px 10px;cursor:move;border-bottom:1px solid var(--dsw-alias-border-l1, rgba(128,128,128,.3));font:var(--dsw-font-markdown-base, 13px/20px sans-serif)";var n=document.createElement("span");n.textContent="DSH \u5BF9\u8BDD",n.style.cssText="font-weight:600;flex:none";var t=document.createElement("span");t.style.cssText="flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary, rgba(128,128,128,.9));font-size:12px";var a=document.createElement("button");a.type="button",a.textContent="\u2715",a.title="\u5173\u95ED",a.setAttribute("aria-label","\u5173\u95ED"),a.style.cssText="flex:none;border:0;background:transparent;color:inherit;cursor:pointer;font-size:13px;line-height:1;padding:2px 6px;border-radius:4px",a.addEventListener("click",function(){je()}),r.appendChild(n),r.appendChild(t),r.appendChild(a);var l=document.createElement("div");l.className="dshcs-panel",l.setAttribute("data-dshcs-ask-root",""),l.style.cssText="height:calc(100% - 33px);overflow:hidden",e.appendChild(r),e.appendChild(l),document.body.appendChild(e),u.el=e,u.body=l,u.title=t;var o=null;r.addEventListener("pointerdown",function(c){if(c.target!==a){var p=e.getBoundingClientRect();o={x:c.clientX,y:c.clientY,left:p.left,top:p.top},e.style.right="auto",e.style.bottom="auto",e.style.left=p.left+"px",e.style.top=p.top+"px";try{r.setPointerCapture(c.pointerId)}catch(f){}}}),r.addEventListener("pointermove",function(c){o!==null&&(e.style.left=Math.max(0,Math.min(window.innerWidth-80,o.left+(c.clientX-o.x)))+"px",e.style.top=Math.max(0,Math.min(window.innerHeight-40,o.top+(c.clientY-o.y)))+"px")}),r.addEventListener("pointerup",function(){o=null})}}var ze="dshcs.ask.bundle",jr=900*1e3,O=null;function ae(){try{var e=window.sessionStorage.getItem(ze);if(e==null)return null;var r=JSON.parse(e);return r==null||typeof r.js!="string"||typeof r.css!="string"||Date.now()-Number(r.at||0)>jr?null:{css:r.css,js:r.js}}catch(n){return null}}function Pe(e){try{window.sessionStorage.setItem(ze,JSON.stringify({at:Date.now(),css:e.css,js:e.js}))}catch(r){}}function Dr(){if(!(O!==null||u.mounted)){var e=ae();if(e!==null){O=e;return}y("/code-server/ask/bundle").then(function(r){r==null||r.ok!==!0||(O={css:r.css,js:r.js},Pe(O),console.log("[code-server] ask bundle preloaded ("+Math.round((r.js.length+r.css.length)/1024)+"KB)"))}).catch(function(){})}}function zr(){if(!(u.mounted||u.loading)){u.loading=!0;var e=O!==null?Promise.resolve(O):ae()!==null?Promise.resolve(ae()):y("/code-server/ask/bundle");e.then(function(r){u.loading=!1;var n=r;if(O===null&&r!=null&&r.ok===!0&&(n={css:r.css,js:r.js},O=n,Pe(n)),n==null||typeof n.js!="string"){G(n!=null&&n.error?n.error:"\u9762\u677F\u4EA7\u7269\u4E0D\u53EF\u7528");return}if(De(),document.getElementById("dshcs-ask-style")===null){var t=document.createElement("style");t.id="dshcs-ask-style",t.textContent=n.css,document.head.appendChild(t)}window.__DSHCS_HOST__="dsh",window.__DSHCS_MOUNT__=u.body,window.acquireVsCodeApi=function(){return{postMessage:Rr}};var a=document.createElement("script");a.textContent=n.js,document.head.appendChild(a),u.mounted=!0,setTimeout(function(){T(!0)},60)}).catch(function(r){u.loading=!1,G("\u9762\u677F\u4EA7\u7269\u52A0\u8F7D\u5931\u8D25:"+String(r&&r.message?r.message:r))})}}function Te(){y("/code-server/ask/state?rev="+u.rev).then(function(e){e==null||e.ok!==!0||e.changed===!0&&(u.rev=typeof e.rev=="number"?e.rev:-1,u.pending=e,e.open===!0?(De(),u.el.style.display="block",u.title!==null&&(u.title.textContent=e.contextText||"\u6765\u81EA\u7F16\u8F91\u5668"),u.open=!0,zr(),u.mounted&&T(!0)):u.el!==null&&(u.el.style.display="none",u.open=!1))}).catch(function(){})}function Pr(){u.timer===null&&(u.timer=setInterval(Te,Ae),setTimeout(Te,800),setTimeout(Dr,3e3),console.log("[code-server] ask dialog poller started (every "+Ae+"ms)"))}function _r(e){try{Hr(e),Pr()}catch(r){console.error("[code-server] apply failed:",r&&r.stack?r.stack:String(r));try{document.title="CS-ERR "+(r&&r.message||String(r))}catch(n){}}}function Hr(e){var r=e.get("slots");if(r===void 0){console.error("[code-server] slots service unavailable");return}var n=e.settingsScope,t=null;if(n!==void 0&&typeof n.bind=="function")t=n.bind({namespace:"code-server"});else{console.error("[code-server] settingsScope unavailable (inject missing?); settings card disabled");return}y("/code-server/status").then(function(d){L({status:d})}).catch(function(){}),r.inject("plugins.bundle.config",()=>r.register({name:"plugins.bundle.config",key:gr,inject:function(){return{scope:t}}},Ir)),r.inject("settings.plugin.item",()=>r.register({name:"settings.plugin.item",key:"code-server",label:"Code Server",inject:function(){return{scope:t}}},Re));var a=!1;function l(d,m){if(!a){a=!0,x();var h=!1;try{h=Nr(d)}catch(E){console.error("[code-server] sidebar tab registration failed:",E!=null&&E.message!=null?E.message:String(E))}z.sidebarUi==="legacy"&&(console.log("[code-server] \u53F3\u4FA7\u680F\u670D\u52A1\u665A\u5230(\u7ECF "+m+"):\u64A4\u9500\u65E7\u7248 DSH \u5224\u5B9A"),y("/code-server/ui-mode",{sidebar:!0}).catch(function(){})),L({sidebarUi:"modern",sidebarRegisterFailed:h!==!0}),r.inject("shell.overlay",()=>r.register({name:"shell.overlay",id:"code-server",order:70,label:"Code Server"},E=>i.createElement(mr,E))),console.log("[code-server] client registered via "+m+": sidebar tab="+h+"(claims dsh-resource://file/**) + resident preload + settings card")}}function o(d){L({sidebarUi:"legacy"}),console.warn("[code-server] \u672A\u63A2\u6D4B\u5230\u53F3\u4FA7\u680F\u670D\u52A1(sidebarRightTabs/sidebarRight): \u672C\u63D2\u4EF6\u81EA 0.2.3 \u8D77\u4E0D\u518D\u517C\u5BB9\u65E7\u7248 DSH \u2014\u2014 \u9664\u300C\u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 Code Server\u300D\u7684\u63D0\u793A\u5916\u4E0D\u63D0\u4F9B\u4EFB\u4F55\u5165\u53E3,\u4E5F\u4E0D\u9884\u70ED IDE\u3002\u8BF7\u5347\u7EA7 DSH\u3002"),d===!0&&y("/code-server/ui-mode",{sidebar:!1}).catch(function(){})}var c=null,p=null,f=null;function x(){c!==null&&(clearTimeout(c),c=null),p!==null&&(clearTimeout(p),p=null),f!==null&&(clearTimeout(f),f=null)}var v=!1;try{typeof e.inject=="function"&&(v=!0,e.inject(["sidebarRightTabs","sidebarRight"],function(d){l(d,"inject")}))}catch(d){console.warn("[code-server] sidebar inject failed:",d!=null&&d.message!=null?d.message:String(d))}var w=typeof e.get=="function"&&e.get("sidebarRightTabs")!==void 0&&e.get("sidebarRight")!==void 0;if(w){f=setTimeout(function(){a||(console.warn("[code-server] ctx.inject \u672A\u5728 1.5s \u5185\u56DE\u8C03,\u6539\u7528\u540C\u6B65\u670D\u52A1\u6CE8\u518C\u4FA7\u680F"),l(e,"sync-fallback"))},wr);return}if(v!==!0){o(!0);return}c=setTimeout(function(){a||o(!1)},yr),p=setTimeout(function(){a||o(!0)},xr)}var Ur=["slots","settingsScope"],Br="code-server";
2
+ var Q=Object.defineProperty;var Ue=Object.getOwnPropertyDescriptor;var He=Object.getOwnPropertyNames;var Fe=Object.prototype.hasOwnProperty;var Be=(e,r)=>{for(var n in r)Q(e,n,{get:r[n],enumerable:!0})},We=(e,r,n,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of He(r))!Fe.call(e,a)&&a!==n&&Q(e,a,{get:()=>r[a],enumerable:!(t=Ue(r,a))||t.enumerable});return e};var Ye=e=>We(Q({},"__esModule",{value:!0}),e);var Wr={};Be(Wr,{apply:()=>Ur,inject:()=>Fr,name:()=>Br});module.exports=Ye(Wr);var ce="dsh-resource://file/",Ge="sidebar://";function J(e){return typeof e=="string"&&e.startsWith(Ge)}function U(e){if(typeof e!="string"||!e.startsWith(ce))return null;for(var r=e.length,n=0;n<e.length;n+=1){var t=e.charAt(n);if(t==="?"||t==="#"){r=n;break}}var a=e.slice(ce.length,r).split("/"),l=a.shift();try{if(l==="session"){var o=a.shift();return o===void 0||o===""||a.length===0?null:{scope:"session",sessionId:decodeURIComponent(o),path:de(a)}}if(l==="absolute"){var c=a[0]===""&&a.length>1,p=c?a.slice(1):a,f=de(p);return(f===""||f.charAt(0)==="/")&&!c?null:c?{scope:"absolute",path:"//"+f}:f===""?null:{scope:"absolute",path:ue(f)?f:"/"+f}}}catch(x){return null}return null}function de(e){for(var r=[],n=0;n<e.length;n+=1)r.push(decodeURIComponent(e[n]));return r.join("/")}function ue(e){return/^[A-Za-z]:($|\/)/.test(e)}function Xe(e){return typeof e!="string"||e===""?!1:e.charAt(0)==="/"?!0:ue(e)}function fe(e){var r=U(e);if(r===null)return"";var n=r.path.replace(/[/\\]+$/,""),t=Math.max(n.lastIndexOf("/"),n.lastIndexOf("\\")),a=t===-1?n:n.slice(t+1);return a}function pe(e,r){if(e===null||e==null)return null;var n=typeof e.path=="string"?e.path:"";if(n==="")return null;if(Xe(n))return n;if(typeof r!="string"||r==="")return null;var t=r.indexOf("\\")!==-1?"\\":"/",a=r.replace(/[\\/]+$/,"");return a+t+(t==="\\"?n.replace(/\//g,"\\"):n)}var V=["md","markdown","html","htm","png","jpg","jpeg","gif","webp","bmp","ico","svg","pdf"],H=["exe","com","msi","msix","msixbundle","appx","appxbundle","dll","sys","scr","cpl","ocx","drv","efi","mui","obj","o","a","lib","pdb","class","jar","pyc","pyo","wasm","node","so","dylib","ko","elf","bin","out","apk","ipa","deb","rpm","dmg","iso","img","cab"],F=["doc","docx","docm","dot","dotx","dotm","docb","rtf","odt","xls","xlsx","xlsm","xlsb","xlt","xltx","xltm","xla","xlam","ods","ppt","pptx","pptm","pot","potx","potm","pps","ppsx","ppam","odp","vsd","vsdx","vssx","vstx","vsdm","vssm","vstm","one","onetoc2","mpt","mpp","pub","msg","xps","oxps","odg"],Z=["*"].concat(V).concat(H).concat(F).map(function(e,r){return r===0?e:"!"+e}).join(";"),Qe=/[;,\s]+/;function Je(e){return String(e).replace(/!\s+/g,"!").split(Qe)}function Ve(e){var r=typeof e=="string"?e.trim():"";if(r==="")return"";var n=r.charAt(0)==="!",t=n?r.slice(1).trim():r;return t==="*"?n?"!*":"*":(t.slice(0,2)==="*."?t=t.slice(2):t.charAt(0)==="."&&(t=t.slice(1)),t=t.toLowerCase(),t===""?"":n?"!"+t:t)}function T(e){if(typeof e!="string")return"";for(var r=Je(e),n=[],t=0;t<r.length;t+=1){var a=Ve(r[t]);a===""||a==="!*"||n.indexOf(a)===-1&&n.push(a)}return n.join(";")}function B(e){for(var r=T(e),n=r===""?[]:r.split(";"),t=!1,a=[],l=[],o=0;o<n.length;o+=1){var c=n[o];if(c==="*"){t=!0;continue}c.charAt(0)==="!"?l.push(c.slice(1)):a.push(c)}return{all:t,allow:a,deny:l}}function Ze(e){if(typeof e!="string"||e==="")return"";var r=e.replace(/[/\\]+$/,""),n=Math.max(r.lastIndexOf("/"),r.lastIndexOf("\\"));n!==-1&&(r=r.slice(n+1));var t=r.lastIndexOf(".");return t<=0?"":r.slice(t+1).toLowerCase()}function Ke(e,r){if(r==null)return!1;var n=Ze(e);return n!==""&&r.deny.indexOf(n)!==-1?!1:n!==""&&r.allow.indexOf(n)!==-1?!0:r.all===!0}function me(e,r){return e===null||e==null?!1:Ke(e.path,r)}function he(e){var r=B(e),n=[];if(r.all&&n.push("\u5176\u4F59\u7C7B\u578B\u5168\u90E8\u8BA4\u9886"),r.allow.length>0&&n.push("\u6307\u5B9A\u8BA4\u9886 "+r.allow.length+" \u9879"),r.deny.length>0){var t=[];ve(r.deny,H)&&t.push("\u53EF\u6267\u884C\u6587\u4EF6"),ve(r.deny,F)&&t.push("Office \u6587\u6863"),n.push("\u6392\u9664 "+r.deny.length+" \u9879"+(t.length>0?"(\u542B"+t.join("\u3001")+")":""))}return n.length===0?"\u4E0D\u8BA4\u9886\u4EFB\u4F55\u6587\u4EF6(\u53EA\u6709\u9875\u9762\u6807\u7B7E)":n.join(" \xB7 ")}function ve(e,r){for(var n=new Set(r),t=0;t<e.length;t+=1)if(n.has(e[t]))return!0;return!1}var qe="[data-sidebar-right-panel]",$e='[data-sidebar-right-mode="fullscreen"]';function ge(e){if(e==null||typeof e.closest!="function")return"no-root";var r,n;try{if(r=e.closest(qe),r==null||typeof r.querySelector!="function")return"no-panel";n=r.querySelector($e)}catch(t){return"lookup-failed"}if(n==null||typeof n.click!="function")return"no-control";try{n.click()}catch(t){return"click-failed"}return"clicked"}function be(e,r){if(!(e==null||e.byId==null)&&!(typeof r!="string"||r==="")){var n=e.byId[r];if(n!=null)return typeof n.cwd=="string"&&n.cwd!==""?n.cwd:void 0}}function K(e,r){if(!(e==null||!Array.isArray(e.items))&&!(typeof r!="string"||r===""))for(var n=0;n<e.items.length;n+=1){var t=e.items[n];if(!(t==null||!Array.isArray(t.sessionIds))&&t.sessionIds.indexOf(r)!==-1&&typeof t.path=="string"&&t.path!=="")return t.path}}function q(e){var r=e==null?{}:e,n=r.sessions==null?null:r.sessions,t=r.workspaces==null?null:r.workspaces,a=typeof r.sessionId=="string"&&r.sessionId!==""?r.sessionId:void 0,l=be(n,a);if(l!==void 0)return l;var o=n==null?void 0:n.current,c=be(n,o);if(c!==void 0)return c;var p=K(t,a);if(p!==void 0)return p;var f=K(t,typeof o=="string"?o:void 0);if(f!==void 0)return f;var x=n!=null&&Array.isArray(n.ids)?n.ids[0]:void 0,v=K(t,typeof x=="string"?x:void 0);if(v!==void 0)return v;if(t!=null&&Array.isArray(t.items)&&t.recentWorkspaceId!==void 0)for(var w=0;w<t.items.length;w+=1){var d=t.items[w];if(!(d==null||d.workspaceId!==t.recentWorkspaceId)&&typeof d.path=="string"&&d.path!=="")return d.path}if(t!=null&&Array.isArray(t.items)&&t.items.length>0){var m=t.items[0];if(m!=null&&typeof m.path=="string"&&m.path!=="")return m.path}}var M=typeof Element!="undefined"&&typeof Element.prototype.moveBefore=="function",er=-2e4,s={park:null,frame:null,currentSrc:null,sameOrigin:null,owner:null,lastRect:null,parkStrategy:"offscreen",degraded:!1,preloaded:!1,nudgeCount:0,nudgeEnabled:!0,lastNudgeAt:0,listeners:new Set};function $(){return{ready:s.frame!==null,docked:s.owner!==null,owner:s.owner,src:s.currentSrc,sameOrigin:s.sameOrigin,parkStrategy:s.parkStrategy,degraded:s.degraded,preloaded:s.preloaded,supportsMoveBefore:M,nudgeCount:s.nudgeCount,lastNudgeAt:s.lastNudgeAt}}function R(){var e=$();s.listeners.forEach(function(r){try{r(e)}catch(n){}})}function ye(e){return s.listeners.add(e),function(){s.listeners.delete(e)}}function xe(){return $()}function rr(e){e!=="offscreen"&&e!=="behind"||s.parkStrategy!==e&&(s.parkStrategy=e,s.frame!==null&&s.owner===null&&ee(),R())}function nr(){return s.parkStrategy}function tr(){var e=s.lastRect;e!==null&&(s.park.style.width=Math.max(1,Math.round(e.width))+"px",s.park.style.height=Math.max(1,Math.round(e.height))+"px")}function ee(){if(s.park!==null){if(tr(),s.parkStrategy==="behind"&&s.lastRect!==null){s.park.style.left=Math.round(s.lastRect.left)+"px",s.park.style.top=Math.round(s.lastRect.top)+"px",s.park.style.visibility="visible",s.park.style.zIndex="0";return}s.park.style.left=er+"px",s.park.style.top="0px",s.park.style.visibility="hidden",s.park.style.zIndex="0"}}function we(){s.frame!==null&&(s.frame.setAttribute("inert",""),s.frame.setAttribute("aria-hidden","true"))}function ar(){s.frame!==null&&(s.frame.removeAttribute("inert"),s.frame.removeAttribute("aria-hidden"))}function sr(){var e=document.createElement("div");e.className="dshcs-park",e.setAttribute("data-dshcs-park",""),e.setAttribute("aria-hidden","true");var r=document.createElement("iframe");return r.className="dshcs-frame",r.setAttribute("title","code-server"),r.setAttribute("allow","clipboard-read; clipboard-write"),r.setAttribute("data-dshcs-resident",""),r.src="about:blank",e.appendChild(r),document.body.appendChild(e),s.park=e,s.frame=r,s.currentSrc="about:blank",s.owner=null,ee(),we(),r}function ir(e){var r=s.frame;if(r!==null){var n=s.sameOrigin!==e;!n&&r.hasAttribute("data-dshcs-attrs")||(e===!0?r.removeAttribute("sandbox"):e===!1&&r.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms allow-modals allow-popups allow-pointer-lock allow-clipboard-read allow-clipboard-write"),r.setAttribute("data-dshcs-attrs",e===!0?"same-origin":"cross-origin"),s.sameOrigin=e)}}function re(e){var r=e||{};return s.frame===null&&sr(),typeof r.sameOrigin=="boolean"&&ir(r.sameOrigin),typeof r.src=="string"&&r.src!==""&&r.src!==s.currentSrc&&lr(r.src),s.frame}function lr(e){s.frame===null||typeof e!="string"||e===""||e===s.currentSrc||(s.currentSrc=e,s.frame.src=e,R())}function ke(){var e=s.frame;if(s.nudgeEnabled!==!0||e===null||e.isConnected!==!0)return!1;var r=e.style.display;return e.style.display="none",e.offsetHeight,e.style.display=r,s.nudgeCount+=1,s.lastNudgeAt=Date.now(),!0}function or(e){return s.nudgeEnabled=e!==!1,s.nudgeEnabled}function Ee(e){if(s.frame!==null){if(M)try{e.moveBefore(s.frame,null);return}catch(r){s.degraded=!0,s.lastMoveError=(r&&r.name?r.name+": ":"")+(r&&r.message?r.message:String(r))}else s.degraded=!0;e.appendChild(s.frame)}}function ne(e,r){if(!(s.frame===null||e==null)){var n=s.owner===null,t=e.getBoundingClientRect();t.width>=1&&t.height>=1&&(s.lastRect={left:t.left,top:t.top,width:t.width,height:t.height}),s.owner=r===void 0?null:r,ar(),s.park.setAttribute("aria-hidden","true"),Ee(e),n&&ke(),R()}}function j(e){s.frame!==null&&(e!==void 0&&s.owner!==e||(s.owner=null,ee(),we(),s.park.setAttribute("aria-hidden","true"),Ee(s.park),R()))}function te(e){var r=e||{};return re(r),s.owner===null&&(typeof r.src=="string"&&r.src!==""&&(s.preloaded=!0),j()),s.frame}function cr(){s.park!==null&&s.park.parentNode!==null&&s.park.parentNode.removeChild(s.park),s.park=null,s.frame=null,s.currentSrc=null,s.sameOrigin=null,s.owner=null,s.lastRect=null,s.degraded=!1,s.preloaded=!1,s.nudgeCount=0,s.lastNudgeAt=0,R()}typeof window!="undefined"&&(window.__dshcsSurface={snapshot:$,setParkStrategy:rr,getParkStrategy:nr,preload:te,dock:ne,park:j,nudge:ke,setNudgeEnabled:or,destroy:cr});var i=require("react"),ie=new Set,D={status:null,busy:!1,sidebarUi:"unknown",sidebarRegisterFailed:!1};function L(e){D=Object.assign({},D,e),ie.forEach(function(r){r()})}function dr(e){return ie.add(e),function(){ie.delete(e)}}function ur(){return D}function oe(){return i.useSyncExternalStore(dr,ur)}var fr="/api",pr="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMTQ3IDE0NyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8c3R5bGU+QG1lZGlhIChwcmVmZXJzLWNvbG9yLXNjaGVtZTogZGFyaykgeyogeyBmaWxsOiB3aGl0ZTsgfX08L3N0eWxlPgogIDxwYXRoIGQ9Im00Mi40MjE0LDM5LjY1NWMtMjQuNDA1NywwIC00Mi4xNTU0LDEzLjE3MjEgLTQyLjE1NTQsMzMuODQ1YzAsMjAuNTgxNCAxOC40ODkyLDMzLjg0NSA0Mi4xNTU0LDMzLjg0NWMyMy42NjYyLDAgMzguMTgwMywtMTEuNjE3MSAzOC43MzQ5LC0yOC43MjI1bC0yMS4wNzc3LC0wLjQ1NzRjLTAuOTI0NCw5LjMzMDMgLTkuMTA1OSwxNS4xODQ1IC0xNy42NTcyLDE1LjE4NDVjLTExLjc0MDYsMCAtMjAuNDMwNiwtNy41OTIyIC0yMC40MzA2LC0xOS44NDk2YzAsLTEyLjI1NzQgOC42OSwtMTkuOTg2OCAyMC40MzA2LC0yMC4yMTU1YzguNTUxMywtMC4xODMgMTYuOTE3Nyw1Ljk0NTcgMTcuNDcyMywxNS4yNzZsMjEuMDc3NywtMC42NDAzYy0wLjQ2MjIsLTE2LjgzMTEgLTE0LjE0NDIsLTI4LjI2NTIgLTM4LjU1LC0yOC4yNjUyem00OC44NDQ2LDJsNTUuNDY4LDBsMCw2NC4wMzExbC01NS40NjgsMGwwLC02NC4wMzExeiIgY2xpcC1ydWxlPSJldmVub2RkIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiLz4KPC9zdmc+Cg==";async function y(e,r){var n={method:r===void 0?"GET":"POST",headers:{}};r!==void 0&&(n.headers["content-type"]="application/json",n.body=JSON.stringify(r));var t=await fetch(fr+e,n),a=await t.text(),l=null;try{l=a===""?null:JSON.parse(a)}catch(o){l=null}return t.ok?l!==null?l:{ok:!1,error:"invalid JSON response"}:{ok:!1,error:"HTTP "+t.status+(l!==null&&l.error!==void 0?": "+l.error:"")}}function Se(){}function Me(e){var r=typeof e.useSessions=="function"?e.useSessions:Se,n=typeof e.useWorkspaces=="function"?e.useWorkspaces:Se;return{sessions:r(function(t){return t}),workspaces:n(function(t){return t})}}function Re(e,r){if(e==null||typeof e.url!="string"||e.url==="")return null;var n=e.pid!=null?String(e.pid):e.startedAt!=null?String(e.startedAt):"0",t=e.url+"?s="+encodeURIComponent(n),a=typeof r=="string"&&r!==""?r:e!=null&&e.cwd!=null?e.cwd:null;if(a==null||a==="")return t;var l=a.replace(/\\/g,"/"),o=l;return(/^[A-Za-z]:\//.test(l)||l.charCodeAt(0)!==47)&&(o="/"+l),t+"&folder="+encodeURIComponent(o)}function vr(e){var r=e.status,n=e.pageUrl,t=e.reloadTick,a=e.owner,l=i.useRef(null),o=r!=null&&r.ok===!0&&r.running===!0,c=r!=null&&r.status==="starting",p=r!=null&&r.ok===!1,f=r!=null&&r.serve==="dsh";if(i.useLayoutEffect(function(){if(!o||n===null){j(a);return}re({src:n,sameOrigin:f}),l.current!==null&&ne(l.current,a)},[o,n,f,t,a]),i.useLayoutEffect(function(){return function(){j(a)}},[a]),o&&n!==null)return i.createElement("div",{ref:l,className:"dshcs-slot","data-code-server-slot":a!=null?a:"code-server"});if(c)return i.createElement("div",{className:"dshcs-loading"},"\u6B63\u5728\u542F\u52A8 code-server\u2026");var x=p&&r!=null&&r.error?r.error:"code-server \u672A\u8FD0\u884C",v=f?"\u5F53\u524D\u4EE5 DSH \u540C\u6E90\u8DEF\u5F84 "+(r!=null&&r.url||"/code-server/")+" \u63D0\u4F9B(\u65E0\u72EC\u7ACB\u7AEF\u53E3)\u3002":"\u5F53\u524D\u4EE5\u72EC\u7ACB\u56DE\u73AF\u7AEF\u53E3\u63D0\u4F9B(\u7AEF\u53E3 "+(r!=null&&r.port!=null?r.port:"\u968F\u673A")+" + \u8DEF\u5F84\u4EE4\u724C;\u8981\u5728\u65B0\u6807\u7B7E\u9875\u6253\u5F00,\u590D\u5236\u8BBE\u7F6E\u5361\u91CC\u7684\u5B8C\u6574\u5730\u5740 \u2014\u2014 \u7F3A\u4E86\u4EE4\u724C\u90A3\u6BB5\u4F1A 404)\u3002",w=M?"\u5E38\u9A7B\u9762:\u53EF\u7528(\u5207\u6807\u7B7E/\u6536\u8D77\u4FA7\u680F\u4E0D\u91CD\u8F7D)\u3002":"\u5E38\u9A7B\u9762:\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 Element.moveBefore \u2014\u2014 \u5207\u6807\u7B7E\u4F1A\u6574\u9875\u91CD\u8F7D(\u5347\u7EA7\u6D4F\u89C8\u5668\u540E\u81EA\u52A8\u53EF\u7528)\u3002";return i.createElement("div",{className:"dshcs-empty"},i.createElement("div",{className:"dshcs-emptybox"},i.createElement("div",null,p?"code-server \u542F\u52A8\u5931\u8D25":"code-server \u672A\u8FD0\u884C"),i.createElement("pre",{className:"dshcs-error"},x),i.createElement("p",{className:"dshcs-hint"},"VS Code \u6811\u968F\u63D2\u4EF6\u5305\u5185\u7F6E\u3001\u5C31\u5730\u8FD0\u884C(\u65E0\u9700\u5168\u5C40\u5B89\u88C5\u3001\u65E0\u9700\u8054\u7F51\u5B89\u88C5\u3001\u65E0\u300C\u5B89\u88C5\u73AF\u5883\u300D\u6B65\u9AA4);\u5185\u90E8\u4F9D\u8D56\u4E0E\u9884\u7F16\u8BD1\u539F\u751F\u6A21\u5757\u7531\u5305\u7BA1\u7406\u5668\u5728\u5B89\u88C5\u63D2\u4EF6\u65F6\u4E00\u5E76\u88C5\u597D(\u65E0\u9700 C++ \u5DE5\u5177\u94FE)\u3002\u82E5\u6B64\u5904\u957F\u671F\u672A\u8FD0\u884C,\u8BF7\u67E5\u770B DSH host \u65E5\u5FD7\u91CC\u7684 [code-server] \u8F93\u51FA(\u6216\u5728\u8BBE\u7F6E\u5361\u7247\u91CC\u5207\u6362\u300C\u540E\u53F0\u5E38\u9A7B\u300D\u89E6\u53D1\u4E00\u6B21\u542F\u52A8)\u3002"+v+w)))}function mr(e){var r=oe(),n=r.status,t=n!=null&&n.ok===!0&&n.running===!0,a=n!=null&&n.keepResident===!0,l=Me(e!=null?e:{}),o=q({sessions:l.sessions,workspaces:l.workspaces}),c=t?Re(n,o):null;return i.useEffect(function(){!a||!t||c===null||te({src:c,sameOrigin:n!=null&&n.serve==="dsh"})},[a,t,c,n!=null?n.serve:null]),null}var hr=".dshcs-frame{display:block;position:absolute;inset:0;z-index:1;width:100%;height:100%;border:0;background:var(--dsw-alias-bg-base,#fff)}.dshcs-tabroot{position:relative;display:flex;flex-direction:column;width:100%;height:100%;min-width:0;min-height:0;background:var(--dsw-alias-bg-base,#fff)}.dshcs-slot{position:relative;display:block;width:100%;height:100%;min-width:0;min-height:0;overflow:hidden;background:var(--dsw-alias-bg-base,#fff)}.dshcs-park{position:fixed;left:-20000px;top:0;width:320px;height:200px;overflow:hidden;pointer-events:none;z-index:0;visibility:hidden;contain:strict}.dshcs-loading{position:absolute;inset:0;z-index:2;display:grid;place-items:center;background:var(--dsw-alias-bg-base,#fff);color:var(--dsw-alias-label-tertiary,#7d8798);font-size:13px}.dshcs-empty{position:relative;z-index:2;flex:1;display:flex;align-items:center;justify-content:center;padding:44px 24px 24px}.dshcs-emptybox{max-width:560px;text-align:left;background:var(--dsw-alias-bg-layer-2,#f7f8fb);border:1px solid var(--dsw-alias-border-l2,#dfe3eb);border-radius:12px;padding:16px 18px}.dshcs-error{color:var(--dsw-alias-label-error,#d92d20);white-space:pre-wrap;word-break:break-all;font-family:ui-monospace,Consolas,monospace;font-size:12px;margin:8px 0 0}.dshcs-hint{color:var(--dsw-alias-label-tertiary,#7d8798);font-size:12px;margin:6px 0 0}.dshcs-legacy{color:var(--dsw-alias-label-warning,#b54708);font-size:12px;font-weight:600;margin:0 0 6px}",Ce="dsh-code-server/styles";typeof document!="undefined"&&document.querySelector("style[data-dshcs="+JSON.stringify(Ce)+"]")===null&&(W=document.createElement("style"),W.setAttribute("data-dshcs",Ce),W.textContent=hr,document.head.appendChild(W));var W,Ne="code-server",Oe="dsh-code-server-app",gr="dsh-code-server-app",br="\u5728\u53F3\u4FA7\u680F\u6807\u7B7E\u91CC\u8FD0\u884C VS Code \u7F51\u9875\u7248,\u8DDF\u968F\u5F53\u524D\u4F1A\u8BDD\u5DE5\u4F5C\u533A;\u8BA4\u9886\u7C7B\u578B\u3001\u6253\u5F00\u5373\u5168\u5C4F\u3001\u540E\u53F0\u5E38\u9A7B\u90FD\u5728\u8FD9\u91CC\u8BBE\u3002",yr=2500,xr=1e4,wr=1500;function kr(e){var r=e!=null&&typeof e.size=="number"?e.size:16;return i.createElement("img",{src:pr,alt:"","aria-hidden":!0,draggable:!1,className:e!=null?e.className:void 0,style:{width:r,height:r,display:"block",objectFit:"contain",WebkitUserDrag:"none",userSelect:"none"}})}var Er=B("");function Sr(){var e=D.status;return e==null||typeof e.claimExtensions!="string"?Er:B(e.claimExtensions)}function Cr(){for(var e=["*"],r=[V,H,F],n=0;n<r.length;n+=1){for(var t=[],a=0;a<r[n].length;a+=1)t.push("!"+r[n][a]);e.push(t.join(";"))}return e.join(`
3
+ `)}function Nr(e){var r=e.useTabInfo(),n=r.tab,t=oe(),a=t.status,l=n.navigation,o=l!=null&&typeof l.revision=="number"?l.revision:0,c=l!=null&&typeof l.address=="string"?l.address:"",p=J(c)?null:U(c),f=Me(e),x=p!=null&&typeof p.sessionId=="string"?p.sessionId:void 0,v=q({sessions:f.sessions,workspaces:f.workspaces,sessionId:x!==void 0?x:e.sessionId}),w=i.useRef(!1),d=pe(p,v),m=l!=null&&l.params!=null&&typeof l.params.line=="number"?l.params.line:null,h=i.useRef(void 0),[E,X]=i.useState(0),z=i.useRef(null),C=i.useRef(!1),P=r.tab!=null&&r.tab.visible===!0,_=r.sidebar!=null&&r.sidebar.fullscreen===!0,I=a!=null&&a.fullscreenOnOpen!==!1;return i.useLayoutEffect(function(){if(!P){C.current=!1;return}if(!(!I||_||C.current)){C.current=!0;var b=ge(z.current);b!=="clicked"&&console.warn("[code-server] \u672A\u80FD\u81EA\u52A8\u5207\u5230\u5168\u5C4F\u53F3\u4FA7\u680F("+b+");\u672C\u6B21\u6253\u5F00\u4FDD\u6301\u539F\u6A21\u5F0F")}},[P,_,I]),i.useEffect(function(){if(!(typeof v!="string"||v==="")&&h.current!==v){var b=h.current!==void 0;h.current=v;var S=!1;return y("/code-server/start",{cwd:v}).then(function(N){S||(L({status:N}),b&&N!=null&&N.ok===!0&&N.running===!0&&X(function(g){return g+1}))}).catch(function(){}),function(){S=!0}}},[v]),i.useEffect(function(){typeof v=="string"&&v!==""||w.current||(w.current=!0,console.warn("[code-server] \u672A\u80FD\u89E3\u6790\u5F53\u524D\u5DE5\u4F5C\u533A\u76EE\u5F55(\u4F1A\u8BDD\u65E0 cwd / \u6807\u51C6 prop \u65E0 sessionId / \u5DE5\u4F5C\u533A\u8868\u4E5F\u6CA1\u5339\u914D\u4E0A):\u672C\u6B21\u4E0D\u5411\u5BBF\u4E3B\u53D1\u9001 cwd,IDE \u4F1A\u4EE5\u7A7A\u5DE5\u4F5C\u533A\u6253\u5F00"))},[v]),i.useEffect(function(){y("/code-server/status").then(function(S){S!=null&&L({status:S})}).catch(function(){});var b=window.setInterval(function(){y("/code-server/status").then(function(S){L({status:S})}).catch(function(){})},3e3);return function(){window.clearInterval(b)}},[]),i.useEffect(function(){d!==null&&y("/code-server/open-file",m===null?{file:d}:{file:d,line:m}).catch(function(){})},[o,d,m]),i.createElement("div",{className:"dshcs-tabroot","data-code-server-tab":"body",ref:z},i.createElement(vr,{status:a,pageUrl:Re(a,v),reloadTick:E,owner:"tab:"+n.id}))}function ae(e,r){if(e==null)return null;var n=e[r];if(n!=null)return n;if(typeof e.get=="function"){var t=e.get(r);if(t!=null)return t}return null}function Or(e){var r=ae(e,"sidebarRightTabs"),n=ae(e,"sidebarRight");if(r==null||n==null)return console.error("[code-server] \u53F3\u4FA7\u680F\u670D\u52A1\u4E0A\u4E0B\u6587\u4E0D\u53EF\u89C1(sidebarRightTabs="+(r!=null)+", sidebarRight="+(n!=null)+"):\u8DF3\u8FC7\u4FA7\u680F\u6CE8\u518C"),!1;var t=ae(e,"slots");if(e.effect(function(){return r.register({id:Oe,kind:Ne,priority:"extension",patterns:["dsh-resource://file/**"],canOpen:function(a){return me(U(a),Sr())},title:function(a){if(J(a)||a===void 0||a===null||a==="")return"Code Server";var l=fe(a);return l===""?"Code Server":l},guide:[{order:20,title:function(){return"Code Server"},description:function(){return"\u5728\u53F3\u4FA7\u680F\u6807\u7B7E\u91CC\u8FD0\u884C VS Code \u7F51\u9875\u7248,\u8DDF\u968F\u5F53\u524D\u4F1A\u8BDD\u5DE5\u4F5C\u533A;\u4EA7\u7269/\u4EA4\u4ED8\u6587\u4EF6\u70B9\u51FB\u540E\u5728\u6B64\u6253\u5F00\u3002"},icon:kr}]})},"code-server: sidebar tab type"),t!=null)e.effect(function(){return t.inject("sidebar.right.pane.tab",function(){return t.register({name:"sidebar.right.pane.tab",key:Oe},Nr)})},"code-server: sidebar tab body");else return console.error("[code-server] slots \u670D\u52A1\u4E0D\u53EF\u89C1:\u4FA7\u680F\u6807\u7B7E body \u672A\u6CE8\u518C"),!1;return e.effect(function(){return function(){L({sidebarUi:"unknown"})}},"code-server: sidebar mode reset"),console.log("[code-server] right-sidebar tab registered (kind="+Ne+")"),!0}var Lr=".dshcs-card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:12px;list-style:none;transition:border-color .16s,background .16s}.dshcs-card:hover{border-color:var(--dsw-alias-label-dimmed,var(--dsw-alias-border-l2))}.dshcs-cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed,var(--dsw-alias-border-l2))}.dshcs-cardHeader{appearance:none;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:12px;align-items:center;gap:12px;padding:14px 16px;display:flex}.dshcs-cardHeader:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}.dshcs-cardHeadText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}.dshcs-cardName{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}.dshcs-cardDescription{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));font-size:13px;line-height:1.5}.dshcs-cardChevron{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));flex:none;transition:transform .16s;display:inline-flex}.dshcs-cardChevronOpen{transform:rotate(180deg)}.dshcs-cardBody{border-top:1px solid var(--dsw-alias-border-l2);margin:0 16px;padding-bottom:8px}.dshcs-cardReadOnly{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));margin:12px 0 0;font-size:12px;line-height:1.5}.dshcs-pending{white-space:nowrap;background:var(--dsw-alias-bg-module-platform,var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-label-secondary);border-radius:999px;flex:none;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.dshcs-cardFooter{border-top:1px solid var(--dsw-alias-border-l2);justify-content:flex-end;align-items:center;gap:8px;padding:12px 0 4px;display:flex}.dshcs-cardFailed{min-width:0;color:var(--dsw-alias-label-error,var(--dsw-alias-state-error-primary));flex:1;margin:0;font-size:12px;line-height:1.5}.dshcs-cbtn{appearance:none;font:inherit;cursor:pointer;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5;border:1px solid transparent;transition:color .12s ease,background .12s ease}.dshcs-cbtn:disabled{opacity:.4;cursor:default}.dshcs-cbtn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}.dshcs-cbtnOutline{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);background:0 0}.dshcs-cbtnOutline:hover:not(:disabled){color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover,transparent)}.dshcs-cbtnPrimary{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3);border-color:var(--dsw-alias-label-primary);font-weight:600}.dshcs-cbtnPrimary:hover:not(:disabled){filter:brightness(.95)}.dshcs-cbtnPrimary:active:not(:disabled){filter:brightness(.9)}.dshcs-field{flex-direction:column;gap:6px;padding:12px 0;display:flex}.dshcs-field+.dshcs-field{border-top:1px solid var(--dsw-alias-border-l2)}.dshcs-fieldHead{align-items:center;gap:8px;display:flex}.dshcs-fieldLabel{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13px;font-weight:500;line-height:1.5}.dshcs-card .dshcs-hint{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));margin:0;font-size:12px;line-height:1.5}.dshcs-check{display:flex;align-items:center;gap:8px;cursor:pointer}.dshcs-check input{accent-color:var(--dsw-alias-brand-primary);width:15px;height:15px;margin:0;flex:none}.dshcs-check input:disabled{cursor:default}.dshcs-text{display:flex}.dshcs-text input,.dshcs-text textarea{font:12px/1.5 ui-monospace,Consolas,monospace;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-3,transparent);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;padding:5px 8px;width:100%;min-width:0}.dshcs-text textarea{display:block;box-sizing:border-box;resize:vertical;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word}.dshcs-text input:disabled,.dshcs-text textarea:disabled{opacity:.5;cursor:default}.dshcs-text input:focus-visible,.dshcs-text textarea:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-1px}.dshcs-code{display:block;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;font:11.5px/1.55 ui-monospace,Consolas,monospace;color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-layer-2,transparent);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;padding:6px 8px;margin:4px 0 0;max-width:100%}.dshcs-badges{align-items:center;gap:8px;display:inline-flex}.dshcs-badge{white-space:nowrap;background:var(--dsw-alias-bg-module-platform,var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-label-secondary);border-radius:999px;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.dshcs-reset{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;padding:0;font-size:12px;line-height:1.5}.dshcs-reset:hover:not(:disabled){color:var(--dsw-alias-label-primary)}.dshcs-reset:disabled{cursor:default}.dshcs-cfgpage{display:flex;flex-direction:column;gap:0}.dshcs-cfgfoot{justify-content:flex-end;align-items:center;gap:8px;padding:12px 0 4px;display:flex}",Tr="dsh-code-server/Card.module.css";function Ar(e,r){if(typeof document!="undefined"&&document.querySelector("style[data-plugin-css="+JSON.stringify(e)+"]")===null){var n=document.createElement("style");n.dataset.plugin="dsh-code-server",n.dataset.pluginCss=e,n.textContent=r,document.head.appendChild(n)}}Ar(Tr,Lr);function Ir(e){return i.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none","aria-hidden":!0,className:e.className},i.createElement("path",{d:"M3.5 5.25L7 8.75L10.5 5.25",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))}function Y(e){return i.createElement("button",{type:"button",className:"dshcs-cbtn "+(e.variant==="primary"?"dshcs-cbtnPrimary":"dshcs-cbtnOutline"),disabled:e.disabled===!0,onClick:e.onClick},e.children)}function Le(e){return i.createElement("label",{className:"dshcs-check"},i.createElement("input",{type:"checkbox",checked:e.checked===!0,disabled:e.disabled===!0,onChange:function(r){e.onChange(r.target.checked)}}),i.createElement("span",{className:"dshcs-hint"},e.children))}function Mr(e){var r=typeof e.value=="string"?e.value:"",n=Math.min(12,Math.max(3,Math.ceil(r.length/64)));return i.createElement("label",{className:"dshcs-text"},i.createElement("textarea",{value:e.value,disabled:e.disabled===!0,rows:n,spellCheck:!1,autoComplete:"off",wrap:"soft",placeholder:e.placeholder,onChange:function(t){e.onChange(t.target.value)}}))}function se(e){var r=[];return e.overridden===!0&&(r.push(i.createElement("span",{className:"dshcs-badge"},e.overriddenLabel)),r.push(i.createElement("button",{type:"button",className:"dshcs-reset",disabled:e.disabled===!0,onClick:e.onReset},e.resetLabel))),r.length===0?null:i.createElement("span",{className:"dshcs-badges"},...r)}function Te(e){var[r,n]=i.useState(e.defaultOpen===!0),t=e.state;if(t==null||t.available!==!0)return null;var a=e.title,l=e.noticeOnly===!0,o=t.dirty!==!0||t.invalid===!0||t.saving===!0;return i.createElement("li",{className:"dshcs-card"+(r?" dshcs-cardOpen":"")},i.createElement("button",{type:"button",className:"dshcs-cardHeader","aria-expanded":r,onClick:function(){n(!r)}},i.createElement("span",{className:"dshcs-cardHeadText"},i.createElement("span",{className:"dshcs-cardName"},a),i.createElement("span",{className:"dshcs-cardDescription"},e.description)),t.dirty===!0?i.createElement("span",{className:"dshcs-pending"},e.unsavedLabel):null,i.createElement(Ir,{className:"dshcs-cardChevron"+(r?" dshcs-cardChevronOpen":"")})),r===!0?i.createElement("div",{className:"dshcs-cardBody"},l===!0?null:t.writable!==!0?i.createElement("p",{className:"dshcs-cardReadOnly",role:"status"},e.readOnlyLabel):null,e.children,l===!0?null:i.createElement("div",{className:"dshcs-cardFooter"},t.failed===!0?i.createElement("p",{className:"dshcs-cardFailed",role:"status"},e.saveFailedLabel):null,i.createElement(Y,{disabled:t.dirty!==!0||t.saving===!0,onClick:e.onDiscard},e.discardLabel),i.createElement(Y,{variant:"primary",disabled:o,onClick:e.onSave},t.saving===!0?e.savingLabel:e.saveLabel))):null)}function je(e){try{let b=function(){y("/code-server/status").then(function(g){g!=null&&typeof g=="object"&&L({status:g})}).catch(function(){})};var r=e.scope,[n,t]=i.useState(function(){return r!==void 0?r.getSnapshot():null}),[a,l]=i.useState(null),[o,c]=i.useState(!1),[p,f]=i.useState(!1),x=oe(),[v,w]=i.useState(xe());if(i.useEffect(function(){return ye(function(g){w(g)})},[]),i.useEffect(function(){if(r===void 0||typeof r.subscribe!="function")return;function g(){try{t(r.getSnapshot())}catch(Yr){}}var k=r.subscribe(g);return function(){typeof k=="function"&&k()}},[r]),r===void 0)return console.error("[code-server] card scope missing"),null;if(n==null||n.status!=="ready")return n!=null&&n.status==="unavailable"&&console.warn("[code-server] settings scope unavailable:",n.status),null;var d=n.value!==void 0&&n.value!==null?n.value:{},m=n.user,h={keepResident:d.keepResident!==!1,claimExtensions:typeof d.claimExtensions=="string"?d.claimExtensions:Z,fullscreenOnOpen:d.fullscreenOnOpen!==!1};if(x!=null&&x.sidebarUi==="legacy")return i.createElement(Te,{title:"Code Server",description:"\u5F53\u524D DSH \u7248\u672C\u4E0D\u53D7\u652F\u6301(\u7F3A\u5C11\u53F3\u4FA7\u680F\u670D\u52A1)",defaultOpen:!0,noticeOnly:!0,state:{available:!0,writable:!1,dirty:!1,invalid:!1,saving:!1,failed:!1}},i.createElement("div",{className:"dshcs-field"},i.createElement("div",{className:"dshcs-legacy"},"\u672C\u63D2\u4EF6\u81EA 0.2.3 \u8D77\u4E0D\u518D\u517C\u5BB9\u65E7\u7248 DSH\u3002"),i.createElement("div",{className:"dshcs-hint",style:{marginTop:0}},`\u672A\u68C0\u6D4B\u5230\u53F3\u4FA7\u680F\u63D2\u4EF6\u670D\u52A1 sidebarRightTabs / sidebarRight,\u56E0\u6B64\u63D2\u4EF6\u4E0D\u63D0\u4F9B\u4EFB\u4F55\u5165\u53E3(\u65E7\u7248\u7684\u60AC\u6D6E\u7403\u4E0E\u6D6E\u52A8\u7A97\u53E3\u5DF2\u79FB\u9664),\u4E5F\u4E0D\u4F1A\u540E\u53F0\u542F\u52A8 IDE\u3002
4
+ \u5347\u7EA7 DSH \u5230\u5E26\u53F3\u4FA7\u680F\u7684\u7248\u672C(\u2265 0.1.5-alpha.1)\u540E,Code Server \u4F1A\u51FA\u73B0\u5728\u53F3\u4FA7\u680F\u6807\u7B7E\u91CC,\u672C\u9875\u540C\u65F6\u663E\u793A\u5B8C\u6574\u8BBE\u7F6E\u9879;\u5347\u7EA7\u540E\u65E0\u9700\u91CD\u88C5\u672C\u63D2\u4EF6,\u5237\u65B0\u9875\u9762\u5373\u53EF\u3002`)));var E=m!=null&&Object.prototype.hasOwnProperty.call(m,"keepResident"),X=m!=null&&Object.prototype.hasOwnProperty.call(m,"claimExtensions"),z=m!=null&&Object.prototype.hasOwnProperty.call(m,"fullscreenOnOpen"),C=a!==null&&(a.keepResident!==h.keepResident||T(a.claimExtensions)!==T(h.claimExtensions)||a.fullscreenOnOpen!==h.fullscreenOnOpen),P=!C||o,_={available:!0,writable:n.writable,dirty:C,invalid:!1,saving:o,failed:p};async function S(){if(C&&!o){c(!0),f(!1);try{var g=a!==null?a:h;await e.scope.set("keepResident",g.keepResident===!0),await e.scope.set("claimExtensions",T(g.claimExtensions)),await e.scope.set("fullscreenOnOpen",g.fullscreenOnOpen===!0),l(null),b()}catch(k){f(!0)}c(!1)}}async function N(){if(!(o||n.writable!==!0)){c(!0),f(!1);try{typeof e.scope.unset=="function"?(await e.scope.unset("keepResident"),await e.scope.unset("claimExtensions"),await e.scope.unset("fullscreenOnOpen")):(await e.scope.set("keepResident",d.keepResident===void 0||d.keepResident===null?!0:d.keepResident),await e.scope.set("claimExtensions",typeof d.claimExtensions=="string"?T(d.claimExtensions):Z),await e.scope.set("fullscreenOnOpen",d.fullscreenOnOpen===void 0||d.fullscreenOnOpen===null?!0:d.fullscreenOnOpen)),l(null),b()}catch(g){f(!0)}c(!1)}}var I=[i.createElement("div",{className:"dshcs-field"},i.createElement("div",{className:"dshcs-fieldHead"},i.createElement("span",{className:"dshcs-fieldLabel"},"\u8BA4\u9886\u7C7B\u578B(\u6309\u6269\u5C55\u540D,\u5206\u53F7\u5206\u9694)"),X===!0?i.createElement(se,{overridden:!0,disabled:n.writable!==!0,overriddenLabel:"\u5DF2\u8986\u76D6",resetLabel:"\u6062\u590D\u9ED8\u8BA4",onReset:function(){N()}}):null),i.createElement(Mr,{value:a!==null?a.claimExtensions:h.claimExtensions,disabled:n.writable!==!0,placeholder:"\u4F8B\u5982 py;ts;!md(\u7559\u7A7A = \u4E0D\u8BA4\u9886\u4EFB\u4F55\u6587\u4EF6)",onChange:function(g){l(function(k){return Object.assign({},k!==null?k:h,{claimExtensions:g})}),f(!1)}}),i.createElement("div",{className:"dshcs-hint",style:{marginTop:4}},"\u5199\u6269\u5C55\u540D(\u4E0D\u5E26\u70B9,\u5927\u5C0F\u5199\u968F\u610F);`*` = \u5176\u4F59\u7C7B\u578B\u4E5F\u8BA4\u9886;`!ext` = \u4E0D\u8BA4\u9886(\u6392\u9664\u4F18\u5148)\u3002\u4E0D\u518D\u533A\u5206\u4F1A\u8BDD\u5185/\u7EDD\u5BF9\u8DEF\u5F84 \u2014\u2014 \u6240\u6709 `dsh-resource://file/**` \u4E00\u89C6\u540C\u4EC1,\u672A\u8BA4\u9886\u7684\u843D\u56DE DSH \u81EA\u5E26\u9884\u89C8\u3002"),i.createElement("div",{className:"dshcs-hint",style:{marginTop:4}},"\u5B9E\u9645\u89C4\u5219:"+he(a!==null?a.claimExtensions:h.claimExtensions)+(T(a!==null?a.claimExtensions:h.claimExtensions)!==(a!==null?a.claimExtensions:h.claimExtensions)?"(\u4FDD\u5B58\u540E\u5F52\u4E00\u5316)":"")),i.createElement("div",{className:"dshcs-hint",style:{marginTop:6}},"\u9ED8\u8BA4\u6392\u9664\u4E09\u7C7B:\u2460 DSH \u9884\u89C8\u6E32\u67D3\u5F97\u597D\u7684 markdown/html/\u56FE\u7247/PDF;\u2461 \u53EF\u6267\u884C\u6587\u4EF6\u4E0E\u4E8C\u8FDB\u5236\u4EA7\u7269(exe/dll/msi/jar/so\u2026);\u2462 Office \u4E0E\u7248\u5F0F\u6587\u6863(docx/xlsx/pptx/vsdx\u2026)\u3002\u6587\u672C\u811A\u672C(bat/cmd/ps1/sh/py)\u4E0E csv/tsv \u4ECD\u8FDB IDE\u3002\u60F3\u6574\u7EC4\u653E\u5F00,\u628A\u4E0B\u9762\u8FD9\u6BB5\u6362\u6210 `*;!md;!html;!png;!jpg;!pdf` \u4E4B\u7C7B\u7684\u77ED\u6E05\u5355\u5373\u53EF\u3002"),i.createElement("div",{className:"dshcs-hint",style:{marginTop:4}},"\u9ED8\u8BA4\u503C(\u53EF\u6574\u6BB5\u590D\u5236;\u6362\u884C\u4E0E\u5206\u53F7\u7B49\u4EF7):",i.createElement("code",{className:"dshcs-code","data-claim-default":"lines"},Cr()))),i.createElement("div",{className:"dshcs-field"},i.createElement("div",{className:"dshcs-fieldHead"},i.createElement("span",{className:"dshcs-fieldLabel"},"\u6253\u5F00\u5373\u5168\u5C4F(\u53F3\u4FA7\u680F\u94FA\u6EE1\u7A97\u53E3)"),z===!0?i.createElement(se,{overridden:!0,disabled:n.writable!==!0,overriddenLabel:"\u5DF2\u8986\u76D6",resetLabel:"\u6062\u590D\u9ED8\u8BA4",onReset:function(){N()}}):null),i.createElement(Le,{checked:a!==null?a.fullscreenOnOpen:h.fullscreenOnOpen,disabled:n.writable!==!0,onChange:function(g){l(function(k){return Object.assign({},k!==null?k:h,{fullscreenOnOpen:g===!0})}),f(!1)}},'\u6253\u5F00 Code Server \u6807\u7B7E(\u542B\u70B9\u5F00\u4EA7\u7269/\u4EA4\u4ED8\u6587\u4EF6)\u65F6,\u81EA\u52A8\u628A\u53F3\u4FA7\u680F\u4ECE"\u4E0E\u5BF9\u8BDD\u5E76\u6392"\u5207\u5230\u5168\u5C4F;\u60F3\u540C\u65F6\u770B\u5BF9\u8BDD\u5C31\u5173\u6389\u5B83,\u6216\u968F\u65F6\u70B9\u53F3\u4FA7\u680F\u7684\u300C\u9000\u51FA\u5168\u5C4F\u300D\u2014\u2014 \u672C\u6B21\u6253\u5F00\u4E0D\u4F1A\u88AB\u62A2\u56DE\u53BB'),i.createElement("div",{className:"dshcs-hint",style:{marginTop:4}},'\u53EA\u5F71\u54CD"\u6253\u5F00\u90A3\u4E00\u523B":\u5207\u8D70\u518D\u5207\u56DE\u3001\u518D\u6B21\u6253\u5F00\u6587\u4EF6 tab \u4F1A\u91CD\u65B0\u5207\u5168\u5C4F;DSH \u672A\u5411\u63D2\u4EF6\u5F00\u653E\u6A21\u5F0F\u63A5\u53E3,\u672C\u9879\u7531\u70B9\u51FB\u53F3\u4FA7\u680F\u81EA\u8EAB\u7684\u300C\u5168\u5C4F\u300D\u6309\u94AE\u5B9E\u73B0\u3002')),i.createElement("div",{className:"dshcs-field"},i.createElement("div",{className:"dshcs-fieldHead"},i.createElement("span",{className:"dshcs-fieldLabel"},"\u540E\u53F0\u5E38\u9A7B(\u5207\u6807\u7B7E\u4E0D\u91CD\u8F7D)"),E===!0?i.createElement(se,{overridden:!0,disabled:n.writable!==!0,overriddenLabel:"\u5DF2\u8986\u76D6",resetLabel:"\u6062\u590D\u9ED8\u8BA4",onReset:function(){N()}}):null),i.createElement(Le,{checked:a!==null?a.keepResident:h.keepResident,disabled:n.writable!==!0,onChange:function(g){l(function(k){return Object.assign({},k!==null?k:h,{keepResident:g===!0})}),f(!1)}},'\u5F00\u542F\u540E\u5BBF\u4E3B\u542F\u52A8\u5373\u628A IDE \u52A0\u8F7D\u5230\u540E\u53F0"\u505C\u653E\u533A":\u5207\u6362\u53F3\u4FA7\u680F\u6807\u7B7E\u3001\u6536\u8D77/\u5C55\u5F00\u4FA7\u680F\u3001\u62D6\u6210\u6D6E\u52A8\u7A97\u53E3\u90FD\u4E0D\u518D\u91CD\u8F7D,\u9996\u6B21\u6253\u5F00\u514D\u7B49\u5F85;\u5173\u95ED\u5219\u53EA\u5728\u6253\u5F00\u9762\u677F\u65F6\u52A0\u8F7D(\u7701\u5185\u5B58)'),i.createElement("div",{className:"dshcs-hint",style:{marginTop:4}},M?"\u5E38\u9A7B\u9762:"+(v.docked?"\u5DF2\u505C\u9760":v.ready?"\u5DF2\u505C\u653E(\u540E\u53F0\u8FD0\u884C\u4E2D)":"\u672A\u542F\u52A8")+(v.degraded?" \xB7 \u672C\u6B21\u53D1\u751F\u8FC7\u964D\u7EA7\u91CD\u8F7D":""):"\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 Element.moveBefore(Chromium <133)\u2192 \u5E38\u9A7B\u4E0D\u53EF\u7528,\u5207\u6807\u7B7E\u4ECD\u4F1A\u6574\u9875\u91CD\u8F7D(\u5347\u7EA7\u6D4F\u89C8\u5668\u540E\u81EA\u52A8\u751F\u6548)"))];return e.seat==="bundle-config"?i.createElement("div",{className:"dshcs-cfgpage","data-code-server-config":"page"},n.writable!==!0?i.createElement("p",{className:"dshcs-cardReadOnly",role:"status"},"\u672C\u90E8\u7F72\u7684\u8BBE\u7F6E\u4E3A\u53EA\u8BFB\u3002"):null,...I,p===!0?i.createElement("p",{className:"dshcs-cardFailed",role:"status"},"\u672C\u90E8\u7F72\u6CA1\u6709\u63A5\u53D7\u8FD9\u4E9B\u503C\uFF0C\u5DF2\u4FDD\u7559\u4F9B\u4F60\u4FEE\u6539\u3002"):null,i.createElement("div",{className:"dshcs-cfgfoot"},i.createElement(Y,{disabled:!C||o,onClick:function(){l(null),f(!1)}},"\u653E\u5F03\u4FEE\u6539"),i.createElement(Y,{variant:"primary",disabled:P,onClick:function(){S()}},o===!0?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58"))):i.createElement(Te,{title:"Code Server",description:"\u5165\u53E3:\u53F3\u4FA7\u680F\u6807\u7B7E(DSH \u2265 0.1.5-alpha.1);\u8BA4\u9886\u7C7B\u578B\u51B3\u5B9A\u54EA\u4E9B\u6587\u4EF6\u4EA4\u7ED9 Code Server \u6253\u5F00",state:_,unsavedLabel:"\u672A\u4FDD\u5B58",readOnlyLabel:"\u672C\u90E8\u7F72\u7684\u8BBE\u7F6E\u4E3A\u53EA\u8BFB\u3002",saveFailedLabel:"\u672C\u90E8\u7F72\u6CA1\u6709\u63A5\u53D7\u8FD9\u4E9B\u503C\uFF0C\u5DF2\u4FDD\u7559\u4F9B\u4F60\u4FEE\u6539\u3002",discardLabel:"\u653E\u5F03\u4FEE\u6539",saveLabel:"\u4FDD\u5B58",savingLabel:"\u4FDD\u5B58\u4E2D\u2026",onSave:S,onDiscard:function(){l(null),f(!1)}},...I)}catch(b){return console.error("[code-server] card render error:",b!=null&&b.message!==void 0?b.message:String(b)),null}}function Rr(e){return e!=null&&e.view==="summary"?br:i.createElement(je,Object.assign({},e,{seat:"bundle-config"}))}var Ae=900,u={rev:-1,open:!1,mounted:!1,pending:null,el:null,body:null,title:null,timer:null,loading:!1};function jr(e){if(!(e===null||typeof e!="object")){if(e.type==="ready"){A(!0);return}if(e.type==="ask"&&typeof e.text=="string"){y("/code-server/ask/send",{text:e.text,mode:u.pending===null?void 0:u.pending.mode}).then(function(r){u.rev=-1,A(!0)}).catch(function(){});return}if(e.type==="approve"&&typeof e.id=="string"){y("/code-server/ask/approve",{id:e.id,outcome:e.outcome}).then(function(r){r!=null&&r.ok===!1&&G(r.error||"\u6388\u6743\u63D0\u4EA4\u5931\u8D25"),u.rev=-1,A(!0)}).catch(function(r){G("\u6388\u6743\u63D0\u4EA4\u5931\u8D25:"+String(r&&r.message?r.message:r))});return}e.type==="close"&&De()}}function A(e){if(u.el!==null){var r=window.__DSHCS_ASK_PUSH__;typeof r=="function"?r(u.pending):e===!0&&setTimeout(function(){A(!1)},120)}}function G(e){console.warn("[code-server] ask dialog:",e)}function De(){u.open=!1,u.el!==null&&(u.el.style.display="none"),y("/code-server/ask/close",{}).catch(function(){})}function ze(){if(u.el===null){var e=document.createElement("div");e.className="dshcs-dialog",e.setAttribute("data-dshcs-dialog","ask"),e.style.cssText=["position:fixed","right:24px","bottom:24px","width:460px","height:600px","min-width:320px","min-height:280px","max-width:96vw","max-height:92vh","resize:both","overflow:hidden","display:none","z-index:2147483000","border-radius:10px","box-shadow:0 18px 48px rgba(0,0,0,.45)","border:1px solid var(--dsw-alias-border-l2, rgba(128,128,128,.4))","background:var(--dsw-alias-bg-base, var(--vscode-editor-background, #1e1e1e))"].join(";");var r=document.createElement("div");r.style.cssText="display:flex;align-items:center;gap:8px;padding:6px 10px;cursor:move;border-bottom:1px solid var(--dsw-alias-border-l1, rgba(128,128,128,.3));font:var(--dsw-font-markdown-base, 13px/20px sans-serif)";var n=document.createElement("span");n.textContent="DSH \u5BF9\u8BDD",n.style.cssText="font-weight:600;flex:none";var t=document.createElement("span");t.style.cssText="flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary, rgba(128,128,128,.9));font-size:12px";var a=document.createElement("button");a.type="button",a.textContent="\u2715",a.title="\u5173\u95ED",a.setAttribute("aria-label","\u5173\u95ED"),a.style.cssText="flex:none;border:0;background:transparent;color:inherit;cursor:pointer;font-size:13px;line-height:1;padding:2px 6px;border-radius:4px",a.addEventListener("click",function(){De()}),r.appendChild(n),r.appendChild(t),r.appendChild(a);var l=document.createElement("div");l.className="dshcs-panel",l.setAttribute("data-dshcs-ask-root",""),l.style.cssText="height:calc(100% - 33px);overflow:hidden",e.appendChild(r),e.appendChild(l),document.body.appendChild(e),u.el=e,u.body=l,u.title=t;var o=null;r.addEventListener("pointerdown",function(c){if(c.target!==a){var p=e.getBoundingClientRect();o={x:c.clientX,y:c.clientY,left:p.left,top:p.top},e.style.right="auto",e.style.bottom="auto",e.style.left=p.left+"px",e.style.top=p.top+"px";try{r.setPointerCapture(c.pointerId)}catch(f){}}}),r.addEventListener("pointermove",function(c){o!==null&&(e.style.left=Math.max(0,Math.min(window.innerWidth-80,o.left+(c.clientX-o.x)))+"px",e.style.top=Math.max(0,Math.min(window.innerHeight-40,o.top+(c.clientY-o.y)))+"px")}),r.addEventListener("pointerup",function(){o=null})}}var Pe="dshcs.ask.bundle",Dr=900*1e3,O=null;function le(){try{var e=window.sessionStorage.getItem(Pe);if(e==null)return null;var r=JSON.parse(e);return r==null||typeof r.js!="string"||typeof r.css!="string"||Date.now()-Number(r.at||0)>Dr?null:{css:r.css,js:r.js}}catch(n){return null}}function _e(e){try{window.sessionStorage.setItem(Pe,JSON.stringify({at:Date.now(),css:e.css,js:e.js}))}catch(r){}}function zr(){if(!(O!==null||u.mounted)){var e=le();if(e!==null){O=e;return}y("/code-server/ask/bundle").then(function(r){r==null||r.ok!==!0||(O={css:r.css,js:r.js},_e(O),console.log("[code-server] ask bundle preloaded ("+Math.round((r.js.length+r.css.length)/1024)+"KB)"))}).catch(function(){})}}function Pr(){if(!(u.mounted||u.loading)){u.loading=!0;var e=O!==null?Promise.resolve(O):le()!==null?Promise.resolve(le()):y("/code-server/ask/bundle");e.then(function(r){u.loading=!1;var n=r;if(O===null&&r!=null&&r.ok===!0&&(n={css:r.css,js:r.js},O=n,_e(n)),n==null||typeof n.js!="string"){G(n!=null&&n.error?n.error:"\u9762\u677F\u4EA7\u7269\u4E0D\u53EF\u7528");return}if(ze(),document.getElementById("dshcs-ask-style")===null){var t=document.createElement("style");t.id="dshcs-ask-style",t.textContent=n.css,document.head.appendChild(t)}window.__DSHCS_HOST__="dsh",window.__DSHCS_MOUNT__=u.body,window.acquireVsCodeApi=function(){return{postMessage:jr}};var a=document.createElement("script");a.textContent=n.js,document.head.appendChild(a),u.mounted=!0,setTimeout(function(){A(!0)},60)}).catch(function(r){u.loading=!1,G("\u9762\u677F\u4EA7\u7269\u52A0\u8F7D\u5931\u8D25:"+String(r&&r.message?r.message:r))})}}function Ie(){y("/code-server/ask/state?rev="+u.rev).then(function(e){e==null||e.ok!==!0||e.changed===!0&&(u.rev=typeof e.rev=="number"?e.rev:-1,u.pending=e,e.open===!0?(ze(),u.el.style.display="block",u.title!==null&&(u.title.textContent=e.contextText||"\u6765\u81EA\u7F16\u8F91\u5668"),u.open=!0,Pr(),u.mounted&&A(!0)):u.el!==null&&(u.el.style.display="none",u.open=!1))}).catch(function(){})}function _r(){u.timer===null&&(u.timer=setInterval(Ie,Ae),setTimeout(Ie,800),setTimeout(zr,3e3),console.log("[code-server] ask dialog poller started (every "+Ae+"ms)"))}function Ur(e){try{Hr(e),_r()}catch(r){console.error("[code-server] apply failed:",r&&r.stack?r.stack:String(r));try{document.title="CS-ERR "+(r&&r.message||String(r))}catch(n){}}}function Hr(e){var r=e.get("slots");if(r===void 0){console.error("[code-server] slots service unavailable");return}var n=e.settingsScope,t=null;if(n!==void 0&&typeof n.bind=="function")t=n.bind({namespace:"code-server"});else{console.error("[code-server] settingsScope unavailable (inject missing?); settings card disabled");return}y("/code-server/status").then(function(d){L({status:d})}).catch(function(){}),r.inject("plugins.bundle.config",()=>r.register({name:"plugins.bundle.config",key:gr,inject:function(){return{scope:t}}},Rr)),r.inject("settings.plugin.item",()=>r.register({name:"settings.plugin.item",key:"code-server",label:"Code Server",inject:function(){return{scope:t}}},je));var a=!1;function l(d,m){if(!a){a=!0,x();var h=!1;try{h=Or(d)}catch(E){console.error("[code-server] sidebar tab registration failed:",E!=null&&E.message!=null?E.message:String(E))}D.sidebarUi==="legacy"&&(console.log("[code-server] \u53F3\u4FA7\u680F\u670D\u52A1\u665A\u5230(\u7ECF "+m+"):\u64A4\u9500\u65E7\u7248 DSH \u5224\u5B9A"),y("/code-server/ui-mode",{sidebar:!0}).catch(function(){})),L({sidebarUi:"modern",sidebarRegisterFailed:h!==!0}),r.inject("shell.overlay",()=>r.register({name:"shell.overlay",id:"code-server",order:70,label:"Code Server"},E=>i.createElement(mr,E))),console.log("[code-server] client registered via "+m+": sidebar tab="+h+"(claims dsh-resource://file/**) + resident preload + settings card")}}function o(d){L({sidebarUi:"legacy"}),console.warn("[code-server] \u672A\u63A2\u6D4B\u5230\u53F3\u4FA7\u680F\u670D\u52A1(sidebarRightTabs/sidebarRight): \u672C\u63D2\u4EF6\u81EA 0.2.3 \u8D77\u4E0D\u518D\u517C\u5BB9\u65E7\u7248 DSH \u2014\u2014 \u9664\u300C\u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 Code Server\u300D\u7684\u63D0\u793A\u5916\u4E0D\u63D0\u4F9B\u4EFB\u4F55\u5165\u53E3,\u4E5F\u4E0D\u9884\u70ED IDE\u3002\u8BF7\u5347\u7EA7 DSH\u3002"),d===!0&&y("/code-server/ui-mode",{sidebar:!1}).catch(function(){})}var c=null,p=null,f=null;function x(){c!==null&&(clearTimeout(c),c=null),p!==null&&(clearTimeout(p),p=null),f!==null&&(clearTimeout(f),f=null)}var v=!1;try{typeof e.inject=="function"&&(v=!0,e.inject(["sidebarRightTabs","sidebarRight"],function(d){l(d,"inject")}))}catch(d){console.warn("[code-server] sidebar inject failed:",d!=null&&d.message!=null?d.message:String(d))}var w=typeof e.get=="function"&&e.get("sidebarRightTabs")!==void 0&&e.get("sidebarRight")!==void 0;if(w){f=setTimeout(function(){a||(console.warn("[code-server] ctx.inject \u672A\u5728 1.5s \u5185\u56DE\u8C03,\u6539\u7528\u540C\u6B65\u670D\u52A1\u6CE8\u518C\u4FA7\u680F"),l(e,"sync-fallback"))},wr);return}if(v!==!0){o(!0);return}c=setTimeout(function(){a||o(!1)},yr),p=setTimeout(function(){a||o(!0)},xr)}var Fr=["slots","settingsScope"],Br="code-server";
4
5
  return module.exports;}});
5
6
 
package/lib/index.js CHANGED
@@ -54,6 +54,7 @@ import { bridgeEndpointPath, startBridgeListener } from './bridge-ipc.mjs';
54
54
  import { registerEditorPrompt, registerEditorTools, setPromptLiveProbe } from './bridge-tools.mjs';
55
55
  import { deliverEditorPrompt } from './bridge-session.mjs';
56
56
  import { dshEntry, dshRequire } from './dsh-resolve.mjs';
57
+ import { childNodeEnv, resolveChildNode } from './child-node.mjs';
57
58
  import { registerBridgeObserver } from './bridge-observe.mjs';
58
59
  import { createThreadRegistry } from './bridge-thread.mjs';
59
60
  import { createApprovalBoard, createApprovalInterceptor, DEFAULT_HOLD_MS, PANEL_OUTCOMES } from './bridge-approval.mjs';
@@ -1675,13 +1676,30 @@ export async function apply(ctx, config) {
1675
1676
  // 启动前再自愈一次依赖布局(插件重装/树被替换后可能丢失;幂等且只做存在性检查)
1676
1677
  ensureRuntimeLayout();
1677
1678
  const isCmd = launch.kind === 'bin' && win32() && /\.cmd$/i.test(launch.command);
1678
- const command = launch.kind === 'bin' ? launch.command : process.execPath;
1679
+ // 解释器:显式 bin 用它的;其余(node 脚本 / 自带 launcher)默认 process.execPath —— 但**宿主是
1680
+ // Electron(Node 模式)时必须换成真 Node**(0.3.53):VS Code 的 server-main 会注册一段只在
1681
+ // Electron/ELECTRON_RUN_AS_NODE 下生效的 asar 解析钩子,它拒绝一切落在"应用根"之外的包,而
1682
+ // 本插件的原生包都在树外的 pnpm 目录里 ⇒ 桌面版必然 `Cannot find package '@vscode/spdlog' …`
1683
+ // ⇒ 面板显示「code-server 意外退出(exit 2)」。详见 lib/child-node.mjs。
1684
+ const childNode = launch.kind === 'bin' ? null : resolveChildNode();
1685
+ const command = launch.kind === 'bin' ? launch.command : childNode.command;
1679
1686
  const spawnArgs = launch.kind === 'bin' ? args : [launch.script, ...args];
1687
+ if (childNode !== null && childNode.electronHost) {
1688
+ if (childNode.swapped) {
1689
+ console.log(`[code-server] 宿主是 Electron(Node 模式):改用真 Node 跑 IDE 子进程`
1690
+ + `(${childNode.source}: ${childNode.command});已从子进程环境剥离 ELECTRON_RUN_AS_NODE`);
1691
+ } else {
1692
+ console.warn('[code-server] 宿主是 Electron(Node 模式),但没找到可用的真 Node —— VS Code 的 asar 解析钩子'
1693
+ + '会拒绝树外的原生包(@vscode/spdlog / @vscode/deviceid / @vscode/windows-registry 等),'
1694
+ + 'IDE 很可能以 exit 2 退出。修法:让应用自带的 resources/runtime/primary-runtime/dependencies/node/bin/'
1695
+ + '或 PATH 上有一个真的 node。');
1696
+ }
1697
+ }
1680
1698
  // shell 仅对 .cmd shim(Windows npm 全局包)必要:它必须经 cmd.exe 解析。
1681
1699
  // 含空格路径由 spawn 数组传参,不再经 shell 拼接,避免 'C:\Program' 拆分。
1682
1700
  proc = spawn(isCmd ? `"${command}"` : command, spawnArgs, {
1683
1701
  cwd: cwd ?? process.cwd(),
1684
- env,
1702
+ env: childNode === null ? env : childNodeEnv(childNode, env),
1685
1703
  shell: isCmd,
1686
1704
  windowsHide: true,
1687
1705
  detached: !win32() && !isCmd,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-code-server-app",
3
- "version": "0.3.51",
3
+ "version": "0.3.54",
4
4
  "description": "VS Code (from a code-server release) inside DSH: a right-sidebar tab driven by the plugin's own launcher over the in-process VS Code server (lib/launcher.mjs). Since 0.3.0 the bundle also ships an editor bridge (assets/extensions/dshcs-editor-bridge): a read-only channel between the in-tree VS Code extension host and DSH, giving the agent what only the editor knows (unsaved buffers, language-server diagnostics, the active selection) and letting editor gestures drive the session. Since 0.3.22 the ask panel renders that session's new content with DSH's own Markdown renderer (pinned to the deployed DSH UI version); since 0.3.23 it is a full-width dialog with collapsible thinking rows and can answer approval requests in place — the bridge's only non-read-only route (POST /approve, constrained to pending in-process requests and the outcomes allowed-once/rejected; panel-first for 5 minutes, handed back to the official card the moment the panel closes). The tab claims DSH file addresses (dsh-resource://file/**) by file type (setting claimExtensions), so the product's own produced-file chips, delivered-file previews and inline prose mentions open in the workbench. The IDE is a resident surface moved with Element.moveBefore instead of being remounted, so switching sidebar tabs no longer reloads it. Opening the tab switches the right sidebar to fullscreen by default (setting fullscreenOnOpen). Following a workspace switch is lightweight: the workbench re-navigates with the new ?folder= and the IDE process is not restarted (since 0.2.12). Requires a DSH with the right-sidebar services (sidebarRightTabs/sidebarRight, >= 0.1.5-alpha.1); older DSH versions get a single upgrade notice on the settings page and no other UI. Two serving modes: loopback port (default) or same-origin mount on DSH's own webServer (/code-server, protected by ctx.connection.requestRejection). No code-server Node layer, no argon2, no C++ toolchain.",
5
5
  "homepage": "https://github.com/jinsiyu/dsh-code-server-app",
6
6
  "repository": {
@@ -46,6 +46,7 @@
46
46
  "lib/bridge-thread.mjs",
47
47
  "lib/bridge-approval.mjs",
48
48
  "lib/dsh-resolve.mjs",
49
+ "lib/child-node.mjs",
49
50
  "lib/launcher.mjs",
50
51
  "lib/serve-dsh.mjs",
51
52
  "lib/vendor.js",
@@ -192,6 +193,8 @@
192
193
  "test:client-cwd": "node scripts/test-client-bundle-cwd.mjs",
193
194
  "test:client-seat": "node scripts/test-client-settings-seat.mjs",
194
195
  "test:dsh-resolve": "node scripts/test-dsh-resolve.mjs",
196
+ "test:child-node": "node scripts/test-child-node.mjs",
197
+ "test:package-files": "node scripts/test-package-files.mjs",
195
198
  "test:bridge-routes": "node scripts/test-bridge-routes.mjs",
196
199
  "test:bridge-extension": "node scripts/test-bridge-extension.mjs",
197
200
  "test:webview": "node scripts/test-webview-bundle.mjs",
@@ -3,7 +3,7 @@
3
3
  "vscodeVersion": "1.137.0",
4
4
  "productPath": "stable-b11dabdaca0d3369986975be285db92c8795cea5",
5
5
  "layout": "vscode-only",
6
- "preparedAt": "2026-09-18T11:22:51.430Z",
6
+ "preparedAt": "2026-09-18T15:59:04.210Z",
7
7
  "source": "registry",
8
8
  "node": "v24.20.0",
9
9
  "platform": "linux",