@nextclaw/ui 0.12.26 → 0.12.28
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/CHANGELOG.md +74 -0
- package/dist/assets/{channels-list-page-HgLgrEg4.js → channels-list-page-DkPvpAqc.js} +1 -1
- package/dist/assets/{chat-page-DAKMFDrS.js → chat-page-b7Zf32fF.js} +1 -1
- package/dist/assets/index-DmWo8dX2.css +1 -0
- package/dist/assets/{index-Cuwst6cc.js → index-DqJ3CYwi.js} +2 -2
- package/dist/assets/marketplace-page-BVqFjnEB.js +105 -0
- package/dist/assets/marketplace-page-DkQ2hTs1.js +1 -0
- package/dist/assets/{mcp-marketplace-page-DwnaLNTx.js → mcp-marketplace-page-BOYJO0kp.js} +1 -1
- package/dist/assets/mcp-marketplace-page-DSML7NN0.js +1 -0
- package/dist/assets/{model-config-L2l6YAlQ.js → model-config-Bg2yycmn.js} +1 -1
- package/dist/assets/{providers-list-DYAEunOp.js → providers-list-DC1q3fvC.js} +1 -1
- package/dist/assets/{runtime-config-page-BdeU8PEK.js → runtime-config-page-q-nC0C5i.js} +1 -1
- package/dist/assets/{search-config-CQUhd5RU.js → search-config-CcKHif8O.js} +1 -1
- package/dist/assets/{secrets-config-D-NWlW9q.js → secrets-config-DSg6O92a.js} +1 -1
- package/dist/assets/{use-infinite-scroll-loader-CFVdPpNv.js → use-infinite-scroll-loader-DF2e6nQ2.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +9 -9
- package/src/features/marketplace/components/curated-shelves/marketplace-curated-scene-route.test.tsx +54 -16
- package/src/features/marketplace/components/curated-shelves/marketplace-curated-shelves.tsx +96 -24
- package/src/features/marketplace/components/marketplace-page.test.tsx +4 -0
- package/src/features/marketplace/components/marketplace-page.tsx +16 -12
- package/src/features/marketplace/hooks/use-marketplace-curated-scene-route.ts +14 -5
- package/dist/assets/index-dlcqieQ0.css +0 -1
- package/dist/assets/marketplace-page-BeFbwxR-.js +0 -105
- package/dist/assets/marketplace-page-CR4xq-TM.js +0 -1
- package/dist/assets/mcp-marketplace-page-DlRrSCj3.js +0 -1
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import{_ as e,m as t,p as n,r,u as i}from"./i18n-D1144VAA.js";import{A as a,At as o,D as s,E as c,Gt as l,Ht as u,Jt as d,Kt as f,Lt as p,M as m,O as h,Rt as g,Ut as _,Vt as v,Wt as y,Xt as b,an as x,en as S,in as ee,j as te,k as ne,nn as C,qt as w,rn as T,tn as E,zt as D}from"./api-DGD9_Bg4.js";import{l as re,t as ie,u as ae}from"./cpu-DPPwMzoC.js";import{a as oe,c as se,i as O,l as ce,n as le,o as ue,s as k,t as de}from"./use-infinite-scroll-loader-DF2e6nQ2.js";import{t as A}from"./createLucideIcon-DzY6wN61.js";import{n as j}from"./search-CRtQwr-h.js";import{t as M}from"./download-CMM8po31.js";import{t as N}from"./sparkles-BmgOD4nY.js";import{i as fe}from"./doc-browser-context-FukQHvyo.js";import{n as pe}from"./doc-browser-CAhfnm0D.js";import{X as P,_ as F,g as I,h as me,u as L,v as R,y as z}from"./index-DqJ3CYwi.js";import{t as he}from"./tabs-custom-D48zdZoc.js";function ge(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function B(e,t,n){let r=e.slice(0);return r[t]=n,r}var V=class extends x{#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,E.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||!ee(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(ge(e,n).forEach(e=>{e.destroy()}),ge(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=T(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 S(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#p(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=B(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)&&E.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},H=e(t(),1);function _e({queries:e,...t},n){let r=b(n),i=d(),a=w(),o=H.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{v(e),y(e,a,r.getQueryCache().get(e.queryHash))}),f(a);let[s]=H.useState(()=>new V(r,o,t)),[c,p,m]=s.getOptimisticResult(o,t.combine),h=!i&&t.subscribed!==!1;H.useSyncExternalStore(H.useCallback(e=>h?s.subscribe(E.batchCalls(e)):C,[s,h]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),H.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let g=c.some((e,t)=>_(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&_(n,e)?u(n,new S(r,n),a):[]}):[];if(g.length>0)throw Promise.all(g);let x=c.find((e,t)=>{let n=o[t];return n&&l({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(x?.error)throw x.error;return p(m())}var U=A(`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`}]]),ve=A(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ye=A(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),be=A(`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`}]]),xe=A(`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`}]]),Se=A(`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`}]]),Ce=A(`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`}]]),we=A(`PowerOff`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Te=A(`Power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Ee=A(`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`}]]);function W(e){return Array.from(new Set(e.map(e=>e.spec).filter(Boolean)))}function De(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 G(e,t){return!!(t.spec&&e.spec===t.spec||t.id&&e.id===t.id)}function Oe(e,t){return t??{type:e,total:0,specs:[],records:[]}}function ke(e){let t=Oe(e.result.type,e.view),n=De(e),r=t.records.findIndex(e=>G(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:W(i),total:i.length}}function Ae(e){let t=Oe(e.result.type,e.view);if(e.result.action===`uninstall`||e.result.action===`remove`){let n=t.records.filter(t=>!G(t,{id:e.result.id,spec:e.request.spec}));return{...t,records:n,specs:W(n),total:n.length}}let n=t.records.map(t=>G(t,{id:e.result.id,spec:e.request.spec})?e.result.action===`disable`?{...t,enabled:!1,runtimeStatus:`disabled`}:{...t,enabled:!0,runtimeStatus:`ready`}:t);return{...t,records:n,specs:W(n),total:n.length}}function je(e){let t=ce({queryKey:[`marketplace-items`,e],initialPageParam:1,queryFn:({pageParam:t})=>s({...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&&Me(r,e)?t:void 0},staleTime:15e3}),n=(0,H.useMemo)(()=>se(t.data),[t.data]);return{...t,data:n}}function Me(e,t){return e.q===t.q&&e.tag===t.tag&&e.scene===t.scene&&e.sort===t.sort&&e.pageSize===t.pageSize}function Ne(e=!0){return D({queryKey:[`marketplace-skill-scenes`],queryFn:a,enabled:e,staleTime:6e4})}function Pe(e,t=!0){let n=_e({queries:e.map(e=>({queryKey:[`marketplace-skill-scene-count`,e.scene],queryFn:()=>s({type:`skill`,scene:e.scene,pageSize:1}),enabled:t&&typeof e.count!=`number`,staleTime:6e4}))});return(0,H.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 Fe(e){return D({queryKey:[`marketplace-installed`,e],queryFn:()=>c(e),staleTime:1e4})}function Ie(){let e=b();return g({mutationFn:e=>te(e),onSuccess:(t,n)=>{e.setQueryData([`marketplace-installed`,t.type],e=>ke({view:e,request:n,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`}),t.type===`plugin`&&e.invalidateQueries({queryKey:[`ncp-session-types`]});let i=t.type===`plugin`?r(`marketplaceInstallSuccessPlugin`):r(`marketplaceInstallSuccessSkill`);p.success(t.message||i)},onError:e=>{p.error(e.message||r(`marketplaceInstallFailed`))}})}function Le(){let e=b();return g({mutationFn:e=>m(e),onSuccess:(t,n)=>{e.setQueryData([`marketplace-installed`,t.type],e=>Ae({view:e,request:n,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`}),t.type===`plugin`&&e.invalidateQueries({queryKey:[`ncp-session-types`]});let i=t.action===`enable`?r(`marketplaceEnableSuccess`):t.action===`disable`?r(`marketplaceDisableSuccess`):r(`marketplaceUninstallSuccess`);p.success(t.message||i)},onError:e=>{p.error(e.message||r(`marketplaceOperationFailed`))}})}function K(e){return(e??``).trim().toLowerCase()}function q(e,t){let n=K(t);return n.length>0?`${e}:${n}`:``}function Re(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=q(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function ze(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=q(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function J(e,t){let n=[e.install.spec,e.slug,e.id];for(let r of n){let n=q(e.type,r);if(!n)continue;let i=t.get(n);if(i)return i}}function Be(e,t){return t.get(q(e.type,e.spec))||t.get(q(e.type,e.id))||t.get(q(e.type,e.label))}function Ve(e,t,n,r){let i=K(n);if(!i)return!0;let a=O(t?.summaryI18n,t?.summary,r);return[e.id,e.spec,e.label,t?.name,t?.slug,t?.summary,a,...t?.tags??[]].map(e=>K(e)).filter(Boolean).some(e=>e.includes(i))}function Y(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function He(e){let t=e.replace(/\r\n/g,`
|
|
2
|
+
`).split(`
|
|
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
|
+
`).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 Ue(e){return/^(#{1,4})\s+/.test(e)||/^([-*])\s+/.test(e)||/^\d+\.\s+/.test(e)||/^>\s?/.test(e)||/^```/.test(e)}function We(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(`
|
|
5
|
+
`))}</code></pre></div>`,nextIndex:i+1}}function Ge(e,t){let n=Math.min(4,e[1]?.length??2);return{html:`<h${n}>${X(e[2]??``)}</h${n}>`,nextIndex:t+1}}function Ke(e,t,n){let r=[],i=t,a=n?/^\d+\.\s+/:/^[-*]\s+/;for(;i<e.length&&a.test(e[i]?.trim()??``);)r.push(`<li>${X((e[i]??``).trim().replace(a,``))}</li>`),i+=1;return{html:n?`<ol>${r.join(``)}</ol>`:`<ul>${r.join(``)}</ul>`,nextIndex:i}}function qe(e,t){let n=[],r=t;for(;r<e.length&&/^>\s?/.test(e[r]?.trim()??``);)n.push((e[r]??``).trim().replace(/^>\s?/,``)),r+=1;return{html:`<blockquote>${X(n.join(` `))}</blockquote>`,nextIndex:r}}function Je(e,t){let n=[],r=t;for(;r<e.length;){let t=e[r]?.trim()??``;if(!t||Ue(t))break;n.push(t),r+=1}return{html:`<p>${X(n.join(` `))}</p>`,nextIndex:r}}function Ye(e,t){let n=e[t]?.trim()??``,r=n.match(/^```(\S*)/);if(r)return We(e,t,r);let i=n.match(/^(#{1,4})\s+(.+)$/);return i?Ge(i,t):/^[-*]\s+/.test(n)?Ke(e,t,!1):/^\d+\.\s+/.test(n)?Ke(e,t,!0):/^>\s?/.test(n)?qe(e,t):Je(e,t)}function Xe(e){let t=He(e).replace(/\r\n/g,`
|
|
6
|
+
`).split(`
|
|
7
|
+
`),n=[],r=0;for(;r<t.length;){if(!(t[r]??``).trim()){r+=1;continue}let e=Ye(t,r);n.push(e.html),r=e.nextIndex}return n.join(``)}function Ze(e){return Array.isArray(e)?e.map(e=>Ze(e)).join(`, `):e&&typeof e==`object`?JSON.stringify(e):String(e??``)}function Qe(e){try{let t=JSON.parse(e);return!t||typeof t!=`object`||Array.isArray(t)?[]:Object.entries(t).map(([e,t])=>({key:e,value:Ze(t)})).filter(e=>e.value.trim().length>0)}catch{return[]}}function $e(e){return e.replace(/\r\n/g,`
|
|
8
|
+
`).split(`
|
|
9
|
+
`).map(e=>e.match(/^([A-Za-z0-9_.-]+):\s*(.+)$/)).filter(e=>!!e).map(e=>({key:e[1]??``,value:e[2]?.replace(/^["']|["']$/g,``)??``})).filter(e=>e.key&&e.value.trim().length>0)}function et(e){let t=Qe(e),n=t.length>0?t:$e(e);return n.length===0?`<pre class="code">${Y(e)}</pre>`:`<dl class="metadata-list">${n.map(e=>`<div><dt>${Y(e.key)}</dt><dd>${Y(e.value)}</dd></div>`).join(``)}</dl>`}function Z(e){let{title:t,typeLabel:n,spec:r,summary:i,description:a,metadataRaw:o,contentRaw:s,sourceUrl:c,sourceLabel:l,tags:u,author:d,loading:f}=e,p=o?.trim()||`-`,m=s?.trim()||`-`,h=i?.trim(),g=a?.trim(),_=!!g&&g!==h,v=et(p),y=Xe(m),b=`<!doctype html>
|
|
10
|
+
<html>
|
|
11
|
+
<head>
|
|
12
|
+
<meta charset="utf-8" />
|
|
13
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
14
|
+
<title>${Y(t)}</title>
|
|
15
|
+
<style>
|
|
16
|
+
:root { color-scheme: light; }
|
|
17
|
+
body { margin: 0; background: #f9f8f5; color: #2f2212; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
|
|
18
|
+
.wrap { max-width: 940px; margin: 0 auto; padding: 24px 20px 36px; }
|
|
19
|
+
.hero { border: 1px solid #f0e2c8; border-radius: 14px; background: linear-gradient(180deg, #fff9f1 0%, #ffffff 28%); padding: 18px; box-shadow: 0 1px 3px rgba(30, 20, 10, 0.05); }
|
|
20
|
+
.hero h1 { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: 0; }
|
|
21
|
+
.meta { margin-top: 7px; color: #78644d; font-size: 12px; overflow-wrap: anywhere; word-break: break-word; }
|
|
22
|
+
.summary { margin: 12px 0 0; font-size: 13px; line-height: 1.65; color: #5f5142; }
|
|
23
|
+
.grid { display: grid; grid-template-columns: minmax(220px, 0.42fr) minmax(0, 1fr); gap: 12px; margin-top: 12px; }
|
|
24
|
+
.card { border: 1px solid #eee3d1; background: #fffdf9; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 2px rgba(30, 20, 10, 0.035); }
|
|
25
|
+
.card h2 { margin: 0; padding: 11px 13px; font-size: 12px; font-weight: 650; color: #3f472f; border-bottom: 1px solid #f1e7d4; background: #fffaf2; }
|
|
26
|
+
.card .body { padding: 12px 13px; font-size: 12px; color: #4e463d; line-height: 1.65; }
|
|
27
|
+
.code { white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; line-height: 1.55; margin: 0; }
|
|
28
|
+
.metadata-list { margin: 0; }
|
|
29
|
+
.metadata-list div { display: grid; grid-template-columns: minmax(72px, 0.36fr) minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px solid #f2eadc; }
|
|
30
|
+
.metadata-list div:last-child { border-bottom: 0; }
|
|
31
|
+
.metadata-list dt { color: #7a5a24; font-weight: 650; overflow-wrap: anywhere; }
|
|
32
|
+
.metadata-list dd { margin: 0; color: #4e463d; overflow-wrap: anywhere; }
|
|
33
|
+
.markdown { font-size: 13px; line-height: 1.68; }
|
|
34
|
+
.markdown > *:first-child { margin-top: 0; }
|
|
35
|
+
.markdown > *:last-child { margin-bottom: 0; }
|
|
36
|
+
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { margin: 18px 0 8px; color: #2f2212; line-height: 1.25; letter-spacing: 0; }
|
|
37
|
+
.markdown h1 { font-size: 20px; }
|
|
38
|
+
.markdown h2 { font-size: 17px; }
|
|
39
|
+
.markdown h3 { font-size: 15px; }
|
|
40
|
+
.markdown h4 { font-size: 13px; }
|
|
41
|
+
.markdown p { margin: 10px 0; }
|
|
42
|
+
.markdown ul, .markdown ol { margin: 10px 0; padding-left: 20px; }
|
|
43
|
+
.markdown li { margin: 5px 0; }
|
|
44
|
+
.markdown blockquote { margin: 12px 0; padding: 8px 12px; border-left: 3px solid #d9b56f; border-radius: 8px; background: #fff7ea; color: #6d5841; }
|
|
45
|
+
.markdown code { border: 1px solid #eadcc6; border-radius: 5px; background: #fff7ea; padding: 1px 4px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: #6b4b16; }
|
|
46
|
+
.markdown a { color: #5f6b45; text-decoration: none; font-weight: 600; }
|
|
47
|
+
.markdown a:hover { text-decoration: underline; }
|
|
48
|
+
.code-block { position: relative; margin: 12px 0; overflow: hidden; border: 1px solid #eadcc6; border-radius: 10px; background: #2f2a24; }
|
|
49
|
+
.code-block pre { margin: 0; overflow-x: auto; padding: 13px; }
|
|
50
|
+
.code-block code { border: 0; border-radius: 0; background: transparent; padding: 0; color: #f7efe3; }
|
|
51
|
+
.code-language { position: absolute; right: 10px; top: 8px; color: #d8c3a0; font-size: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
|
|
52
|
+
.tags { margin-top: 10px; }
|
|
53
|
+
.tag { display: inline-block; margin: 0 6px 6px 0; padding: 4px 8px; border: 1px solid #ecd9b5; border-radius: 999px; background: #fff7ea; color: #7a5a24; font-size: 11px; }
|
|
54
|
+
.source { color: #5f6b45; text-decoration: none; overflow-wrap: anywhere; word-break: break-all; }
|
|
55
|
+
.source:hover { text-decoration: underline; }
|
|
56
|
+
.skeleton { display: block; border-radius: 8px; background: linear-gradient(90deg, #f0e6d6 0%, #fffaf2 42%, #f0e6d6 78%); background-size: 220% 100%; animation: shimmer 1.35s ease-in-out infinite; }
|
|
57
|
+
.detail-skeleton .hero { padding: 18px; }
|
|
58
|
+
.sk-title { width: 52%; height: 24px; }
|
|
59
|
+
.sk-meta { width: 78%; height: 12px; margin-top: 12px; }
|
|
60
|
+
.sk-line { height: 12px; margin-top: 12px; }
|
|
61
|
+
.sk-line.short { width: 62%; }
|
|
62
|
+
.sk-line.mid { width: 82%; }
|
|
63
|
+
.sk-body { height: 220px; margin: 13px; }
|
|
64
|
+
@keyframes shimmer { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
|
|
65
|
+
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }
|
|
66
|
+
</style>
|
|
67
|
+
</head>
|
|
68
|
+
<body>
|
|
69
|
+
<main class="wrap${f?` detail-skeleton`:``}"${f?` aria-busy="true"`:``}>
|
|
70
|
+
${f?`
|
|
71
|
+
<section class="hero">
|
|
72
|
+
<span class="skeleton sk-title"></span>
|
|
73
|
+
<span class="skeleton sk-meta"></span>
|
|
74
|
+
<span class="skeleton sk-line mid"></span>
|
|
75
|
+
<span class="skeleton sk-line"></span>
|
|
76
|
+
<span class="skeleton sk-line short"></span>
|
|
77
|
+
</section>
|
|
78
|
+
<section class="grid">
|
|
79
|
+
<article class="card"><span class="skeleton sk-body"></span></article>
|
|
80
|
+
<article class="card"><span class="skeleton sk-body"></span></article>
|
|
81
|
+
</section>
|
|
82
|
+
`:`
|
|
83
|
+
<section class="hero">
|
|
84
|
+
<h1>${Y(t)}</h1>
|
|
85
|
+
<div class="meta">${Y(n)} · ${Y(r)}${d?` · ${Y(d)}`:``}</div>
|
|
86
|
+
${h?`<p class="summary">${Y(h)}</p>`:``}
|
|
87
|
+
${_?`<p class="summary">${Y(g)}</p>`:``}
|
|
88
|
+
${u&&u.length>0?`<div class="tags">${u.map(e=>`<span class="tag">${Y(e)}</span>`).join(``)}</div>`:``}
|
|
89
|
+
${c?`<p class="meta" style="margin-top:12px;">${Y(l??`Source`)}: <a class="source" href="${Y(c)}" target="_blank" rel="noopener noreferrer">${Y(c)}</a></p>`:``}
|
|
90
|
+
</section>
|
|
91
|
+
|
|
92
|
+
<section class="grid">
|
|
93
|
+
<article class="card">
|
|
94
|
+
<h2>Metadata</h2>
|
|
95
|
+
<div class="body">${v}</div>
|
|
96
|
+
</article>
|
|
97
|
+
<article class="card">
|
|
98
|
+
<h2>Content</h2>
|
|
99
|
+
<div class="body markdown">${y}</div>
|
|
100
|
+
</article>
|
|
101
|
+
</section>
|
|
102
|
+
`}
|
|
103
|
+
</main>
|
|
104
|
+
</body>
|
|
105
|
+
</html>`;return`data:text/html;charset=utf-8,${encodeURIComponent(b)}`}var Q=n(),tt=[`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 nt(e){let{name:t,fallback:n,className:r}=e,a=t||n,o=a.substring(0,2).toUpperCase();return(0,Q.jsx)(`div`,{className:i(`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-sm font-semibold text-white`,rt(a),r),children:o})}function rt(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return tt[Math.abs(t)%tt.length]}function it({title:e,spec:t,summary:n}){return(0,Q.jsxs)(R,{delayDuration:400,children:[(0,Q.jsxs)(I,{children:[(0,Q.jsx)(z,{asChild:!0,children:(0,Q.jsx)(`div`,{className:`truncate text-[14px] font-semibold leading-tight text-gray-900`,children:e})}),(0,Q.jsx)(F,{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)(I,{children:[(0,Q.jsx)(z,{asChild:!0,children:(0,Q.jsx)(`span`,{className:`max-w-full truncate text-[11px] font-mono text-gray-400`,children:t})}),(0,Q.jsx)(F,{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 at(e){let{item:t,record:n,pluginRecord:a,isInstalling:o,isDisabled:s,canUninstall:c,busyAction:l,busyForRecord:u,language:d,onInstall:f,onManage:p}=e,m=!!(t&&!n||a||n&&c);return(0,Q.jsxs)(`div`,{className:i(`relative flex h-8 shrink-0 items-center justify-end`,n?`md:w-5`:`md:w-0`),children:[(0,Q.jsx)(`div`,{className:i(`hidden items-center justify-end transition-opacity duration-150 md:flex`,m&&`group-hover:opacity-0 group-focus-within:opacity-0`),children:n?(0,Q.jsx)(ot,{disabled:s,language:d}):null}),(0,Q.jsxs)(`div`,{className:i(`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:[t&&!n&&(0,Q.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),f(t)},disabled:o,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)(M,{className:`h-3.5 w-3.5`}),r(o?`marketplaceInstalling`:`marketplaceInstall`)]}),a&&(0,Q.jsxs)(`button`,{disabled:u,onClick:e=>{e.stopPropagation(),p(s?`enable`:`disable`,a)},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-600 transition-colors hover:border-gray-300 hover:bg-gray-50 disabled:opacity-50`,children:[s?(0,Q.jsx)(Te,{className:`h-3.5 w-3.5`}):(0,Q.jsx)(we,{className:`h-3.5 w-3.5`}),r(l&&l!==`uninstall`?l===`enable`?`marketplaceEnabling`:`marketplaceDisabling`:s?`marketplaceEnable`:`marketplaceDisable`)]}),n&&c&&(0,Q.jsxs)(`button`,{disabled:u,onClick:e=>{e.stopPropagation(),p(`uninstall`,n)},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)(P,{className:`h-3.5 w-3.5`}),r(l===`uninstall`?`marketplaceRemoving`:`marketplaceUninstall`)]})]})]})}function ot(e){let{disabled:t,language:n}=e,r=ct(t?{zh:`已禁用`,en:`Disabled`}:{zh:`已安装`,en:`Installed`},n);return(0,Q.jsx)(R,{delayDuration:300,children:(0,Q.jsxs)(I,{children:[(0,Q.jsx)(z,{asChild:!0,children:(0,Q.jsx)(`span`,{"aria-label":r,className:i(`inline-flex h-5 w-5 items-center justify-center`,t?`text-gray-400`:`text-emerald-700`),children:t?(0,Q.jsx)(we,{className:`h-4 w-4`}):(0,Q.jsx)(ve,{className:`h-4 w-4`})})}),(0,Q.jsx)(F,{className:`text-xs`,children:r})]})})}function st(e){let{item:t,record:n,language:i,installState:a,manageState:o,onOpen:s,onInstall:c,onManage:l}=e,u=le(i),d=n?.type===`plugin`?n:void 0,f=t?.name??n?.label??n?.id??n?.spec??r(`marketplaceUnknownItem`),p=O(t?.summaryI18n,t?.summary,u)||(n?r(`marketplaceInstalledLocalSummary`):``),m=t?.install.spec??n?.spec??``,h=n?.id||n?.spec,g=h?o.actionsByTarget.get(h):void 0,_=!!g,v=n?.type===`plugin`&&n.origin!==`bundled`||n?.type===`skill`&&n.source===`workspace`,y=n?n.enabled===!1||n.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)(nt,{name:f,fallback:m||r(`marketplaceTypeExtension`)}),(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col justify-center`,children:(0,Q.jsx)(it,{title:f,spec:m,summary:p})})]}),(0,Q.jsx)(at,{item:t,record:n,pluginRecord:d,isInstalling:x,isDisabled:y,canUninstall:v,busyAction:g,busyForRecord:_,language:i,onInstall:c,onManage:l})]})}function ct(e,t){return t.startsWith(`zh`)?e.zh:e.en}function lt(e){let{scope:t,title:n,summary:r,showTitle:a,showListSkeleton:o,skeletonCardCount:s,allItems:c,installedEntries:l,installedRecordLookup:u,language:d,installState:f,manageState:p,onOpen:m,onInstall:h,onManage:g}=e;return(0,Q.jsxs)(`section`,{className:i(`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:n}),(0,Q.jsx)(`span`,{className:`text-[12px] text-gray-500`,children:r})]}),(0,Q.jsxs)(`div`,{"data-testid":o?`marketplace-list-skeleton`:void 0,className:i(`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)(k,{count:s}),!o&&t===`all`&&c.map(e=>(0,Q.jsx)(st,{item:e,record:J(e,u),language:d,installState:f,manageState:p,onOpen:()=>m(e,J(e,u)),onInstall:h,onManage:g},e.id)),!o&&t===`installed`&&l.map(e=>(0,Q.jsx)(st,{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 ut(e){let{entry:t,language:n,localeFallbacks:a,installState:o,layout:s=`rail`,onOpen:c,onInstall:l}=e,{item:u,record:d}=t,f=O(u.summaryI18n,u.summary,a),p=u.install.spec,m=o.installingSpecs.has(p),h=!!d;return(0,Q.jsxs)(`article`,{onClick:()=>c(t),className:i(`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`,s===`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)(nt,{name:u.name,fallback:u.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:u.name}),(0,Q.jsx)(`div`,{className:`mt-0.5 truncate text-[11px] font-mono leading-tight text-gray-400`,children:dt(u)})]})]}),(0,Q.jsx)(`p`,{className:`line-clamp-2 text-[12px] leading-relaxed text-gray-500`,children:f}),(0,Q.jsx)(ft,{tags:u.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:pt(u.updatedAt)}),h?(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)(ve,{className:`h-3.5 w-3.5`}),mt({zh:`已安装`,en:`Installed`},n)]}):(0,Q.jsxs)(`button`,{type:`button`,disabled:m,onClick:e=>{e.stopPropagation(),l(u)},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)(M,{className:`h-3.5 w-3.5`}),r(m?`marketplaceInstalling`:`marketplaceInstall`)]})]})]})}function dt(e){return e.slug||e.install.spec}function ft({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 pt(e){return e.slice(0,10)||e}function mt(e,t){return t.startsWith(`zh`)?e.zh:e.en}var ht=[{scene:`development-debugging`,title:{zh:`开发与调试`,en:`Development`},summary:{zh:`代码审查、错误定位、架构分析与交付验证。`,en:`Review, debug, analyze, and verify delivery work.`},icon:Ee,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:U,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:Ce,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:xe,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:ie,tone:`violet`,span:`md:col-span-1`},{scene:`social-platforms`,title:{zh:`社交平台`,en:`Social`},summary:{zh:`处理发布、互动、检索和内容分发。`,en:`Handle posting, interaction, search, and distribution.`},icon:Se,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:N,tone:`teal`,span:`md:col-span-2`}],gt={icon:N,tone:`dark`,span:`md:col-span-2`},_t={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`}},vt=`grid grid-cols-[repeat(auto-fill,minmax(240px,320px))] justify-start gap-3`,yt=24;function bt(e){let{entries:t,scenes:n,isScenesLoading:r,isItemsLoading:i,language:a,installState:o,onOpen:s,onInstall:c,onOpenScene:l}=e,u=le(a),d=[...t].sort((e,t)=>Dt(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)(Et,{icon:be,title:$({zh:`场景`,en:`Scenes`},a),description:$({zh:`按使用场景浏览适合的技能组合。`,en:`Browse skills by how you plan to use them.`},a)}),r?(0,Q.jsx)(xt,{}):(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)(St,{scene:e,language:a,onSelect:l},e.scene))})]}),(i||d.length>0)&&(0,Q.jsx)(wt,{icon:ye,title:$({zh:`最近更新`,en:`Recently updated`},a),description:$({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 xt(){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:ht.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)(L,{className:`h-7 w-7 shrink-0 rounded-md`}),(0,Q.jsx)(L,{className:`h-3.5 min-w-0 flex-1`}),(0,Q.jsx)(L,{className:`h-3 w-8 shrink-0`})]}),(0,Q.jsx)(L,{className:`mt-2 h-3 w-4/5`})]},e.scene))})}function St(e){let{scene:t,language:n,onSelect:r}=e,a=Ot(t.scene),o=a.icon,s=_t[a.tone];return(0,Q.jsx)(`button`,{type:`button`,onClick:()=>r(t.scene),className:i(`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:i(`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:kt(t,a,n)}),typeof t.count==`number`&&(0,Q.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:jt(t.count,n)})]}),(0,Q.jsx)(`p`,{className:i(`mt-1 line-clamp-1 text-[11px] leading-relaxed`,s.text),children:At(t,a,n)})]})})}function Ct(e){let{scene:t,entries:n,isLoading:r,language:a,localeFallbacks:o,installState:s,onBack:c,onOpen:l,onInstall:u}=e,d=Ot(t.scene),f=d.icon,p=_t[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":$({zh:`返回`,en:`Back`},a),children:(0,Q.jsx)(j,{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:i(`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:kt(t,d,a)}),(0,Q.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:$(r?{zh:`加载中`,en:`Loading`}:{zh:`${n.length} 个技能`,en:`${n.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:At(t,d,a)})})]})]}),r?(0,Q.jsx)(`div`,{"data-testid":`marketplace-scene-skeleton`,className:i(vt,`min-h-0 flex-1 auto-rows-[166px] content-start`),children:(0,Q.jsx)(k,{count:yt})}):n.length>0?(0,Q.jsx)(`div`,{className:vt,children:n.map(e=>(0,Q.jsx)(ut,{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:$({zh:`这个模块暂无技能。`,en:`No skills in this module yet.`},a)})]})}function wt(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)(Et,{icon:t,title:n,description:r}),s?(0,Q.jsx)(Tt,{}):(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)(ut,{entry:e,language:a,localeFallbacks:o,installState:c,onOpen:l,onInstall:u},e.item.id))})]})}function Tt(){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)(L,{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)(L,{className:`h-3.5 w-32 max-w-full`}),(0,Q.jsx)(L,{className:`h-3 w-24 max-w-full`})]})]}),(0,Q.jsx)(L,{className:`h-3 w-full`}),(0,Q.jsx)(L,{className:`mt-1.5 h-3 w-4/5`}),(0,Q.jsx)(L,{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)(L,{className:`h-3 w-20`}),(0,Q.jsx)(L,{className:`h-7 w-16 rounded-md`})]})]},`marketplace-recent-skeleton-${t}`))})}function Et({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 Dt(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 $(e,t){return t.startsWith(`zh`)?e.zh:e.en}function Ot(e){return ht.find(t=>t.scene===e)??{scene:e,...gt}}function kt(e,t,n){return t.title?$(t.title,n):e.title}function At(e,t,n){return t.summary?$(t.summary,n):e.description??e.scene}function jt(e,t){return t.startsWith(`zh`)?`${e} 个技能`:`${e} skills`}function Mt(e){let{items:t,installedRecordLookup:n,scene:r,forcedType:i,typeFilter:a,scope:o,searchText:s,query:c,showListSkeleton:l,hasCatalogError:u}=e,d=Ne(a===`skill`),f=(0,H.useMemo)(()=>d.data?.scenes??[],[d.data?.scenes]),p=Pe(f,a===`skill`),m=(0,H.useMemo)(()=>f.map(e=>({...e,count:typeof e.count==`number`?e.count:p.get(e.scene)})),[p,f]),h=(0,H.useMemo)(()=>t.map(e=>({item:e,record:J(e,n)})),[t,n]),g=(0,H.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 Nt=20,Pt=36;function Ft(e){return e===`plugin`?{pageTitle:`marketplacePluginsPageTitle`,pageDescription:`marketplacePluginsPageDescription`,tabMarketplace:`marketplaceTabMarketplacePlugins`,tabInstalled:`marketplaceTabInstalledPlugins`,searchPlaceholder:`marketplaceSearchPlaceholderPlugins`,sectionCatalog:`marketplaceSectionPlugins`,sectionInstalled:`marketplaceSectionInstalledPlugins`,errorLoadData:`marketplaceErrorLoadingPluginsData`,errorLoadInstalled:`marketplaceErrorLoadingInstalledPlugins`,emptyData:`marketplaceNoPlugins`,emptyInstalled:`marketplaceNoInstalledPlugins`,installedCountSuffix:`marketplaceInstalledPluginsCountSuffix`}:{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 It(e={}){let{forcedType:t}=e,n=re(),i=ae(),{language:a}=pe(),s=fe(),c=(0,H.useMemo)(()=>t===`plugins`||t===`skills`?t:i.type===`plugins`||i.type===`skills`?i.type:null,[t,i.type]);(0,H.useEffect)(()=>{t||c||n(`/marketplace/plugins`,{replace:!0})},[t,c,n]);let l=c===`skills`?`skill`:`plugin`,u=(0,H.useMemo)(()=>le(a),[a]),d=Ft(l),[f,p]=(0,H.useState)(``),[m,g]=(0,H.useState)(``),[_,v]=(0,H.useState)(`all`),[y,b]=(0,H.useState)(`relevance`),[x,S]=(0,H.useState)(new Set),[ee,te]=(0,H.useState)(new Map),C=(0,H.useRef)({byKey:new Map,seq:0});(0,H.useEffect)(()=>{let e=setTimeout(()=>{g(f.trim())},250);return()=>clearTimeout(e)},[f]);let w=Fe(l),T=l===`skill`?i.scene?.trim():void 0,E=je({q:T?void 0:m||void 0,scene:T,type:l,sort:y,pageSize:Nt}),D=de({disabled:_!==`all`||E.isError||!E.hasNextPage||E.isFetchingNextPage,onLoadMore:()=>E.fetchNextPage(),watchValue:`${l}:${_}:${m}:${T??``}:${y}:${E.data?.loadedItems??0}:${E.data?.loadedPages??0}`});(0,H.useEffect)(()=>{let e=D.containerRef.current;e&&typeof e.scrollTo==`function`&&e.scrollTo({top:0})},[D.containerRef,m,T,_,y,l]);let ie=Ie(),se=Le(),{confirm:ce,ConfirmDialog:k}=me(),A=(0,H.useMemo)(()=>w.data?.records??[],[w.data?.records]),j=(0,H.useMemo)(()=>E.data?.items??[],[E.data?.items]),M=(0,H.useMemo)(()=>Re(j),[j]),N=(0,H.useMemo)(()=>ze(A),[A]),P=(0,H.useMemo)(()=>{let e=A.filter(e=>e.type===l).map(e=>({key:`${e.type}:${e.spec}:${e.id??``}`,record:e,item:Be(e,M)})).filter(e=>Ve(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},[A,l,M,m,u]),F=_===`installed`?P.length:E.data?.total??0,I={showCatalog:_===`all`&&E.isLoading&&!E.data,showInstalled:_===`installed`&&w.isLoading&&!w.data},L=I.showCatalog||I.showInstalled,R=(0,H.useMemo)(()=>_===`installed`?w.isLoading&&!w.data?r(`loading`):`${P.length} ${r(d.installedCountSuffix)}`:E.data?`${j.length} / ${F}`:r(`loading`),[_,w.data,w.isLoading,P.length,E.data,j.length,F,d.installedCountSuffix]),z={installingSpecs:x},ge={actionsByTarget:ee},B=Mt({items:j,installedRecordLookup:N,scene:T,forcedType:t,typeFilter:l,scope:_,searchText:f,query:m,showListSkeleton:L,hasCatalogError:E.isError}),V=async e=>{let t=e.install.spec;if(!x.has(t)){S(e=>{let n=new Set(e);return n.add(t),n});try{await ie.mutateAsync({type:e.type,spec:t,kind:e.install.kind,...e.type===`skill`?{skill:e.slug,installPath:`skills/${e.slug}`}:{}})}catch{}finally{S(e=>{if(!e.has(t))return e;let n=new Set(e);return n.delete(t),n})}}},_e=async(e,t)=>{let n=t.id||t.spec;if(n&&!ee.has(n)&&!(e===`uninstall`&&!await ce({title:`${r(`marketplaceUninstallTitle`)} ${n}?`,description:r(`marketplaceUninstallDescription`),confirmLabel:r(`marketplaceUninstall`),variant:`destructive`}))){te(t=>{let r=new Map(t);return r.set(n,e),r});try{await se.mutateAsync({type:t.type,action:e,id:n,spec:t.spec})}finally{te(e=>{if(!e.has(n))return e;let t=new Map(e);return t.delete(n),t})}}},U=async(e,t)=>{let n=e?.name??t?.label??t?.id??t?.spec??r(`marketplaceUnknownItem`),i=e?`marketplace:${e.type}:${e.slug}`:`marketplace:${t?.type??`unknown`}:${t?.id??t?.spec??n}`,a={title:n,kind:`content`,dedupeKey:i},o={...a,activate:!1};if(!e){let e=Z({title:n,typeLabel:t?.type===`plugin`?r(`marketplaceTypePlugin`):r(`marketplaceTypeSkill`),spec:t?.spec??`-`,summary:r(`marketplaceInstalledLocalSummary`),metadataRaw:JSON.stringify(t??{},null,2),contentRaw:`-`});s.open(e,a);return}let c=C.current.seq+1;C.current.seq=c,C.current.byKey.set(i,c);let l=O(e.summaryI18n,e.summary,u),d=e.type===`skill`?{typeLabel:r(`marketplaceTypeSkill`),loadContent:()=>ne(e.slug),fallbackContent:r(`marketplaceOperationFailed`),defaultContent:void 0}:{typeLabel:r(`marketplaceTypePlugin`),loadContent:()=>h(e.slug),fallbackContent:`-`,defaultContent:e.summary};s.open(Z({title:n,typeLabel:d.typeLabel,spec:e.install.spec,loading:!0}),a);try{let t=await d.loadContent();if(C.current.byKey.get(i)!==c)return;let r=Z({title:n,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});s.open(r,o)}catch(t){if(C.current.byKey.get(i)!==c)return;let r=Z({title:n,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});s.open(r,o)}};return(0,Q.jsxs)(o,{className:`flex h-full min-h-0 flex-col pb-0`,children:[!B.isSceneRoute&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(he,{tabs:[{id:`all`,label:r(d.tabMarketplace)},{id:`installed`,label:r(d.tabInstalled),count:w.data?.total??0}],activeTab:_,onChange:e=>v(e),className:`mb-3`}),(0,Q.jsx)(oe,{scope:_,searchText:f,searchPlaceholder:r(d.searchPlaceholder),sort:y,onSearchTextChange:p,onSortChange:b})]}),(0,Q.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:[!B.isSceneRoute&&!B.showShelves&&!L&&(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:_===`installed`?r(d.sectionInstalled):a.startsWith(`zh`)?`全部技能`:`All Skills`}),(0,Q.jsx)(`span`,{className:`text-[12px] text-gray-500`,children:R})]}),_===`all`&&E.isError&&(0,Q.jsxs)(`div`,{className:`rounded-xl border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700`,children:[r(d.errorLoadData),`: `,E.error.message]}),_===`installed`&&w.isError&&(0,Q.jsxs)(`div`,{className:`rounded-xl border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700`,children:[r(d.errorLoadInstalled),`: `,w.error.message]}),(0,Q.jsxs)(`div`,{ref:D.containerRef,className:`min-h-0 flex-1 overflow-y-auto custom-scrollbar pr-1`,"aria-busy":L||E.isFetchingNextPage,children:[B.isSceneRoute&&B.selectedScene&&(0,Q.jsx)(Ct,{scene:B.selectedScene,entries:B.sceneEntries,isLoading:L,language:a,localeFallbacks:u,installState:z,onBack:()=>n(B.backPath),onOpen:e=>void U(e.item,e.record),onInstall:V}),B.showShelves&&(0,Q.jsx)(bt,{entries:B.entries,scenes:B.scenes,isScenesLoading:B.isScenesLoading,isItemsLoading:L,language:a,installState:z,onOpen:e=>void U(e.item,e.record),onInstall:V,onOpenScene:e=>n(`${B.pathPrefix}/${e}`)}),!B.isSceneRoute&&(0,Q.jsx)(lt,{scope:_,title:_===`installed`?r(d.sectionInstalled):a.startsWith(`zh`)?`全部技能`:`All Skills`,summary:R,showTitle:B.showShelves,showListSkeleton:L,skeletonCardCount:Pt,allItems:j,installedEntries:P,installedRecordLookup:N,language:a,installState:z,manageState:ge,onOpen:(e,t)=>void U(e,t),onInstall:V,onManage:_e}),_===`all`&&!B.isSceneRoute&&!L&&!E.isError&&j.length===0&&(0,Q.jsx)(`div`,{className:`py-8 text-center text-[13px] text-gray-500`,children:r(d.emptyData)}),_===`installed`&&!B.isSceneRoute&&!L&&!w.isError&&P.length===0&&(0,Q.jsx)(`div`,{className:`py-8 text-center text-[13px] text-gray-500`,children:r(d.emptyInstalled)}),_===`all`&&!L&&!E.isError&&(0,Q.jsx)(ue,{hasMore:!!E.hasNextPage,loading:E.isFetchingNextPage,sentinelRef:D.sentinelRef})]})]}),(0,Q.jsx)(k,{})]})}export{Te as n,It as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./marketplace-page-BVqFjnEB.js";export{e as MarketplacePage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as e,m as t,p as n,r,u as i}from"./i18n-D1144VAA.js";import{At as a,C as o,Lt as s,Mt as c,Nt as l,Rt as u,S as d,T as f,Xt as p,b as m,ft as h,w as g,x as _,zt as v}from"./api-DGD9_Bg4.js";import{a as y,c as b,i as x,l as S,n as ee,o as C,r as w,s as T,t as te}from"./use-infinite-scroll-loader-
|
|
1
|
+
import{_ as e,m as t,p as n,r,u as i}from"./i18n-D1144VAA.js";import{At as a,C as o,Lt as s,Mt as c,Nt as l,Rt as u,S as d,T as f,Xt as p,b as m,ft as h,w as g,x as _,zt as v}from"./api-DGD9_Bg4.js";import{a as y,c as b,i as x,l as S,n as ee,o as C,r as w,s as T,t as te}from"./use-infinite-scroll-loader-DF2e6nQ2.js";import{a as E,i as D,n as O,o as k,r as A,t as j}from"./dialog-BKo0RItd.js";import{t as M}from"./createLucideIcon-DzY6wN61.js";import{t as N}from"./sparkles-BmgOD4nY.js";import{t as P}from"./notice-card-Dr6xCwva.js";import{i as F}from"./doc-browser-context-FukQHvyo.js";import{n as I}from"./doc-browser-CAhfnm0D.js";import{h as L}from"./index-DqJ3CYwi.js";import{t as R}from"./tag-chip-Dm2Lqnpu.js";var ne=M(`PackageCheck`,[[`path`,{d:`m16 16 2 2 4-4`,key:`gfu2re`}],[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}]]);function z(e){return(e??``).trim().toLowerCase()}function re(e){let t=new Map;for(let n of e){let e=[n.catalogSlug,n.spec,n.id,n.label];for(let r of e){let e=z(r);!e||t.has(e)||t.set(e,n)}}return t}function B(e,t){let n=[e.slug,e.install.spec,e.id,e.name];for(let e of n){let n=z(e);if(!n)continue;let r=t.get(n);if(r)return r}}function V(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function H(e,t,n,r,i){let a=`<!doctype html>
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./mcp-marketplace-page-BOYJO0kp.js";export{e as McpMarketplacePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,m as t,p as n,r}from"./i18n-D1144VAA.js";import{At as i,Mt as a,Nt as o,jt as s,kt as c,wt as l}from"./api-DGD9_Bg4.js";import{t as u}from"./book-open-BcnAiKde.js";import{n as d,t as f}from"./provider-scoped-model-input-BMTp4BEH.js";import{t as p}from"./sparkles-BmgOD4nY.js";import{t as m}from"./doc-browser-context-FukQHvyo.js";import{i as h,n as g,r as _,y as v}from"./use-config-Cyv5IuSt.js";import{Q as y,tt as b,u as x}from"./index-
|
|
1
|
+
import{_ as e,m as t,p as n,r}from"./i18n-D1144VAA.js";import{At as i,Mt as a,Nt as o,jt as s,kt as c,wt as l}from"./api-DGD9_Bg4.js";import{t as u}from"./book-open-BcnAiKde.js";import{n as d,t as f}from"./provider-scoped-model-input-BMTp4BEH.js";import{t as p}from"./sparkles-BmgOD4nY.js";import{t as m}from"./doc-browser-context-FukQHvyo.js";import{i as h,n as g,r as _,y as v}from"./use-config-Cyv5IuSt.js";import{Q as y,tt as b,u as x}from"./index-DqJ3CYwi.js";import{t as S}from"./config-hints-BNfpOL4J.js";var C=e(t(),1),w=n(),T=`provider/model`;function E(e){let{initialModel:t,initialWorkspace:n,isPending:i,modelHelpText:c,modelLabel:l,modelPlaceholder:d,onSubmit:h,providerCatalog:g,workspaceLabel:_,workspacePlaceholder:v}=e,[x,S]=(0,C.useState)(t),[T,E]=(0,C.useState)(n);return(0,w.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),h({model:x,workspace:T})},className:`space-y-8`,children:[(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-8 md:grid-cols-2`,children:[(0,w.jsxs)(`div`,{className:`rounded-2xl border border-gray-200 bg-white p-8 shadow-card`,children:[(0,w.jsxs)(`div`,{className:`mb-8 flex items-center gap-4`,children:[(0,w.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-xl bg-primary text-white`,children:(0,w.jsx)(p,{className:`h-5 w-5`})}),(0,w.jsx)(`h3`,{className:`text-lg font-bold text-gray-900`,children:r(`defaultModel`)})]}),(0,w.jsxs)(`div`,{className:`space-y-2`,children:[(0,w.jsx)(s,{htmlFor:`model`,className:`text-xs font-semibold uppercase tracking-wider text-gray-500`,children:l}),(0,w.jsx)(f,{id:`model`,value:x,onChange:S,providerCatalog:g,modelPlaceholder:d}),(0,w.jsx)(`p`,{className:`text-xs text-gray-400`,children:c}),(0,w.jsxs)(`a`,{href:`${m}/guide/model-selection`,className:`inline-flex items-center gap-1.5 text-xs text-primary transition-colors hover:text-primary-hover`,children:[(0,w.jsx)(u,{className:`h-3.5 w-3.5`}),r(`channelsGuideTitle`)]})]})]}),(0,w.jsxs)(`div`,{className:`rounded-2xl border border-gray-200 bg-white p-8 shadow-card`,children:[(0,w.jsxs)(`div`,{className:`mb-8 flex items-center gap-4`,children:[(0,w.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-xl bg-primary text-white`,children:(0,w.jsx)(b,{className:`h-5 w-5`})}),(0,w.jsx)(`h3`,{className:`text-lg font-bold text-gray-900`,children:r(`workspace`)})]}),(0,w.jsxs)(`div`,{className:`space-y-2`,children:[(0,w.jsx)(s,{htmlFor:`workspace`,className:`text-xs font-semibold uppercase tracking-wider text-gray-500`,children:_}),(0,w.jsx)(a,{id:`workspace`,value:T,onChange:e=>E(e.target.value),placeholder:v,className:`rounded-xl`})]})]})]}),(0,w.jsx)(`div`,{className:`flex justify-end pt-4`,children:(0,w.jsx)(o,{type:`submit`,disabled:i,size:`lg`,children:i?(0,w.jsx)(y,{className:`h-5 w-5 animate-spin`}):r(`saveChanges`)})})]})}function D(){let{data:e,isLoading:t}=g(),{data:n}=_(),{data:a}=h(),o=v(),s=a?.uiHints,u=S(`agents.defaults.model`,s),f=S(`agents.defaults.workspace`,s),p=(0,C.useMemo)(()=>d({meta:n,config:e,onlyConfigured:!0}),[e,n]),m=r(`modelIdentifierHelp`)||u?.help||``,y=(e?.agents?.defaults?.model||``).trim(),b=e?.agents?.defaults?.workspace||``;return t?(0,w.jsxs)(`div`,{className:`max-w-2xl space-y-6`,children:[(0,w.jsxs)(`div`,{className:`space-y-2`,children:[(0,w.jsx)(x,{className:`h-8 w-32`}),(0,w.jsx)(x,{className:`h-4 w-48`})]}),(0,w.jsxs)(l,{className:`rounded-2xl border-gray-200 p-6`,children:[(0,w.jsxs)(`div`,{className:`mb-6 flex items-center gap-4`,children:[(0,w.jsx)(x,{className:`h-12 w-12 rounded-xl`}),(0,w.jsxs)(`div`,{className:`space-y-2`,children:[(0,w.jsx)(x,{className:`h-5 w-24`}),(0,w.jsx)(x,{className:`h-3 w-32`})]})]}),(0,w.jsx)(x,{className:`mb-2 h-4 w-20`}),(0,w.jsx)(x,{className:`h-10 w-full rounded-xl`})]}),(0,w.jsxs)(l,{className:`rounded-2xl border-gray-200 p-6`,children:[(0,w.jsx)(x,{className:`mb-2 h-5 w-24`}),(0,w.jsx)(x,{className:`h-10 w-full rounded-xl`})]})]}):(0,w.jsxs)(i,{children:[(0,w.jsx)(c,{title:r(`modelPageTitle`),description:r(`modelPageDescription`)}),(0,w.jsx)(E,{initialModel:y,initialWorkspace:b,isPending:o.isPending,modelHelpText:m,modelLabel:u?.label??`Model Name`,modelPlaceholder:u?.placeholder??T,onSubmit:({model:e,workspace:t})=>o.mutate({model:e,workspace:t}),providerCatalog:p,workspaceLabel:f?.label??`Default Path`,workspacePlaceholder:f?.placeholder??`/path/to/workspace`},`${y}::${b}`)]})}export{D as ModelConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,a as t,m as n,p as r,r as i,u as a}from"./i18n-D1144VAA.js";import{At as o,Lt as s,Mt as c,Nt as l,Xt as u,ft as d,jt as f,kt as p}from"./api-DGD9_Bg4.js";import{t as m}from"./createLucideIcon-DzY6wN61.js";import{t as h}from"./search-CRtQwr-h.js";import{O as g,a as _,i as v,n as y,r as b,t as x}from"./select-BUTwE_lC.js";import{t as S}from"./key-round-DUq47t0P.js";import{t as C}from"./plus-B-YHtTNC.js";import{t as w}from"./x-BeyYA_h6.js";import{t as T}from"./status-dot-l3kPFdq_.js";import{a as ee,b as te,c as ne,g as re,h as ie,i as ae,n as oe,p as se,r as ce,u as le}from"./use-config-Cyv5IuSt.js";import{n as E,r as ue,t as D}from"./popover-BDFNiLlg.js";import{X as de,Y as O,q as k}from"./index-Cuwst6cc.js";import{t as A}from"./tabs-custom-D48zdZoc.js";import{t as fe}from"./config-hints-BNfpOL4J.js";import{a as pe,c as me,i as he,n as ge,o as _e,r as j,s as ve,t as M}from"./config-split-page-CcrEUtwu.js";import{t as ye}from"./setting-row-BavcnXw1.js";var be=m(`CircleDotDashed`,[[`path`,{d:`M10.1 2.18a9.93 9.93 0 0 1 3.8 0`,key:`1qdqn0`}],[`path`,{d:`M17.6 3.71a9.95 9.95 0 0 1 2.69 2.7`,key:`1bq7p6`}],[`path`,{d:`M21.82 10.1a9.93 9.93 0 0 1 0 3.8`,key:`1rlaqf`}],[`path`,{d:`M20.29 17.6a9.95 9.95 0 0 1-2.7 2.69`,key:`1xk03u`}],[`path`,{d:`M13.9 21.82a9.94 9.94 0 0 1-3.8 0`,key:`l7re25`}],[`path`,{d:`M6.4 20.29a9.95 9.95 0 0 1-2.69-2.7`,key:`1v18p6`}],[`path`,{d:`M2.18 13.9a9.93 9.93 0 0 1 0-3.8`,key:`xdo6bj`}],[`path`,{d:`M3.71 6.4a9.95 9.95 0 0 1 2.7-2.69`,key:`1jjmaz`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),xe=m(`EyeOff`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Se=m(`Eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Ce=m(`Settings2`,[[`path`,{d:`M20 7h-9`,key:`3s1dr2`}],[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),N=e(n(),1),P=r();function we({isSet:e,className:t,value:n,onChange:r,placeholder:i,...o}){let[s,u]=(0,N.useState)(!1),[d,f]=(0,N.useState)(!1),p=typeof n==`string`&&n.length>0;return(0,P.jsxs)(`div`,{className:`relative`,children:[e&&!p&&!d?(0,P.jsx)(`div`,{onClick:()=>f(!0),className:a(`flex h-9 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2 text-sm text-gray-500 cursor-text items-center pr-12`,t),children:`••••••••••••`}):(0,P.jsx)(c,{type:s?`text`:`password`,className:a(`pr-12`,t),value:n,onChange:r,onBlur:()=>{p||f(!1)},placeholder:i,autoFocus:d,...o}),(0,P.jsx)(`div`,{className:`absolute right-2 top-1/2 -translate-y-1/2 flex gap-1`,children:(e||p)&&(0,P.jsx)(l,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>u(!s),children:s?(0,P.jsx)(xe,{className:`h-4 w-4`}):(0,P.jsx)(Se,{className:`h-4 w-4`})})})]})}function Te({value:e,onChange:t,className:n}){let r=e?Object.entries(e):[],o=(e,n,i)=>{let a=[...r];a[e]=[n,i],t(Object.fromEntries(a))},s=()=>{t({...e,"":``})},u=e=>{let n=r.filter((t,n)=>n!==e);t(Object.fromEntries(n))};return(0,P.jsxs)(`div`,{className:a(`space-y-2`,n),children:[r.map(([e,t],n)=>(0,P.jsxs)(`div`,{className:`flex gap-2`,children:[(0,P.jsx)(c,{type:`text`,value:e,onChange:e=>o(n,e.target.value,t),placeholder:i(`headerName`),className:`flex-1`}),(0,P.jsx)(c,{type:`text`,value:t,onChange:t=>o(n,e,t.target.value),placeholder:i(`headerValue`),className:`flex-1`}),(0,P.jsx)(l,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>u(n),children:(0,P.jsx)(de,{className:`h-4 w-4 text-red-500`})})]},n)),(0,P.jsxs)(l,{type:`button`,variant:`outline`,size:`sm`,onClick:s,children:[(0,P.jsx)(C,{className:`h-4 w-4 mr-2`}),i(`add`)]})]})}function Ee(e){let{value:t,onChange:n,options:r}=e;return(0,P.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.map(e=>{let r=e.value===t;return(0,P.jsx)(`button`,{type:`button`,onClick:()=>n(e.value),"aria-pressed":r,className:`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors ${r?`border-primary bg-primary text-white shadow-sm`:`border-gray-200 bg-white text-gray-700 hover:border-primary/40 hover:text-primary`}`,children:e.label},e.value)})})}function De(e){let{showAdvanced:t,onShowAdvancedChange:n,supportsWireApi:r,wireApiLabel:a,wireApi:o,onWireApiChange:s,shouldUseWireApiPills:c,wireApiSelectOptions:l,extraHeadersLabel:u,extraHeaders:d,onExtraHeadersChange:p}=e;return(0,P.jsxs)(`div`,{className:`border-t border-gray-100 pt-4`,children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>n(!t),className:`flex w-full items-center justify-between text-sm text-gray-600 transition-colors hover:text-gray-900`,children:[(0,P.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,P.jsx)(Ce,{className:`h-3.5 w-3.5`}),i(`providerAdvancedSettings`)]}),(0,P.jsx)(g,{className:`h-4 w-4 transition-transform ${t?`rotate-180`:``}`})]}),t?(0,P.jsxs)(`div`,{className:`mt-4 space-y-5`,children:[r?(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(f,{htmlFor:`wireApi`,className:`text-sm font-medium text-gray-900`,children:a}),c?(0,P.jsx)(Ee,{value:o,onChange:e=>s(e),options:l}):(0,P.jsxs)(x,{value:o,onValueChange:e=>s(e),children:[(0,P.jsx)(v,{className:`rounded-xl`,children:(0,P.jsx)(_,{})}),(0,P.jsx)(y,{children:l.map(e=>(0,P.jsx)(b,{value:e.value,children:e.label},e.value))})]})]}):null,(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(f,{className:`text-sm font-medium text-gray-900`,children:u}),(0,P.jsx)(Te,{value:d,onChange:p}),(0,P.jsx)(`p`,{className:`text-xs text-gray-500`,children:i(`providerExtraHeadersHelpShort`)})]})]}):null]})}function Oe(e){let{providerAuth:t,providerAuthNote:n,providerAuthMethodOptions:r,providerAuthMethodsCount:a,selectedAuthMethodHint:o,shouldUseAuthMethodPills:s,resolvedAuthMethodId:c,onAuthMethodChange:u,onStartProviderAuth:d,onImportProviderAuthFromCli:p,startPending:m,importPending:h,authSessionId:g,authStatusMessage:S}=e;return t?.kind===`device_code`?(0,P.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-primary/20 bg-primary-50/50 p-3`,children:[(0,P.jsx)(f,{className:`text-sm font-medium text-gray-900`,children:t.displayName||i(`providerAuthSectionTitle`)}),n?(0,P.jsx)(`p`,{className:`text-xs text-gray-600`,children:n}):null,a>1?(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(f,{className:`text-xs font-medium text-gray-700`,children:i(`providerAuthMethodLabel`)}),s?(0,P.jsx)(Ee,{value:c,onChange:u,options:r}):(0,P.jsxs)(x,{value:c,onValueChange:u,children:[(0,P.jsx)(v,{className:`h-8 rounded-lg bg-white`,children:(0,P.jsx)(_,{placeholder:i(`providerAuthMethodPlaceholder`)})}),(0,P.jsx)(y,{children:r.map(e=>(0,P.jsx)(b,{value:e.value,children:e.label},e.value))})]}),o?(0,P.jsx)(`p`,{className:`text-xs text-gray-500`,children:o}):null]}):null,(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(l,{type:`button`,variant:`outline`,size:`sm`,onClick:d,disabled:m||!!g,children:i(m?`providerAuthStarting`:g?`providerAuthAuthorizing`:`providerAuthAuthorizeInBrowser`)}),t.supportsCliImport?(0,P.jsx)(l,{type:`button`,variant:`outline`,size:`sm`,onClick:p,disabled:h,children:i(h?`providerAuthImporting`:`providerAuthImportFromCli`)}):null,g?(0,P.jsxs)(`span`,{className:`text-xs text-gray-500`,children:[i(`providerAuthSessionLabel`),`: `,g.slice(0,8),`…`]}):null]}),S?(0,P.jsx)(`p`,{className:`text-xs text-gray-600`,children:S}):null]}):null}function ke(e){let{enabled:t,onChange:n}=e;return(0,P.jsx)(ye,{tone:`muted`,title:i(`enabled`),control:(0,P.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,P.jsx)(`span`,{className:`text-xs text-gray-500`,children:i(t?`enabled`:`disabled`)}),(0,P.jsx)(d,{checked:t,onCheckedChange:n})]})})}var Ae={enabled:!0,displayName:``,apiKeySet:!1,apiKeyMasked:void 0,apiBase:null,extraHeaders:null,wireApi:null,models:[],modelThinking:{}},je=[`off`,`minimal`,`low`,`medium`,`high`,`adaptive`,`xhigh`],F=new Set(je);function I(e){if(!e)return null;let t=Object.entries(e).map(([e,t])=>[e.trim(),t]).filter(([e])=>e.length>0);return t.length===0?null:Object.fromEntries(t)}function Me(e,t){let n=I(e),r=I(t);if(n===null&&r===null)return!0;if(!n||!r)return!1;let i=Object.entries(n).sort(([e],[t])=>e.localeCompare(t)),a=Object.entries(r).sort(([e],[t])=>e.localeCompare(t));return i.length===a.length?i.every(([e,t],n)=>e===a[n][0]&&t===a[n][1]):!1}function Ne(e){if(!e||e.length===0)return[];let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function Pe(e,t){let n=e.trim();if(!n||!t.trim())return n;let r=`${t.trim()}/`;return n.startsWith(r)?n.slice(r.length):n}function L(e,t){let n=e.trim();if(!n)return``;for(let e of t){let t=e.trim();t&&(n=Pe(n,t))}return n.trim()}function Fe(e,t){return e.length===t.length?e.every((e,n)=>e===t[n]):!1}function Ie(e,t){return t}function Le(e,t){return e}function Re(e,t,n){t!==n&&(e.enabled=t)}function R(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase();return t&&F.has(t)?t:null}function ze(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){let e=R(n);!e||t.includes(e)||t.push(e)}return t}function Be(e,t){if(!e)return{};let n={};for(let[r,i]of Object.entries(e)){let e=L(r,t);if(!e)continue;let a=ze(i?.supported);if(a.length===0)continue;let o=R(i?.default);n[e]=o&&a.includes(o)?{supported:a,default:o}:{supported:a}}return n}function Ve(e,t){let n=new Set(t.map(e=>e.trim()).filter(Boolean)),r={};for(let[t,i]of Object.entries(e)){if(!n.has(t))continue;let e=ze(i.supported);if(e.length===0)continue;let a=R(i.default);r[t]=a&&e.includes(a)?{supported:e,default:a}:{supported:e}}return r}function He(e,t){let n=Object.keys(e).sort(),r=Object.keys(t).sort();if(n.length!==r.length)return!1;for(let i=0;i<n.length;i+=1){let a=n[i];if(a!==r[i])return!1;let o=e[a],s=t[a];if(!o||!s||!Fe([...o.supported].sort(),[...s.supported].sort())||(o.default??null)!==(s.default??null))return!1}return!0}function Ue(e){return i(e===`off`?`chatThinkingLevelOff`:e===`minimal`?`chatThinkingLevelMinimal`:e===`low`?`chatThinkingLevelLow`:e===`medium`?`chatThinkingLevelMedium`:e===`high`?`chatThinkingLevelHigh`:e===`adaptive`?`chatThinkingLevelAdaptive`:`chatThinkingLevelXhigh`)}function We(e){let{providerName:t,methods:n,defaultMethodId:r,language:i}=e;if(n.length===0)return``;let a=new Map;for(let e of n){let t=e.id.trim();t&&a.set(t.toLowerCase(),t)}let o=(...e)=>{for(let t of e){let e=a.get(t.toLowerCase());if(e)return e}},s=r?.trim();if(t===`minimax-portal`){if(i===`zh`)return o(`cn`,`china-mainland`)??o(s??``)??n[0]?.id??``;if(i===`en`)return o(`global`,`intl`,`international`)??o(s??``)??n[0]?.id??``}if(s){let e=o(s);if(e)return e}return i===`zh`?o(`cn`)??n[0]?.id??``:i===`en`?o(`global`)??n[0]?.id??``:n[0]?.id??``}function Ge(e){return e.required&&e.hasDefault&&e.optionCount>1&&e.optionCount<=3}function Ke(e){let{models:t,modelThinking:n,modelDraft:r,showModelInput:a,onModelDraftChange:o,onShowModelInputChange:s,onAddModel:u,onRemoveModel:d,onToggleModelThinkingLevel:p,onSetModelThinkingDefault:m,thinkingLevels:h,formatThinkingLevelLabel:g}=e;return(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,P.jsx)(f,{className:`text-sm font-medium text-gray-900`,children:i(`providerModelsTitle`)}),a?null:(0,P.jsxs)(`button`,{type:`button`,onClick:()=>s(!0),className:`flex items-center gap-1 text-xs font-medium text-primary hover:text-primary/80`,children:[(0,P.jsx)(C,{className:`h-3 w-3`}),i(`providerAddModel`)]})]}),a?(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(c,{value:r,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),u()),e.key===`Escape`&&(s(!1),o(``))},placeholder:i(`providerModelInputPlaceholder`),className:`flex-1 rounded-xl`,autoFocus:!0}),(0,P.jsx)(l,{type:`button`,size:`sm`,onClick:u,disabled:r.trim().length===0,children:i(`add`)}),(0,P.jsx)(l,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{s(!1),o(``)},children:(0,P.jsx)(w,{className:`h-4 w-4`})})]}):null,t.length===0?(0,P.jsxs)(`div`,{className:`rounded-xl border border-dashed border-gray-200 bg-gray-50 px-4 py-6 text-center`,children:[(0,P.jsx)(`p`,{className:`text-sm text-gray-500`,children:i(`providerModelsEmptyShort`)}),a?null:(0,P.jsx)(`button`,{type:`button`,onClick:()=>s(!0),className:`mt-2 text-sm font-medium text-primary hover:text-primary/80`,children:i(`providerAddFirstModel`)})]}):(0,P.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.map(e=>{let t=n[e],r=t?.supported??[],a=t?.default??null;return(0,P.jsxs)(`div`,{className:`group inline-flex max-w-full items-center gap-1 rounded-full border border-gray-200 bg-white px-3 py-1.5`,children:[(0,P.jsx)(`span`,{className:`max-w-[140px] truncate text-sm text-gray-800 sm:max-w-[220px]`,children:e}),(0,P.jsxs)(D,{children:[(0,P.jsx)(ue,{asChild:!0,children:(0,P.jsx)(`button`,{type:`button`,className:`inline-flex h-5 w-5 items-center justify-center rounded-full text-gray-400 opacity-100 transition-opacity hover:bg-gray-100 hover:text-gray-600 md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,"aria-label":i(`providerModelThinkingTitle`),title:i(`providerModelThinkingTitle`),children:(0,P.jsx)(Ce,{className:`h-3 w-3`})})}),(0,P.jsxs)(E,{className:`w-80 space-y-3`,children:[(0,P.jsxs)(`div`,{className:`space-y-1`,children:[(0,P.jsx)(`p`,{className:`text-xs font-semibold text-gray-800`,children:i(`providerModelThinkingTitle`)}),(0,P.jsx)(`p`,{className:`text-xs text-gray-500`,children:i(`providerModelThinkingHint`)})]}),(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:h.map(t=>(0,P.jsx)(`button`,{type:`button`,onClick:()=>p(e,t),className:`rounded-full border px-2.5 py-1 text-xs font-medium transition-colors ${r.includes(t)?`border-primary bg-primary text-white`:`border-gray-200 bg-white text-gray-600 hover:border-primary/40 hover:text-primary`}`,children:g(t)},t))}),(0,P.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,P.jsx)(f,{className:`text-xs font-medium text-gray-700`,children:i(`providerModelThinkingDefault`)}),(0,P.jsxs)(x,{value:a??`__none__`,onValueChange:t=>m(e,t===`__none__`?null:t),disabled:r.length===0,children:[(0,P.jsx)(v,{className:`h-8 rounded-lg bg-white text-xs`,children:(0,P.jsx)(_,{})}),(0,P.jsxs)(y,{children:[(0,P.jsx)(b,{value:`__none__`,children:i(`providerModelThinkingDefaultNone`)}),r.map(e=>(0,P.jsx)(b,{value:e,children:g(e)},e))]})]}),r.length===0?(0,P.jsx)(`p`,{className:`text-xs text-gray-500`,children:i(`providerModelThinkingNoSupported`)}):null]})]})]}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>d(e),className:`inline-flex h-5 w-5 items-center justify-center rounded-full text-gray-400 opacity-100 transition-opacity hover:bg-gray-100 hover:text-gray-600 md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,"aria-label":i(`remove`),children:(0,P.jsx)(w,{className:`h-3 w-3`})})]},e)})})]})}function qe(e){return e.enabled?(0,P.jsx)(T,{status:e.apiKeySet?`ready`:`setup`,label:e.apiKeySet?i(`statusReady`):i(`statusSetup`),className:e.className}):(0,P.jsx)(T,{status:`inactive`,label:i(`disabled`),className:e.className})}function Je({providerName:e,onProviderDeleted:n}){let r=u(),{data:a}=oe(),{data:o}=ce(),{data:d}=ae(),p=te(),m=ne(),h=re(),g=ie(),_=se(),v=le(),[y,b]=(0,N.useState)(``),[x,S]=(0,N.useState)(!0),[C,w]=(0,N.useState)(``),[T,ee]=(0,N.useState)(null),[E,ue]=(0,N.useState)(`auto`),[D,O]=(0,N.useState)([]),[k,A]=(0,N.useState)({}),[he,j]=(0,N.useState)(``),[M,ye]=(0,N.useState)(``),[xe,Se]=(0,N.useState)(!1),[Ce,Te]=(0,N.useState)(!1),[Ee,F]=(0,N.useState)(null),[Pe,R]=(0,N.useState)(``),[ze,Je]=(0,N.useState)(``),z=(0,N.useRef)(null),B=o?.providers.find(t=>t.name===e),V=(e?a?.providers[e]:null)??Ae,Ye=d?.uiHints,H=!!B?.isCustom,Xe=e?fe(`providers.${e}.apiKey`,Ye):void 0,Ze=e?fe(`providers.${e}.apiBase`,Ye):void 0,Qe=e?fe(`providers.${e}.extraHeaders`,Ye):void 0,$e=e?fe(`providers.${e}.wireApi`,Ye):void 0,et=B?.displayName||e||``,U=(V.displayName||``).trim()||et,W=V.enabled!==!1,tt=M.trim()||U||e||i(`providersSelectPlaceholder`),G=(0,N.useMemo)(()=>Ne([B?.modelPrefix||e||``,e||``]),[e,B?.modelPrefix]),nt=B?.defaultApiBase||``,rt=V.apiBase||nt,it=I(V.extraHeaders||null),at=V.wireApi||B?.defaultWireApi||`auto`,ot=(0,N.useMemo)(()=>Ne((B?.defaultModels??[]).map(e=>L(e,G))),[B?.defaultModels,G]),st=(0,N.useMemo)(()=>Ne((V.models??[]).map(e=>L(e,G))),[V.models,G]),K=(0,N.useMemo)(()=>Ie(ot,st),[ot,st]),q=(0,N.useMemo)(()=>Ve(Be(V.modelThinking,G),K),[K,G,V.modelThinking]),J=t(),ct=B?.apiBaseHelp?.[J]||B?.apiBaseHelp?.en||Ze?.help||i(`providerApiBaseHelp`),Y=B?.auth,X=Y?.methods??[],Z=!!B?.supportsWireApi||H,lt=(0,N.useMemo)(()=>X.map(e=>({value:e.id,label:e.label?.[J]||e.label?.en||e.id})),[X,J]),ut=(0,N.useMemo)(()=>We({providerName:e,methods:X,defaultMethodId:Y?.defaultMethodId,language:J}),[e,Y?.defaultMethodId,X,J]),Q=(0,N.useMemo)(()=>{if(!X.length)return``;let e=ze.trim();return e&&X.some(t=>t.id===e)?e:ut||X[0]?.id||``},[ze,ut,X]),dt=(0,N.useMemo)(()=>X.find(e=>e.id===Q),[X,Q]),ft=Ge({required:Y?.kind===`device_code`,hasDefault:!!Y?.defaultMethodId?.trim(),optionCount:X.length}),pt=(B?.wireApiOptions||[`auto`,`chat`,`responses`]).map(e=>({value:e,label:i(e===`chat`?`wireApiChat`:e===`responses`?`wireApiResponses`:`wireApiAuto`)})),mt=Ge({required:Z,hasDefault:typeof B?.defaultWireApi==`string`&&B.defaultWireApi.length>0,optionCount:pt.length}),$=(0,N.useCallback)(()=>{z.current!==null&&(window.clearTimeout(z.current),z.current=null)},[]),ht=(0,N.useCallback)((t,n)=>{$(),z.current=window.setTimeout(()=>{(async()=>{if(e)try{let a=await _.mutateAsync({provider:e,data:{sessionId:t}});if(a.status===`pending`){R(i(`providerAuthWaitingBrowser`)),ht(t,a.nextPollMs??n);return}if(a.status===`authorized`){F(null),$(),R(i(`providerAuthCompleted`)),s.success(i(`providerAuthCompleted`)),r.invalidateQueries({queryKey:[`config`]}),r.invalidateQueries({queryKey:[`config-meta`]});return}F(null),$(),R(a.message||`Authorization ${a.status}.`),s.error(a.message||`Authorization ${a.status}.`)}catch(e){F(null),$();let t=e instanceof Error?e.message:String(e);R(t),s.error(`Authorization failed: ${t}`)}})()},Math.max(1e3,n))},[$,_,e,r]);(0,N.useEffect)(()=>{if(!e){b(``),S(!0),w(``),ee(null),ue(`auto`),O([]),A({}),j(``),ye(``),F(null),R(``),Je(``),$();return}b(``),S(W),w(rt),ee(V.extraHeaders||null),ue(at),O(K),A(q),j(``),ye(U),F(null),R(``),Je(ut),$()},[e,rt,W,V.extraHeaders,at,K,q,U,ut,$]),(0,N.useEffect)(()=>()=>$(),[$]),(0,N.useEffect)(()=>A(e=>Ve(e,D)),[D]);let gt=(0,N.useMemo)(()=>e?y.trim().length>0||x!==W||C.trim()!==rt.trim()||!Me(T,it)||Z&&E!==at||!Fe(D,K)||!He(k,q)||H&&M.trim()!==U:!1,[e,y,x,W,C,rt,T,it,Z,E,at,D,K,k,q,H,M,U]);return!e||!B?(0,P.jsx)(ge,{children:(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h3`,{className:`text-base font-semibold text-gray-900`,children:i(`providersSelectTitle`)}),(0,P.jsx)(`p`,{className:`mt-2 text-sm text-gray-500`,children:i(`providersSelectDescription`)})]})}):(0,P.jsxs)(pe,{children:[(0,P.jsx)(me,{className:`px-6 py-4`,children:(0,P.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,P.jsx)(`h3`,{className:`truncate text-lg font-semibold text-gray-900`,children:tt}),(0,P.jsxs)(`div`,{className:`flex items-center gap-3`,children:[H&&(0,P.jsx)(`button`,{type:`button`,onClick:async()=>{if(!(!e||!H)&&window.confirm(i(`providerDeleteConfirm`)))try{await m.mutateAsync({provider:e}),n?.(e)}catch{}},disabled:m.isPending,className:`text-gray-400 transition-colors hover:text-red-500`,title:i(`providerDelete`),children:(0,P.jsx)(de,{className:`h-4 w-4`})}),(0,P.jsx)(qe,{enabled:W,apiKeySet:V.apiKeySet})]})]})}),(0,P.jsxs)(`form`,{onSubmit:t=>{if(t.preventDefault(),!e)return;let n={},r=y.trim(),i=C.trim(),a=I(T),o=M.trim();H&&o!==U&&(n.displayName=o.length>0?o:null),r.length>0&&(n.apiKey=r),Re(n,x,W),i!==rt.trim()&&(n.apiBase=i.length>0&&i!==nt?i:null),Me(a,it)||(n.extraHeaders=a),Z&&E!==at&&(n.wireApi=E),Fe(D,K)||(n.models=Le(D,ot)),He(k,q)||(n.modelThinking=Ve(k,D)),p.mutate({provider:e,data:n})},className:`flex min-h-0 flex-1 flex-col`,children:[(0,P.jsxs)(_e,{className:`space-y-5 px-6 py-5`,children:[(0,P.jsx)(ke,{enabled:x,onChange:S}),H&&(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(f,{htmlFor:`providerDisplayName`,className:`text-sm font-medium text-gray-900`,children:i(`providerDisplayName`)}),(0,P.jsx)(c,{id:`providerDisplayName`,type:`text`,value:M,onChange:e=>ye(e.target.value),placeholder:et||i(`providerDisplayNamePlaceholder`),className:`rounded-xl`}),(0,P.jsx)(`p`,{className:`text-xs text-gray-500`,children:i(`providerDisplayNameHelpShort`)})]}),(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(f,{htmlFor:`apiKey`,className:`text-sm font-medium text-gray-900`,children:Xe?.label??i(`apiKey`)}),(0,P.jsx)(we,{id:`apiKey`,value:y,isSet:V.apiKeySet,onChange:e=>b(e.target.value),placeholder:Xe?.placeholder??i(`enterApiKey`),className:`rounded-xl`}),(0,P.jsx)(`p`,{className:`text-xs text-gray-500`,children:i(`leaveBlankToKeepUnchanged`)})]}),(0,P.jsx)(Oe,{providerAuth:Y,providerAuthNote:Y?.note?.[J]||Y?.note?.en||Y?.displayName||``,providerAuthMethodOptions:lt,providerAuthMethodsCount:X.length,selectedAuthMethodHint:dt?.hint?.[J]||dt?.hint?.en||``,shouldUseAuthMethodPills:ft,resolvedAuthMethodId:Q,onAuthMethodChange:Je,onStartProviderAuth:async()=>{if(!(!e||Y?.kind!==`device_code`))try{R(``);let t=await g.mutateAsync({provider:e,data:Q?{methodId:Q}:{}});if(!t.sessionId||!t.verificationUri)throw Error(i(`providerAuthStartFailed`));F(t.sessionId),R(`${i(`providerAuthOpenPrompt`)}${t.userCode}${i(`providerAuthOpenPromptSuffix`)}`),window.open(t.verificationUri,`_blank`,`noopener,noreferrer`),ht(t.sessionId,t.intervalMs)}catch(e){let t=e instanceof Error?e.message:String(e);F(null),$(),R(t),s.error(`${i(`providerAuthStartFailed`)}: ${t}`)}},onImportProviderAuthFromCli:async()=>{if(!(!e||Y?.kind!==`device_code`))try{$(),F(null);let t=await v.mutateAsync({provider:e});R(`${i(`providerAuthImportStatusPrefix`)}${t.expiresAt?` (expires: ${t.expiresAt})`:``}`),s.success(i(`providerAuthImportSuccess`)),r.invalidateQueries({queryKey:[`config`]}),r.invalidateQueries({queryKey:[`config-meta`]})}catch(e){let t=e instanceof Error?e.message:String(e);R(t),s.error(`${i(`providerAuthImportFailed`)}: ${t}`)}},startPending:g.isPending,importPending:v.isPending,authSessionId:Ee,authStatusMessage:Pe}),(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(f,{htmlFor:`apiBase`,className:`text-sm font-medium text-gray-900`,children:Ze?.label??i(`apiBase`)}),(0,P.jsx)(c,{id:`apiBase`,type:`text`,value:C,onChange:e=>w(e.target.value),placeholder:nt||Ze?.placeholder||`https://api.example.com`,className:`rounded-xl`}),(0,P.jsx)(`p`,{className:`text-xs text-gray-500`,children:ct})]}),(0,P.jsx)(Ke,{models:D,modelThinking:k,modelDraft:he,showModelInput:Ce,onModelDraftChange:j,onShowModelInputChange:Te,onAddModel:()=>{let e=L(he,G);if(e){if(D.includes(e)){j(``);return}O(t=>[...t,e]),j(``)}},onRemoveModel:e=>{O(t=>t.filter(t=>t!==e)),A(t=>{let n={...t};return delete n[e],n})},onToggleModelThinkingLevel:(e,t)=>{A(n=>{let r=n[e],i=r?.supported??[],a=i.includes(t)?i.filter(e=>e!==t):je.filter(e=>e===t||i.includes(e));if(a.length===0){let t={...n};return delete t[e],t}let o=r?.default&&a.includes(r.default)?r.default:void 0;return{...n,[e]:o?{supported:a,default:o}:{supported:a}}})},onSetModelThinkingDefault:(e,t)=>{A(n=>{let r=n[e];return!r||r.supported.length===0||t&&!r.supported.includes(t)?n:{...n,[e]:t?{supported:r.supported,default:t}:{supported:r.supported}}})},thinkingLevels:je,formatThinkingLevelLabel:Ue}),(0,P.jsx)(De,{showAdvanced:xe,onShowAdvancedChange:Se,supportsWireApi:Z,wireApiLabel:$e?.label??i(`wireApi`),wireApi:E,onWireApiChange:ue,shouldUseWireApiPills:mt,wireApiSelectOptions:pt,extraHeadersLabel:Qe?.label??i(`extraHeaders`),extraHeaders:T,onExtraHeadersChange:ee})]}),(0,P.jsxs)(ve,{className:`flex items-center justify-between px-6 py-4`,children:[(0,P.jsxs)(l,{type:`button`,variant:`outline`,size:`sm`,onClick:async()=>{if(!e)return;let t=L(D.find(e=>e.trim().length>0)??``,G),n={apiBase:C.trim(),extraHeaders:I(T),model:t||null};y.trim().length>0&&(n.apiKey=y.trim()),Z&&(n.wireApi=E);try{let t=await h.mutateAsync({provider:e,data:n});if(t.success){s.success(`${i(`providerTestConnectionSuccess`)} (${t.latencyMs}ms)`);return}let r=[`provider=${t.provider}`,`latency=${t.latencyMs}ms`];t.model&&r.push(`model=${t.model}`),s.error(`${i(`providerTestConnectionFailed`)}: ${t.message} | ${r.join(` | `)}`)}catch(e){let t=e instanceof Error?e.message:String(e);s.error(`${i(`providerTestConnectionFailed`)}: ${t}`)}},disabled:h.isPending,children:[(0,P.jsx)(be,{className:`mr-1.5 h-4 w-4`}),h.isPending?i(`providerTestingConnection`):i(`providerTestConnection`)]}),(0,P.jsx)(l,{type:`submit`,disabled:p.isPending||!gt,children:p.isPending?i(`saving`):i(gt?`save`:`unchanged`)})]})]})]})}function z(e){if(!e)return null;try{let t=new URL(e);return`${t.host}${t.pathname&&t.pathname!==`/`?t.pathname:``}`}catch{return e.replace(/^https?:\/\//,``)}}function B(e){return e.map((e,t)=>({provider:e,index:t})).sort((e,t)=>{let n=e.provider.name===`nextclaw`?1:0,r=t.provider.name===`nextclaw`?1:0;return n===r?e.index-t.index:n-r}).map(({provider:e})=>e)}function V(){let{isMobile:e}=O(),{data:t}=oe(),{data:n}=ce(),{data:r}=ae(),s=ee(),[u,d]=(0,N.useState)(`installed`),[f,m]=(0,N.useState)(null),[g,_]=(0,N.useState)(``),v=(0,N.useMemo)(()=>B(n?.providers??[]),[n?.providers]),y=t?.providers??{},b=(0,N.useMemo)(()=>{let e=g.trim().toLowerCase();return v.filter(e=>u!==`installed`||!!(y[e.name]?.enabled!==!1&&y[e.name]?.apiKeySet)).filter(t=>e?(y[t.name]?.displayName?.trim()||t.displayName||t.name).toLowerCase().includes(e)||t.name.toLowerCase().includes(e):!0)},[u,v,y,g]),x=(0,N.useMemo)(()=>f&&b.some(e=>e.name===f)?f:e?null:b[0]?.name??null,[b,e,f]);return!t||!n?(0,P.jsx)(`div`,{className:`p-8`,children:i(`providersLoading`)}):(0,P.jsxs)(o,{className:`pb-0 xl:flex xl:h-full xl:min-h-0 xl:flex-col`,children:[(0,P.jsx)(p,{title:i(`providersPageTitle`),description:i(`providersPageDescription`)}),(0,P.jsxs)(he,{className:`xl:min-h-0`,mobileView:e?x?`detail`:`list`:void 0,onMobileBack:()=>m(null),mobileListLabel:i(`providersPageTitle`),children:[(0,P.jsxs)(pe,{children:[(0,P.jsxs)(me,{className:`space-y-3 px-4 pb-3 pt-4`,children:[(0,P.jsx)(A,{tabs:[{id:`installed`,label:i(`providersTabConfigured`),count:v.filter(e=>y[e.name]?.enabled!==!1&&y[e.name]?.apiKeySet).length},{id:`all`,label:i(`providersTabAll`),count:v.length}],activeTab:u,onChange:d,className:`mb-0`}),(0,P.jsxs)(l,{type:`button`,variant:`outline`,className:`w-full justify-center`,onClick:async()=>{try{let e=await s.mutateAsync({data:{}});d(`all`),_(``),m(e.name)}catch{}},disabled:s.isPending,children:[(0,P.jsx)(C,{className:`mr-2 h-4 w-4`}),s.isPending?i(`saving`):i(`providerAddCustom`)]})]}),(0,P.jsx)(`div`,{className:`border-b border-gray-100 px-4 py-3`,children:(0,P.jsxs)(`div`,{className:`relative`,children:[(0,P.jsx)(h,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400`}),(0,P.jsx)(c,{value:g,onChange:e=>_(e.target.value),placeholder:i(`providersFilterPlaceholder`),className:`h-10 rounded-xl pl-9`})]})}),(0,P.jsxs)(_e,{className:`space-y-2 p-3`,children:[b.map(e=>{let t=y[e.name],n=t?.enabled!==!1,o=!!(n&&t?.apiKeySet),s=t?.displayName?.trim()||e.displayName||e.name,c=z(t?.apiBase||e.defaultApiBase||``)||fe(`providers.${e.name}`,r?.uiHints)?.help||i(`providersDefaultDescription`);return(0,P.jsx)(M,{onClick:()=>m(e.name),active:x===e.name,children:(0,P.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,P.jsx)(k,{name:e.name,src:e.logo?`/logos/${e.logo}`:null,className:a(`h-10 w-10 rounded-lg border`,o?`border-primary/30 bg-white`:`border-gray-200/70 bg-white`),imgClassName:`h-5 w-5 object-contain`,fallback:(0,P.jsx)(`span`,{className:`text-sm font-semibold uppercase text-gray-500`,children:e.name[0]})}),(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`p`,{className:`truncate text-sm font-semibold text-gray-900`,children:s}),(0,P.jsx)(`p`,{className:`line-clamp-1 text-[11px] text-gray-500`,children:c})]})]}),(0,P.jsx)(T,{status:n?o?`ready`:`setup`:`inactive`,label:i(n?o?`statusReady`:`statusSetup`:`disabled`),className:`min-w-[56px] justify-center`})]})},e.name)}),b.length===0?(0,P.jsx)(j,{icon:S,title:i(`providersNoMatch`)}):null]})]}),(0,P.jsx)(Je,{providerName:x??void 0,onProviderDeleted:e=>{e===x&&m(null)}})]})]})}export{V as ProvidersList};
|
|
1
|
+
import{_ as e,a as t,m as n,p as r,r as i,u as a}from"./i18n-D1144VAA.js";import{At as o,Lt as s,Mt as c,Nt as l,Xt as u,ft as d,jt as f,kt as p}from"./api-DGD9_Bg4.js";import{t as m}from"./createLucideIcon-DzY6wN61.js";import{t as h}from"./search-CRtQwr-h.js";import{O as g,a as _,i as v,n as y,r as b,t as x}from"./select-BUTwE_lC.js";import{t as S}from"./key-round-DUq47t0P.js";import{t as C}from"./plus-B-YHtTNC.js";import{t as w}from"./x-BeyYA_h6.js";import{t as T}from"./status-dot-l3kPFdq_.js";import{a as ee,b as te,c as ne,g as re,h as ie,i as ae,n as oe,p as se,r as ce,u as le}from"./use-config-Cyv5IuSt.js";import{n as E,r as ue,t as D}from"./popover-BDFNiLlg.js";import{X as de,Y as O,q as k}from"./index-DqJ3CYwi.js";import{t as A}from"./tabs-custom-D48zdZoc.js";import{t as fe}from"./config-hints-BNfpOL4J.js";import{a as pe,c as me,i as he,n as ge,o as _e,r as j,s as ve,t as M}from"./config-split-page-CcrEUtwu.js";import{t as ye}from"./setting-row-BavcnXw1.js";var be=m(`CircleDotDashed`,[[`path`,{d:`M10.1 2.18a9.93 9.93 0 0 1 3.8 0`,key:`1qdqn0`}],[`path`,{d:`M17.6 3.71a9.95 9.95 0 0 1 2.69 2.7`,key:`1bq7p6`}],[`path`,{d:`M21.82 10.1a9.93 9.93 0 0 1 0 3.8`,key:`1rlaqf`}],[`path`,{d:`M20.29 17.6a9.95 9.95 0 0 1-2.7 2.69`,key:`1xk03u`}],[`path`,{d:`M13.9 21.82a9.94 9.94 0 0 1-3.8 0`,key:`l7re25`}],[`path`,{d:`M6.4 20.29a9.95 9.95 0 0 1-2.69-2.7`,key:`1v18p6`}],[`path`,{d:`M2.18 13.9a9.93 9.93 0 0 1 0-3.8`,key:`xdo6bj`}],[`path`,{d:`M3.71 6.4a9.95 9.95 0 0 1 2.7-2.69`,key:`1jjmaz`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),xe=m(`EyeOff`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Se=m(`Eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Ce=m(`Settings2`,[[`path`,{d:`M20 7h-9`,key:`3s1dr2`}],[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),N=e(n(),1),P=r();function we({isSet:e,className:t,value:n,onChange:r,placeholder:i,...o}){let[s,u]=(0,N.useState)(!1),[d,f]=(0,N.useState)(!1),p=typeof n==`string`&&n.length>0;return(0,P.jsxs)(`div`,{className:`relative`,children:[e&&!p&&!d?(0,P.jsx)(`div`,{onClick:()=>f(!0),className:a(`flex h-9 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2 text-sm text-gray-500 cursor-text items-center pr-12`,t),children:`••••••••••••`}):(0,P.jsx)(c,{type:s?`text`:`password`,className:a(`pr-12`,t),value:n,onChange:r,onBlur:()=>{p||f(!1)},placeholder:i,autoFocus:d,...o}),(0,P.jsx)(`div`,{className:`absolute right-2 top-1/2 -translate-y-1/2 flex gap-1`,children:(e||p)&&(0,P.jsx)(l,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>u(!s),children:s?(0,P.jsx)(xe,{className:`h-4 w-4`}):(0,P.jsx)(Se,{className:`h-4 w-4`})})})]})}function Te({value:e,onChange:t,className:n}){let r=e?Object.entries(e):[],o=(e,n,i)=>{let a=[...r];a[e]=[n,i],t(Object.fromEntries(a))},s=()=>{t({...e,"":``})},u=e=>{let n=r.filter((t,n)=>n!==e);t(Object.fromEntries(n))};return(0,P.jsxs)(`div`,{className:a(`space-y-2`,n),children:[r.map(([e,t],n)=>(0,P.jsxs)(`div`,{className:`flex gap-2`,children:[(0,P.jsx)(c,{type:`text`,value:e,onChange:e=>o(n,e.target.value,t),placeholder:i(`headerName`),className:`flex-1`}),(0,P.jsx)(c,{type:`text`,value:t,onChange:t=>o(n,e,t.target.value),placeholder:i(`headerValue`),className:`flex-1`}),(0,P.jsx)(l,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>u(n),children:(0,P.jsx)(de,{className:`h-4 w-4 text-red-500`})})]},n)),(0,P.jsxs)(l,{type:`button`,variant:`outline`,size:`sm`,onClick:s,children:[(0,P.jsx)(C,{className:`h-4 w-4 mr-2`}),i(`add`)]})]})}function Ee(e){let{value:t,onChange:n,options:r}=e;return(0,P.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.map(e=>{let r=e.value===t;return(0,P.jsx)(`button`,{type:`button`,onClick:()=>n(e.value),"aria-pressed":r,className:`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors ${r?`border-primary bg-primary text-white shadow-sm`:`border-gray-200 bg-white text-gray-700 hover:border-primary/40 hover:text-primary`}`,children:e.label},e.value)})})}function De(e){let{showAdvanced:t,onShowAdvancedChange:n,supportsWireApi:r,wireApiLabel:a,wireApi:o,onWireApiChange:s,shouldUseWireApiPills:c,wireApiSelectOptions:l,extraHeadersLabel:u,extraHeaders:d,onExtraHeadersChange:p}=e;return(0,P.jsxs)(`div`,{className:`border-t border-gray-100 pt-4`,children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>n(!t),className:`flex w-full items-center justify-between text-sm text-gray-600 transition-colors hover:text-gray-900`,children:[(0,P.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,P.jsx)(Ce,{className:`h-3.5 w-3.5`}),i(`providerAdvancedSettings`)]}),(0,P.jsx)(g,{className:`h-4 w-4 transition-transform ${t?`rotate-180`:``}`})]}),t?(0,P.jsxs)(`div`,{className:`mt-4 space-y-5`,children:[r?(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(f,{htmlFor:`wireApi`,className:`text-sm font-medium text-gray-900`,children:a}),c?(0,P.jsx)(Ee,{value:o,onChange:e=>s(e),options:l}):(0,P.jsxs)(x,{value:o,onValueChange:e=>s(e),children:[(0,P.jsx)(v,{className:`rounded-xl`,children:(0,P.jsx)(_,{})}),(0,P.jsx)(y,{children:l.map(e=>(0,P.jsx)(b,{value:e.value,children:e.label},e.value))})]})]}):null,(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(f,{className:`text-sm font-medium text-gray-900`,children:u}),(0,P.jsx)(Te,{value:d,onChange:p}),(0,P.jsx)(`p`,{className:`text-xs text-gray-500`,children:i(`providerExtraHeadersHelpShort`)})]})]}):null]})}function Oe(e){let{providerAuth:t,providerAuthNote:n,providerAuthMethodOptions:r,providerAuthMethodsCount:a,selectedAuthMethodHint:o,shouldUseAuthMethodPills:s,resolvedAuthMethodId:c,onAuthMethodChange:u,onStartProviderAuth:d,onImportProviderAuthFromCli:p,startPending:m,importPending:h,authSessionId:g,authStatusMessage:S}=e;return t?.kind===`device_code`?(0,P.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-primary/20 bg-primary-50/50 p-3`,children:[(0,P.jsx)(f,{className:`text-sm font-medium text-gray-900`,children:t.displayName||i(`providerAuthSectionTitle`)}),n?(0,P.jsx)(`p`,{className:`text-xs text-gray-600`,children:n}):null,a>1?(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(f,{className:`text-xs font-medium text-gray-700`,children:i(`providerAuthMethodLabel`)}),s?(0,P.jsx)(Ee,{value:c,onChange:u,options:r}):(0,P.jsxs)(x,{value:c,onValueChange:u,children:[(0,P.jsx)(v,{className:`h-8 rounded-lg bg-white`,children:(0,P.jsx)(_,{placeholder:i(`providerAuthMethodPlaceholder`)})}),(0,P.jsx)(y,{children:r.map(e=>(0,P.jsx)(b,{value:e.value,children:e.label},e.value))})]}),o?(0,P.jsx)(`p`,{className:`text-xs text-gray-500`,children:o}):null]}):null,(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(l,{type:`button`,variant:`outline`,size:`sm`,onClick:d,disabled:m||!!g,children:i(m?`providerAuthStarting`:g?`providerAuthAuthorizing`:`providerAuthAuthorizeInBrowser`)}),t.supportsCliImport?(0,P.jsx)(l,{type:`button`,variant:`outline`,size:`sm`,onClick:p,disabled:h,children:i(h?`providerAuthImporting`:`providerAuthImportFromCli`)}):null,g?(0,P.jsxs)(`span`,{className:`text-xs text-gray-500`,children:[i(`providerAuthSessionLabel`),`: `,g.slice(0,8),`…`]}):null]}),S?(0,P.jsx)(`p`,{className:`text-xs text-gray-600`,children:S}):null]}):null}function ke(e){let{enabled:t,onChange:n}=e;return(0,P.jsx)(ye,{tone:`muted`,title:i(`enabled`),control:(0,P.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,P.jsx)(`span`,{className:`text-xs text-gray-500`,children:i(t?`enabled`:`disabled`)}),(0,P.jsx)(d,{checked:t,onCheckedChange:n})]})})}var Ae={enabled:!0,displayName:``,apiKeySet:!1,apiKeyMasked:void 0,apiBase:null,extraHeaders:null,wireApi:null,models:[],modelThinking:{}},je=[`off`,`minimal`,`low`,`medium`,`high`,`adaptive`,`xhigh`],F=new Set(je);function I(e){if(!e)return null;let t=Object.entries(e).map(([e,t])=>[e.trim(),t]).filter(([e])=>e.length>0);return t.length===0?null:Object.fromEntries(t)}function Me(e,t){let n=I(e),r=I(t);if(n===null&&r===null)return!0;if(!n||!r)return!1;let i=Object.entries(n).sort(([e],[t])=>e.localeCompare(t)),a=Object.entries(r).sort(([e],[t])=>e.localeCompare(t));return i.length===a.length?i.every(([e,t],n)=>e===a[n][0]&&t===a[n][1]):!1}function Ne(e){if(!e||e.length===0)return[];let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function Pe(e,t){let n=e.trim();if(!n||!t.trim())return n;let r=`${t.trim()}/`;return n.startsWith(r)?n.slice(r.length):n}function L(e,t){let n=e.trim();if(!n)return``;for(let e of t){let t=e.trim();t&&(n=Pe(n,t))}return n.trim()}function Fe(e,t){return e.length===t.length?e.every((e,n)=>e===t[n]):!1}function Ie(e,t){return t}function Le(e,t){return e}function Re(e,t,n){t!==n&&(e.enabled=t)}function R(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase();return t&&F.has(t)?t:null}function ze(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){let e=R(n);!e||t.includes(e)||t.push(e)}return t}function Be(e,t){if(!e)return{};let n={};for(let[r,i]of Object.entries(e)){let e=L(r,t);if(!e)continue;let a=ze(i?.supported);if(a.length===0)continue;let o=R(i?.default);n[e]=o&&a.includes(o)?{supported:a,default:o}:{supported:a}}return n}function Ve(e,t){let n=new Set(t.map(e=>e.trim()).filter(Boolean)),r={};for(let[t,i]of Object.entries(e)){if(!n.has(t))continue;let e=ze(i.supported);if(e.length===0)continue;let a=R(i.default);r[t]=a&&e.includes(a)?{supported:e,default:a}:{supported:e}}return r}function He(e,t){let n=Object.keys(e).sort(),r=Object.keys(t).sort();if(n.length!==r.length)return!1;for(let i=0;i<n.length;i+=1){let a=n[i];if(a!==r[i])return!1;let o=e[a],s=t[a];if(!o||!s||!Fe([...o.supported].sort(),[...s.supported].sort())||(o.default??null)!==(s.default??null))return!1}return!0}function Ue(e){return i(e===`off`?`chatThinkingLevelOff`:e===`minimal`?`chatThinkingLevelMinimal`:e===`low`?`chatThinkingLevelLow`:e===`medium`?`chatThinkingLevelMedium`:e===`high`?`chatThinkingLevelHigh`:e===`adaptive`?`chatThinkingLevelAdaptive`:`chatThinkingLevelXhigh`)}function We(e){let{providerName:t,methods:n,defaultMethodId:r,language:i}=e;if(n.length===0)return``;let a=new Map;for(let e of n){let t=e.id.trim();t&&a.set(t.toLowerCase(),t)}let o=(...e)=>{for(let t of e){let e=a.get(t.toLowerCase());if(e)return e}},s=r?.trim();if(t===`minimax-portal`){if(i===`zh`)return o(`cn`,`china-mainland`)??o(s??``)??n[0]?.id??``;if(i===`en`)return o(`global`,`intl`,`international`)??o(s??``)??n[0]?.id??``}if(s){let e=o(s);if(e)return e}return i===`zh`?o(`cn`)??n[0]?.id??``:i===`en`?o(`global`)??n[0]?.id??``:n[0]?.id??``}function Ge(e){return e.required&&e.hasDefault&&e.optionCount>1&&e.optionCount<=3}function Ke(e){let{models:t,modelThinking:n,modelDraft:r,showModelInput:a,onModelDraftChange:o,onShowModelInputChange:s,onAddModel:u,onRemoveModel:d,onToggleModelThinkingLevel:p,onSetModelThinkingDefault:m,thinkingLevels:h,formatThinkingLevelLabel:g}=e;return(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,P.jsx)(f,{className:`text-sm font-medium text-gray-900`,children:i(`providerModelsTitle`)}),a?null:(0,P.jsxs)(`button`,{type:`button`,onClick:()=>s(!0),className:`flex items-center gap-1 text-xs font-medium text-primary hover:text-primary/80`,children:[(0,P.jsx)(C,{className:`h-3 w-3`}),i(`providerAddModel`)]})]}),a?(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(c,{value:r,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),u()),e.key===`Escape`&&(s(!1),o(``))},placeholder:i(`providerModelInputPlaceholder`),className:`flex-1 rounded-xl`,autoFocus:!0}),(0,P.jsx)(l,{type:`button`,size:`sm`,onClick:u,disabled:r.trim().length===0,children:i(`add`)}),(0,P.jsx)(l,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{s(!1),o(``)},children:(0,P.jsx)(w,{className:`h-4 w-4`})})]}):null,t.length===0?(0,P.jsxs)(`div`,{className:`rounded-xl border border-dashed border-gray-200 bg-gray-50 px-4 py-6 text-center`,children:[(0,P.jsx)(`p`,{className:`text-sm text-gray-500`,children:i(`providerModelsEmptyShort`)}),a?null:(0,P.jsx)(`button`,{type:`button`,onClick:()=>s(!0),className:`mt-2 text-sm font-medium text-primary hover:text-primary/80`,children:i(`providerAddFirstModel`)})]}):(0,P.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.map(e=>{let t=n[e],r=t?.supported??[],a=t?.default??null;return(0,P.jsxs)(`div`,{className:`group inline-flex max-w-full items-center gap-1 rounded-full border border-gray-200 bg-white px-3 py-1.5`,children:[(0,P.jsx)(`span`,{className:`max-w-[140px] truncate text-sm text-gray-800 sm:max-w-[220px]`,children:e}),(0,P.jsxs)(D,{children:[(0,P.jsx)(ue,{asChild:!0,children:(0,P.jsx)(`button`,{type:`button`,className:`inline-flex h-5 w-5 items-center justify-center rounded-full text-gray-400 opacity-100 transition-opacity hover:bg-gray-100 hover:text-gray-600 md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,"aria-label":i(`providerModelThinkingTitle`),title:i(`providerModelThinkingTitle`),children:(0,P.jsx)(Ce,{className:`h-3 w-3`})})}),(0,P.jsxs)(E,{className:`w-80 space-y-3`,children:[(0,P.jsxs)(`div`,{className:`space-y-1`,children:[(0,P.jsx)(`p`,{className:`text-xs font-semibold text-gray-800`,children:i(`providerModelThinkingTitle`)}),(0,P.jsx)(`p`,{className:`text-xs text-gray-500`,children:i(`providerModelThinkingHint`)})]}),(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:h.map(t=>(0,P.jsx)(`button`,{type:`button`,onClick:()=>p(e,t),className:`rounded-full border px-2.5 py-1 text-xs font-medium transition-colors ${r.includes(t)?`border-primary bg-primary text-white`:`border-gray-200 bg-white text-gray-600 hover:border-primary/40 hover:text-primary`}`,children:g(t)},t))}),(0,P.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,P.jsx)(f,{className:`text-xs font-medium text-gray-700`,children:i(`providerModelThinkingDefault`)}),(0,P.jsxs)(x,{value:a??`__none__`,onValueChange:t=>m(e,t===`__none__`?null:t),disabled:r.length===0,children:[(0,P.jsx)(v,{className:`h-8 rounded-lg bg-white text-xs`,children:(0,P.jsx)(_,{})}),(0,P.jsxs)(y,{children:[(0,P.jsx)(b,{value:`__none__`,children:i(`providerModelThinkingDefaultNone`)}),r.map(e=>(0,P.jsx)(b,{value:e,children:g(e)},e))]})]}),r.length===0?(0,P.jsx)(`p`,{className:`text-xs text-gray-500`,children:i(`providerModelThinkingNoSupported`)}):null]})]})]}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>d(e),className:`inline-flex h-5 w-5 items-center justify-center rounded-full text-gray-400 opacity-100 transition-opacity hover:bg-gray-100 hover:text-gray-600 md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,"aria-label":i(`remove`),children:(0,P.jsx)(w,{className:`h-3 w-3`})})]},e)})})]})}function qe(e){return e.enabled?(0,P.jsx)(T,{status:e.apiKeySet?`ready`:`setup`,label:e.apiKeySet?i(`statusReady`):i(`statusSetup`),className:e.className}):(0,P.jsx)(T,{status:`inactive`,label:i(`disabled`),className:e.className})}function Je({providerName:e,onProviderDeleted:n}){let r=u(),{data:a}=oe(),{data:o}=ce(),{data:d}=ae(),p=te(),m=ne(),h=re(),g=ie(),_=se(),v=le(),[y,b]=(0,N.useState)(``),[x,S]=(0,N.useState)(!0),[C,w]=(0,N.useState)(``),[T,ee]=(0,N.useState)(null),[E,ue]=(0,N.useState)(`auto`),[D,O]=(0,N.useState)([]),[k,A]=(0,N.useState)({}),[he,j]=(0,N.useState)(``),[M,ye]=(0,N.useState)(``),[xe,Se]=(0,N.useState)(!1),[Ce,Te]=(0,N.useState)(!1),[Ee,F]=(0,N.useState)(null),[Pe,R]=(0,N.useState)(``),[ze,Je]=(0,N.useState)(``),z=(0,N.useRef)(null),B=o?.providers.find(t=>t.name===e),V=(e?a?.providers[e]:null)??Ae,Ye=d?.uiHints,H=!!B?.isCustom,Xe=e?fe(`providers.${e}.apiKey`,Ye):void 0,Ze=e?fe(`providers.${e}.apiBase`,Ye):void 0,Qe=e?fe(`providers.${e}.extraHeaders`,Ye):void 0,$e=e?fe(`providers.${e}.wireApi`,Ye):void 0,et=B?.displayName||e||``,U=(V.displayName||``).trim()||et,W=V.enabled!==!1,tt=M.trim()||U||e||i(`providersSelectPlaceholder`),G=(0,N.useMemo)(()=>Ne([B?.modelPrefix||e||``,e||``]),[e,B?.modelPrefix]),nt=B?.defaultApiBase||``,rt=V.apiBase||nt,it=I(V.extraHeaders||null),at=V.wireApi||B?.defaultWireApi||`auto`,ot=(0,N.useMemo)(()=>Ne((B?.defaultModels??[]).map(e=>L(e,G))),[B?.defaultModels,G]),st=(0,N.useMemo)(()=>Ne((V.models??[]).map(e=>L(e,G))),[V.models,G]),K=(0,N.useMemo)(()=>Ie(ot,st),[ot,st]),q=(0,N.useMemo)(()=>Ve(Be(V.modelThinking,G),K),[K,G,V.modelThinking]),J=t(),ct=B?.apiBaseHelp?.[J]||B?.apiBaseHelp?.en||Ze?.help||i(`providerApiBaseHelp`),Y=B?.auth,X=Y?.methods??[],Z=!!B?.supportsWireApi||H,lt=(0,N.useMemo)(()=>X.map(e=>({value:e.id,label:e.label?.[J]||e.label?.en||e.id})),[X,J]),ut=(0,N.useMemo)(()=>We({providerName:e,methods:X,defaultMethodId:Y?.defaultMethodId,language:J}),[e,Y?.defaultMethodId,X,J]),Q=(0,N.useMemo)(()=>{if(!X.length)return``;let e=ze.trim();return e&&X.some(t=>t.id===e)?e:ut||X[0]?.id||``},[ze,ut,X]),dt=(0,N.useMemo)(()=>X.find(e=>e.id===Q),[X,Q]),ft=Ge({required:Y?.kind===`device_code`,hasDefault:!!Y?.defaultMethodId?.trim(),optionCount:X.length}),pt=(B?.wireApiOptions||[`auto`,`chat`,`responses`]).map(e=>({value:e,label:i(e===`chat`?`wireApiChat`:e===`responses`?`wireApiResponses`:`wireApiAuto`)})),mt=Ge({required:Z,hasDefault:typeof B?.defaultWireApi==`string`&&B.defaultWireApi.length>0,optionCount:pt.length}),$=(0,N.useCallback)(()=>{z.current!==null&&(window.clearTimeout(z.current),z.current=null)},[]),ht=(0,N.useCallback)((t,n)=>{$(),z.current=window.setTimeout(()=>{(async()=>{if(e)try{let a=await _.mutateAsync({provider:e,data:{sessionId:t}});if(a.status===`pending`){R(i(`providerAuthWaitingBrowser`)),ht(t,a.nextPollMs??n);return}if(a.status===`authorized`){F(null),$(),R(i(`providerAuthCompleted`)),s.success(i(`providerAuthCompleted`)),r.invalidateQueries({queryKey:[`config`]}),r.invalidateQueries({queryKey:[`config-meta`]});return}F(null),$(),R(a.message||`Authorization ${a.status}.`),s.error(a.message||`Authorization ${a.status}.`)}catch(e){F(null),$();let t=e instanceof Error?e.message:String(e);R(t),s.error(`Authorization failed: ${t}`)}})()},Math.max(1e3,n))},[$,_,e,r]);(0,N.useEffect)(()=>{if(!e){b(``),S(!0),w(``),ee(null),ue(`auto`),O([]),A({}),j(``),ye(``),F(null),R(``),Je(``),$();return}b(``),S(W),w(rt),ee(V.extraHeaders||null),ue(at),O(K),A(q),j(``),ye(U),F(null),R(``),Je(ut),$()},[e,rt,W,V.extraHeaders,at,K,q,U,ut,$]),(0,N.useEffect)(()=>()=>$(),[$]),(0,N.useEffect)(()=>A(e=>Ve(e,D)),[D]);let gt=(0,N.useMemo)(()=>e?y.trim().length>0||x!==W||C.trim()!==rt.trim()||!Me(T,it)||Z&&E!==at||!Fe(D,K)||!He(k,q)||H&&M.trim()!==U:!1,[e,y,x,W,C,rt,T,it,Z,E,at,D,K,k,q,H,M,U]);return!e||!B?(0,P.jsx)(ge,{children:(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h3`,{className:`text-base font-semibold text-gray-900`,children:i(`providersSelectTitle`)}),(0,P.jsx)(`p`,{className:`mt-2 text-sm text-gray-500`,children:i(`providersSelectDescription`)})]})}):(0,P.jsxs)(pe,{children:[(0,P.jsx)(me,{className:`px-6 py-4`,children:(0,P.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,P.jsx)(`h3`,{className:`truncate text-lg font-semibold text-gray-900`,children:tt}),(0,P.jsxs)(`div`,{className:`flex items-center gap-3`,children:[H&&(0,P.jsx)(`button`,{type:`button`,onClick:async()=>{if(!(!e||!H)&&window.confirm(i(`providerDeleteConfirm`)))try{await m.mutateAsync({provider:e}),n?.(e)}catch{}},disabled:m.isPending,className:`text-gray-400 transition-colors hover:text-red-500`,title:i(`providerDelete`),children:(0,P.jsx)(de,{className:`h-4 w-4`})}),(0,P.jsx)(qe,{enabled:W,apiKeySet:V.apiKeySet})]})]})}),(0,P.jsxs)(`form`,{onSubmit:t=>{if(t.preventDefault(),!e)return;let n={},r=y.trim(),i=C.trim(),a=I(T),o=M.trim();H&&o!==U&&(n.displayName=o.length>0?o:null),r.length>0&&(n.apiKey=r),Re(n,x,W),i!==rt.trim()&&(n.apiBase=i.length>0&&i!==nt?i:null),Me(a,it)||(n.extraHeaders=a),Z&&E!==at&&(n.wireApi=E),Fe(D,K)||(n.models=Le(D,ot)),He(k,q)||(n.modelThinking=Ve(k,D)),p.mutate({provider:e,data:n})},className:`flex min-h-0 flex-1 flex-col`,children:[(0,P.jsxs)(_e,{className:`space-y-5 px-6 py-5`,children:[(0,P.jsx)(ke,{enabled:x,onChange:S}),H&&(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(f,{htmlFor:`providerDisplayName`,className:`text-sm font-medium text-gray-900`,children:i(`providerDisplayName`)}),(0,P.jsx)(c,{id:`providerDisplayName`,type:`text`,value:M,onChange:e=>ye(e.target.value),placeholder:et||i(`providerDisplayNamePlaceholder`),className:`rounded-xl`}),(0,P.jsx)(`p`,{className:`text-xs text-gray-500`,children:i(`providerDisplayNameHelpShort`)})]}),(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(f,{htmlFor:`apiKey`,className:`text-sm font-medium text-gray-900`,children:Xe?.label??i(`apiKey`)}),(0,P.jsx)(we,{id:`apiKey`,value:y,isSet:V.apiKeySet,onChange:e=>b(e.target.value),placeholder:Xe?.placeholder??i(`enterApiKey`),className:`rounded-xl`}),(0,P.jsx)(`p`,{className:`text-xs text-gray-500`,children:i(`leaveBlankToKeepUnchanged`)})]}),(0,P.jsx)(Oe,{providerAuth:Y,providerAuthNote:Y?.note?.[J]||Y?.note?.en||Y?.displayName||``,providerAuthMethodOptions:lt,providerAuthMethodsCount:X.length,selectedAuthMethodHint:dt?.hint?.[J]||dt?.hint?.en||``,shouldUseAuthMethodPills:ft,resolvedAuthMethodId:Q,onAuthMethodChange:Je,onStartProviderAuth:async()=>{if(!(!e||Y?.kind!==`device_code`))try{R(``);let t=await g.mutateAsync({provider:e,data:Q?{methodId:Q}:{}});if(!t.sessionId||!t.verificationUri)throw Error(i(`providerAuthStartFailed`));F(t.sessionId),R(`${i(`providerAuthOpenPrompt`)}${t.userCode}${i(`providerAuthOpenPromptSuffix`)}`),window.open(t.verificationUri,`_blank`,`noopener,noreferrer`),ht(t.sessionId,t.intervalMs)}catch(e){let t=e instanceof Error?e.message:String(e);F(null),$(),R(t),s.error(`${i(`providerAuthStartFailed`)}: ${t}`)}},onImportProviderAuthFromCli:async()=>{if(!(!e||Y?.kind!==`device_code`))try{$(),F(null);let t=await v.mutateAsync({provider:e});R(`${i(`providerAuthImportStatusPrefix`)}${t.expiresAt?` (expires: ${t.expiresAt})`:``}`),s.success(i(`providerAuthImportSuccess`)),r.invalidateQueries({queryKey:[`config`]}),r.invalidateQueries({queryKey:[`config-meta`]})}catch(e){let t=e instanceof Error?e.message:String(e);R(t),s.error(`${i(`providerAuthImportFailed`)}: ${t}`)}},startPending:g.isPending,importPending:v.isPending,authSessionId:Ee,authStatusMessage:Pe}),(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(f,{htmlFor:`apiBase`,className:`text-sm font-medium text-gray-900`,children:Ze?.label??i(`apiBase`)}),(0,P.jsx)(c,{id:`apiBase`,type:`text`,value:C,onChange:e=>w(e.target.value),placeholder:nt||Ze?.placeholder||`https://api.example.com`,className:`rounded-xl`}),(0,P.jsx)(`p`,{className:`text-xs text-gray-500`,children:ct})]}),(0,P.jsx)(Ke,{models:D,modelThinking:k,modelDraft:he,showModelInput:Ce,onModelDraftChange:j,onShowModelInputChange:Te,onAddModel:()=>{let e=L(he,G);if(e){if(D.includes(e)){j(``);return}O(t=>[...t,e]),j(``)}},onRemoveModel:e=>{O(t=>t.filter(t=>t!==e)),A(t=>{let n={...t};return delete n[e],n})},onToggleModelThinkingLevel:(e,t)=>{A(n=>{let r=n[e],i=r?.supported??[],a=i.includes(t)?i.filter(e=>e!==t):je.filter(e=>e===t||i.includes(e));if(a.length===0){let t={...n};return delete t[e],t}let o=r?.default&&a.includes(r.default)?r.default:void 0;return{...n,[e]:o?{supported:a,default:o}:{supported:a}}})},onSetModelThinkingDefault:(e,t)=>{A(n=>{let r=n[e];return!r||r.supported.length===0||t&&!r.supported.includes(t)?n:{...n,[e]:t?{supported:r.supported,default:t}:{supported:r.supported}}})},thinkingLevels:je,formatThinkingLevelLabel:Ue}),(0,P.jsx)(De,{showAdvanced:xe,onShowAdvancedChange:Se,supportsWireApi:Z,wireApiLabel:$e?.label??i(`wireApi`),wireApi:E,onWireApiChange:ue,shouldUseWireApiPills:mt,wireApiSelectOptions:pt,extraHeadersLabel:Qe?.label??i(`extraHeaders`),extraHeaders:T,onExtraHeadersChange:ee})]}),(0,P.jsxs)(ve,{className:`flex items-center justify-between px-6 py-4`,children:[(0,P.jsxs)(l,{type:`button`,variant:`outline`,size:`sm`,onClick:async()=>{if(!e)return;let t=L(D.find(e=>e.trim().length>0)??``,G),n={apiBase:C.trim(),extraHeaders:I(T),model:t||null};y.trim().length>0&&(n.apiKey=y.trim()),Z&&(n.wireApi=E);try{let t=await h.mutateAsync({provider:e,data:n});if(t.success){s.success(`${i(`providerTestConnectionSuccess`)} (${t.latencyMs}ms)`);return}let r=[`provider=${t.provider}`,`latency=${t.latencyMs}ms`];t.model&&r.push(`model=${t.model}`),s.error(`${i(`providerTestConnectionFailed`)}: ${t.message} | ${r.join(` | `)}`)}catch(e){let t=e instanceof Error?e.message:String(e);s.error(`${i(`providerTestConnectionFailed`)}: ${t}`)}},disabled:h.isPending,children:[(0,P.jsx)(be,{className:`mr-1.5 h-4 w-4`}),h.isPending?i(`providerTestingConnection`):i(`providerTestConnection`)]}),(0,P.jsx)(l,{type:`submit`,disabled:p.isPending||!gt,children:p.isPending?i(`saving`):i(gt?`save`:`unchanged`)})]})]})]})}function z(e){if(!e)return null;try{let t=new URL(e);return`${t.host}${t.pathname&&t.pathname!==`/`?t.pathname:``}`}catch{return e.replace(/^https?:\/\//,``)}}function B(e){return e.map((e,t)=>({provider:e,index:t})).sort((e,t)=>{let n=e.provider.name===`nextclaw`?1:0,r=t.provider.name===`nextclaw`?1:0;return n===r?e.index-t.index:n-r}).map(({provider:e})=>e)}function V(){let{isMobile:e}=O(),{data:t}=oe(),{data:n}=ce(),{data:r}=ae(),s=ee(),[u,d]=(0,N.useState)(`installed`),[f,m]=(0,N.useState)(null),[g,_]=(0,N.useState)(``),v=(0,N.useMemo)(()=>B(n?.providers??[]),[n?.providers]),y=t?.providers??{},b=(0,N.useMemo)(()=>{let e=g.trim().toLowerCase();return v.filter(e=>u!==`installed`||!!(y[e.name]?.enabled!==!1&&y[e.name]?.apiKeySet)).filter(t=>e?(y[t.name]?.displayName?.trim()||t.displayName||t.name).toLowerCase().includes(e)||t.name.toLowerCase().includes(e):!0)},[u,v,y,g]),x=(0,N.useMemo)(()=>f&&b.some(e=>e.name===f)?f:e?null:b[0]?.name??null,[b,e,f]);return!t||!n?(0,P.jsx)(`div`,{className:`p-8`,children:i(`providersLoading`)}):(0,P.jsxs)(o,{className:`pb-0 xl:flex xl:h-full xl:min-h-0 xl:flex-col`,children:[(0,P.jsx)(p,{title:i(`providersPageTitle`),description:i(`providersPageDescription`)}),(0,P.jsxs)(he,{className:`xl:min-h-0`,mobileView:e?x?`detail`:`list`:void 0,onMobileBack:()=>m(null),mobileListLabel:i(`providersPageTitle`),children:[(0,P.jsxs)(pe,{children:[(0,P.jsxs)(me,{className:`space-y-3 px-4 pb-3 pt-4`,children:[(0,P.jsx)(A,{tabs:[{id:`installed`,label:i(`providersTabConfigured`),count:v.filter(e=>y[e.name]?.enabled!==!1&&y[e.name]?.apiKeySet).length},{id:`all`,label:i(`providersTabAll`),count:v.length}],activeTab:u,onChange:d,className:`mb-0`}),(0,P.jsxs)(l,{type:`button`,variant:`outline`,className:`w-full justify-center`,onClick:async()=>{try{let e=await s.mutateAsync({data:{}});d(`all`),_(``),m(e.name)}catch{}},disabled:s.isPending,children:[(0,P.jsx)(C,{className:`mr-2 h-4 w-4`}),s.isPending?i(`saving`):i(`providerAddCustom`)]})]}),(0,P.jsx)(`div`,{className:`border-b border-gray-100 px-4 py-3`,children:(0,P.jsxs)(`div`,{className:`relative`,children:[(0,P.jsx)(h,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400`}),(0,P.jsx)(c,{value:g,onChange:e=>_(e.target.value),placeholder:i(`providersFilterPlaceholder`),className:`h-10 rounded-xl pl-9`})]})}),(0,P.jsxs)(_e,{className:`space-y-2 p-3`,children:[b.map(e=>{let t=y[e.name],n=t?.enabled!==!1,o=!!(n&&t?.apiKeySet),s=t?.displayName?.trim()||e.displayName||e.name,c=z(t?.apiBase||e.defaultApiBase||``)||fe(`providers.${e.name}`,r?.uiHints)?.help||i(`providersDefaultDescription`);return(0,P.jsx)(M,{onClick:()=>m(e.name),active:x===e.name,children:(0,P.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,P.jsx)(k,{name:e.name,src:e.logo?`/logos/${e.logo}`:null,className:a(`h-10 w-10 rounded-lg border`,o?`border-primary/30 bg-white`:`border-gray-200/70 bg-white`),imgClassName:`h-5 w-5 object-contain`,fallback:(0,P.jsx)(`span`,{className:`text-sm font-semibold uppercase text-gray-500`,children:e.name[0]})}),(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`p`,{className:`truncate text-sm font-semibold text-gray-900`,children:s}),(0,P.jsx)(`p`,{className:`line-clamp-1 text-[11px] text-gray-500`,children:c})]})]}),(0,P.jsx)(T,{status:n?o?`ready`:`setup`:`inactive`,label:i(n?o?`statusReady`:`statusSetup`:`disabled`),className:`min-w-[56px] justify-center`})]})},e.name)}),b.length===0?(0,P.jsx)(j,{icon:S,title:i(`providersNoMatch`)}):null]})]}),(0,P.jsx)(Je,{providerName:x??void 0,onProviderDeleted:e=>{e===x&&m(null)}})]})]})}export{V as ProvidersList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,m as t,p as n,r}from"./i18n-D1144VAA.js";import{At as i,Dt as a,Et as o,Lt as s,Mt as c,Nt as l,Ot as u,Tt as d,_t as f,ft as p,ht as m,kt as h,wt as g,xt as _,yt as v}from"./api-DGD9_Bg4.js";import{t as y}from"./createLucideIcon-DzY6wN61.js";import{b,l as x,x as S}from"./desktop-DVUbOWbR.js";import{a as C,i as w,n as T,r as E,t as D}from"./select-BUTwE_lC.js";import{t as ee}from"./play-AqrNslHI.js";import{t as O}from"./plus-B-YHtTNC.js";import{t as te}from"./rotate-cw-BN9yjccP.js";import{t as ne}from"./save-CO_4qf6b.js";import{t as k}from"./notice-card-Dr6xCwva.js";import{n as A,x as j}from"./use-config-Cyv5IuSt.js";import{Q as M,X as N}from"./index-Cuwst6cc.js";import{t as P}from"./setting-row-BavcnXw1.js";var re=y(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),F=e(t(),1),I=n(),L={healthy:`runtimeControlHealthy`,"starting-service":`runtimeControlStartingService`,"restarting-service":`runtimeControlRestartingService`,"stopping-service":`runtimeControlStoppingService`,"restarting-app":`runtimeControlRestartingApp`,recovering:`runtimeControlRecovering`,failed:`runtimeControlFailed`},R={running:`runtimeControlServiceRunning`,stopped:`runtimeControlServiceStopped`,starting:`runtimeControlServiceStarting`,stopping:`runtimeControlServiceStopping`,restarting:`runtimeControlServiceRestarting`},z={"desktop-embedded":`runtimeControlEnvironmentDesktop`,"managed-local-service":`runtimeControlEnvironmentManagedService`,"self-hosted-web":`runtimeControlEnvironmentSelfHosted`,"shared-web":`runtimeControlEnvironmentSharedWeb`};function B(e){return r(L[e]??`runtimeControlUnavailable`)}function V(e){return r(R[e]??`runtimeControlServiceUnknown`)}function H(e){return r(z[e.environment])}function U(e,t){return t===`start-service`?e?.canStartService:t===`stop-service`?e?.canStopService:e?.canRestartService}function W(e){return e?[{action:`start-service`,capability:e.canStartService,label:r(`runtimeControlStartService`),icon:`play`},{action:`restart-service`,capability:e.canRestartService,label:r(`runtimeControlRestartService`),icon:`rotate`},{action:`stop-service`,capability:e.canStopService,label:r(`runtimeControlStopService`),icon:`square`,variant:`destructive`},{action:`restart-app`,capability:e.canRestartApp,label:r(`runtimeControlRestartApp`),icon:`rotate`,variant:`secondary`}].filter(e=>e.capability.available||!!e.capability.reasonIfUnavailable):[]}function G(e){let{busy:t,icon:n}=e;return t?(0,I.jsx)(M,{className:`mr-2 h-4 w-4 animate-spin`}):n===`play`?(0,I.jsx)(ee,{className:`mr-2 h-4 w-4`}):n===`square`?(0,I.jsx)(re,{className:`mr-2 h-4 w-4`}):(0,I.jsx)(te,{className:`mr-2 h-4 w-4`})}function K(){let{busy:e,busyAction:t,controlView:n,errorMessage:i,pendingRestart:c,visibleLifecycle:f,visibleMessage:p,visibleServiceState:h}=m(),y=W(n??void 0),b=async e=>{let t=U(n,e);if(!t?.available){s.error(_(t?.reasonIfUnavailable)??r(`runtimeControlLoadFailed`));return}if(!(e===`stop-service`&&t.requiresConfirmation&&!window.confirm(r(`runtimeControlStopServiceConfirm`))))try{let t=await v.runRuntimeControlAction(e);s.success(_(t.message)??t.message)}catch(e){let t=e instanceof Error?e.message:r(`runtimeControlActionFailed`);s.error(`${r(`runtimeControlActionFailed`)}: ${t}`)}},x=async()=>{if(!n?.canRestartApp.available){s.error(_(n?.canRestartApp.reasonIfUnavailable)??r(`runtimeRestartAppUnavailable`));return}if(window.confirm(r(`runtimeControlRestartAppConfirm`)))try{let e=await v.runRuntimeControlAction(`restart-app`);s.success(_(e.message)??e.message)}catch(e){let t=e instanceof Error?e.message:r(`runtimeControlActionFailed`);s.error(`${r(`runtimeControlActionFailed`)}: ${t}`)}};return(0,I.jsxs)(g,{children:[(0,I.jsxs)(a,{children:[(0,I.jsx)(u,{children:r(`runtimeControlTitle`)}),(0,I.jsx)(o,{children:r(`runtimeControlDescription`)})]}),(0,I.jsxs)(d,{className:`space-y-4`,children:[(0,I.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-gray-200 bg-gray-50 p-4`,children:[(0,I.jsxs)(`div`,{className:`flex flex-col gap-1 md:flex-row md:items-center md:justify-between`,children:[(0,I.jsx)(`div`,{className:`text-sm font-medium text-gray-900`,children:V(h)}),(0,I.jsx)(`div`,{className:`text-xs text-gray-500`,children:n?H(n):r(`runtimeControlLoading`)})]}),(0,I.jsx)(`p`,{className:`text-sm text-gray-600`,children:p}),(0,I.jsx)(`div`,{className:`text-xs text-gray-500`,children:B(f)}),n?.managementHint?(0,I.jsx)(`p`,{className:`text-xs text-gray-500`,children:_(n.managementHint)}):null,i&&!e?(0,I.jsx)(`p`,{className:`text-sm text-amber-700`,children:i}):null]}),c?(0,I.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-amber-200 bg-amber-50 p-4`,children:[(0,I.jsx)(`div`,{className:`text-sm font-medium text-amber-900`,children:r(`runtimeControlPendingRestartTitle`)}),(0,I.jsx)(`p`,{className:`text-sm text-amber-800`,children:r(`runtimeControlPendingRestartDescription`)}),c.changedPaths.length>0?(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(`div`,{className:`text-xs font-medium uppercase tracking-[0.08em] text-amber-700`,children:r(`runtimeControlPendingRestartPaths`)}),(0,I.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:c.changedPaths.map(e=>(0,I.jsx)(`span`,{className:`rounded-full border border-amber-200 bg-white px-2.5 py-1 text-xs text-amber-800`,children:e},e))})]}):null]}):null,(0,I.jsx)(`div`,{className:`flex flex-col gap-3 md:flex-row md:flex-wrap`,children:y.map(n=>(0,I.jsxs)(l,{type:`button`,variant:n.variant??`default`,onClick:()=>{if(n.action===`restart-app`){x();return}b(n.action)},disabled:!n.capability.available||e,children:[(0,I.jsx)(G,{icon:n.icon,busy:t===n.action}),n.label]},n.action))}),y.filter(e=>!e.capability.available&&e.capability.reasonIfUnavailable).map(e=>(0,I.jsx)(`p`,{className:`text-xs text-gray-500`,children:_(e.capability.reasonIfUnavailable)},`${e.action}-reason`))]})]})}function q(e){let{description:t,title:n}=e;return(0,I.jsx)(k,{tone:`neutral`,title:n,description:t})}function J(e){let{children:t}=e;return(0,I.jsxs)(g,{children:[(0,I.jsxs)(a,{children:[(0,I.jsx)(u,{children:r(`runtimePresenceTitle`)}),(0,I.jsx)(o,{children:r(`runtimePresenceDescription`)})]}),(0,I.jsx)(d,{children:t})]})}function Y(){let e=f().runtimeControlView?.environment,t=S(e=>e.supported),n=S(e=>e.initialized),i=S(e=>e.busyAction),a=S(e=>e.snapshot);return(0,F.useEffect)(()=>{if(e===`desktop-embedded`){b.start();return}b.markUnsupported()},[e]),e===`desktop-embedded`?(0,I.jsx)(J,{children:(0,I.jsxs)(`div`,{className:`space-y-4`,children:[(0,I.jsx)(k,{tone:`neutral`,title:r(`runtimePresenceBehaviorLabel`),description:a?.closeToBackground?r(`runtimePresenceBehaviorBackground`):r(`runtimePresenceBehaviorQuit`),className:`rounded-xl`}),!n||t&&!a?(0,I.jsx)(`p`,{className:`text-sm text-gray-500`,children:r(`runtimePresenceLoading`)}):null,a?(0,I.jsxs)(`div`,{className:`space-y-4`,children:[(0,I.jsx)(P,{title:r(`runtimePresenceCloseToBackground`),description:r(`runtimePresenceCloseToBackgroundHelp`),control:(0,I.jsx)(p,{id:`runtime-presence-close-background`,"aria-label":r(`runtimePresenceCloseToBackground`),checked:a.closeToBackground,disabled:i===`saving-preferences`,onCheckedChange:e=>{b.updatePreferences({closeToBackground:e})}})}),(0,I.jsx)(P,{title:r(`runtimePresenceLaunchAtLogin`),description:a.supportsLaunchAtLogin?r(`runtimePresenceLaunchAtLoginHelp`):a.launchAtLoginReason??r(`runtimePresenceLaunchAtLoginUnavailable`),control:(0,I.jsx)(p,{id:`runtime-presence-launch-login`,"aria-label":r(`runtimePresenceLaunchAtLogin`),checked:a.launchAtLogin,disabled:!a.supportsLaunchAtLogin||i===`saving-preferences`,onCheckedChange:e=>{b.updatePreferences({launchAtLogin:e})}})})]}):null]})}):e===`managed-local-service`?(0,I.jsx)(J,{children:(0,I.jsx)(q,{title:r(`runtimePresenceManagedLocalTitle`),description:r(`runtimePresenceManagedLocalDescription`)})}):e===`self-hosted-web`?(0,I.jsx)(J,{children:(0,I.jsx)(q,{title:r(`runtimePresenceSelfHostedTitle`),description:r(`runtimePresenceSelfHostedDescription`)})}):e===`shared-web`?(0,I.jsx)(J,{children:(0,I.jsx)(q,{title:r(`runtimePresenceSharedTitle`),description:r(`runtimePresenceSharedDescription`)})}):(0,I.jsx)(J,{children:(0,I.jsx)(`p`,{className:`text-sm text-gray-500`,children:r(`runtimePresenceLoading`)})})}function X(){return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(h,{title:r(`runtimePageTitle`),description:r(`runtimePageDescription`)}),(0,I.jsx)(K,{}),(0,I.jsx)(Y,{}),(0,I.jsx)(x,{})]})}var Z={wireDialect:`acp`,processScope:`per-session`,command:``,args:[`acp`],env:{},cwd:``,startupTimeoutMs:8e3,probeTimeoutMs:3e3,requestTimeoutMs:12e4};function ie(){return{id:``,default:!1,workspace:``,model:``,runtime:``,contextTokens:void 0,maxToolIterations:void 0}}function ae(){return{agentId:``,match:{channel:``,accountId:``}}}function oe(){return{id:``,enabled:!0,label:``,type:`narp-stdio`,config:Z,configText:JSON.stringify(Z,null,2)}}function se(e){return{id:e.id??``,default:!!e.default,displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,workspace:e.workspace??``,model:e.model??``,runtime:e.runtime??e.engine??``,contextTokens:e.contextTokens,maxToolIterations:e.maxToolIterations}}function Q(e){return{agentId:e.agentId??``,match:{channel:e.match?.channel??``,accountId:e.match?.accountId??``,peer:e.match?.peer?{kind:e.match.peer.kind,id:e.match.peer.id}:void 0}}}function $(e){let t=e.trim();if(!t)return;let n=Number.parseInt(t,10);return Number.isFinite(n)?n:void 0}function ce(e){return{companionEnabled:e.companion?.enabled===!0,agents:(e.agents.list??[]).map(se),bindings:(e.bindings??[]).map(Q),runtimeEntries:Object.entries(e.agents.runtimes?.entries??{}).map(([e,t])=>({id:e,enabled:t.enabled!==!1,label:t.label??``,type:t.type,config:t.config??{},configText:JSON.stringify(t.config??{},null,2)})),dmScope:e.session?.dmScope??`per-channel-peer`,defaultContextTokens:e.agents.defaults.contextTokens??2e5,defaultEngine:e.agents.defaults.engine??`native`}}function le(e){let t={id:e.id.trim()};e.default&&(t.default=!0),e.displayName?.trim()&&(t.displayName=e.displayName.trim()),e.description?.trim()&&(t.description=e.description.trim()),e.avatar?.trim()&&(t.avatar=e.avatar.trim()),e.workspace?.trim()&&(t.workspace=e.workspace.trim()),e.model?.trim()&&(t.model=e.model.trim());let n=e.runtime?.trim()??e.engine?.trim();return n&&(t.engine=n),typeof e.contextTokens==`number`&&(t.contextTokens=Math.max(1e3,e.contextTokens)),typeof e.maxToolIterations==`number`&&(t.maxToolIterations=e.maxToolIterations),t}function ue(e){let t=e.agents.map((e,t)=>{if(!e.id.trim())throw Error(r(`agentIdRequiredError`).replace(`{index}`,String(t)));return le(e)}),n=t.map(e=>e.id).filter((e,t,n)=>n.indexOf(e)!==t);if(n.length>0)throw Error(`${r(`duplicateAgentId`)}: ${n[0]}`);let i=e.bindings.map((t,n)=>{let i=t.agentId.trim(),a=t.match.channel.trim(),o=t.match.accountId?.trim()??``,s=t.match.peer?.kind,c=t.match.peer?.id?.trim()??``;if(!i)throw Error(r(`bindingAgentIdRequired`).replace(`{index}`,String(n)));if(!e.knownAgentIds.has(i))throw Error(`${r(`bindingAgentIdNotFound`).replace(`{index}`,String(n))}: ${i}`);if(!a)throw Error(r(`bindingChannelRequired`).replace(`{index}`,String(n)));let l={agentId:i,match:{channel:a}};if(o&&(l.match.accountId=o),s){if(!c)throw Error(r(`bindingPeerIdRequired`).replace(`{index}`,String(n)));l.match.peer={kind:s,id:c}}return l}),a=e.runtimeEntries.reduce((e,t,n)=>{let i=t.id.trim(),a=t.type.trim();if(!i)throw Error(r(`runtimeEntryIdRequired`).replace(`{index}`,String(n)));if(!a)throw Error(r(`runtimeEntryTypeRequired`).replace(`{id}`,i));if(e[i])throw Error(`${r(`runtimeEntryDuplicate`)}: ${i}`);let o=t.configText.trim()?JSON.parse(t.configText):{};if(o&&(typeof o!=`object`||Array.isArray(o)))throw Error(r(`runtimeEntryConfigObjectRequired`).replace(`{id}`,i));return e[i]={enabled:t.enabled!==!1,...t.label?.trim()?{label:t.label.trim()}:{},type:a,config:o??{}},e},{});return{companion:{enabled:e.companionEnabled},agents:{defaults:{contextTokens:Math.max(1e3,e.defaultContextTokens),engine:e.defaultEngine.trim()||`native`},list:t,runtimes:{entries:a}},bindings:i,session:{dmScope:e.dmScope}}}function de(e){return(0,I.jsxs)(g,{children:[(0,I.jsxs)(a,{children:[(0,I.jsx)(u,{children:r(`agentList`)}),(0,I.jsx)(o,{children:r(`agentListHelp`)})]}),(0,I.jsxs)(d,{className:`space-y-3`,children:[e.agents.map((t,n)=>(0,I.jsxs)(`div`,{className:`rounded-xl border border-gray-200 p-3 space-y-3`,children:[(0,I.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,I.jsx)(c,{value:t.id,onChange:t=>e.onUpdateAgent(n,{id:t.target.value}),placeholder:r(`agentIdPlaceholder`)}),(0,I.jsx)(c,{value:t.workspace??``,onChange:t=>e.onUpdateAgent(n,{workspace:t.target.value}),placeholder:r(`workspaceOverridePlaceholder`)}),(0,I.jsx)(c,{value:t.model??``,onChange:t=>e.onUpdateAgent(n,{model:t.target.value}),placeholder:r(`modelOverridePlaceholder`)}),(0,I.jsx)(c,{value:t.runtime??t.engine??``,onChange:t=>e.onUpdateAgent(n,{runtime:t.target.value}),placeholder:r(`engineOverridePlaceholder`)}),(0,I.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2`,children:[(0,I.jsx)(c,{type:`number`,min:1e3,step:1e3,value:t.contextTokens??``,onChange:t=>e.onUpdateAgent(n,{contextTokens:$(t.target.value)}),placeholder:r(`contextTokensPlaceholder`)}),(0,I.jsx)(c,{type:`number`,min:1,value:t.maxToolIterations??``,onChange:t=>e.onUpdateAgent(n,{maxToolIterations:$(t.target.value)}),placeholder:r(`maxToolsPlaceholder`)})]})]}),(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-gray-600`,children:[(0,I.jsx)(p,{checked:!!t.default,onCheckedChange:t=>e.onSetDefaultAgent(n,t)}),(0,I.jsx)(`span`,{children:r(`defaultAgent`)})]}),(0,I.jsxs)(l,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e.onRemoveAgent(n),children:[(0,I.jsx)(N,{className:`h-4 w-4 mr-1`}),r(`remove`)]})]})]},`${n}-${t.id}`)),(0,I.jsxs)(l,{type:`button`,variant:`outline`,onClick:e.onAddAgent,children:[(0,I.jsx)(O,{className:`h-4 w-4 mr-2`}),r(`addAgent`)]})]})]})}function fe(e){return(0,I.jsxs)(g,{children:[(0,I.jsxs)(a,{children:[(0,I.jsx)(u,{children:r(`bindings`)}),(0,I.jsx)(o,{children:r(`bindingsHelp`)})]}),(0,I.jsxs)(d,{className:`space-y-3`,children:[e.bindings.map((t,n)=>{let i=t.match.peer?.kind??``;return(0,I.jsxs)(`div`,{className:`rounded-xl border border-gray-200 p-3 space-y-3`,children:[(0,I.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,I.jsx)(c,{value:t.agentId,onChange:r=>e.onUpdateBinding(n,{...t,agentId:r.target.value}),placeholder:r(`targetAgentIdPlaceholder`)}),(0,I.jsx)(c,{value:t.match.channel,onChange:r=>e.onUpdateBinding(n,{...t,match:{...t.match,channel:r.target.value}}),placeholder:r(`channelPlaceholder`)}),(0,I.jsx)(c,{value:t.match.accountId??``,onChange:r=>e.onUpdateBinding(n,{...t,match:{...t.match,accountId:r.target.value}}),placeholder:r(`accountIdOptionalPlaceholder`)}),(0,I.jsxs)(D,{value:i||`__none__`,onValueChange:r=>{let i=r===`__none__`?``:r;e.onUpdateBinding(n,i?{...t,match:{...t.match,peer:{kind:i,id:t.match.peer?.id??``}}}:{...t,match:{...t.match,peer:void 0}})},children:[(0,I.jsx)(w,{children:(0,I.jsx)(C,{})}),(0,I.jsxs)(T,{children:[(0,I.jsx)(E,{value:`__none__`,children:r(`peerKindOptional`)}),(0,I.jsx)(E,{value:`direct`,children:r(`peerKindDirect`)}),(0,I.jsx)(E,{value:`group`,children:r(`peerKindGroup`)}),(0,I.jsx)(E,{value:`channel`,children:r(`peerKindChannel`)})]})]}),(0,I.jsx)(c,{value:t.match.peer?.id??``,onChange:r=>e.onUpdateBinding(n,{...t,match:{...t.match,peer:i?{kind:i,id:r.target.value}:void 0}}),placeholder:r(`peerIdPlaceholder`)})]}),(0,I.jsx)(`div`,{className:`flex justify-end`,children:(0,I.jsxs)(l,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e.onRemoveBinding(n),children:[(0,I.jsx)(N,{className:`h-4 w-4 mr-1`}),r(`remove`)]})})]},`${n}-${t.agentId}`)}),(0,I.jsxs)(l,{type:`button`,variant:`outline`,onClick:e.onAddBinding,children:[(0,I.jsx)(O,{className:`h-4 w-4 mr-2`}),r(`addBinding`)]})]})]})}function pe(e){return(0,I.jsxs)(g,{children:[(0,I.jsxs)(a,{children:[(0,I.jsx)(u,{children:r(`runtimeEntries`)}),(0,I.jsx)(o,{children:r(`runtimeEntriesHelp`)})]}),(0,I.jsxs)(d,{className:`space-y-3`,children:[e.entries.map((t,n)=>(0,I.jsxs)(`div`,{className:`rounded-xl border border-gray-200 p-3 space-y-3`,children:[(0,I.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,I.jsx)(c,{value:t.id,onChange:t=>e.onUpdateEntry(n,{id:t.target.value}),placeholder:r(`runtimeEntryIdPlaceholder`)}),(0,I.jsx)(c,{value:t.label??``,onChange:t=>e.onUpdateEntry(n,{label:t.target.value}),placeholder:r(`runtimeEntryLabelPlaceholder`)}),(0,I.jsx)(c,{value:t.type,onChange:t=>e.onUpdateEntry(n,{type:t.target.value}),placeholder:r(`runtimeEntryTypePlaceholder`)}),(0,I.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-gray-200 px-3 py-2`,children:[(0,I.jsx)(`span`,{className:`text-sm text-gray-700`,children:r(`enabled`)}),(0,I.jsx)(p,{checked:t.enabled!==!1,onCheckedChange:t=>e.onUpdateEntry(n,{enabled:t})})]})]}),(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:r(`runtimeEntryConfigJson`)}),(0,I.jsx)(`textarea`,{className:`min-h-32 w-full rounded-md border border-gray-200 px-3 py-2 text-sm font-mono`,value:t.configText,onChange:t=>e.onUpdateEntry(n,{configText:t.target.value}),spellCheck:!1})]}),(0,I.jsx)(`div`,{className:`flex justify-end`,children:(0,I.jsxs)(l,{type:`button`,variant:`outline`,onClick:()=>e.onRemoveEntry(n),children:[(0,I.jsx)(N,{className:`mr-2 h-4 w-4`}),r(`delete`)]})})]},`${n}-${t.id||`runtime-entry`}`)),(0,I.jsxs)(l,{type:`button`,variant:`outline`,onClick:e.onAddEntry,children:[(0,I.jsx)(O,{className:`mr-2 h-4 w-4`}),r(`addRuntimeEntry`)]})]})]})}var me=[{value:`main`,labelKey:`dmScopeMain`},{value:`per-peer`,labelKey:`dmScopePerPeer`},{value:`per-channel-peer`,labelKey:`dmScopePerChannelPeer`},{value:`per-account-channel-peer`,labelKey:`dmScopePerAccountChannelPeer`}];function he(e){return(0,I.jsxs)(g,{children:[(0,I.jsxs)(a,{children:[(0,I.jsx)(u,{children:r(`dmScope`)}),(0,I.jsx)(o,{children:r(`dmScopeHelp`)})]}),(0,I.jsxs)(d,{className:`space-y-4`,children:[(0,I.jsxs)(`div`,{className:`flex items-start justify-between gap-4 rounded-md border border-gray-200 px-4 py-3`,children:[(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`div`,{className:`text-sm font-medium text-gray-800`,children:r(`runtimeCompanionEnabled`)}),(0,I.jsx)(`p`,{className:`text-xs text-gray-500`,children:r(`runtimeCompanionEnabledHelp`)})]}),(0,I.jsx)(p,{checked:e.companionEnabled,onCheckedChange:e.onCompanionEnabledChange})]}),(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:r(`defaultContextTokens`)}),(0,I.jsx)(c,{type:`number`,min:1e3,step:1e3,value:e.defaultContextTokens,onChange:t=>e.onDefaultContextTokensChange(Math.max(1e3,Number.parseInt(t.target.value,10)||1e3))}),(0,I.jsx)(`p`,{className:`text-xs text-gray-500`,children:r(`defaultContextTokensHelp`)})]}),(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:r(`defaultEngine`)}),(0,I.jsx)(c,{value:e.defaultEngine,onChange:t=>e.onDefaultEngineChange(t.target.value),placeholder:r(`defaultEnginePlaceholder`)}),(0,I.jsx)(`p`,{className:`text-xs text-gray-500`,children:r(`defaultEngineHelp`)})]}),(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:r(`dmScope`)}),(0,I.jsxs)(D,{value:e.dmScope,onValueChange:t=>e.onDmScopeChange(t),children:[(0,I.jsx)(w,{children:(0,I.jsx)(C,{})}),(0,I.jsx)(T,{children:me.map(e=>(0,I.jsx)(E,{value:e.value,children:r(e.labelKey)},e.value))})]})]})]})]})}function ge(e){let t=(0,F.useMemo)(()=>ce(e.config),[e.config]),[n,a]=(0,F.useState)(t.agents),[o,c]=(0,F.useState)(t.bindings),[u,d]=(0,F.useState)(t.runtimeEntries),[f,p]=(0,F.useState)(t.dmScope),[m,h]=(0,F.useState)(t.companionEnabled),[g,_]=(0,F.useState)(t.defaultContextTokens),[v,y]=(0,F.useState)(t.defaultEngine),b=(0,F.useMemo)(()=>{let e=new Set([`main`]);return n.forEach(t=>{let n=t.id.trim();n&&e.add(n)}),e},[n]);return(0,I.jsxs)(i,{className:`space-y-6`,children:[(0,I.jsx)(X,{}),(0,I.jsx)(he,{companionEnabled:m,dmScope:f,defaultContextTokens:g,defaultEngine:v,onCompanionEnabledChange:h,onDmScopeChange:p,onDefaultContextTokensChange:_,onDefaultEngineChange:y}),(0,I.jsx)(pe,{entries:u,onUpdateEntry:(e,t)=>d(n=>n.map((n,r)=>r===e?{...n,...t}:n)),onRemoveEntry:e=>d(t=>t.filter((t,n)=>n!==e)),onAddEntry:()=>d(e=>[...e,oe()])}),(0,I.jsx)(de,{agents:n,onUpdateAgent:(e,t)=>{a(n=>n.map((n,r)=>r===e?{...n,...t}:n))},onRemoveAgent:e=>a(t=>t.filter((t,n)=>n!==e)),onAddAgent:()=>a(e=>[...e,ie()]),onSetDefaultAgent:(e,t)=>a(n=>t?n.map((t,n)=>({...t,default:n===e})):n.map((t,n)=>n===e?{...t,default:!1}:t))}),(0,I.jsx)(fe,{bindings:o,onUpdateBinding:(e,t)=>{c(n=>n.map((n,r)=>r===e?t:n))},onRemoveBinding:e=>c(t=>t.filter((t,n)=>n!==e)),onAddBinding:()=>c(e=>[...e,ae()])}),(0,I.jsx)(`div`,{className:`flex justify-end`,children:(0,I.jsxs)(l,{type:`button`,onClick:()=>{try{let t=ue({companionEnabled:m,agents:n,bindings:o,runtimeEntries:u,dmScope:f,defaultContextTokens:g,defaultEngine:v,knownAgentIds:b});e.updateRuntime.mutate({data:t})}catch(e){s.error(e instanceof Error?e.message:String(e))}},disabled:e.updateRuntime.isPending,children:[(0,I.jsx)(ne,{className:`h-4 w-4 mr-2`}),e.updateRuntime.isPending?r(`saving`):r(`saveRuntimeSettings`)]})})]})}function _e(){let{data:e,isLoading:t}=A(),n=j();return t||!e?(0,I.jsx)(`div`,{className:`p-8 text-gray-400`,children:r(`runtimeLoading`)}):(0,I.jsx)(ge,{config:e,updateRuntime:n})}export{_e as RuntimeConfig};
|
|
1
|
+
import{_ as e,m as t,p as n,r}from"./i18n-D1144VAA.js";import{At as i,Dt as a,Et as o,Lt as s,Mt as c,Nt as l,Ot as u,Tt as d,_t as f,ft as p,ht as m,kt as h,wt as g,xt as _,yt as v}from"./api-DGD9_Bg4.js";import{t as y}from"./createLucideIcon-DzY6wN61.js";import{b,l as x,x as S}from"./desktop-DVUbOWbR.js";import{a as C,i as w,n as T,r as E,t as D}from"./select-BUTwE_lC.js";import{t as ee}from"./play-AqrNslHI.js";import{t as O}from"./plus-B-YHtTNC.js";import{t as te}from"./rotate-cw-BN9yjccP.js";import{t as ne}from"./save-CO_4qf6b.js";import{t as k}from"./notice-card-Dr6xCwva.js";import{n as A,x as j}from"./use-config-Cyv5IuSt.js";import{Q as M,X as N}from"./index-DqJ3CYwi.js";import{t as P}from"./setting-row-BavcnXw1.js";var re=y(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),F=e(t(),1),I=n(),L={healthy:`runtimeControlHealthy`,"starting-service":`runtimeControlStartingService`,"restarting-service":`runtimeControlRestartingService`,"stopping-service":`runtimeControlStoppingService`,"restarting-app":`runtimeControlRestartingApp`,recovering:`runtimeControlRecovering`,failed:`runtimeControlFailed`},R={running:`runtimeControlServiceRunning`,stopped:`runtimeControlServiceStopped`,starting:`runtimeControlServiceStarting`,stopping:`runtimeControlServiceStopping`,restarting:`runtimeControlServiceRestarting`},z={"desktop-embedded":`runtimeControlEnvironmentDesktop`,"managed-local-service":`runtimeControlEnvironmentManagedService`,"self-hosted-web":`runtimeControlEnvironmentSelfHosted`,"shared-web":`runtimeControlEnvironmentSharedWeb`};function B(e){return r(L[e]??`runtimeControlUnavailable`)}function V(e){return r(R[e]??`runtimeControlServiceUnknown`)}function H(e){return r(z[e.environment])}function U(e,t){return t===`start-service`?e?.canStartService:t===`stop-service`?e?.canStopService:e?.canRestartService}function W(e){return e?[{action:`start-service`,capability:e.canStartService,label:r(`runtimeControlStartService`),icon:`play`},{action:`restart-service`,capability:e.canRestartService,label:r(`runtimeControlRestartService`),icon:`rotate`},{action:`stop-service`,capability:e.canStopService,label:r(`runtimeControlStopService`),icon:`square`,variant:`destructive`},{action:`restart-app`,capability:e.canRestartApp,label:r(`runtimeControlRestartApp`),icon:`rotate`,variant:`secondary`}].filter(e=>e.capability.available||!!e.capability.reasonIfUnavailable):[]}function G(e){let{busy:t,icon:n}=e;return t?(0,I.jsx)(M,{className:`mr-2 h-4 w-4 animate-spin`}):n===`play`?(0,I.jsx)(ee,{className:`mr-2 h-4 w-4`}):n===`square`?(0,I.jsx)(re,{className:`mr-2 h-4 w-4`}):(0,I.jsx)(te,{className:`mr-2 h-4 w-4`})}function K(){let{busy:e,busyAction:t,controlView:n,errorMessage:i,pendingRestart:c,visibleLifecycle:f,visibleMessage:p,visibleServiceState:h}=m(),y=W(n??void 0),b=async e=>{let t=U(n,e);if(!t?.available){s.error(_(t?.reasonIfUnavailable)??r(`runtimeControlLoadFailed`));return}if(!(e===`stop-service`&&t.requiresConfirmation&&!window.confirm(r(`runtimeControlStopServiceConfirm`))))try{let t=await v.runRuntimeControlAction(e);s.success(_(t.message)??t.message)}catch(e){let t=e instanceof Error?e.message:r(`runtimeControlActionFailed`);s.error(`${r(`runtimeControlActionFailed`)}: ${t}`)}},x=async()=>{if(!n?.canRestartApp.available){s.error(_(n?.canRestartApp.reasonIfUnavailable)??r(`runtimeRestartAppUnavailable`));return}if(window.confirm(r(`runtimeControlRestartAppConfirm`)))try{let e=await v.runRuntimeControlAction(`restart-app`);s.success(_(e.message)??e.message)}catch(e){let t=e instanceof Error?e.message:r(`runtimeControlActionFailed`);s.error(`${r(`runtimeControlActionFailed`)}: ${t}`)}};return(0,I.jsxs)(g,{children:[(0,I.jsxs)(a,{children:[(0,I.jsx)(u,{children:r(`runtimeControlTitle`)}),(0,I.jsx)(o,{children:r(`runtimeControlDescription`)})]}),(0,I.jsxs)(d,{className:`space-y-4`,children:[(0,I.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-gray-200 bg-gray-50 p-4`,children:[(0,I.jsxs)(`div`,{className:`flex flex-col gap-1 md:flex-row md:items-center md:justify-between`,children:[(0,I.jsx)(`div`,{className:`text-sm font-medium text-gray-900`,children:V(h)}),(0,I.jsx)(`div`,{className:`text-xs text-gray-500`,children:n?H(n):r(`runtimeControlLoading`)})]}),(0,I.jsx)(`p`,{className:`text-sm text-gray-600`,children:p}),(0,I.jsx)(`div`,{className:`text-xs text-gray-500`,children:B(f)}),n?.managementHint?(0,I.jsx)(`p`,{className:`text-xs text-gray-500`,children:_(n.managementHint)}):null,i&&!e?(0,I.jsx)(`p`,{className:`text-sm text-amber-700`,children:i}):null]}),c?(0,I.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-amber-200 bg-amber-50 p-4`,children:[(0,I.jsx)(`div`,{className:`text-sm font-medium text-amber-900`,children:r(`runtimeControlPendingRestartTitle`)}),(0,I.jsx)(`p`,{className:`text-sm text-amber-800`,children:r(`runtimeControlPendingRestartDescription`)}),c.changedPaths.length>0?(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(`div`,{className:`text-xs font-medium uppercase tracking-[0.08em] text-amber-700`,children:r(`runtimeControlPendingRestartPaths`)}),(0,I.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:c.changedPaths.map(e=>(0,I.jsx)(`span`,{className:`rounded-full border border-amber-200 bg-white px-2.5 py-1 text-xs text-amber-800`,children:e},e))})]}):null]}):null,(0,I.jsx)(`div`,{className:`flex flex-col gap-3 md:flex-row md:flex-wrap`,children:y.map(n=>(0,I.jsxs)(l,{type:`button`,variant:n.variant??`default`,onClick:()=>{if(n.action===`restart-app`){x();return}b(n.action)},disabled:!n.capability.available||e,children:[(0,I.jsx)(G,{icon:n.icon,busy:t===n.action}),n.label]},n.action))}),y.filter(e=>!e.capability.available&&e.capability.reasonIfUnavailable).map(e=>(0,I.jsx)(`p`,{className:`text-xs text-gray-500`,children:_(e.capability.reasonIfUnavailable)},`${e.action}-reason`))]})]})}function q(e){let{description:t,title:n}=e;return(0,I.jsx)(k,{tone:`neutral`,title:n,description:t})}function J(e){let{children:t}=e;return(0,I.jsxs)(g,{children:[(0,I.jsxs)(a,{children:[(0,I.jsx)(u,{children:r(`runtimePresenceTitle`)}),(0,I.jsx)(o,{children:r(`runtimePresenceDescription`)})]}),(0,I.jsx)(d,{children:t})]})}function Y(){let e=f().runtimeControlView?.environment,t=S(e=>e.supported),n=S(e=>e.initialized),i=S(e=>e.busyAction),a=S(e=>e.snapshot);return(0,F.useEffect)(()=>{if(e===`desktop-embedded`){b.start();return}b.markUnsupported()},[e]),e===`desktop-embedded`?(0,I.jsx)(J,{children:(0,I.jsxs)(`div`,{className:`space-y-4`,children:[(0,I.jsx)(k,{tone:`neutral`,title:r(`runtimePresenceBehaviorLabel`),description:a?.closeToBackground?r(`runtimePresenceBehaviorBackground`):r(`runtimePresenceBehaviorQuit`),className:`rounded-xl`}),!n||t&&!a?(0,I.jsx)(`p`,{className:`text-sm text-gray-500`,children:r(`runtimePresenceLoading`)}):null,a?(0,I.jsxs)(`div`,{className:`space-y-4`,children:[(0,I.jsx)(P,{title:r(`runtimePresenceCloseToBackground`),description:r(`runtimePresenceCloseToBackgroundHelp`),control:(0,I.jsx)(p,{id:`runtime-presence-close-background`,"aria-label":r(`runtimePresenceCloseToBackground`),checked:a.closeToBackground,disabled:i===`saving-preferences`,onCheckedChange:e=>{b.updatePreferences({closeToBackground:e})}})}),(0,I.jsx)(P,{title:r(`runtimePresenceLaunchAtLogin`),description:a.supportsLaunchAtLogin?r(`runtimePresenceLaunchAtLoginHelp`):a.launchAtLoginReason??r(`runtimePresenceLaunchAtLoginUnavailable`),control:(0,I.jsx)(p,{id:`runtime-presence-launch-login`,"aria-label":r(`runtimePresenceLaunchAtLogin`),checked:a.launchAtLogin,disabled:!a.supportsLaunchAtLogin||i===`saving-preferences`,onCheckedChange:e=>{b.updatePreferences({launchAtLogin:e})}})})]}):null]})}):e===`managed-local-service`?(0,I.jsx)(J,{children:(0,I.jsx)(q,{title:r(`runtimePresenceManagedLocalTitle`),description:r(`runtimePresenceManagedLocalDescription`)})}):e===`self-hosted-web`?(0,I.jsx)(J,{children:(0,I.jsx)(q,{title:r(`runtimePresenceSelfHostedTitle`),description:r(`runtimePresenceSelfHostedDescription`)})}):e===`shared-web`?(0,I.jsx)(J,{children:(0,I.jsx)(q,{title:r(`runtimePresenceSharedTitle`),description:r(`runtimePresenceSharedDescription`)})}):(0,I.jsx)(J,{children:(0,I.jsx)(`p`,{className:`text-sm text-gray-500`,children:r(`runtimePresenceLoading`)})})}function X(){return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(h,{title:r(`runtimePageTitle`),description:r(`runtimePageDescription`)}),(0,I.jsx)(K,{}),(0,I.jsx)(Y,{}),(0,I.jsx)(x,{})]})}var Z={wireDialect:`acp`,processScope:`per-session`,command:``,args:[`acp`],env:{},cwd:``,startupTimeoutMs:8e3,probeTimeoutMs:3e3,requestTimeoutMs:12e4};function ie(){return{id:``,default:!1,workspace:``,model:``,runtime:``,contextTokens:void 0,maxToolIterations:void 0}}function ae(){return{agentId:``,match:{channel:``,accountId:``}}}function oe(){return{id:``,enabled:!0,label:``,type:`narp-stdio`,config:Z,configText:JSON.stringify(Z,null,2)}}function se(e){return{id:e.id??``,default:!!e.default,displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,workspace:e.workspace??``,model:e.model??``,runtime:e.runtime??e.engine??``,contextTokens:e.contextTokens,maxToolIterations:e.maxToolIterations}}function Q(e){return{agentId:e.agentId??``,match:{channel:e.match?.channel??``,accountId:e.match?.accountId??``,peer:e.match?.peer?{kind:e.match.peer.kind,id:e.match.peer.id}:void 0}}}function $(e){let t=e.trim();if(!t)return;let n=Number.parseInt(t,10);return Number.isFinite(n)?n:void 0}function ce(e){return{companionEnabled:e.companion?.enabled===!0,agents:(e.agents.list??[]).map(se),bindings:(e.bindings??[]).map(Q),runtimeEntries:Object.entries(e.agents.runtimes?.entries??{}).map(([e,t])=>({id:e,enabled:t.enabled!==!1,label:t.label??``,type:t.type,config:t.config??{},configText:JSON.stringify(t.config??{},null,2)})),dmScope:e.session?.dmScope??`per-channel-peer`,defaultContextTokens:e.agents.defaults.contextTokens??2e5,defaultEngine:e.agents.defaults.engine??`native`}}function le(e){let t={id:e.id.trim()};e.default&&(t.default=!0),e.displayName?.trim()&&(t.displayName=e.displayName.trim()),e.description?.trim()&&(t.description=e.description.trim()),e.avatar?.trim()&&(t.avatar=e.avatar.trim()),e.workspace?.trim()&&(t.workspace=e.workspace.trim()),e.model?.trim()&&(t.model=e.model.trim());let n=e.runtime?.trim()??e.engine?.trim();return n&&(t.engine=n),typeof e.contextTokens==`number`&&(t.contextTokens=Math.max(1e3,e.contextTokens)),typeof e.maxToolIterations==`number`&&(t.maxToolIterations=e.maxToolIterations),t}function ue(e){let t=e.agents.map((e,t)=>{if(!e.id.trim())throw Error(r(`agentIdRequiredError`).replace(`{index}`,String(t)));return le(e)}),n=t.map(e=>e.id).filter((e,t,n)=>n.indexOf(e)!==t);if(n.length>0)throw Error(`${r(`duplicateAgentId`)}: ${n[0]}`);let i=e.bindings.map((t,n)=>{let i=t.agentId.trim(),a=t.match.channel.trim(),o=t.match.accountId?.trim()??``,s=t.match.peer?.kind,c=t.match.peer?.id?.trim()??``;if(!i)throw Error(r(`bindingAgentIdRequired`).replace(`{index}`,String(n)));if(!e.knownAgentIds.has(i))throw Error(`${r(`bindingAgentIdNotFound`).replace(`{index}`,String(n))}: ${i}`);if(!a)throw Error(r(`bindingChannelRequired`).replace(`{index}`,String(n)));let l={agentId:i,match:{channel:a}};if(o&&(l.match.accountId=o),s){if(!c)throw Error(r(`bindingPeerIdRequired`).replace(`{index}`,String(n)));l.match.peer={kind:s,id:c}}return l}),a=e.runtimeEntries.reduce((e,t,n)=>{let i=t.id.trim(),a=t.type.trim();if(!i)throw Error(r(`runtimeEntryIdRequired`).replace(`{index}`,String(n)));if(!a)throw Error(r(`runtimeEntryTypeRequired`).replace(`{id}`,i));if(e[i])throw Error(`${r(`runtimeEntryDuplicate`)}: ${i}`);let o=t.configText.trim()?JSON.parse(t.configText):{};if(o&&(typeof o!=`object`||Array.isArray(o)))throw Error(r(`runtimeEntryConfigObjectRequired`).replace(`{id}`,i));return e[i]={enabled:t.enabled!==!1,...t.label?.trim()?{label:t.label.trim()}:{},type:a,config:o??{}},e},{});return{companion:{enabled:e.companionEnabled},agents:{defaults:{contextTokens:Math.max(1e3,e.defaultContextTokens),engine:e.defaultEngine.trim()||`native`},list:t,runtimes:{entries:a}},bindings:i,session:{dmScope:e.dmScope}}}function de(e){return(0,I.jsxs)(g,{children:[(0,I.jsxs)(a,{children:[(0,I.jsx)(u,{children:r(`agentList`)}),(0,I.jsx)(o,{children:r(`agentListHelp`)})]}),(0,I.jsxs)(d,{className:`space-y-3`,children:[e.agents.map((t,n)=>(0,I.jsxs)(`div`,{className:`rounded-xl border border-gray-200 p-3 space-y-3`,children:[(0,I.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,I.jsx)(c,{value:t.id,onChange:t=>e.onUpdateAgent(n,{id:t.target.value}),placeholder:r(`agentIdPlaceholder`)}),(0,I.jsx)(c,{value:t.workspace??``,onChange:t=>e.onUpdateAgent(n,{workspace:t.target.value}),placeholder:r(`workspaceOverridePlaceholder`)}),(0,I.jsx)(c,{value:t.model??``,onChange:t=>e.onUpdateAgent(n,{model:t.target.value}),placeholder:r(`modelOverridePlaceholder`)}),(0,I.jsx)(c,{value:t.runtime??t.engine??``,onChange:t=>e.onUpdateAgent(n,{runtime:t.target.value}),placeholder:r(`engineOverridePlaceholder`)}),(0,I.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2`,children:[(0,I.jsx)(c,{type:`number`,min:1e3,step:1e3,value:t.contextTokens??``,onChange:t=>e.onUpdateAgent(n,{contextTokens:$(t.target.value)}),placeholder:r(`contextTokensPlaceholder`)}),(0,I.jsx)(c,{type:`number`,min:1,value:t.maxToolIterations??``,onChange:t=>e.onUpdateAgent(n,{maxToolIterations:$(t.target.value)}),placeholder:r(`maxToolsPlaceholder`)})]})]}),(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-gray-600`,children:[(0,I.jsx)(p,{checked:!!t.default,onCheckedChange:t=>e.onSetDefaultAgent(n,t)}),(0,I.jsx)(`span`,{children:r(`defaultAgent`)})]}),(0,I.jsxs)(l,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e.onRemoveAgent(n),children:[(0,I.jsx)(N,{className:`h-4 w-4 mr-1`}),r(`remove`)]})]})]},`${n}-${t.id}`)),(0,I.jsxs)(l,{type:`button`,variant:`outline`,onClick:e.onAddAgent,children:[(0,I.jsx)(O,{className:`h-4 w-4 mr-2`}),r(`addAgent`)]})]})]})}function fe(e){return(0,I.jsxs)(g,{children:[(0,I.jsxs)(a,{children:[(0,I.jsx)(u,{children:r(`bindings`)}),(0,I.jsx)(o,{children:r(`bindingsHelp`)})]}),(0,I.jsxs)(d,{className:`space-y-3`,children:[e.bindings.map((t,n)=>{let i=t.match.peer?.kind??``;return(0,I.jsxs)(`div`,{className:`rounded-xl border border-gray-200 p-3 space-y-3`,children:[(0,I.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,I.jsx)(c,{value:t.agentId,onChange:r=>e.onUpdateBinding(n,{...t,agentId:r.target.value}),placeholder:r(`targetAgentIdPlaceholder`)}),(0,I.jsx)(c,{value:t.match.channel,onChange:r=>e.onUpdateBinding(n,{...t,match:{...t.match,channel:r.target.value}}),placeholder:r(`channelPlaceholder`)}),(0,I.jsx)(c,{value:t.match.accountId??``,onChange:r=>e.onUpdateBinding(n,{...t,match:{...t.match,accountId:r.target.value}}),placeholder:r(`accountIdOptionalPlaceholder`)}),(0,I.jsxs)(D,{value:i||`__none__`,onValueChange:r=>{let i=r===`__none__`?``:r;e.onUpdateBinding(n,i?{...t,match:{...t.match,peer:{kind:i,id:t.match.peer?.id??``}}}:{...t,match:{...t.match,peer:void 0}})},children:[(0,I.jsx)(w,{children:(0,I.jsx)(C,{})}),(0,I.jsxs)(T,{children:[(0,I.jsx)(E,{value:`__none__`,children:r(`peerKindOptional`)}),(0,I.jsx)(E,{value:`direct`,children:r(`peerKindDirect`)}),(0,I.jsx)(E,{value:`group`,children:r(`peerKindGroup`)}),(0,I.jsx)(E,{value:`channel`,children:r(`peerKindChannel`)})]})]}),(0,I.jsx)(c,{value:t.match.peer?.id??``,onChange:r=>e.onUpdateBinding(n,{...t,match:{...t.match,peer:i?{kind:i,id:r.target.value}:void 0}}),placeholder:r(`peerIdPlaceholder`)})]}),(0,I.jsx)(`div`,{className:`flex justify-end`,children:(0,I.jsxs)(l,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e.onRemoveBinding(n),children:[(0,I.jsx)(N,{className:`h-4 w-4 mr-1`}),r(`remove`)]})})]},`${n}-${t.agentId}`)}),(0,I.jsxs)(l,{type:`button`,variant:`outline`,onClick:e.onAddBinding,children:[(0,I.jsx)(O,{className:`h-4 w-4 mr-2`}),r(`addBinding`)]})]})]})}function pe(e){return(0,I.jsxs)(g,{children:[(0,I.jsxs)(a,{children:[(0,I.jsx)(u,{children:r(`runtimeEntries`)}),(0,I.jsx)(o,{children:r(`runtimeEntriesHelp`)})]}),(0,I.jsxs)(d,{className:`space-y-3`,children:[e.entries.map((t,n)=>(0,I.jsxs)(`div`,{className:`rounded-xl border border-gray-200 p-3 space-y-3`,children:[(0,I.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,I.jsx)(c,{value:t.id,onChange:t=>e.onUpdateEntry(n,{id:t.target.value}),placeholder:r(`runtimeEntryIdPlaceholder`)}),(0,I.jsx)(c,{value:t.label??``,onChange:t=>e.onUpdateEntry(n,{label:t.target.value}),placeholder:r(`runtimeEntryLabelPlaceholder`)}),(0,I.jsx)(c,{value:t.type,onChange:t=>e.onUpdateEntry(n,{type:t.target.value}),placeholder:r(`runtimeEntryTypePlaceholder`)}),(0,I.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-gray-200 px-3 py-2`,children:[(0,I.jsx)(`span`,{className:`text-sm text-gray-700`,children:r(`enabled`)}),(0,I.jsx)(p,{checked:t.enabled!==!1,onCheckedChange:t=>e.onUpdateEntry(n,{enabled:t})})]})]}),(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:r(`runtimeEntryConfigJson`)}),(0,I.jsx)(`textarea`,{className:`min-h-32 w-full rounded-md border border-gray-200 px-3 py-2 text-sm font-mono`,value:t.configText,onChange:t=>e.onUpdateEntry(n,{configText:t.target.value}),spellCheck:!1})]}),(0,I.jsx)(`div`,{className:`flex justify-end`,children:(0,I.jsxs)(l,{type:`button`,variant:`outline`,onClick:()=>e.onRemoveEntry(n),children:[(0,I.jsx)(N,{className:`mr-2 h-4 w-4`}),r(`delete`)]})})]},`${n}-${t.id||`runtime-entry`}`)),(0,I.jsxs)(l,{type:`button`,variant:`outline`,onClick:e.onAddEntry,children:[(0,I.jsx)(O,{className:`mr-2 h-4 w-4`}),r(`addRuntimeEntry`)]})]})]})}var me=[{value:`main`,labelKey:`dmScopeMain`},{value:`per-peer`,labelKey:`dmScopePerPeer`},{value:`per-channel-peer`,labelKey:`dmScopePerChannelPeer`},{value:`per-account-channel-peer`,labelKey:`dmScopePerAccountChannelPeer`}];function he(e){return(0,I.jsxs)(g,{children:[(0,I.jsxs)(a,{children:[(0,I.jsx)(u,{children:r(`dmScope`)}),(0,I.jsx)(o,{children:r(`dmScopeHelp`)})]}),(0,I.jsxs)(d,{className:`space-y-4`,children:[(0,I.jsxs)(`div`,{className:`flex items-start justify-between gap-4 rounded-md border border-gray-200 px-4 py-3`,children:[(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`div`,{className:`text-sm font-medium text-gray-800`,children:r(`runtimeCompanionEnabled`)}),(0,I.jsx)(`p`,{className:`text-xs text-gray-500`,children:r(`runtimeCompanionEnabledHelp`)})]}),(0,I.jsx)(p,{checked:e.companionEnabled,onCheckedChange:e.onCompanionEnabledChange})]}),(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:r(`defaultContextTokens`)}),(0,I.jsx)(c,{type:`number`,min:1e3,step:1e3,value:e.defaultContextTokens,onChange:t=>e.onDefaultContextTokensChange(Math.max(1e3,Number.parseInt(t.target.value,10)||1e3))}),(0,I.jsx)(`p`,{className:`text-xs text-gray-500`,children:r(`defaultContextTokensHelp`)})]}),(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:r(`defaultEngine`)}),(0,I.jsx)(c,{value:e.defaultEngine,onChange:t=>e.onDefaultEngineChange(t.target.value),placeholder:r(`defaultEnginePlaceholder`)}),(0,I.jsx)(`p`,{className:`text-xs text-gray-500`,children:r(`defaultEngineHelp`)})]}),(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:r(`dmScope`)}),(0,I.jsxs)(D,{value:e.dmScope,onValueChange:t=>e.onDmScopeChange(t),children:[(0,I.jsx)(w,{children:(0,I.jsx)(C,{})}),(0,I.jsx)(T,{children:me.map(e=>(0,I.jsx)(E,{value:e.value,children:r(e.labelKey)},e.value))})]})]})]})]})}function ge(e){let t=(0,F.useMemo)(()=>ce(e.config),[e.config]),[n,a]=(0,F.useState)(t.agents),[o,c]=(0,F.useState)(t.bindings),[u,d]=(0,F.useState)(t.runtimeEntries),[f,p]=(0,F.useState)(t.dmScope),[m,h]=(0,F.useState)(t.companionEnabled),[g,_]=(0,F.useState)(t.defaultContextTokens),[v,y]=(0,F.useState)(t.defaultEngine),b=(0,F.useMemo)(()=>{let e=new Set([`main`]);return n.forEach(t=>{let n=t.id.trim();n&&e.add(n)}),e},[n]);return(0,I.jsxs)(i,{className:`space-y-6`,children:[(0,I.jsx)(X,{}),(0,I.jsx)(he,{companionEnabled:m,dmScope:f,defaultContextTokens:g,defaultEngine:v,onCompanionEnabledChange:h,onDmScopeChange:p,onDefaultContextTokensChange:_,onDefaultEngineChange:y}),(0,I.jsx)(pe,{entries:u,onUpdateEntry:(e,t)=>d(n=>n.map((n,r)=>r===e?{...n,...t}:n)),onRemoveEntry:e=>d(t=>t.filter((t,n)=>n!==e)),onAddEntry:()=>d(e=>[...e,oe()])}),(0,I.jsx)(de,{agents:n,onUpdateAgent:(e,t)=>{a(n=>n.map((n,r)=>r===e?{...n,...t}:n))},onRemoveAgent:e=>a(t=>t.filter((t,n)=>n!==e)),onAddAgent:()=>a(e=>[...e,ie()]),onSetDefaultAgent:(e,t)=>a(n=>t?n.map((t,n)=>({...t,default:n===e})):n.map((t,n)=>n===e?{...t,default:!1}:t))}),(0,I.jsx)(fe,{bindings:o,onUpdateBinding:(e,t)=>{c(n=>n.map((n,r)=>r===e?t:n))},onRemoveBinding:e=>c(t=>t.filter((t,n)=>n!==e)),onAddBinding:()=>c(e=>[...e,ae()])}),(0,I.jsx)(`div`,{className:`flex justify-end`,children:(0,I.jsxs)(l,{type:`button`,onClick:()=>{try{let t=ue({companionEnabled:m,agents:n,bindings:o,runtimeEntries:u,dmScope:f,defaultContextTokens:g,defaultEngine:v,knownAgentIds:b});e.updateRuntime.mutate({data:t})}catch(e){s.error(e instanceof Error?e.message:String(e))}},disabled:e.updateRuntime.isPending,children:[(0,I.jsx)(ne,{className:`h-4 w-4 mr-2`}),e.updateRuntime.isPending?r(`saving`):r(`saveRuntimeSettings`)]})})]})}function _e(){let{data:e,isLoading:t}=A(),n=j();return t||!e?(0,I.jsx)(`div`,{className:`p-8 text-gray-400`,children:r(`runtimeLoading`)}):(0,I.jsx)(ge,{config:e,updateRuntime:n})}export{_e as RuntimeConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,m as t,p as n,r}from"./i18n-D1144VAA.js";import{At as i,Mt as a,Nt as o,jt as s,kt as c}from"./api-DGD9_Bg4.js";import{t as l}from"./search-CRtQwr-h.js";import{a as u,i as d,n as f,r as p,t as m}from"./select-BUTwE_lC.js";import{t as h}from"./external-link-CpEvG65F.js";import{t as g}from"./key-round-DUq47t0P.js";import{S as _,n as v,r as y}from"./use-config-Cyv5IuSt.js";import{Y as b}from"./index-
|
|
1
|
+
import{_ as e,m as t,p as n,r}from"./i18n-D1144VAA.js";import{At as i,Mt as a,Nt as o,jt as s,kt as c}from"./api-DGD9_Bg4.js";import{t as l}from"./search-CRtQwr-h.js";import{a as u,i as d,n as f,r as p,t as m}from"./select-BUTwE_lC.js";import{t as h}from"./external-link-CpEvG65F.js";import{t as g}from"./key-round-DUq47t0P.js";import{S as _,n as v,r as y}from"./use-config-Cyv5IuSt.js";import{Y as b}from"./index-DqJ3CYwi.js";import{a as x,c as S,i as C,n as w,o as T,s as E,t as D}from"./config-split-page-CcrEUtwu.js";var O=e(t(),1),k=n(),A=[{value:`noLimit`,label:`searchFreshnessNoLimit`},{value:`oneDay`,label:`searchFreshnessOneDay`},{value:`oneWeek`,label:`searchFreshnessOneWeek`},{value:`oneMonth`,label:`searchFreshnessOneMonth`},{value:`oneYear`,label:`searchFreshnessOneYear`}],j=[{value:`basic`,label:`searchDepthBasic`},{value:`advanced`,label:`searchDepthAdvanced`}],M=[{value:`true`,label:`enabled`},{value:`false`,label:`disabled`}],N={bocha:`searchProviderBochaDescription`,tavily:`searchProviderTavilyDescription`,brave:`searchProviderBraveDescription`};function P(e){return{activeProvider:e.provider,enabledProviders:e.enabledProviders,maxResults:String(e.defaults.maxResults),providers:{bocha:{apiKey:``,baseUrl:e.providers.bocha.baseUrl,summary:!!e.providers.bocha.summary,freshness:e.providers.bocha.freshness??`noLimit`},tavily:{apiKey:``,baseUrl:e.providers.tavily.baseUrl,searchDepth:e.providers.tavily.searchDepth??`basic`,includeAnswer:!!e.providers.tavily.includeAnswer},brave:{apiKey:``,baseUrl:e.providers.brave.baseUrl}}}}function F(e){return{provider:e.activeProvider,enabledProviders:e.enabledProviders,defaults:{maxResults:Number(e.maxResults)||10},providers:{bocha:{apiKey:e.providers.bocha.apiKey||void 0,baseUrl:e.providers.bocha.baseUrl,summary:e.providers.bocha.summary,freshness:e.providers.bocha.freshness},tavily:{apiKey:e.providers.tavily.apiKey||void 0,baseUrl:e.providers.tavily.baseUrl,searchDepth:e.providers.tavily.searchDepth,includeAnswer:e.providers.tavily.includeAnswer},brave:{apiKey:e.providers.brave.apiKey||void 0,baseUrl:e.providers.brave.baseUrl}}}}function I(e){let{label:t,value:n,onChange:r,placeholder:i,type:o=`text`,inputMode:c}=e;return(0,k.jsxs)(`div`,{className:`space-y-2`,children:[(0,k.jsx)(s,{children:t}),(0,k.jsx)(a,{type:o,value:n,onChange:e=>r(e.target.value),placeholder:i,inputMode:c,className:`rounded-xl`})]})}function L(e){let{label:t,value:n,options:i,onChange:a}=e;return(0,k.jsxs)(`div`,{className:`space-y-2`,children:[(0,k.jsx)(s,{children:t}),(0,k.jsxs)(m,{value:n,onValueChange:a,children:[(0,k.jsx)(d,{className:`rounded-xl`,children:(0,k.jsx)(u,{})}),(0,k.jsx)(f,{children:i.map(e=>(0,k.jsx)(p,{value:e.value,children:r(e.label)},e.value))})]})]})}function R({docsUrl:e}){return e?(0,k.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,children:(0,k.jsxs)(o,{type:`button`,variant:`outline`,className:`rounded-xl`,children:[(0,k.jsx)(h,{className:`mr-2 h-4 w-4`}),r(`searchProviderOpenDocs`)]})}):null}function z(e){let{draft:t,provider:n,search:i,selectedDocsUrl:a,updateProviderDraft:o}=e;if(n===`bocha`){let{bocha:e}=t.providers;return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(I,{label:r(`apiKey`),value:e.apiKey,onChange:e=>o(`bocha`,{apiKey:e}),placeholder:i.providers.bocha.apiKeyMasked||r(`enterApiKey`),type:`password`}),(0,k.jsx)(I,{label:r(`searchProviderBaseUrl`),value:e.baseUrl,onChange:e=>o(`bocha`,{baseUrl:e})}),(0,k.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,k.jsx)(L,{label:r(`searchProviderSummary`),value:e.summary?`true`:`false`,options:M,onChange:e=>o(`bocha`,{summary:e===`true`})}),(0,k.jsx)(L,{label:r(`searchProviderFreshness`),value:e.freshness,options:A,onChange:e=>o(`bocha`,{freshness:e})})]}),(0,k.jsx)(R,{docsUrl:a??`https://open.bocha.cn`})]})}if(n===`tavily`){let{tavily:e}=t.providers;return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(I,{label:r(`apiKey`),value:e.apiKey,onChange:e=>o(`tavily`,{apiKey:e}),placeholder:i.providers.tavily.apiKeyMasked||r(`enterApiKey`),type:`password`}),(0,k.jsx)(I,{label:r(`searchProviderBaseUrl`),value:e.baseUrl,onChange:e=>o(`tavily`,{baseUrl:e})}),(0,k.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,k.jsx)(L,{label:r(`searchProviderSearchDepth`),value:e.searchDepth,options:j,onChange:e=>o(`tavily`,{searchDepth:e})}),(0,k.jsx)(L,{label:r(`searchProviderIncludeAnswer`),value:e.includeAnswer?`true`:`false`,options:M,onChange:e=>o(`tavily`,{includeAnswer:e===`true`})})]}),(0,k.jsx)(R,{docsUrl:a})]})}let{brave:s}=t.providers;return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(I,{label:r(`apiKey`),value:s.apiKey,onChange:e=>o(`brave`,{apiKey:e}),placeholder:i.providers.brave.apiKeyMasked||r(`enterApiKey`),type:`password`}),(0,k.jsx)(I,{label:r(`searchProviderBaseUrl`),value:s.baseUrl,onChange:e=>o(`brave`,{baseUrl:e})})]})}function B(e){let{draft:t,providers:n,search:i,selectedProvider:a,onSelect:o}=e;return(0,k.jsxs)(x,{children:[(0,k.jsx)(S,{className:`px-4 py-4`,children:(0,k.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-gray-500`,children:r(`searchChannels`)})}),(0,k.jsx)(T,{className:`space-y-2 p-3`,children:n.map(e=>{let n=i.providers[e.name],s=t.enabledProviders.includes(e.name);return(0,k.jsx)(D,{onClick:()=>o(e.name),active:a===e.name,className:`p-3`,children:(0,k.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,k.jsxs)(`div`,{className:`min-w-0`,children:[(0,k.jsx)(`p`,{className:`truncate text-sm font-semibold text-gray-900`,children:e.displayName}),(0,k.jsx)(`p`,{className:`line-clamp-2 text-[11px] text-gray-500`,children:r(N[e.name])})]}),(0,k.jsxs)(`div`,{className:`flex flex-col items-end gap-1`,children:[(0,k.jsx)(`span`,{className:`rounded-full bg-gray-100 px-2 py-0.5 text-[11px] font-medium text-gray-600`,children:n.apiKeySet?r(`searchStatusConfigured`):r(`searchStatusNeedsSetup`)}),s?(0,k.jsx)(`span`,{className:`rounded-full bg-emerald-50 px-2 py-0.5 text-[11px] font-medium text-emerald-700`,children:r(`searchProviderActivated`)}):null]})]})},e.name)})})]})}function V(e){let{initialDraft:t,providers:n,search:i,onSubmit:a,isPending:s}=e,{isMobile:c}=b(),[u,d]=(0,O.useState)(c?null:i.provider),[f,p]=(0,O.useState)(t),m=u&&n.some(e=>e.name===u)?u:c?null:i.provider,h=n.find(e=>e.name===m)??null,_=m?i.providers[m]:null,v=m?f.enabledProviders.includes(m):!1,y=_?.docsUrl??h?.docsUrl;return(0,k.jsxs)(C,{className:`xl:min-h-0`,mobileView:c?m?`detail`:`list`:void 0,onMobileBack:()=>d(null),mobileListLabel:r(`searchPageTitle`),children:[(0,k.jsx)(B,{draft:f,providers:n,search:i,selectedProvider:m??i.provider,onSelect:d}),h?(0,k.jsx)(x,{children:(0,k.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),a(f)},className:`flex min-h-0 flex-1 flex-col`,children:[(0,k.jsx)(S,{className:`px-6 py-5`,children:(0,k.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,k.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-xl bg-primary text-white`,children:(0,k.jsx)(l,{className:`h-5 w-5`})}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900`,children:h.displayName}),(0,k.jsx)(`p`,{className:`text-sm text-gray-500`,children:h.description})]})]}),(0,k.jsx)(o,{type:`button`,variant:v?`secondary`:`outline`,className:`rounded-xl`,onClick:()=>{let e=v?f.enabledProviders.filter(e=>e!==m):m?[...f.enabledProviders,m]:f.enabledProviders,t={...f,enabledProviders:e};p(t),a(t)},children:r(v?`searchProviderDeactivate`:`searchProviderActivate`)})]})}),(0,k.jsxs)(T,{className:`space-y-6 px-6 py-5`,children:[(0,k.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,k.jsx)(L,{label:r(`searchActiveProvider`),value:f.activeProvider,options:n.map(e=>({value:e.name,label:e.displayName})),onChange:e=>p({...f,activeProvider:e})}),(0,k.jsx)(I,{label:r(`searchDefaultMaxResults`),value:f.maxResults,onChange:e=>p({...f,maxResults:e}),inputMode:`numeric`})]}),(0,k.jsx)(z,{draft:f,provider:m,search:i,selectedDocsUrl:y,updateProviderDraft:(e,t)=>{p(n=>({...n,providers:{...n.providers,[e]:{...n.providers[e],...t}}}))}})]}),(0,k.jsx)(E,{className:`flex justify-end px-6 py-4`,children:(0,k.jsxs)(o,{type:`submit`,disabled:s,children:[(0,k.jsx)(g,{className:`mr-2 h-4 w-4`}),r(s?`saving`:`saveChanges`)]})})]})}):(0,k.jsx)(w,{children:(0,k.jsx)(`p`,{className:`text-sm text-gray-500`,children:r(`searchNoProviderSelected`)})})]})}function H(){let{data:e}=v(),{data:t}=y(),n=_(),a=t?.search??[],o=e?.search;return!o||a.length===0?(0,k.jsx)(`div`,{className:`p-8`,children:r(`loading`)}):(0,k.jsxs)(i,{className:`pb-0 xl:flex xl:h-full xl:min-h-0 xl:flex-col`,children:[(0,k.jsx)(c,{title:r(`searchPageTitle`),description:r(`searchPageDescription`)}),(0,k.jsx)(V,{initialDraft:P(o),providers:a,search:o,onSubmit:e=>n.mutate({data:F(e)}),isPending:n.isPending},JSON.stringify(o))]})}export{H as SearchConfig};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{_ as e,m as t,p as n,r}from"./i18n-D1144VAA.js";import{At as i,Dt as a,Et as o,Lt as s,Mt as c,Nt as l,Ot as u,Tt as d,ft as f,jt as p,kt as m,wt as h}from"./api-DGD9_Bg4.js";import{a as g,i as _,n as v,r as y,t as b}from"./select-BUTwE_lC.js";import{t as x}from"./plus-B-YHtTNC.js";import{t as S}from"./save-CO_4qf6b.js";import{C,n as w}from"./use-config-Cyv5IuSt.js";import{X as T}from"./index-
|
|
1
|
+
import{_ as e,m as t,p as n,r}from"./i18n-D1144VAA.js";import{At as i,Dt as a,Et as o,Lt as s,Mt as c,Nt as l,Ot as u,Tt as d,ft as f,jt as p,kt as m,wt as h}from"./api-DGD9_Bg4.js";import{a as g,i as _,n as v,r as y,t as b}from"./select-BUTwE_lC.js";import{t as x}from"./plus-B-YHtTNC.js";import{t as S}from"./save-CO_4qf6b.js";import{C,n as w}from"./use-config-Cyv5IuSt.js";import{X as T}from"./index-DqJ3CYwi.js";var E=e(t(),1),D=n(),O=[`env`,`file`,`exec`];function k(e=``){return{alias:e,source:`env`,prefix:``,path:``,command:``,argsText:``,cwd:``,timeoutMs:5e3}}function A(){return{path:``,source:`env`,provider:``,id:``}}function j(e,t){return t.source===`env`?{...k(e),source:`env`,prefix:t.prefix??``}:t.source===`file`?{...k(e),source:`file`,path:t.path}:{...k(e),source:`exec`,command:t.command,argsText:(t.args??[]).join(`
|
|
2
2
|
`),cwd:t.cwd??``,timeoutMs:t.timeoutMs??5e3}}function M(e){return e.source===`env`?{source:`env`,...e.prefix.trim()?{prefix:e.prefix.trim()}:{}}:e.source===`file`?{source:`file`,path:e.path.trim(),format:`json`}:{source:`exec`,command:e.command.trim(),args:e.argsText.split(`
|
|
3
3
|
`).map(e=>e.trim()).filter(Boolean),...e.cwd.trim()?{cwd:e.cwd.trim()}:{},timeoutMs:Math.max(1,Math.trunc(e.timeoutMs||5e3))}}function N(e){return e?{enabled:!!e.enabled,defaultEnv:e.defaults.env??``,defaultFile:e.defaults.file??``,defaultExec:e.defaults.exec??``,providers:Object.entries(e.providers).map(([e,t])=>j(e,t)),refs:Object.entries(e.refs).map(([e,t])=>({path:e,source:t.source,provider:t.provider??``,id:t.id}))}:{enabled:!0,defaultEnv:``,defaultFile:``,defaultExec:``,providers:[],refs:[]}}function P(e){return{enabled:e.enabled,defaults:{env:e.defaultEnv||null,file:e.defaultFile||null,exec:e.defaultExec||null},providers:Object.fromEntries(e.providers.map(e=>[e.alias.trim(),M(e)]).filter(([e])=>e)),refs:Object.fromEntries(e.refs.map(e=>[e.path.trim(),{source:e.source,...e.provider.trim()?{provider:e.provider.trim()}:{},id:e.id.trim()}]).filter(([e,t])=>e&&t.id))}}function F(e){let{defaultEnv:t,defaultFile:n,defaultExec:i,providerAliases:s,onChange:c}=e;return(0,D.jsxs)(h,{children:[(0,D.jsxs)(a,{children:[(0,D.jsx)(u,{children:r(`secrets`)}),(0,D.jsx)(o,{children:r(`secretsEnabledHelp`)})]}),(0,D.jsx)(d,{className:`space-y-4`,children:[{label:r(`defaultEnvProvider`),value:t,key:`defaultEnv`},{label:r(`defaultFileProvider`),value:n,key:`defaultFile`},{label:r(`defaultExecProvider`),value:i,key:`defaultExec`}].map(e=>(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsx)(p,{children:e.label}),(0,D.jsxs)(b,{value:e.value||`__none__`,onValueChange:t=>c(e.key,t===`__none__`?``:t),children:[(0,D.jsx)(_,{children:(0,D.jsx)(g,{placeholder:r(`noneOption`)})}),(0,D.jsxs)(v,{children:[(0,D.jsx)(y,{value:`__none__`,children:r(`noneOption`)}),s.map(e=>(0,D.jsx)(y,{value:e,children:e},e))]})]})]},e.key))})]})}function I(e){let{providers:t,onUpdate:n,onRemove:i,onAdd:s}=e;return(0,D.jsxs)(h,{children:[(0,D.jsxs)(a,{children:[(0,D.jsx)(u,{children:r(`secretProvidersTitle`)}),(0,D.jsx)(o,{children:r(`secretProvidersDescription`)})]}),(0,D.jsxs)(d,{className:`space-y-3`,children:[t.map((e,t)=>(0,D.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-gray-200 p-3`,children:[(0,D.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-3`,children:[(0,D.jsx)(c,{value:e.alias,onChange:e=>n(t,{alias:e.target.value}),placeholder:r(`providerAlias`)}),(0,D.jsxs)(b,{value:e.source,onValueChange:e=>n(t,{source:e}),children:[(0,D.jsx)(_,{children:(0,D.jsx)(g,{})}),(0,D.jsx)(v,{children:O.map(e=>(0,D.jsx)(y,{value:e,children:e},e))})]}),(0,D.jsxs)(l,{type:`button`,variant:`outline`,onClick:()=>i(t),children:[(0,D.jsx)(T,{className:`mr-2 h-4 w-4`}),r(`removeProvider`)]})]}),e.source===`env`?(0,D.jsx)(c,{value:e.prefix,onChange:e=>n(t,{prefix:e.target.value}),placeholder:r(`envPrefix`)}):null,e.source===`file`?(0,D.jsx)(c,{value:e.path,onChange:e=>n(t,{path:e.target.value}),placeholder:r(`secretFilePath`)}):null,e.source===`exec`?(0,D.jsxs)(`div`,{className:`space-y-2`,children:[(0,D.jsx)(c,{value:e.command,onChange:e=>n(t,{command:e.target.value}),placeholder:r(`secretExecCommand`)}),(0,D.jsx)(`textarea`,{className:`min-h-[84px] w-full rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-mono`,value:e.argsText,onChange:e=>n(t,{argsText:e.target.value}),placeholder:r(`secretExecArgs`)}),(0,D.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 md:grid-cols-2`,children:[(0,D.jsx)(c,{value:e.cwd,onChange:e=>n(t,{cwd:e.target.value}),placeholder:r(`secretExecCwd`)}),(0,D.jsx)(c,{type:`number`,min:1,value:e.timeoutMs,onChange:e=>n(t,{timeoutMs:Number.parseInt(e.target.value,10)||5e3}),placeholder:r(`secretExecTimeoutMs`)})]})]}):null]},`provider-${t}`)),(0,D.jsxs)(l,{type:`button`,variant:`outline`,onClick:s,children:[(0,D.jsx)(x,{className:`mr-2 h-4 w-4`}),r(`addSecretProvider`)]})]})]})}function L(e){let{refs:t,providerAliases:n,onUpdate:i,onRemove:s,onAdd:f}=e;return(0,D.jsxs)(h,{children:[(0,D.jsxs)(a,{children:[(0,D.jsx)(u,{children:r(`secretRefsTitle`)}),(0,D.jsx)(o,{children:r(`secretRefsDescription`)})]}),(0,D.jsxs)(d,{className:`space-y-3`,children:[t.map((e,t)=>(0,D.jsx)(`div`,{className:`space-y-3 rounded-xl border border-gray-200 p-3`,children:(0,D.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2`,children:[(0,D.jsx)(c,{value:e.path,onChange:e=>i(t,{path:e.target.value}),placeholder:r(`secretConfigPath`)}),(0,D.jsx)(c,{value:e.id,onChange:e=>i(t,{id:e.target.value}),placeholder:r(`secretId`)}),(0,D.jsxs)(b,{value:e.source,onValueChange:e=>i(t,{source:e}),children:[(0,D.jsx)(_,{children:(0,D.jsx)(g,{})}),(0,D.jsx)(v,{children:O.map(e=>(0,D.jsx)(y,{value:e,children:e},e))})]}),(0,D.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] gap-2`,children:[(0,D.jsxs)(b,{value:e.provider||`__none__`,onValueChange:e=>i(t,{provider:e===`__none__`?``:e}),children:[(0,D.jsx)(_,{children:(0,D.jsx)(g,{placeholder:r(`secretProviderAlias`)})}),(0,D.jsxs)(v,{children:[(0,D.jsx)(y,{value:`__none__`,children:r(`noneOption`)}),n.map(e=>(0,D.jsx)(y,{value:e,children:e},e))]})]}),(0,D.jsx)(l,{type:`button`,variant:`outline`,onClick:()=>s(t),children:(0,D.jsx)(T,{className:`h-4 w-4`})})]})]})},`ref-${t}`)),(0,D.jsxs)(l,{type:`button`,variant:`outline`,onClick:f,children:[(0,D.jsx)(x,{className:`mr-2 h-4 w-4`}),r(`addSecretRef`)]})]})]})}function R(e){let{initialState:t,isPending:n,onSubmit:c}=e,[p,g]=(0,E.useState)(t),_=(0,E.useMemo)(()=>{let e=p.providers.map(e=>e.alias.trim()).filter(Boolean);return Array.from(new Set(e))},[p.providers]);return(0,D.jsxs)(i,{className:`space-y-6`,children:[(0,D.jsx)(m,{title:r(`secretsPageTitle`),description:r(`secretsPageDescription`)}),(0,D.jsxs)(h,{children:[(0,D.jsxs)(a,{children:[(0,D.jsx)(u,{children:r(`secrets`)}),(0,D.jsx)(o,{children:r(`secretsEnabledHelp`)})]}),(0,D.jsxs)(d,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl border border-gray-200 p-3`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`p`,{className:`text-sm font-medium text-gray-800`,children:r(`enabled`)}),(0,D.jsx)(`p`,{className:`text-xs text-gray-500`,children:r(`secretsEnabledHelp`)})]}),(0,D.jsx)(f,{checked:p.enabled,onCheckedChange:e=>g(t=>({...t,enabled:e}))})]}),(0,D.jsx)(F,{defaultEnv:p.defaultEnv,defaultFile:p.defaultFile,defaultExec:p.defaultExec,providerAliases:_,onChange:(e,t)=>g(n=>({...n,[e]:t}))})]})]}),(0,D.jsx)(I,{providers:p.providers,onUpdate:(e,t)=>{g(n=>({...n,providers:n.providers.map((n,r)=>r===e?{...n,...t}:n)}))},onRemove:e=>g(t=>({...t,providers:t.providers.filter((t,n)=>n!==e)})),onAdd:()=>g(e=>({...e,providers:[...e.providers,k()]}))}),(0,D.jsx)(L,{refs:p.refs,providerAliases:_,onUpdate:(e,t)=>{g(n=>({...n,refs:n.refs.map((n,r)=>r===e?{...n,...t}:n)}))},onRemove:e=>g(t=>({...t,refs:t.refs.filter((t,n)=>n!==e)})),onAdd:()=>g(e=>({...e,refs:[...e.refs,A()]}))}),(0,D.jsx)(`div`,{className:`flex justify-end`,children:(0,D.jsxs)(l,{type:`button`,onClick:()=>{try{let e={};for(let[t,n]of p.providers.entries()){let i=n.alias.trim();if(!i)throw Error(`${r(`providerAlias`)} #${t+1} ${r(`isRequired`)}`);if(e[i])throw Error(`${r(`providerAlias`)}: ${i} (${r(`duplicate`)})`);if(n.source===`file`&&!n.path.trim())throw Error(`${r(`secretFilePath`)} #${t+1} ${r(`isRequired`)}`);if(n.source===`exec`&&!n.command.trim())throw Error(`${r(`secretExecCommand`)} #${t+1} ${r(`isRequired`)}`);e[i]=M(n)}let t={};for(let[n,i]of p.refs.entries()){let a=i.path.trim(),o=i.id.trim();if(!a)throw Error(`${r(`secretConfigPath`)} #${n+1} ${r(`isRequired`)}`);if(!o)throw Error(`${r(`secretId`)} #${n+1} ${r(`isRequired`)}`);let s=i.provider.trim();if(s&&!e[s])throw Error(`${r(`secretProviderAlias`)}: ${s} ${r(`notFound`)}`);t[a]={source:i.source,...s?{provider:s}:{},id:o}}c({enabled:p.enabled,defaultEnv:p.defaultEnv.trim(),defaultFile:p.defaultFile.trim(),defaultExec:p.defaultExec.trim(),providers:Object.entries(e).map(([e,t])=>j(e,t)),refs:Object.entries(t).map(([e,t])=>({path:e,source:t.source,provider:t.provider??``,id:t.id}))})}catch(e){s.error(e instanceof Error?e.message:String(e))}},disabled:n,children:[(0,D.jsx)(S,{className:`mr-2 h-4 w-4`}),r(n?`saving`:`save`)]})})]})}function z(){let{data:e,isLoading:t}=w(),n=C();return t?(0,D.jsx)(`div`,{className:`p-8 text-gray-400`,children:r(`loading`)}):(0,D.jsx)(R,{initialState:N(e?.secrets),isPending:n.isPending,onSubmit:e=>n.mutate({data:P(e)})},JSON.stringify(e?.secrets??null))}export{z as SecretsConfig};
|