dsh-code-server-app 0.3.47 → 0.3.50
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.en.md +166 -3
- package/README.md +188 -10
- package/assets/extensions/dshcs-editor-bridge/webview/THIRD-PARTY.md +1 -1
- package/lib/client.js +2 -2
- package/lib/dsh-resolve.mjs +106 -13
- package/lib/index.js +6 -7
- package/lib/native.js +28 -1
- package/lib/vendored.json +53 -9
- package/package.json +15 -1
- package/scripts/vendor-repacks.mjs +446 -32
- package/vendor/VENDOR.json +1 -1
package/lib/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
window.__ModuleLoader__.load({id:'dsh-code-server-app',factory:function(require){var module={exports:{}};var exports=module.exports;
|
|
2
|
-
var Y=Object.defineProperty;var Te=Object.getOwnPropertyDescriptor;var Ae=Object.getOwnPropertyNames;var Me=Object.prototype.hasOwnProperty;var Re=(e,r)=>{for(var n in r)Y(e,n,{get:r[n],enumerable:!0})},Ie=(e,r,n,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of Ae(r))!Me.call(e,t)&&t!==n&&Y(e,t,{get:()=>r[t],enumerable:!(a=Te(r,t))||a.enumerable});return e};var je=e=>Ie(Y({},"__esModule",{value:!0}),e);var Mr={};Re(Mr,{apply:()=>Or,inject:()=>Tr,name:()=>Ar});module.exports=je(Mr);var ne="dsh-resource://file/",De="sidebar://";function W(e){return typeof e=="string"&&e.startsWith(De)}function H(e){if(typeof e!="string"||!e.startsWith(ne))return null;for(var r=e.length,n=0;n<e.length;n+=1){var a=e.charAt(n);if(a==="?"||a==="#"){r=n;break}}var t=e.slice(ne.length,r).split("/"),s=t.shift();try{if(s==="session"){var o=t.shift();return o===void 0||o===""||t.length===0?null:{scope:"session",sessionId:decodeURIComponent(o),path:te(t)}}if(s==="absolute"){var d=t[0]===""&&t.length>1,p=d?t.slice(1):t,u=te(p);return(u===""||u.charAt(0)==="/")&&!d?null:d?{scope:"absolute",path:"//"+u}:u===""?null:{scope:"absolute",path:ae(u)?u:"/"+u}}}catch(v){return null}return null}function te(e){for(var r=[],n=0;n<e.length;n+=1)r.push(decodeURIComponent(e[n]));return r.join("/")}function ae(e){return/^[A-Za-z]:($|\/)/.test(e)}function ze(e){return typeof e!="string"||e===""?!1:e.charAt(0)==="/"?!0:ae(e)}function le(e){var r=H(e);if(r===null)return"";var n=r.path.replace(/[/\\]+$/,""),a=Math.max(n.lastIndexOf("/"),n.lastIndexOf("\\")),t=a===-1?n:n.slice(a+1);return t}function ie(e,r){if(e===null||e==null)return null;var n=typeof e.path=="string"?e.path:"";if(n==="")return null;if(ze(n))return n;if(typeof r!="string"||r==="")return null;var a=r.indexOf("\\")!==-1?"\\":"/",t=r.replace(/[\\/]+$/,"");return t+a+(a==="\\"?n.replace(/\//g,"\\"):n)}var I="*;!md;!markdown;!html;!htm;!png;!jpg;!jpeg;!gif;!webp;!bmp;!ico;!svg;!pdf",Pe=/[;,\s]+/;function _e(e){return String(e).replace(/!\s+/g,"!").split(Pe)}function He(e){var r=typeof e=="string"?e.trim():"";if(r==="")return"";var n=r.charAt(0)==="!",a=n?r.slice(1).trim():r;return a==="*"?n?"!*":"*":(a.slice(0,2)==="*."?a=a.slice(2):a.charAt(0)==="."&&(a=a.slice(1)),a=a.toLowerCase(),a===""?"":n?"!"+a:a)}function O(e){if(typeof e!="string")return"";for(var r=_e(e),n=[],a=0;a<r.length;a+=1){var t=He(r[a]);t===""||t==="!*"||n.indexOf(t)===-1&&n.push(t)}return n.join(";")}function U(e){for(var r=O(e),n=r===""?[]:r.split(";"),a=!1,t=[],s=[],o=0;o<n.length;o+=1){var d=n[o];if(d==="*"){a=!0;continue}d.charAt(0)==="!"?s.push(d.slice(1)):t.push(d)}return{all:a,allow:t,deny:s}}function Ue(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 a=r.lastIndexOf(".");return a<=0?"":r.slice(a+1).toLowerCase()}function Be(e,r){if(r==null)return!1;var n=Ue(e);return n!==""&&r.deny.indexOf(n)!==-1?!1:n!==""&&r.allow.indexOf(n)!==-1?!0:r.all===!0}function se(e,r){return e===null||e==null?!1:Be(e.path,r)}function oe(e){var r=U(e),n=[];return 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&&n.push("\u6392\u9664 "+r.deny.length+" \u9879"),n.length===0?"\u4E0D\u8BA4\u9886\u4EFB\u4F55\u6587\u4EF6(\u53EA\u6709\u9875\u9762\u6807\u7B7E)":n.join(" \xB7 ")}var Fe="[data-sidebar-right-panel]",Ge='[data-sidebar-right-mode="fullscreen"]';function de(e){if(e==null||typeof e.closest!="function")return"no-root";var r,n;try{if(r=e.closest(Fe),r==null||typeof r.querySelector!="function")return"no-panel";n=r.querySelector(Ge)}catch(a){return"lookup-failed"}if(n==null||typeof n.click!="function")return"no-control";try{n.click()}catch(a){return"click-failed"}return"clicked"}var j=typeof Element!="undefined"&&typeof Element.prototype.moveBefore=="function",Ye=-2e4,l={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 Q(){return{ready:l.frame!==null,docked:l.owner!==null,owner:l.owner,src:l.currentSrc,sameOrigin:l.sameOrigin,parkStrategy:l.parkStrategy,degraded:l.degraded,preloaded:l.preloaded,supportsMoveBefore:j,nudgeCount:l.nudgeCount,lastNudgeAt:l.lastNudgeAt}}function D(){var e=Q();l.listeners.forEach(function(r){try{r(e)}catch(n){}})}function ce(e){return l.listeners.add(e),function(){l.listeners.delete(e)}}function ue(){return Q()}function We(e){e!=="offscreen"&&e!=="behind"||l.parkStrategy!==e&&(l.parkStrategy=e,l.frame!==null&&l.owner===null&&J(),D())}function Qe(){return l.parkStrategy}function Je(){var e=l.lastRect;e!==null&&(l.park.style.width=Math.max(1,Math.round(e.width))+"px",l.park.style.height=Math.max(1,Math.round(e.height))+"px")}function J(){if(l.park!==null){if(Je(),l.parkStrategy==="behind"&&l.lastRect!==null){l.park.style.left=Math.round(l.lastRect.left)+"px",l.park.style.top=Math.round(l.lastRect.top)+"px",l.park.style.visibility="visible",l.park.style.zIndex="0";return}l.park.style.left=Ye+"px",l.park.style.top="0px",l.park.style.visibility="hidden",l.park.style.zIndex="0"}}function fe(){l.frame!==null&&(l.frame.setAttribute("inert",""),l.frame.setAttribute("aria-hidden","true"))}function Ze(){l.frame!==null&&(l.frame.removeAttribute("inert"),l.frame.removeAttribute("aria-hidden"))}function Xe(){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),l.park=e,l.frame=r,l.currentSrc="about:blank",l.owner=null,J(),fe(),r}function Ke(e){var r=l.frame;if(r!==null){var n=l.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"),l.sameOrigin=e)}}function Z(e){var r=e||{};return l.frame===null&&Xe(),typeof r.sameOrigin=="boolean"&&Ke(r.sameOrigin),typeof r.src=="string"&&r.src!==""&&r.src!==l.currentSrc&&Ve(r.src),l.frame}function Ve(e){l.frame===null||typeof e!="string"||e===""||e===l.currentSrc||(l.currentSrc=e,l.frame.src=e,D())}function pe(){var e=l.frame;if(l.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,l.nudgeCount+=1,l.lastNudgeAt=Date.now(),!0}function qe(e){return l.nudgeEnabled=e!==!1,l.nudgeEnabled}function ve(e){if(l.frame!==null){if(j)try{e.moveBefore(l.frame,null);return}catch(r){l.degraded=!0,l.lastMoveError=(r&&r.name?r.name+": ":"")+(r&&r.message?r.message:String(r))}else l.degraded=!0;e.appendChild(l.frame)}}function X(e,r){if(!(l.frame===null||e==null)){var n=l.owner===null,a=e.getBoundingClientRect();a.width>=1&&a.height>=1&&(l.lastRect={left:a.left,top:a.top,width:a.width,height:a.height}),l.owner=r===void 0?null:r,Ze(),l.park.setAttribute("aria-hidden","true"),ve(e),n&&pe(),D()}}function z(e){l.frame!==null&&(e!==void 0&&l.owner!==e||(l.owner=null,J(),fe(),l.park.setAttribute("aria-hidden","true"),ve(l.park),D()))}function K(e){var r=e||{};return Z(r),l.owner===null&&(typeof r.src=="string"&&r.src!==""&&(l.preloaded=!0),z()),l.frame}function $e(){l.park!==null&&l.park.parentNode!==null&&l.park.parentNode.removeChild(l.park),l.park=null,l.frame=null,l.currentSrc=null,l.sameOrigin=null,l.owner=null,l.lastRect=null,l.degraded=!1,l.preloaded=!1,l.nudgeCount=0,l.lastNudgeAt=0,D()}typeof window!="undefined"&&(window.__dshcsSurface={snapshot:Q,setParkStrategy:We,getParkStrategy:Qe,preload:K,dock:X,park:z,nudge:pe,setNudgeEnabled:qe,destroy:$e});var i=require("react"),$=new Set,P={status:null,busy:!1,sidebarUi:"unknown",sidebarRegisterFailed:!1};function N(e){P=Object.assign({},P,e),$.forEach(function(r){r()})}function er(e){return $.add(e),function(){$.delete(e)}}function rr(){return P}function re(){return i.useSyncExternalStore(er,rr)}var nr="/api",tr="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMTQ3IDE0NyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8c3R5bGU+QG1lZGlhIChwcmVmZXJzLWNvbG9yLXNjaGVtZTogZGFyaykgeyogeyBmaWxsOiB3aGl0ZTsgfX08L3N0eWxlPgogIDxwYXRoIGQ9Im00Mi40MjE0LDM5LjY1NWMtMjQuNDA1NywwIC00Mi4xNTU0LDEzLjE3MjEgLTQyLjE1NTQsMzMuODQ1YzAsMjAuNTgxNCAxOC40ODkyLDMzLjg0NSA0Mi4xNTU0LDMzLjg0NWMyMy42NjYyLDAgMzguMTgwMywtMTEuNjE3MSAzOC43MzQ5LC0yOC43MjI1bC0yMS4wNzc3LC0wLjQ1NzRjLTAuOTI0NCw5LjMzMDMgLTkuMTA1OSwxNS4xODQ1IC0xNy42NTcyLDE1LjE4NDVjLTExLjc0MDYsMCAtMjAuNDMwNiwtNy41OTIyIC0yMC40MzA2LC0xOS44NDk2YzAsLTEyLjI1NzQgOC42OSwtMTkuOTg2OCAyMC40MzA2LC0yMC4yMTU1YzguNTUxMywtMC4xODMgMTYuOTE3Nyw1Ljk0NTcgMTcuNDcyMywxNS4yNzZsMjEuMDc3NywtMC42NDAzYy0wLjQ2MjIsLTE2LjgzMTEgLTE0LjE0NDIsLTI4LjI2NTIgLTM4LjU1LC0yOC4yNjUyem00OC44NDQ2LDJsNTUuNDY4LDBsMCw2NC4wMzExbC01NS40NjgsMGwwLC02NC4wMzExeiIgY2xpcC1ydWxlPSJldmVub2RkIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiLz4KPC9zdmc+Cg==";async function x(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 a=await fetch(nr+e,n),t=await a.text(),s=null;try{s=t===""?null:JSON.parse(t)}catch(o){s=null}return a.ok?s!==null?s:{ok:!1,error:"invalid JSON response"}:{ok:!1,error:"HTTP "+a.status+(s!==null&&s.error!==void 0?": "+s.error:"")}}function Ee(e,r){try{var n=e(function(m){return m}),a=r===null?null:typeof r=="function"?r(function(m){return m}):null,t=n!=null?n.current:void 0;if(t!==void 0&&n!=null&&n.byId!=null){var s=n.byId[t];if(s!=null&&typeof s.cwd=="string"&&s.cwd!=="")return s.cwd}var o=a!=null&&Array.isArray(a.items)?a.items:[];if(t!==void 0)for(var d=0;d<o.length;d++){var p=o[d];if(p.sessionIds!=null&&p.sessionIds.indexOf(t)!==-1&&typeof p.path=="string"&&p.path!=="")return p.path}var u=a!=null?a.recentWorkspaceId:void 0;if(u!==void 0){for(var v=0;v<o.length;v++)if(o[v].workspaceId===u&&typeof o[v].path=="string"&&o[v].path!=="")return o[v].path}if(o.length>0&&typeof o[0].path=="string"&&o[0].path!=="")return o[0].path}catch(m){}}function Se(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",a=e.url+"?s="+encodeURIComponent(n),t=typeof r=="string"&&r!==""?r:e!=null&&e.cwd!=null?e.cwd:null;if(t==null||t==="")return a;var s=t.replace(/\\/g,"/"),o=s;return(/^[A-Za-z]:\//.test(s)||s.charCodeAt(0)!==47)&&(o="/"+s),a+"&folder="+encodeURIComponent(o)}function ar(e){var r=e.status,n=e.pageUrl,a=e.reloadTick,t=e.owner,s=i.useRef(null),o=r!=null&&r.ok===!0&&r.running===!0,d=r!=null&&r.status==="starting",p=r!=null&&r.ok===!1,u=r!=null&&r.serve==="dsh";if(i.useLayoutEffect(function(){if(!o||n===null){z(t);return}Z({src:n,sameOrigin:u}),s.current!==null&&X(s.current,t)},[o,n,u,a,t]),i.useLayoutEffect(function(){return function(){z(t)}},[t]),o&&n!==null)return i.createElement("div",{ref:s,className:"dshcs-slot","data-code-server-slot":t!=null?t:"code-server"});if(d)return i.createElement("div",{className:"dshcs-loading"},"\u6B63\u5728\u542F\u52A8 code-server\u2026");var v=p&&r!=null&&r.error?r.error:"code-server \u672A\u8FD0\u884C",m=u?"\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",E=j?"\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"},v),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"+m+E)))}function lr(e){var r=re(),n=r.status,a=n!=null&&n.ok===!0&&n.running===!0,t=n!=null&&n.keepResident===!0,s=Ee(e&&e.useSessions,e&&e.useWorkspaces),o=a?Se(n,s):null;return i.useEffect(function(){!t||!a||o===null||K({src:o,sameOrigin:n!=null&&n.serve==="dsh"})},[t,a,o,n!=null?n.serve:null]),null}var ir=".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}",he="dsh-code-server/styles";typeof document!="undefined"&&document.querySelector("style[data-dshcs="+JSON.stringify(he)+"]")===null&&(B=document.createElement("style"),B.setAttribute("data-dshcs",he),B.textContent=ir,document.head.appendChild(B));var B,me="code-server",ge="dsh-code-server-app",sr=2500,or=1e4,dr=1500;function cr(e){var r=e!=null&&typeof e.size=="number"?e.size:16;return i.createElement("img",{src:tr,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 ur=U("");function fr(){var e=P.status;return e==null||typeof e.claimExtensions!="string"?ur:U(e.claimExtensions)}function pr(e,r){try{var n=e(function(t){return t});if(n!=null&&r!=null&&n.byId!=null){var a=n.byId[r];if(a!=null&&typeof a.cwd=="string"&&a.cwd!=="")return a.cwd}}catch(t){}}function vr(e){var r=e.useTabInfo(),n=r.tab,a=re(),t=a.status,s=n.navigation,o=s!=null&&typeof s.revision=="number"?s.revision:0,d=s!=null&&typeof s.address=="string"?s.address:"",p=W(d)?null:H(d),u=pr(e.useSessions,p!=null?p.sessionId:void 0),v=u!==void 0?u:Ee(e.useSessions,null),m=ie(p,v),E=s!=null&&s.params!=null&&typeof s.params.line=="number"?s.params.line:null,f=i.useRef(void 0),[y,h]=i.useState(0),k=i.useRef(null),M=i.useRef(!1),_=r.tab!=null&&r.tab.visible===!0,L=r.sidebar!=null&&r.sidebar.fullscreen===!0,G=t!=null&&t.fullscreenOnOpen!==!1;return i.useLayoutEffect(function(){if(!_){M.current=!1;return}if(!(!G||L||M.current)){M.current=!0;var S=de(k.current);S!=="clicked"&&console.warn("[code-server] \u672A\u80FD\u81EA\u52A8\u5207\u5230\u5168\u5C4F\u53F3\u4FA7\u680F("+S+");\u672C\u6B21\u6253\u5F00\u4FDD\u6301\u539F\u6A21\u5F0F")}},[_,L,G]),i.useEffect(function(){if(!(typeof v!="string"||v==="")&&f.current!==v){var S=f.current!==void 0;f.current=v;var b=!1;return x("/code-server/start",{cwd:v}).then(function(T){b||(N({status:T}),S&&T!=null&&T.ok===!0&&T.running===!0&&h(function(R){return R+1}))}).catch(function(){}),function(){b=!0}}},[v]),i.useEffect(function(){x("/code-server/status").then(function(b){b!=null&&N({status:b})}).catch(function(){});var S=window.setInterval(function(){x("/code-server/status").then(function(b){N({status:b})}).catch(function(){})},3e3);return function(){window.clearInterval(S)}},[]),i.useEffect(function(){m!==null&&x("/code-server/open-file",E===null?{file:m}:{file:m,line:E}).catch(function(){})},[o,m,E]),i.createElement("div",{className:"dshcs-tabroot","data-code-server-tab":"body",ref:k},i.createElement(ar,{status:t,pageUrl:Se(t,v),reloadTick:y,owner:"tab:"+n.id}))}function V(e,r){if(e==null)return null;var n=e[r];if(n!=null)return n;if(typeof e.get=="function"){var a=e.get(r);if(a!=null)return a}return null}function hr(e){var r=V(e,"sidebarRightTabs"),n=V(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 a=V(e,"slots");if(e.effect(function(){return r.register({id:ge,kind:me,priority:"extension",patterns:["dsh-resource://file/**"],canOpen:function(t){return se(H(t),fr())},title:function(t){if(W(t)||t===void 0||t===null||t==="")return"Code Server";var s=le(t);return s===""?"Code Server":s},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:cr}]})},"code-server: sidebar tab type"),a!=null)e.effect(function(){return a.inject("sidebar.right.pane.tab",function(){return a.register({name:"sidebar.right.pane.tab",key:ge},vr)})},"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(){N({sidebarUi:"unknown"})}},"code-server: sidebar mode reset"),console.log("[code-server] right-sidebar tab registered (kind="+me+")"),!0}var mr=".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}",gr="dsh-code-server/Card.module.css";function br(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)}}br(gr,mr);function yr(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 be(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 ye(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 xr(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 q(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 xe(e){var[r,n]=i.useState(e.defaultOpen===!0),a=e.state;if(a==null||a.available!==!0)return null;var t=e.title,s=e.noticeOnly===!0,o=a.dirty!==!0||a.invalid===!0||a.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"},t),i.createElement("span",{className:"dshcs-cardDescription"},e.description)),a.dirty===!0?i.createElement("span",{className:"dshcs-pending"},e.unsavedLabel):null,i.createElement(yr,{className:"dshcs-cardChevron"+(r?" dshcs-cardChevronOpen":"")})),r===!0?i.createElement("div",{className:"dshcs-cardBody"},s===!0?null:a.writable!==!0?i.createElement("p",{className:"dshcs-cardReadOnly",role:"status"},e.readOnlyLabel):null,e.children,s===!0?null:i.createElement("div",{className:"dshcs-cardFooter"},a.failed===!0?i.createElement("p",{className:"dshcs-cardFailed",role:"status"},e.saveFailedLabel):null,i.createElement(be,{disabled:a.dirty!==!0||a.saving===!0,onClick:e.onDiscard},e.discardLabel),i.createElement(be,{variant:"primary",disabled:o,onClick:e.onSave},a.saving===!0?e.savingLabel:e.saveLabel))):null)}function wr(e){try{let b=function(){x("/code-server/status").then(function(g){g!=null&&typeof g=="object"&&N({status:g})}).catch(function(){})};var r=e.scope,[n,a]=i.useState(function(){return r!==void 0?r.getSnapshot():null}),[t,s]=i.useState(null),[o,d]=i.useState(!1),[p,u]=i.useState(!1),v=re(),[m,E]=i.useState(ue());if(i.useEffect(function(){return ce(function(g){E(g)})},[]),i.useEffect(function(){if(r===void 0||typeof r.subscribe!="function")return;function g(){try{a(r.getSnapshot())}catch(Rr){}}var w=r.subscribe(g);return function(){typeof w=="function"&&w()}},[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 f=n.value!==void 0&&n.value!==null?n.value:{},y=n.user,h={keepResident:f.keepResident!==!1,claimExtensions:typeof f.claimExtensions=="string"?f.claimExtensions:I,fullscreenOnOpen:f.fullscreenOnOpen!==!1};if(v!=null&&v.sidebarUi==="legacy")return i.createElement(xe,{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 k=y!=null&&Object.prototype.hasOwnProperty.call(y,"keepResident"),M=y!=null&&Object.prototype.hasOwnProperty.call(y,"claimExtensions"),_=y!=null&&Object.prototype.hasOwnProperty.call(y,"fullscreenOnOpen"),L=t!==null&&(t.keepResident!==h.keepResident||O(t.claimExtensions)!==O(h.claimExtensions)||t.fullscreenOnOpen!==h.fullscreenOnOpen),G=!L||o,S={available:!0,writable:n.writable,dirty:L,invalid:!1,saving:o,failed:p};async function T(){if(L&&!o){d(!0),u(!1);try{var g=t!==null?t:h;await e.scope.set("keepResident",g.keepResident===!0),await e.scope.set("claimExtensions",O(g.claimExtensions)),await e.scope.set("fullscreenOnOpen",g.fullscreenOnOpen===!0),s(null),b()}catch(w){u(!0)}d(!1)}}async function R(){if(!(o||n.writable!==!0)){d(!0),u(!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",f.keepResident===void 0||f.keepResident===null?!0:f.keepResident),await e.scope.set("claimExtensions",typeof f.claimExtensions=="string"?O(f.claimExtensions):I),await e.scope.set("fullscreenOnOpen",f.fullscreenOnOpen===void 0||f.fullscreenOnOpen===null?!0:f.fullscreenOnOpen)),s(null),b()}catch(g){u(!0)}d(!1)}}return i.createElement(xe,{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:S,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:T,onDiscard:function(){s(null),u(!1)}},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)"),M===!0?i.createElement(q,{overridden:!0,disabled:n.writable!==!0,overriddenLabel:"\u5DF2\u8986\u76D6",resetLabel:"\u6062\u590D\u9ED8\u8BA4",onReset:function(){R()}}):null),i.createElement(xr,{value:t!==null?t.claimExtensions:h.claimExtensions,disabled:n.writable!==!0,placeholder:I,onChange:function(g){s(function(w){return Object.assign({},w!==null?w:h,{claimExtensions:g})}),u(!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}},"\u5B9E\u9645\u89C4\u5219:"+oe(t!==null?t.claimExtensions:h.claimExtensions)+(O(t!==null?t.claimExtensions:h.claimExtensions)!==(t!==null?t.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)"),_===!0?i.createElement(q,{overridden:!0,disabled:n.writable!==!0,overriddenLabel:"\u5DF2\u8986\u76D6",resetLabel:"\u6062\u590D\u9ED8\u8BA4",onReset:function(){R()}}):null),i.createElement(ye,{checked:t!==null?t.fullscreenOnOpen:h.fullscreenOnOpen,disabled:n.writable!==!0,onChange:function(g){s(function(w){return Object.assign({},w!==null?w:h,{fullscreenOnOpen:g===!0})}),u(!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)"),k===!0?i.createElement(q,{overridden:!0,disabled:n.writable!==!0,overriddenLabel:"\u5DF2\u8986\u76D6",resetLabel:"\u6062\u590D\u9ED8\u8BA4",onReset:function(){R()}}):null),i.createElement(ye,{checked:t!==null?t.keepResident:h.keepResident,disabled:n.writable!==!0,onChange:function(g){s(function(w){return Object.assign({},w!==null?w:h,{keepResident:g===!0})}),u(!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}},j?"\u5E38\u9A7B\u9762:"+(m.docked?"\u5DF2\u505C\u9760":m.ready?"\u5DF2\u505C\u653E(\u540E\u53F0\u8FD0\u884C\u4E2D)":"\u672A\u542F\u52A8")+(m.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)")))}catch(b){return console.error("[code-server] card render error:",b!=null&&b.message!==void 0?b.message:String(b)),null}}var we=900,c={rev:-1,open:!1,mounted:!1,pending:null,el:null,body:null,title:null,timer:null,loading:!1};function kr(e){if(!(e===null||typeof e!="object")){if(e.type==="ready"){A(!0);return}if(e.type==="ask"&&typeof e.text=="string"){x("/code-server/ask/send",{text:e.text,mode:c.pending===null?void 0:c.pending.mode}).then(function(r){c.rev=-1,A(!0)}).catch(function(){});return}if(e.type==="approve"&&typeof e.id=="string"){x("/code-server/ask/approve",{id:e.id,outcome:e.outcome}).then(function(r){r!=null&&r.ok===!1&&F(r.error||"\u6388\u6743\u63D0\u4EA4\u5931\u8D25"),c.rev=-1,A(!0)}).catch(function(r){F("\u6388\u6743\u63D0\u4EA4\u5931\u8D25:"+String(r&&r.message?r.message:r))});return}e.type==="close"&&Ce()}}function A(e){if(c.el!==null){var r=window.__DSHCS_ASK_PUSH__;typeof r=="function"?r(c.pending):e===!0&&setTimeout(function(){A(!1)},120)}}function F(e){console.warn("[code-server] ask dialog:",e)}function Ce(){c.open=!1,c.el!==null&&(c.el.style.display="none"),x("/code-server/ask/close",{}).catch(function(){})}function Ne(){if(c.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 a=document.createElement("span");a.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 t=document.createElement("button");t.type="button",t.textContent="\u2715",t.title="\u5173\u95ED",t.setAttribute("aria-label","\u5173\u95ED"),t.style.cssText="flex:none;border:0;background:transparent;color:inherit;cursor:pointer;font-size:13px;line-height:1;padding:2px 6px;border-radius:4px",t.addEventListener("click",function(){Ce()}),r.appendChild(n),r.appendChild(a),r.appendChild(t);var s=document.createElement("div");s.className="dshcs-panel",s.setAttribute("data-dshcs-ask-root",""),s.style.cssText="height:calc(100% - 33px);overflow:hidden",e.appendChild(r),e.appendChild(s),document.body.appendChild(e),c.el=e,c.body=s,c.title=a;var o=null;r.addEventListener("pointerdown",function(d){if(d.target!==t){var p=e.getBoundingClientRect();o={x:d.clientX,y:d.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(d.pointerId)}catch(u){}}}),r.addEventListener("pointermove",function(d){o!==null&&(e.style.left=Math.max(0,Math.min(window.innerWidth-80,o.left+(d.clientX-o.x)))+"px",e.style.top=Math.max(0,Math.min(window.innerHeight-40,o.top+(d.clientY-o.y)))+"px")}),r.addEventListener("pointerup",function(){o=null})}}var Oe="dshcs.ask.bundle",Er=900*1e3,C=null;function ee(){try{var e=window.sessionStorage.getItem(Oe);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)>Er?null:{css:r.css,js:r.js}}catch(n){return null}}function Le(e){try{window.sessionStorage.setItem(Oe,JSON.stringify({at:Date.now(),css:e.css,js:e.js}))}catch(r){}}function Sr(){if(!(C!==null||c.mounted)){var e=ee();if(e!==null){C=e;return}x("/code-server/ask/bundle").then(function(r){r==null||r.ok!==!0||(C={css:r.css,js:r.js},Le(C),console.log("[code-server] ask bundle preloaded ("+Math.round((r.js.length+r.css.length)/1024)+"KB)"))}).catch(function(){})}}function Cr(){if(!(c.mounted||c.loading)){c.loading=!0;var e=C!==null?Promise.resolve(C):ee()!==null?Promise.resolve(ee()):x("/code-server/ask/bundle");e.then(function(r){c.loading=!1;var n=r;if(C===null&&r!=null&&r.ok===!0&&(n={css:r.css,js:r.js},C=n,Le(n)),n==null||typeof n.js!="string"){F(n!=null&&n.error?n.error:"\u9762\u677F\u4EA7\u7269\u4E0D\u53EF\u7528");return}if(Ne(),document.getElementById("dshcs-ask-style")===null){var a=document.createElement("style");a.id="dshcs-ask-style",a.textContent=n.css,document.head.appendChild(a)}window.__DSHCS_HOST__="dsh",window.__DSHCS_MOUNT__=c.body,window.acquireVsCodeApi=function(){return{postMessage:kr}};var t=document.createElement("script");t.textContent=n.js,document.head.appendChild(t),c.mounted=!0,setTimeout(function(){A(!0)},60)}).catch(function(r){c.loading=!1,F("\u9762\u677F\u4EA7\u7269\u52A0\u8F7D\u5931\u8D25:"+String(r&&r.message?r.message:r))})}}function ke(){x("/code-server/ask/state?rev="+c.rev).then(function(e){e==null||e.ok!==!0||e.changed===!0&&(c.rev=typeof e.rev=="number"?e.rev:-1,c.pending=e,e.open===!0?(Ne(),c.el.style.display="block",c.title!==null&&(c.title.textContent=e.contextText||"\u6765\u81EA\u7F16\u8F91\u5668"),c.open=!0,Cr(),c.mounted&&A(!0)):c.el!==null&&(c.el.style.display="none",c.open=!1))}).catch(function(){})}function Nr(){c.timer===null&&(c.timer=setInterval(ke,we),setTimeout(ke,800),setTimeout(Sr,3e3),console.log("[code-server] ask dialog poller started (every "+we+"ms)"))}function Or(e){try{Lr(e),Nr()}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 Lr(e){var r=e.get("slots");if(r===void 0){console.error("[code-server] slots service unavailable");return}var n=e.settingsScope,a=null;if(n!==void 0&&typeof n.bind=="function")a=n.bind({namespace:"code-server"});else{console.error("[code-server] settingsScope unavailable (inject missing?); settings card disabled");return}x("/code-server/status").then(function(f){N({status:f})}).catch(function(){}),r.inject("settings.plugin.item",()=>r.register({name:"settings.plugin.item",key:"code-server",label:"Code Server",inject:function(){return{scope:a}}},wr));var t=!1;function s(f,y){if(!t){t=!0,v();var h=!1;try{h=hr(f)}catch(k){console.error("[code-server] sidebar tab registration failed:",k!=null&&k.message!=null?k.message:String(k))}P.sidebarUi==="legacy"&&(console.log("[code-server] \u53F3\u4FA7\u680F\u670D\u52A1\u665A\u5230(\u7ECF "+y+"):\u64A4\u9500\u65E7\u7248 DSH \u5224\u5B9A"),x("/code-server/ui-mode",{sidebar:!0}).catch(function(){})),N({sidebarUi:"modern",sidebarRegisterFailed:h!==!0}),r.inject("shell.overlay",()=>r.register({name:"shell.overlay",id:"code-server",order:70,label:"Code Server"},k=>i.createElement(lr,k))),console.log("[code-server] client registered via "+y+": sidebar tab="+h+"(claims dsh-resource://file/**) + resident preload + settings card")}}function o(f){N({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"),f===!0&&x("/code-server/ui-mode",{sidebar:!1}).catch(function(){})}var d=null,p=null,u=null;function v(){d!==null&&(clearTimeout(d),d=null),p!==null&&(clearTimeout(p),p=null),u!==null&&(clearTimeout(u),u=null)}var m=!1;try{typeof e.inject=="function"&&(m=!0,e.inject(["sidebarRightTabs","sidebarRight"],function(f){s(f,"inject")}))}catch(f){console.warn("[code-server] sidebar inject failed:",f!=null&&f.message!=null?f.message:String(f))}var E=typeof e.get=="function"&&e.get("sidebarRightTabs")!==void 0&&e.get("sidebarRight")!==void 0;if(E){u=setTimeout(function(){t||(console.warn("[code-server] ctx.inject \u672A\u5728 1.5s \u5185\u56DE\u8C03,\u6539\u7528\u540C\u6B65\u670D\u52A1\u6CE8\u518C\u4FA7\u680F"),s(e,"sync-fallback"))},dr);return}if(m!==!0){o(!0);return}d=setTimeout(function(){t||o(!1)},sr),p=setTimeout(function(){t||o(!0)},or)}var Tr=["slots","settingsScope"],Ar="code-server";
|
|
2
|
+
var Q=Object.defineProperty;var De=Object.getOwnPropertyDescriptor;var ze=Object.getOwnPropertyNames;var Pe=Object.prototype.hasOwnProperty;var _e=(e,r)=>{for(var n in r)Q(e,n,{get:r[n],enumerable:!0})},He=(e,r,n,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of ze(r))!Pe.call(e,a)&&a!==n&&Q(e,a,{get:()=>r[a],enumerable:!(t=De(r,a))||t.enumerable});return e};var Ue=e=>He(Q({},"__esModule",{value:!0}),e);var _r={};_e(_r,{apply:()=>jr,inject:()=>zr,name:()=>Pr});module.exports=Ue(_r);var ie="dsh-resource://file/",Be="sidebar://";function J(e){return typeof e=="string"&&e.startsWith(Be)}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 Fe(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(Fe(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 R="*;!md;!markdown;!html;!htm;!png;!jpg;!jpeg;!gif;!webp;!bmp;!ico;!svg;!pdf",We=/[;,\s]+/;function Ge(e){return String(e).replace(/!\s+/g,"!").split(We)}function Ye(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=Ge(e),n=[],t=0;t<r.length;t+=1){var a=Ye(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 Qe(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 Je(e,r){if(r==null)return!1;var n=Qe(e);return n!==""&&r.deny.indexOf(n)!==-1?!1:n!==""&&r.allow.indexOf(n)!==-1?!0:r.all===!0}function ue(e,r){return e===null||e==null?!1:Je(e.path,r)}function fe(e){var r=B(e),n=[];return 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&&n.push("\u6392\u9664 "+r.deny.length+" \u9879"),n.length===0?"\u4E0D\u8BA4\u9886\u4EFB\u4F55\u6587\u4EF6(\u53EA\u6709\u9875\u9762\u6807\u7B7E)":n.join(" \xB7 ")}var Ze="[data-sidebar-right-panel]",Ke='[data-sidebar-right-mode="fullscreen"]';function pe(e){if(e==null||typeof e.closest!="function")return"no-root";var r,n;try{if(r=e.closest(Ze),r==null||typeof r.querySelector!="function")return"no-panel";n=r.querySelector(Ke)}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 ve(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 Z(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 K(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=ve(n,a);if(l!==void 0)return l;var o=n==null?void 0:n.current,c=ve(n,o);if(c!==void 0)return c;var p=Z(t,a);if(p!==void 0)return p;var f=Z(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=Z(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 h=t.items[0];if(h!=null&&typeof h.path=="string"&&h.path!=="")return h.path}}var I=typeof Element!="undefined"&&typeof Element.prototype.moveBefore=="function",Xe=-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 X(){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:I,nudgeCount:s.nudgeCount,lastNudgeAt:s.lastNudgeAt}}function j(){var e=X();s.listeners.forEach(function(r){try{r(e)}catch(n){}})}function he(e){return s.listeners.add(e),function(){s.listeners.delete(e)}}function me(){return X()}function Ve(e){e!=="offscreen"&&e!=="behind"||s.parkStrategy!==e&&(s.parkStrategy=e,s.frame!==null&&s.owner===null&&V(),j())}function qe(){return s.parkStrategy}function $e(){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($e(),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=Xe+"px",s.park.style.top="0px",s.park.style.visibility="hidden",s.park.style.zIndex="0"}}function ge(){s.frame!==null&&(s.frame.setAttribute("inert",""),s.frame.setAttribute("aria-hidden","true"))}function er(){s.frame!==null&&(s.frame.removeAttribute("inert"),s.frame.removeAttribute("aria-hidden"))}function rr(){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(),ge(),r}function nr(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&&rr(),typeof r.sameOrigin=="boolean"&&nr(r.sameOrigin),typeof r.src=="string"&&r.src!==""&&r.src!==s.currentSrc&&tr(r.src),s.frame}function tr(e){s.frame===null||typeof e!="string"||e===""||e===s.currentSrc||(s.currentSrc=e,s.frame.src=e,j())}function be(){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 ar(e){return s.nudgeEnabled=e!==!1,s.nudgeEnabled}function ye(e){if(s.frame!==null){if(I)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,er(),s.park.setAttribute("aria-hidden","true"),ye(e),n&&be(),j()}}function D(e){s.frame!==null&&(e!==void 0&&s.owner!==e||(s.owner=null,V(),ge(),s.park.setAttribute("aria-hidden","true"),ye(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 sr(){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:X,setParkStrategy:Ve,getParkStrategy:qe,preload:ee,dock:$,park:D,nudge:be,setNudgeEnabled:ar,destroy:sr});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 ir(e){return te.add(e),function(){te.delete(e)}}function lr(){return z}function se(){return i.useSyncExternalStore(ir,lr)}var or="/api",cr="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(or+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 xe(){}function Le(e){var r=typeof e.useSessions=="function"?e.useSessions:xe,n=typeof e.useWorkspaces=="function"?e.useWorkspaces:xe;return{sessions:r(function(t){return t}),workspaces:n(function(t){return t})}}function Ae(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 dr(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=I?"\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 ur(e){var r=se(),n=r.status,t=n!=null&&n.ok===!0&&n.running===!0,a=n!=null&&n.keepResident===!0,l=Le(e!=null?e:{}),o=K({sessions:l.sessions,workspaces:l.workspaces}),c=t?Ae(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 fr=".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}",we="dsh-code-server/styles";typeof document!="undefined"&&document.querySelector("style[data-dshcs="+JSON.stringify(we)+"]")===null&&(F=document.createElement("style"),F.setAttribute("data-dshcs",we),F.textContent=fr,document.head.appendChild(F));var F,ke="code-server",Ee="dsh-code-server-app",pr="dsh-code-server-app",vr="\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",hr=2500,mr=1e4,gr=1500;function br(e){var r=e!=null&&typeof e.size=="number"?e.size:16;return i.createElement("img",{src:cr,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 yr=B("");function xr(){var e=z.status;return e==null||typeof e.claimExtensions!="string"?yr:B(e.claimExtensions)}function wr(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=J(c)?null:U(c),f=Le(e),x=p!=null&&typeof p.sessionId=="string"?p.sessionId:void 0,v=K({sessions:f.sessions,workspaces:f.workspaces,sessionId:x!==void 0?x:e.sessionId}),w=i.useRef(!1),d=de(p,v),h=l!=null&&l.params!=null&&typeof l.params.line=="number"?l.params.line:null,m=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=pe(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==="")&&m.current!==v){var b=m.current!==void 0;m.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",h===null?{file:d}:{file:d,line:h}).catch(function(){})},[o,d,h]),i.createElement("div",{className:"dshcs-tabroot","data-code-server-tab":"body",ref:P},i.createElement(dr,{status:a,pageUrl:Ae(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 kr(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:Ee,kind:ke,priority:"extension",patterns:["dsh-resource://file/**"],canOpen:function(a){return ue(U(a),xr())},title:function(a){if(J(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:br}]})},"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:Ee},wr)})},"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="+ke+")"),!0}var Er=".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}",Sr="dsh-code-server/Card.module.css";function Cr(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)}}Cr(Sr,Er);function Nr(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 Se(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 Or(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 Ce(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(Nr,{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 Te(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(me());if(i.useEffect(function(){return he(function(g){w(g)})},[]),i.useEffect(function(){if(r===void 0||typeof r.subscribe!="function")return;function g(){try{t(r.getSnapshot())}catch(Hr){}}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:{},h=n.user,m={keepResident:d.keepResident!==!1,claimExtensions:typeof d.claimExtensions=="string"?d.claimExtensions:R,fullscreenOnOpen:d.fullscreenOnOpen!==!1};if(x!=null&&x.sidebarUi==="legacy")return i.createElement(Ce,{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=h!=null&&Object.prototype.hasOwnProperty.call(h,"keepResident"),Y=h!=null&&Object.prototype.hasOwnProperty.call(h,"claimExtensions"),P=h!=null&&Object.prototype.hasOwnProperty.call(h,"fullscreenOnOpen"),C=a!==null&&(a.keepResident!==m.keepResident||A(a.claimExtensions)!==A(m.claimExtensions)||a.fullscreenOnOpen!==m.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:m;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):R),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(Or,{value:a!==null?a.claimExtensions:m.claimExtensions,disabled:n.writable!==!0,placeholder:R,onChange:function(g){l(function(k){return Object.assign({},k!==null?k:m,{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}},"\u5B9E\u9645\u89C4\u5219:"+fe(a!==null?a.claimExtensions:m.claimExtensions)+(A(a!==null?a.claimExtensions:m.claimExtensions)!==(a!==null?a.claimExtensions:m.claimExtensions)?"(\u4FDD\u5B58\u540E\u5F52\u4E00\u5316)":"")+" \xB7 \u9ED8\u8BA4 "+R)),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(Se,{checked:a!==null?a.fullscreenOnOpen:m.fullscreenOnOpen,disabled:n.writable!==!0,onChange:function(g){l(function(k){return Object.assign({},k!==null?k:m,{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(Se,{checked:a!==null?a.keepResident:m.keepResident,disabled:n.writable!==!0,onChange:function(g){l(function(k){return Object.assign({},k!==null?k:m,{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}},I?"\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(Ce,{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 Lr(e){return e!=null&&e.view==="summary"?vr:i.createElement(Te,Object.assign({},e,{seat:"bundle-config"}))}var Ne=900,u={rev:-1,open:!1,mounted:!1,pending:null,el:null,body:null,title:null,timer:null,loading:!1};function Ar(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"&&Me()}}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 Me(){u.open=!1,u.el!==null&&(u.el.style.display="none"),y("/code-server/ask/close",{}).catch(function(){})}function Re(){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(){Me()}),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 Ie="dshcs.ask.bundle",Tr=900*1e3,O=null;function ae(){try{var e=window.sessionStorage.getItem(Ie);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)>Tr?null:{css:r.css,js:r.js}}catch(n){return null}}function je(e){try{window.sessionStorage.setItem(Ie,JSON.stringify({at:Date.now(),css:e.css,js:e.js}))}catch(r){}}function Mr(){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},je(O),console.log("[code-server] ask bundle preloaded ("+Math.round((r.js.length+r.css.length)/1024)+"KB)"))}).catch(function(){})}}function Rr(){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,je(n)),n==null||typeof n.js!="string"){G(n!=null&&n.error?n.error:"\u9762\u677F\u4EA7\u7269\u4E0D\u53EF\u7528");return}if(Re(),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:Ar}};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 Oe(){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?(Re(),u.el.style.display="block",u.title!==null&&(u.title.textContent=e.contextText||"\u6765\u81EA\u7F16\u8F91\u5668"),u.open=!0,Rr(),u.mounted&&T(!0)):u.el!==null&&(u.el.style.display="none",u.open=!1))}).catch(function(){})}function Ir(){u.timer===null&&(u.timer=setInterval(Oe,Ne),setTimeout(Oe,800),setTimeout(Mr,3e3),console.log("[code-server] ask dialog poller started (every "+Ne+"ms)"))}function jr(e){try{Dr(e),Ir()}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 Dr(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:pr,inject:function(){return{scope:t}}},Lr)),r.inject("settings.plugin.item",()=>r.register({name:"settings.plugin.item",key:"code-server",label:"Code Server",inject:function(){return{scope:t}}},Te));var a=!1;function l(d,h){if(!a){a=!0,x();var m=!1;try{m=kr(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 "+h+"):\u64A4\u9500\u65E7\u7248 DSH \u5224\u5B9A"),y("/code-server/ui-mode",{sidebar:!0}).catch(function(){})),L({sidebarUi:"modern",sidebarRegisterFailed:m!==!0}),r.inject("shell.overlay",()=>r.register({name:"shell.overlay",id:"code-server",order:70,label:"Code Server"},E=>i.createElement(ur,E))),console.log("[code-server] client registered via "+h+": sidebar tab="+m+"(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"))},gr);return}if(v!==!0){o(!0);return}c=setTimeout(function(){a||o(!1)},hr),p=setTimeout(function(){a||o(!0)},mr)}var zr=["slots","settingsScope"],Pr="code-server";
|
|
4
4
|
return module.exports;}});
|
|
5
5
|
|
package/lib/dsh-resolve.mjs
CHANGED
|
@@ -1,32 +1,125 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* lib/dsh-resolve.mjs — 从 DSH 部署里解析 DSH 自己的包(0.3.0)。
|
|
2
|
+
* lib/dsh-resolve.mjs — 从 DSH 部署里解析 DSH 自己的包(0.3.0;0.3.49 起位置表按平台铺开)。
|
|
3
3
|
*
|
|
4
4
|
* 插件**不**把 `@deepseek-ai/*` 写进 `dependencies`:它们是 DSH 的一部分,版本交给部署决定
|
|
5
|
-
* (与 schemastery 在 `lib/index.js` 顶部的同一决策)。常规 import
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* (与 schemastery 在 `lib/index.js` 顶部的同一决策)。常规 import 失败时按下面的位置表回退,
|
|
6
|
+
* 找到第一个**真的存在** `@deepseek-ai/dsh/package.json` 的目录,用它建一个 require。
|
|
7
|
+
*
|
|
8
|
+
* 位置表分三类(顺序即优先级,不猜、不静默降级 —— 全都不在就是解析失败):
|
|
9
|
+
* ① **正在跑的这份部署**:插件的宿主进程就是 CLI 拉起来的,`process.argv[1]` 附近通常能直接
|
|
10
|
+
* `require.resolve('@deepseek-ai/dsh/package.json')`(desktop 的 host 子进程、SDK 形态都吃这条);
|
|
11
|
+
* ② **各平台的「全局装」布局**:Windows `%APPDATA%\npm`、`npm --prefix`(`~/.npm-global`,
|
|
12
|
+
* release.yml 的 Linux 安装冒烟腿用的就是这个)、pnpm global、nvm、系统 `/usr/local|/usr`;
|
|
13
|
+
* ③ **`$DSH_HOME` 的 profile 层**:DSH 每次 boot 会在 `profiles/node_modules` heal 出 junction,
|
|
14
|
+
* 某些形态下某个 profile 自己那份也在。
|
|
15
|
+
*
|
|
16
|
+
* 为什么位置表必须铺开(0.3.48 → 0.3.49 的实测):只认 ① ②里的 Windows 一条与 ③ 时,
|
|
17
|
+
* 在 **Linux CI** 上(CLI 装到 `~/.npm-global`)整条链都落空 ⇒ 插件解析不到 schemastery ⇒
|
|
18
|
+
* 安装冒烟 ④「已安装的 lib/index.js 可加载」直接抛错;而真实 Linux 用户(nvm / 自定义 prefix /
|
|
19
|
+
* pnpm global)是同一类布局,只是本机遇不到而已。
|
|
9
20
|
*
|
|
10
21
|
* 注意解析出来的模块与 DSH host 用的是**同一份**(同一路径的 require 缓存),所以
|
|
11
22
|
* `createUserMessage` 出来的对象能直接喂给 `agent.followup()`。
|
|
12
23
|
*/
|
|
13
24
|
|
|
14
25
|
import * as fs from 'node:fs';
|
|
26
|
+
import * as os from 'node:os';
|
|
15
27
|
import * as path from 'node:path';
|
|
16
28
|
import { createRequire } from 'node:module';
|
|
17
29
|
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
|
|
30
|
+
/** 部署入口在某个 node_modules 下的尾巴。 */
|
|
31
|
+
const DSH_ENTRY_SEGMENTS = ['@deepseek-ai', 'dsh', 'package.json'];
|
|
32
|
+
|
|
33
|
+
/** 目录里的直接子目录(含符号链接/junction;只扫一层,数量封顶;读不到就是空表)。 */
|
|
34
|
+
function childDirs(dir, limit = 64) {
|
|
35
|
+
try {
|
|
36
|
+
return fs.readdirSync(dir, { withFileTypes: true })
|
|
37
|
+
.filter((entry) => entry.isDirectory() || entry.isSymbolicLink())
|
|
38
|
+
.slice(0, limit)
|
|
39
|
+
.map((entry) => path.join(dir, entry.name));
|
|
40
|
+
} catch {
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** 家目录:环境变量优先(测试/CI 可覆盖),再退 os.homedir()。 */
|
|
46
|
+
function homeDir() {
|
|
47
|
+
const fromEnv = process.env.HOME ?? process.env.USERPROFILE;
|
|
48
|
+
if (typeof fromEnv === 'string' && fromEnv !== '') return fromEnv;
|
|
49
|
+
try {
|
|
50
|
+
return os.homedir();
|
|
51
|
+
} catch {
|
|
52
|
+
return '';
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 部署位置表(顺序即优先级;调用方逐个试"文件在不在")。
|
|
58
|
+
* 导出仅为单测:正常用法见 `dshEntry()` / `dshRequire()`。
|
|
59
|
+
*/
|
|
60
|
+
export function dshEntryCandidates() {
|
|
61
|
+
const out = [];
|
|
62
|
+
/** 把一个 node_modules 目录拼成部署入口候选。 */
|
|
63
|
+
const entryOf = (nodeModulesDir) => {
|
|
64
|
+
if (typeof nodeModulesDir !== 'string' || nodeModulesDir === '') return;
|
|
65
|
+
out.push(path.join(nodeModulesDir, ...DSH_ENTRY_SEGMENTS));
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// ① 正在跑的这份部署:从 CLI 入口(argv[1])与 node 二进制(execPath)各自向上解析一次。
|
|
69
|
+
for (const base of [process.argv[1], process.execPath]) {
|
|
70
|
+
if (typeof base !== 'string' || base === '') continue;
|
|
71
|
+
try {
|
|
72
|
+
const resolved = createRequire(path.resolve(base)).resolve('@deepseek-ai/dsh/package.json');
|
|
73
|
+
entryOf(path.dirname(resolved));
|
|
74
|
+
} catch {
|
|
75
|
+
// 这个入口附近没有部署副本 → 下一个候选
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// ② 各平台的「全局装」布局。
|
|
80
|
+
const home = homeDir();
|
|
21
81
|
const appData = process.env.APPDATA;
|
|
22
82
|
if (typeof appData === 'string' && appData !== '') {
|
|
23
|
-
|
|
83
|
+
// Windows 用户级 npm 全局(本机日常形态;保持在最前面,行为不变)
|
|
84
|
+
entryOf(path.join(appData, 'npm', 'node_modules'));
|
|
85
|
+
}
|
|
86
|
+
if (home !== '') {
|
|
87
|
+
// npm --prefix <用户目录>(release.yml 的 Linux 安装冒烟腿;也是常见的"免 sudo 全局装")
|
|
88
|
+
entryOf(path.join(home, '.npm-global', 'lib', 'node_modules'));
|
|
24
89
|
}
|
|
25
|
-
const
|
|
26
|
-
if (typeof
|
|
27
|
-
|
|
90
|
+
const pnpmHome = process.env.PNPM_HOME;
|
|
91
|
+
if (typeof pnpmHome === 'string' && pnpmHome !== '') {
|
|
92
|
+
entryOf(path.join(pnpmHome, 'node_modules'));
|
|
93
|
+
// pnpm 的全局包在 <PNPM_HOME>/global/<大版本>/node_modules
|
|
94
|
+
for (const dir of childDirs(path.join(pnpmHome, 'global'))) entryOf(path.join(dir, 'node_modules'));
|
|
95
|
+
}
|
|
96
|
+
if (home !== '') {
|
|
97
|
+
// pnpm global 的默认根(未设 PNPM_HOME 时)
|
|
98
|
+
for (const dir of childDirs(path.join(home, '.local', 'share', 'pnpm', 'global'))) {
|
|
99
|
+
entryOf(path.join(dir, 'node_modules'));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const nvmDir = process.env.NVM_DIR ?? (home !== '' ? path.join(home, '.nvm') : '');
|
|
103
|
+
if (nvmDir !== '') {
|
|
104
|
+
for (const dir of childDirs(path.join(nvmDir, 'versions', 'node'))) {
|
|
105
|
+
entryOf(path.join(dir, 'lib', 'node_modules'));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// 系统级(macOS / Linux 发行版包;Windows 上是无意义路径,existsSync 直接 false)
|
|
109
|
+
entryOf('/usr/local/lib/node_modules');
|
|
110
|
+
entryOf('/usr/lib/node_modules');
|
|
111
|
+
|
|
112
|
+
// ③ $DSH_HOME 的 profile 层。
|
|
113
|
+
const dshHome = process.env.DSH_HOME;
|
|
114
|
+
if (typeof dshHome === 'string' && dshHome !== '') {
|
|
115
|
+
const profiles = path.join(dshHome, 'profiles');
|
|
116
|
+
entryOf(path.join(profiles, 'node_modules'));
|
|
117
|
+
for (const dir of childDirs(profiles)) {
|
|
118
|
+
if (path.basename(dir) === 'node_modules') continue;
|
|
119
|
+
entryOf(path.join(dir, 'node_modules'));
|
|
120
|
+
}
|
|
28
121
|
}
|
|
29
|
-
return
|
|
122
|
+
return out;
|
|
30
123
|
}
|
|
31
124
|
|
|
32
125
|
/** 第一个存在的 DSH 入口(诊断用;不存在返回 null)。 */
|
package/lib/index.js
CHANGED
|
@@ -61,13 +61,12 @@ import { createApprovalBoard, createApprovalInterceptor, DEFAULT_HOLD_MS, PANEL_
|
|
|
61
61
|
// schemastery 由 DSH 部署自带(官方核心依赖),仿 auto-open-web 的解析策略:
|
|
62
62
|
// 常规 import 优先,不可用时回退到 DSH 部署里的那一份。
|
|
63
63
|
//
|
|
64
|
-
// 回退走 lib/dsh-resolve.mjs 的 dshRequire() ——
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
//
|
|
68
|
-
//
|
|
69
|
-
//
|
|
70
|
-
// 两条都拿不到时才抛错(不是静默降级:设置 schema 建不出来,插件没有意义)。
|
|
64
|
+
// 回退走 lib/dsh-resolve.mjs 的 dshRequire() —— 部署位置表就一份(0.3.49 起按平台铺开):
|
|
65
|
+
// 正在跑的部署(argv[1]/execPath 向上解析)、Windows `%APPDATA%\npm`、`npm --prefix`
|
|
66
|
+
// (`~/.npm-global`)、pnpm global、nvm、系统 `/usr/local|/usr`、以及 `$DSH_HOME` 的 profile 层。
|
|
67
|
+
// 这些布局**都得在**:0.3.47 的 Windows 冒烟只证明过 `%APPDATA%\npm` 那条,0.3.48 的 Linux 冒烟
|
|
68
|
+
// (CLI 装到 `~/.npm-global`)就把"表太窄"当场打出来了 —— 解析不到 schemastery 时整个插件不可用。
|
|
69
|
+
// 全都拿不到时才抛错(不是静默降级:设置 schema 建不出来,插件没有意义)。
|
|
71
70
|
let z = null;
|
|
72
71
|
try {
|
|
73
72
|
z = (await import('@deepseek-ai/schemastery')).default;
|
package/lib/native.js
CHANGED
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
// 实测证据与复现命令见 docs/desktop-first-install-root-cause.md。
|
|
17
17
|
//
|
|
18
18
|
// 「原名 → 真包」的表由打包期写进 lib/vendored.json(随包发布),本模块运行时只读它。
|
|
19
|
+
// 平台专属条目还带一个 `targets` 白名单(打包期由 scripts/repack-platforms.json 推导):
|
|
20
|
+
// 只属于别的平台的模块(如 Linux 上的 @vscode/windows-registry)**不进本平台的清单** ——
|
|
21
|
+
// 它对应的 `-linux-x64` 子包永远不会存在,报成「缺包」只会误导环境检测卡片。
|
|
19
22
|
//
|
|
20
23
|
// 本模块只做四件事:
|
|
21
24
|
// 1. 读 lib/vendored.json → 本平台期望可解析的「原名 → 真包」表;
|
|
@@ -36,6 +39,17 @@ export function platformKey(platform = process.platform, arch = process.arch) {
|
|
|
36
39
|
return `${platform}-${arch}`;
|
|
37
40
|
}
|
|
38
41
|
|
|
42
|
+
/** 某个条目是否适用于给定平台。
|
|
43
|
+
* 平台无关的模块哪儿都适用;平台专属的看它的每模块 `targets` 白名单
|
|
44
|
+
* ——例如 `@vscode/windows-registry` 只在 win32-* 里有子包,在 Linux 上压根不该去找
|
|
45
|
+
* `@jinsiyu/dshcs-vscode-windows-registry-linux-x64`(那名字永远不会存在)。
|
|
46
|
+
* `targets` 缺席 = 全部目标(兼容 0.3.47 及更早写出的旧表)。 */
|
|
47
|
+
export function vendoredAppliesTo(entry, platform = process.platform, arch = process.arch) {
|
|
48
|
+
if (entry.platform !== true) return true;
|
|
49
|
+
const targets = Array.isArray(entry.targets) ? entry.targets : null;
|
|
50
|
+
return targets === null || targets.includes(platformKey(platform, arch));
|
|
51
|
+
}
|
|
52
|
+
|
|
39
53
|
/** 读重打包表。
|
|
40
54
|
* @returns {{scope:string, targets:string[], modules:{alias:string,package:string,version?:string,platform?:boolean}[]}} */
|
|
41
55
|
export function readVendoredTable() {
|
|
@@ -62,9 +76,12 @@ export function vendoredPackageName(entry, platform = process.platform, arch = p
|
|
|
62
76
|
}
|
|
63
77
|
|
|
64
78
|
/** 本平台期望装在依赖图里的重打包子包(原名 + 真名),按原名排序。
|
|
79
|
+
* **不含**只属于其它平台的模块(见 vendoredAppliesTo):它们的子包永远不会存在,
|
|
80
|
+
* 报成「缺包」只会误导环境检测卡片。
|
|
65
81
|
* @returns {{alias:string, packageName:string, version:string|null, platform:boolean}[]} */
|
|
66
82
|
export function vendoredEntries(platform = process.platform, arch = process.arch) {
|
|
67
83
|
return readVendoredTable().modules
|
|
84
|
+
.filter((m) => vendoredAppliesTo(m, platform, arch))
|
|
68
85
|
.map((m) => ({
|
|
69
86
|
alias: m.alias,
|
|
70
87
|
packageName: vendoredPackageName(m, platform, arch),
|
|
@@ -74,6 +91,14 @@ export function vendoredEntries(platform = process.platform, arch = process.arch
|
|
|
74
91
|
.sort((a, b) => a.alias.localeCompare(b.alias));
|
|
75
92
|
}
|
|
76
93
|
|
|
94
|
+
/** 本平台不适用的重打包模块(别名),给环境检测卡片用一句话解释「为什么这些不在清单里」。 */
|
|
95
|
+
export function vendoredNotApplicable(platform = process.platform, arch = process.arch) {
|
|
96
|
+
return readVendoredTable().modules
|
|
97
|
+
.filter((m) => !vendoredAppliesTo(m, platform, arch))
|
|
98
|
+
.map((m) => m.alias)
|
|
99
|
+
.sort((a, b) => a.localeCompare(b));
|
|
100
|
+
}
|
|
101
|
+
|
|
77
102
|
/** 解析原生模块时的锚点目录:
|
|
78
103
|
* ① code-server 运行根(树自带 node_modules);
|
|
79
104
|
* ② 插件包根 —— 重打包子包挂在插件依赖上(profile 根或插件自己的 node_modules),
|
|
@@ -266,7 +291,7 @@ export function ensureRuntimeLayout() {
|
|
|
266
291
|
|
|
267
292
|
/** 本平台预编译原生包的状态汇总(环境检测卡片用)。
|
|
268
293
|
* @returns {{name:string, source:'package'|null, version:string|null, modules:number, packages:number,
|
|
269
|
-
* resolved:number, missing:string[], missingPackages:string[]}} */
|
|
294
|
+
* resolved:number, missing:string[], missingPackages:string[], notApplicable:string[]}} */
|
|
270
295
|
export function nativeRuntimeStatus(platform = process.platform, arch = process.arch) {
|
|
271
296
|
const table = readVendoredTable();
|
|
272
297
|
const entries = vendoredEntries(platform, arch);
|
|
@@ -286,5 +311,7 @@ export function nativeRuntimeStatus(platform = process.platform, arch = process.
|
|
|
286
311
|
resolved: resolved.length,
|
|
287
312
|
missing,
|
|
288
313
|
missingPackages: missingPackages.map((entry) => entry.packageName),
|
|
314
|
+
// 只属于其它平台的模块(如 Linux 上的 windows-*):不计入 modules/missing,单独列出来解释
|
|
315
|
+
notApplicable: vendoredNotApplicable(platform, arch),
|
|
289
316
|
};
|
|
290
317
|
}
|
package/lib/vendored.json
CHANGED
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
"generatedBy": "scripts/vendor-repacks.mjs",
|
|
4
4
|
"scope": "@jinsiyu",
|
|
5
5
|
"targets": [
|
|
6
|
+
"win32-x64",
|
|
6
7
|
"win32-arm64",
|
|
7
|
-
"
|
|
8
|
+
"linux-x64",
|
|
9
|
+
"linux-arm64"
|
|
8
10
|
],
|
|
9
11
|
"modules": [
|
|
10
12
|
{
|
|
@@ -21,7 +23,13 @@
|
|
|
21
23
|
"alias": "@vscode/deviceid",
|
|
22
24
|
"package": "@jinsiyu/dshcs-vscode-deviceid",
|
|
23
25
|
"version": "0.1.5",
|
|
24
|
-
"platform": true
|
|
26
|
+
"platform": true,
|
|
27
|
+
"targets": [
|
|
28
|
+
"win32-x64",
|
|
29
|
+
"win32-arm64",
|
|
30
|
+
"linux-x64",
|
|
31
|
+
"linux-arm64"
|
|
32
|
+
]
|
|
25
33
|
},
|
|
26
34
|
{
|
|
27
35
|
"alias": "@vscode/fs-copyfile",
|
|
@@ -32,7 +40,13 @@
|
|
|
32
40
|
"alias": "@vscode/native-watchdog",
|
|
33
41
|
"package": "@jinsiyu/dshcs-vscode-native-watchdog",
|
|
34
42
|
"version": "1.4.6",
|
|
35
|
-
"platform": true
|
|
43
|
+
"platform": true,
|
|
44
|
+
"targets": [
|
|
45
|
+
"win32-x64",
|
|
46
|
+
"win32-arm64",
|
|
47
|
+
"linux-x64",
|
|
48
|
+
"linux-arm64"
|
|
49
|
+
]
|
|
36
50
|
},
|
|
37
51
|
{
|
|
38
52
|
"alias": "@vscode/proxy-agent",
|
|
@@ -43,31 +57,55 @@
|
|
|
43
57
|
"alias": "@vscode/spdlog",
|
|
44
58
|
"package": "@jinsiyu/dshcs-vscode-spdlog",
|
|
45
59
|
"version": "0.15.8",
|
|
46
|
-
"platform": true
|
|
60
|
+
"platform": true,
|
|
61
|
+
"targets": [
|
|
62
|
+
"win32-x64",
|
|
63
|
+
"win32-arm64",
|
|
64
|
+
"linux-x64",
|
|
65
|
+
"linux-arm64"
|
|
66
|
+
]
|
|
47
67
|
},
|
|
48
68
|
{
|
|
49
69
|
"alias": "@vscode/sqlite3",
|
|
50
70
|
"package": "@jinsiyu/dshcs-vscode-sqlite3",
|
|
51
71
|
"version": "5.1.12-vscode",
|
|
52
|
-
"platform": true
|
|
72
|
+
"platform": true,
|
|
73
|
+
"targets": [
|
|
74
|
+
"win32-x64",
|
|
75
|
+
"win32-arm64",
|
|
76
|
+
"linux-x64",
|
|
77
|
+
"linux-arm64"
|
|
78
|
+
]
|
|
53
79
|
},
|
|
54
80
|
{
|
|
55
81
|
"alias": "@vscode/windows-ca-certs",
|
|
56
82
|
"package": "@jinsiyu/dshcs-vscode-windows-ca-certs",
|
|
57
83
|
"version": "0.3.4",
|
|
58
|
-
"platform": true
|
|
84
|
+
"platform": true,
|
|
85
|
+
"targets": [
|
|
86
|
+
"win32-x64",
|
|
87
|
+
"win32-arm64"
|
|
88
|
+
]
|
|
59
89
|
},
|
|
60
90
|
{
|
|
61
91
|
"alias": "@vscode/windows-process-tree",
|
|
62
92
|
"package": "@jinsiyu/dshcs-vscode-windows-process-tree",
|
|
63
93
|
"version": "0.8.0",
|
|
64
|
-
"platform": true
|
|
94
|
+
"platform": true,
|
|
95
|
+
"targets": [
|
|
96
|
+
"win32-x64",
|
|
97
|
+
"win32-arm64"
|
|
98
|
+
]
|
|
65
99
|
},
|
|
66
100
|
{
|
|
67
101
|
"alias": "@vscode/windows-registry",
|
|
68
102
|
"package": "@jinsiyu/dshcs-vscode-windows-registry",
|
|
69
103
|
"version": "1.2.0",
|
|
70
|
-
"platform": true
|
|
104
|
+
"platform": true,
|
|
105
|
+
"targets": [
|
|
106
|
+
"win32-x64",
|
|
107
|
+
"win32-arm64"
|
|
108
|
+
]
|
|
71
109
|
},
|
|
72
110
|
{
|
|
73
111
|
"alias": "cpu-features",
|
|
@@ -78,7 +116,13 @@
|
|
|
78
116
|
"alias": "kerberos",
|
|
79
117
|
"package": "@jinsiyu/dshcs-kerberos",
|
|
80
118
|
"version": "2.1.1-dshcs.1",
|
|
81
|
-
"platform": true
|
|
119
|
+
"platform": true,
|
|
120
|
+
"targets": [
|
|
121
|
+
"win32-x64",
|
|
122
|
+
"win32-arm64",
|
|
123
|
+
"linux-x64",
|
|
124
|
+
"linux-arm64"
|
|
125
|
+
]
|
|
82
126
|
},
|
|
83
127
|
{
|
|
84
128
|
"alias": "koffi",
|