@dsh-sup/dsh-core-linux-x64 0.1.6-BETA.12 → 0.1.6-BETA.13

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.
@@ -0,0 +1 @@
1
+ import{N as e,O as t,R as n,a as r}from"./supervisor-BbSavtNN.js";var i=e(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),a=e(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]);function o(){let e=String(window.location.hostname||``).toLowerCase();return e===`localhost`||e===`[::1]`||e===`::1`||/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(e)}function s(e){try{return window.open(e,`_blank`,`noopener,noreferrer`)?{ok:!0,confirmed:!0,handedOff:!1,url:e,message:`已在新标签打开`,evidence:{via:`window`}}:{ok:!1,url:e,error:`浏览器拦截了新窗口,请允许弹窗或复制下方地址打开`}}catch(t){return{ok:!1,url:e,error:String(t)}}}async function c(e){return e?o()?r.envOpenUrl(e):s(e):{ok:!1,error:`没有可打开的地址`}}function l(e){if(!e||typeof e!=`object`)return null;let t=typeof e.bin==`string`?e.bin.split(/[\\/]/).pop():null,n=[];t?n.push(t):e.via===`none`&&n.push(`未定出启动对象`),e.via&&n.push(e.via),e.ownsWindow===!1&&n.push(`退出码不作证据`),e.exitCode!==void 0&&e.exitCode!==null?n.push(`exit `+String(e.exitCode)):e.exitSignal?n.push(`signal `+e.exitSignal):e.error&&n.push(String(e.error));let r=e.diagnostics;if(r&&typeof r==`object`){n.push(`默认项来源 `+(r.default&&r.default.source||`未读出`));let e=Array.isArray(r.found)?r.found:[];n.push(`候选 `+String(e.length)+` 个`+(e.length?`:`+e.map(e=>e.name||e.via||`?`).join(`、`):``));let t=Array.isArray(r.probed)?r.probed:[];!e.length&&t.length&&n.push(`探测读数:`+t.map(e=>e.source).join(`、`))}return n.length?n.join(` | `):null}function u(e){let t=typeof e?.url==`string`&&e.url?e.url:null,n=l(e?.evidence);return!e||e.ok!==!0?{tier:`failed`,url:t,detail:n,title:e&&e.error||`无法调起系统浏览器,请手动打开下方地址`}:e.confirmed===!0?{tier:`confirmed`,url:t,detail:n,title:e.message||`已在系统浏览器打开`}:{tier:`handed-off`,url:t,detail:n,title:`已把地址交给系统,但没拿到窗口出现的证据`+(t?`:没看到浏览器就点下方地址`:``)}}var d=n();function f({url:e}){async function n(){await h(()=>c(e))}function r(){let n=()=>t.error(`复制失败,请手动选中地址`);navigator.clipboard?.writeText?navigator.clipboard.writeText(e).then(()=>t.success(`地址已复制`),n):n()}return(0,d.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,d.jsx)(`code`,{className:`min-w-0 flex-1 truncate rounded bg-muted px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground`,children:e}),(0,d.jsx)(`button`,{type:`button`,onClick:()=>void n(),title:`在系统浏览器中打开该地址`,className:`shrink-0 text-muted-foreground transition-colors hover:text-foreground`,children:(0,d.jsx)(a,{className:`size-3.5`})}),(0,d.jsx)(`button`,{type:`button`,onClick:r,title:`复制地址`,className:`shrink-0 text-muted-foreground transition-colors hover:text-foreground`,children:(0,d.jsx)(i,{className:`size-3.5`})})]})}function p({url:e,detail:t}){return(0,d.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[e?(0,d.jsx)(f,{url:e}):null,t?(0,d.jsx)(`div`,{className:`break-all font-mono text-[10px] text-muted-foreground`,children:t}):null]})}function m(e){let{tier:n,url:r,title:i,detail:a}=u(e),o=n===`confirmed`?null:a,s={description:r||o?(0,d.jsx)(p,{url:r,detail:o}):void 0,duration:n===`confirmed`?3e3:2e4};n===`confirmed`?t.success(i,s):n===`handed-off`?t.warning(i,s):t.error(i,s)}async function h(e){try{let t=await e();return m(t),t??null}catch(e){let t=e.body,n=t&&typeof t==`object`?t:{ok:!1,error:e instanceof Error?e.message:String(e)};return m(n),n}}export{i,c as n,a as r,h as t};