@av-pi-studio/web-client 0.0.113 → 0.0.114
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web/assets/{BinaryFallbackViewer-BH2FpXPq.js → BinaryFallbackViewer-Bkpz8WV_.js} +1 -1
- package/dist/web/assets/{ChatPanel-C49fPd0n.css → ChatPanel-DtQ_LR4Y.css} +1 -1
- package/dist/web/assets/ChatPanel-kbXAj_zX.js +9 -0
- package/dist/web/assets/{CodeView-nWhbxYNo.js → CodeView-BGmM4Xdz.js} +1 -1
- package/dist/web/assets/{FilePanel-DuSXRbB3.js → FilePanel-_4YNsvO0.js} +1 -1
- package/dist/web/assets/{HtmlViewer-Bp9FVmsO.js → HtmlViewer-DFstCiC5.js} +1 -1
- package/dist/web/assets/{ImageViewer-CGkHIlbr.js → ImageViewer-BQxrdTlE.js} +1 -1
- package/dist/web/assets/{MarkdownFileViewer-Jd18lpAb.js → MarkdownFileViewer-BGovxRT6.js} +1 -1
- package/dist/web/assets/{ModelProvidersPanel-BGnWcyq9.js → ModelProvidersPanel-DfQW9oP8.js} +1 -1
- package/dist/web/assets/{MoleculeViewerPanel-gr1xhI3B.js → MoleculeViewerPanel-u97-c07_.js} +1 -1
- package/dist/web/assets/{PdfViewer-Chvwi-vw.js → PdfViewer-BXC1UMNj.js} +1 -1
- package/dist/web/assets/{SettingsDialog-TBdq-cJW.js → SettingsDialog-CINzuD1W.js} +1 -1
- package/dist/web/assets/{SkillsPanel-BPOQfm8q.js → SkillsPanel-Mfgze4oy.js} +1 -1
- package/dist/web/assets/{TerminalPanel-BHWw9ZUE.js → TerminalPanel-CyyoVOMa.js} +1 -1
- package/dist/web/assets/{TextViewer-d0xfOD_a.js → TextViewer-C6Lp03uL.js} +1 -1
- package/dist/web/assets/{VideoViewer-DhoCw-I5.js → VideoViewer-hV_glBDT.js} +1 -1
- package/dist/web/assets/{ViewersPanel-DKQeezkV.js → ViewersPanel-ZyLSqRdr.js} +1 -1
- package/dist/web/assets/{href-resolution-CKrMBdbX.js → href-resolution-DWAlGpSI.js} +1 -1
- package/dist/web/assets/index-DjUHduQf.js +19 -0
- package/dist/web/assets/{markdown-BWyDQ88Y.js → markdown-ZgA079Q9.js} +1 -1
- package/dist/web/assets/{use-file-download-IryqzIsu.js → use-file-download-Bc8Kby2g.js} +1 -1
- package/dist/web/assets/{use-file-watch-CKy-EMBA.js → use-file-watch-hu9dEdvA.js} +1 -1
- package/dist/web/assets/{use-provider-auth-list-CkrX1tsv.js → use-provider-auth-list-BDqjbQx-.js} +1 -1
- package/dist/web/assets/{vendor-icons-FMicTc5d.js → vendor-icons-Dq3K7TC5.js} +67 -62
- package/dist/web/index.html +2 -2
- package/package.json +8 -3
- package/dist/web/assets/ChatPanel-IwIp9TyM.js +0 -8
- package/dist/web/assets/index-BbSAfLF_.js +0 -19
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as me,r as v,j as l}from"./vendor-react-DQUAl2K8.js";import{af as we,N as ye}from"./vendor-DaF96HbP.js";import{u as oe,r as _t,D as ie,B as G,S as It,q as Ce,s as Ee,a8 as Be,a9 as Ne,aa as Se,I as Ie,E as Lt}from"./index-BbSAfLF_.js";import{a as Re}from"./vendor-query-i7fr__Xm.js";import{u as O}from"./provider-auth-store-9hsJ07X1.js";import{r as se,f as be,s as Ae}from"./vendor-icons-FMicTc5d.js";import"./vendor-overlays-3MkedLFU.js";import"./vendor-dnd-CayJj8TC.js";function _e(t,n){return{provider:t,authType:n,phase:"starting",statusLines:[]}}function Le(t,n,i){return{...t,phase:t.phase==="starting"?"waiting":t.phase,statusLines:[...t.statusLines,{kind:"info",message:n,links:i}]}}function Te(t,n){const i=t.statusLines.filter(r=>r.kind!=="progress");return{...t,phase:t.phase==="starting"?"waiting":t.phase,statusLines:[...i,{kind:"progress",message:n}]}}function Me(t,n,i){return{...t,authUrl:{url:n,instructions:i}}}function Pe(t,n,i,r,e){return{...t,deviceCode:{userCode:n,verificationUri:i,intervalSeconds:r,expiresInSeconds:e}}}function ve(t,n){return{...t,phase:"prompt",prompt:n}}function je(t,n){var i;return((i=t.prompt)==null?void 0:i.promptId)!==n?t:{...t,phase:"waiting",prompt:void 0}}function De(t,n,i){return{...t,phase:"done",result:{ok:n,error:i}}}function xe(t,n){if(t.phase==="done")return t;switch(n.kind){case"info":return Le(t,n.message,n.links);case"progress":return Te(t,n.message);case"auth_url":return Me(t,n.url,n.instructions);case"device_code":return Pe(t,n.userCode,n.verificationUri,n.intervalSeconds,n.expiresInSeconds);case"prompt":return ve(t,n);case"prompt_cancelled":return je(t,n.promptId);case"done":return De(t,n.ok,n.error)}}var V={},nt,Tt;function ke(){return Tt||(Tt=1,nt=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),nt}var rt={},U={},Mt;function F(){if(Mt)return U;Mt=1;let t;const n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return U.getSymbolSize=function(r){if(!r)throw new Error('"version" cannot be null or undefined');if(r<1||r>40)throw new Error('"version" should be in range from 1 to 40');return r*4+17},U.getSymbolTotalCodewords=function(r){return n[r]},U.getBCHDigit=function(i){let r=0;for(;i!==0;)r++,i>>>=1;return r},U.setToSJISFunction=function(r){if(typeof r!="function")throw new Error('"toSJISFunc" is not a valid function.');t=r},U.isKanjiModeEnabled=function(){return typeof t<"u"},U.toSJIS=function(r){return t(r)},U}var ot={},Pt;function Rt(){return Pt||(Pt=1,(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function n(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+i)}}t.isValid=function(r){return r&&typeof r.bit<"u"&&r.bit>=0&&r.bit<4},t.from=function(r,e){if(t.isValid(r))return r;try{return n(r)}catch{return e}}})(ot)),ot}var it,vt;function Ue(){if(vt)return it;vt=1;function t(){this.buffer=[],this.length=0}return t.prototype={get:function(n){const i=Math.floor(n/8);return(this.buffer[i]>>>7-n%8&1)===1},put:function(n,i){for(let r=0;r<i;r++)this.putBit((n>>>i-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(n){const i=Math.floor(this.length/8);this.buffer.length<=i&&this.buffer.push(0),n&&(this.buffer[i]|=128>>>this.length%8),this.length++}},it=t,it}var st,jt;function qe(){if(jt)return st;jt=1;function t(n){if(!n||n<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=n,this.data=new Uint8Array(n*n),this.reservedBit=new Uint8Array(n*n)}return t.prototype.set=function(n,i,r,e){const o=n*this.size+i;this.data[o]=r,e&&(this.reservedBit[o]=!0)},t.prototype.get=function(n,i){return this.data[n*this.size+i]},t.prototype.xor=function(n,i,r){this.data[n*this.size+i]^=r},t.prototype.isReserved=function(n,i){return this.reservedBit[n*this.size+i]},st=t,st}var at={},Dt;function Fe(){return Dt||(Dt=1,(function(t){const n=F().getSymbolSize;t.getRowColCoords=function(r){if(r===1)return[];const e=Math.floor(r/7)+2,o=n(r),s=o===145?26:Math.ceil((o-13)/(2*e-2))*2,a=[o-7];for(let u=1;u<e-1;u++)a[u]=a[u-1]-s;return a.push(6),a.reverse()},t.getPositions=function(r){const e=[],o=t.getRowColCoords(r),s=o.length;for(let a=0;a<s;a++)for(let u=0;u<s;u++)a===0&&u===0||a===0&&u===s-1||a===s-1&&u===0||e.push([o[a],o[u]]);return e}})(at)),at}var ut={},xt;function ze(){if(xt)return ut;xt=1;const t=F().getSymbolSize,n=7;return ut.getPositions=function(r){const e=t(r);return[[0,0],[e-n,0],[0,e-n]]},ut}var ct={},kt;function Ke(){return kt||(kt=1,(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const n={N1:3,N2:3,N3:40,N4:10};t.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(e){const o=e.size;let s=0,a=0,u=0,c=null,m=null;for(let E=0;E<o;E++){a=u=0,c=m=null;for(let S=0;S<o;S++){let h=e.get(E,S);h===c?a++:(a>=5&&(s+=n.N1+(a-5)),c=h,a=1),h=e.get(S,E),h===m?u++:(u>=5&&(s+=n.N1+(u-5)),m=h,u=1)}a>=5&&(s+=n.N1+(a-5)),u>=5&&(s+=n.N1+(u-5))}return s},t.getPenaltyN2=function(e){const o=e.size;let s=0;for(let a=0;a<o-1;a++)for(let u=0;u<o-1;u++){const c=e.get(a,u)+e.get(a,u+1)+e.get(a+1,u)+e.get(a+1,u+1);(c===4||c===0)&&s++}return s*n.N2},t.getPenaltyN3=function(e){const o=e.size;let s=0,a=0,u=0;for(let c=0;c<o;c++){a=u=0;for(let m=0;m<o;m++)a=a<<1&2047|e.get(c,m),m>=10&&(a===1488||a===93)&&s++,u=u<<1&2047|e.get(m,c),m>=10&&(u===1488||u===93)&&s++}return s*n.N3},t.getPenaltyN4=function(e){let o=0;const s=e.data.length;for(let u=0;u<s;u++)o+=e.data[u];return Math.abs(Math.ceil(o*100/s/5)-10)*n.N4};function i(r,e,o){switch(r){case t.Patterns.PATTERN000:return(e+o)%2===0;case t.Patterns.PATTERN001:return e%2===0;case t.Patterns.PATTERN010:return o%3===0;case t.Patterns.PATTERN011:return(e+o)%3===0;case t.Patterns.PATTERN100:return(Math.floor(e/2)+Math.floor(o/3))%2===0;case t.Patterns.PATTERN101:return e*o%2+e*o%3===0;case t.Patterns.PATTERN110:return(e*o%2+e*o%3)%2===0;case t.Patterns.PATTERN111:return(e*o%3+(e+o)%2)%2===0;default:throw new Error("bad maskPattern:"+r)}}t.applyMask=function(e,o){const s=o.size;for(let a=0;a<s;a++)for(let u=0;u<s;u++)o.isReserved(u,a)||o.xor(u,a,i(e,u,a))},t.getBestMask=function(e,o){const s=Object.keys(t.Patterns).length;let a=0,u=1/0;for(let c=0;c<s;c++){o(c),t.applyMask(c,e);const m=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(c,e),m<u&&(u=m,a=c)}return a}})(ct)),ct}var W={},Ut;function ae(){if(Ut)return W;Ut=1;const t=Rt(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],i=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return W.getBlocksCount=function(e,o){switch(o){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},W.getTotalCodewordsCount=function(e,o){switch(o){case t.L:return i[(e-1)*4+0];case t.M:return i[(e-1)*4+1];case t.Q:return i[(e-1)*4+2];case t.H:return i[(e-1)*4+3];default:return}},W}var lt={},Q={},qt;function Ve(){if(qt)return Q;qt=1;const t=new Uint8Array(512),n=new Uint8Array(256);return(function(){let r=1;for(let e=0;e<255;e++)t[e]=r,n[r]=e,r<<=1,r&256&&(r^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),Q.log=function(r){if(r<1)throw new Error("log("+r+")");return n[r]},Q.exp=function(r){return t[r]},Q.mul=function(r,e){return r===0||e===0?0:t[n[r]+n[e]]},Q}var Ft;function Oe(){return Ft||(Ft=1,(function(t){const n=Ve();t.mul=function(r,e){const o=new Uint8Array(r.length+e.length-1);for(let s=0;s<r.length;s++)for(let a=0;a<e.length;a++)o[s+a]^=n.mul(r[s],e[a]);return o},t.mod=function(r,e){let o=new Uint8Array(r);for(;o.length-e.length>=0;){const s=o[0];for(let u=0;u<e.length;u++)o[u]^=n.mul(e[u],s);let a=0;for(;a<o.length&&o[a]===0;)a++;o=o.slice(a)}return o},t.generateECPolynomial=function(r){let e=new Uint8Array([1]);for(let o=0;o<r;o++)e=t.mul(e,new Uint8Array([1,n.exp(o)]));return e}})(lt)),lt}var dt,zt;function He(){if(zt)return dt;zt=1;const t=Oe();function n(i){this.genPoly=void 0,this.degree=i,this.degree&&this.initialize(this.degree)}return n.prototype.initialize=function(r){this.degree=r,this.genPoly=t.generateECPolynomial(this.degree)},n.prototype.encode=function(r){if(!this.genPoly)throw new Error("Encoder not initialized");const e=new Uint8Array(r.length+this.degree);e.set(r);const o=t.mod(e,this.genPoly),s=this.degree-o.length;if(s>0){const a=new Uint8Array(this.degree);return a.set(o,s),a}return o},dt=n,dt}var ft={},ht={},gt={},Kt;function ue(){return Kt||(Kt=1,gt.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}),gt}var D={},Vt;function ce(){if(Vt)return D;Vt=1;const t="[0-9]+",n="[A-Z $%*+\\-./:]+";let i="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";i=i.replace(/u/g,"\\u");const r="(?:(?![A-Z0-9 $%*+\\-./:]|"+i+`)(?:.|[\r
|
|
1
|
+
import{b as me,r as v,j as l}from"./vendor-react-DQUAl2K8.js";import{af as we,N as ye}from"./vendor-DaF96HbP.js";import{u as oe,r as _t,D as ie,B as G,S as It,q as Ce,s as Ee,ac as Be,ad as Ne,ae as Se,I as Ie,E as Lt}from"./index-DjUHduQf.js";import{a as Re}from"./vendor-query-i7fr__Xm.js";import{u as O}from"./provider-auth-store-9hsJ07X1.js";import{s as se,f as be,t as Ae}from"./vendor-icons-Dq3K7TC5.js";import"./vendor-overlays-3MkedLFU.js";import"./vendor-dnd-CayJj8TC.js";function _e(t,n){return{provider:t,authType:n,phase:"starting",statusLines:[]}}function Le(t,n,i){return{...t,phase:t.phase==="starting"?"waiting":t.phase,statusLines:[...t.statusLines,{kind:"info",message:n,links:i}]}}function Te(t,n){const i=t.statusLines.filter(r=>r.kind!=="progress");return{...t,phase:t.phase==="starting"?"waiting":t.phase,statusLines:[...i,{kind:"progress",message:n}]}}function Me(t,n,i){return{...t,authUrl:{url:n,instructions:i}}}function Pe(t,n,i,r,e){return{...t,deviceCode:{userCode:n,verificationUri:i,intervalSeconds:r,expiresInSeconds:e}}}function ve(t,n){return{...t,phase:"prompt",prompt:n}}function je(t,n){var i;return((i=t.prompt)==null?void 0:i.promptId)!==n?t:{...t,phase:"waiting",prompt:void 0}}function De(t,n,i){return{...t,phase:"done",result:{ok:n,error:i}}}function xe(t,n){if(t.phase==="done")return t;switch(n.kind){case"info":return Le(t,n.message,n.links);case"progress":return Te(t,n.message);case"auth_url":return Me(t,n.url,n.instructions);case"device_code":return Pe(t,n.userCode,n.verificationUri,n.intervalSeconds,n.expiresInSeconds);case"prompt":return ve(t,n);case"prompt_cancelled":return je(t,n.promptId);case"done":return De(t,n.ok,n.error)}}var V={},nt,Tt;function ke(){return Tt||(Tt=1,nt=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),nt}var rt={},U={},Mt;function F(){if(Mt)return U;Mt=1;let t;const n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return U.getSymbolSize=function(r){if(!r)throw new Error('"version" cannot be null or undefined');if(r<1||r>40)throw new Error('"version" should be in range from 1 to 40');return r*4+17},U.getSymbolTotalCodewords=function(r){return n[r]},U.getBCHDigit=function(i){let r=0;for(;i!==0;)r++,i>>>=1;return r},U.setToSJISFunction=function(r){if(typeof r!="function")throw new Error('"toSJISFunc" is not a valid function.');t=r},U.isKanjiModeEnabled=function(){return typeof t<"u"},U.toSJIS=function(r){return t(r)},U}var ot={},Pt;function Rt(){return Pt||(Pt=1,(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function n(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+i)}}t.isValid=function(r){return r&&typeof r.bit<"u"&&r.bit>=0&&r.bit<4},t.from=function(r,e){if(t.isValid(r))return r;try{return n(r)}catch{return e}}})(ot)),ot}var it,vt;function Ue(){if(vt)return it;vt=1;function t(){this.buffer=[],this.length=0}return t.prototype={get:function(n){const i=Math.floor(n/8);return(this.buffer[i]>>>7-n%8&1)===1},put:function(n,i){for(let r=0;r<i;r++)this.putBit((n>>>i-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(n){const i=Math.floor(this.length/8);this.buffer.length<=i&&this.buffer.push(0),n&&(this.buffer[i]|=128>>>this.length%8),this.length++}},it=t,it}var st,jt;function qe(){if(jt)return st;jt=1;function t(n){if(!n||n<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=n,this.data=new Uint8Array(n*n),this.reservedBit=new Uint8Array(n*n)}return t.prototype.set=function(n,i,r,e){const o=n*this.size+i;this.data[o]=r,e&&(this.reservedBit[o]=!0)},t.prototype.get=function(n,i){return this.data[n*this.size+i]},t.prototype.xor=function(n,i,r){this.data[n*this.size+i]^=r},t.prototype.isReserved=function(n,i){return this.reservedBit[n*this.size+i]},st=t,st}var at={},Dt;function Fe(){return Dt||(Dt=1,(function(t){const n=F().getSymbolSize;t.getRowColCoords=function(r){if(r===1)return[];const e=Math.floor(r/7)+2,o=n(r),s=o===145?26:Math.ceil((o-13)/(2*e-2))*2,a=[o-7];for(let u=1;u<e-1;u++)a[u]=a[u-1]-s;return a.push(6),a.reverse()},t.getPositions=function(r){const e=[],o=t.getRowColCoords(r),s=o.length;for(let a=0;a<s;a++)for(let u=0;u<s;u++)a===0&&u===0||a===0&&u===s-1||a===s-1&&u===0||e.push([o[a],o[u]]);return e}})(at)),at}var ut={},xt;function ze(){if(xt)return ut;xt=1;const t=F().getSymbolSize,n=7;return ut.getPositions=function(r){const e=t(r);return[[0,0],[e-n,0],[0,e-n]]},ut}var ct={},kt;function Ke(){return kt||(kt=1,(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const n={N1:3,N2:3,N3:40,N4:10};t.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(e){const o=e.size;let s=0,a=0,u=0,c=null,m=null;for(let E=0;E<o;E++){a=u=0,c=m=null;for(let S=0;S<o;S++){let h=e.get(E,S);h===c?a++:(a>=5&&(s+=n.N1+(a-5)),c=h,a=1),h=e.get(S,E),h===m?u++:(u>=5&&(s+=n.N1+(u-5)),m=h,u=1)}a>=5&&(s+=n.N1+(a-5)),u>=5&&(s+=n.N1+(u-5))}return s},t.getPenaltyN2=function(e){const o=e.size;let s=0;for(let a=0;a<o-1;a++)for(let u=0;u<o-1;u++){const c=e.get(a,u)+e.get(a,u+1)+e.get(a+1,u)+e.get(a+1,u+1);(c===4||c===0)&&s++}return s*n.N2},t.getPenaltyN3=function(e){const o=e.size;let s=0,a=0,u=0;for(let c=0;c<o;c++){a=u=0;for(let m=0;m<o;m++)a=a<<1&2047|e.get(c,m),m>=10&&(a===1488||a===93)&&s++,u=u<<1&2047|e.get(m,c),m>=10&&(u===1488||u===93)&&s++}return s*n.N3},t.getPenaltyN4=function(e){let o=0;const s=e.data.length;for(let u=0;u<s;u++)o+=e.data[u];return Math.abs(Math.ceil(o*100/s/5)-10)*n.N4};function i(r,e,o){switch(r){case t.Patterns.PATTERN000:return(e+o)%2===0;case t.Patterns.PATTERN001:return e%2===0;case t.Patterns.PATTERN010:return o%3===0;case t.Patterns.PATTERN011:return(e+o)%3===0;case t.Patterns.PATTERN100:return(Math.floor(e/2)+Math.floor(o/3))%2===0;case t.Patterns.PATTERN101:return e*o%2+e*o%3===0;case t.Patterns.PATTERN110:return(e*o%2+e*o%3)%2===0;case t.Patterns.PATTERN111:return(e*o%3+(e+o)%2)%2===0;default:throw new Error("bad maskPattern:"+r)}}t.applyMask=function(e,o){const s=o.size;for(let a=0;a<s;a++)for(let u=0;u<s;u++)o.isReserved(u,a)||o.xor(u,a,i(e,u,a))},t.getBestMask=function(e,o){const s=Object.keys(t.Patterns).length;let a=0,u=1/0;for(let c=0;c<s;c++){o(c),t.applyMask(c,e);const m=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(c,e),m<u&&(u=m,a=c)}return a}})(ct)),ct}var W={},Ut;function ae(){if(Ut)return W;Ut=1;const t=Rt(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],i=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return W.getBlocksCount=function(e,o){switch(o){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},W.getTotalCodewordsCount=function(e,o){switch(o){case t.L:return i[(e-1)*4+0];case t.M:return i[(e-1)*4+1];case t.Q:return i[(e-1)*4+2];case t.H:return i[(e-1)*4+3];default:return}},W}var lt={},Q={},qt;function Ve(){if(qt)return Q;qt=1;const t=new Uint8Array(512),n=new Uint8Array(256);return(function(){let r=1;for(let e=0;e<255;e++)t[e]=r,n[r]=e,r<<=1,r&256&&(r^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),Q.log=function(r){if(r<1)throw new Error("log("+r+")");return n[r]},Q.exp=function(r){return t[r]},Q.mul=function(r,e){return r===0||e===0?0:t[n[r]+n[e]]},Q}var Ft;function Oe(){return Ft||(Ft=1,(function(t){const n=Ve();t.mul=function(r,e){const o=new Uint8Array(r.length+e.length-1);for(let s=0;s<r.length;s++)for(let a=0;a<e.length;a++)o[s+a]^=n.mul(r[s],e[a]);return o},t.mod=function(r,e){let o=new Uint8Array(r);for(;o.length-e.length>=0;){const s=o[0];for(let u=0;u<e.length;u++)o[u]^=n.mul(e[u],s);let a=0;for(;a<o.length&&o[a]===0;)a++;o=o.slice(a)}return o},t.generateECPolynomial=function(r){let e=new Uint8Array([1]);for(let o=0;o<r;o++)e=t.mul(e,new Uint8Array([1,n.exp(o)]));return e}})(lt)),lt}var dt,zt;function He(){if(zt)return dt;zt=1;const t=Oe();function n(i){this.genPoly=void 0,this.degree=i,this.degree&&this.initialize(this.degree)}return n.prototype.initialize=function(r){this.degree=r,this.genPoly=t.generateECPolynomial(this.degree)},n.prototype.encode=function(r){if(!this.genPoly)throw new Error("Encoder not initialized");const e=new Uint8Array(r.length+this.degree);e.set(r);const o=t.mod(e,this.genPoly),s=this.degree-o.length;if(s>0){const a=new Uint8Array(this.degree);return a.set(o,s),a}return o},dt=n,dt}var ft={},ht={},gt={},Kt;function ue(){return Kt||(Kt=1,gt.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}),gt}var D={},Vt;function ce(){if(Vt)return D;Vt=1;const t="[0-9]+",n="[A-Z $%*+\\-./:]+";let i="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";i=i.replace(/u/g,"\\u");const r="(?:(?![A-Z0-9 $%*+\\-./:]|"+i+`)(?:.|[\r
|
|
2
2
|
]))+`;D.KANJI=new RegExp(i,"g"),D.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),D.BYTE=new RegExp(r,"g"),D.NUMERIC=new RegExp(t,"g"),D.ALPHANUMERIC=new RegExp(n,"g");const e=new RegExp("^"+i+"$"),o=new RegExp("^"+t+"$"),s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return D.testKanji=function(u){return e.test(u)},D.testNumeric=function(u){return o.test(u)},D.testAlphanumeric=function(u){return s.test(u)},D}var Ot;function z(){return Ot||(Ot=1,(function(t){const n=ue(),i=ce();t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(o,s){if(!o.ccBits)throw new Error("Invalid mode: "+o);if(!n.isValid(s))throw new Error("Invalid version: "+s);return s>=1&&s<10?o.ccBits[0]:s<27?o.ccBits[1]:o.ccBits[2]},t.getBestModeForData=function(o){return i.testNumeric(o)?t.NUMERIC:i.testAlphanumeric(o)?t.ALPHANUMERIC:i.testKanji(o)?t.KANJI:t.BYTE},t.toString=function(o){if(o&&o.id)return o.id;throw new Error("Invalid mode")},t.isValid=function(o){return o&&o.bit&&o.ccBits};function r(e){if(typeof e!="string")throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+e)}}t.from=function(o,s){if(t.isValid(o))return o;try{return r(o)}catch{return s}}})(ht)),ht}var Ht;function Qe(){return Ht||(Ht=1,(function(t){const n=F(),i=ae(),r=Rt(),e=z(),o=ue(),s=7973,a=n.getBCHDigit(s);function u(S,h,_){for(let d=1;d<=40;d++)if(h<=t.getCapacity(d,_,S))return d}function c(S,h){return e.getCharCountIndicator(S,h)+4}function m(S,h){let _=0;return S.forEach(function(d){const P=c(d.mode,h);_+=P+d.getBitsLength()}),_}function E(S,h){for(let _=1;_<=40;_++)if(m(S,_)<=t.getCapacity(_,h,e.MIXED))return _}t.from=function(h,_){return o.isValid(h)?parseInt(h,10):_},t.getCapacity=function(h,_,d){if(!o.isValid(h))throw new Error("Invalid QR Code version");typeof d>"u"&&(d=e.BYTE);const P=n.getSymbolTotalCodewords(h),A=i.getTotalCodewordsCount(h,_),L=(P-A)*8;if(d===e.MIXED)return L;const b=L-c(d,h);switch(d){case e.NUMERIC:return Math.floor(b/10*3);case e.ALPHANUMERIC:return Math.floor(b/11*2);case e.KANJI:return Math.floor(b/13);case e.BYTE:default:return Math.floor(b/8)}},t.getBestVersionForData=function(h,_){let d;const P=r.from(_,r.M);if(Array.isArray(h)){if(h.length>1)return E(h,P);if(h.length===0)return 1;d=h[0]}else d=h;return u(d.mode,d.getLength(),P)},t.getEncodedBits=function(h){if(!o.isValid(h)||h<7)throw new Error("Invalid QR Code version");let _=h<<12;for(;n.getBCHDigit(_)-a>=0;)_^=s<<n.getBCHDigit(_)-a;return h<<12|_}})(ft)),ft}var pt={},Qt;function Je(){if(Qt)return pt;Qt=1;const t=F(),n=1335,i=21522,r=t.getBCHDigit(n);return pt.getEncodedBits=function(o,s){const a=o.bit<<3|s;let u=a<<10;for(;t.getBCHDigit(u)-r>=0;)u^=n<<t.getBCHDigit(u)-r;return(a<<10|u)^i},pt}var mt={},wt,Jt;function Ye(){if(Jt)return wt;Jt=1;const t=z();function n(i){this.mode=t.NUMERIC,this.data=i.toString()}return n.getBitsLength=function(r){return 10*Math.floor(r/3)+(r%3?r%3*3+1:0)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(r){let e,o,s;for(e=0;e+3<=this.data.length;e+=3)o=this.data.substr(e,3),s=parseInt(o,10),r.put(s,10);const a=this.data.length-e;a>0&&(o=this.data.substr(e),s=parseInt(o,10),r.put(s,a*3+1))},wt=n,wt}var yt,Yt;function $e(){if(Yt)return yt;Yt=1;const t=z(),n=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function i(r){this.mode=t.ALPHANUMERIC,this.data=r}return i.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let o;for(o=0;o+2<=this.data.length;o+=2){let s=n.indexOf(this.data[o])*45;s+=n.indexOf(this.data[o+1]),e.put(s,11)}this.data.length%2&&e.put(n.indexOf(this.data[o]),6)},yt=i,yt}var Ct,$t;function Ge(){if($t)return Ct;$t=1;const t=z();function n(i){this.mode=t.BYTE,typeof i=="string"?this.data=new TextEncoder().encode(i):this.data=new Uint8Array(i)}return n.getBitsLength=function(r){return r*8},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(i){for(let r=0,e=this.data.length;r<e;r++)i.put(this.data[r],8)},Ct=n,Ct}var Et,Gt;function We(){if(Gt)return Et;Gt=1;const t=z(),n=F();function i(r){this.mode=t.KANJI,this.data=r}return i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(r){let e;for(e=0;e<this.data.length;e++){let o=n.toSJIS(this.data[e]);if(o>=33088&&o<=40956)o-=33088;else if(o>=57408&&o<=60351)o-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
|
|
3
3
|
Make sure your charset is UTF-8`);o=(o>>>8&255)*192+(o&255),r.put(o,13)}},Et=i,Et}var Wt;function Xe(){return Wt||(Wt=1,(function(t){const n=z(),i=Ye(),r=$e(),e=Ge(),o=We(),s=ce(),a=F(),u=we();function c(A){return unescape(encodeURIComponent(A)).length}function m(A,L,b){const R=[];let M;for(;(M=A.exec(b))!==null;)R.push({data:M[0],index:M.index,mode:L,length:M[0].length});return R}function E(A){const L=m(s.NUMERIC,n.NUMERIC,A),b=m(s.ALPHANUMERIC,n.ALPHANUMERIC,A);let R,M;return a.isKanjiModeEnabled()?(R=m(s.BYTE,n.BYTE,A),M=m(s.KANJI,n.KANJI,A)):(R=m(s.BYTE_KANJI,n.BYTE,A),M=[]),L.concat(b,R,M).sort(function(B,w){return B.index-w.index}).map(function(B){return{data:B.data,mode:B.mode,length:B.length}})}function S(A,L){switch(L){case n.NUMERIC:return i.getBitsLength(A);case n.ALPHANUMERIC:return r.getBitsLength(A);case n.KANJI:return o.getBitsLength(A);case n.BYTE:return e.getBitsLength(A)}}function h(A){return A.reduce(function(L,b){const R=L.length-1>=0?L[L.length-1]:null;return R&&R.mode===b.mode?(L[L.length-1].data+=b.data,L):(L.push(b),L)},[])}function _(A){const L=[];for(let b=0;b<A.length;b++){const R=A[b];switch(R.mode){case n.NUMERIC:L.push([R,{data:R.data,mode:n.ALPHANUMERIC,length:R.length},{data:R.data,mode:n.BYTE,length:R.length}]);break;case n.ALPHANUMERIC:L.push([R,{data:R.data,mode:n.BYTE,length:R.length}]);break;case n.KANJI:L.push([R,{data:R.data,mode:n.BYTE,length:c(R.data)}]);break;case n.BYTE:L.push([{data:R.data,mode:n.BYTE,length:c(R.data)}])}}return L}function d(A,L){const b={},R={start:{}};let M=["start"];for(let p=0;p<A.length;p++){const B=A[p],w=[];for(let g=0;g<B.length;g++){const I=B[g],y=""+p+g;w.push(y),b[y]={node:I,lastCount:0},R[y]={};for(let N=0;N<M.length;N++){const C=M[N];b[C]&&b[C].node.mode===I.mode?(R[C][y]=S(b[C].lastCount+I.length,I.mode)-S(b[C].lastCount,I.mode),b[C].lastCount+=I.length):(b[C]&&(b[C].lastCount=I.length),R[C][y]=S(I.length,I.mode)+4+n.getCharCountIndicator(I.mode,L))}}M=w}for(let p=0;p<M.length;p++)R[M[p]].end=0;return{map:R,table:b}}function P(A,L){let b;const R=n.getBestModeForData(A);if(b=n.from(L,R),b!==n.BYTE&&b.bit<R.bit)throw new Error('"'+A+'" cannot be encoded with mode '+n.toString(b)+`.
|
|
4
4
|
Suggested mode is: `+n.toString(R));switch(b===n.KANJI&&!a.isKanjiModeEnabled()&&(b=n.BYTE),b){case n.NUMERIC:return new i(A);case n.ALPHANUMERIC:return new r(A);case n.KANJI:return new o(A);case n.BYTE:return new e(A)}}t.fromArray=function(L){return L.reduce(function(b,R){return typeof R=="string"?b.push(P(R,null)):R.data&&b.push(P(R.data,R.mode)),b},[])},t.fromString=function(L,b){const R=E(L,a.isKanjiModeEnabled()),M=_(R),p=d(M,b),B=u.find_path(p.map,"start","end"),w=[];for(let g=1;g<B.length-1;g++)w.push(p.table[B[g]].node);return t.fromArray(h(w))},t.rawSplit=function(L){return t.fromArray(E(L,a.isKanjiModeEnabled()))}})(mt)),mt}var Xt;function Ze(){if(Xt)return rt;Xt=1;const t=F(),n=Rt(),i=Ue(),r=qe(),e=Fe(),o=ze(),s=Ke(),a=ae(),u=He(),c=Qe(),m=Je(),E=z(),S=Xe();function h(p,B){const w=p.size,g=o.getPositions(B);for(let I=0;I<g.length;I++){const y=g[I][0],N=g[I][1];for(let C=-1;C<=7;C++)if(!(y+C<=-1||w<=y+C))for(let f=-1;f<=7;f++)N+f<=-1||w<=N+f||(C>=0&&C<=6&&(f===0||f===6)||f>=0&&f<=6&&(C===0||C===6)||C>=2&&C<=4&&f>=2&&f<=4?p.set(y+C,N+f,!0,!0):p.set(y+C,N+f,!1,!0))}}function _(p){const B=p.size;for(let w=8;w<B-8;w++){const g=w%2===0;p.set(w,6,g,!0),p.set(6,w,g,!0)}}function d(p,B){const w=e.getPositions(B);for(let g=0;g<w.length;g++){const I=w[g][0],y=w[g][1];for(let N=-2;N<=2;N++)for(let C=-2;C<=2;C++)N===-2||N===2||C===-2||C===2||N===0&&C===0?p.set(I+N,y+C,!0,!0):p.set(I+N,y+C,!1,!0)}}function P(p,B){const w=p.size,g=c.getEncodedBits(B);let I,y,N;for(let C=0;C<18;C++)I=Math.floor(C/3),y=C%3+w-8-3,N=(g>>C&1)===1,p.set(I,y,N,!0),p.set(y,I,N,!0)}function A(p,B,w){const g=p.size,I=m.getEncodedBits(B,w);let y,N;for(y=0;y<15;y++)N=(I>>y&1)===1,y<6?p.set(y,8,N,!0):y<8?p.set(y+1,8,N,!0):p.set(g-15+y,8,N,!0),y<8?p.set(8,g-y-1,N,!0):y<9?p.set(8,15-y-1+1,N,!0):p.set(8,15-y-1,N,!0);p.set(g-8,8,1,!0)}function L(p,B){const w=p.size;let g=-1,I=w-1,y=7,N=0;for(let C=w-1;C>0;C-=2)for(C===6&&C--;;){for(let f=0;f<2;f++)if(!p.isReserved(I,C-f)){let j=!1;N<B.length&&(j=(B[N]>>>y&1)===1),p.set(I,C-f,j),y--,y===-1&&(N++,y=7)}if(I+=g,I<0||w<=I){I-=g,g=-g;break}}}function b(p,B,w){const g=new i;w.forEach(function(f){g.put(f.mode.bit,4),g.put(f.getLength(),E.getCharCountIndicator(f.mode,p)),f.write(g)});const I=t.getSymbolTotalCodewords(p),y=a.getTotalCodewordsCount(p,B),N=(I-y)*8;for(g.getLengthInBits()+4<=N&&g.put(0,4);g.getLengthInBits()%8!==0;)g.putBit(0);const C=(N-g.getLengthInBits())/8;for(let f=0;f<C;f++)g.put(f%2?17:236,8);return R(g,p,B)}function R(p,B,w){const g=t.getSymbolTotalCodewords(B),I=a.getTotalCodewordsCount(B,w),y=g-I,N=a.getBlocksCount(B,w),C=g%N,f=N-C,j=Math.floor(g/N),q=Math.floor(y/N),Y=q+1,H=j-q,ge=new u(H);let X=0;const $=new Array(N),bt=new Array(N);let Z=0;const pe=new Uint8Array(p.buffer);for(let K=0;K<N;K++){const et=K<f?q:Y;$[K]=pe.slice(X,X+et),bt[K]=ge.encode($[K]),X+=et,Z=Math.max(Z,et)}const tt=new Uint8Array(g);let At=0,x,k;for(x=0;x<Z;x++)for(k=0;k<N;k++)x<$[k].length&&(tt[At++]=$[k][x]);for(x=0;x<H;x++)for(k=0;k<N;k++)tt[At++]=bt[k][x];return tt}function M(p,B,w,g){let I;if(Array.isArray(p))I=S.fromArray(p);else if(typeof p=="string"){let j=B;if(!j){const q=S.rawSplit(p);j=c.getBestVersionForData(q,w)}I=S.fromString(p,j||40)}else throw new Error("Invalid data");const y=c.getBestVersionForData(I,w);if(!y)throw new Error("The amount of data is too big to be stored in a QR Code");if(!B)B=y;else if(B<y)throw new Error(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as h,j as t}from"./vendor-react-DQUAl2K8.js";import{u as T,r as j,q as Z,I as D,D as Y,C as Q,B as A,S as M,E as $,s as ee}from"./index-BbSAfLF_.js";import{S as z}from"./StatusBadge-BMKAPA9O.js";import{S as te}from"./Switch-1I6AMAC7.js";import"./vendor-DaF96HbP.js";import{a as B,u as se}from"./vendor-query-i7fr__Xm.js";import{T as G,C as ne,b as re}from"./vendor-icons-FMicTc5d.js";import"./vendor-overlays-3MkedLFU.js";import"./vendor-dnd-CayJj8TC.js";const ae=/^npm:\S+$/,le=/^git:\S+$/,oe=/^ssh:\/\/\S+$/,ie=/^git@[^\s:/]+:\S+$/,ce=/^https?:\/\/(?:[^\s/]*\.)?(?:github|gitlab)\.com\/\S+$/i,ue=/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\/\S+\.git$/,de=/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//,H="[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?",pe=new RegExp(`^${H}/${H}(?:@${H})?$`);function ge(e){const s=e.trim();return s.length===0?null:ae.test(s)?{kind:"pi_npm",normalized:s}:le.test(s)?{kind:"pi_git",normalized:s}:s==="~"||s.startsWith("~/")||s.startsWith("/")?{kind:"local_path",normalized:s}:ie.test(s)||oe.test(s)||ce.test(s)||ue.test(s)?{kind:"skills_repo",normalized:s}:de.test(s)?null:pe.test(s)?{kind:"skills_repo",normalized:s}:null}const U={agent_dir:"Pi skills",agents_dir:"Agent Skills",settings_path:"Skill paths"},q=new Set(["agent_dir","agents_dir"]);function _e(e,s){return q.has(e.origin)&&s.some(r=>r!==e&&r.name===e.name&&q.has(r.origin))?`Pi applies this setting to every '${e.name}' skill folder.`:null}function he(e,s,a){var o;const r=!!e.shadowedBy,l=[];if(r){const u=e.shadowedBy?a.get(e.shadowedBy):void 0;l.push({label:`shadowed by ${(u==null?void 0:u.originLabel)??e.shadowedBy}`,variant:"warning"})}return e.symlinkTarget&&l.push({label:`→ ${e.symlinkTarget}`,variant:"muted"}),e.disableModelInvocation&&l.push({label:"manual only",variant:"muted"}),(o=e.provenance)!=null&&o.source&&l.push({label:e.provenance.source,variant:"muted"}),{skill:e,muted:r,toggleDisabled:r,badges:l,warnings:e.warnings??[],sharedPatternTooltip:_e(e,s)}}function me(e){const s=[{label:e.kind,variant:"muted"}];return e.curated&&s.push({label:"curated",variant:"success"}),e.pinned&&s.push({label:"pinned",variant:"muted"}),s}function fe(e,s){const a=new Map(e.map(c=>[c.path,c])),r=c=>he(c,e,a),l=[],o=e.filter(c=>c.origin==="agent_dir").map(r);o.length>0&&l.push({id:"agent_dir",label:U.agent_dir,rows:o});const u=e.filter(c=>c.origin==="agents_dir").map(r);u.length>0&&l.push({id:"agents_dir",label:U.agents_dir,rows:u});const g=e.filter(c=>c.origin==="package"),d=new Set;for(const c of s){d.add(c.source);const v=g.filter(w=>w.packageSource===c.source).map(r);v.length>0&&l.push({id:`package:${c.source}`,label:c.source,rows:v,packageInfo:c})}const n=Array.from(new Set(g.filter(c=>c.packageSource&&!d.has(c.packageSource)).map(c=>c.packageSource)));for(const c of n){const v=g.filter(w=>w.packageSource===c).map(r);v.length>0&&l.push({id:`package:${c}`,label:c,rows:v})}const i=e.filter(c=>c.origin==="settings_path").map(r);i.length>0&&l.push({id:"settings_path",label:U.settings_path,rows:i});const f=new Set(["agent_dir","agents_dir","package","settings_path"]),k=Array.from(new Set(e.filter(c=>!f.has(c.origin)).map(c=>c.origin)));for(const c of k){const v=e.filter(w=>w.origin===c).map(r);v.length>0&&l.push({id:c,label:c,rows:v})}return l}function ke(e,s){const a=s.trim().toLowerCase();return a?e.map(r=>({...r,rows:r.rows.filter(l=>l.skill.name.toLowerCase().includes(a)||(l.skill.description??"").toLowerCase().includes(a))})).filter(r=>r.rows.length>0):e}function Se(e,s){if(e.origin!=="package"||!e.packageSource)return!1;const a=s.find(r=>r.source===e.packageSource);return!!(a!=null&&a.curated)}function we(e){return e.symlinkTarget?`Removes the link only; ${e.symlinkTarget} is kept.`:e.origin==="agents_dir"&&e.provenance?`Removes '${e.name}' for every agent on this machine.`:e.origin==="settings_path"?`Removes the Pi settings entry that provides ${e.path} (other skills from the same folder stop loading too); files are kept.`:`Deletes ${e.path}.`}function ve(e){const s=e.skillCount;return`Remove ${e.source}? This removes ${s} skill${s===1?"":"s"}.`}const Re="Updates every Agent Skills skill and every unpinned Pi package; may take several minutes",xe={"agent-skills":"Agent Skills","pi-packages":"Pi packages"};function be(e){return xe[e]??e}const je={settings_unreadable:"Can't read settings.json — skills can't be loaded or changed until this is fixed.",invalid_source:"That source isn't recognized.",not_found:"That skill could not be found.",not_removable:"That skill can't be removed from here.",spawn_failed:"Could not run the skills command.",timeout:"Timed out."};function X(e){return{...e,ok:!0,error:void 0,message:void 0}}function J(e){return e.results.length>0}function L(e,s){return e?s||(je[e]??e):null}const Ee={pi_npm:"npm package",pi_git:"git package",skills_repo:"Agent Skills repo",local_path:"Folder on daemon host"};function ye(e){return e?Ee[e.kind]:"Unrecognized"}function K(e){return e==="pi_npm"||e==="pi_git"}function Ne(e){return e!==null}const Ae="Installs the package's skills only; its extensions stay disabled. Pi packages run with full system access — review the source before installing.";function Ce(e){return e.installResult?"results":e.installPending?"running":e.previewPending?"previewing":e.previewResult?"pick":"source"}function ze(e){return e.map(s=>({skill:s,checked:s.valid,replace:!1}))}function W(e){return e.filter(s=>s.skill.valid&&s.checked&&(!s.skill.exists||s.replace)).map(s=>s.skill.name)}function Te(e){return e.some(s=>s.skill.valid&&s.checked&&s.skill.exists&&s.replace)}function Le(e,s,a){return{...e,skills:e.skills.map(r=>r.path===s?{...r,enabled:a}:r)}}function Pe(){const e=T(a=>a.client),s=B();return h.useEffect(()=>{if(e)return e.onSkillsChanged(()=>{s.invalidateQueries({queryKey:j.skillsList()})})},[e,s]),se({queryKey:j.skillsList(),queryFn:()=>{if(!e)throw new Error("not connected");return e.listSkills()},enabled:!!e})}function De(){const e=T(d=>d.client),s=B(),[a,r]=h.useState({}),[l,o]=h.useState({});function u(d){r(n=>{if(!(d in n))return n;const i={...n};return delete i[d],i})}async function g(d,n){if(!e)return;const i=d.path;u(i),o(k=>({...k,[i]:!0}));const f=s.getQueryData(j.skillsList());f&&s.setQueryData(j.skillsList(),Le(f,i,n));try{const k=await e.setSkillEnabled(i,n);if(!k.ok){f&&s.setQueryData(j.skillsList(),f),r(c=>({...c,[i]:L(k.error,k.message)??"Failed to update skill."}));return}s.setQueryData(j.skillsList(),k)}catch(k){f&&s.setQueryData(j.skillsList(),f),r(c=>({...c,[i]:k instanceof Error?k.message:"Failed to update skill."}))}finally{o(k=>{const c={...k};return delete c[i],c})}}return{rowErrors:a,pending:l,toggle:g,clearRowError:u}}function Be(e){return e.path??`package:${e.packageSource}`}function Ie(){const e=T(d=>d.client),s=B(),[a,r]=h.useState({}),[l,o]=h.useState({});function u(d){o(n=>{if(!(d in n))return n;const i={...n};return delete i[d],i})}async function g(d){if(!e)return;const n=Be(d);u(n),r(i=>({...i,[n]:!0}));try{const i=await e.removeSkill(d);if(!i.ok){o(f=>({...f,[n]:L(i.error,i.message)??"Failed to remove."}));return}s.setQueryData(j.skillsList(),i)}catch(i){o(f=>({...f,[n]:i instanceof Error?i.message:"Failed to remove."}))}finally{r(i=>{const f={...i};return delete f[n],f})}}return{pending:a,errors:l,clearError:u,removeSkill:d=>g({path:d.path}),removePackage:d=>g({packageSource:d.source})}}function $e(){const e=T(n=>n.client),s=B(),[a,r]=h.useState(!1),[l,o]=h.useState(null),[u,g]=h.useState(null);async function d(){if(e){r(!0),g(null);try{const n=await e.updateAllSkills();if(!n.ok&&!J(n)){g(L(n.error,n.message)??"Failed to update skills.");return}o(n),s.setQueryData(j.skillsList(),X(n))}catch(n){g(n instanceof Error?n.message:"Failed to update skills.")}finally{r(!1)}}}return{pending:a,result:l,error:u,updateAll:d,clearResult:()=>o(null)}}function Me(){const e=T(d=>d.client),[s,a]=h.useState(!1),[r,l]=h.useState(null),[o,u]=h.useState(null);async function g(d){if(e){a(!0),u(null);try{const n=await e.previewSkillSource(d);if(!n.ok){u(L(n.error,n.message)??"Failed to preview.");return}l(n)}catch(n){u(n instanceof Error?n.message:"Failed to preview.")}finally{a(!1)}}}return{pending:s,result:r,error:o,preview:g,reset:()=>{l(null),u(null)}}}function Fe(){const e=T(n=>n.client),s=B(),[a,r]=h.useState(!1),[l,o]=h.useState(null),[u,g]=h.useState(null);async function d(n){if(e){r(!0),g(null);try{const i=await e.installSkills(n);if(!i.ok&&!J(i)){g(L(i.error,i.message)??"Failed to install.");return}o(i),s.setQueryData(j.skillsList(),X(i))}catch(i){g(i instanceof Error?i.message:"Failed to install.")}finally{r(!1)}}}return{pending:a,result:l,error:u,install:d,reset:()=>{o(null),g(null)}}}const Oe="_sourceStep_1n0el_6",He="_sourceLabel_1n0el_13",Ue="_notice_1n0el_18",Ge="_error_1n0el_30",Qe="_statusStep_1n0el_35",qe="_pickStep_1n0el_45",Ke="_pickRows_1n0el_52",We="_pickRow_1n0el_52",Ze="_pickRowMain_1n0el_73",Xe="_pickRowTop_1n0el_80",Je="_pickRowName_1n0el_87",Ve="_pickRowDescription_1n0el_95",Ye="_backButton_1n0el_103",et="_results_1n0el_107",tt="_resultRow_1n0el_116",st="_resultHeader_1n0el_125",nt="_resultTarget_1n0el_132",rt="_resultError_1n0el_140",at="_resultToggle_1n0el_148",lt="_resultStderr_1n0el_159",m={sourceStep:Oe,sourceLabel:He,notice:Ue,error:Ge,statusStep:Qe,pickStep:qe,pickRows:Ke,pickRow:We,pickRowMain:Ze,pickRowTop:Xe,pickRowName:Je,pickRowDescription:Ve,backButton:Ye,results:et,resultRow:tt,resultHeader:st,resultTarget:nt,resultError:rt,resultToggle:at,resultStderr:lt};function ot({open:e,onOpenChange:s}){var I;const a=Me(),r=Fe(),[l,o]=h.useState(""),[u,g]=h.useState([]),d=h.useRef(!1),n=ge(l),i=Ce({previewPending:a.pending,previewResult:a.result,installPending:r.pending,installResult:r.result});h.useEffect(()=>{e&&!d.current&&!r.pending&&!r.result&&(o(""),g([]),a.reset()),d.current=e},[e]),h.useEffect(()=>{a.result&&g(ze(a.result.skills))},[a.result]);async function f(){if(n){if(K(n.kind)){await r.install({source:n.normalized});return}await a.preview(n.normalized)}}function k(R,N){g(P=>P.map((_,b)=>b===R?{..._,...N}:_))}async function c(){var N;const R=W(u);R.length!==0&&await r.install({source:((N=a.result)==null?void 0:N.source)??(n==null?void 0:n.normalized)??l,skills:R,replace:Te(u)})}function v(){a.reset(),g([])}function w(){r.reset(),s(!1)}const F=((I=a.result)==null?void 0:I.source)??(n==null?void 0:n.normalized)??l,O=W(u).length;let y,E;return i==="source"?(y=t.jsxs("div",{className:m.sourceStep,children:[t.jsx(Z,{autoFocus:!0,placeholder:"npm:<name>, git:<url>, owner/repo, or a daemon-host path",value:l,onChange:R=>o(R.target.value),"aria-label":"Install source"}),t.jsx("div",{className:m.sourceLabel,children:ye(n)}),n&&K(n.kind)&&t.jsxs("div",{className:m.notice,children:[t.jsx(D,{icon:G,size:"xs"}),t.jsx("span",{children:Ae})]}),a.error&&t.jsx("div",{className:m.error,children:a.error})]}),E=t.jsx(A,{size:"sm",disabled:!Ne(n),loading:r.pending,onClick:()=>void f(),children:"Next"})):i==="previewing"?(y=t.jsxs("div",{className:m.statusStep,children:[t.jsx(M,{size:"sm"})," Looking up the source…"]}),E=null):i==="pick"?(y=t.jsxs("div",{className:m.pickStep,children:[u.length===0?t.jsx("div",{className:m.statusStep,children:"No installable skills found."}):t.jsx("div",{className:m.pickRows,children:u.map((R,N)=>t.jsx(it,{row:R,onChange:P=>k(N,P)},R.skill.relPath))}),r.error&&t.jsx("div",{className:m.error,children:r.error})]}),E=t.jsxs(t.Fragment,{children:[t.jsx(A,{size:"sm",variant:"ghost",className:m.backButton,onClick:v,children:"‹ Back"}),t.jsxs(A,{size:"sm",disabled:O===0,loading:r.pending,onClick:()=>void c(),children:["Install from ",F]})]})):i==="running"?(y=t.jsxs("div",{className:m.statusStep,children:[t.jsx(M,{size:"sm"})," Installing… this may take several minutes"]}),E=null):(y=r.result?t.jsx(ct,{result:r.result}):null,E=t.jsx(A,{size:"sm",onClick:w,children:"Done"})),t.jsx(Y,{open:e,onOpenChange:R=>{if(!R&&i==="results"){w();return}s(R)},title:"Install skill…",width:480,footer:E,children:y})}function it({row:e,onChange:s}){const{skill:a,checked:r,replace:l}=e,o=!a.valid;return t.jsxs("div",{className:m.pickRow,"data-disabled":o||void 0,children:[t.jsx(Q,{checked:r&&a.valid,disabled:o,onChange:u=>s({checked:u.target.checked}),"aria-label":a.name}),t.jsxs("div",{className:m.pickRowMain,children:[t.jsxs("div",{className:m.pickRowTop,children:[t.jsx("span",{className:m.pickRowName,children:a.name}),!a.valid&&t.jsx(z,{label:"Invalid",variant:"error"}),a.exists&&t.jsx(z,{label:"Already installed",variant:"warning"}),a.warnings&&a.warnings.length>0&&t.jsx(D,{icon:G,size:"xs",color:"var(--pi-color-statusWarning)","aria-label":a.warnings.join("; ")})]}),a.description&&t.jsx("span",{className:m.pickRowDescription,children:a.description}),a.exists&&a.valid&&t.jsx(Q,{label:"Already installed — replace",checked:l,onChange:u=>s({replace:u.target.checked})})]})]})}function ct({result:e}){const[s,a]=h.useState(()=>new Set);function r(l){a(o=>{const u=new Set(o);return u.has(l)?u.delete(l):u.add(l),u})}return t.jsx("div",{className:m.results,children:e.results.map((l,o)=>{const u=s.has(o);return t.jsxs("div",{className:m.resultRow,children:[t.jsxs("div",{className:m.resultHeader,children:[t.jsx(z,{label:l.ok?"Installed":"Failed",variant:l.ok?"success":"error"}),t.jsx("span",{className:m.resultTarget,children:l.target}),l.error&&t.jsx("span",{className:m.resultError,children:l.error}),l.stderr&&t.jsx("button",{type:"button",className:m.resultToggle,onClick:()=>r(o),children:u?"Hide details":"Show details"})]}),u&&l.stderr&&t.jsx("pre",{className:m.resultStderr,children:l.stderr})]},`${l.target}-${o}`)})})}const ut="_panel_1tczp_1",dt="_toolbar_1tczp_7",pt="_search_1tczp_14",gt="_groups_1tczp_19",_t="_group_1tczp_19",ht="_groupHeader_1tczp_30",mt="_chevronExpanded_1tczp_47",ft="_groupLabel_1tczp_51",kt="_groupBadges_1tczp_62",St="_groupCount_1tczp_68",wt="_rows_1tczp_74",vt="_row_1tczp_74",Rt="_rowMain_1tczp_91",xt="_rowTop_1tczp_98",bt="_name_1tczp_105",jt="_nameMuted_1tczp_113 _name_1tczp_105",Et="_badge_1tczp_118",yt="_description_1tczp_122",Nt="_descriptionMuted_1tczp_130 _description_1tczp_122",At="_rowError_1tczp_135",Ct="_footnote_1tczp_147",zt="_errorState_1tczp_153",Tt="_removePackageBtn_1tczp_157",Lt="_rowActions_1tczp_161",Pt="_updateAllResults_1tczp_168",Dt="_updateAllResultRow_1tczp_178",Bt="_updateAllResultHeader_1tczp_184",It="_updateAllResultLabel_1tczp_191",$t="_updateAllResultError_1tczp_196",Mt="_updateAllResultToggle_1tczp_204",Ft="_updateAllResultStderr_1tczp_215",p={panel:ut,toolbar:dt,search:pt,groups:gt,group:_t,groupHeader:ht,chevronExpanded:mt,groupLabel:ft,groupBadges:kt,groupCount:St,rows:wt,row:vt,rowMain:Rt,rowTop:xt,name:bt,nameMuted:jt,badge:Et,description:yt,descriptionMuted:Nt,rowError:At,footnote:Ct,errorState:zt,removePackageBtn:Tt,rowActions:Lt,updateAllResults:Pt,updateAllResultRow:Dt,updateAllResultHeader:Bt,updateAllResultLabel:It,updateAllResultError:$t,updateAllResultToggle:Mt,updateAllResultStderr:Ft};function Vt(){const{data:e,isLoading:s,isError:a,error:r}=Pe(),{rowErrors:l,pending:o,toggle:u,clearRowError:g}=De(),d=Ie(),n=$e(),[i,f]=h.useState(""),[k,c]=h.useState(()=>new Set),[v,w]=h.useState(!1),[F,O]=h.useState(()=>new Set);function y(_){c(b=>{const x=new Set(b);return x.has(_)?x.delete(_):x.add(_),x})}if(s)return t.jsxs($,{children:[t.jsx(M,{size:"sm"})," Loading skills…"]});if(a)return t.jsx($,{className:p.errorState,children:r instanceof Error?r.message:"Failed to load skills."});if(!e)return null;if(!e.ok)return t.jsx($,{className:p.errorState,children:L(e.error,e.message)??"Could not load skills."});const E=ke(fe(e.skills,e.packages),i);function I(_,b){if(b&&_.packageSource&&Se(_,e.packages)&&!F.has(_.packageSource)){if(!window.confirm("Pi-Studio will stop managing this package's updates."))return;O(x=>new Set(x).add(_.packageSource))}u(_,b)}function R(_){window.confirm(we(_))&&d.removeSkill(_)}function N(_){window.confirm(ve(_))&&d.removePackage(_)}function P(){window.confirm(Re)&&n.updateAll()}return t.jsxs("div",{className:p.panel,children:[t.jsxs("div",{className:p.toolbar,children:[t.jsx(Z,{className:p.search,placeholder:"Search skills…",value:i,onChange:_=>f(_.target.value),"aria-label":"Search skills"}),t.jsx(A,{size:"sm",variant:"outline",loading:n.pending,onClick:P,children:"Update all"}),t.jsx(A,{size:"sm",onClick:()=>w(!0),children:"Install skill…"})]}),n.error&&t.jsx("button",{type:"button",className:p.rowError,onClick:()=>n.updateAll().catch(()=>{}),children:n.error}),n.result&&t.jsx(Ot,{result:n.result,onDismiss:n.clearResult}),E.length===0?t.jsx($,{children:i?"No skills match your search.":"No skills found."}):t.jsx("div",{className:p.groups,children:E.map(_=>{const b=k.has(_.id),x=_.packageInfo,C=x?`package:${x.source}`:void 0;return t.jsxs("div",{className:p.group,children:[t.jsxs("button",{type:"button",className:p.groupHeader,onClick:()=>y(_.id),"aria-expanded":!b,children:[t.jsx(D,{icon:ne,size:"xs",className:b?void 0:p.chevronExpanded}),t.jsx("span",{className:p.groupLabel,children:_.label}),x&&t.jsx("span",{className:p.groupBadges,children:me(x).map(S=>t.jsx(z,{label:S.label,variant:S.variant},S.label))}),t.jsx("span",{className:p.groupCount,children:_.rows.length}),x&&t.jsx(A,{size:"xs",variant:"ghost",className:p.removePackageBtn,loading:C?!!d.pending[C]:!1,onClick:S=>{S.stopPropagation(),N(x)},children:"Remove package"})]}),C&&d.errors[C]&&t.jsx("button",{type:"button",className:p.rowError,onClick:()=>d.clearError(C),children:d.errors[C]}),!b&&t.jsx("div",{className:p.rows,children:_.rows.map(S=>t.jsx(Ht,{row:S,error:l[S.skill.path],pending:!!o[S.skill.path],removeError:d.errors[S.skill.path],removePending:!!d.pending[S.skill.path],onToggle:V=>I(S.skill,V),onDismissError:()=>g(S.skill.path),onRemove:()=>R(S.skill),onDismissRemoveError:()=>d.clearError(S.skill.path)},S.skill.path))})]},_.id)})}),t.jsx("p",{className:p.footnote,children:"Changes apply to newly started agent sessions."}),t.jsx(ot,{open:v,onOpenChange:w})]})}function Ot({result:e,onDismiss:s}){const[a,r]=h.useState(()=>new Set);function l(o){r(u=>{const g=new Set(u);return g.has(o)?g.delete(o):g.add(o),g})}return t.jsxs("div",{className:p.updateAllResults,children:[e.results.map(o=>{const u=a.has(o.target);return t.jsxs("div",{className:p.updateAllResultRow,children:[t.jsxs("div",{className:p.updateAllResultHeader,children:[t.jsx(z,{label:o.ok?"Succeeded":"Failed",variant:o.ok?"success":"error"}),t.jsx("span",{className:p.updateAllResultLabel,children:be(o.target)}),o.error&&t.jsx("span",{className:p.updateAllResultError,children:o.error}),o.stderr&&t.jsx("button",{type:"button",className:p.updateAllResultToggle,onClick:()=>l(o.target),children:u?"Hide details":"Show details"})]}),u&&o.stderr&&t.jsx("pre",{className:p.updateAllResultStderr,children:o.stderr})]},o.target)}),t.jsx("button",{type:"button",className:p.rowError,onClick:s,children:"Dismiss"})]})}function Ht({row:e,error:s,pending:a,removeError:r,removePending:l,onToggle:o,onDismissError:u,onRemove:g,onDismissRemoveError:d}){const{skill:n,muted:i,toggleDisabled:f,badges:k,warnings:c,sharedPatternTooltip:v}=e;return t.jsxs("div",{className:p.row,title:v??void 0,children:[t.jsxs("div",{className:p.rowMain,children:[t.jsxs("div",{className:p.rowTop,children:[t.jsx("span",{className:i?p.nameMuted:p.name,children:n.name}),c.length>0&&t.jsx(D,{icon:G,size:"xs",color:"var(--pi-color-statusWarning)","aria-label":c.join("; ")}),k.map(w=>t.jsx(z,{label:w.label,variant:w.variant,className:p.badge},w.label))]}),n.description&&t.jsx("span",{className:i?p.descriptionMuted:p.description,children:n.description}),s&&t.jsx("button",{type:"button",className:p.rowError,onClick:u,children:s}),r&&t.jsx("button",{type:"button",className:p.rowError,onClick:d,children:r})]}),t.jsxs("div",{className:p.rowActions,children:[t.jsx(te,{checked:n.enabled,disabled:f||a,onCheckedChange:o,"aria-label":n.name}),n.removable&&t.jsx(ee,{"aria-label":`Remove ${n.name}`,disabled:l,onClick:g,children:l?t.jsx(M,{size:"xs"}):t.jsx(D,{icon:re,size:"xs"})})]})]})}export{Vt as SkillsPanel};
|
|
1
|
+
import{r as h,j as t}from"./vendor-react-DQUAl2K8.js";import{u as T,r as j,q as Z,I as D,D as Y,C as Q,B as A,S as M,E as $,s as ee}from"./index-DjUHduQf.js";import{S as z}from"./StatusBadge-BMKAPA9O.js";import{S as te}from"./Switch-1I6AMAC7.js";import"./vendor-DaF96HbP.js";import{a as B,u as se}from"./vendor-query-i7fr__Xm.js";import{T as G,C as ne,b as re}from"./vendor-icons-Dq3K7TC5.js";import"./vendor-overlays-3MkedLFU.js";import"./vendor-dnd-CayJj8TC.js";const ae=/^npm:\S+$/,le=/^git:\S+$/,oe=/^ssh:\/\/\S+$/,ie=/^git@[^\s:/]+:\S+$/,ce=/^https?:\/\/(?:[^\s/]*\.)?(?:github|gitlab)\.com\/\S+$/i,ue=/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\/\S+\.git$/,de=/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//,H="[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?",pe=new RegExp(`^${H}/${H}(?:@${H})?$`);function ge(e){const s=e.trim();return s.length===0?null:ae.test(s)?{kind:"pi_npm",normalized:s}:le.test(s)?{kind:"pi_git",normalized:s}:s==="~"||s.startsWith("~/")||s.startsWith("/")?{kind:"local_path",normalized:s}:ie.test(s)||oe.test(s)||ce.test(s)||ue.test(s)?{kind:"skills_repo",normalized:s}:de.test(s)?null:pe.test(s)?{kind:"skills_repo",normalized:s}:null}const U={agent_dir:"Pi skills",agents_dir:"Agent Skills",settings_path:"Skill paths"},q=new Set(["agent_dir","agents_dir"]);function _e(e,s){return q.has(e.origin)&&s.some(r=>r!==e&&r.name===e.name&&q.has(r.origin))?`Pi applies this setting to every '${e.name}' skill folder.`:null}function he(e,s,a){var o;const r=!!e.shadowedBy,l=[];if(r){const u=e.shadowedBy?a.get(e.shadowedBy):void 0;l.push({label:`shadowed by ${(u==null?void 0:u.originLabel)??e.shadowedBy}`,variant:"warning"})}return e.symlinkTarget&&l.push({label:`→ ${e.symlinkTarget}`,variant:"muted"}),e.disableModelInvocation&&l.push({label:"manual only",variant:"muted"}),(o=e.provenance)!=null&&o.source&&l.push({label:e.provenance.source,variant:"muted"}),{skill:e,muted:r,toggleDisabled:r,badges:l,warnings:e.warnings??[],sharedPatternTooltip:_e(e,s)}}function me(e){const s=[{label:e.kind,variant:"muted"}];return e.curated&&s.push({label:"curated",variant:"success"}),e.pinned&&s.push({label:"pinned",variant:"muted"}),s}function fe(e,s){const a=new Map(e.map(c=>[c.path,c])),r=c=>he(c,e,a),l=[],o=e.filter(c=>c.origin==="agent_dir").map(r);o.length>0&&l.push({id:"agent_dir",label:U.agent_dir,rows:o});const u=e.filter(c=>c.origin==="agents_dir").map(r);u.length>0&&l.push({id:"agents_dir",label:U.agents_dir,rows:u});const g=e.filter(c=>c.origin==="package"),d=new Set;for(const c of s){d.add(c.source);const v=g.filter(w=>w.packageSource===c.source).map(r);v.length>0&&l.push({id:`package:${c.source}`,label:c.source,rows:v,packageInfo:c})}const n=Array.from(new Set(g.filter(c=>c.packageSource&&!d.has(c.packageSource)).map(c=>c.packageSource)));for(const c of n){const v=g.filter(w=>w.packageSource===c).map(r);v.length>0&&l.push({id:`package:${c}`,label:c,rows:v})}const i=e.filter(c=>c.origin==="settings_path").map(r);i.length>0&&l.push({id:"settings_path",label:U.settings_path,rows:i});const f=new Set(["agent_dir","agents_dir","package","settings_path"]),k=Array.from(new Set(e.filter(c=>!f.has(c.origin)).map(c=>c.origin)));for(const c of k){const v=e.filter(w=>w.origin===c).map(r);v.length>0&&l.push({id:c,label:c,rows:v})}return l}function ke(e,s){const a=s.trim().toLowerCase();return a?e.map(r=>({...r,rows:r.rows.filter(l=>l.skill.name.toLowerCase().includes(a)||(l.skill.description??"").toLowerCase().includes(a))})).filter(r=>r.rows.length>0):e}function Se(e,s){if(e.origin!=="package"||!e.packageSource)return!1;const a=s.find(r=>r.source===e.packageSource);return!!(a!=null&&a.curated)}function we(e){return e.symlinkTarget?`Removes the link only; ${e.symlinkTarget} is kept.`:e.origin==="agents_dir"&&e.provenance?`Removes '${e.name}' for every agent on this machine.`:e.origin==="settings_path"?`Removes the Pi settings entry that provides ${e.path} (other skills from the same folder stop loading too); files are kept.`:`Deletes ${e.path}.`}function ve(e){const s=e.skillCount;return`Remove ${e.source}? This removes ${s} skill${s===1?"":"s"}.`}const Re="Updates every Agent Skills skill and every unpinned Pi package; may take several minutes",xe={"agent-skills":"Agent Skills","pi-packages":"Pi packages"};function be(e){return xe[e]??e}const je={settings_unreadable:"Can't read settings.json — skills can't be loaded or changed until this is fixed.",invalid_source:"That source isn't recognized.",not_found:"That skill could not be found.",not_removable:"That skill can't be removed from here.",spawn_failed:"Could not run the skills command.",timeout:"Timed out."};function X(e){return{...e,ok:!0,error:void 0,message:void 0}}function J(e){return e.results.length>0}function L(e,s){return e?s||(je[e]??e):null}const Ee={pi_npm:"npm package",pi_git:"git package",skills_repo:"Agent Skills repo",local_path:"Folder on daemon host"};function ye(e){return e?Ee[e.kind]:"Unrecognized"}function K(e){return e==="pi_npm"||e==="pi_git"}function Ne(e){return e!==null}const Ae="Installs the package's skills only; its extensions stay disabled. Pi packages run with full system access — review the source before installing.";function Ce(e){return e.installResult?"results":e.installPending?"running":e.previewPending?"previewing":e.previewResult?"pick":"source"}function ze(e){return e.map(s=>({skill:s,checked:s.valid,replace:!1}))}function W(e){return e.filter(s=>s.skill.valid&&s.checked&&(!s.skill.exists||s.replace)).map(s=>s.skill.name)}function Te(e){return e.some(s=>s.skill.valid&&s.checked&&s.skill.exists&&s.replace)}function Le(e,s,a){return{...e,skills:e.skills.map(r=>r.path===s?{...r,enabled:a}:r)}}function Pe(){const e=T(a=>a.client),s=B();return h.useEffect(()=>{if(e)return e.onSkillsChanged(()=>{s.invalidateQueries({queryKey:j.skillsList()})})},[e,s]),se({queryKey:j.skillsList(),queryFn:()=>{if(!e)throw new Error("not connected");return e.listSkills()},enabled:!!e})}function De(){const e=T(d=>d.client),s=B(),[a,r]=h.useState({}),[l,o]=h.useState({});function u(d){r(n=>{if(!(d in n))return n;const i={...n};return delete i[d],i})}async function g(d,n){if(!e)return;const i=d.path;u(i),o(k=>({...k,[i]:!0}));const f=s.getQueryData(j.skillsList());f&&s.setQueryData(j.skillsList(),Le(f,i,n));try{const k=await e.setSkillEnabled(i,n);if(!k.ok){f&&s.setQueryData(j.skillsList(),f),r(c=>({...c,[i]:L(k.error,k.message)??"Failed to update skill."}));return}s.setQueryData(j.skillsList(),k)}catch(k){f&&s.setQueryData(j.skillsList(),f),r(c=>({...c,[i]:k instanceof Error?k.message:"Failed to update skill."}))}finally{o(k=>{const c={...k};return delete c[i],c})}}return{rowErrors:a,pending:l,toggle:g,clearRowError:u}}function Be(e){return e.path??`package:${e.packageSource}`}function Ie(){const e=T(d=>d.client),s=B(),[a,r]=h.useState({}),[l,o]=h.useState({});function u(d){o(n=>{if(!(d in n))return n;const i={...n};return delete i[d],i})}async function g(d){if(!e)return;const n=Be(d);u(n),r(i=>({...i,[n]:!0}));try{const i=await e.removeSkill(d);if(!i.ok){o(f=>({...f,[n]:L(i.error,i.message)??"Failed to remove."}));return}s.setQueryData(j.skillsList(),i)}catch(i){o(f=>({...f,[n]:i instanceof Error?i.message:"Failed to remove."}))}finally{r(i=>{const f={...i};return delete f[n],f})}}return{pending:a,errors:l,clearError:u,removeSkill:d=>g({path:d.path}),removePackage:d=>g({packageSource:d.source})}}function $e(){const e=T(n=>n.client),s=B(),[a,r]=h.useState(!1),[l,o]=h.useState(null),[u,g]=h.useState(null);async function d(){if(e){r(!0),g(null);try{const n=await e.updateAllSkills();if(!n.ok&&!J(n)){g(L(n.error,n.message)??"Failed to update skills.");return}o(n),s.setQueryData(j.skillsList(),X(n))}catch(n){g(n instanceof Error?n.message:"Failed to update skills.")}finally{r(!1)}}}return{pending:a,result:l,error:u,updateAll:d,clearResult:()=>o(null)}}function Me(){const e=T(d=>d.client),[s,a]=h.useState(!1),[r,l]=h.useState(null),[o,u]=h.useState(null);async function g(d){if(e){a(!0),u(null);try{const n=await e.previewSkillSource(d);if(!n.ok){u(L(n.error,n.message)??"Failed to preview.");return}l(n)}catch(n){u(n instanceof Error?n.message:"Failed to preview.")}finally{a(!1)}}}return{pending:s,result:r,error:o,preview:g,reset:()=>{l(null),u(null)}}}function Fe(){const e=T(n=>n.client),s=B(),[a,r]=h.useState(!1),[l,o]=h.useState(null),[u,g]=h.useState(null);async function d(n){if(e){r(!0),g(null);try{const i=await e.installSkills(n);if(!i.ok&&!J(i)){g(L(i.error,i.message)??"Failed to install.");return}o(i),s.setQueryData(j.skillsList(),X(i))}catch(i){g(i instanceof Error?i.message:"Failed to install.")}finally{r(!1)}}}return{pending:a,result:l,error:u,install:d,reset:()=>{o(null),g(null)}}}const Oe="_sourceStep_1n0el_6",He="_sourceLabel_1n0el_13",Ue="_notice_1n0el_18",Ge="_error_1n0el_30",Qe="_statusStep_1n0el_35",qe="_pickStep_1n0el_45",Ke="_pickRows_1n0el_52",We="_pickRow_1n0el_52",Ze="_pickRowMain_1n0el_73",Xe="_pickRowTop_1n0el_80",Je="_pickRowName_1n0el_87",Ve="_pickRowDescription_1n0el_95",Ye="_backButton_1n0el_103",et="_results_1n0el_107",tt="_resultRow_1n0el_116",st="_resultHeader_1n0el_125",nt="_resultTarget_1n0el_132",rt="_resultError_1n0el_140",at="_resultToggle_1n0el_148",lt="_resultStderr_1n0el_159",m={sourceStep:Oe,sourceLabel:He,notice:Ue,error:Ge,statusStep:Qe,pickStep:qe,pickRows:Ke,pickRow:We,pickRowMain:Ze,pickRowTop:Xe,pickRowName:Je,pickRowDescription:Ve,backButton:Ye,results:et,resultRow:tt,resultHeader:st,resultTarget:nt,resultError:rt,resultToggle:at,resultStderr:lt};function ot({open:e,onOpenChange:s}){var I;const a=Me(),r=Fe(),[l,o]=h.useState(""),[u,g]=h.useState([]),d=h.useRef(!1),n=ge(l),i=Ce({previewPending:a.pending,previewResult:a.result,installPending:r.pending,installResult:r.result});h.useEffect(()=>{e&&!d.current&&!r.pending&&!r.result&&(o(""),g([]),a.reset()),d.current=e},[e]),h.useEffect(()=>{a.result&&g(ze(a.result.skills))},[a.result]);async function f(){if(n){if(K(n.kind)){await r.install({source:n.normalized});return}await a.preview(n.normalized)}}function k(R,N){g(P=>P.map((_,b)=>b===R?{..._,...N}:_))}async function c(){var N;const R=W(u);R.length!==0&&await r.install({source:((N=a.result)==null?void 0:N.source)??(n==null?void 0:n.normalized)??l,skills:R,replace:Te(u)})}function v(){a.reset(),g([])}function w(){r.reset(),s(!1)}const F=((I=a.result)==null?void 0:I.source)??(n==null?void 0:n.normalized)??l,O=W(u).length;let y,E;return i==="source"?(y=t.jsxs("div",{className:m.sourceStep,children:[t.jsx(Z,{autoFocus:!0,placeholder:"npm:<name>, git:<url>, owner/repo, or a daemon-host path",value:l,onChange:R=>o(R.target.value),"aria-label":"Install source"}),t.jsx("div",{className:m.sourceLabel,children:ye(n)}),n&&K(n.kind)&&t.jsxs("div",{className:m.notice,children:[t.jsx(D,{icon:G,size:"xs"}),t.jsx("span",{children:Ae})]}),a.error&&t.jsx("div",{className:m.error,children:a.error})]}),E=t.jsx(A,{size:"sm",disabled:!Ne(n),loading:r.pending,onClick:()=>void f(),children:"Next"})):i==="previewing"?(y=t.jsxs("div",{className:m.statusStep,children:[t.jsx(M,{size:"sm"})," Looking up the source…"]}),E=null):i==="pick"?(y=t.jsxs("div",{className:m.pickStep,children:[u.length===0?t.jsx("div",{className:m.statusStep,children:"No installable skills found."}):t.jsx("div",{className:m.pickRows,children:u.map((R,N)=>t.jsx(it,{row:R,onChange:P=>k(N,P)},R.skill.relPath))}),r.error&&t.jsx("div",{className:m.error,children:r.error})]}),E=t.jsxs(t.Fragment,{children:[t.jsx(A,{size:"sm",variant:"ghost",className:m.backButton,onClick:v,children:"‹ Back"}),t.jsxs(A,{size:"sm",disabled:O===0,loading:r.pending,onClick:()=>void c(),children:["Install from ",F]})]})):i==="running"?(y=t.jsxs("div",{className:m.statusStep,children:[t.jsx(M,{size:"sm"})," Installing… this may take several minutes"]}),E=null):(y=r.result?t.jsx(ct,{result:r.result}):null,E=t.jsx(A,{size:"sm",onClick:w,children:"Done"})),t.jsx(Y,{open:e,onOpenChange:R=>{if(!R&&i==="results"){w();return}s(R)},title:"Install skill…",width:480,footer:E,children:y})}function it({row:e,onChange:s}){const{skill:a,checked:r,replace:l}=e,o=!a.valid;return t.jsxs("div",{className:m.pickRow,"data-disabled":o||void 0,children:[t.jsx(Q,{checked:r&&a.valid,disabled:o,onChange:u=>s({checked:u.target.checked}),"aria-label":a.name}),t.jsxs("div",{className:m.pickRowMain,children:[t.jsxs("div",{className:m.pickRowTop,children:[t.jsx("span",{className:m.pickRowName,children:a.name}),!a.valid&&t.jsx(z,{label:"Invalid",variant:"error"}),a.exists&&t.jsx(z,{label:"Already installed",variant:"warning"}),a.warnings&&a.warnings.length>0&&t.jsx(D,{icon:G,size:"xs",color:"var(--pi-color-statusWarning)","aria-label":a.warnings.join("; ")})]}),a.description&&t.jsx("span",{className:m.pickRowDescription,children:a.description}),a.exists&&a.valid&&t.jsx(Q,{label:"Already installed — replace",checked:l,onChange:u=>s({replace:u.target.checked})})]})]})}function ct({result:e}){const[s,a]=h.useState(()=>new Set);function r(l){a(o=>{const u=new Set(o);return u.has(l)?u.delete(l):u.add(l),u})}return t.jsx("div",{className:m.results,children:e.results.map((l,o)=>{const u=s.has(o);return t.jsxs("div",{className:m.resultRow,children:[t.jsxs("div",{className:m.resultHeader,children:[t.jsx(z,{label:l.ok?"Installed":"Failed",variant:l.ok?"success":"error"}),t.jsx("span",{className:m.resultTarget,children:l.target}),l.error&&t.jsx("span",{className:m.resultError,children:l.error}),l.stderr&&t.jsx("button",{type:"button",className:m.resultToggle,onClick:()=>r(o),children:u?"Hide details":"Show details"})]}),u&&l.stderr&&t.jsx("pre",{className:m.resultStderr,children:l.stderr})]},`${l.target}-${o}`)})})}const ut="_panel_1tczp_1",dt="_toolbar_1tczp_7",pt="_search_1tczp_14",gt="_groups_1tczp_19",_t="_group_1tczp_19",ht="_groupHeader_1tczp_30",mt="_chevronExpanded_1tczp_47",ft="_groupLabel_1tczp_51",kt="_groupBadges_1tczp_62",St="_groupCount_1tczp_68",wt="_rows_1tczp_74",vt="_row_1tczp_74",Rt="_rowMain_1tczp_91",xt="_rowTop_1tczp_98",bt="_name_1tczp_105",jt="_nameMuted_1tczp_113 _name_1tczp_105",Et="_badge_1tczp_118",yt="_description_1tczp_122",Nt="_descriptionMuted_1tczp_130 _description_1tczp_122",At="_rowError_1tczp_135",Ct="_footnote_1tczp_147",zt="_errorState_1tczp_153",Tt="_removePackageBtn_1tczp_157",Lt="_rowActions_1tczp_161",Pt="_updateAllResults_1tczp_168",Dt="_updateAllResultRow_1tczp_178",Bt="_updateAllResultHeader_1tczp_184",It="_updateAllResultLabel_1tczp_191",$t="_updateAllResultError_1tczp_196",Mt="_updateAllResultToggle_1tczp_204",Ft="_updateAllResultStderr_1tczp_215",p={panel:ut,toolbar:dt,search:pt,groups:gt,group:_t,groupHeader:ht,chevronExpanded:mt,groupLabel:ft,groupBadges:kt,groupCount:St,rows:wt,row:vt,rowMain:Rt,rowTop:xt,name:bt,nameMuted:jt,badge:Et,description:yt,descriptionMuted:Nt,rowError:At,footnote:Ct,errorState:zt,removePackageBtn:Tt,rowActions:Lt,updateAllResults:Pt,updateAllResultRow:Dt,updateAllResultHeader:Bt,updateAllResultLabel:It,updateAllResultError:$t,updateAllResultToggle:Mt,updateAllResultStderr:Ft};function Vt(){const{data:e,isLoading:s,isError:a,error:r}=Pe(),{rowErrors:l,pending:o,toggle:u,clearRowError:g}=De(),d=Ie(),n=$e(),[i,f]=h.useState(""),[k,c]=h.useState(()=>new Set),[v,w]=h.useState(!1),[F,O]=h.useState(()=>new Set);function y(_){c(b=>{const x=new Set(b);return x.has(_)?x.delete(_):x.add(_),x})}if(s)return t.jsxs($,{children:[t.jsx(M,{size:"sm"})," Loading skills…"]});if(a)return t.jsx($,{className:p.errorState,children:r instanceof Error?r.message:"Failed to load skills."});if(!e)return null;if(!e.ok)return t.jsx($,{className:p.errorState,children:L(e.error,e.message)??"Could not load skills."});const E=ke(fe(e.skills,e.packages),i);function I(_,b){if(b&&_.packageSource&&Se(_,e.packages)&&!F.has(_.packageSource)){if(!window.confirm("Pi-Studio will stop managing this package's updates."))return;O(x=>new Set(x).add(_.packageSource))}u(_,b)}function R(_){window.confirm(we(_))&&d.removeSkill(_)}function N(_){window.confirm(ve(_))&&d.removePackage(_)}function P(){window.confirm(Re)&&n.updateAll()}return t.jsxs("div",{className:p.panel,children:[t.jsxs("div",{className:p.toolbar,children:[t.jsx(Z,{className:p.search,placeholder:"Search skills…",value:i,onChange:_=>f(_.target.value),"aria-label":"Search skills"}),t.jsx(A,{size:"sm",variant:"outline",loading:n.pending,onClick:P,children:"Update all"}),t.jsx(A,{size:"sm",onClick:()=>w(!0),children:"Install skill…"})]}),n.error&&t.jsx("button",{type:"button",className:p.rowError,onClick:()=>n.updateAll().catch(()=>{}),children:n.error}),n.result&&t.jsx(Ot,{result:n.result,onDismiss:n.clearResult}),E.length===0?t.jsx($,{children:i?"No skills match your search.":"No skills found."}):t.jsx("div",{className:p.groups,children:E.map(_=>{const b=k.has(_.id),x=_.packageInfo,C=x?`package:${x.source}`:void 0;return t.jsxs("div",{className:p.group,children:[t.jsxs("button",{type:"button",className:p.groupHeader,onClick:()=>y(_.id),"aria-expanded":!b,children:[t.jsx(D,{icon:ne,size:"xs",className:b?void 0:p.chevronExpanded}),t.jsx("span",{className:p.groupLabel,children:_.label}),x&&t.jsx("span",{className:p.groupBadges,children:me(x).map(S=>t.jsx(z,{label:S.label,variant:S.variant},S.label))}),t.jsx("span",{className:p.groupCount,children:_.rows.length}),x&&t.jsx(A,{size:"xs",variant:"ghost",className:p.removePackageBtn,loading:C?!!d.pending[C]:!1,onClick:S=>{S.stopPropagation(),N(x)},children:"Remove package"})]}),C&&d.errors[C]&&t.jsx("button",{type:"button",className:p.rowError,onClick:()=>d.clearError(C),children:d.errors[C]}),!b&&t.jsx("div",{className:p.rows,children:_.rows.map(S=>t.jsx(Ht,{row:S,error:l[S.skill.path],pending:!!o[S.skill.path],removeError:d.errors[S.skill.path],removePending:!!d.pending[S.skill.path],onToggle:V=>I(S.skill,V),onDismissError:()=>g(S.skill.path),onRemove:()=>R(S.skill),onDismissRemoveError:()=>d.clearError(S.skill.path)},S.skill.path))})]},_.id)})}),t.jsx("p",{className:p.footnote,children:"Changes apply to newly started agent sessions."}),t.jsx(ot,{open:v,onOpenChange:w})]})}function Ot({result:e,onDismiss:s}){const[a,r]=h.useState(()=>new Set);function l(o){r(u=>{const g=new Set(u);return g.has(o)?g.delete(o):g.add(o),g})}return t.jsxs("div",{className:p.updateAllResults,children:[e.results.map(o=>{const u=a.has(o.target);return t.jsxs("div",{className:p.updateAllResultRow,children:[t.jsxs("div",{className:p.updateAllResultHeader,children:[t.jsx(z,{label:o.ok?"Succeeded":"Failed",variant:o.ok?"success":"error"}),t.jsx("span",{className:p.updateAllResultLabel,children:be(o.target)}),o.error&&t.jsx("span",{className:p.updateAllResultError,children:o.error}),o.stderr&&t.jsx("button",{type:"button",className:p.updateAllResultToggle,onClick:()=>l(o.target),children:u?"Hide details":"Show details"})]}),u&&o.stderr&&t.jsx("pre",{className:p.updateAllResultStderr,children:o.stderr})]},o.target)}),t.jsx("button",{type:"button",className:p.rowError,onClick:s,children:"Dismiss"})]})}function Ht({row:e,error:s,pending:a,removeError:r,removePending:l,onToggle:o,onDismissError:u,onRemove:g,onDismissRemoveError:d}){const{skill:n,muted:i,toggleDisabled:f,badges:k,warnings:c,sharedPatternTooltip:v}=e;return t.jsxs("div",{className:p.row,title:v??void 0,children:[t.jsxs("div",{className:p.rowMain,children:[t.jsxs("div",{className:p.rowTop,children:[t.jsx("span",{className:i?p.nameMuted:p.name,children:n.name}),c.length>0&&t.jsx(D,{icon:G,size:"xs",color:"var(--pi-color-statusWarning)","aria-label":c.join("; ")}),k.map(w=>t.jsx(z,{label:w.label,variant:w.variant,className:p.badge},w.label))]}),n.description&&t.jsx("span",{className:i?p.descriptionMuted:p.description,children:n.description}),s&&t.jsx("button",{type:"button",className:p.rowError,onClick:u,children:s}),r&&t.jsx("button",{type:"button",className:p.rowError,onClick:d,children:r})]}),t.jsxs("div",{className:p.rowActions,children:[t.jsx(te,{checked:n.enabled,disabled:f||a,onCheckedChange:o,"aria-label":n.name}),n.removable&&t.jsx(ee,{"aria-label":`Remove ${n.name}`,disabled:l,onClick:g,children:l?t.jsx(M,{size:"xs"}):t.jsx(D,{icon:re,size:"xs"})})]})]})}export{Vt as SkillsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var ce=Object.defineProperty;var ie=(n,e,t)=>e in n?ce(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var U=(n,e,t)=>ie(n,typeof e!="symbol"?e+"":e,t);import{r as s,j as b}from"./vendor-react-DQUAl2K8.js";import{x as ue,a as le}from"./vendor-terminal-BhzX2_ts.js";import{f as X,g as ae,T as J,u as fe,h as de,j as me,k as pe,l as Q,S as he,m as Re,o as we}from"./index-
|
|
1
|
+
var ce=Object.defineProperty;var ie=(n,e,t)=>e in n?ce(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var U=(n,e,t)=>ie(n,typeof e!="symbol"?e+"":e,t);import{r as s,j as b}from"./vendor-react-DQUAl2K8.js";import{x as ue,a as le}from"./vendor-terminal-BhzX2_ts.js";import{f as X,g as ae,T as J,u as fe,h as de,j as me,k as pe,l as Q,S as he,m as Re,o as we}from"./index-DjUHduQf.js";import"./vendor-DaF96HbP.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-icons-Dq3K7TC5.js";import"./vendor-overlays-3MkedLFU.js";import"./vendor-dnd-CayJj8TC.js";class Se{constructor(e){U(this,"subscribers",new Map);U(this,"detach",null);this.daemon=e}start(){this.detach||(this.detach=this.daemon.onTerminalFrame(e=>this.dispatch(e)))}stop(){var e;(e=this.detach)==null||e.call(this),this.detach=null}subscribeSlot(e,t){return this.subscribers.set(e,t),()=>{this.subscribers.get(e)===t&&this.subscribers.delete(e)}}hasSlot(e){return this.subscribers.has(e)}sendInput(e,t){this.daemon.sendBinary(X({opcode:"Input",slot:e,data:t}))}sendResize(e,t,d){this.daemon.sendBinary(X({opcode:"Resize",slot:e,rows:t,cols:d}))}dispatch(e){var d,R,p;const t=this.subscribers.get(e.slot);if(t)switch(e.opcode){case"Output":(d=t.onOutput)==null||d.call(t,e.data);return;case"Snapshot":(R=t.onSnapshot)==null||R.call(t,e.data);return;case"Restore":(p=t.onRestore)==null||p.call(t,e.data);return;default:return}}}const ye=3e3,Z=`${ae.sm}px ${J}`,ee="M";function te(){if(typeof document>"u"||!document.fonts)return!0;try{return document.fonts.check(Z,ee)}catch{return!0}}const Te=(async()=>{if(typeof document>"u"||!document.fonts||te())return;let n;try{await Promise.race([document.fonts.load(Z,ee),new Promise(e=>{n=window.setTimeout(e,ye)})])}catch{}finally{window.clearTimeout(n)}})(),_e=2,ve=1;function y(n){if(n==null)return!1;const{cols:e,rows:t}=n;return typeof e=="number"&&Number.isInteger(e)&&e>=_e&&typeof t=="number"&&Number.isInteger(t)&&t>=ve}function ge(n,e){return n===null||e===null?n===e:n.cols===e.cols&&n.rows===e.rows}function xe(n,e){return y(n)?!ge(n,e):!1}function be(n,e){if(e===null)return;const t=n.find(R=>R.slot===e);if(!t)return;const d={cols:t.cols,rows:t.rows};return y(d)?d:void 0}const Fe="_wrap_1fx2h_1",Ee="_terminal_1fx2h_12",Ae="_statusOverlay_1fx2h_19",ze="_exitedBanner_1fx2h_30",z={wrap:Fe,terminal:Ee,statusOverlay:Ae,exitedBanner:ze},Oe=64*1024,$=new TextEncoder,K=new WeakMap;function Ne(n){let e=K.get(n);return e||(e=new Se(n),e.start(),K.set(n,e)),e}function Y(n){const e=Q.getState(),t=e.tabs.find(d=>d.id===n);return!t||t.workspaceCwd!==e.activeWorkspaceCwd?!1:Re(we.getState().layouts[t.workspaceCwd],n)}function Le({tab:n}){const e=n.data,t=fe(r=>r.client),d=de(n.id),{settings:R,resolvedTheme:p}=me(),B=R.monoFont&&R.monoFont.trim()!==""?p.fontFamily.mono:J,W=s.useRef(null),w=s.useRef(null),T=s.useRef(null),_=s.useRef(e.slot),O=s.useRef(null),N=s.useRef([]),I=s.useRef(0),F=s.useRef(null),ne=s.useRef(null),E=s.useRef(null),v=s.useRef(null),A=s.useRef(null),k=s.useRef(!1),H=s.useRef(null),V=s.useRef(t);V.current=t;const D=s.useRef(e.exited??!1);D.current=e.exited??!1;const[g,re]=s.useState(e.slot),[j,M]=s.useState({isAttaching:!0,error:null}),[q,se]=s.useState(te);s.useEffect(()=>{if(q)return;let r=!1;return Te.then(()=>{r||se(!0)}),()=>{r=!0}},[q]);const C=()=>{var o,c;const r=(o=T.current)==null?void 0:o.proposeDimensions();(c=E.current)==null||c.call(E,y(r)?r:null)},oe=()=>{var r;A.current=null,k.current=!0,(r=T.current)==null||r.fit(),C(),requestAnimationFrame(()=>{k.current=!1})},P=()=>{v.current!==null&&window.clearTimeout(v.current),v.current=window.setTimeout(()=>{v.current=null,A.current===null&&(A.current=requestAnimationFrame(oe))},60)};s.useEffect(()=>{const r=W.current;if(!r||!q)return;const o=new ue.Terminal({cursorBlink:!0,fontFamily:B,fontSize:p.fontSize.code,scrollback:5e3,theme:p.colors.terminal,allowProposedApi:!0}),c=new le.FitAddon;o.loadAddon(c),o.open(r);const f=u=>{if(!Y(n.id))return;const l=_.current,S=O.current;l===null||!S||xe(u,F.current)&&(F.current=u,S.sendResize(l,u.rows,u.cols))},a=o.onData(u=>{if(D.current)return;const l=_.current,S=O.current;if(l===null||!S){const G=$.encode(u);I.current+G.length<=Oe&&(N.current.push(G),I.current+=G.length);return}S.sendInput(l,$.encode(u))}),m=o.onResize(({cols:u,rows:l})=>{f({cols:u,rows:l})}),h=()=>{c.fit(),C()};r.addEventListener("focusin",h),c.fit(),w.current=o,T.current=c,E.current=f;const i=new ResizeObserver(u=>{if(k.current)return;const l=u[0];l&&(l.contentRect.width===0||l.contentRect.height===0)||P()});return i.observe(r),()=>{i.disconnect(),v.current!==null&&window.clearTimeout(v.current),A.current!==null&&cancelAnimationFrame(A.current),r.removeEventListener("focusin",h),a.dispose(),m.dispose(),o.dispose(),w.current=null,T.current=null,E.current=null}},[q]),s.useEffect(()=>{const r=w.current;if(!r)return;r.options.theme=p.colors.terminal;const o=p.fontSize.code,c=B,f=H.current,a=f!==null&&(f.size!==o||f.family!==c);r.options.fontSize=o,r.options.fontFamily=c,H.current={size:o,family:c},a&&P()},[p,B]),s.useEffect(()=>{if(!e.exited)return;const r=w.current;r&&(r.options.cursorBlink=!1,r.blur())},[e.exited]),s.useEffect(()=>{if(t)return t.connection.onSessionMessage(r=>{const o=r;if(!pe(o))return;const c=be(o.terminals,_.current);c!==void 0&&(F.current=c)})},[t]);const x=s.useRef(!1),L=s.useRef(!1);return s.useEffect(()=>{var f;if(x.current=!0,!t||_.current!==null||L.current)return()=>{x.current=!1};L.current=!0;const r=e.cwd||"~",o=(f=T.current)==null?void 0:f.proposeDimensions(),c=y(o)?o:null;return t.connection.request("create_terminal_request",{workspaceId:"",cwd:r,...c?{cols:c.cols,rows:c.rows}:{}}).then(a=>{const m=a.terminal.slot;if(!x.current){t.connection.request("kill_terminal_request",{slot:m}).catch(()=>{});return}_.current=m,re(m),Q.getState().updateData(n.id,{slot:m});const h={cols:a.terminal.cols,rows:a.terminal.rows};F.current=y(h)?h:null}).catch(a=>{x.current&&M({isAttaching:!1,error:a instanceof Error?a.message:String(a)})}).finally(()=>{L.current=!1}),()=>{x.current=!1}},[t,n.id]),s.useEffect(()=>()=>{const r=_.current;r!==null&&setTimeout(()=>{var o;x.current||D.current||(o=V.current)==null||o.connection.request("kill_terminal_request",{slot:r}).catch(()=>{})},0)},[]),s.useEffect(()=>{var h;if(!t||g===null)return;M({isAttaching:!0,error:null});const r=Ne(t.connection);O.current=r;const o=i=>{var u,l;(u=w.current)==null||u.reset(),(l=w.current)==null||l.write(i)},c=r.subscribeSlot(g,{onOutput:i=>{var u;return(u=w.current)==null?void 0:u.write(i)},onSnapshot:o,onRestore:o});let f=!1;const a=(h=T.current)==null?void 0:h.proposeDimensions(),m=y(a)&&Y(n.id)?a:null;return t.connection.request("subscribe_terminal_request",{slot:g,restoreMode:"reflowable",...m?{cols:m.cols,rows:m.rows}:{}}).then(i=>{if(f)return;M({isAttaching:!1,error:null}),ne.current=(i==null?void 0:i.restoreMode)??"basic";const u=N.current;N.current=[],I.current=0;for(const S of u)r.sendInput(g,S);const l={cols:i==null?void 0:i.cols,rows:i==null?void 0:i.rows};F.current=y(l)?l:m,C()}).catch(i=>{f||(N.current=[],I.current=0,M({isAttaching:!1,error:i instanceof Error?i.message:String(i)}))}),()=>{f=!0,c(),O.current=null,t.connection.request("unsubscribe_terminal_request",{slot:g}).catch(()=>{})}},[t,g]),s.useEffect(()=>{d&&P()},[d]),b.jsxs("div",{className:z.wrap,children:[b.jsx("div",{ref:W,className:z.terminal}),j.error?b.jsxs("div",{className:z.statusOverlay,children:["Terminal error: ",j.error]}):j.isAttaching?b.jsxs("div",{className:z.statusOverlay,children:[b.jsx(he,{size:"sm"})," Starting terminal…"]}):null,e.exited?b.jsx("div",{className:z.exitedBanner,children:"Terminal exited"}):null]})}export{Le as TerminalPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./vendor-react-DQUAl2K8.js";import{E as r,S as t,B as a,P as c}from"./index-
|
|
1
|
+
import{j as e}from"./vendor-react-DQUAl2K8.js";import{E as r,S as t,B as a,P as c}from"./index-DjUHduQf.js";import{u as m,C as d}from"./CodeView-BGmM4Xdz.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-DaF96HbP.js";import"./vendor-icons-Dq3K7TC5.js";import"./vendor-overlays-3MkedLFU.js";import"./vendor-dnd-CayJj8TC.js";import"./use-file-download-Bc8Kby2g.js";const x="_note_1g5yz_1",j="_body_1g5yz_9",g="_tooLarge_1g5yz_13",i={note:x,body:j,tooLarge:g};function n(o){return`${(o/(1024*1024)).toFixed(1)} MB`}function b({path:o}){const s=m(o);switch(s.kind){case"loading":return e.jsxs(r,{children:[e.jsx(t,{size:"sm"})," Loading..."]});case"inline":return e.jsx(d,{path:o,content:s.content});case"streaming":return e.jsxs(r,{children:[e.jsx(t,{size:"sm"})," Streaming ",n(s.size)," file..."]});case"stream-error":return e.jsxs(r,{children:["Error: ",s.message]});case"streamed":return e.jsxs(c,{children:[e.jsxs("div",{className:i.note,children:[n(s.size)," file streamed"]}),e.jsx("div",{className:i.body,children:e.jsx(d,{path:o,content:s.content})})]});case"too-large":{const l=o.split("/").pop()||o;return e.jsx(r,{children:e.jsxs("div",{className:i.tooLarge,children:[e.jsxs("div",{children:[n(s.size)," — too large to display (display ceiling is"," ",n(s.maxDisplayBytes),")."]}),s.downloading?e.jsx(t,{size:"sm"}):s.downloadUrl?e.jsx("a",{href:s.downloadUrl,download:s.downloadName||l,children:e.jsx(a,{size:"sm",children:"Save file"})}):e.jsx(a,{size:"sm",onClick:()=>s.requestDownload(),children:"Download"})]})})}case"error":return e.jsxs(r,{children:["Error: ",s.message]})}}export{b as TextViewer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as o}from"./vendor-react-DQUAl2K8.js";import{E as e,S as t}from"./index-
|
|
1
|
+
import{j as o}from"./vendor-react-DQUAl2K8.js";import{E as e,S as t}from"./index-DjUHduQf.js";import{u as n}from"./use-file-download-Bc8Kby2g.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-DaF96HbP.js";import"./vendor-icons-Dq3K7TC5.js";import"./vendor-overlays-3MkedLFU.js";import"./vendor-dnd-CayJj8TC.js";const a="_wrap_gy3e6_1",d="_video_gy3e6_10",s={wrap:a,video:d};function v({path:i,workspaceCwd:m}){const r=n(i);return r.isLoading?o.jsxs(e,{children:[o.jsx(t,{size:"sm"})," Loading video..."]}):r.isError?o.jsxs(e,{children:["Error: ",r.error instanceof Error?r.error.message:"unknown error"]}):r.data?o.jsx("div",{className:s.wrap,children:o.jsx("video",{className:s.video,src:r.data.objectUrl,controls:!0})}):null}export{v as VideoViewer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./vendor-react-DQUAl2K8.js";import{S as d}from"./Switch-1I6AMAC7.js";import{b as a}from"./index-
|
|
1
|
+
import{j as e}from"./vendor-react-DQUAl2K8.js";import{S as d}from"./Switch-1I6AMAC7.js";import{b as a}from"./index-DjUHduQf.js";import"./vendor-DaF96HbP.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-icons-Dq3K7TC5.js";import"./vendor-overlays-3MkedLFU.js";import"./vendor-dnd-CayJj8TC.js";const p="_list_x2x5z_1",m="_row_x2x5z_7",x="_rowMain_x2x5z_17",w="_name_x2x5z_24",_="_description_x2x5z_29",f="_note_x2x5z_34",n={list:p,row:m,rowMain:x,name:w,description:_,note:f},b=[{id:"molviewer",name:"Molecule Viewer",description:"Open molecular structure files (.cif, .pdb, .xyz, and similar) in the 3D viewer instead of as plain text."},{id:"pdfviewer",name:"PDF Viewer",description:"Render PDF files in place instead of offering only a download."}];function h({id:o,name:i,description:r}){const t=a(s=>s.capable),c=a(s=>s.isViewerEnabled(o)),l=a(s=>s.setEnabled);return e.jsxs("div",{className:n.row,children:[e.jsxs("div",{className:n.rowMain,children:[e.jsx("span",{className:n.name,children:i}),e.jsx("span",{className:n.description,children:r})]}),e.jsx(d,{checked:c,disabled:!t,onCheckedChange:s=>void l(o,s),"aria-label":i})]})}function M(){const o=a(i=>i.capable);return e.jsxs("div",{className:n.list,children:[b.map(i=>e.jsx(h,{...i},i.id)),!o&&e.jsx("p",{className:n.note,children:"Requires a newer daemon."})]})}export{M as ViewersPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as l,a as o,c as i}from"./index-
|
|
1
|
+
import{n as l,a as o,c as i}from"./index-DjUHduQf.js";const u=/^([a-zA-Z][a-zA-Z0-9+.-]*):/;function d(n){try{return decodeURIComponent(n)}catch{return n}}function p(n,a,r){const s=n.trim();if(!s)return null;const e=s.split(/[?#]/,1)[0];if(!e||u.exec(e))return null;let t;if(e.startsWith("/")?t=e:e==="~"||e.startsWith("~/")?t=r?l(e,r):null:t=o(e,a??""),!t)return null;const c=i(t);return d(c)}export{u as S,d as p,p as r};
|