nextclaw 0.21.5 → 0.21.6
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/package.json +16 -16
- package/ui-dist/assets/{channels-list-page-bkKDqaO5.js → channels-list-page-D-WYFmcG.js} +1 -1
- package/ui-dist/assets/{chat-page-YKdeGoVx.js → chat-page-D1X8YNTC.js} +2 -2
- package/ui-dist/assets/{desktop-update-config-CLXdVz9r.js → desktop-update-config-DOi5R1fX.js} +1 -1
- package/ui-dist/assets/{index-DKflQCOL.js → index-ZDJP_uJc.js} +5 -5
- package/ui-dist/assets/mcp-marketplace-page-LmMhKH5a.js +1 -0
- package/ui-dist/assets/{mcp-marketplace-page-BaBuHB2L.js → mcp-marketplace-page-RqISBSqO.js} +1 -1
- package/ui-dist/assets/{model-config-B-qg70S4.js → model-config-JUsW1Khb.js} +1 -1
- package/ui-dist/assets/{provider-scoped-model-input-BgPTQa8H.js → provider-scoped-model-input-IMD4W0jD.js} +1 -1
- package/ui-dist/assets/{providers-list-cBeeslbc.js → providers-list-BsDpxNzy.js} +1 -1
- package/ui-dist/assets/{runtime-config-page-DYH2ejUI.js → runtime-config-page-DzbTVebD.js} +1 -1
- package/ui-dist/assets/{search-config-BRsrQ4zK.js → search-config-CJ6OPxAf.js} +1 -1
- package/ui-dist/assets/{secrets-config-eYdx5_AW.js → secrets-config-CYOHWL7P.js} +1 -1
- package/ui-dist/index.html +1 -1
- package/ui-dist/assets/mcp-marketplace-page-ooEvG_bB.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nextclaw",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.6",
|
|
4
4
|
"description": "Powerful AI assistant for coordinating agents, skills, CLI tools, automations, and messaging apps.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -41,20 +41,20 @@
|
|
|
41
41
|
"commander": "^12.1.0",
|
|
42
42
|
"jszip": "^3.10.1",
|
|
43
43
|
"yaml": "^2.8.1",
|
|
44
|
-
"@nextclaw/
|
|
45
|
-
"@nextclaw/
|
|
46
|
-
"@nextclaw/
|
|
47
|
-
"@nextclaw/
|
|
48
|
-
"@nextclaw/ncp-
|
|
49
|
-
"@nextclaw/ncp-
|
|
50
|
-
"@nextclaw/ncp-
|
|
51
|
-
"@nextclaw/nextclaw-
|
|
52
|
-
"@nextclaw/nextclaw-
|
|
53
|
-
"@nextclaw/
|
|
54
|
-
"@nextclaw/
|
|
55
|
-
"@nextclaw/
|
|
56
|
-
"@nextclaw/
|
|
57
|
-
"@nextclaw/
|
|
44
|
+
"@nextclaw/kernel": "0.4.2",
|
|
45
|
+
"@nextclaw/core": "0.14.2",
|
|
46
|
+
"@nextclaw/mcp": "0.2.12",
|
|
47
|
+
"@nextclaw/ncp": "0.6.1",
|
|
48
|
+
"@nextclaw/ncp-agent-runtime": "0.3.42",
|
|
49
|
+
"@nextclaw/ncp-mcp": "0.1.107",
|
|
50
|
+
"@nextclaw/ncp-toolkit": "0.5.36",
|
|
51
|
+
"@nextclaw/nextclaw-hermes-acp-bridge": "0.2.11",
|
|
52
|
+
"@nextclaw/nextclaw-ncp-runtime-stdio-client": "0.2.11",
|
|
53
|
+
"@nextclaw/remote": "0.2.12",
|
|
54
|
+
"@nextclaw/nextclaw-ncp-runtime-http-client": "0.2.11",
|
|
55
|
+
"@nextclaw/runtime": "0.3.12",
|
|
56
|
+
"@nextclaw/service": "0.2.12",
|
|
57
|
+
"@nextclaw/server": "0.14.2"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/node": "^20.17.6",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"tsx": "^4.19.2",
|
|
63
63
|
"typescript": "^5.6.3",
|
|
64
64
|
"vitest": "^4.1.2",
|
|
65
|
-
"@nextclaw/ui": "0.13.
|
|
65
|
+
"@nextclaw/ui": "0.13.12"
|
|
66
66
|
},
|
|
67
67
|
"scripts": {
|
|
68
68
|
"dev": "tsx watch --tsconfig ../../scripts/dev/dev-runtime.tsconfig.json src/cli/app/index.ts",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as e,d as t,g as n,i as r,m as i,n as a,o,y as s}from"./react-BVjl1ZaK.js";import{Bt as c,Ft as l,Mt as u,Nt as d,Pt as f,Qt as p,Tt as m,Vt as h,ct as g,it as _,jt as v,mt as y,nt as b,rt as x,zt as S}from"./api-DmxQnm30.js";import{c as C}from"./dist-CyWdaJvr.js";import{n as w,t as T}from"./loader-circle-Dz4FssYC.js";import{t as E}from"./external-link-BLjo8z2a.js";import{t as ee}from"./key-round-Du8x3sWa.js";import{t as D}from"./search-CjHGYvTI.js";import{t as te}from"./x-dpDISboO.js";import{t as O}from"./status-dot-SVPjIyG5.js";import{i as k,n as A,r as ne,t as re}from"./tabs-Czd2mj6z.js";import{$ as j,Ct as ie,Dt as ae,J as M,K as oe,Lt as se,Mt as ce,Q as le,U as ue,W as de,X as fe,Y as pe,Z as me,ht as he,it as ge,kt as _e,q as N}from"./index-DKflQCOL.js";import{t as ve}from"./tabs-custom-Ix4nkp2h.js";import{t as ye}from"./tag-chip-Cdwb3JSH.js";import{t as P}from"./config-hints-Ceiol9x4.js";import{a as F,c as I,i as be,n as xe,o as L,r as Se,s as Ce,t as we}from"./config-split-page-CdJEkWxv.js";var Te=C(`Hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),Ee=C(`Mail`,[[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}]]),R=C(`MessageCircleMore`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}]]),z=C(`QrCode`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),De=C(`ToggleLeft`,[[`rect`,{width:`20`,height:`12`,x:`2`,y:`6`,rx:`6`,ry:`6`,key:`f2vt7d`}],[`circle`,{cx:`8`,cy:`12`,r:`2`,key:`1nvbw3`}]]),B=s(n(),1),V=i();function Oe({value:e,onChange:n,className:i,placeholder:a=``}){let[o,s]=(0,B.useState)(``),c=t=>{t.key===`Enter`&&o.trim()?(t.preventDefault(),n([...e,o.trim()]),s(``)):t.key===`Backspace`&&!o&&e.length>0&&n(e.slice(0,-1))},l=t=>{n(e.filter((e,n)=>n!==t))};return(0,V.jsxs)(`div`,{className:t(`flex min-h-[42px] flex-wrap gap-2 rounded-xl border border-gray-200/80 bg-white p-2`,i),children:[e.map((e,t)=>(0,V.jsxs)(ye,{tone:`info`,className:`gap-1 px-2 py-1 text-sm`,children:[e,(0,V.jsx)(`button`,{type:`button`,onClick:()=>l(t),className:`transition-colors hover:text-rose-200`,children:(0,V.jsx)(te,{className:`h-3 w-3`})})]},t)),(0,V.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),onKeyDown:c,className:`flex-1 outline-none min-w-[100px] bg-transparent text-sm`,placeholder:a||r(`enterTag`)})]})}function ke(e){return e.includes(`token`)||e.includes(`secret`)||e.includes(`password`)?(0,V.jsx)(ee,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`url`)||e.includes(`host`)?(0,V.jsx)(ce,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`email`)||e.includes(`mail`)?(0,V.jsx)(Ee,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`id`)||e.includes(`from`)?(0,V.jsx)(Te,{className:`h-3.5 w-3.5 text-gray-500`}):e===`enabled`||e===`consentGranted`?(0,V.jsx)(De,{className:`h-3.5 w-3.5 text-gray-500`}):(0,V.jsx)(ae,{className:`h-3.5 w-3.5 text-gray-500`})}function Ae({channelName:e,fields:t,formData:n,jsonDrafts:i,setJsonDrafts:a,updateField:o,uiHints:s}){return(0,V.jsx)(V.Fragment,{children:t.map(t=>{let c=P(`channels.${e}.${t.name}`,s),l=c?.label??t.label,u=c?.placeholder;return(0,V.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,V.jsxs)(d,{htmlFor:t.name,className:`flex items-center gap-2 text-sm font-medium text-gray-900`,children:[ke(t.name),l]}),t.type===`boolean`&&(0,V.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl bg-gray-50 p-3`,children:[(0,V.jsx)(`span`,{className:`text-sm text-gray-500`,children:n[t.name]?r(`enabled`):r(`disabled`)}),(0,V.jsx)(y,{id:t.name,checked:n[t.name]||!1,onCheckedChange:e=>o(t.name,e),className:`data-[state=checked]:bg-emerald-500`})]}),(t.type===`text`||t.type===`email`)&&(0,V.jsx)(f,{id:t.name,type:t.type,value:n[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:u,className:`rounded-xl`}),t.type===`password`&&(0,V.jsx)(f,{id:t.name,type:`password`,value:n[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:u??r(`leaveBlankToKeepUnchanged`),className:`rounded-xl`}),t.type===`number`&&(0,V.jsx)(f,{id:t.name,type:`number`,value:n[t.name]||0,onChange:e=>o(t.name,parseInt(e.target.value,10)||0),placeholder:u,className:`rounded-xl`}),t.type===`tags`&&(0,V.jsx)(Oe,{value:n[t.name]||[],onChange:e=>o(t.name,e)}),t.type===`select`&&(0,V.jsxs)(oe,{value:n[t.name]||``,onValueChange:e=>o(t.name,e),children:[(0,V.jsx)(pe,{className:`rounded-xl`,children:(0,V.jsx)(fe,{})}),(0,V.jsx)(N,{children:(t.options??[]).map(e=>(0,V.jsx)(M,{value:e.value,children:e.label},e.value))})]}),t.type===`json`&&(0,V.jsx)(`textarea`,{id:t.name,value:i[t.name]??`{}`,onChange:e=>a(n=>({...n,[t.name]:e.target.value})),className:`min-h-[120px] w-full resize-none rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-mono`})]},t.name)})})}var je=e(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),H=e((e=>{var t,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];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),U=e((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),Me=e(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),Ne=e(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),Pe=e((e=>{var t=H().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),Fe=e((e=>{var t=H().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),Ie=e((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),W=e((e=>{var t=U(),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],r=[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];e.getBlocksCount=function(e,r){switch(r){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}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),Le=e((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),Re=e((e=>{var t=Le();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),ze=e(((e,t)=>{var n=Re();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),G=e((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),K=e((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
|
|
1
|
+
import{_ as e,d as t,g as n,i as r,m as i,n as a,o,y as s}from"./react-BVjl1ZaK.js";import{Bt as c,Ft as l,Mt as u,Nt as d,Pt as f,Qt as p,Tt as m,Vt as h,ct as g,it as _,jt as v,mt as y,nt as b,rt as x,zt as S}from"./api-DmxQnm30.js";import{c as C}from"./dist-CyWdaJvr.js";import{n as w,t as T}from"./loader-circle-Dz4FssYC.js";import{t as E}from"./external-link-BLjo8z2a.js";import{t as ee}from"./key-round-Du8x3sWa.js";import{t as D}from"./search-CjHGYvTI.js";import{t as te}from"./x-dpDISboO.js";import{t as O}from"./status-dot-SVPjIyG5.js";import{i as k,n as A,r as ne,t as re}from"./tabs-Czd2mj6z.js";import{$ as j,Ct as ie,Dt as ae,J as M,K as oe,Lt as se,Mt as ce,Q as le,U as ue,W as de,X as fe,Y as pe,Z as me,ht as he,it as ge,kt as _e,q as N}from"./index-ZDJP_uJc.js";import{t as ve}from"./tabs-custom-Ix4nkp2h.js";import{t as ye}from"./tag-chip-Cdwb3JSH.js";import{t as P}from"./config-hints-Ceiol9x4.js";import{a as F,c as I,i as be,n as xe,o as L,r as Se,s as Ce,t as we}from"./config-split-page-CdJEkWxv.js";var Te=C(`Hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),Ee=C(`Mail`,[[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}]]),R=C(`MessageCircleMore`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}]]),z=C(`QrCode`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),De=C(`ToggleLeft`,[[`rect`,{width:`20`,height:`12`,x:`2`,y:`6`,rx:`6`,ry:`6`,key:`f2vt7d`}],[`circle`,{cx:`8`,cy:`12`,r:`2`,key:`1nvbw3`}]]),B=s(n(),1),V=i();function Oe({value:e,onChange:n,className:i,placeholder:a=``}){let[o,s]=(0,B.useState)(``),c=t=>{t.key===`Enter`&&o.trim()?(t.preventDefault(),n([...e,o.trim()]),s(``)):t.key===`Backspace`&&!o&&e.length>0&&n(e.slice(0,-1))},l=t=>{n(e.filter((e,n)=>n!==t))};return(0,V.jsxs)(`div`,{className:t(`flex min-h-[42px] flex-wrap gap-2 rounded-xl border border-gray-200/80 bg-white p-2`,i),children:[e.map((e,t)=>(0,V.jsxs)(ye,{tone:`info`,className:`gap-1 px-2 py-1 text-sm`,children:[e,(0,V.jsx)(`button`,{type:`button`,onClick:()=>l(t),className:`transition-colors hover:text-rose-200`,children:(0,V.jsx)(te,{className:`h-3 w-3`})})]},t)),(0,V.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),onKeyDown:c,className:`flex-1 outline-none min-w-[100px] bg-transparent text-sm`,placeholder:a||r(`enterTag`)})]})}function ke(e){return e.includes(`token`)||e.includes(`secret`)||e.includes(`password`)?(0,V.jsx)(ee,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`url`)||e.includes(`host`)?(0,V.jsx)(ce,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`email`)||e.includes(`mail`)?(0,V.jsx)(Ee,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`id`)||e.includes(`from`)?(0,V.jsx)(Te,{className:`h-3.5 w-3.5 text-gray-500`}):e===`enabled`||e===`consentGranted`?(0,V.jsx)(De,{className:`h-3.5 w-3.5 text-gray-500`}):(0,V.jsx)(ae,{className:`h-3.5 w-3.5 text-gray-500`})}function Ae({channelName:e,fields:t,formData:n,jsonDrafts:i,setJsonDrafts:a,updateField:o,uiHints:s}){return(0,V.jsx)(V.Fragment,{children:t.map(t=>{let c=P(`channels.${e}.${t.name}`,s),l=c?.label??t.label,u=c?.placeholder;return(0,V.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,V.jsxs)(d,{htmlFor:t.name,className:`flex items-center gap-2 text-sm font-medium text-gray-900`,children:[ke(t.name),l]}),t.type===`boolean`&&(0,V.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl bg-gray-50 p-3`,children:[(0,V.jsx)(`span`,{className:`text-sm text-gray-500`,children:n[t.name]?r(`enabled`):r(`disabled`)}),(0,V.jsx)(y,{id:t.name,checked:n[t.name]||!1,onCheckedChange:e=>o(t.name,e),className:`data-[state=checked]:bg-emerald-500`})]}),(t.type===`text`||t.type===`email`)&&(0,V.jsx)(f,{id:t.name,type:t.type,value:n[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:u,className:`rounded-xl`}),t.type===`password`&&(0,V.jsx)(f,{id:t.name,type:`password`,value:n[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:u??r(`leaveBlankToKeepUnchanged`),className:`rounded-xl`}),t.type===`number`&&(0,V.jsx)(f,{id:t.name,type:`number`,value:n[t.name]||0,onChange:e=>o(t.name,parseInt(e.target.value,10)||0),placeholder:u,className:`rounded-xl`}),t.type===`tags`&&(0,V.jsx)(Oe,{value:n[t.name]||[],onChange:e=>o(t.name,e)}),t.type===`select`&&(0,V.jsxs)(oe,{value:n[t.name]||``,onValueChange:e=>o(t.name,e),children:[(0,V.jsx)(pe,{className:`rounded-xl`,children:(0,V.jsx)(fe,{})}),(0,V.jsx)(N,{children:(t.options??[]).map(e=>(0,V.jsx)(M,{value:e.value,children:e.label},e.value))})]}),t.type===`json`&&(0,V.jsx)(`textarea`,{id:t.name,value:i[t.name]??`{}`,onChange:e=>a(n=>({...n,[t.name]:e.target.value})),className:`min-h-[120px] w-full resize-none rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-mono`})]},t.name)})})}var je=e(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),H=e((e=>{var t,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];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),U=e((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),Me=e(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),Ne=e(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),Pe=e((e=>{var t=H().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),Fe=e((e=>{var t=H().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),Ie=e((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),W=e((e=>{var t=U(),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],r=[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];e.getBlocksCount=function(e,r){switch(r){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}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),Le=e((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),Re=e((e=>{var t=Le();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),ze=e(((e,t)=>{var n=Re();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),G=e((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),K=e((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
|
|
2
2
|
]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^`+t+`$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),q=e((e=>{var t=G(),n=K();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),Be=e((e=>{var t=H(),n=W(),r=U(),i=q(),a=G(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),Ve=e((e=>{var t=H(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),He=e(((e,t)=>{var n=q();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),Ue=e(((e,t)=>{var n=q(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),We=e(((e,t)=>{var n=q();function r(e){this.mode=n.BYTE,typeof e==`string`?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),Ge=e(((e,t)=>{var n=q(),r=H();function i(e){this.mode=n.KANJI,this.data=e}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(e){let t;for(t=0;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
|
|
3
3
|
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),Ke=e(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),qe=e((e=>{var t=q(),n=He(),r=Ue(),i=We(),a=Ge(),o=K(),s=H(),c=Ke();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
|
|
4
4
|
Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),Je=e((e=>{var t=H(),n=U(),r=Me(),i=Ne(),a=Pe(),o=Fe(),s=Ie(),c=W(),l=ze(),u=Be(),d=Ve(),f=q(),p=qe();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as e,g as t,i as n,m as r,y as i}from"./react-BVjl1ZaK.js";import{D as a,E as o,I as s,L as c,R as l,w as u}from"./app-presenter-provider-CDSjiqfE.js";import{A as d,Bt as f,D as p,Dt as m,E as h,Et as g,Ft as _,Gt as v,Jt as y,Kt as b,Mt as x,O as S,Pt as C,Qt as w,Ut as T,Vt as E,Wt as D,Xt as O,Yt as k,an as A,in as ee,j as te,jt as ne,k as re,mt as j,nn as M,on as ie,qt as ae,rn as N,sn as oe,yt as se,zt as P}from"./api-DmxQnm30.js";import{a as ce,c as le,i as F,l as I,n as ue,o as de,r as fe,s as pe}from"./mcp-marketplace-page-BaBuHB2L.js";import{c as L}from"./dist-CyWdaJvr.js";import{a as me,i as he,n as ge,o as _e,r as ve,s as ye}from"./confirm-dialog-BWRNsRgb.js";import{t as be}from"./arrow-left-Dd45Mvr1.js";import{i as R,n as z,r as xe,t as B}from"./tooltip-CKGxLGnG.js";import{t as Se}from"./provider-scoped-model-input-BgPTQa8H.js";import{t as Ce}from"./ellipsis-BDgTYNDX.js";import{t as we}from"./play-BziM-Y34.js";import{t as Te}from"./plus-DrpyArC8.js";import{t as Ee}from"./refresh-cw-DFR87zei.js";import{t as De}from"./trash-2-yLA8BEcE.js";import{t as Oe}from"./notice-card-3a7FmAz-.js";import{n as ke,r as Ae,t as je}from"./popover-BlJLguiZ.js";import{n as Me}from"./doc-browser-context-CpL2m4Sp.js";import{A as Ne,At as Pe,B as Fe,Bt as Ie,C as Le,Ct as Re,D as ze,E as Be,Et as Ve,F as He,Ft as Ue,H as We,I as V,It as Ge,J as H,K as Ke,L as qe,Lt as Je,M as Ye,N as Xe,O as Ze,Ot as Qe,P as $e,Pt as et,R as tt,S as nt,T as rt,V as it,X as at,Y as ot,Z as st,_ as ct,a as lt,b as ut,c as dt,d as ft,dt as pt,f as mt,g as ht,h as gt,i as _t,j as vt,jt as yt,k as bt,l as xt,lt as St,m as Ct,mt as wt,n as Tt,nt as Et,o as Dt,ot as Ot,p as kt,q as At,r as jt,s as Mt,st as Nt,t as Pt,tt as Ft,u as U,ut as It,v as Lt,w as Rt,wt as zt,x as W,y as G,z as Bt,zt as Vt}from"./index-DKflQCOL.js";import{t as Ht}from"./tabs-custom-Ix4nkp2h.js";import{t as Ut}from"./tag-chip-Cdwb3JSH.js";import{c as Wt,n as Gt,r as Kt}from"./provider-models-C_yOh6DE.js";function qt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Jt(e,t,n){let r=e.slice(0);return r[t]=n,r}var Yt=class extends oe{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,N.batch(()=>{let e=this.#i,t=this.#f(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!ie(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(qt(e,n).forEach(e=>{e.destroy()}),qt(n,e).forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})),this.#m()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#f(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=A(this.#a,t(e))),this.#a}return e}#f(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new M(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#p(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Jt(this.#t,n,t),this.#m())}#m(){if(this.hasListeners()){let e=this.#a,t=this.#u(this.#t,this.#l);e!==this.#d(t,this.#r?.combine)&&N.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},K=i(t(),1);function Xt({queries:e,...t},n){let r=w(n),i=O(),a=k(),o=K.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{T(e),b(e,a,r.getQueryCache().get(e.queryHash))}),y(a);let[s]=K.useState(()=>new Yt(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;K.useSyncExternalStore(K.useCallback(e=>d?s.subscribe(N.batchCalls(e)):ee,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),K.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>v(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&v(n,e)?D(n,new M(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&ae({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}var Zt=L(`BriefcaseBusiness`,[[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2`,key:`1ksdt3`}],[`path`,{d:`M22 13a18.15 18.15 0 0 1-20 0`,key:`12hx5q`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`6`,rx:`2`,key:`i6l2r4`}]]),Qt=L(`CalendarClock`,[[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M17.5 17.5 16 16.3V14`,key:`akvzfd`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),$t=L(`CircleAlert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),en=L(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),tn=L(`Clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]),nn=L(`Compass`,[[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),rn=L(`Earth`,[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),an=L(`ListTodo`,[[`rect`,{x:`3`,y:`5`,width:`6`,height:`6`,rx:`1`,key:`1defrl`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`M13 6h8`,key:`15sg57`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 18h8`,key:`oe0vm4`}]]),on=L(`MessagesSquare`,[[`path`,{d:`M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z`,key:`p1xzt8`}],[`path`,{d:`M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1`,key:`1cx29u`}]]),sn=L(`PenLine`,[[`path`,{d:`M12 20h9`,key:`t2du7b`}],[`path`,{d:`M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z`,key:`1ykcvy`}]]),cn=L(`SquareTerminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),q=r(),ln=K.forwardRef(({className:t,...n},r)=>(0,q.jsx)(`textarea`,{className:e(`flex min-h-28 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2.5 text-sm text-gray-900 placeholder:text-gray-300 placeholder:font-normal focus:outline-none focus:ring-1 focus:ring-primary/40 focus:border-primary/40 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,t),ref:r,...n}));ln.displayName=`Textarea`;function un(e){return{displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,model:e.model??``,runtime:e.runtime??e.engine??``}}function dn(e){let{runtimeOptions:t,currentRuntime:n}=e,r=n.trim();if(!r)return t;let i=G(r);return t.some(e=>e.value===i)?t:[...t,{value:i,label:W(i),icon:null,ready:!1,reason:`unavailable`,reasonMessage:null,supportedModels:void 0,recommendedModel:null,cta:null}].sort((e,t)=>e.value===`native`?-1:t.value===`native`?1:e.value.localeCompare(t.value))}function fn({value:e,disabled:t=!1,runtimeOptions:r,defaultRuntime:i,onChange:a}){let o=e.trim()?G(e):``,s=dn({runtimeOptions:r,currentRuntime:e}),c=s.find(e=>e.value===o)??null,l=c?.reasonMessage?.trim()||(c?.ready===!1?n(`agentsRuntimeUnavailableHelp`):``);return(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsxs)(Ke,{value:o||i,onValueChange:e=>a(e===i?``:e),disabled:t,children:[(0,q.jsx)(ot,{"aria-label":n(`agentsCardRuntimeLabel`),className:`rounded-xl`,children:(0,q.jsx)(at,{placeholder:n(`agentsRuntimeSelectPlaceholder`)})}),(0,q.jsx)(At,{className:`rounded-xl`,children:s.map(e=>(0,q.jsx)(H,{value:e.value,disabled:e.ready===!1&&e.value!==o,className:`rounded-lg`,children:e.label},e.value))})]}),l?(0,q.jsx)(`p`,{className:`text-xs text-gray-500`,children:l}):null]})}function pn({agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,q.jsx)(ge,{open:e!==null,onOpenChange:a,children:e?(0,q.jsx)(mn,{agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e.id):null})}function mn(e){let{agent:t,pending:r,providerCatalog:i,runtimeOptions:a,defaultRuntime:o,onOpenChange:s,onSubmit:c}=e,[l,u]=(0,K.useState)(un(t));return(0,q.jsxs)(ve,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-[linear-gradient(180deg,#fff9f1_0%,#ffffff_24%)] p-0 sm:max-h-[760px] sm:max-w-xl`,children:[(0,q.jsx)(`div`,{className:`shrink-0 border-b border-[#f0e2c8] px-6 py-6`,children:(0,q.jsxs)(_e,{className:`text-left`,children:[(0,q.jsx)(ye,{children:n(`agentsEditDialogTitle`)}),(0,q.jsx)(he,{children:n(`agentsEditDialogDescription`)})]})}),(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(Oe,{tone:`warning`,title:n(`agentsEditHomeReadonly`),description:n(`agentsEditHomeReadonlyHint`),children:(0,q.jsx)(`div`,{className:`break-all text-sm text-amber-950`,children:t.workspace??`-`})}),(0,q.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,q.jsx)(C,{value:l.displayName,onChange:e=>u(t=>({...t,displayName:e.target.value})),placeholder:n(`agentsFormNamePlaceholder`)}),(0,q.jsx)(ln,{value:l.description,onChange:e=>u(t=>({...t,description:e.target.value})),placeholder:n(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,q.jsx)(C,{value:l.avatar,onChange:e=>u(t=>({...t,avatar:e.target.value})),placeholder:n(`agentsFormAvatarPlaceholder`)}),(0,q.jsx)(Se,{value:l.model,onChange:e=>u(t=>({...t,model:e})),providerCatalog:i,disabled:r,className:`md:col-span-2`}),(0,q.jsx)(fn,{value:l.runtime,onChange:e=>u(t=>({...t,runtime:e})),runtimeOptions:a,defaultRuntime:o,disabled:r})]})]})}),(0,q.jsxs)(me,{className:`shrink-0 border-t border-[#f1e7d4] px-6 py-5`,children:[(0,q.jsx)(_,{type:`button`,variant:`ghost`,onClick:()=>s(!1),disabled:r,children:n(`cancel`)}),(0,q.jsxs)(_,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>c(t.id,l),disabled:r,children:[(0,q.jsx)(Qe,{className:`mr-2 h-4 w-4`}),n(`agentsEditSaveAction`)]})]})]})}var hn=`请直接创建一个默认示例 Agent,不要问我问题。创建完成后,简单告诉我它能做什么。`;function gn(e){let{agentCount:t,onCreate:r}=e;return(0,q.jsxs)(`section`,{className:`flex flex-col gap-3 border-b border-gray-200 pb-4 sm:flex-row sm:items-end sm:justify-between`,children:[(0,q.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`h1`,{className:`text-xl font-semibold text-gray-950`,children:n(`agentsHeroEyebrow`)}),(0,q.jsx)(`span`,{className:`rounded-full border border-gray-200 bg-white px-2 py-0.5 text-xs font-medium text-gray-500`,children:t})]}),(0,q.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-gray-500`,children:n(`agentsHeroDescription`)})]}),(0,q.jsxs)(_,{type:`button`,variant:`primary`,className:`h-9 shrink-0 rounded-xl px-4 text-sm font-semibold`,onClick:r,children:[(0,q.jsx)(Te,{className:`mr-2 h-4 w-4`}),n(`agentsCreateButton`)]})]})}function _n(t){let{icon:n,label:r,disabled:i=!1,destructive:a=!1,onClick:o}=t;return(0,q.jsxs)(`button`,{type:`button`,className:e(`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50`,a?`text-destructive hover:bg-destructive/10`:`text-gray-700 hover:bg-gray-100`),onClick:o,disabled:i,children:[(0,q.jsx)(n,{className:`h-4 w-4 shrink-0`}),(0,q.jsx)(`span`,{children:r})]})}function vn(e){let{agent:t,runtimeOptions:r,defaultRuntimeLabel:i,updatePending:a,deletePending:o,onStartChat:s,onEdit:c,onDelete:l}=e,d=t.runtime?.trim()||t.engine?.trim()||``,f=d?r.find(e=>e.value===G(d))?.label??W(d):i;return(0,q.jsx)(g,{className:`group overflow-hidden border border-gray-200 bg-white shadow-none transition-colors duration-200 hover:border-gray-300`,children:(0,q.jsxs)(m,{className:`relative flex h-full flex-col gap-3 px-3.5 py-3.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-2.5 pr-16`,children:[(0,q.jsx)(We,{agentId:t.id,displayName:t.displayName,avatarUrl:t.avatarUrl,className:`h-9 w-9 shrink-0`}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`div`,{className:`truncate text-sm font-semibold text-gray-950`,children:t.displayName?.trim()||t.id}),t.builtIn?(0,q.jsxs)(Ut,{tone:`warning`,className:`h-5 gap-1 border-amber-200 bg-amber-50 px-1.5 text-[10px] text-amber-700`,children:[(0,q.jsx)(u,{className:`h-3 w-3`}),n(`agentsCardBuiltInTag`)]}):null]}),(0,q.jsxs)(`div`,{className:`truncate text-xs text-gray-400`,children:[`@`,t.id]})]})]}),(0,q.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 flex items-center gap-1 opacity-100 transition-opacity md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,children:[(0,q.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-gray-400 hover:text-gray-800`,"aria-label":n(`agentsCardStartChat`),title:n(`agentsCardStartChat`),onClick:s,children:(0,q.jsx)(Pe,{className:`h-4 w-4`})}),(0,q.jsxs)(je,{children:[(0,q.jsx)(Ae,{asChild:!0,children:(0,q.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-gray-400 hover:text-gray-800`,"aria-label":n(`chatSessionMoreActions`),title:n(`chatSessionMoreActions`),children:(0,q.jsx)(Ce,{className:`h-4 w-4`})})}),(0,q.jsxs)(ke,{align:`end`,className:`w-44 p-1.5`,children:[(0,q.jsx)(_n,{icon:Qe,label:n(`agentsEditAction`),onClick:c,disabled:a}),t.builtIn?null:(0,q.jsx)(_n,{icon:De,label:n(`agentsRemoveAction`),onClick:l,disabled:o,destructive:!0})]})]})]}),(0,q.jsx)(`p`,{className:`line-clamp-2 min-h-10 text-sm leading-5 text-gray-600`,children:t.description?.trim()||(t.builtIn?n(`agentsCardBuiltInSummary`):n(`agentsCardCustomSummary`))}),(0,q.jsxs)(`div`,{className:`mt-auto grid gap-2 border-t border-gray-100 pt-2 text-xs text-gray-500`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(Ve,{className:`h-3.5 w-3.5 shrink-0 text-gray-300`}),(0,q.jsx)(`span`,{className:`truncate`,children:f})]}),(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(yt,{className:`h-3.5 w-3.5 shrink-0 text-gray-300`}),(0,q.jsx)(`span`,{className:`truncate`,children:t.workspace??`-`})]})]})]})})}function yn(){let e=Bt(),t=Le(),r=st(),i=It(),a=St(),o=Mt(),s=rt(),c=Rt(),[l,u]=(0,K.useState)(null),d=(0,K.useMemo)(()=>t.data?.agents??[],[t.data?.agents]),f=(0,K.useMemo)(()=>[...d].sort((e,t)=>Number(!!t.builtIn)-Number(!!e.builtIn)||e.id.localeCompare(t.id)),[d]),p=(0,K.useMemo)(()=>Gt({config:r.data,providersView:i.data,templatesView:a.data,onlyConfigured:!0}),[r.data,i.data,a.data]),h=(0,K.useMemo)(()=>Lt(o.data?.options??[]),[o.data?.options]),v=(0,K.useMemo)(()=>G(o.data?.defaultType??`native`),[o.data?.defaultType]),y=(0,K.useMemo)(()=>h.find(e=>e.value===v)?.label??W(v),[v,h]),b=e=>{u(e)},S=async(e,t)=>{await s.mutateAsync({agentId:e,data:{displayName:t.displayName,description:t.description,avatar:t.avatar,model:t.model,...t.runtime.trim()?{runtime:t.runtime.trim()}:{runtime:``}}}),u(null)},C=t=>{e.chatSessionListManager.startAgentDraftChat(t.id,ut(t,v))};return(0,q.jsxs)(x,{className:`space-y-5`,children:[(0,q.jsx)(gn,{agentCount:d.length,onCreate:()=>e.startAgentCreationDraft(hn)}),(0,q.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:t.isLoading?(0,q.jsx)(g,{className:`md:col-span-2 xl:col-span-3 border-dashed border-[#d9dce3] bg-white/70`,children:(0,q.jsx)(m,{className:`py-14 text-center text-sm text-gray-500`,children:n(`agentsLoading`)})}):f.length===0?(0,q.jsx)(g,{className:`md:col-span-2 xl:col-span-3 overflow-hidden border-dashed border-[#d9dce3] bg-[linear-gradient(135deg,#fff7ea_0%,#f4fbff_100%)]`,children:(0,q.jsxs)(m,{className:`flex min-h-[240px] flex-col items-center justify-center px-6 py-14 text-center`,children:[(0,q.jsx)(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-white/80 shadow-[0_18px_44px_rgba(0,0,0,0.08)]`,children:(0,q.jsx)(Vt,{className:`h-8 w-8 text-[#d39a3b]`})}),(0,q.jsx)(`div`,{className:`text-lg font-semibold text-[#2f2212]`,children:n(`agentsEmpty`)}),(0,q.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-[#78644d]`,children:n(`agentsEmptyDescription`)}),(0,q.jsxs)(_,{type:`button`,variant:`primary`,className:`mt-5 rounded-2xl px-5`,onClick:()=>e.startAgentCreationDraft(hn),children:[(0,q.jsx)(Te,{className:`mr-2 h-4 w-4`}),n(`agentsCreateButton`)]})]})}):f.map(e=>(0,q.jsx)(vn,{agent:e,runtimeOptions:h,defaultRuntimeLabel:y,updatePending:s.isPending,deletePending:c.isPending,onStartChat:()=>C(e),onEdit:()=>b(e),onDelete:()=>c.mutate({agentId:e.id})},e.id))}),(0,q.jsx)(pn,{agent:l,pending:s.isPending,providerCatalog:p,runtimeOptions:h,defaultRuntime:v,onOpenChange:e=>{!e&&!s.isPending&&u(null)},onSubmit:S})]})}function bn(e,t){let n=t.trim().toLowerCase();return n?[e.id,e.name,e.payload.message,e.payload.sessionId??``].join(` `).toLowerCase().includes(n):!0}function xn(e,t){return t===`all`?!0:t===`enabled`?e.enabled:!e.enabled}function Sn({job:t}){return(0,q.jsxs)(`span`,{className:e(`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-semibold`,t.enabled?`bg-emerald-50 text-emerald-700`:`bg-gray-100 text-gray-500`),children:[(0,q.jsx)(`span`,{className:e(`h-1.5 w-1.5 rounded-full`,t.enabled?`bg-emerald-400`:`bg-gray-400`)}),t.enabled?n(`enabled`):n(`disabled`)]})}function Cn(t){let{job:r,onDelete:i,onRun:a,onToggle:s}=t,[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(!1),f=r.enabled?`bg-emerald-400`:`bg-gray-300`;return(0,q.jsxs)(`div`,{className:e(`group relative overflow-hidden rounded-xl border bg-white transition-all duration-150 cursor-pointer`,c?`border-gray-300 shadow-sm`:`border-gray-200 hover:border-gray-300 hover:shadow-sm`),onClick:e=>{e.target.closest(`[data-no-expand]`)||l(!c)},children:[(0,q.jsx)(`div`,{className:e(`absolute left-0 top-0 bottom-0 w-1 rounded-l-xl`,f)}),(0,q.jsxs)(`div`,{className:`pl-4 pr-3 py-3`,children:[` `,(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c?(0,q.jsx)(Je,{className:`h-3.5 w-3.5 text-gray-400 shrink-0`}):(0,q.jsx)(Ge,{className:`h-3.5 w-3.5 text-gray-300 shrink-0 group-hover:text-gray-500 transition-colors`}),(0,q.jsx)(`span`,{className:`text-sm font-semibold text-gray-900 truncate`,children:r.name||r.id}),(0,q.jsx)(Sn,{job:r}),r.deleteAfterRun&&(0,q.jsx)(`span`,{className:`rounded-full bg-amber-50 px-1.5 py-0.5 text-[10px] font-medium text-amber-600`,children:n(`cronOneShot`)})]})}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,"data-no-expand":!0,children:[(0,q.jsx)(j,{checked:r.enabled,onCheckedChange:e=>s(r,e)}),(0,q.jsxs)(je,{open:u,onOpenChange:d,children:[(0,q.jsx)(Ae,{asChild:!0,children:(0,q.jsx)(_,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-gray-400 hover:text-gray-600`,"aria-label":n(`cronMoreActions`),children:(0,q.jsx)(o,{className:`h-4 w-4`})})}),(0,q.jsxs)(ke,{align:`end`,sideOffset:4,className:`w-40 p-1`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{d(!1),a(r)},className:`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-gray-700 transition-colors hover:bg-gray-100`,children:[(0,q.jsx)(we,{className:`h-3.5 w-3.5 text-gray-500`}),n(`cronRunNow`)]}),(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{d(!1),i(r)},className:`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-600 transition-colors hover:bg-red-50`,children:[(0,q.jsx)(De,{className:`h-3.5 w-3.5`}),n(`delete`)]})]})]})]})]}),(0,q.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-gray-500 pl-6`,children:[(0,q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(Qt,{className:`h-3 w-3 text-gray-400`}),(0,q.jsx)(`span`,{className:`font-mono text-gray-600`,children:ft(r)})]}),r.state.nextRunAt&&(0,q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(tn,{className:`h-3 w-3 text-gray-400`}),(0,q.jsx)(`span`,{children:Ct(r.state.nextRunAt)})]}),r.state.lastRunAt&&(0,q.jsxs)(`span`,{className:`flex items-center gap-1`,"data-no-expand":!0,children:[(0,q.jsx)(`span`,{className:`text-gray-300`,children:`•`}),r.state.lastStatus===`error`&&r.state.lastError?(0,q.jsx)(xe,{delayDuration:200,children:(0,q.jsxs)(B,{children:[(0,q.jsx)(R,{asChild:!0,children:(0,q.jsx)(`span`,{className:`inline-flex items-center gap-0.5 text-orange-400 cursor-help`,children:(0,q.jsx)($t,{className:`h-3 w-3`})})}),(0,q.jsx)(z,{side:`top`,align:`start`,className:`max-w-xs text-xs bg-red-50 text-red-700 border-red-200`,children:r.state.lastError})]})}):(0,q.jsx)(`span`,{className:e(r.state.lastStatus===`ok`?`text-emerald-400`:`text-gray-400`),children:r.state.lastStatus===`ok`?`✓`:``}),(0,q.jsx)(`span`,{children:Ct(r.state.lastRunAt)})]})]}),(0,q.jsx)(`div`,{className:`mt-2 pl-6`,children:(0,q.jsx)(`div`,{className:e(`text-sm text-gray-600 break-words`,!c&&`line-clamp-2`),children:r.payload.message})}),c&&(0,q.jsxs)(`div`,{className:`mt-3 ml-6 space-y-3 animate-in fade-in-0 slide-in-from-top-1 duration-150`,children:[(0,q.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 gap-x-4 gap-y-2 text-xs`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`text-[11px] text-gray-400 mb-0.5`,children:n(`cronSessionLabel`)}),(0,q.jsx)(`div`,{className:`text-gray-700 font-mono text-[11px] truncate`,title:mt(r),children:mt(r)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`text-[11px] text-gray-400 mb-0.5`,children:n(`cronNextRun`)}),(0,q.jsx)(`div`,{className:`text-gray-700`,children:kt(r.state.nextRunAt)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`text-[11px] text-gray-400 mb-0.5`,children:n(`cronLastRun`)}),(0,q.jsx)(`div`,{className:`text-gray-700`,children:kt(r.state.lastRunAt)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`text-[11px] text-gray-400 mb-0.5`,children:n(`cronLastStatus`)}),(0,q.jsx)(`div`,{className:e(`inline-flex items-center gap-1 font-medium`,r.state.lastStatus===`ok`?`text-emerald-600`:r.state.lastStatus===`error`?`text-red-600`:r.state.lastStatus===`skipped`?`text-amber-600`:`text-gray-500`),children:r.state.lastStatus??`-`})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`text-[11px] text-gray-400 mb-0.5`,children:n(`cronCreatedAt`)}),(0,q.jsx)(`div`,{className:`text-gray-700`,children:kt(r.createdAt)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`text-[11px] text-gray-400 mb-0.5`,children:n(`cronId`)}),(0,q.jsx)(`div`,{className:`text-gray-700 font-mono text-[11px] truncate`,title:r.id,children:r.id})]})]}),r.state.lastError&&(0,q.jsx)(`div`,{className:`rounded-lg bg-red-50 border border-red-100 px-3 py-2 text-xs text-red-600 break-words`,children:r.state.lastError})]})]})]})}function wn(){let[t,r]=(0,K.useState)(``),[i,a]=(0,K.useState)(`all`),o=Ft({all:!0}),s=Et(),c=wt(),l=pt(),{confirm:u,ConfirmDialog:d}=gt(),f=(0,K.useMemo)(()=>(o.data?.jobs??[]).filter(e=>bn(e,t)).filter(e=>xn(e,i)),[o.data,t,i]),p=async e=>{await u({title:`${n(`cronDeleteConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,variant:`destructive`,confirmLabel:n(`delete`)})&&s.mutate({id:e.id})},m=(e,t)=>{c.mutate({id:e.id,enabled:t})},h=async e=>{let t=!e.enabled;t&&!await u({title:`${n(`cronRunForceConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,confirmLabel:n(`cronRunNow`)})||l.mutate({id:e.id,force:t})};return(0,q.jsxs)(x,{fullHeight:!0,children:[(0,q.jsx)(ne,{title:n(`cronPageTitle`),description:n(`cronPageDescription`),actions:(0,q.jsx)(_,{variant:`ghost`,size:`icon`,className:`h-9 w-9 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100`,onClick:()=>o.refetch(),children:(0,q.jsx)(Ee,{className:e(`h-4 w-4`,o.isFetching&&`animate-spin`)})})}),(0,q.jsx)(`div`,{className:`mb-5`,children:(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center`,children:[(0,q.jsxs)(`div`,{className:`relative flex-1 min-w-[240px]`,children:[(0,q.jsx)(C,{value:t,onChange:e=>r(e.target.value),placeholder:n(`cronSearchPlaceholder`),className:`pl-9`}),(0,q.jsx)(Ie,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`})]}),(0,q.jsx)(`div`,{className:`min-w-[140px]`,children:(0,q.jsxs)(Ke,{value:i,onValueChange:e=>a(e),children:[(0,q.jsx)(ot,{className:`w-full`,children:(0,q.jsx)(at,{placeholder:n(`cronStatusLabel`)})}),(0,q.jsxs)(At,{children:[(0,q.jsx)(H,{value:`all`,children:n(`cronStatusAll`)}),(0,q.jsx)(H,{value:`enabled`,children:n(`cronStatusEnabled`)}),(0,q.jsx)(H,{value:`disabled`,children:n(`cronStatusDisabled`)})]})]})}),(0,q.jsxs)(`div`,{className:`text-xs text-gray-400 ml-auto tabular-nums`,children:[f.length,` / `,o.data?.total??0]})]})}),(0,q.jsx)(`div`,{className:`flex-1 overflow-auto custom-scrollbar`,children:o.isLoading?(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 text-gray-400`,children:[(0,q.jsx)(Ee,{className:`h-6 w-6 animate-spin mb-3`}),(0,q.jsx)(`span`,{className:`text-sm`,children:n(`cronLoading`)})]}):f.length===0?(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 text-gray-400`,children:[(0,q.jsx)(an,{className:`h-10 w-10 mb-3 text-gray-300`}),(0,q.jsx)(`span`,{className:`text-sm font-medium text-gray-500`,children:n(`cronEmpty`)}),(0,q.jsx)(`span`,{className:`text-xs text-gray-400 mt-1`,children:n(`cronEmptyGuide`)})]}):(0,q.jsx)(`div`,{className:`space-y-2.5`,children:f.map(e=>(0,q.jsx)(Cn,{job:e,onDelete:p,onRun:h,onToggle:m},e.id))})}),(0,q.jsx)(d,{})]})}function Tn(e){return Array.from(new Set(e.map(e=>e.spec).filter(Boolean)))}function En(e){let t=new Date().toISOString();return e.result.type===`skill`?{type:`skill`,spec:e.result.spec,id:e.request.skill??e.result.spec,label:e.request.skill??e.result.name??e.result.spec,source:`workspace`,installPath:e.request.installPath,installedAt:t}:{type:e.result.type,spec:e.result.spec,id:e.result.name??e.result.spec,label:e.result.name??e.result.spec,source:`marketplace`,origin:`marketplace`,enabled:e.request.enabled??!0,runtimeStatus:e.request.enabled===!1?`disabled`:`ready`,installedAt:t}}function Dn(e,t){return!!(t.spec&&e.spec===t.spec||t.id&&e.id===t.id)}function On(e,t){return t??{type:e,total:0,specs:[],records:[]}}function kn(e){let t=On(e.result.type,e.view),n=En(e),r=t.records.findIndex(e=>Dn(e,{id:n.id,spec:n.spec})),i=[...t.records];return r>=0?i[r]={...i[r],...n}:i.unshift(n),{...t,type:e.result.type,records:i,specs:Tn(i),total:i.length}}function An(e){let t=On(e.result.type,e.view);if(e.result.action===`uninstall`||e.result.action===`remove`){let n=t.records.filter(t=>!Dn(t,{id:e.result.id,spec:e.request.spec}));return{...t,records:n,specs:Tn(n),total:n.length}}let n=t.records.map(t=>Dn(t,{id:e.result.id,spec:e.request.spec})?e.result.action===`disable`?{...t,enabled:!1,runtimeStatus:`disabled`}:e.result.action===`update`?{...t,installedAt:new Date().toISOString(),origin:t.origin??`marketplace`}:{...t,enabled:!0,runtimeStatus:`ready`}:t);return{...t,records:n,specs:Tn(n),total:n.length}}function jn(e){let t=I({queryKey:[`marketplace-items`,e],initialPageParam:1,queryFn:({pageParam:t})=>p({...e,page:t}),getNextPageParam:e=>e.page<e.totalPages?e.page+1:void 0,placeholderData:(t,n)=>{let r=n?.queryKey?.[1];if(!(!r||typeof r!=`object`||!r))return(`type`in r?r.type:void 0)===e.type&&Mn(r,e)?t:void 0},staleTime:15e3}),n=(0,K.useMemo)(()=>le(t.data),[t.data]);return{...t,data:n}}function Mn(e,t){return e.q===t.q&&e.tag===t.tag&&e.scene===t.scene&&e.sort===t.sort&&e.pageSize===t.pageSize}function Nn(e=!0){return E({queryKey:[`marketplace-skill-scenes`],queryFn:re,enabled:e,staleTime:6e4})}function Pn(e,t=!0){let n=Xt({queries:e.map(e=>({queryKey:[`marketplace-skill-scene-count`,e.scene],queryFn:()=>p({type:`skill`,scene:e.scene,pageSize:1}),enabled:t&&typeof e.count!=`number`,staleTime:6e4}))});return(0,K.useMemo)(()=>{let t=new Map;return e.forEach((e,r)=>{let i=typeof e.count==`number`?e.count:n[r]?.data?.total;typeof i==`number`&&t.set(e.scene,i)}),t},[n,e])}function Fn(e){return E({queryKey:[`marketplace-installed`,e],queryFn:()=>h(e),staleTime:1e4})}function In(){let e=w();return f({mutationFn:e=>d(e),onSuccess:(t,r)=>{e.setQueryData([`marketplace-installed`,t.type],e=>kn({view:e,request:r,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`}),P.success(t.message||n(`marketplaceInstallSuccessSkill`))},onError:e=>{P.error(e.message||n(`marketplaceInstallFailed`))}})}function Ln(){let e=w();return f({mutationFn:e=>te(e),onSuccess:(t,r)=>{e.setQueryData([`marketplace-installed`,t.type],e=>An({view:e,request:r,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`});let i=t.action===`enable`?n(`marketplaceEnableSuccess`):t.action===`disable`?n(`marketplaceDisableSuccess`):t.action===`update`?n(`marketplaceUpdateSuccess`):n(`marketplaceUninstallSuccess`);P.success(t.message||i)},onError:e=>{P.error(e.message||n(`marketplaceOperationFailed`))}})}function Rn(e){return(e??``).trim().toLowerCase()}function J(e,t){let n=Rn(t);return n.length>0?`${e}:${n}`:``}function zn(e){let t=new Map;for(let n of e){let e=[n.install.spec,n.slug,n.id];for(let r of e){let e=J(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function Bn(e){let t=new Map;for(let n of e){let e=[n.spec,n.id,n.label];for(let r of e){let e=J(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function Vn(e,t){let n=[e.install.spec,e.slug,e.id];for(let r of n){let n=J(e.type,r);if(!n)continue;let i=t.get(n);if(i)return i}}function Hn(e,t){return t.get(J(e.type,e.spec))||t.get(J(e.type,e.id))||t.get(J(e.type,e.label))}function Un(e,t,n,r){let i=Rn(n);if(!i)return!0;let a=F(t?.summaryI18n,t?.summary,r);return[e.id,e.spec,e.label,t?.name,t?.slug,t?.summary,a,...t?.tags??[]].map(e=>Rn(e)).filter(Boolean).some(e=>e.includes(i))}function Y(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function Wn(e){let t=e.replace(/\r\n/g,`
|
|
1
|
+
import{d as e,g as t,i as n,m as r,y as i}from"./react-BVjl1ZaK.js";import{D as a,E as o,I as s,L as c,R as l,w as u}from"./app-presenter-provider-CDSjiqfE.js";import{A as d,Bt as f,D as p,Dt as m,E as h,Et as g,Ft as _,Gt as v,Jt as y,Kt as b,Mt as x,O as S,Pt as C,Qt as w,Ut as T,Vt as E,Wt as D,Xt as O,Yt as k,an as A,in as ee,j as te,jt as ne,k as re,mt as j,nn as M,on as ie,qt as ae,rn as N,sn as oe,yt as se,zt as P}from"./api-DmxQnm30.js";import{a as ce,c as le,i as F,l as I,n as ue,o as de,r as fe,s as pe}from"./mcp-marketplace-page-RqISBSqO.js";import{c as L}from"./dist-CyWdaJvr.js";import{a as me,i as he,n as ge,o as _e,r as ve,s as ye}from"./confirm-dialog-BWRNsRgb.js";import{t as be}from"./arrow-left-Dd45Mvr1.js";import{i as R,n as z,r as xe,t as B}from"./tooltip-CKGxLGnG.js";import{t as Se}from"./provider-scoped-model-input-IMD4W0jD.js";import{t as Ce}from"./ellipsis-BDgTYNDX.js";import{t as we}from"./play-BziM-Y34.js";import{t as Te}from"./plus-DrpyArC8.js";import{t as Ee}from"./refresh-cw-DFR87zei.js";import{t as De}from"./trash-2-yLA8BEcE.js";import{t as Oe}from"./notice-card-3a7FmAz-.js";import{n as ke,r as Ae,t as je}from"./popover-BlJLguiZ.js";import{n as Me}from"./doc-browser-context-CpL2m4Sp.js";import{A as Ne,At as Pe,B as Fe,Bt as Ie,C as Le,Ct as Re,D as ze,E as Be,Et as Ve,F as He,Ft as Ue,H as We,I as V,It as Ge,J as H,K as Ke,L as qe,Lt as Je,M as Ye,N as Xe,O as Ze,Ot as Qe,P as $e,Pt as et,R as tt,S as nt,T as rt,V as it,X as at,Y as ot,Z as st,_ as ct,a as lt,b as ut,c as dt,d as ft,dt as pt,f as mt,g as ht,h as gt,i as _t,j as vt,jt as yt,k as bt,l as xt,lt as St,m as Ct,mt as wt,n as Tt,nt as Et,o as Dt,ot as Ot,p as kt,q as At,r as jt,s as Mt,st as Nt,t as Pt,tt as Ft,u as U,ut as It,v as Lt,w as Rt,wt as zt,x as W,y as G,z as Bt,zt as Vt}from"./index-ZDJP_uJc.js";import{t as Ht}from"./tabs-custom-Ix4nkp2h.js";import{t as Ut}from"./tag-chip-Cdwb3JSH.js";import{c as Wt,n as Gt,r as Kt}from"./provider-models-C_yOh6DE.js";function qt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Jt(e,t,n){let r=e.slice(0);return r[t]=n,r}var Yt=class extends oe{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,N.batch(()=>{let e=this.#i,t=this.#f(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!ie(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(qt(e,n).forEach(e=>{e.destroy()}),qt(n,e).forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})),this.#m()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#f(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=A(this.#a,t(e))),this.#a}return e}#f(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new M(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#p(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Jt(this.#t,n,t),this.#m())}#m(){if(this.hasListeners()){let e=this.#a,t=this.#u(this.#t,this.#l);e!==this.#d(t,this.#r?.combine)&&N.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},K=i(t(),1);function Xt({queries:e,...t},n){let r=w(n),i=O(),a=k(),o=K.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{T(e),b(e,a,r.getQueryCache().get(e.queryHash))}),y(a);let[s]=K.useState(()=>new Yt(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;K.useSyncExternalStore(K.useCallback(e=>d?s.subscribe(N.batchCalls(e)):ee,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),K.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>v(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&v(n,e)?D(n,new M(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&ae({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}var Zt=L(`BriefcaseBusiness`,[[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2`,key:`1ksdt3`}],[`path`,{d:`M22 13a18.15 18.15 0 0 1-20 0`,key:`12hx5q`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`6`,rx:`2`,key:`i6l2r4`}]]),Qt=L(`CalendarClock`,[[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M17.5 17.5 16 16.3V14`,key:`akvzfd`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),$t=L(`CircleAlert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),en=L(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),tn=L(`Clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]),nn=L(`Compass`,[[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),rn=L(`Earth`,[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),an=L(`ListTodo`,[[`rect`,{x:`3`,y:`5`,width:`6`,height:`6`,rx:`1`,key:`1defrl`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`M13 6h8`,key:`15sg57`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 18h8`,key:`oe0vm4`}]]),on=L(`MessagesSquare`,[[`path`,{d:`M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z`,key:`p1xzt8`}],[`path`,{d:`M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1`,key:`1cx29u`}]]),sn=L(`PenLine`,[[`path`,{d:`M12 20h9`,key:`t2du7b`}],[`path`,{d:`M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z`,key:`1ykcvy`}]]),cn=L(`SquareTerminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),q=r(),ln=K.forwardRef(({className:t,...n},r)=>(0,q.jsx)(`textarea`,{className:e(`flex min-h-28 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2.5 text-sm text-gray-900 placeholder:text-gray-300 placeholder:font-normal focus:outline-none focus:ring-1 focus:ring-primary/40 focus:border-primary/40 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,t),ref:r,...n}));ln.displayName=`Textarea`;function un(e){return{displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,model:e.model??``,runtime:e.runtime??e.engine??``}}function dn(e){let{runtimeOptions:t,currentRuntime:n}=e,r=n.trim();if(!r)return t;let i=G(r);return t.some(e=>e.value===i)?t:[...t,{value:i,label:W(i),icon:null,ready:!1,reason:`unavailable`,reasonMessage:null,supportedModels:void 0,recommendedModel:null,cta:null}].sort((e,t)=>e.value===`native`?-1:t.value===`native`?1:e.value.localeCompare(t.value))}function fn({value:e,disabled:t=!1,runtimeOptions:r,defaultRuntime:i,onChange:a}){let o=e.trim()?G(e):``,s=dn({runtimeOptions:r,currentRuntime:e}),c=s.find(e=>e.value===o)??null,l=c?.reasonMessage?.trim()||(c?.ready===!1?n(`agentsRuntimeUnavailableHelp`):``);return(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsxs)(Ke,{value:o||i,onValueChange:e=>a(e===i?``:e),disabled:t,children:[(0,q.jsx)(ot,{"aria-label":n(`agentsCardRuntimeLabel`),className:`rounded-xl`,children:(0,q.jsx)(at,{placeholder:n(`agentsRuntimeSelectPlaceholder`)})}),(0,q.jsx)(At,{className:`rounded-xl`,children:s.map(e=>(0,q.jsx)(H,{value:e.value,disabled:e.ready===!1&&e.value!==o,className:`rounded-lg`,children:e.label},e.value))})]}),l?(0,q.jsx)(`p`,{className:`text-xs text-gray-500`,children:l}):null]})}function pn({agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,q.jsx)(ge,{open:e!==null,onOpenChange:a,children:e?(0,q.jsx)(mn,{agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e.id):null})}function mn(e){let{agent:t,pending:r,providerCatalog:i,runtimeOptions:a,defaultRuntime:o,onOpenChange:s,onSubmit:c}=e,[l,u]=(0,K.useState)(un(t));return(0,q.jsxs)(ve,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-[linear-gradient(180deg,#fff9f1_0%,#ffffff_24%)] p-0 sm:max-h-[760px] sm:max-w-xl`,children:[(0,q.jsx)(`div`,{className:`shrink-0 border-b border-[#f0e2c8] px-6 py-6`,children:(0,q.jsxs)(_e,{className:`text-left`,children:[(0,q.jsx)(ye,{children:n(`agentsEditDialogTitle`)}),(0,q.jsx)(he,{children:n(`agentsEditDialogDescription`)})]})}),(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(Oe,{tone:`warning`,title:n(`agentsEditHomeReadonly`),description:n(`agentsEditHomeReadonlyHint`),children:(0,q.jsx)(`div`,{className:`break-all text-sm text-amber-950`,children:t.workspace??`-`})}),(0,q.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,q.jsx)(C,{value:l.displayName,onChange:e=>u(t=>({...t,displayName:e.target.value})),placeholder:n(`agentsFormNamePlaceholder`)}),(0,q.jsx)(ln,{value:l.description,onChange:e=>u(t=>({...t,description:e.target.value})),placeholder:n(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,q.jsx)(C,{value:l.avatar,onChange:e=>u(t=>({...t,avatar:e.target.value})),placeholder:n(`agentsFormAvatarPlaceholder`)}),(0,q.jsx)(Se,{value:l.model,onChange:e=>u(t=>({...t,model:e})),providerCatalog:i,disabled:r,className:`md:col-span-2`}),(0,q.jsx)(fn,{value:l.runtime,onChange:e=>u(t=>({...t,runtime:e})),runtimeOptions:a,defaultRuntime:o,disabled:r})]})]})}),(0,q.jsxs)(me,{className:`shrink-0 border-t border-[#f1e7d4] px-6 py-5`,children:[(0,q.jsx)(_,{type:`button`,variant:`ghost`,onClick:()=>s(!1),disabled:r,children:n(`cancel`)}),(0,q.jsxs)(_,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>c(t.id,l),disabled:r,children:[(0,q.jsx)(Qe,{className:`mr-2 h-4 w-4`}),n(`agentsEditSaveAction`)]})]})]})}var hn=`请直接创建一个默认示例 Agent,不要问我问题。创建完成后,简单告诉我它能做什么。`;function gn(e){let{agentCount:t,onCreate:r}=e;return(0,q.jsxs)(`section`,{className:`flex flex-col gap-3 border-b border-gray-200 pb-4 sm:flex-row sm:items-end sm:justify-between`,children:[(0,q.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`h1`,{className:`text-xl font-semibold text-gray-950`,children:n(`agentsHeroEyebrow`)}),(0,q.jsx)(`span`,{className:`rounded-full border border-gray-200 bg-white px-2 py-0.5 text-xs font-medium text-gray-500`,children:t})]}),(0,q.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-gray-500`,children:n(`agentsHeroDescription`)})]}),(0,q.jsxs)(_,{type:`button`,variant:`primary`,className:`h-9 shrink-0 rounded-xl px-4 text-sm font-semibold`,onClick:r,children:[(0,q.jsx)(Te,{className:`mr-2 h-4 w-4`}),n(`agentsCreateButton`)]})]})}function _n(t){let{icon:n,label:r,disabled:i=!1,destructive:a=!1,onClick:o}=t;return(0,q.jsxs)(`button`,{type:`button`,className:e(`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50`,a?`text-destructive hover:bg-destructive/10`:`text-gray-700 hover:bg-gray-100`),onClick:o,disabled:i,children:[(0,q.jsx)(n,{className:`h-4 w-4 shrink-0`}),(0,q.jsx)(`span`,{children:r})]})}function vn(e){let{agent:t,runtimeOptions:r,defaultRuntimeLabel:i,updatePending:a,deletePending:o,onStartChat:s,onEdit:c,onDelete:l}=e,d=t.runtime?.trim()||t.engine?.trim()||``,f=d?r.find(e=>e.value===G(d))?.label??W(d):i;return(0,q.jsx)(g,{className:`group overflow-hidden border border-gray-200 bg-white shadow-none transition-colors duration-200 hover:border-gray-300`,children:(0,q.jsxs)(m,{className:`relative flex h-full flex-col gap-3 px-3.5 py-3.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-2.5 pr-16`,children:[(0,q.jsx)(We,{agentId:t.id,displayName:t.displayName,avatarUrl:t.avatarUrl,className:`h-9 w-9 shrink-0`}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`div`,{className:`truncate text-sm font-semibold text-gray-950`,children:t.displayName?.trim()||t.id}),t.builtIn?(0,q.jsxs)(Ut,{tone:`warning`,className:`h-5 gap-1 border-amber-200 bg-amber-50 px-1.5 text-[10px] text-amber-700`,children:[(0,q.jsx)(u,{className:`h-3 w-3`}),n(`agentsCardBuiltInTag`)]}):null]}),(0,q.jsxs)(`div`,{className:`truncate text-xs text-gray-400`,children:[`@`,t.id]})]})]}),(0,q.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 flex items-center gap-1 opacity-100 transition-opacity md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,children:[(0,q.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-gray-400 hover:text-gray-800`,"aria-label":n(`agentsCardStartChat`),title:n(`agentsCardStartChat`),onClick:s,children:(0,q.jsx)(Pe,{className:`h-4 w-4`})}),(0,q.jsxs)(je,{children:[(0,q.jsx)(Ae,{asChild:!0,children:(0,q.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-gray-400 hover:text-gray-800`,"aria-label":n(`chatSessionMoreActions`),title:n(`chatSessionMoreActions`),children:(0,q.jsx)(Ce,{className:`h-4 w-4`})})}),(0,q.jsxs)(ke,{align:`end`,className:`w-44 p-1.5`,children:[(0,q.jsx)(_n,{icon:Qe,label:n(`agentsEditAction`),onClick:c,disabled:a}),t.builtIn?null:(0,q.jsx)(_n,{icon:De,label:n(`agentsRemoveAction`),onClick:l,disabled:o,destructive:!0})]})]})]}),(0,q.jsx)(`p`,{className:`line-clamp-2 min-h-10 text-sm leading-5 text-gray-600`,children:t.description?.trim()||(t.builtIn?n(`agentsCardBuiltInSummary`):n(`agentsCardCustomSummary`))}),(0,q.jsxs)(`div`,{className:`mt-auto grid gap-2 border-t border-gray-100 pt-2 text-xs text-gray-500`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(Ve,{className:`h-3.5 w-3.5 shrink-0 text-gray-300`}),(0,q.jsx)(`span`,{className:`truncate`,children:f})]}),(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(yt,{className:`h-3.5 w-3.5 shrink-0 text-gray-300`}),(0,q.jsx)(`span`,{className:`truncate`,children:t.workspace??`-`})]})]})]})})}function yn(){let e=Bt(),t=Le(),r=st(),i=It(),a=St(),o=Mt(),s=rt(),c=Rt(),[l,u]=(0,K.useState)(null),d=(0,K.useMemo)(()=>t.data?.agents??[],[t.data?.agents]),f=(0,K.useMemo)(()=>[...d].sort((e,t)=>Number(!!t.builtIn)-Number(!!e.builtIn)||e.id.localeCompare(t.id)),[d]),p=(0,K.useMemo)(()=>Gt({config:r.data,providersView:i.data,templatesView:a.data,onlyConfigured:!0}),[r.data,i.data,a.data]),h=(0,K.useMemo)(()=>Lt(o.data?.options??[]),[o.data?.options]),v=(0,K.useMemo)(()=>G(o.data?.defaultType??`native`),[o.data?.defaultType]),y=(0,K.useMemo)(()=>h.find(e=>e.value===v)?.label??W(v),[v,h]),b=e=>{u(e)},S=async(e,t)=>{await s.mutateAsync({agentId:e,data:{displayName:t.displayName,description:t.description,avatar:t.avatar,model:t.model,...t.runtime.trim()?{runtime:t.runtime.trim()}:{runtime:``}}}),u(null)},C=t=>{e.chatSessionListManager.startAgentDraftChat(t.id,ut(t,v))};return(0,q.jsxs)(x,{className:`space-y-5`,children:[(0,q.jsx)(gn,{agentCount:d.length,onCreate:()=>e.startAgentCreationDraft(hn)}),(0,q.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:t.isLoading?(0,q.jsx)(g,{className:`md:col-span-2 xl:col-span-3 border-dashed border-[#d9dce3] bg-white/70`,children:(0,q.jsx)(m,{className:`py-14 text-center text-sm text-gray-500`,children:n(`agentsLoading`)})}):f.length===0?(0,q.jsx)(g,{className:`md:col-span-2 xl:col-span-3 overflow-hidden border-dashed border-[#d9dce3] bg-[linear-gradient(135deg,#fff7ea_0%,#f4fbff_100%)]`,children:(0,q.jsxs)(m,{className:`flex min-h-[240px] flex-col items-center justify-center px-6 py-14 text-center`,children:[(0,q.jsx)(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-white/80 shadow-[0_18px_44px_rgba(0,0,0,0.08)]`,children:(0,q.jsx)(Vt,{className:`h-8 w-8 text-[#d39a3b]`})}),(0,q.jsx)(`div`,{className:`text-lg font-semibold text-[#2f2212]`,children:n(`agentsEmpty`)}),(0,q.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-[#78644d]`,children:n(`agentsEmptyDescription`)}),(0,q.jsxs)(_,{type:`button`,variant:`primary`,className:`mt-5 rounded-2xl px-5`,onClick:()=>e.startAgentCreationDraft(hn),children:[(0,q.jsx)(Te,{className:`mr-2 h-4 w-4`}),n(`agentsCreateButton`)]})]})}):f.map(e=>(0,q.jsx)(vn,{agent:e,runtimeOptions:h,defaultRuntimeLabel:y,updatePending:s.isPending,deletePending:c.isPending,onStartChat:()=>C(e),onEdit:()=>b(e),onDelete:()=>c.mutate({agentId:e.id})},e.id))}),(0,q.jsx)(pn,{agent:l,pending:s.isPending,providerCatalog:p,runtimeOptions:h,defaultRuntime:v,onOpenChange:e=>{!e&&!s.isPending&&u(null)},onSubmit:S})]})}function bn(e,t){let n=t.trim().toLowerCase();return n?[e.id,e.name,e.payload.message,e.payload.sessionId??``].join(` `).toLowerCase().includes(n):!0}function xn(e,t){return t===`all`?!0:t===`enabled`?e.enabled:!e.enabled}function Sn({job:t}){return(0,q.jsxs)(`span`,{className:e(`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-semibold`,t.enabled?`bg-emerald-50 text-emerald-700`:`bg-gray-100 text-gray-500`),children:[(0,q.jsx)(`span`,{className:e(`h-1.5 w-1.5 rounded-full`,t.enabled?`bg-emerald-400`:`bg-gray-400`)}),t.enabled?n(`enabled`):n(`disabled`)]})}function Cn(t){let{job:r,onDelete:i,onRun:a,onToggle:s}=t,[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(!1),f=r.enabled?`bg-emerald-400`:`bg-gray-300`;return(0,q.jsxs)(`div`,{className:e(`group relative overflow-hidden rounded-xl border bg-white transition-all duration-150 cursor-pointer`,c?`border-gray-300 shadow-sm`:`border-gray-200 hover:border-gray-300 hover:shadow-sm`),onClick:e=>{e.target.closest(`[data-no-expand]`)||l(!c)},children:[(0,q.jsx)(`div`,{className:e(`absolute left-0 top-0 bottom-0 w-1 rounded-l-xl`,f)}),(0,q.jsxs)(`div`,{className:`pl-4 pr-3 py-3`,children:[` `,(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c?(0,q.jsx)(Je,{className:`h-3.5 w-3.5 text-gray-400 shrink-0`}):(0,q.jsx)(Ge,{className:`h-3.5 w-3.5 text-gray-300 shrink-0 group-hover:text-gray-500 transition-colors`}),(0,q.jsx)(`span`,{className:`text-sm font-semibold text-gray-900 truncate`,children:r.name||r.id}),(0,q.jsx)(Sn,{job:r}),r.deleteAfterRun&&(0,q.jsx)(`span`,{className:`rounded-full bg-amber-50 px-1.5 py-0.5 text-[10px] font-medium text-amber-600`,children:n(`cronOneShot`)})]})}),(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,"data-no-expand":!0,children:[(0,q.jsx)(j,{checked:r.enabled,onCheckedChange:e=>s(r,e)}),(0,q.jsxs)(je,{open:u,onOpenChange:d,children:[(0,q.jsx)(Ae,{asChild:!0,children:(0,q.jsx)(_,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-gray-400 hover:text-gray-600`,"aria-label":n(`cronMoreActions`),children:(0,q.jsx)(o,{className:`h-4 w-4`})})}),(0,q.jsxs)(ke,{align:`end`,sideOffset:4,className:`w-40 p-1`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{d(!1),a(r)},className:`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-gray-700 transition-colors hover:bg-gray-100`,children:[(0,q.jsx)(we,{className:`h-3.5 w-3.5 text-gray-500`}),n(`cronRunNow`)]}),(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{d(!1),i(r)},className:`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-600 transition-colors hover:bg-red-50`,children:[(0,q.jsx)(De,{className:`h-3.5 w-3.5`}),n(`delete`)]})]})]})]})]}),(0,q.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-gray-500 pl-6`,children:[(0,q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(Qt,{className:`h-3 w-3 text-gray-400`}),(0,q.jsx)(`span`,{className:`font-mono text-gray-600`,children:ft(r)})]}),r.state.nextRunAt&&(0,q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(tn,{className:`h-3 w-3 text-gray-400`}),(0,q.jsx)(`span`,{children:Ct(r.state.nextRunAt)})]}),r.state.lastRunAt&&(0,q.jsxs)(`span`,{className:`flex items-center gap-1`,"data-no-expand":!0,children:[(0,q.jsx)(`span`,{className:`text-gray-300`,children:`•`}),r.state.lastStatus===`error`&&r.state.lastError?(0,q.jsx)(xe,{delayDuration:200,children:(0,q.jsxs)(B,{children:[(0,q.jsx)(R,{asChild:!0,children:(0,q.jsx)(`span`,{className:`inline-flex items-center gap-0.5 text-orange-400 cursor-help`,children:(0,q.jsx)($t,{className:`h-3 w-3`})})}),(0,q.jsx)(z,{side:`top`,align:`start`,className:`max-w-xs text-xs bg-red-50 text-red-700 border-red-200`,children:r.state.lastError})]})}):(0,q.jsx)(`span`,{className:e(r.state.lastStatus===`ok`?`text-emerald-400`:`text-gray-400`),children:r.state.lastStatus===`ok`?`✓`:``}),(0,q.jsx)(`span`,{children:Ct(r.state.lastRunAt)})]})]}),(0,q.jsx)(`div`,{className:`mt-2 pl-6`,children:(0,q.jsx)(`div`,{className:e(`text-sm text-gray-600 break-words`,!c&&`line-clamp-2`),children:r.payload.message})}),c&&(0,q.jsxs)(`div`,{className:`mt-3 ml-6 space-y-3 animate-in fade-in-0 slide-in-from-top-1 duration-150`,children:[(0,q.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 gap-x-4 gap-y-2 text-xs`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`text-[11px] text-gray-400 mb-0.5`,children:n(`cronSessionLabel`)}),(0,q.jsx)(`div`,{className:`text-gray-700 font-mono text-[11px] truncate`,title:mt(r),children:mt(r)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`text-[11px] text-gray-400 mb-0.5`,children:n(`cronNextRun`)}),(0,q.jsx)(`div`,{className:`text-gray-700`,children:kt(r.state.nextRunAt)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`text-[11px] text-gray-400 mb-0.5`,children:n(`cronLastRun`)}),(0,q.jsx)(`div`,{className:`text-gray-700`,children:kt(r.state.lastRunAt)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`text-[11px] text-gray-400 mb-0.5`,children:n(`cronLastStatus`)}),(0,q.jsx)(`div`,{className:e(`inline-flex items-center gap-1 font-medium`,r.state.lastStatus===`ok`?`text-emerald-600`:r.state.lastStatus===`error`?`text-red-600`:r.state.lastStatus===`skipped`?`text-amber-600`:`text-gray-500`),children:r.state.lastStatus??`-`})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`text-[11px] text-gray-400 mb-0.5`,children:n(`cronCreatedAt`)}),(0,q.jsx)(`div`,{className:`text-gray-700`,children:kt(r.createdAt)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`text-[11px] text-gray-400 mb-0.5`,children:n(`cronId`)}),(0,q.jsx)(`div`,{className:`text-gray-700 font-mono text-[11px] truncate`,title:r.id,children:r.id})]})]}),r.state.lastError&&(0,q.jsx)(`div`,{className:`rounded-lg bg-red-50 border border-red-100 px-3 py-2 text-xs text-red-600 break-words`,children:r.state.lastError})]})]})]})}function wn(){let[t,r]=(0,K.useState)(``),[i,a]=(0,K.useState)(`all`),o=Ft({all:!0}),s=Et(),c=wt(),l=pt(),{confirm:u,ConfirmDialog:d}=gt(),f=(0,K.useMemo)(()=>(o.data?.jobs??[]).filter(e=>bn(e,t)).filter(e=>xn(e,i)),[o.data,t,i]),p=async e=>{await u({title:`${n(`cronDeleteConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,variant:`destructive`,confirmLabel:n(`delete`)})&&s.mutate({id:e.id})},m=(e,t)=>{c.mutate({id:e.id,enabled:t})},h=async e=>{let t=!e.enabled;t&&!await u({title:`${n(`cronRunForceConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,confirmLabel:n(`cronRunNow`)})||l.mutate({id:e.id,force:t})};return(0,q.jsxs)(x,{fullHeight:!0,children:[(0,q.jsx)(ne,{title:n(`cronPageTitle`),description:n(`cronPageDescription`),actions:(0,q.jsx)(_,{variant:`ghost`,size:`icon`,className:`h-9 w-9 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100`,onClick:()=>o.refetch(),children:(0,q.jsx)(Ee,{className:e(`h-4 w-4`,o.isFetching&&`animate-spin`)})})}),(0,q.jsx)(`div`,{className:`mb-5`,children:(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center`,children:[(0,q.jsxs)(`div`,{className:`relative flex-1 min-w-[240px]`,children:[(0,q.jsx)(C,{value:t,onChange:e=>r(e.target.value),placeholder:n(`cronSearchPlaceholder`),className:`pl-9`}),(0,q.jsx)(Ie,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`})]}),(0,q.jsx)(`div`,{className:`min-w-[140px]`,children:(0,q.jsxs)(Ke,{value:i,onValueChange:e=>a(e),children:[(0,q.jsx)(ot,{className:`w-full`,children:(0,q.jsx)(at,{placeholder:n(`cronStatusLabel`)})}),(0,q.jsxs)(At,{children:[(0,q.jsx)(H,{value:`all`,children:n(`cronStatusAll`)}),(0,q.jsx)(H,{value:`enabled`,children:n(`cronStatusEnabled`)}),(0,q.jsx)(H,{value:`disabled`,children:n(`cronStatusDisabled`)})]})]})}),(0,q.jsxs)(`div`,{className:`text-xs text-gray-400 ml-auto tabular-nums`,children:[f.length,` / `,o.data?.total??0]})]})}),(0,q.jsx)(`div`,{className:`flex-1 overflow-auto custom-scrollbar`,children:o.isLoading?(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 text-gray-400`,children:[(0,q.jsx)(Ee,{className:`h-6 w-6 animate-spin mb-3`}),(0,q.jsx)(`span`,{className:`text-sm`,children:n(`cronLoading`)})]}):f.length===0?(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 text-gray-400`,children:[(0,q.jsx)(an,{className:`h-10 w-10 mb-3 text-gray-300`}),(0,q.jsx)(`span`,{className:`text-sm font-medium text-gray-500`,children:n(`cronEmpty`)}),(0,q.jsx)(`span`,{className:`text-xs text-gray-400 mt-1`,children:n(`cronEmptyGuide`)})]}):(0,q.jsx)(`div`,{className:`space-y-2.5`,children:f.map(e=>(0,q.jsx)(Cn,{job:e,onDelete:p,onRun:h,onToggle:m},e.id))})}),(0,q.jsx)(d,{})]})}function Tn(e){return Array.from(new Set(e.map(e=>e.spec).filter(Boolean)))}function En(e){let t=new Date().toISOString();return e.result.type===`skill`?{type:`skill`,spec:e.result.spec,id:e.request.skill??e.result.spec,label:e.request.skill??e.result.name??e.result.spec,source:`workspace`,installPath:e.request.installPath,installedAt:t}:{type:e.result.type,spec:e.result.spec,id:e.result.name??e.result.spec,label:e.result.name??e.result.spec,source:`marketplace`,origin:`marketplace`,enabled:e.request.enabled??!0,runtimeStatus:e.request.enabled===!1?`disabled`:`ready`,installedAt:t}}function Dn(e,t){return!!(t.spec&&e.spec===t.spec||t.id&&e.id===t.id)}function On(e,t){return t??{type:e,total:0,specs:[],records:[]}}function kn(e){let t=On(e.result.type,e.view),n=En(e),r=t.records.findIndex(e=>Dn(e,{id:n.id,spec:n.spec})),i=[...t.records];return r>=0?i[r]={...i[r],...n}:i.unshift(n),{...t,type:e.result.type,records:i,specs:Tn(i),total:i.length}}function An(e){let t=On(e.result.type,e.view);if(e.result.action===`uninstall`||e.result.action===`remove`){let n=t.records.filter(t=>!Dn(t,{id:e.result.id,spec:e.request.spec}));return{...t,records:n,specs:Tn(n),total:n.length}}let n=t.records.map(t=>Dn(t,{id:e.result.id,spec:e.request.spec})?e.result.action===`disable`?{...t,enabled:!1,runtimeStatus:`disabled`}:e.result.action===`update`?{...t,installedAt:new Date().toISOString(),origin:t.origin??`marketplace`}:{...t,enabled:!0,runtimeStatus:`ready`}:t);return{...t,records:n,specs:Tn(n),total:n.length}}function jn(e){let t=I({queryKey:[`marketplace-items`,e],initialPageParam:1,queryFn:({pageParam:t})=>p({...e,page:t}),getNextPageParam:e=>e.page<e.totalPages?e.page+1:void 0,placeholderData:(t,n)=>{let r=n?.queryKey?.[1];if(!(!r||typeof r!=`object`||!r))return(`type`in r?r.type:void 0)===e.type&&Mn(r,e)?t:void 0},staleTime:15e3}),n=(0,K.useMemo)(()=>le(t.data),[t.data]);return{...t,data:n}}function Mn(e,t){return e.q===t.q&&e.tag===t.tag&&e.scene===t.scene&&e.sort===t.sort&&e.pageSize===t.pageSize}function Nn(e=!0){return E({queryKey:[`marketplace-skill-scenes`],queryFn:re,enabled:e,staleTime:6e4})}function Pn(e,t=!0){let n=Xt({queries:e.map(e=>({queryKey:[`marketplace-skill-scene-count`,e.scene],queryFn:()=>p({type:`skill`,scene:e.scene,pageSize:1}),enabled:t&&typeof e.count!=`number`,staleTime:6e4}))});return(0,K.useMemo)(()=>{let t=new Map;return e.forEach((e,r)=>{let i=typeof e.count==`number`?e.count:n[r]?.data?.total;typeof i==`number`&&t.set(e.scene,i)}),t},[n,e])}function Fn(e){return E({queryKey:[`marketplace-installed`,e],queryFn:()=>h(e),staleTime:1e4})}function In(){let e=w();return f({mutationFn:e=>d(e),onSuccess:(t,r)=>{e.setQueryData([`marketplace-installed`,t.type],e=>kn({view:e,request:r,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`}),P.success(t.message||n(`marketplaceInstallSuccessSkill`))},onError:e=>{P.error(e.message||n(`marketplaceInstallFailed`))}})}function Ln(){let e=w();return f({mutationFn:e=>te(e),onSuccess:(t,r)=>{e.setQueryData([`marketplace-installed`,t.type],e=>An({view:e,request:r,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`});let i=t.action===`enable`?n(`marketplaceEnableSuccess`):t.action===`disable`?n(`marketplaceDisableSuccess`):t.action===`update`?n(`marketplaceUpdateSuccess`):n(`marketplaceUninstallSuccess`);P.success(t.message||i)},onError:e=>{P.error(e.message||n(`marketplaceOperationFailed`))}})}function Rn(e){return(e??``).trim().toLowerCase()}function J(e,t){let n=Rn(t);return n.length>0?`${e}:${n}`:``}function zn(e){let t=new Map;for(let n of e){let e=[n.install.spec,n.slug,n.id];for(let r of e){let e=J(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function Bn(e){let t=new Map;for(let n of e){let e=[n.spec,n.id,n.label];for(let r of e){let e=J(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function Vn(e,t){let n=[e.install.spec,e.slug,e.id];for(let r of n){let n=J(e.type,r);if(!n)continue;let i=t.get(n);if(i)return i}}function Hn(e,t){return t.get(J(e.type,e.spec))||t.get(J(e.type,e.id))||t.get(J(e.type,e.label))}function Un(e,t,n,r){let i=Rn(n);if(!i)return!0;let a=F(t?.summaryI18n,t?.summary,r);return[e.id,e.spec,e.label,t?.name,t?.slug,t?.summary,a,...t?.tags??[]].map(e=>Rn(e)).filter(Boolean).some(e=>e.includes(i))}function Y(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function Wn(e){let t=e.replace(/\r\n/g,`
|
|
2
2
|
`).split(`
|
|
3
3
|
`);if(t[0]?.trim()!==`---`)return e;let n=t.findIndex((e,t)=>t>0&&e.trim()===`---`);return n>0?t.slice(n+1).join(`
|
|
4
4
|
`).trim():e}function X(e){return Y(e).replace(/`([^`]+)`/g,`<code>$1</code>`).replace(/\*\*([^*]+)\*\*/g,`<strong>$1</strong>`).replace(/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)/g,`<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>`)}function Gn(e){return/^(#{1,4})\s+/.test(e)||/^([-*])\s+/.test(e)||/^\d+\.\s+/.test(e)||/^>\s?/.test(e)||/^```/.test(e)}function Kn(e,t,n){let r=[],i=t+1;for(;i<e.length&&!e[i]?.trim().startsWith("```");)r.push(e[i]??``),i+=1;return{html:`<div class="code-block">${n[1]?`<span class="code-language">${Y(n[1])}</span>`:``}<pre><code>${Y(r.join(`
|
|
@@ -102,4 +102,4 @@ import{d as e,g as t,i as n,m as r,y as i}from"./react-BVjl1ZaK.js";import{D as
|
|
|
102
102
|
`}
|
|
103
103
|
</main>
|
|
104
104
|
</body>
|
|
105
|
-
</html>`;return`data:text/html;charset=utf-8,${encodeURIComponent(b)}`}var rr=[`bg-amber-600`,`bg-orange-500`,`bg-yellow-600`,`bg-emerald-600`,`bg-teal-600`,`bg-cyan-600`,`bg-stone-600`,`bg-rose-500`,`bg-violet-500`];function ir(t){let{name:n,fallback:r,className:i}=t,a=n||r,o=a.substring(0,2).toUpperCase();return(0,q.jsx)(`div`,{className:e(`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-sm font-semibold text-white`,ar(a),i),children:o})}function ar(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return rr[Math.abs(t)%rr.length]}function or({title:e,spec:t,summary:n}){return(0,q.jsxs)(xe,{delayDuration:400,children:[(0,q.jsxs)(B,{children:[(0,q.jsx)(R,{asChild:!0,children:(0,q.jsx)(`div`,{className:`truncate text-[14px] font-semibold leading-tight text-gray-900`,children:e})}),(0,q.jsx)(z,{className:`max-w-[300px] text-xs`,children:e})]}),(0,q.jsx)(`div`,{className:`mb-1.5 mt-0.5 flex min-w-0 items-center gap-1.5`,children:t?(0,q.jsxs)(B,{children:[(0,q.jsx)(R,{asChild:!0,children:(0,q.jsx)(`span`,{className:`max-w-full truncate text-[11px] font-mono text-gray-400`,children:t})}),(0,q.jsx)(z,{className:`max-w-[300px] break-all font-mono text-xs`,children:t})]}):null}),(0,q.jsx)(`p`,{className:`line-clamp-2 text-left text-[12px] leading-relaxed text-gray-500/90`,children:n})]})}function sr(t){let{item:r,record:i,isInstalling:a,isDisabled:o,canUpdate:s,canUninstall:c,busyAction:l,busyForRecord:u,language:d,onInstall:f,onManage:p}=t,m=!!(r&&!i||i&&(s||c));return(0,q.jsxs)(`div`,{className:e(`relative flex h-8 shrink-0 items-center justify-end`,i?`md:w-5`:`md:w-0`),children:[(0,q.jsx)(`div`,{className:e(`hidden items-center justify-end transition-opacity duration-150 md:flex`,m&&`group-hover:opacity-0 group-focus-within:opacity-0`),children:i?(0,q.jsx)(cr,{disabled:o,language:d}):null}),(0,q.jsxs)(`div`,{className:e(`flex w-max items-center justify-end gap-2 transition-opacity duration-150`,`opacity-100 md:pointer-events-none md:absolute md:right-0 md:opacity-0`,`md:group-hover:pointer-events-auto md:group-hover:opacity-100`,`md:group-focus-within:pointer-events-auto md:group-focus-within:opacity-100`),children:[r&&!i&&(0,q.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),f(r)},disabled:a,className:`inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-xl bg-primary px-3 text-xs font-medium text-white transition-colors hover:bg-primary-600 disabled:opacity-50`,children:[(0,q.jsx)(et,{className:`h-3.5 w-3.5`}),n(a?`marketplaceInstalling`:`marketplaceInstall`)]}),i&&s&&(0,q.jsxs)(`button`,{disabled:u,onClick:e=>{e.stopPropagation(),p(`update`,i)},className:`inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-xl border border-blue-200/80 bg-white px-3 text-xs font-medium text-blue-600 transition-colors hover:border-blue-300 hover:bg-blue-50 disabled:opacity-50`,children:[(0,q.jsx)(Ee,{className:`h-3.5 w-3.5`}),n(l===`update`?`marketplaceUpdating`:`marketplaceUpdate`)]}),i&&c&&(0,q.jsxs)(`button`,{disabled:u,onClick:e=>{e.stopPropagation(),p(`uninstall`,i)},className:`inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-xl border border-gray-200/80 bg-white px-3 text-xs font-medium text-gray-500 transition-colors hover:border-rose-200 hover:bg-rose-50 hover:text-rose-600 disabled:opacity-50`,children:[(0,q.jsx)(De,{className:`h-3.5 w-3.5`}),n(l===`uninstall`?`marketplaceRemoving`:`marketplaceUninstall`)]})]})]})}function cr(t){let{disabled:n,language:r}=t,i=ur(n?{zh:`已禁用`,en:`Disabled`}:{zh:`已安装`,en:`Installed`},r);return(0,q.jsx)(xe,{delayDuration:300,children:(0,q.jsxs)(B,{children:[(0,q.jsx)(R,{asChild:!0,children:(0,q.jsx)(`span`,{"aria-label":i,className:e(`inline-flex h-5 w-5 items-center justify-center`,n?`text-gray-400`:`text-emerald-700`),children:n?(0,q.jsx)(a,{className:`h-4 w-4 opacity-40`}):(0,q.jsx)(a,{className:`h-4 w-4`})})}),(0,q.jsx)(z,{className:`text-xs`,children:i})]})})}function lr(e){let{item:t,record:r,language:i,installState:a,manageState:o,onOpen:s,onInstall:c,onManage:l}=e,u=fe(i),d=t?.name??r?.label??r?.id??r?.spec??n(`marketplaceUnknownItem`),f=F(t?.summaryI18n,t?.summary,u)||(r?n(`marketplaceInstalledLocalSummary`):``),p=t?.install.spec??r?.spec??``,m=r?.id||r?.spec,h=m?o.actionsByTarget.get(m):void 0,g=!!h,_=r?.type===`skill`&&r.source===`workspace`,v=r?.type===`skill`&&r.origin===`marketplace`,y=r?r.enabled===!1||r.runtimeStatus===`disabled`:!1,b=t?.install.spec,x=typeof b==`string`&&a.installingSpecs.has(b);return(0,q.jsxs)(`article`,{onClick:s,className:`group flex cursor-pointer items-start justify-between gap-3.5 rounded-2xl border border-gray-200/40 bg-white px-5 py-4 shadow-sm transition-all hover:border-blue-300/80 hover:shadow-md`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 gap-3`,children:[(0,q.jsx)(ir,{name:d,fallback:p||n(`marketplaceTypeSkill`)}),(0,q.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col justify-center`,children:(0,q.jsx)(or,{title:d,spec:p,summary:f})})]}),(0,q.jsx)(sr,{item:t,record:r,isInstalling:x,isDisabled:y,canUpdate:v,canUninstall:_,busyAction:h,busyForRecord:g,language:i,onInstall:c,onManage:l})]})}function ur(e,t){return t.startsWith(`zh`)?e.zh:e.en}function dr(t){let{scope:n,title:r,summary:i,showTitle:a,showListSkeleton:o,skeletonCardCount:s,allItems:c,installedEntries:l,installedRecordLookup:u,language:d,installState:f,manageState:p,onOpen:m,onInstall:h,onManage:g}=t;return(0,q.jsxs)(`section`,{className:e(`flex min-h-full flex-col`,a&&`gap-3`),children:[a&&(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,q.jsx)(`h3`,{className:`text-[14px] font-semibold text-gray-950`,children:r}),(0,q.jsx)(`span`,{className:`text-[12px] text-gray-500`,children:i})]}),(0,q.jsxs)(`div`,{"data-testid":o?`marketplace-list-skeleton`:void 0,className:e(`grid grid-cols-1 gap-3 lg:grid-cols-2 2xl:grid-cols-3`,o&&`min-h-0 flex-1 auto-rows-[104px] content-start`),children:[o&&(0,q.jsx)(pe,{count:s}),!o&&n===`all`&&c.map(e=>(0,q.jsx)(lr,{item:e,record:Vn(e,u),language:d,installState:f,manageState:p,onOpen:()=>m(e,Vn(e,u)),onInstall:h,onManage:g},e.id)),!o&&n===`installed`&&l.map(e=>(0,q.jsx)(lr,{item:e.item,record:e.record,language:d,installState:f,manageState:p,onOpen:()=>m(e.item,e.record),onInstall:h,onManage:g},e.key))]})]})}function fr(t){let{entry:r,language:i,localeFallbacks:o,installState:s,layout:c=`rail`,onOpen:l,onInstall:u}=t,{item:d,record:f}=r,p=F(d.summaryI18n,d.summary,o),m=d.install.spec,h=s.installingSpecs.has(m),g=!!f;return(0,q.jsxs)(`article`,{onClick:()=>l(r),className:e(`group flex min-h-[166px] cursor-pointer flex-col justify-between rounded-xl border border-gray-200/70 bg-white p-3 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,c===`rail`?`w-[260px] shrink-0`:`w-full min-w-0`),children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`mb-2.5 flex min-w-0 items-start gap-2.5`,children:[(0,q.jsx)(ir,{name:d.name,fallback:d.install.spec}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,q.jsx)(`div`,{className:`truncate text-[13px] font-semibold leading-tight text-gray-950`,children:d.name}),(0,q.jsx)(`div`,{className:`mt-0.5 truncate text-[11px] font-mono leading-tight text-gray-400`,children:pr(d)})]})]}),(0,q.jsx)(`p`,{className:`line-clamp-2 text-[12px] leading-relaxed text-gray-500`,children:p}),(0,q.jsx)(mr,{tags:d.tags})]}),(0,q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 border-t border-gray-100 pt-2.5`,children:[(0,q.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-gray-400`,children:hr(d.updatedAt)}),g?(0,q.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 text-[11px] font-semibold text-emerald-700`,children:[(0,q.jsx)(a,{className:`h-3.5 w-3.5`}),gr({zh:`已安装`,en:`Installed`},i)]}):(0,q.jsxs)(`button`,{type:`button`,disabled:h,onClick:e=>{e.stopPropagation(),u(d)},className:`inline-flex h-7 items-center gap-1.5 rounded-md border border-gray-200 bg-white px-2 text-[11px] font-semibold text-gray-700 transition-colors hover:border-gray-300 hover:bg-gray-50 disabled:opacity-50`,children:[(0,q.jsx)(et,{className:`h-3.5 w-3.5`}),n(h?`marketplaceInstalling`:`marketplaceInstall`)]})]})]})}function pr(e){return e.slug||e.install.spec}function mr({tags:e}){let t=e.slice(0,2);return t.length===0?null:(0,q.jsx)(`div`,{className:`mt-2 truncate text-[11px] font-medium text-gray-400`,children:t.join(` / `)})}function hr(e){return e.slice(0,10)||e}function gr(e,t){return t.startsWith(`zh`)?e.zh:e.en}var _r=[{scene:`development-debugging`,title:{zh:`开发与调试`,en:`Development`},summary:{zh:`代码审查、错误定位、架构分析与交付验证。`,en:`Review, debug, analyze, and verify delivery work.`},icon:cn,tone:`dark`,span:`md:col-span-2`},{scene:`office-collaboration`,title:{zh:`办公协作`,en:`Office Work`},summary:{zh:`连接文档、日历、会议、邮件和团队通信。`,en:`Connect docs, calendars, meetings, mail, and teams.`},icon:Zt,tone:`green`,span:`md:col-span-2`},{scene:`writing-content`,title:{zh:`写作与内容`,en:`Writing`},summary:{zh:`把调研、写作、润色和发布组织成连续工作流。`,en:`Turn research, writing, polishing, and publishing into one flow.`},icon:sn,tone:`amber`,span:`md:col-span-2`},{scene:`browser-automation`,title:{zh:`浏览器自动化`,en:`Browser`},summary:{zh:`操作网页、捕获动态内容并验证真实用户路径。`,en:`Operate pages, capture dynamic content, and verify user paths.`},icon:rn,tone:`blue`,span:`md:col-span-2`},{scene:`local-environment`,title:{zh:`本地环境`,en:`Local`},summary:{zh:`管理终端、文件、运行时和本地服务。`,en:`Manage shells, files, runtimes, and local services.`},icon:Ue,tone:`violet`,span:`md:col-span-1`},{scene:`social-platforms`,title:{zh:`社交平台`,en:`Social`},summary:{zh:`处理发布、互动、检索和内容分发。`,en:`Handle posting, interaction, search, and distribution.`},icon:on,tone:`sky`,span:`md:col-span-1`},{scene:`nextclaw-official`,title:{zh:`NextClaw 官方`,en:`NextClaw Official`},summary:{zh:`优先查看由 NextClaw 维护的原生能力。`,en:`Browse native capabilities maintained by NextClaw.`},icon:Ve,tone:`teal`,span:`md:col-span-2`}],vr={icon:Ve,tone:`dark`,span:`md:col-span-2`},yr={dark:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-stone-600 bg-stone-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},blue:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-cyan-600 bg-cyan-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},green:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-emerald-600 bg-emerald-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},amber:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-amber-600 bg-amber-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},violet:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-violet-500 bg-violet-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},sky:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-sky-500 bg-sky-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},teal:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-teal-600 bg-teal-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`}},br=`grid grid-cols-[repeat(auto-fill,minmax(240px,320px))] justify-start gap-3`,xr=24;function Sr(e){let{entries:t,scenes:n,isScenesLoading:r,isItemsLoading:i,language:a,installState:o,onOpen:s,onInstall:c,onOpenScene:l}=e,u=fe(a),d=[...t].sort((e,t)=>kr(e.item,t.item)).slice(0,6);return(0,q.jsxs)(`div`,{className:`mb-4 space-y-5`,children:[(0,q.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,q.jsx)(Or,{icon:nn,title:Q({zh:`场景`,en:`Scenes`},a),description:Q({zh:`按使用场景浏览适合的技能组合。`,en:`Browse skills by how you plan to use them.`},a)}),r?(0,q.jsx)(Cr,{}):(0,q.jsx)(`div`,{className:`grid grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:n.map(e=>(0,q.jsx)(wr,{scene:e,language:a,onSelect:l},e.scene))})]}),(i||d.length>0)&&(0,q.jsx)(Er,{icon:en,title:Q({zh:`最近更新`,en:`Recently updated`},a),description:Q({zh:`看看生态最近在补齐哪些能力。`,en:`See what the ecosystem has been improving lately.`},a),entries:d,language:a,localeFallbacks:u,isLoading:i,installState:o,onOpen:s,onInstall:c})]})}function Cr(){return(0,q.jsx)(`div`,{"data-testid":`marketplace-scenes-skeleton`,className:`grid grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:_r.map(e=>(0,q.jsxs)(`div`,{className:`flex min-h-[74px] flex-col justify-center rounded-lg border border-gray-200/70 bg-white px-3 py-2.5 shadow-sm`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(U,{className:`h-7 w-7 shrink-0 rounded-md`}),(0,q.jsx)(U,{className:`h-3.5 min-w-0 flex-1`}),(0,q.jsx)(U,{className:`h-3 w-8 shrink-0`})]}),(0,q.jsx)(U,{className:`mt-2 h-3 w-4/5`})]},e.scene))})}function wr(t){let{scene:n,language:r,onSelect:i}=t,a=Ar(n.scene),o=a.icon,s=yr[a.tone];return(0,q.jsx)(`button`,{type:`button`,onClick:()=>i(n.scene),className:e(`group flex min-h-[74px] flex-col justify-center rounded-lg border px-3 py-2.5 text-left shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/70`,s.card),children:(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`span`,{className:e(`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border`,s.icon),children:(0,q.jsx)(o,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-gray-950`,children:jr(n,a,r)}),typeof n.count==`number`&&(0,q.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:Nr(n.count,r)})]}),(0,q.jsx)(`p`,{className:e(`mt-1 line-clamp-1 text-[11px] leading-relaxed`,s.text),children:Mr(n,a,r)})]})})}function Tr(t){let{scene:n,entries:r,isLoading:i,language:a,localeFallbacks:o,installState:s,onBack:c,onOpen:l,onInstall:u}=t,d=Ar(n.scene),f=d.icon,p=yr[d.tone];return(0,q.jsxs)(`section`,{className:`flex min-h-full flex-col`,children:[(0,q.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-start gap-2.5`,children:[(0,q.jsx)(`button`,{type:`button`,onClick:c,className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900`,"aria-label":Q({zh:`返回`,en:`Back`},a),children:(0,q.jsx)(be,{className:`h-4 w-4`})}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`span`,{className:e(`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border`,p.icon),children:(0,q.jsx)(f,{className:`h-4 w-4`})}),(0,q.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[15px] font-semibold text-gray-950`,children:jr(n,d,a)}),(0,q.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:Q(i?{zh:`加载中`,en:`Loading`}:{zh:`${r.length} 个技能`,en:`${r.length} skills`},a)})]}),(0,q.jsx)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-2`,children:(0,q.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[12px] leading-relaxed text-gray-500`,children:Mr(n,d,a)})})]})]}),i?(0,q.jsx)(`div`,{"data-testid":`marketplace-scene-skeleton`,className:e(br,`min-h-0 flex-1 auto-rows-[166px] content-start`),children:(0,q.jsx)(pe,{count:xr})}):r.length>0?(0,q.jsx)(`div`,{className:br,children:r.map(e=>(0,q.jsx)(fr,{entry:e,language:a,localeFallbacks:o,installState:s,layout:`grid`,onOpen:l,onInstall:u},e.item.id))}):(0,q.jsx)(`div`,{className:`rounded-lg border border-dashed border-gray-200 py-8 text-center text-[12px] text-gray-500`,children:Q({zh:`这个模块暂无技能。`,en:`No skills in this module yet.`},a)})]})}function Er(e){let{icon:t,title:n,description:r,entries:i,language:a,localeFallbacks:o,isLoading:s,installState:c,onOpen:l,onInstall:u}=e;return(0,q.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,q.jsx)(Or,{icon:t,title:n,description:r}),s?(0,q.jsx)(Dr,{}):(0,q.jsx)(`div`,{className:`-mx-1 flex gap-2.5 overflow-x-auto px-1 pb-1.5 custom-scrollbar`,children:i.map(e=>(0,q.jsx)(fr,{entry:e,language:a,localeFallbacks:o,installState:c,onOpen:l,onInstall:u},e.item.id))})]})}function Dr(){return(0,q.jsx)(`div`,{"data-testid":`marketplace-recent-skeleton`,className:`-mx-1 flex gap-2.5 overflow-hidden px-1 pb-1.5`,children:Array.from({length:4},(e,t)=>(0,q.jsxs)(`article`,{className:`flex min-h-[166px] w-[260px] shrink-0 flex-col justify-between rounded-xl border border-gray-200/70 bg-white p-3 shadow-sm`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`mb-2.5 flex min-w-0 items-start gap-2.5`,children:[(0,q.jsx)(U,{className:`h-10 w-10 shrink-0 rounded-xl`}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5 pt-0.5`,children:[(0,q.jsx)(U,{className:`h-3.5 w-32 max-w-full`}),(0,q.jsx)(U,{className:`h-3 w-24 max-w-full`})]})]}),(0,q.jsx)(U,{className:`h-3 w-full`}),(0,q.jsx)(U,{className:`mt-1.5 h-3 w-4/5`}),(0,q.jsx)(U,{className:`mt-2 h-3 w-24`})]}),(0,q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 border-t border-gray-100 pt-2.5`,children:[(0,q.jsx)(U,{className:`h-3 w-20`}),(0,q.jsx)(U,{className:`h-7 w-16 rounded-md`})]})]},`marketplace-recent-skeleton-${t}`))})}function Or({icon:e,title:t,description:n}){return(0,q.jsx)(`div`,{className:`flex items-end justify-between gap-4`,children:(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`h3`,{className:`flex items-center gap-2 text-[14px] font-semibold text-gray-950`,children:[(0,q.jsx)(e,{className:`h-4 w-4 text-primary`}),t]}),(0,q.jsx)(`p`,{className:`mt-0.5 text-[12px] leading-relaxed text-gray-500`,children:n})]})})}function kr(e,t){let n=Date.parse(e.updatedAt),r=Date.parse(t.updatedAt);return Number.isNaN(n)||Number.isNaN(r)?t.updatedAt.localeCompare(e.updatedAt):r-n}function Q(e,t){return t.startsWith(`zh`)?e.zh:e.en}function Ar(e){return _r.find(t=>t.scene===e)??{scene:e,...vr}}function jr(e,t,n){return t.title?Q(t.title,n):e.title}function Mr(e,t,n){return t.summary?Q(t.summary,n):e.description??e.scene}function Nr(e,t){return t.startsWith(`zh`)?`${e} 个技能`:`${e} skills`}function Pr(e){let{items:t,installedRecordLookup:n,scene:r,forcedType:i,typeFilter:a,scope:o,searchText:s,query:c,showListSkeleton:l,hasCatalogError:u}=e,d=Nn(a===`skill`),f=(0,K.useMemo)(()=>d.data?.scenes??[],[d.data?.scenes]),p=Pn(f,a===`skill`),m=(0,K.useMemo)(()=>f.map(e=>({...e,count:typeof e.count==`number`?e.count:p.get(e.scene)})),[p,f]),h=(0,K.useMemo)(()=>t.map(e=>({item:e,record:Vn(e,n)})),[t,n]),g=(0,K.useMemo)(()=>{let e=r?.trim();if(e)return m.find(t=>t.scene===e)??{scene:e,title:e}},[r,m]),_=a===`skill`&&!!r?.trim(),v=a===`skill`&&o===`all`&&!s.trim()&&!c&&!_,y=l||t.length>=4,b=v&&!u&&y&&m.length===0&&d.isLoading;return{entries:h,scenes:m,selectedScene:g,sceneEntries:h,isSceneRoute:_,isScenesLoading:b,showShelves:v&&!u&&y&&(l||m.length>0||b),backPath:i?`/skills`:`/marketplace/skills`,pathPrefix:i?`/skills/scenes`:`/marketplace/skills/scenes`}}var Fr=20,Ir=36;function Lr(){return{pageTitle:`marketplaceSkillsPageTitle`,pageDescription:`marketplaceSkillsPageDescription`,tabMarketplace:`marketplaceTabMarketplaceSkills`,tabInstalled:`marketplaceTabInstalledSkills`,searchPlaceholder:`marketplaceSearchPlaceholderSkills`,sectionCatalog:`marketplaceSectionSkills`,sectionInstalled:`marketplaceSectionInstalledSkills`,errorLoadData:`marketplaceErrorLoadingSkillsData`,errorLoadInstalled:`marketplaceErrorLoadingInstalledSkills`,emptyData:`marketplaceNoSkills`,emptyInstalled:`marketplaceNoInstalledSkills`,installedCountSuffix:`marketplaceInstalledSkillsCountSuffix`}}function Rr(e={}){let{forcedType:t}=e,r=c(),i=l(),{language:a}=zt(),o=Me(),s=`skill`,u=(0,K.useMemo)(()=>fe(a),[a]),d=Lr(),[f,p]=(0,K.useState)(``),[m,h]=(0,K.useState)(``),[g,_]=(0,K.useState)(`all`),[v,y]=(0,K.useState)(`relevance`),[b,C]=(0,K.useState)(new Set),[w,T]=(0,K.useState)(new Map),E=(0,K.useRef)({byKey:new Map,seq:0});(0,K.useEffect)(()=>{let e=setTimeout(()=>{h(f.trim())},250);return()=>clearTimeout(e)},[f]);let D=Fn(s),O=s===`skill`?i.scene?.trim():void 0,k=jn({q:O?void 0:m||void 0,scene:O,type:s,sort:v,pageSize:Fr}),A=ue({disabled:g!==`all`||k.isError||!k.hasNextPage||k.isFetchingNextPage,onLoadMore:()=>k.fetchNextPage(),watchValue:`${s}:${g}:${m}:${O??``}:${v}:${k.data?.loadedItems??0}:${k.data?.loadedPages??0}`});(0,K.useEffect)(()=>{let e=A.containerRef.current;e&&typeof e.scrollTo==`function`&&e.scrollTo({top:0})},[A.containerRef,m,O,g,v,s]);let ee=In(),te=Ln(),{confirm:ne,ConfirmDialog:re}=gt(),j=(0,K.useMemo)(()=>D.data?.records??[],[D.data?.records]),M=(0,K.useMemo)(()=>k.data?.items??[],[k.data?.items]),ie=(0,K.useMemo)(()=>zn(M),[M]),ae=(0,K.useMemo)(()=>Bn(j),[j]),N=(0,K.useMemo)(()=>{let e=j.filter(e=>e.type===s).map(e=>({key:`${e.type}:${e.spec}:${e.id??``}`,record:e,item:Hn(e,ie)})).filter(e=>Un(e.record,e.item,m,u));return e.sort((e,t)=>{let n=e.record.installedAt?Date.parse(e.record.installedAt):NaN,r=t.record.installedAt?Date.parse(t.record.installedAt):NaN;return!Number.isNaN(n)&&!Number.isNaN(r)&&n!==r?r-n:e.record.spec.localeCompare(t.record.spec)}),e},[j,s,ie,m,u]),oe=g===`installed`?N.length:k.data?.total??0,se={showCatalog:g===`all`&&k.isLoading&&!k.data,showInstalled:g===`installed`&&D.isLoading&&!D.data},P=se.showCatalog||se.showInstalled,le=(0,K.useMemo)(()=>g===`installed`?D.isLoading&&!D.data?n(`loading`):`${N.length} ${n(d.installedCountSuffix)}`:k.data?`${M.length} / ${oe}`:n(`loading`),[g,D.data,D.isLoading,N.length,k.data,M.length,oe,d.installedCountSuffix]),I={installingSpecs:b},pe={actionsByTarget:w},L=Pr({items:M,installedRecordLookup:ae,scene:O,forcedType:t,typeFilter:s,scope:g,searchText:f,query:m,showListSkeleton:P,hasCatalogError:k.isError}),me=async e=>{let t=e.install.spec;if(!b.has(t)){C(e=>{let n=new Set(e);return n.add(t),n});try{await ee.mutateAsync({type:e.type,spec:t,kind:e.install.kind,skill:e.slug,installPath:`skills/${e.slug}`})}catch{}finally{C(e=>{if(!e.has(t))return e;let n=new Set(e);return n.delete(t),n})}}},he=async(e,t)=>{let r=e===`update`?t.catalogSlug||t.id||t.spec:t.id||t.spec;if(r&&!w.has(r)&&!(e===`uninstall`&&!await ne({title:`${n(`marketplaceUninstallTitle`)} ${r}?`,description:n(`marketplaceUninstallDescription`),confirmLabel:n(`marketplaceUninstall`),variant:`destructive`}))){T(t=>{let n=new Map(t);return n.set(r,e),n});try{await te.mutateAsync({type:t.type,action:e,id:r,spec:t.spec})}finally{T(e=>{if(!e.has(r))return e;let t=new Map(e);return t.delete(r),t})}}},ge=async(e,t)=>{let r=e?.name??t?.label??t?.id??t?.spec??n(`marketplaceUnknownItem`),i=e?`marketplace:${e.type}:${e.slug}`:`marketplace:${t?.type??`unknown`}:${t?.id??t?.spec??r}`,a={title:r,kind:`content`,dedupeKey:i},s={...a,activate:!1};if(!e){let e=Z({title:r,typeLabel:n(`marketplaceTypeSkill`),spec:t?.spec??`-`,summary:n(`marketplaceInstalledLocalSummary`),metadataRaw:JSON.stringify(t??{},null,2),contentRaw:`-`});o.open(e,a);return}let c=E.current.seq+1;E.current.seq=c,E.current.byKey.set(i,c);let l=F(e.summaryI18n,e.summary,u),d={typeLabel:n(`marketplaceTypeSkill`),loadContent:()=>S(e.slug),fallbackContent:n(`marketplaceOperationFailed`),defaultContent:void 0};o.open(Z({title:r,typeLabel:d.typeLabel,spec:e.install.spec,loading:!0}),a);try{let t=await d.loadContent();if(E.current.byKey.get(i)!==c)return;let n=Z({title:r,typeLabel:d.typeLabel,spec:e.install.spec,summary:l,metadataRaw:t.metadataRaw,contentRaw:t.bodyRaw||t.raw||d.defaultContent,sourceUrl:t.sourceUrl,sourceLabel:`Source (${t.source})`,tags:e.tags,author:e.author});o.open(n,s)}catch(t){if(E.current.byKey.get(i)!==c)return;let n=Z({title:r,typeLabel:d.typeLabel,spec:e.install.spec,summary:l,metadataRaw:JSON.stringify({error:t instanceof Error?t.message:String(t)},null,2),contentRaw:d.fallbackContent});o.open(n,s)}};return(0,q.jsxs)(x,{className:`flex h-full min-h-0 flex-col pb-0`,children:[!L.isSceneRoute&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Ht,{tabs:[{id:`all`,label:n(d.tabMarketplace)},{id:`installed`,label:n(d.tabInstalled),count:D.data?.total??0}],activeTab:g,onChange:e=>_(e),className:`mb-3`}),(0,q.jsx)(ce,{scope:g,searchText:f,searchPlaceholder:n(d.searchPlaceholder),sort:v,onSearchTextChange:p,onSortChange:y})]}),(0,q.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:[!L.isSceneRoute&&!L.showShelves&&!P&&(0,q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,q.jsx)(`h3`,{className:`text-[14px] font-semibold text-gray-900`,children:g===`installed`?n(d.sectionInstalled):a.startsWith(`zh`)?`全部技能`:`All Skills`}),(0,q.jsx)(`span`,{className:`text-[12px] text-gray-500`,children:le})]}),g===`all`&&k.isError&&(0,q.jsxs)(`div`,{className:`rounded-xl border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700`,children:[n(d.errorLoadData),`: `,k.error.message]}),g===`installed`&&D.isError&&(0,q.jsxs)(`div`,{className:`rounded-xl border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700`,children:[n(d.errorLoadInstalled),`: `,D.error.message]}),(0,q.jsxs)(`div`,{ref:A.containerRef,className:`min-h-0 flex-1 overflow-y-auto custom-scrollbar pr-1`,"aria-busy":P||k.isFetchingNextPage,children:[L.isSceneRoute&&L.selectedScene&&(0,q.jsx)(Tr,{scene:L.selectedScene,entries:L.sceneEntries,isLoading:P,language:a,localeFallbacks:u,installState:I,onBack:()=>r(L.backPath),onOpen:e=>void ge(e.item,e.record),onInstall:me}),L.showShelves&&(0,q.jsx)(Sr,{entries:L.entries,scenes:L.scenes,isScenesLoading:L.isScenesLoading,isItemsLoading:P,language:a,installState:I,onOpen:e=>void ge(e.item,e.record),onInstall:me,onOpenScene:e=>r(`${L.pathPrefix}/${e}`)}),!L.isSceneRoute&&(0,q.jsx)(dr,{scope:g,title:g===`installed`?n(d.sectionInstalled):a.startsWith(`zh`)?`全部技能`:`All Skills`,summary:le,showTitle:L.showShelves,showListSkeleton:P,skeletonCardCount:Ir,allItems:M,installedEntries:N,installedRecordLookup:ae,language:a,installState:I,manageState:pe,onOpen:(e,t)=>void ge(e,t),onInstall:me,onManage:he}),g===`all`&&!L.isSceneRoute&&!P&&!k.isError&&M.length===0&&(0,q.jsx)(`div`,{className:`py-8 text-center text-[13px] text-gray-500`,children:n(d.emptyData)}),g===`installed`&&!L.isSceneRoute&&!P&&!D.isError&&N.length===0&&(0,q.jsx)(`div`,{className:`py-8 text-center text-[13px] text-gray-500`,children:n(d.emptyInstalled)}),g===`all`&&!P&&!k.isError&&(0,q.jsx)(de,{hasMore:!!k.hasNextPage,loading:k.isFetchingNextPage,sentinelRef:A.sentinelRef})]})]}),(0,q.jsx)(re,{})]})}function zr(e){let{view:t,routeSessionKey:n,selectedSessionKey:r,setSelectedSessionKey:i,selectedSessionKeyRef:a,resetStreamState:o}=e;(0,K.useEffect)(()=>{if(t===`chat`){if(n){r!==n&&i(n);return}r!==null&&(i(null),o())}},[o,n,r,i,t]),(0,K.useEffect)(()=>{a.current=r},[r,a])}function Br({view:e,confirmDialog:t}){let{isMobile:n}=Re();return(0,q.jsxs)(`div`,{className:`h-full flex`,children:[n?null:(0,q.jsx)(dt,{}),e===`chat`?n?(0,q.jsx)(Pt,{}):(0,q.jsx)(xt,{}):(0,q.jsx)(`section`,{className:`flex-1 min-h-0 overflow-hidden bg-gradient-to-b from-gray-50/60 to-white`,children:e===`cron`?(0,q.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,q.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1120px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,q.jsx)(wn,{})})}):e===`agents`?(0,q.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,q.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1180px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,q.jsx)(yn,{})})}):(0,q.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,q.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full max-w-[min(1120px,100%)] flex-col px-4 py-4 sm:px-6 sm:py-5`,children:(0,q.jsx)(Rr,{forcedType:`skills`})})})}),t]})}function Vr(e,t){return e.filter(e=>it(e,t))}function Hr(e){let{config:t,providersView:n,templatesView:r}=e;return(0,K.useMemo)(()=>{let e=Gt({providersView:n,templatesView:r,config:t,onlyConfigured:!0}),i=new Set,a=[];for(let t of e)for(let e of t.models){let n=Kt(t.prefix,e);!n||i.has(n)||(i.add(n),a.push({value:n,modelLabel:e,providerLabel:t.displayName,thinkingCapability:Wt(t.modelThinking,e,t.aliases)}))}return a.sort((e,t)=>{let n=e.providerLabel.localeCompare(t.providerLabel);return n===0?e.modelLabel.localeCompare(t.modelLabel):n})},[t,n,r])}function Ur(e){let{sessions:t,sessionKey:n,sessionType:r}=e;return{recentSessionPreferredModel:(0,K.useMemo)(()=>Tt({sessions:t,selectedSessionKey:n??``,sessionType:r,readPreference:e=>e.preferredModel?.trim()||void 0}),[n,r,t]),recentSessionPreferredThinking:(0,K.useMemo)(()=>Tt({sessions:t,selectedSessionKey:n??``,sessionType:r,readPreference:e=>e.preferredThinking??void 0}),[n,r,t])}}function Wr(e){let{currentSelectedModel:t,modelOptions:n}=e,r=(0,K.useMemo)(()=>n.find(e=>e.value===t),[t,n]);return{supportedThinkingLevels:(0,K.useMemo)(()=>r?.thinkingCapability?.supported??[],[r?.thinkingCapability?.supported]),defaultThinkingLevel:(0,K.useMemo)(()=>r?.thinkingCapability?.default??null,[r?.thinkingCapability?.default])}}function Gr(e){let{modelOptions:t,supportedModels:n}=e;if(!n||n.length===0)return t;let r=new Set(n),i=t.filter(e=>r.has(e.value));return i.length>0?i:t}function Kr(e){let{currentSelectedModel:t,pendingSessionType:n,projectRootOverride:r,query:i,sessionKey:a,setPendingSessionType:o,setSelectedModel:s,setSelectedThinkingLevel:c}=e,l=st(),u=It(),d=St(),f=Nt({limit:200}),p=Mt(),m=Ot({sessionId:a?.trim()||`draft-session`,...Object.prototype.hasOwnProperty.call(e,`projectRootOverride`)?{projectRoot:r??null}:{}}),h=(l.isFetched||l.isSuccess)&&(u.isFetched||u.isSuccess)&&(d.isFetched||d.isSuccess),g=Hr({config:l.data,providersView:u.data,templatesView:d.data}),_=(0,K.useMemo)(()=>f.data?.sessions??[],[f.data?.sessions]),v=(0,K.useMemo)(()=>ze(_),[_]),y=(0,K.useMemo)(()=>Vr(v,i),[v,i]),b=(0,K.useMemo)(()=>v.find(e=>e.key===a)??null,[v,a]),x=(0,K.useMemo)(()=>m.data?.records??[],[m.data?.records]),S=nt({selectedSession:b,pendingSessionType:n,setPendingSessionType:o,sessionTypesData:p.data}),C=(0,K.useMemo)(()=>Gr({modelOptions:g,supportedModels:S.selectedSessionTypeOption?.supportedModels}),[g,S.selectedSessionTypeOption?.supportedModels]),{recentSessionPreferredModel:w,recentSessionPreferredThinking:T}=Ur({sessions:v,sessionKey:a,sessionType:S.selectedSessionType}),{supportedThinkingLevels:E,defaultThinkingLevel:D}=Wr({currentSelectedModel:t,modelOptions:C});return jt({modelOptions:C,selectedSessionKey:a??``,selectedSessionExists:!!b,selectedSessionPreferredModel:b?.preferredModel,fallbackPreferredModel:S.selectedSessionTypeOption?.recommendedModel??w,defaultModel:S.selectedSessionTypeOption?.recommendedModel??l.data?.agents.defaults.model,setSelectedModel:s}),_t({supportedThinkingLevels:E,selectedSessionKey:a??``,selectedSessionExists:!!b,selectedSessionPreferredThinking:b?.preferredThinking??null,fallbackPreferredThinking:T??null,defaultThinkingLevel:D,setSelectedThinkingLevel:c}),{configQuery:l,providersQuery:u,templatesQuery:d,sessionsQuery:f,sessionTypesQuery:p,sessionSkillsQuery:m,isProviderStateResolved:h,modelOptions:C,sessionSummaries:_,sessions:y,skillRecords:x,selectedSession:b,...S}}function qr(e){return e.parentSessionKey?e.sessionSummaries.map(Ze).filter(t=>t.parentSessionId===e.parentSessionKey).sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)).map(e=>({sessionKey:e.key,parentSessionKey:e.parentSessionId??null,label:e.label??null,agentId:e.agentId??null})):[]}function Jr(e){let{availableAgents:t,parentSessionId:n,selectedAgentId:r,selectedSession:i,selectedSessionType:a,sessionKey:o,sessionSummaries:s,sessionTypeOptions:c}=e,l=i?Fe(i):void 0,u=i?.agentId??r,d=t.find(e=>e.id===u)??null,f=(0,K.useMemo)(()=>{if(!n)return null;let e=s.find(e=>e.sessionId===n)??null;return e?Ze(e):null},[n,s]),p=c.find(e=>e.value===a)??null;return{currentSessionDisplayName:l,currentAgentId:u,currentAgent:d,parentSession:f,currentSessionTypeLabel:p?.label??W(a),currentSessionTypeIcon:p?.icon??null,currentChildSessionTabs:(0,K.useMemo)(()=>qr({parentSessionKey:o,sessionSummaries:s}),[o,s])}}function Yr(e){(0,K.useEffect)(()=>{e.presenter.chatInputManager.syncSnapshot({isProviderStateResolved:e.isProviderStateResolved,defaultSessionType:e.defaultSessionType,canStopGeneration:e.canStopCurrentRun,stopDisabledReason:e.stopDisabledReason,stopSupported:!0,stopReason:void 0,sendError:e.lastSendError,isSending:e.isSending,modelOptions:e.modelOptions,sessionTypeOptions:e.sessionTypeOptions,selectedSessionType:e.selectedSessionType,canEditSessionType:e.canEditSessionType,sessionTypeUnavailable:e.sessionTypeUnavailable,skillRecords:e.skillRecords,isSkillsLoading:e.isSkillsLoading}),e.presenter.chatThreadManager.syncSnapshot({isProviderStateResolved:e.isProviderStateResolved,modelOptions:e.modelOptions,sessionTypeUnavailable:e.sessionTypeUnavailable,sessionTypeUnavailableMessage:e.sessionTypeUnavailableMessage,sessionTypeLabel:e.currentSessionTypeLabel,sessionTypeIcon:e.currentSessionTypeIcon,sessionKey:e.sessionKey??null,agentId:e.currentAgentId,agentDisplayName:e.currentAgent?.displayName??null,agentAvatarUrl:e.currentAgent?.avatarUrl??null,availableAgents:e.availableAgents,sessionDisplayName:e.currentSessionDisplayName,sessionProjectRoot:e.effectiveSessionProjectRoot,sessionProjectName:e.effectiveSessionProjectName,canDeleteSession:!!e.selectedSession,threadRef:e.threadRef,isHistoryLoading:e.agent.isHydrating,messages:e.agent.visibleMessages,isSending:e.isSending,isAwaitingAssistantOutput:e.isAwaitingAssistantOutput,contextWindow:Be(e.agent.snapshot.contextWindow),parentSessionKey:e.parentSession?.key??null,parentSessionLabel:e.parentSession?Fe(e.parentSession):null,childSessionTabs:e.childSessionTabs})},[e])}function Xr(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function $(e,t){return e?Object.fromEntries(t.map(t=>[t,e])):{}}function Zr(e){let t=Ne(e.projectRoot),n={...$(e.model?.trim(),[`model`,`preferred_model`]),...$(e.thinkingLevel?.trim(),[`thinkingEffort`,`thinking`,`preferred_thinking`]),...$(e.sessionType?.trim(),[`agentRuntimeId`,`session_type`,`runtime`]),...$(e.agentId?.trim(),[`agentId`,`agent_id`]),...$(t??void 0,[`projectRoot`,`project_root`])},r=Xr(e.requestedSkills);r.length>0&&(n.requested_skill_refs=r);let i=e.composerNodes?Ye(e.composerNodes):[];return i.length>0&&(n[vt]=i),n}function Qr(e){let{pendingProjectRoot:t,pendingProjectRootSessionKey:n,sessionKey:r,selectedSessionProjectRoot:i}=e;return t!==null&&n!==null&&r===n&&(i??null)===t}function $r(e){let t=He(e=>e.snapshot.query),n=He(e=>e.snapshot.selectedSessionKey),r=He(e=>e.snapshot.selectedAgentId),i=V(e=>e.snapshot.pendingSessionType),a=V(e=>e.snapshot.pendingProjectRoot),o=V(e=>e.snapshot.pendingProjectRootSessionKey),u=V(e=>e.snapshot.selectedModel),d=se(),f=Xe(d),p=Le(),{confirm:m,ConfirmDialog:h}=gt(),g=s(),_=c(),{sessionId:v}=l(),y=(0,K.useRef)(null),b=(0,K.useRef)(n),x=(0,K.useMemo)(()=>Dt(v),[v]),S=x??void 0,C=a!==null&&(!S||o===S),w=Kr({query:t,sessionKey:S??null,projectRootOverride:C?a:void 0,currentSelectedModel:u,pendingSessionType:i,setPendingSessionType:e.chatInputManager.setPendingSessionType,setSelectedModel:e.chatInputManager.setSelectedModel,setSelectedThinkingLevel:e.chatInputManager.setSelectedThinkingLevel});return{presenter:e,selectedSessionKey:n,selectedAgentId:r,pendingProjectRoot:a,pendingProjectRootSessionKey:o,systemStatus:d,isRuntimeBlocked:f,agentsQuery:p,confirm:m,ConfirmDialog:h,location:g,navigate:_,threadRef:y,selectedSessionKeyRef:b,routeSessionKey:x,sessionKey:S,hasSessionProjectRootOverride:C,agent:ct(S),...w}}function ei(e){let t=$r(e),{agent:n,agentsQuery:r,hasSessionProjectRootOverride:i,pendingProjectRoot:a,isRuntimeBlocked:o,systemStatus:s,selectedAgentId:c,selectedSession:l,selectedSessionType:u,sessionKey:d,sessionSummaries:f,sessionTypeOptions:p}=t,m=i?a:l?.projectRoot??null,h=i?bt(m):l?.projectName??bt(m),g=n.hydrateError?.message??n.snapshot.error?.message??null,_=s.phase===`ready`&&ht(g)?null:g,v=(r.data?.agents?.length??0)>0?r.data?.agents??[]:[{id:l?.agentId??c}],y=Jr({sessionKey:d??null,selectedSession:l,selectedAgentId:c,availableAgents:v,parentSessionId:l?.parentSessionId??null,sessionSummaries:f,selectedSessionType:u,sessionTypeOptions:p}),b=n.isRunning||l?.status===`running`;return{...t,availableAgents:v,effectiveSessionProjectRoot:m,effectiveSessionProjectName:h,isSending:n.isSending||b,isAwaitingAssistantOutput:b,canStopCurrentRun:b,stopDisabledReason:b?null:`__preparing__`,lastSendError:o?null:s.phase===`ready`?_:$e({message:_,status:s}),...y}}function ti(e){let{agent:t,pendingProjectRoot:n,pendingProjectRootSessionKey:r,presenter:i,selectedSession:a,selectedSessionKeyRef:o,sessionKey:s}=e;(0,K.useEffect)(()=>{i.chatStreamActionsManager.bind({sendMessage:async e=>{if((e.sessionKey??null)!==(s??null))return;let o=Zr({agentId:e.agentId,model:e.model,thinkingLevel:e.thinkingLevel,sessionType:e.sessionType,projectRoot:!e.sessionKey||e.sessionKey===r?n:a?.projectRoot??null,requestedSkills:e.requestedSkills,composerNodes:e.composerNodes}),c=qe({sessionId:e.sessionKey,text:e.message,attachments:e.attachments,parts:e.parts,metadata:o});if(c)try{let n=await t.send(c);!e.sessionKey&&n?.sessionId&&i.chatSessionListManager.materializeRootSessionRoute(n.sessionId)}catch(t){throw e.restoreDraftOnError&&(e.composerNodes&&e.composerNodes.length>0?i.chatInputManager.restoreComposerState?.(e.composerNodes,e.attachments??[]):i.chatInputManager.setDraft(t=>t.trim().length===0?e.message:t)),t}},stopCurrentRun:async()=>{await t.abort()},resumeRun:async e=>{e.sessionKey===s&&await t.streamRun()},resetStreamState:()=>{o.current=null},applyHistoryMessages:()=>{}})},[t,n,r,i,a?.projectRoot,o,s])}function ni(e){let{pendingProjectRoot:t,pendingProjectRootSessionKey:n,selectedSession:r}=e;(0,K.useEffect)(()=>{!r||!Qr({pendingProjectRoot:t,pendingProjectRootSessionKey:n,sessionKey:r.key,selectedSessionProjectRoot:r.projectRoot??null})||V.getState().setSnapshot({pendingProjectRoot:null,pendingProjectRootSessionKey:null})},[t,n,r])}function ri(e){let{confirm:t,location:n,navigate:r,presenter:i}=e;(0,K.useEffect)(()=>{i.chatUiManager.syncState({pathname:n.pathname}),i.chatUiManager.bindActions({navigate:r,confirm:t})},[t,n.pathname,r,i])}function ii(e){let{presenter:t,selectedAgentId:n,selectedSession:r}=e;(0,K.useEffect)(()=>{!r?.agentId||n===r.agentId||t.chatSessionListManager.setSelectedAgentId(r.agentId)},[t,n,r?.agentId])}function ai(e){let{agent:t,presenter:n,routeSessionKey:r}=e,i=t.snapshot.activeRun?.sessionId??t.visibleMessages.find(e=>e.sessionId.trim())?.sessionId??null;(0,K.useEffect)(()=>{r||!i||n.chatSessionListManager.materializeRootSessionRoute(i)},[i,n,r])}function oi({view:e}){let[t]=(0,K.useState)(()=>new lt),n=ei(t);return ti(n),ni(n),ri(n),ii(n),ai(n),zr({view:e,routeSessionKey:n.routeSessionKey,selectedSessionKey:n.selectedSessionKey,setSelectedSessionKey:t.chatSessionListManager.setSelectedSessionKey,selectedSessionKeyRef:n.selectedSessionKeyRef,resetStreamState:t.chatStreamActionsManager.resetStreamState}),Yr({presenter:t,isProviderStateResolved:n.isProviderStateResolved,defaultSessionType:n.defaultSessionType,canStopCurrentRun:n.canStopCurrentRun,stopDisabledReason:n.stopDisabledReason,lastSendError:n.lastSendError,isSending:n.isSending,modelOptions:n.modelOptions,sessionTypeOptions:n.sessionTypeOptions,selectedSessionType:n.selectedSessionType,canEditSessionType:n.canEditSessionType,sessionTypeUnavailable:n.sessionTypeUnavailable,skillRecords:n.skillRecords,isSkillsLoading:n.sessionSkillsQuery.isLoading,sessionTypeUnavailableMessage:n.sessionTypeUnavailableMessage,currentSessionTypeLabel:n.currentSessionTypeLabel,currentSessionTypeIcon:n.currentSessionTypeIcon,sessionKey:n.sessionKey,currentAgentId:n.currentAgentId,currentAgent:n.currentAgent,availableAgents:n.availableAgents,currentSessionDisplayName:n.currentSessionDisplayName,effectiveSessionProjectRoot:n.effectiveSessionProjectRoot,effectiveSessionProjectName:n.effectiveSessionProjectName,selectedSession:n.selectedSession,threadRef:n.threadRef,agent:n.agent,isAwaitingAssistantOutput:n.isAwaitingAssistantOutput,parentSession:n.parentSession,childSessionTabs:n.currentChildSessionTabs}),(0,q.jsx)(tt,{presenter:t,children:(0,q.jsx)(Br,{view:e,confirmDialog:(0,q.jsx)(n.ConfirmDialog,{})})})}function si({view:e}){return(0,q.jsx)(oi,{view:e})}export{si as ChatPage};
|
|
105
|
+
</html>`;return`data:text/html;charset=utf-8,${encodeURIComponent(b)}`}var rr=[`bg-amber-600`,`bg-orange-500`,`bg-yellow-600`,`bg-emerald-600`,`bg-teal-600`,`bg-cyan-600`,`bg-stone-600`,`bg-rose-500`,`bg-violet-500`];function ir(t){let{name:n,fallback:r,className:i}=t,a=n||r,o=a.substring(0,2).toUpperCase();return(0,q.jsx)(`div`,{className:e(`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-sm font-semibold text-white`,ar(a),i),children:o})}function ar(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return rr[Math.abs(t)%rr.length]}function or({title:e,spec:t,summary:n}){return(0,q.jsxs)(xe,{delayDuration:400,children:[(0,q.jsxs)(B,{children:[(0,q.jsx)(R,{asChild:!0,children:(0,q.jsx)(`div`,{className:`truncate text-[14px] font-semibold leading-tight text-gray-900`,children:e})}),(0,q.jsx)(z,{className:`max-w-[300px] text-xs`,children:e})]}),(0,q.jsx)(`div`,{className:`mb-1.5 mt-0.5 flex min-w-0 items-center gap-1.5`,children:t?(0,q.jsxs)(B,{children:[(0,q.jsx)(R,{asChild:!0,children:(0,q.jsx)(`span`,{className:`max-w-full truncate text-[11px] font-mono text-gray-400`,children:t})}),(0,q.jsx)(z,{className:`max-w-[300px] break-all font-mono text-xs`,children:t})]}):null}),(0,q.jsx)(`p`,{className:`line-clamp-2 text-left text-[12px] leading-relaxed text-gray-500/90`,children:n})]})}function sr(t){let{item:r,record:i,isInstalling:a,isDisabled:o,canUpdate:s,canUninstall:c,busyAction:l,busyForRecord:u,language:d,onInstall:f,onManage:p}=t,m=!!(r&&!i||i&&(s||c));return(0,q.jsxs)(`div`,{className:e(`relative flex h-8 shrink-0 items-center justify-end`,i?`md:w-5`:`md:w-0`),children:[(0,q.jsx)(`div`,{className:e(`hidden items-center justify-end transition-opacity duration-150 md:flex`,m&&`group-hover:opacity-0 group-focus-within:opacity-0`),children:i?(0,q.jsx)(cr,{disabled:o,language:d}):null}),(0,q.jsxs)(`div`,{className:e(`flex w-max items-center justify-end gap-2 transition-opacity duration-150`,`opacity-100 md:pointer-events-none md:absolute md:right-0 md:opacity-0`,`md:group-hover:pointer-events-auto md:group-hover:opacity-100`,`md:group-focus-within:pointer-events-auto md:group-focus-within:opacity-100`),children:[r&&!i&&(0,q.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),f(r)},disabled:a,className:`inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-xl bg-primary px-3 text-xs font-medium text-white transition-colors hover:bg-primary-600 disabled:opacity-50`,children:[(0,q.jsx)(et,{className:`h-3.5 w-3.5`}),n(a?`marketplaceInstalling`:`marketplaceInstall`)]}),i&&s&&(0,q.jsxs)(`button`,{disabled:u,onClick:e=>{e.stopPropagation(),p(`update`,i)},className:`inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-xl border border-blue-200/80 bg-white px-3 text-xs font-medium text-blue-600 transition-colors hover:border-blue-300 hover:bg-blue-50 disabled:opacity-50`,children:[(0,q.jsx)(Ee,{className:`h-3.5 w-3.5`}),n(l===`update`?`marketplaceUpdating`:`marketplaceUpdate`)]}),i&&c&&(0,q.jsxs)(`button`,{disabled:u,onClick:e=>{e.stopPropagation(),p(`uninstall`,i)},className:`inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-xl border border-gray-200/80 bg-white px-3 text-xs font-medium text-gray-500 transition-colors hover:border-rose-200 hover:bg-rose-50 hover:text-rose-600 disabled:opacity-50`,children:[(0,q.jsx)(De,{className:`h-3.5 w-3.5`}),n(l===`uninstall`?`marketplaceRemoving`:`marketplaceUninstall`)]})]})]})}function cr(t){let{disabled:n,language:r}=t,i=ur(n?{zh:`已禁用`,en:`Disabled`}:{zh:`已安装`,en:`Installed`},r);return(0,q.jsx)(xe,{delayDuration:300,children:(0,q.jsxs)(B,{children:[(0,q.jsx)(R,{asChild:!0,children:(0,q.jsx)(`span`,{"aria-label":i,className:e(`inline-flex h-5 w-5 items-center justify-center`,n?`text-gray-400`:`text-emerald-700`),children:n?(0,q.jsx)(a,{className:`h-4 w-4 opacity-40`}):(0,q.jsx)(a,{className:`h-4 w-4`})})}),(0,q.jsx)(z,{className:`text-xs`,children:i})]})})}function lr(e){let{item:t,record:r,language:i,installState:a,manageState:o,onOpen:s,onInstall:c,onManage:l}=e,u=fe(i),d=t?.name??r?.label??r?.id??r?.spec??n(`marketplaceUnknownItem`),f=F(t?.summaryI18n,t?.summary,u)||(r?n(`marketplaceInstalledLocalSummary`):``),p=t?.install.spec??r?.spec??``,m=r?.id||r?.spec,h=m?o.actionsByTarget.get(m):void 0,g=!!h,_=r?.type===`skill`&&r.source===`workspace`,v=r?.type===`skill`&&r.origin===`marketplace`,y=r?r.enabled===!1||r.runtimeStatus===`disabled`:!1,b=t?.install.spec,x=typeof b==`string`&&a.installingSpecs.has(b);return(0,q.jsxs)(`article`,{onClick:s,className:`group flex cursor-pointer items-start justify-between gap-3.5 rounded-2xl border border-gray-200/40 bg-white px-5 py-4 shadow-sm transition-all hover:border-blue-300/80 hover:shadow-md`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 gap-3`,children:[(0,q.jsx)(ir,{name:d,fallback:p||n(`marketplaceTypeSkill`)}),(0,q.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col justify-center`,children:(0,q.jsx)(or,{title:d,spec:p,summary:f})})]}),(0,q.jsx)(sr,{item:t,record:r,isInstalling:x,isDisabled:y,canUpdate:v,canUninstall:_,busyAction:h,busyForRecord:g,language:i,onInstall:c,onManage:l})]})}function ur(e,t){return t.startsWith(`zh`)?e.zh:e.en}function dr(t){let{scope:n,title:r,summary:i,showTitle:a,showListSkeleton:o,skeletonCardCount:s,allItems:c,installedEntries:l,installedRecordLookup:u,language:d,installState:f,manageState:p,onOpen:m,onInstall:h,onManage:g}=t;return(0,q.jsxs)(`section`,{className:e(`flex min-h-full flex-col`,a&&`gap-3`),children:[a&&(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,q.jsx)(`h3`,{className:`text-[14px] font-semibold text-gray-950`,children:r}),(0,q.jsx)(`span`,{className:`text-[12px] text-gray-500`,children:i})]}),(0,q.jsxs)(`div`,{"data-testid":o?`marketplace-list-skeleton`:void 0,className:e(`grid grid-cols-1 gap-3 lg:grid-cols-2 2xl:grid-cols-3`,o&&`min-h-0 flex-1 auto-rows-[104px] content-start`),children:[o&&(0,q.jsx)(pe,{count:s}),!o&&n===`all`&&c.map(e=>(0,q.jsx)(lr,{item:e,record:Vn(e,u),language:d,installState:f,manageState:p,onOpen:()=>m(e,Vn(e,u)),onInstall:h,onManage:g},e.id)),!o&&n===`installed`&&l.map(e=>(0,q.jsx)(lr,{item:e.item,record:e.record,language:d,installState:f,manageState:p,onOpen:()=>m(e.item,e.record),onInstall:h,onManage:g},e.key))]})]})}function fr(t){let{entry:r,language:i,localeFallbacks:o,installState:s,layout:c=`rail`,onOpen:l,onInstall:u}=t,{item:d,record:f}=r,p=F(d.summaryI18n,d.summary,o),m=d.install.spec,h=s.installingSpecs.has(m),g=!!f;return(0,q.jsxs)(`article`,{onClick:()=>l(r),className:e(`group flex min-h-[166px] cursor-pointer flex-col justify-between rounded-xl border border-gray-200/70 bg-white p-3 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,c===`rail`?`w-[260px] shrink-0`:`w-full min-w-0`),children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`mb-2.5 flex min-w-0 items-start gap-2.5`,children:[(0,q.jsx)(ir,{name:d.name,fallback:d.install.spec}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,q.jsx)(`div`,{className:`truncate text-[13px] font-semibold leading-tight text-gray-950`,children:d.name}),(0,q.jsx)(`div`,{className:`mt-0.5 truncate text-[11px] font-mono leading-tight text-gray-400`,children:pr(d)})]})]}),(0,q.jsx)(`p`,{className:`line-clamp-2 text-[12px] leading-relaxed text-gray-500`,children:p}),(0,q.jsx)(mr,{tags:d.tags})]}),(0,q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 border-t border-gray-100 pt-2.5`,children:[(0,q.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-gray-400`,children:hr(d.updatedAt)}),g?(0,q.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 text-[11px] font-semibold text-emerald-700`,children:[(0,q.jsx)(a,{className:`h-3.5 w-3.5`}),gr({zh:`已安装`,en:`Installed`},i)]}):(0,q.jsxs)(`button`,{type:`button`,disabled:h,onClick:e=>{e.stopPropagation(),u(d)},className:`inline-flex h-7 items-center gap-1.5 rounded-md border border-gray-200 bg-white px-2 text-[11px] font-semibold text-gray-700 transition-colors hover:border-gray-300 hover:bg-gray-50 disabled:opacity-50`,children:[(0,q.jsx)(et,{className:`h-3.5 w-3.5`}),n(h?`marketplaceInstalling`:`marketplaceInstall`)]})]})]})}function pr(e){return e.slug||e.install.spec}function mr({tags:e}){let t=e.slice(0,2);return t.length===0?null:(0,q.jsx)(`div`,{className:`mt-2 truncate text-[11px] font-medium text-gray-400`,children:t.join(` / `)})}function hr(e){return e.slice(0,10)||e}function gr(e,t){return t.startsWith(`zh`)?e.zh:e.en}var _r=[{scene:`development-debugging`,title:{zh:`开发与调试`,en:`Development`},summary:{zh:`代码审查、错误定位、架构分析与交付验证。`,en:`Review, debug, analyze, and verify delivery work.`},icon:cn,tone:`dark`,span:`md:col-span-2`},{scene:`office-collaboration`,title:{zh:`办公协作`,en:`Office Work`},summary:{zh:`连接文档、日历、会议、邮件和团队通信。`,en:`Connect docs, calendars, meetings, mail, and teams.`},icon:Zt,tone:`green`,span:`md:col-span-2`},{scene:`writing-content`,title:{zh:`写作与内容`,en:`Writing`},summary:{zh:`把调研、写作、润色和发布组织成连续工作流。`,en:`Turn research, writing, polishing, and publishing into one flow.`},icon:sn,tone:`amber`,span:`md:col-span-2`},{scene:`browser-automation`,title:{zh:`浏览器自动化`,en:`Browser`},summary:{zh:`操作网页、捕获动态内容并验证真实用户路径。`,en:`Operate pages, capture dynamic content, and verify user paths.`},icon:rn,tone:`blue`,span:`md:col-span-2`},{scene:`local-environment`,title:{zh:`本地环境`,en:`Local`},summary:{zh:`管理终端、文件、运行时和本地服务。`,en:`Manage shells, files, runtimes, and local services.`},icon:Ue,tone:`violet`,span:`md:col-span-1`},{scene:`social-platforms`,title:{zh:`社交平台`,en:`Social`},summary:{zh:`处理发布、互动、检索和内容分发。`,en:`Handle posting, interaction, search, and distribution.`},icon:on,tone:`sky`,span:`md:col-span-1`},{scene:`nextclaw-official`,title:{zh:`NextClaw 官方`,en:`NextClaw Official`},summary:{zh:`优先查看由 NextClaw 维护的原生能力。`,en:`Browse native capabilities maintained by NextClaw.`},icon:Ve,tone:`teal`,span:`md:col-span-2`}],vr={icon:Ve,tone:`dark`,span:`md:col-span-2`},yr={dark:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-stone-600 bg-stone-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},blue:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-cyan-600 bg-cyan-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},green:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-emerald-600 bg-emerald-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},amber:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-amber-600 bg-amber-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},violet:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-violet-500 bg-violet-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},sky:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-sky-500 bg-sky-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},teal:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-teal-600 bg-teal-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`}},br=`grid grid-cols-[repeat(auto-fill,minmax(240px,320px))] justify-start gap-3`,xr=24;function Sr(e){let{entries:t,scenes:n,isScenesLoading:r,isItemsLoading:i,language:a,installState:o,onOpen:s,onInstall:c,onOpenScene:l}=e,u=fe(a),d=[...t].sort((e,t)=>kr(e.item,t.item)).slice(0,6);return(0,q.jsxs)(`div`,{className:`mb-4 space-y-5`,children:[(0,q.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,q.jsx)(Or,{icon:nn,title:Q({zh:`场景`,en:`Scenes`},a),description:Q({zh:`按使用场景浏览适合的技能组合。`,en:`Browse skills by how you plan to use them.`},a)}),r?(0,q.jsx)(Cr,{}):(0,q.jsx)(`div`,{className:`grid grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:n.map(e=>(0,q.jsx)(wr,{scene:e,language:a,onSelect:l},e.scene))})]}),(i||d.length>0)&&(0,q.jsx)(Er,{icon:en,title:Q({zh:`最近更新`,en:`Recently updated`},a),description:Q({zh:`看看生态最近在补齐哪些能力。`,en:`See what the ecosystem has been improving lately.`},a),entries:d,language:a,localeFallbacks:u,isLoading:i,installState:o,onOpen:s,onInstall:c})]})}function Cr(){return(0,q.jsx)(`div`,{"data-testid":`marketplace-scenes-skeleton`,className:`grid grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:_r.map(e=>(0,q.jsxs)(`div`,{className:`flex min-h-[74px] flex-col justify-center rounded-lg border border-gray-200/70 bg-white px-3 py-2.5 shadow-sm`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(U,{className:`h-7 w-7 shrink-0 rounded-md`}),(0,q.jsx)(U,{className:`h-3.5 min-w-0 flex-1`}),(0,q.jsx)(U,{className:`h-3 w-8 shrink-0`})]}),(0,q.jsx)(U,{className:`mt-2 h-3 w-4/5`})]},e.scene))})}function wr(t){let{scene:n,language:r,onSelect:i}=t,a=Ar(n.scene),o=a.icon,s=yr[a.tone];return(0,q.jsx)(`button`,{type:`button`,onClick:()=>i(n.scene),className:e(`group flex min-h-[74px] flex-col justify-center rounded-lg border px-3 py-2.5 text-left shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/70`,s.card),children:(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`span`,{className:e(`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border`,s.icon),children:(0,q.jsx)(o,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-gray-950`,children:jr(n,a,r)}),typeof n.count==`number`&&(0,q.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:Nr(n.count,r)})]}),(0,q.jsx)(`p`,{className:e(`mt-1 line-clamp-1 text-[11px] leading-relaxed`,s.text),children:Mr(n,a,r)})]})})}function Tr(t){let{scene:n,entries:r,isLoading:i,language:a,localeFallbacks:o,installState:s,onBack:c,onOpen:l,onInstall:u}=t,d=Ar(n.scene),f=d.icon,p=yr[d.tone];return(0,q.jsxs)(`section`,{className:`flex min-h-full flex-col`,children:[(0,q.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-start gap-2.5`,children:[(0,q.jsx)(`button`,{type:`button`,onClick:c,className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900`,"aria-label":Q({zh:`返回`,en:`Back`},a),children:(0,q.jsx)(be,{className:`h-4 w-4`})}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`span`,{className:e(`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border`,p.icon),children:(0,q.jsx)(f,{className:`h-4 w-4`})}),(0,q.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[15px] font-semibold text-gray-950`,children:jr(n,d,a)}),(0,q.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:Q(i?{zh:`加载中`,en:`Loading`}:{zh:`${r.length} 个技能`,en:`${r.length} skills`},a)})]}),(0,q.jsx)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-2`,children:(0,q.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[12px] leading-relaxed text-gray-500`,children:Mr(n,d,a)})})]})]}),i?(0,q.jsx)(`div`,{"data-testid":`marketplace-scene-skeleton`,className:e(br,`min-h-0 flex-1 auto-rows-[166px] content-start`),children:(0,q.jsx)(pe,{count:xr})}):r.length>0?(0,q.jsx)(`div`,{className:br,children:r.map(e=>(0,q.jsx)(fr,{entry:e,language:a,localeFallbacks:o,installState:s,layout:`grid`,onOpen:l,onInstall:u},e.item.id))}):(0,q.jsx)(`div`,{className:`rounded-lg border border-dashed border-gray-200 py-8 text-center text-[12px] text-gray-500`,children:Q({zh:`这个模块暂无技能。`,en:`No skills in this module yet.`},a)})]})}function Er(e){let{icon:t,title:n,description:r,entries:i,language:a,localeFallbacks:o,isLoading:s,installState:c,onOpen:l,onInstall:u}=e;return(0,q.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,q.jsx)(Or,{icon:t,title:n,description:r}),s?(0,q.jsx)(Dr,{}):(0,q.jsx)(`div`,{className:`-mx-1 flex gap-2.5 overflow-x-auto px-1 pb-1.5 custom-scrollbar`,children:i.map(e=>(0,q.jsx)(fr,{entry:e,language:a,localeFallbacks:o,installState:c,onOpen:l,onInstall:u},e.item.id))})]})}function Dr(){return(0,q.jsx)(`div`,{"data-testid":`marketplace-recent-skeleton`,className:`-mx-1 flex gap-2.5 overflow-hidden px-1 pb-1.5`,children:Array.from({length:4},(e,t)=>(0,q.jsxs)(`article`,{className:`flex min-h-[166px] w-[260px] shrink-0 flex-col justify-between rounded-xl border border-gray-200/70 bg-white p-3 shadow-sm`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`mb-2.5 flex min-w-0 items-start gap-2.5`,children:[(0,q.jsx)(U,{className:`h-10 w-10 shrink-0 rounded-xl`}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5 pt-0.5`,children:[(0,q.jsx)(U,{className:`h-3.5 w-32 max-w-full`}),(0,q.jsx)(U,{className:`h-3 w-24 max-w-full`})]})]}),(0,q.jsx)(U,{className:`h-3 w-full`}),(0,q.jsx)(U,{className:`mt-1.5 h-3 w-4/5`}),(0,q.jsx)(U,{className:`mt-2 h-3 w-24`})]}),(0,q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 border-t border-gray-100 pt-2.5`,children:[(0,q.jsx)(U,{className:`h-3 w-20`}),(0,q.jsx)(U,{className:`h-7 w-16 rounded-md`})]})]},`marketplace-recent-skeleton-${t}`))})}function Or({icon:e,title:t,description:n}){return(0,q.jsx)(`div`,{className:`flex items-end justify-between gap-4`,children:(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`h3`,{className:`flex items-center gap-2 text-[14px] font-semibold text-gray-950`,children:[(0,q.jsx)(e,{className:`h-4 w-4 text-primary`}),t]}),(0,q.jsx)(`p`,{className:`mt-0.5 text-[12px] leading-relaxed text-gray-500`,children:n})]})})}function kr(e,t){let n=Date.parse(e.updatedAt),r=Date.parse(t.updatedAt);return Number.isNaN(n)||Number.isNaN(r)?t.updatedAt.localeCompare(e.updatedAt):r-n}function Q(e,t){return t.startsWith(`zh`)?e.zh:e.en}function Ar(e){return _r.find(t=>t.scene===e)??{scene:e,...vr}}function jr(e,t,n){return t.title?Q(t.title,n):e.title}function Mr(e,t,n){return t.summary?Q(t.summary,n):e.description??e.scene}function Nr(e,t){return t.startsWith(`zh`)?`${e} 个技能`:`${e} skills`}function Pr(e){let{items:t,installedRecordLookup:n,scene:r,forcedType:i,typeFilter:a,scope:o,searchText:s,query:c,showListSkeleton:l,hasCatalogError:u}=e,d=Nn(a===`skill`),f=(0,K.useMemo)(()=>d.data?.scenes??[],[d.data?.scenes]),p=Pn(f,a===`skill`),m=(0,K.useMemo)(()=>f.map(e=>({...e,count:typeof e.count==`number`?e.count:p.get(e.scene)})),[p,f]),h=(0,K.useMemo)(()=>t.map(e=>({item:e,record:Vn(e,n)})),[t,n]),g=(0,K.useMemo)(()=>{let e=r?.trim();if(e)return m.find(t=>t.scene===e)??{scene:e,title:e}},[r,m]),_=a===`skill`&&!!r?.trim(),v=a===`skill`&&o===`all`&&!s.trim()&&!c&&!_,y=l||t.length>=4,b=v&&!u&&y&&m.length===0&&d.isLoading;return{entries:h,scenes:m,selectedScene:g,sceneEntries:h,isSceneRoute:_,isScenesLoading:b,showShelves:v&&!u&&y&&(l||m.length>0||b),backPath:i?`/skills`:`/marketplace/skills`,pathPrefix:i?`/skills/scenes`:`/marketplace/skills/scenes`}}var Fr=20,Ir=36;function Lr(){return{pageTitle:`marketplaceSkillsPageTitle`,pageDescription:`marketplaceSkillsPageDescription`,tabMarketplace:`marketplaceTabMarketplaceSkills`,tabInstalled:`marketplaceTabInstalledSkills`,searchPlaceholder:`marketplaceSearchPlaceholderSkills`,sectionCatalog:`marketplaceSectionSkills`,sectionInstalled:`marketplaceSectionInstalledSkills`,errorLoadData:`marketplaceErrorLoadingSkillsData`,errorLoadInstalled:`marketplaceErrorLoadingInstalledSkills`,emptyData:`marketplaceNoSkills`,emptyInstalled:`marketplaceNoInstalledSkills`,installedCountSuffix:`marketplaceInstalledSkillsCountSuffix`}}function Rr(e={}){let{forcedType:t}=e,r=c(),i=l(),{language:a}=zt(),o=Me(),s=`skill`,u=(0,K.useMemo)(()=>fe(a),[a]),d=Lr(),[f,p]=(0,K.useState)(``),[m,h]=(0,K.useState)(``),[g,_]=(0,K.useState)(`all`),[v,y]=(0,K.useState)(`relevance`),[b,C]=(0,K.useState)(new Set),[w,T]=(0,K.useState)(new Map),E=(0,K.useRef)({byKey:new Map,seq:0});(0,K.useEffect)(()=>{let e=setTimeout(()=>{h(f.trim())},250);return()=>clearTimeout(e)},[f]);let D=Fn(s),O=s===`skill`?i.scene?.trim():void 0,k=jn({q:O?void 0:m||void 0,scene:O,type:s,sort:v,pageSize:Fr}),A=ue({disabled:g!==`all`||k.isError||!k.hasNextPage||k.isFetchingNextPage,onLoadMore:()=>k.fetchNextPage(),watchValue:`${s}:${g}:${m}:${O??``}:${v}:${k.data?.loadedItems??0}:${k.data?.loadedPages??0}`});(0,K.useEffect)(()=>{let e=A.containerRef.current;e&&typeof e.scrollTo==`function`&&e.scrollTo({top:0})},[A.containerRef,m,O,g,v,s]);let ee=In(),te=Ln(),{confirm:ne,ConfirmDialog:re}=gt(),j=(0,K.useMemo)(()=>D.data?.records??[],[D.data?.records]),M=(0,K.useMemo)(()=>k.data?.items??[],[k.data?.items]),ie=(0,K.useMemo)(()=>zn(M),[M]),ae=(0,K.useMemo)(()=>Bn(j),[j]),N=(0,K.useMemo)(()=>{let e=j.filter(e=>e.type===s).map(e=>({key:`${e.type}:${e.spec}:${e.id??``}`,record:e,item:Hn(e,ie)})).filter(e=>Un(e.record,e.item,m,u));return e.sort((e,t)=>{let n=e.record.installedAt?Date.parse(e.record.installedAt):NaN,r=t.record.installedAt?Date.parse(t.record.installedAt):NaN;return!Number.isNaN(n)&&!Number.isNaN(r)&&n!==r?r-n:e.record.spec.localeCompare(t.record.spec)}),e},[j,s,ie,m,u]),oe=g===`installed`?N.length:k.data?.total??0,se={showCatalog:g===`all`&&k.isLoading&&!k.data,showInstalled:g===`installed`&&D.isLoading&&!D.data},P=se.showCatalog||se.showInstalled,le=(0,K.useMemo)(()=>g===`installed`?D.isLoading&&!D.data?n(`loading`):`${N.length} ${n(d.installedCountSuffix)}`:k.data?`${M.length} / ${oe}`:n(`loading`),[g,D.data,D.isLoading,N.length,k.data,M.length,oe,d.installedCountSuffix]),I={installingSpecs:b},pe={actionsByTarget:w},L=Pr({items:M,installedRecordLookup:ae,scene:O,forcedType:t,typeFilter:s,scope:g,searchText:f,query:m,showListSkeleton:P,hasCatalogError:k.isError}),me=async e=>{let t=e.install.spec;if(!b.has(t)){C(e=>{let n=new Set(e);return n.add(t),n});try{await ee.mutateAsync({type:e.type,spec:t,kind:e.install.kind,skill:e.slug,installPath:`skills/${e.slug}`})}catch{}finally{C(e=>{if(!e.has(t))return e;let n=new Set(e);return n.delete(t),n})}}},he=async(e,t)=>{let r=e===`update`?t.catalogSlug||t.id||t.spec:t.id||t.spec;if(r&&!w.has(r)&&!(e===`uninstall`&&!await ne({title:`${n(`marketplaceUninstallTitle`)} ${r}?`,description:n(`marketplaceUninstallDescription`),confirmLabel:n(`marketplaceUninstall`),variant:`destructive`}))){T(t=>{let n=new Map(t);return n.set(r,e),n});try{await te.mutateAsync({type:t.type,action:e,id:r,spec:t.spec})}finally{T(e=>{if(!e.has(r))return e;let t=new Map(e);return t.delete(r),t})}}},ge=async(e,t)=>{let r=e?.name??t?.label??t?.id??t?.spec??n(`marketplaceUnknownItem`),i=e?`marketplace:${e.type}:${e.slug}`:`marketplace:${t?.type??`unknown`}:${t?.id??t?.spec??r}`,a={title:r,kind:`content`,dedupeKey:i},s={...a,activate:!1};if(!e){let e=Z({title:r,typeLabel:n(`marketplaceTypeSkill`),spec:t?.spec??`-`,summary:n(`marketplaceInstalledLocalSummary`),metadataRaw:JSON.stringify(t??{},null,2),contentRaw:`-`});o.open(e,a);return}let c=E.current.seq+1;E.current.seq=c,E.current.byKey.set(i,c);let l=F(e.summaryI18n,e.summary,u),d={typeLabel:n(`marketplaceTypeSkill`),loadContent:()=>S(e.slug),fallbackContent:n(`marketplaceOperationFailed`),defaultContent:void 0};o.open(Z({title:r,typeLabel:d.typeLabel,spec:e.install.spec,loading:!0}),a);try{let t=await d.loadContent();if(E.current.byKey.get(i)!==c)return;let n=Z({title:r,typeLabel:d.typeLabel,spec:e.install.spec,summary:l,metadataRaw:t.metadataRaw,contentRaw:t.bodyRaw||t.raw||d.defaultContent,sourceUrl:t.sourceUrl,sourceLabel:`Source (${t.source})`,tags:e.tags,author:e.author});o.open(n,s)}catch(t){if(E.current.byKey.get(i)!==c)return;let n=Z({title:r,typeLabel:d.typeLabel,spec:e.install.spec,summary:l,metadataRaw:JSON.stringify({error:t instanceof Error?t.message:String(t)},null,2),contentRaw:d.fallbackContent});o.open(n,s)}};return(0,q.jsxs)(x,{className:`flex h-full min-h-0 flex-col pb-0`,children:[!L.isSceneRoute&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Ht,{tabs:[{id:`all`,label:n(d.tabMarketplace)},{id:`installed`,label:n(d.tabInstalled),count:D.data?.total??0}],activeTab:g,onChange:e=>_(e),className:`mb-3`}),(0,q.jsx)(ce,{scope:g,searchText:f,searchPlaceholder:n(d.searchPlaceholder),sort:v,onSearchTextChange:p,onSortChange:y})]}),(0,q.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:[!L.isSceneRoute&&!L.showShelves&&!P&&(0,q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,q.jsx)(`h3`,{className:`text-[14px] font-semibold text-gray-900`,children:g===`installed`?n(d.sectionInstalled):a.startsWith(`zh`)?`全部技能`:`All Skills`}),(0,q.jsx)(`span`,{className:`text-[12px] text-gray-500`,children:le})]}),g===`all`&&k.isError&&(0,q.jsxs)(`div`,{className:`rounded-xl border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700`,children:[n(d.errorLoadData),`: `,k.error.message]}),g===`installed`&&D.isError&&(0,q.jsxs)(`div`,{className:`rounded-xl border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700`,children:[n(d.errorLoadInstalled),`: `,D.error.message]}),(0,q.jsxs)(`div`,{ref:A.containerRef,className:`min-h-0 flex-1 overflow-y-auto custom-scrollbar pr-1`,"aria-busy":P||k.isFetchingNextPage,children:[L.isSceneRoute&&L.selectedScene&&(0,q.jsx)(Tr,{scene:L.selectedScene,entries:L.sceneEntries,isLoading:P,language:a,localeFallbacks:u,installState:I,onBack:()=>r(L.backPath),onOpen:e=>void ge(e.item,e.record),onInstall:me}),L.showShelves&&(0,q.jsx)(Sr,{entries:L.entries,scenes:L.scenes,isScenesLoading:L.isScenesLoading,isItemsLoading:P,language:a,installState:I,onOpen:e=>void ge(e.item,e.record),onInstall:me,onOpenScene:e=>r(`${L.pathPrefix}/${e}`)}),!L.isSceneRoute&&(0,q.jsx)(dr,{scope:g,title:g===`installed`?n(d.sectionInstalled):a.startsWith(`zh`)?`全部技能`:`All Skills`,summary:le,showTitle:L.showShelves,showListSkeleton:P,skeletonCardCount:Ir,allItems:M,installedEntries:N,installedRecordLookup:ae,language:a,installState:I,manageState:pe,onOpen:(e,t)=>void ge(e,t),onInstall:me,onManage:he}),g===`all`&&!L.isSceneRoute&&!P&&!k.isError&&M.length===0&&(0,q.jsx)(`div`,{className:`py-8 text-center text-[13px] text-gray-500`,children:n(d.emptyData)}),g===`installed`&&!L.isSceneRoute&&!P&&!D.isError&&N.length===0&&(0,q.jsx)(`div`,{className:`py-8 text-center text-[13px] text-gray-500`,children:n(d.emptyInstalled)}),g===`all`&&!P&&!k.isError&&(0,q.jsx)(de,{hasMore:!!k.hasNextPage,loading:k.isFetchingNextPage,sentinelRef:A.sentinelRef})]})]}),(0,q.jsx)(re,{})]})}function zr(e){let{view:t,routeSessionKey:n,selectedSessionKey:r,setSelectedSessionKey:i,selectedSessionKeyRef:a,resetStreamState:o}=e;(0,K.useEffect)(()=>{if(t===`chat`){if(n){r!==n&&i(n);return}r!==null&&(i(null),o())}},[o,n,r,i,t]),(0,K.useEffect)(()=>{a.current=r},[r,a])}function Br({view:e,confirmDialog:t}){let{isMobile:n}=Re();return(0,q.jsxs)(`div`,{className:`h-full flex`,children:[n?null:(0,q.jsx)(dt,{}),e===`chat`?n?(0,q.jsx)(Pt,{}):(0,q.jsx)(xt,{}):(0,q.jsx)(`section`,{className:`flex-1 min-h-0 overflow-hidden bg-gradient-to-b from-gray-50/60 to-white`,children:e===`cron`?(0,q.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,q.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1120px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,q.jsx)(wn,{})})}):e===`agents`?(0,q.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,q.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1180px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,q.jsx)(yn,{})})}):(0,q.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,q.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full max-w-[min(1120px,100%)] flex-col px-4 py-4 sm:px-6 sm:py-5`,children:(0,q.jsx)(Rr,{forcedType:`skills`})})})}),t]})}function Vr(e,t){return e.filter(e=>it(e,t))}function Hr(e){let{config:t,providersView:n,templatesView:r}=e;return(0,K.useMemo)(()=>{let e=Gt({providersView:n,templatesView:r,config:t,onlyConfigured:!0}),i=new Set,a=[];for(let t of e)for(let e of t.models){let n=Kt(t.prefix,e);!n||i.has(n)||(i.add(n),a.push({value:n,modelLabel:e,providerLabel:t.displayName,thinkingCapability:Wt(t.modelThinking,e,t.aliases)}))}return a.sort((e,t)=>{let n=e.providerLabel.localeCompare(t.providerLabel);return n===0?e.modelLabel.localeCompare(t.modelLabel):n})},[t,n,r])}function Ur(e){let{sessions:t,sessionKey:n,sessionType:r}=e;return{recentSessionPreferredModel:(0,K.useMemo)(()=>Tt({sessions:t,selectedSessionKey:n??``,sessionType:r,readPreference:e=>e.preferredModel?.trim()||void 0}),[n,r,t]),recentSessionPreferredThinking:(0,K.useMemo)(()=>Tt({sessions:t,selectedSessionKey:n??``,sessionType:r,readPreference:e=>e.preferredThinking??void 0}),[n,r,t])}}function Wr(e){let{currentSelectedModel:t,modelOptions:n}=e,r=(0,K.useMemo)(()=>n.find(e=>e.value===t),[t,n]);return{supportedThinkingLevels:(0,K.useMemo)(()=>r?.thinkingCapability?.supported??[],[r?.thinkingCapability?.supported]),defaultThinkingLevel:(0,K.useMemo)(()=>r?.thinkingCapability?.default??null,[r?.thinkingCapability?.default])}}function Gr(e){let{modelOptions:t,supportedModels:n}=e;if(!n||n.length===0)return t;let r=new Set(n),i=t.filter(e=>r.has(e.value));return i.length>0?i:t}function Kr(e){let{currentSelectedModel:t,pendingSessionType:n,projectRootOverride:r,query:i,sessionKey:a,setPendingSessionType:o,setSelectedModel:s,setSelectedThinkingLevel:c}=e,l=st(),u=It(),d=St(),f=Nt({limit:200}),p=Mt(),m=Ot({sessionId:a?.trim()||`draft-session`,...Object.prototype.hasOwnProperty.call(e,`projectRootOverride`)?{projectRoot:r??null}:{}}),h=(l.isFetched||l.isSuccess)&&(u.isFetched||u.isSuccess)&&(d.isFetched||d.isSuccess),g=Hr({config:l.data,providersView:u.data,templatesView:d.data}),_=(0,K.useMemo)(()=>f.data?.sessions??[],[f.data?.sessions]),v=(0,K.useMemo)(()=>ze(_),[_]),y=(0,K.useMemo)(()=>Vr(v,i),[v,i]),b=(0,K.useMemo)(()=>v.find(e=>e.key===a)??null,[v,a]),x=(0,K.useMemo)(()=>m.data?.records??[],[m.data?.records]),S=nt({selectedSession:b,pendingSessionType:n,setPendingSessionType:o,sessionTypesData:p.data}),C=(0,K.useMemo)(()=>Gr({modelOptions:g,supportedModels:S.selectedSessionTypeOption?.supportedModels}),[g,S.selectedSessionTypeOption?.supportedModels]),{recentSessionPreferredModel:w,recentSessionPreferredThinking:T}=Ur({sessions:v,sessionKey:a,sessionType:S.selectedSessionType}),{supportedThinkingLevels:E,defaultThinkingLevel:D}=Wr({currentSelectedModel:t,modelOptions:C});return jt({modelOptions:C,selectedSessionKey:a??``,selectedSessionExists:!!b,selectedSessionPreferredModel:b?.preferredModel,fallbackPreferredModel:S.selectedSessionTypeOption?.recommendedModel??w,defaultModel:S.selectedSessionTypeOption?.recommendedModel??l.data?.agents.defaults.model,setSelectedModel:s}),_t({supportedThinkingLevels:E,selectedSessionKey:a??``,selectedSessionExists:!!b,selectedSessionPreferredThinking:b?.preferredThinking??null,fallbackPreferredThinking:T??null,defaultThinkingLevel:D,setSelectedThinkingLevel:c}),{configQuery:l,providersQuery:u,templatesQuery:d,sessionsQuery:f,sessionTypesQuery:p,sessionSkillsQuery:m,isProviderStateResolved:h,modelOptions:C,sessionSummaries:_,sessions:y,skillRecords:x,selectedSession:b,...S}}function qr(e){return e.parentSessionKey?e.sessionSummaries.map(Ze).filter(t=>t.parentSessionId===e.parentSessionKey).sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)).map(e=>({sessionKey:e.key,parentSessionKey:e.parentSessionId??null,label:e.label??null,agentId:e.agentId??null})):[]}function Jr(e){let{availableAgents:t,parentSessionId:n,selectedAgentId:r,selectedSession:i,selectedSessionType:a,sessionKey:o,sessionSummaries:s,sessionTypeOptions:c}=e,l=i?Fe(i):void 0,u=i?.agentId??r,d=t.find(e=>e.id===u)??null,f=(0,K.useMemo)(()=>{if(!n)return null;let e=s.find(e=>e.sessionId===n)??null;return e?Ze(e):null},[n,s]),p=c.find(e=>e.value===a)??null;return{currentSessionDisplayName:l,currentAgentId:u,currentAgent:d,parentSession:f,currentSessionTypeLabel:p?.label??W(a),currentSessionTypeIcon:p?.icon??null,currentChildSessionTabs:(0,K.useMemo)(()=>qr({parentSessionKey:o,sessionSummaries:s}),[o,s])}}function Yr(e){(0,K.useEffect)(()=>{e.presenter.chatInputManager.syncSnapshot({isProviderStateResolved:e.isProviderStateResolved,defaultSessionType:e.defaultSessionType,canStopGeneration:e.canStopCurrentRun,stopDisabledReason:e.stopDisabledReason,stopSupported:!0,stopReason:void 0,sendError:e.lastSendError,isSending:e.isSending,modelOptions:e.modelOptions,sessionTypeOptions:e.sessionTypeOptions,selectedSessionType:e.selectedSessionType,canEditSessionType:e.canEditSessionType,sessionTypeUnavailable:e.sessionTypeUnavailable,skillRecords:e.skillRecords,isSkillsLoading:e.isSkillsLoading}),e.presenter.chatThreadManager.syncSnapshot({isProviderStateResolved:e.isProviderStateResolved,modelOptions:e.modelOptions,sessionTypeUnavailable:e.sessionTypeUnavailable,sessionTypeUnavailableMessage:e.sessionTypeUnavailableMessage,sessionTypeLabel:e.currentSessionTypeLabel,sessionTypeIcon:e.currentSessionTypeIcon,sessionKey:e.sessionKey??null,agentId:e.currentAgentId,agentDisplayName:e.currentAgent?.displayName??null,agentAvatarUrl:e.currentAgent?.avatarUrl??null,availableAgents:e.availableAgents,sessionDisplayName:e.currentSessionDisplayName,sessionProjectRoot:e.effectiveSessionProjectRoot,sessionWorkingDir:e.effectiveSessionWorkingDir,sessionProjectName:e.effectiveSessionProjectName,canDeleteSession:!!e.selectedSession,threadRef:e.threadRef,isHistoryLoading:e.agent.isHydrating,messages:e.agent.visibleMessages,isSending:e.isSending,isAwaitingAssistantOutput:e.isAwaitingAssistantOutput,contextWindow:Be(e.agent.snapshot.contextWindow),parentSessionKey:e.parentSession?.key??null,parentSessionLabel:e.parentSession?Fe(e.parentSession):null,childSessionTabs:e.childSessionTabs})},[e])}function Xr(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function $(e,t){return e?Object.fromEntries(t.map(t=>[t,e])):{}}function Zr(e){let t=Ne(e.projectRoot),n={...$(e.model?.trim(),[`model`,`preferred_model`]),...$(e.thinkingLevel?.trim(),[`thinkingEffort`,`thinking`,`preferred_thinking`]),...$(e.sessionType?.trim(),[`agentRuntimeId`,`session_type`,`runtime`]),...$(e.agentId?.trim(),[`agentId`,`agent_id`]),...$(t??void 0,[`projectRoot`,`project_root`])},r=Xr(e.requestedSkills);r.length>0&&(n.requested_skill_refs=r);let i=e.composerNodes?Ye(e.composerNodes):[];return i.length>0&&(n[vt]=i),n}function Qr(e){let{pendingProjectRoot:t,pendingProjectRootSessionKey:n,sessionKey:r,selectedSessionProjectRoot:i}=e;return t!==null&&n!==null&&r===n&&(i??null)===t}function $r(e){let t=He(e=>e.snapshot.query),n=He(e=>e.snapshot.selectedSessionKey),r=He(e=>e.snapshot.selectedAgentId),i=V(e=>e.snapshot.pendingSessionType),a=V(e=>e.snapshot.pendingProjectRoot),o=V(e=>e.snapshot.pendingProjectRootSessionKey),u=V(e=>e.snapshot.selectedModel),d=se(),f=Xe(d),p=Le(),{confirm:m,ConfirmDialog:h}=gt(),g=s(),_=c(),{sessionId:v}=l(),y=(0,K.useRef)(null),b=(0,K.useRef)(n),x=(0,K.useMemo)(()=>Dt(v),[v]),S=x??void 0,C=a!==null&&(!S||o===S),w=Kr({query:t,sessionKey:S??null,projectRootOverride:C?a:void 0,currentSelectedModel:u,pendingSessionType:i,setPendingSessionType:e.chatInputManager.setPendingSessionType,setSelectedModel:e.chatInputManager.setSelectedModel,setSelectedThinkingLevel:e.chatInputManager.setSelectedThinkingLevel});return{presenter:e,selectedSessionKey:n,selectedAgentId:r,pendingProjectRoot:a,pendingProjectRootSessionKey:o,systemStatus:d,isRuntimeBlocked:f,agentsQuery:p,confirm:m,ConfirmDialog:h,location:g,navigate:_,threadRef:y,selectedSessionKeyRef:b,routeSessionKey:x,sessionKey:S,hasSessionProjectRootOverride:C,agent:ct(S),...w}}function ei(e){let t=$r(e),{agent:n,agentsQuery:r,hasSessionProjectRootOverride:i,pendingProjectRoot:a,isRuntimeBlocked:o,systemStatus:s,selectedAgentId:c,selectedSession:l,selectedSessionType:u,sessionKey:d,sessionSummaries:f,sessionTypeOptions:p}=t,m=i?a:l?.projectRoot??null,h=l?.workingDir??m,g=i?bt(m):l?.projectName??bt(m),_=n.hydrateError?.message??n.snapshot.error?.message??null,v=s.phase===`ready`&&ht(_)?null:_,y=(r.data?.agents?.length??0)>0?r.data?.agents??[]:[{id:l?.agentId??c}],b=Jr({sessionKey:d??null,selectedSession:l,selectedAgentId:c,availableAgents:y,parentSessionId:l?.parentSessionId??null,sessionSummaries:f,selectedSessionType:u,sessionTypeOptions:p}),x=n.isRunning||l?.status===`running`;return{...t,availableAgents:y,effectiveSessionProjectRoot:m,effectiveSessionWorkingDir:h,effectiveSessionProjectName:g,isSending:n.isSending||x,isAwaitingAssistantOutput:x,canStopCurrentRun:x,stopDisabledReason:x?null:`__preparing__`,lastSendError:o?null:s.phase===`ready`?v:$e({message:v,status:s}),...b}}function ti(e){let{agent:t,pendingProjectRoot:n,pendingProjectRootSessionKey:r,presenter:i,selectedSession:a,selectedSessionKeyRef:o,sessionKey:s}=e;(0,K.useEffect)(()=>{i.chatStreamActionsManager.bind({sendMessage:async e=>{if((e.sessionKey??null)!==(s??null))return;let o=Zr({agentId:e.agentId,model:e.model,thinkingLevel:e.thinkingLevel,sessionType:e.sessionType,projectRoot:!e.sessionKey||e.sessionKey===r?n:a?.projectRoot??null,requestedSkills:e.requestedSkills,composerNodes:e.composerNodes}),c=qe({sessionId:e.sessionKey,text:e.message,attachments:e.attachments,parts:e.parts,metadata:o});if(c)try{let n=await t.send(c);!e.sessionKey&&n?.sessionId&&i.chatSessionListManager.materializeRootSessionRoute(n.sessionId)}catch(t){throw e.restoreDraftOnError&&(e.composerNodes&&e.composerNodes.length>0?i.chatInputManager.restoreComposerState?.(e.composerNodes,e.attachments??[]):i.chatInputManager.setDraft(t=>t.trim().length===0?e.message:t)),t}},stopCurrentRun:async()=>{await t.abort()},resumeRun:async e=>{e.sessionKey===s&&await t.streamRun()},resetStreamState:()=>{o.current=null},applyHistoryMessages:()=>{}})},[t,n,r,i,a?.projectRoot,o,s])}function ni(e){let{pendingProjectRoot:t,pendingProjectRootSessionKey:n,selectedSession:r}=e;(0,K.useEffect)(()=>{!r||!Qr({pendingProjectRoot:t,pendingProjectRootSessionKey:n,sessionKey:r.key,selectedSessionProjectRoot:r.projectRoot??null})||V.getState().setSnapshot({pendingProjectRoot:null,pendingProjectRootSessionKey:null})},[t,n,r])}function ri(e){let{confirm:t,location:n,navigate:r,presenter:i}=e;(0,K.useEffect)(()=>{i.chatUiManager.syncState({pathname:n.pathname}),i.chatUiManager.bindActions({navigate:r,confirm:t})},[t,n.pathname,r,i])}function ii(e){let{presenter:t,selectedAgentId:n,selectedSession:r}=e;(0,K.useEffect)(()=>{!r?.agentId||n===r.agentId||t.chatSessionListManager.setSelectedAgentId(r.agentId)},[t,n,r?.agentId])}function ai(e){let{agent:t,presenter:n,routeSessionKey:r}=e,i=t.snapshot.activeRun?.sessionId??t.visibleMessages.find(e=>e.sessionId.trim())?.sessionId??null;(0,K.useEffect)(()=>{r||!i||n.chatSessionListManager.materializeRootSessionRoute(i)},[i,n,r])}function oi({view:e}){let[t]=(0,K.useState)(()=>new lt),n=ei(t);return ti(n),ni(n),ri(n),ii(n),ai(n),zr({view:e,routeSessionKey:n.routeSessionKey,selectedSessionKey:n.selectedSessionKey,setSelectedSessionKey:t.chatSessionListManager.setSelectedSessionKey,selectedSessionKeyRef:n.selectedSessionKeyRef,resetStreamState:t.chatStreamActionsManager.resetStreamState}),Yr({presenter:t,isProviderStateResolved:n.isProviderStateResolved,defaultSessionType:n.defaultSessionType,canStopCurrentRun:n.canStopCurrentRun,stopDisabledReason:n.stopDisabledReason,lastSendError:n.lastSendError,isSending:n.isSending,modelOptions:n.modelOptions,sessionTypeOptions:n.sessionTypeOptions,selectedSessionType:n.selectedSessionType,canEditSessionType:n.canEditSessionType,sessionTypeUnavailable:n.sessionTypeUnavailable,skillRecords:n.skillRecords,isSkillsLoading:n.sessionSkillsQuery.isLoading,sessionTypeUnavailableMessage:n.sessionTypeUnavailableMessage,currentSessionTypeLabel:n.currentSessionTypeLabel,currentSessionTypeIcon:n.currentSessionTypeIcon,sessionKey:n.sessionKey,currentAgentId:n.currentAgentId,currentAgent:n.currentAgent,availableAgents:n.availableAgents,currentSessionDisplayName:n.currentSessionDisplayName,effectiveSessionProjectRoot:n.effectiveSessionProjectRoot,effectiveSessionWorkingDir:n.effectiveSessionWorkingDir,effectiveSessionProjectName:n.effectiveSessionProjectName,selectedSession:n.selectedSession,threadRef:n.threadRef,agent:n.agent,isAwaitingAssistantOutput:n.isAwaitingAssistantOutput,parentSession:n.parentSession,childSessionTabs:n.currentChildSessionTabs}),(0,q.jsx)(tt,{presenter:t,children:(0,q.jsx)(Br,{view:e,confirmDialog:(0,q.jsx)(n.ConfirmDialog,{})})})}function si({view:e}){return(0,q.jsx)(oi,{view:e})}export{si as ChatPage};
|
package/ui-dist/assets/{desktop-update-config-CLXdVz9r.js → desktop-update-config-DOi5R1fX.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as e,i as t,m as n,n as r}from"./react-BVjl1ZaK.js";import{At as i,Dt as a,Et as o,Ft as s,Mt as c,Nt as l,Ot as u,gt as d,ht as f,jt as p,kt as m,mt as h}from"./api-DmxQnm30.js";import{t as g}from"./external-link-BLjo8z2a.js";import{t as _}from"./refresh-cw-DFR87zei.js";import{t as v}from"./rotate-cw-DMBnsYKm.js";import{J as y,K as b,Pt as x,X as S,Y as C,q as w}from"./index-
|
|
1
|
+
import{d as e,i as t,m as n,n as r}from"./react-BVjl1ZaK.js";import{At as i,Dt as a,Et as o,Ft as s,Mt as c,Nt as l,Ot as u,gt as d,ht as f,jt as p,kt as m,mt as h}from"./api-DmxQnm30.js";import{t as g}from"./external-link-BLjo8z2a.js";import{t as _}from"./refresh-cw-DFR87zei.js";import{t as v}from"./rotate-cw-DMBnsYKm.js";import{J as y,K as b,Pt as x,X as S,Y as C,q as w}from"./index-ZDJP_uJc.js";var T=n(),E={checking:`desktopUpdatesStatusChecking`,"update-available":`desktopUpdatesStatusAvailable`,downloading:`desktopUpdatesStatusDownloading`,downloaded:`desktopUpdatesStatusDownloaded`,"up-to-date":`desktopUpdatesStatusUpToDate`,blocked:`desktopUpdatesStatusBlocked`,failed:`desktopUpdatesStatusFailed`};function D({status:t}){return(0,T.jsx)(`span`,{className:e(`inline-flex rounded-full px-3 py-1 text-xs font-medium ring-1`,L(t)),children:I(t)})}function O({label:e,value:t}){return(0,T.jsxs)(`div`,{className:`rounded-xl border border-gray-200 bg-gray-50/60 p-4`,children:[(0,T.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-[0.08em] text-gray-500`,children:e}),(0,T.jsx)(`p`,{className:`mt-2 text-base font-semibold text-gray-900`,children:t})]})}function k({snapshot:e}){if(e.status!==`downloading`)return null;let n=e.progress?.percent,r=n==null?t(`desktopUpdatesDownloadProgressUnknown`):t(`desktopUpdatesDownloadProgressPercent`).replace(`{percent}`,String(n)),i=N(e.progress?.downloadedBytes??0,e.progress?.totalBytes??null);return(0,T.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 p-4`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-amber-800`,children:r}),(0,T.jsx)(`p`,{className:`text-xs font-medium text-amber-700`,children:i})]}),(0,T.jsx)(`div`,{className:`mt-3 h-2 overflow-hidden rounded-full bg-amber-100`,children:(0,T.jsx)(`div`,{className:`h-full rounded-full bg-amber-500 transition-[width]`,style:{width:`${n??0}%`}})})]})}function A({label:e,help:t,checked:n,disabled:r,onCheckedChange:i}){return(0,T.jsxs)(`div`,{className:`flex items-start justify-between gap-4 rounded-xl border border-gray-200 p-4`,children:[(0,T.jsxs)(`div`,{className:`space-y-1`,children:[(0,T.jsx)(l,{children:e}),(0,T.jsx)(`p`,{className:`text-sm text-gray-500`,children:t})]}),(0,T.jsx)(h,{checked:n,disabled:r,onCheckedChange:i})]})}function j(e){return e?.trim()||`-`}function M(e){return e?r(e):`-`}function N(e,t){let n=P(e);return t&&t>0?`${n} / ${P(t)}`:n}function P(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n>=10||r===0?n.toFixed(0):n.toFixed(1)} ${t[r]}`}function F(e){return t(e===`beta`?`desktopUpdatesChannelBeta`:`desktopUpdatesChannelStable`)}function I(e){return t(E[e]??`desktopUpdatesStatusIdle`)}function L(e){return e===`downloaded`?`bg-emerald-50 text-emerald-700 ring-emerald-100`:e===`update-available`||e===`downloading`||e===`checking`?`bg-amber-50 text-amber-700 ring-amber-100`:e===`failed`||e===`blocked`?`bg-red-50 text-red-700 ring-red-100`:`bg-gray-100 text-gray-700 ring-gray-200`}function R(){return(0,T.jsxs)(c,{className:`space-y-6`,children:[(0,T.jsx)(p,{title:t(`runtimeUpdatesPageTitle`),description:t(`runtimeUpdatesPageDescription`)}),(0,T.jsxs)(o,{children:[(0,T.jsxs)(m,{children:[(0,T.jsx)(i,{children:t(`runtimeUpdatesUnavailableTitle`)}),(0,T.jsx)(u,{children:t(`runtimeUpdatesUnavailableDescription`)})]}),(0,T.jsx)(a,{children:(0,T.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`runtimeUpdatesUnavailableHint`)})})]})]})}function z(){let{supported:n,initialized:r,busyAction:h,snapshot:E}=d();if(!r)return(0,T.jsx)(`div`,{className:`p-8 text-gray-400`,children:t(`loading`)});if(!n||!E)return(0,T.jsx)(R,{});let N=h===`checking`,P=h===`downloading`,I=h===`applying`,L=h===`saving-preferences`,z=h===`switching-channel`,B=E.status===`update-available`&&!P&&!I,V=E.status===`downloaded`&&!I,H=[[t(`runtimeUpdatesHostVersion`),j(E.hostVersion)],[t(`desktopUpdatesCurrentBundleVersion`),j(E.currentVersion)],[t(`desktopUpdatesAvailableVersion`),j(E.availableVersion)],[t(`desktopUpdatesLastCheckedAt`),M(E.lastCheckedAt)],[t(`desktopUpdatesCurrentChannel`),F(E.channel)]];return(0,T.jsxs)(c,{className:`space-y-6`,children:[(0,T.jsx)(p,{title:t(`runtimeUpdatesPageTitle`),description:t(`runtimeUpdatesPageDescription`),actions:(0,T.jsxs)(s,{variant:`outline`,onClick:()=>void f.checkForUpdates(),disabled:N||P||I,children:[(0,T.jsx)(_,{className:e(`mr-2 h-4 w-4`,N&&`animate-spin`)}),t(`desktopUpdatesCheckNow`)]})}),(0,T.jsxs)(o,{children:[(0,T.jsxs)(m,{children:[(0,T.jsx)(i,{children:t(`desktopUpdatesOverviewTitle`)}),(0,T.jsx)(u,{children:t(`desktopUpdatesOverviewDescription`)})]}),(0,T.jsxs)(a,{className:`space-y-5`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,T.jsx)(`span`,{className:`text-sm font-medium text-gray-700`,children:t(`desktopUpdatesStatusLabel`)}),(0,T.jsx)(D,{status:E.status})]}),(0,T.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-5`,children:H.map(([e,t])=>(0,T.jsx)(O,{label:e,value:t},e))}),E.channel===`beta`?(0,T.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 p-4`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-amber-800`,children:t(`desktopUpdatesBetaBadgeTitle`)}),(0,T.jsx)(`p`,{className:`mt-1 text-sm text-amber-700`,children:t(`desktopUpdatesBetaBadgeDescription`)})]}):null,E.downloadedVersion?(0,T.jsxs)(`div`,{className:`rounded-2xl border border-emerald-200 bg-emerald-50/70 p-4`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-emerald-800`,children:t(`desktopUpdatesDownloadedBannerTitle`)}),(0,T.jsx)(`p`,{className:`mt-1 text-sm text-emerald-700`,children:t(`runtimeUpdatesDownloadedBannerDescription`).replace(`{version}`,E.downloadedVersion)})]}):null,(0,T.jsx)(k,{snapshot:E}),E.status===`blocked`?(0,T.jsxs)(`div`,{className:`rounded-2xl border border-red-200 bg-red-50/70 p-4`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-red-800`,children:t(`desktopUpdatesBlockedTitle`)}),(0,T.jsx)(`p`,{className:`mt-1 text-sm text-red-700`,children:E.errorMessage??t(`desktopUpdatesBlockedDescription`)}),E.recoveryCommand?(0,T.jsx)(`code`,{className:`mt-3 block rounded-lg bg-white/70 px-3 py-2 text-xs text-red-800`,children:E.recoveryCommand}):null]}):null,E.errorMessage&&E.status!==`blocked`?(0,T.jsx)(`div`,{className:`rounded-2xl border border-red-200 bg-red-50/70 p-4 text-sm text-red-700`,children:E.errorMessage}):null]})]}),(0,T.jsxs)(o,{children:[(0,T.jsxs)(m,{children:[(0,T.jsx)(i,{children:t(`desktopUpdatesPreferencesTitle`)}),(0,T.jsx)(u,{children:t(`desktopUpdatesPreferencesDescription`)})]}),(0,T.jsxs)(a,{className:`space-y-5`,children:[(0,T.jsx)(`div`,{className:`rounded-xl border border-gray-200 p-4`,children:(0,T.jsxs)(`div`,{className:`space-y-3`,children:[(0,T.jsxs)(`div`,{className:`space-y-1`,children:[(0,T.jsx)(l,{children:t(`desktopUpdatesReleaseChannel`)}),(0,T.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`desktopUpdatesReleaseChannelHelp`)})]}),(0,T.jsxs)(b,{value:E.channel,disabled:z||N||P||I,onValueChange:e=>void f.updateChannel(e),children:[(0,T.jsx)(C,{className:`w-full max-w-sm`,children:(0,T.jsx)(S,{placeholder:t(`desktopUpdatesReleaseChannel`)})}),(0,T.jsxs)(w,{children:[(0,T.jsx)(y,{value:`stable`,children:t(`desktopUpdatesChannelStable`)}),(0,T.jsx)(y,{value:`beta`,children:t(`desktopUpdatesChannelBeta`)})]})]}),(0,T.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`desktopUpdatesReleaseChannelDowngradeHint`)})]})}),(0,T.jsx)(A,{label:t(`desktopUpdatesAutomaticChecks`),help:t(`desktopUpdatesAutomaticChecksHelp`),checked:E.preferences.automaticChecks,disabled:L||z,onCheckedChange:e=>void f.updatePreferences({automaticChecks:e})}),(0,T.jsx)(A,{label:t(`desktopUpdatesAutoDownload`),help:t(`desktopUpdatesAutoDownloadHelp`),checked:E.preferences.autoDownload,disabled:L||z,onCheckedChange:e=>void f.updatePreferences({autoDownload:e})})]})]}),(0,T.jsxs)(o,{children:[(0,T.jsxs)(m,{children:[(0,T.jsx)(i,{children:t(`desktopUpdatesActionsTitle`)}),(0,T.jsx)(u,{children:t(`runtimeUpdatesActionsDescription`)})]}),(0,T.jsxs)(a,{className:`flex flex-wrap items-center gap-3`,children:[(0,T.jsxs)(s,{variant:`outline`,onClick:()=>void f.checkForUpdates(),disabled:N||P||I,children:[(0,T.jsx)(_,{className:e(`mr-2 h-4 w-4`,N&&`animate-spin`)}),t(`desktopUpdatesCheckNow`)]}),(0,T.jsxs)(s,{onClick:()=>void f.downloadUpdate(),disabled:!B,children:[(0,T.jsx)(x,{className:e(`mr-2 h-4 w-4`,P&&`animate-bounce`)}),t(`desktopUpdatesDownloadNow`)]}),(0,T.jsxs)(s,{variant:`secondary`,onClick:()=>void f.applyDownloadedUpdate(),disabled:!V,children:[(0,T.jsx)(v,{className:e(`mr-2 h-4 w-4`,I&&`animate-spin`)}),t(`runtimeUpdatesApplyNow`)]}),E.releaseNotesUrl?(0,T.jsxs)(s,{variant:`ghost`,onClick:()=>window.open(E.releaseNotesUrl??``,`_blank`,`noopener,noreferrer`),children:[(0,T.jsx)(g,{className:`mr-2 h-4 w-4`}),t(`desktopUpdatesReleaseNotes`)]}):null]})]})]})}export{z as DesktopUpdateConfig};
|