@nextclaw/ui 0.12.35-beta.7 → 0.12.36

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.
Files changed (27) hide show
  1. package/CHANGELOG.md +482 -0
  2. package/dist/assets/{channels-list-page-D-tv11dc.js → channels-list-page-DXH1qYLs.js} +1 -1
  3. package/dist/assets/{chat-page-MyXEZI8R.js → chat-page-Cpo0AFHb.js} +1 -1
  4. package/dist/assets/{desktop-update-config-oZpIKKtS.js → desktop-update-config-Be8x1jNy.js} +1 -1
  5. package/dist/assets/doc-browser-BI7HSaMK.js +3 -0
  6. package/dist/assets/doc-browser-yTfN7UBH.js +1 -0
  7. package/dist/assets/{index-D2H2CKYR.js → index-GVTiCf1s.js} +4 -4
  8. package/dist/assets/{mcp-marketplace-page-CegP14Hl.js → mcp-marketplace-page-DDjeHd1I.js} +1 -1
  9. package/dist/assets/mcp-marketplace-page-WUkc7n94.js +1 -0
  10. package/dist/assets/{model-config-fIE_Asps.js → model-config-BjXMpU9U.js} +1 -1
  11. package/dist/assets/{provider-scoped-model-input-D4zRsGZ6.js → provider-scoped-model-input-t1tCP5y5.js} +1 -1
  12. package/dist/assets/{providers-list-CqsOk2hr.js → providers-list-C1D5p9kK.js} +1 -1
  13. package/dist/assets/remote-BHeENKxL.js +1 -0
  14. package/dist/assets/{runtime-config-page-BJ86cC8a.js → runtime-config-page--O0Wq01S.js} +1 -1
  15. package/dist/assets/{search-config-TbCPlRE7.js → search-config-Dzpizo-_.js} +1 -1
  16. package/dist/assets/{secrets-config-DBIEKP_V.js → secrets-config-D1AUSEXX.js} +1 -1
  17. package/dist/index.html +2 -2
  18. package/package.json +8 -8
  19. package/src/features/panel-apps/managers/panel-app-bridge.manager.test.ts +68 -0
  20. package/src/features/panel-apps/managers/panel-app-bridge.manager.ts +3 -3
  21. package/src/shared/components/doc-browser/doc-browser-panel-parts.tsx +3 -7
  22. package/src/shared/components/doc-browser/doc-browser-renderer.types.ts +1 -0
  23. package/src/shared/components/doc-browser/doc-browser.tsx +4 -4
  24. package/dist/assets/doc-browser-B2OFjScU.js +0 -3
  25. package/dist/assets/doc-browser-BrUQEZ1j.js +0 -1
  26. package/dist/assets/mcp-marketplace-page-MjpFEEkY.js +0 -1
  27. package/dist/assets/remote-BMWQUPDW.js +0 -1
@@ -1,4 +1,4 @@
1
- import{d as e,h as t,i as n,m as r,v as i}from"./react-B2X_ph0a.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,Mt as m,Nt as h,O as g,Rt as _,Tt as v,Ut as y,Vt as b,Wt as x,Xt as S,_t as C,an as w,en as T,in as E,j as D,k as O,kt as ee,nn as te,qt as ne,rn as re,tn as k,wt as A,zt as j}from"./api-DruAcori.js";import{d as ie,f as ae,p as oe}from"./doc-browser-B2OFjScU.js";import{a as se,c as M,i as N,l as ce,n as le,o as ue,r as de,s as P}from"./mcp-marketplace-page-CegP14Hl.js";import{a as F,c as fe,i as I,n as pe,o as L,r as R,s as me}from"./confirm-dialog-B0TP-vPd.js";import{t as z}from"./createLucideIcon-Br1EFMEr.js";import{n as he}from"./search-CdhgFNwf.js";import{i as ge,n as _e,r as ve,t as ye}from"./provider-scoped-model-input-D4zRsGZ6.js";import{t as be}from"./play-CqNi0u02.js";import{t as xe}from"./plus-BcIC8dG1.js";import{n as Se}from"./doc-browser-context-DB6TTHeE.js";import{$t as Ce,A as we,B as Te,C as Ee,Ct as De,D as Oe,E as ke,Et as Ae,F as je,H as Me,I as B,J as V,Jt as Ne,K as Pe,Kt as H,L as Fe,M as Ie,Mt as Le,N as Re,Nt as ze,O as Be,P as Ve,Q as He,Qt as Ue,R as We,S as Ge,St as Ke,T as qe,Tt as Je,V as Ye,X as Xe,Y as Ze,Yt as Qe,Z as $e,_ as et,a as tt,b as nt,c as rt,cn as it,d as at,dn as ot,f as st,fn as ct,ft as lt,g as ut,h as dt,i as ft,in as pt,j as mt,jt as ht,k as gt,l as _t,lt as vt,m as yt,n as bt,nt as xt,o as St,ot as Ct,p as wt,q as Tt,r as Et,s as Dt,sn as Ot,st as kt,t as At,tn as jt,tt as Mt,u as U,v as Nt,w as Pt,wt as Ft,x as W,xt as It,y as G,z as Lt}from"./index-D2H2CKYR.js";import{t as Rt}from"./tabs-custom-BBXu1OGs.js";import{t as zt}from"./tag-chip-ix15P-r4.js";function Bt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Vt(e,t,n){let r=e.slice(0);return r[t]=n,r}var Ht=class extends w{#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,k.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||!E(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Bt(e,n).forEach(e=>{e.destroy()}),Bt(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=re(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 T(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#p(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Vt(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)&&k.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},K=i(t(),1);function Ut({queries:e,...t},n){let r=S(n),i=d(),a=ne(),o=K.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{b(e),x(e,a,r.getQueryCache().get(e.queryHash))}),f(a);let[s]=K.useState(()=>new Ht(r,o,t)),[c,p,m]=s.getOptimisticResult(o,t.combine),h=!i&&t.subscribed!==!1;K.useSyncExternalStore(K.useCallback(e=>h?s.subscribe(k.batchCalls(e)):te,[s,h]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),K.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let g=c.some((e,t)=>y(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&y(n,e)?u(n,new T(r,n),a):[]}):[];if(g.length>0)throw Promise.all(g);let _=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(_?.error)throw _.error;return p(m())}var Wt=z(`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`}]]),Gt=z(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Kt=z(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),qt=z(`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`}]]),Jt=z(`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`}]]),Yt=z(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Xt=z(`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`}]]),Zt=z(`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`}]]),Qt=z(`Power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),$t=z(`SquareTerminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),q=r(),en=K.forwardRef(({className:t,...n},r)=>(0,q.jsx)(`textarea`,{className:e(`flex min-h-28 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2.5 text-sm text-gray-900 placeholder:text-gray-300 placeholder:font-normal focus:outline-none focus:ring-1 focus:ring-primary/40 focus:border-primary/40 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,t),ref:r,...n}));en.displayName=`Textarea`;function tn(e){return{displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,model:e.model??``,runtime:e.runtime??e.engine??``}}function nn(e){let{runtimeOptions:t,currentRuntime:n}=e,r=n.trim();if(!r)return t;let i=G(r);return t.some(e=>e.value===i)?t:[...t,{value:i,label:W(i),icon:null,ready:!1,reason:`unavailable`,reasonMessage:null,supportedModels:void 0,recommendedModel:null,cta:null}].sort((e,t)=>e.value===`native`?-1:t.value===`native`?1:e.value.localeCompare(t.value))}function rn({value:e,disabled:t=!1,runtimeOptions:r,defaultRuntime:i,onChange:a}){let o=e.trim()?G(e):``,s=nn({runtimeOptions:r,currentRuntime:e}),c=s.find(e=>e.value===o)??null,l=c?.reasonMessage?.trim()||(c?.ready===!1?n(`agentsRuntimeUnavailableHelp`):``);return(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsxs)(Pe,{value:o||i,onValueChange:e=>a(e===i?``:e),disabled:t,children:[(0,q.jsx)(Ze,{"aria-label":n(`agentsCardRuntimeLabel`),className:`rounded-xl`,children:(0,q.jsx)(Xe,{placeholder:n(`agentsRuntimeSelectPlaceholder`)})}),(0,q.jsx)(Tt,{className:`rounded-xl`,children:s.map(e=>(0,q.jsx)(V,{value:e.value,disabled:e.ready===!1&&e.value!==o,className:`rounded-lg`,children:e.label},e.value))})]}),l?(0,q.jsx)(`p`,{className:`text-xs text-gray-500`,children:l}):null]})}function an({agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,q.jsx)(R,{open:e!==null,onOpenChange:a,children:e?(0,q.jsx)(on,{agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e.id):null})}function on(e){let{agent:t,pending:r,providerCatalog:i,runtimeOptions:a,defaultRuntime:o,onOpenChange:s,onSubmit:c}=e,[l,u]=(0,K.useState)(tn(t));return(0,q.jsxs)(I,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-[linear-gradient(180deg,#fff9f1_0%,#ffffff_24%)] p-0 sm:max-h-[760px] sm:max-w-xl`,children:[(0,q.jsx)(`div`,{className:`shrink-0 border-b border-[#f0e2c8] px-6 py-6`,children:(0,q.jsxs)(me,{className:`text-left`,children:[(0,q.jsx)(fe,{children:n(`agentsEditDialogTitle`)}),(0,q.jsx)(F,{children:n(`agentsEditDialogDescription`)})]})}),(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(pe,{tone:`warning`,title:n(`agentsEditHomeReadonly`),description:n(`agentsEditHomeReadonlyHint`),children:(0,q.jsx)(`div`,{className:`break-all text-sm text-amber-950`,children:t.workspace??`-`})}),(0,q.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,q.jsx)(m,{value:l.displayName,onChange:e=>u(t=>({...t,displayName:e.target.value})),placeholder:n(`agentsFormNamePlaceholder`)}),(0,q.jsx)(en,{value:l.description,onChange:e=>u(t=>({...t,description:e.target.value})),placeholder:n(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,q.jsx)(m,{value:l.avatar,onChange:e=>u(t=>({...t,avatar:e.target.value})),placeholder:n(`agentsFormAvatarPlaceholder`)}),(0,q.jsx)(ye,{value:l.model,onChange:e=>u(t=>({...t,model:e})),providerCatalog:i,disabled:r,className:`md:col-span-2`}),(0,q.jsx)(rn,{value:l.runtime,onChange:e=>u(t=>({...t,runtime:e})),runtimeOptions:a,defaultRuntime:o,disabled:r})]})]})}),(0,q.jsxs)(L,{className:`shrink-0 border-t border-[#f1e7d4] px-6 py-5`,children:[(0,q.jsx)(h,{type:`button`,variant:`ghost`,onClick:()=>s(!1),disabled:r,children:n(`cancel`)}),(0,q.jsxs)(h,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>c(t.id,l),disabled:r,children:[(0,q.jsx)(Ce,{className:`mr-2 h-4 w-4`}),n(`agentsEditSaveAction`)]})]})]})}var sn=`请直接创建一个默认示例 Agent,不要问我问题。创建完成后,简单告诉我它能做什么。`;function cn(e){let{agentCount:t,onCreate:r}=e;return(0,q.jsxs)(`section`,{className:`flex flex-col gap-3 border-b border-gray-200 pb-4 sm:flex-row sm:items-end sm:justify-between`,children:[(0,q.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`h1`,{className:`text-xl font-semibold text-gray-950`,children:n(`agentsHeroEyebrow`)}),(0,q.jsx)(`span`,{className:`rounded-full border border-gray-200 bg-white px-2 py-0.5 text-xs font-medium text-gray-500`,children:t})]}),(0,q.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-gray-500`,children:n(`agentsHeroDescription`)})]}),(0,q.jsxs)(h,{type:`button`,variant:`primary`,className:`h-9 shrink-0 rounded-xl px-4 text-sm font-semibold`,onClick:r,children:[(0,q.jsx)(xe,{className:`mr-2 h-4 w-4`}),n(`agentsCreateButton`)]})]})}function ln(t){let{icon:n,label:r,disabled:i=!1,destructive:a=!1,onClick:o}=t;return(0,q.jsxs)(`button`,{type:`button`,className:e(`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50`,a?`text-destructive hover:bg-destructive/10`:`text-gray-700 hover:bg-gray-100`),onClick:o,disabled:i,children:[(0,q.jsx)(n,{className:`h-4 w-4 shrink-0`}),(0,q.jsx)(`span`,{children:r})]})}function un(e){let{agent:t,runtimeOptions:r,defaultRuntimeLabel:i,updatePending:a,deletePending:o,onStartChat:s,onEdit:c,onDelete:l}=e,u=t.runtime?.trim()||t.engine?.trim()||``,d=u?r.find(e=>e.value===G(u))?.label??W(u):i;return(0,q.jsx)(A,{className:`group overflow-hidden border border-gray-200 bg-white shadow-none transition-colors duration-200 hover:border-gray-300`,children:(0,q.jsxs)(v,{className:`relative flex h-full flex-col gap-3 px-3.5 py-3.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-2.5 pr-16`,children:[(0,q.jsx)(Me,{agentId:t.id,displayName:t.displayName,avatarUrl:t.avatarUrl,className:`h-9 w-9 shrink-0`}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`div`,{className:`truncate text-sm font-semibold text-gray-950`,children:t.displayName?.trim()||t.id}),t.builtIn?(0,q.jsxs)(zt,{tone:`warning`,className:`h-5 gap-1 border-amber-200 bg-amber-50 px-1.5 text-[10px] text-amber-700`,children:[(0,q.jsx)(Qe,{className:`h-3 w-3`}),n(`agentsCardBuiltInTag`)]}):null]}),(0,q.jsxs)(`div`,{className:`truncate text-xs text-gray-400`,children:[`@`,t.id]})]})]}),(0,q.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 flex items-center gap-1 opacity-100 transition-opacity md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,children:[(0,q.jsx)(h,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-gray-400 hover:text-gray-800`,"aria-label":n(`agentsCardStartChat`),title:n(`agentsCardStartChat`),onClick:s,children:(0,q.jsx)(jt,{className:`h-4 w-4`})}),(0,q.jsxs)(ht,{children:[(0,q.jsx)(ze,{asChild:!0,children:(0,q.jsx)(h,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-gray-400 hover:text-gray-800`,"aria-label":n(`chatSessionMoreActions`),title:n(`chatSessionMoreActions`),children:(0,q.jsx)(Yt,{className:`h-4 w-4`})})}),(0,q.jsxs)(Le,{align:`end`,className:`w-44 p-1.5`,children:[(0,q.jsx)(ln,{icon:Ce,label:n(`agentsEditAction`),onClick:c,disabled:a}),t.builtIn?null:(0,q.jsx)(ln,{icon:H,label:n(`agentsRemoveAction`),onClick:l,disabled:o,destructive:!0})]})]})]}),(0,q.jsx)(`p`,{className:`line-clamp-2 min-h-10 text-sm leading-5 text-gray-600`,children:t.description?.trim()||(t.builtIn?n(`agentsCardBuiltInSummary`):n(`agentsCardCustomSummary`))}),(0,q.jsxs)(`div`,{className:`mt-auto grid gap-2 border-t border-gray-100 pt-2 text-xs text-gray-500`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(Ne,{className:`h-3.5 w-3.5 shrink-0 text-gray-300`}),(0,q.jsx)(`span`,{className:`truncate`,children:d})]}),(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(pt,{className:`h-3.5 w-3.5 shrink-0 text-gray-300`}),(0,q.jsx)(`span`,{className:`truncate`,children:t.workspace??`-`})]})]})]})})}function dn(){let e=Lt(),t=Ee(),r=$e(),i=He(),a=Dt(),s=qe(),c=Pt(),[l,u]=(0,K.useState)(null),d=(0,K.useMemo)(()=>t.data?.agents??[],[t.data?.agents]),f=(0,K.useMemo)(()=>[...d].sort((e,t)=>Number(!!t.builtIn)-Number(!!e.builtIn)||e.id.localeCompare(t.id)),[d]),p=(0,K.useMemo)(()=>_e({config:r.data,meta:i.data,onlyConfigured:!0}),[i.data,r.data]),m=(0,K.useMemo)(()=>Nt(a.data?.options??[]),[a.data?.options]),g=(0,K.useMemo)(()=>G(a.data?.defaultType??`native`),[a.data?.defaultType]),_=(0,K.useMemo)(()=>m.find(e=>e.value===g)?.label??W(g),[g,m]),y=e=>{u(e)},b=async(e,t)=>{await s.mutateAsync({agentId:e,data:{displayName:t.displayName,description:t.description,avatar:t.avatar,model:t.model,...t.runtime.trim()?{runtime:t.runtime.trim()}:{runtime:``}}}),u(null)},x=t=>{e.chatSessionListManager.startAgentDraftChat(t.id,nt(t,g))};return(0,q.jsxs)(o,{className:`space-y-5`,children:[(0,q.jsx)(cn,{agentCount:d.length,onCreate:()=>e.startAgentCreationDraft(sn)}),(0,q.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:t.isLoading?(0,q.jsx)(A,{className:`md:col-span-2 xl:col-span-3 border-dashed border-[#d9dce3] bg-white/70`,children:(0,q.jsx)(v,{className:`py-14 text-center text-sm text-gray-500`,children:n(`agentsLoading`)})}):f.length===0?(0,q.jsx)(A,{className:`md:col-span-2 xl:col-span-3 overflow-hidden border-dashed border-[#d9dce3] bg-[linear-gradient(135deg,#fff7ea_0%,#f4fbff_100%)]`,children:(0,q.jsxs)(v,{className:`flex min-h-[240px] flex-col items-center justify-center px-6 py-14 text-center`,children:[(0,q.jsx)(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-white/80 shadow-[0_18px_44px_rgba(0,0,0,0.08)]`,children:(0,q.jsx)(ot,{className:`h-8 w-8 text-[#d39a3b]`})}),(0,q.jsx)(`div`,{className:`text-lg font-semibold text-[#2f2212]`,children:n(`agentsEmpty`)}),(0,q.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-[#78644d]`,children:n(`agentsEmptyDescription`)}),(0,q.jsxs)(h,{type:`button`,variant:`primary`,className:`mt-5 rounded-2xl px-5`,onClick:()=>e.startAgentCreationDraft(sn),children:[(0,q.jsx)(xe,{className:`mr-2 h-4 w-4`}),n(`agentsCreateButton`)]})]})}):f.map(e=>(0,q.jsx)(un,{agent:e,runtimeOptions:m,defaultRuntimeLabel:_,updatePending:s.isPending,deletePending:c.isPending,onStartChat:()=>x(e),onEdit:()=>y(e),onDelete:()=>c.mutate({agentId:e.id})},e.id))}),(0,q.jsx)(an,{agent:l,pending:s.isPending,providerCatalog:p,runtimeOptions:m,defaultRuntime:g,onOpenChange:e=>{!e&&!s.isPending&&u(null)},onSubmit:b})]})}function fn(e,t){let n=t.trim().toLowerCase();return n?[e.id,e.name,e.payload.message,e.payload.sessionId??``,e.payload.channel??``,e.payload.to??``].join(` `).toLowerCase().includes(n):!0}function pn(e,t){return t===`all`?!0:t===`enabled`?e.enabled:!e.enabled}function mn(t){let{job:r,onDelete:i,onRun:a,onToggle:o}=t;return(0,q.jsx)(A,{className:`border border-gray-200`,children:(0,q.jsx)(v,{className:`pt-5 pb-5`,children:(0,q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,q.jsxs)(`div`,{className:`min-w-[220px] flex-1`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`text-sm font-semibold text-gray-900`,children:r.name||r.id}),(0,q.jsx)(`span`,{className:`rounded-full bg-gray-100 px-2 py-0.5 text-[10px] font-semibold text-gray-500`,children:r.id}),(0,q.jsx)(`span`,{className:e(`rounded-full px-2 py-0.5 text-[10px] font-semibold`,r.enabled?`bg-emerald-50 text-emerald-700`:`bg-gray-100 text-gray-500`),children:r.enabled?n(`enabled`):n(`disabled`)}),r.deleteAfterRun?(0,q.jsx)(`span`,{className:`rounded-full bg-amber-50 px-2 py-0.5 text-[10px] font-semibold text-amber-700`,children:n(`cronOneShot`)}):null]}),(0,q.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[n(`cronScheduleLabel`),`: `,st(r)]}),(0,q.jsx)(`div`,{className:`mt-2 whitespace-pre-wrap break-words text-sm text-gray-700`,children:r.payload.message}),(0,q.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[n(`cronSessionLabel`),`: `,wt(r)]}),(0,q.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[n(`cronDeliverTo`),`: `,at(r)]})]}),(0,q.jsxs)(`div`,{className:`min-w-[220px] space-y-2 text-xs text-gray-500`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[n(`cronNextRun`),`:`]}),` `,yt(r.state.nextRunAt)]}),(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[n(`cronLastRun`),`:`]}),` `,yt(r.state.lastRunAt)]}),(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[n(`cronLastStatus`),`:`]}),` `,r.state.lastStatus??`-`]}),r.state.lastError?(0,q.jsx)(`div`,{className:`break-words text-[11px] text-red-500`,children:r.state.lastError}):null]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-end gap-2`,children:[(0,q.jsxs)(h,{variant:`subtle`,size:`sm`,onClick:()=>a(r),className:`gap-1`,children:[(0,q.jsx)(be,{className:`h-3.5 w-3.5`}),n(`cronRunNow`)]}),(0,q.jsxs)(h,{variant:r.enabled?`outline`:`primary`,size:`sm`,onClick:()=>o(r),className:`gap-1`,children:[(0,q.jsx)(Qt,{className:`h-3.5 w-3.5`}),r.enabled?n(`cronDisable`):n(`cronEnable`)]}),(0,q.jsxs)(h,{variant:`destructive`,size:`sm`,onClick:()=>i(r),className:`gap-1`,children:[(0,q.jsx)(H,{className:`h-3.5 w-3.5`}),n(`delete`)]})]})]})})})}function hn(){let[t,r]=(0,K.useState)(``),[i,a]=(0,K.useState)(`all`),s=Mt({all:!0}),c=xt(),l=lt(),u=vt(),{confirm:d,ConfirmDialog:f}=dt(),p=(0,K.useMemo)(()=>(s.data?.jobs??[]).filter(e=>fn(e,t)).filter(e=>pn(e,i)),[s.data,t,i]),g=async e=>{await d({title:`${n(`cronDeleteConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,variant:`destructive`,confirmLabel:n(`delete`)})&&c.mutate({id:e.id})},_=async e=>{let t=!e.enabled;await d({title:t?`${n(`cronEnableConfirm`)}?`:`${n(`cronDisableConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,variant:t?`default`:`destructive`,confirmLabel:n(t?`cronEnable`:`cronDisable`)})&&l.mutate({id:e.id,enabled:t})},v=async e=>{let t=!e.enabled;await d({title:t?`${n(`cronRunForceConfirm`)}?`:`${n(`cronRunConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,confirmLabel:n(`cronRunNow`)})&&u.mutate({id:e.id,force:t})};return(0,q.jsxs)(o,{fullHeight:!0,children:[(0,q.jsx)(ee,{title:n(`cronPageTitle`),description:n(`cronPageDescription`),actions:(0,q.jsx)(h,{variant:`ghost`,size:`icon`,className:`h-9 w-9 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100`,onClick:()=>s.refetch(),children:(0,q.jsx)(Ue,{className:e(`h-4 w-4`,s.isFetching&&`animate-spin`)})})}),(0,q.jsx)(`div`,{className:`mb-6`,children:(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center`,children:[(0,q.jsxs)(`div`,{className:`relative flex-1 min-w-[240px]`,children:[(0,q.jsx)(m,{value:t,onChange:e=>r(e.target.value),placeholder:n(`cronSearchPlaceholder`),className:`pl-9`}),(0,q.jsx)(ct,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`})]}),(0,q.jsx)(`div`,{className:`min-w-[180px]`,children:(0,q.jsxs)(Pe,{value:i,onValueChange:e=>a(e),children:[(0,q.jsx)(Ze,{className:`w-full`,children:(0,q.jsx)(Xe,{placeholder:n(`cronStatusLabel`)})}),(0,q.jsxs)(Tt,{children:[(0,q.jsx)(V,{value:`all`,children:n(`cronStatusAll`)}),(0,q.jsx)(V,{value:`enabled`,children:n(`cronStatusEnabled`)}),(0,q.jsx)(V,{value:`disabled`,children:n(`cronStatusDisabled`)})]})]})}),(0,q.jsxs)(`div`,{className:`text-xs text-gray-500 ml-auto`,children:[n(`cronTotalLabel`),`: `,s.data?.total??0,` / `,p.length]})]})}),(0,q.jsx)(`div`,{className:`flex-1 overflow-auto custom-scrollbar`,children:s.isLoading?(0,q.jsx)(`div`,{className:`text-sm text-gray-400 p-4 text-center`,children:n(`cronLoading`)}):p.length===0?(0,q.jsx)(`div`,{className:`text-sm text-gray-400 p-4 text-center`,children:n(`cronEmpty`)}):(0,q.jsx)(`div`,{className:`space-y-4`,children:p.map(e=>(0,q.jsx)(mn,{job:e,onDelete:g,onRun:v,onToggle:_},e.id))})}),(0,q.jsx)(f,{})]})}function gn(e){return Array.from(new Set(e.map(e=>e.spec).filter(Boolean)))}function _n(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 vn(e,t){return!!(t.spec&&e.spec===t.spec||t.id&&e.id===t.id)}function yn(e,t){return t??{type:e,total:0,specs:[],records:[]}}function bn(e){let t=yn(e.result.type,e.view),n=_n(e),r=t.records.findIndex(e=>vn(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:gn(i),total:i.length}}function xn(e){let t=yn(e.result.type,e.view);if(e.result.action===`uninstall`||e.result.action===`remove`){let n=t.records.filter(t=>!vn(t,{id:e.result.id,spec:e.request.spec}));return{...t,records:n,specs:gn(n),total:n.length}}let n=t.records.map(t=>vn(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:gn(n),total:n.length}}function Sn(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&&Cn(r,e)?t:void 0},staleTime:15e3}),n=(0,K.useMemo)(()=>M(t.data),[t.data]);return{...t,data:n}}function Cn(e,t){return e.q===t.q&&e.tag===t.tag&&e.scene===t.scene&&e.sort===t.sort&&e.pageSize===t.pageSize}function wn(e=!0){return j({queryKey:[`marketplace-skill-scenes`],queryFn:O,enabled:e,staleTime:6e4})}function Tn(e,t=!0){let n=Ut({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,K.useMemo)(()=>{let t=new Map;return e.forEach((e,r)=>{let i=typeof e.count==`number`?e.count:n[r]?.data?.total;typeof i==`number`&&t.set(e.scene,i)}),t},[n,e])}function En(e){return j({queryKey:[`marketplace-installed`,e],queryFn:()=>c(e),staleTime:1e4})}function Dn(){let e=S();return _({mutationFn:e=>a(e),onSuccess:(t,r)=>{e.setQueryData([`marketplace-installed`,t.type],e=>bn({view:e,request:r,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`}),p.success(t.message||n(`marketplaceInstallSuccessSkill`))},onError:e=>{p.error(e.message||n(`marketplaceInstallFailed`))}})}function On(){let e=S();return _({mutationFn:e=>D(e),onSuccess:(t,r)=>{e.setQueryData([`marketplace-installed`,t.type],e=>xn({view:e,request:r,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`});let i=t.action===`enable`?n(`marketplaceEnableSuccess`):t.action===`disable`?n(`marketplaceDisableSuccess`):n(`marketplaceUninstallSuccess`);p.success(t.message||i)},onError:e=>{p.error(e.message||n(`marketplaceOperationFailed`))}})}function kn(e){return(e??``).trim().toLowerCase()}function J(e,t){let n=kn(t);return n.length>0?`${e}:${n}`:``}function An(e){let t=new Map;for(let n of e){let e=[n.install.spec,n.slug,n.id];for(let r of e){let e=J(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function jn(e){let t=new Map;for(let n of e){let e=[n.spec,n.id,n.label];for(let r of e){let e=J(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function Mn(e,t){let n=[e.install.spec,e.slug,e.id];for(let r of n){let n=J(e.type,r);if(!n)continue;let i=t.get(n);if(i)return i}}function Nn(e,t){return t.get(J(e.type,e.spec))||t.get(J(e.type,e.id))||t.get(J(e.type,e.label))}function Pn(e,t,n,r){let i=kn(n);if(!i)return!0;let a=N(t?.summaryI18n,t?.summary,r);return[e.id,e.spec,e.label,t?.name,t?.slug,t?.summary,a,...t?.tags??[]].map(e=>kn(e)).filter(Boolean).some(e=>e.includes(i))}function Y(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}function Fn(e){let t=e.replace(/\r\n/g,`
1
+ import{d as e,h as t,i as n,m as r,v as i}from"./react-B2X_ph0a.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,Mt as m,Nt as h,O as g,Rt as _,Tt as v,Ut as y,Vt as b,Wt as x,Xt as S,_t as C,an as w,en as T,in as E,j as D,k as O,kt as ee,nn as te,qt as ne,rn as re,tn as k,wt as A,zt as j}from"./api-DruAcori.js";import{d as ie,f as ae,p as oe}from"./doc-browser-BI7HSaMK.js";import{a as se,c as M,i as N,l as ce,n as le,o as ue,r as de,s as P}from"./mcp-marketplace-page-DDjeHd1I.js";import{a as F,c as fe,i as I,n as pe,o as L,r as R,s as me}from"./confirm-dialog-B0TP-vPd.js";import{t as z}from"./createLucideIcon-Br1EFMEr.js";import{n as he}from"./search-CdhgFNwf.js";import{i as ge,n as _e,r as ve,t as ye}from"./provider-scoped-model-input-t1tCP5y5.js";import{t as be}from"./play-CqNi0u02.js";import{t as xe}from"./plus-BcIC8dG1.js";import{n as Se}from"./doc-browser-context-DB6TTHeE.js";import{$t as Ce,A as we,B as Te,C as Ee,Ct as De,D as Oe,E as ke,Et as Ae,F as je,H as Me,I as B,J as V,Jt as Ne,K as Pe,Kt as H,L as Fe,M as Ie,Mt as Le,N as Re,Nt as ze,O as Be,P as Ve,Q as He,Qt as Ue,R as We,S as Ge,St as Ke,T as qe,Tt as Je,V as Ye,X as Xe,Y as Ze,Yt as Qe,Z as $e,_ as et,a as tt,b as nt,c as rt,cn as it,d as at,dn as ot,f as st,fn as ct,ft as lt,g as ut,h as dt,i as ft,in as pt,j as mt,jt as ht,k as gt,l as _t,lt as vt,m as yt,n as bt,nt as xt,o as St,ot as Ct,p as wt,q as Tt,r as Et,s as Dt,sn as Ot,st as kt,t as At,tn as jt,tt as Mt,u as U,v as Nt,w as Pt,wt as Ft,x as W,xt as It,y as G,z as Lt}from"./index-GVTiCf1s.js";import{t as Rt}from"./tabs-custom-BBXu1OGs.js";import{t as zt}from"./tag-chip-ix15P-r4.js";function Bt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Vt(e,t,n){let r=e.slice(0);return r[t]=n,r}var Ht=class extends w{#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,k.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||!E(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Bt(e,n).forEach(e=>{e.destroy()}),Bt(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=re(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 T(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#p(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Vt(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)&&k.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},K=i(t(),1);function Ut({queries:e,...t},n){let r=S(n),i=d(),a=ne(),o=K.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{b(e),x(e,a,r.getQueryCache().get(e.queryHash))}),f(a);let[s]=K.useState(()=>new Ht(r,o,t)),[c,p,m]=s.getOptimisticResult(o,t.combine),h=!i&&t.subscribed!==!1;K.useSyncExternalStore(K.useCallback(e=>h?s.subscribe(k.batchCalls(e)):te,[s,h]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),K.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let g=c.some((e,t)=>y(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&y(n,e)?u(n,new T(r,n),a):[]}):[];if(g.length>0)throw Promise.all(g);let _=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(_?.error)throw _.error;return p(m())}var Wt=z(`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`}]]),Gt=z(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Kt=z(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),qt=z(`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`}]]),Jt=z(`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`}]]),Yt=z(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Xt=z(`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`}]]),Zt=z(`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`}]]),Qt=z(`Power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),$t=z(`SquareTerminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),q=r(),en=K.forwardRef(({className:t,...n},r)=>(0,q.jsx)(`textarea`,{className:e(`flex min-h-28 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2.5 text-sm text-gray-900 placeholder:text-gray-300 placeholder:font-normal focus:outline-none focus:ring-1 focus:ring-primary/40 focus:border-primary/40 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,t),ref:r,...n}));en.displayName=`Textarea`;function tn(e){return{displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,model:e.model??``,runtime:e.runtime??e.engine??``}}function nn(e){let{runtimeOptions:t,currentRuntime:n}=e,r=n.trim();if(!r)return t;let i=G(r);return t.some(e=>e.value===i)?t:[...t,{value:i,label:W(i),icon:null,ready:!1,reason:`unavailable`,reasonMessage:null,supportedModels:void 0,recommendedModel:null,cta:null}].sort((e,t)=>e.value===`native`?-1:t.value===`native`?1:e.value.localeCompare(t.value))}function rn({value:e,disabled:t=!1,runtimeOptions:r,defaultRuntime:i,onChange:a}){let o=e.trim()?G(e):``,s=nn({runtimeOptions:r,currentRuntime:e}),c=s.find(e=>e.value===o)??null,l=c?.reasonMessage?.trim()||(c?.ready===!1?n(`agentsRuntimeUnavailableHelp`):``);return(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsxs)(Pe,{value:o||i,onValueChange:e=>a(e===i?``:e),disabled:t,children:[(0,q.jsx)(Ze,{"aria-label":n(`agentsCardRuntimeLabel`),className:`rounded-xl`,children:(0,q.jsx)(Xe,{placeholder:n(`agentsRuntimeSelectPlaceholder`)})}),(0,q.jsx)(Tt,{className:`rounded-xl`,children:s.map(e=>(0,q.jsx)(V,{value:e.value,disabled:e.ready===!1&&e.value!==o,className:`rounded-lg`,children:e.label},e.value))})]}),l?(0,q.jsx)(`p`,{className:`text-xs text-gray-500`,children:l}):null]})}function an({agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,q.jsx)(R,{open:e!==null,onOpenChange:a,children:e?(0,q.jsx)(on,{agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e.id):null})}function on(e){let{agent:t,pending:r,providerCatalog:i,runtimeOptions:a,defaultRuntime:o,onOpenChange:s,onSubmit:c}=e,[l,u]=(0,K.useState)(tn(t));return(0,q.jsxs)(I,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-[linear-gradient(180deg,#fff9f1_0%,#ffffff_24%)] p-0 sm:max-h-[760px] sm:max-w-xl`,children:[(0,q.jsx)(`div`,{className:`shrink-0 border-b border-[#f0e2c8] px-6 py-6`,children:(0,q.jsxs)(me,{className:`text-left`,children:[(0,q.jsx)(fe,{children:n(`agentsEditDialogTitle`)}),(0,q.jsx)(F,{children:n(`agentsEditDialogDescription`)})]})}),(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(pe,{tone:`warning`,title:n(`agentsEditHomeReadonly`),description:n(`agentsEditHomeReadonlyHint`),children:(0,q.jsx)(`div`,{className:`break-all text-sm text-amber-950`,children:t.workspace??`-`})}),(0,q.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,q.jsx)(m,{value:l.displayName,onChange:e=>u(t=>({...t,displayName:e.target.value})),placeholder:n(`agentsFormNamePlaceholder`)}),(0,q.jsx)(en,{value:l.description,onChange:e=>u(t=>({...t,description:e.target.value})),placeholder:n(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,q.jsx)(m,{value:l.avatar,onChange:e=>u(t=>({...t,avatar:e.target.value})),placeholder:n(`agentsFormAvatarPlaceholder`)}),(0,q.jsx)(ye,{value:l.model,onChange:e=>u(t=>({...t,model:e})),providerCatalog:i,disabled:r,className:`md:col-span-2`}),(0,q.jsx)(rn,{value:l.runtime,onChange:e=>u(t=>({...t,runtime:e})),runtimeOptions:a,defaultRuntime:o,disabled:r})]})]})}),(0,q.jsxs)(L,{className:`shrink-0 border-t border-[#f1e7d4] px-6 py-5`,children:[(0,q.jsx)(h,{type:`button`,variant:`ghost`,onClick:()=>s(!1),disabled:r,children:n(`cancel`)}),(0,q.jsxs)(h,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>c(t.id,l),disabled:r,children:[(0,q.jsx)(Ce,{className:`mr-2 h-4 w-4`}),n(`agentsEditSaveAction`)]})]})]})}var sn=`请直接创建一个默认示例 Agent,不要问我问题。创建完成后,简单告诉我它能做什么。`;function cn(e){let{agentCount:t,onCreate:r}=e;return(0,q.jsxs)(`section`,{className:`flex flex-col gap-3 border-b border-gray-200 pb-4 sm:flex-row sm:items-end sm:justify-between`,children:[(0,q.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`h1`,{className:`text-xl font-semibold text-gray-950`,children:n(`agentsHeroEyebrow`)}),(0,q.jsx)(`span`,{className:`rounded-full border border-gray-200 bg-white px-2 py-0.5 text-xs font-medium text-gray-500`,children:t})]}),(0,q.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-gray-500`,children:n(`agentsHeroDescription`)})]}),(0,q.jsxs)(h,{type:`button`,variant:`primary`,className:`h-9 shrink-0 rounded-xl px-4 text-sm font-semibold`,onClick:r,children:[(0,q.jsx)(xe,{className:`mr-2 h-4 w-4`}),n(`agentsCreateButton`)]})]})}function ln(t){let{icon:n,label:r,disabled:i=!1,destructive:a=!1,onClick:o}=t;return(0,q.jsxs)(`button`,{type:`button`,className:e(`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50`,a?`text-destructive hover:bg-destructive/10`:`text-gray-700 hover:bg-gray-100`),onClick:o,disabled:i,children:[(0,q.jsx)(n,{className:`h-4 w-4 shrink-0`}),(0,q.jsx)(`span`,{children:r})]})}function un(e){let{agent:t,runtimeOptions:r,defaultRuntimeLabel:i,updatePending:a,deletePending:o,onStartChat:s,onEdit:c,onDelete:l}=e,u=t.runtime?.trim()||t.engine?.trim()||``,d=u?r.find(e=>e.value===G(u))?.label??W(u):i;return(0,q.jsx)(A,{className:`group overflow-hidden border border-gray-200 bg-white shadow-none transition-colors duration-200 hover:border-gray-300`,children:(0,q.jsxs)(v,{className:`relative flex h-full flex-col gap-3 px-3.5 py-3.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-2.5 pr-16`,children:[(0,q.jsx)(Me,{agentId:t.id,displayName:t.displayName,avatarUrl:t.avatarUrl,className:`h-9 w-9 shrink-0`}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`div`,{className:`truncate text-sm font-semibold text-gray-950`,children:t.displayName?.trim()||t.id}),t.builtIn?(0,q.jsxs)(zt,{tone:`warning`,className:`h-5 gap-1 border-amber-200 bg-amber-50 px-1.5 text-[10px] text-amber-700`,children:[(0,q.jsx)(Qe,{className:`h-3 w-3`}),n(`agentsCardBuiltInTag`)]}):null]}),(0,q.jsxs)(`div`,{className:`truncate text-xs text-gray-400`,children:[`@`,t.id]})]})]}),(0,q.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 flex items-center gap-1 opacity-100 transition-opacity md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,children:[(0,q.jsx)(h,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-gray-400 hover:text-gray-800`,"aria-label":n(`agentsCardStartChat`),title:n(`agentsCardStartChat`),onClick:s,children:(0,q.jsx)(jt,{className:`h-4 w-4`})}),(0,q.jsxs)(ht,{children:[(0,q.jsx)(ze,{asChild:!0,children:(0,q.jsx)(h,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-gray-400 hover:text-gray-800`,"aria-label":n(`chatSessionMoreActions`),title:n(`chatSessionMoreActions`),children:(0,q.jsx)(Yt,{className:`h-4 w-4`})})}),(0,q.jsxs)(Le,{align:`end`,className:`w-44 p-1.5`,children:[(0,q.jsx)(ln,{icon:Ce,label:n(`agentsEditAction`),onClick:c,disabled:a}),t.builtIn?null:(0,q.jsx)(ln,{icon:H,label:n(`agentsRemoveAction`),onClick:l,disabled:o,destructive:!0})]})]})]}),(0,q.jsx)(`p`,{className:`line-clamp-2 min-h-10 text-sm leading-5 text-gray-600`,children:t.description?.trim()||(t.builtIn?n(`agentsCardBuiltInSummary`):n(`agentsCardCustomSummary`))}),(0,q.jsxs)(`div`,{className:`mt-auto grid gap-2 border-t border-gray-100 pt-2 text-xs text-gray-500`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(Ne,{className:`h-3.5 w-3.5 shrink-0 text-gray-300`}),(0,q.jsx)(`span`,{className:`truncate`,children:d})]}),(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(pt,{className:`h-3.5 w-3.5 shrink-0 text-gray-300`}),(0,q.jsx)(`span`,{className:`truncate`,children:t.workspace??`-`})]})]})]})})}function dn(){let e=Lt(),t=Ee(),r=$e(),i=He(),a=Dt(),s=qe(),c=Pt(),[l,u]=(0,K.useState)(null),d=(0,K.useMemo)(()=>t.data?.agents??[],[t.data?.agents]),f=(0,K.useMemo)(()=>[...d].sort((e,t)=>Number(!!t.builtIn)-Number(!!e.builtIn)||e.id.localeCompare(t.id)),[d]),p=(0,K.useMemo)(()=>_e({config:r.data,meta:i.data,onlyConfigured:!0}),[i.data,r.data]),m=(0,K.useMemo)(()=>Nt(a.data?.options??[]),[a.data?.options]),g=(0,K.useMemo)(()=>G(a.data?.defaultType??`native`),[a.data?.defaultType]),_=(0,K.useMemo)(()=>m.find(e=>e.value===g)?.label??W(g),[g,m]),y=e=>{u(e)},b=async(e,t)=>{await s.mutateAsync({agentId:e,data:{displayName:t.displayName,description:t.description,avatar:t.avatar,model:t.model,...t.runtime.trim()?{runtime:t.runtime.trim()}:{runtime:``}}}),u(null)},x=t=>{e.chatSessionListManager.startAgentDraftChat(t.id,nt(t,g))};return(0,q.jsxs)(o,{className:`space-y-5`,children:[(0,q.jsx)(cn,{agentCount:d.length,onCreate:()=>e.startAgentCreationDraft(sn)}),(0,q.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:t.isLoading?(0,q.jsx)(A,{className:`md:col-span-2 xl:col-span-3 border-dashed border-[#d9dce3] bg-white/70`,children:(0,q.jsx)(v,{className:`py-14 text-center text-sm text-gray-500`,children:n(`agentsLoading`)})}):f.length===0?(0,q.jsx)(A,{className:`md:col-span-2 xl:col-span-3 overflow-hidden border-dashed border-[#d9dce3] bg-[linear-gradient(135deg,#fff7ea_0%,#f4fbff_100%)]`,children:(0,q.jsxs)(v,{className:`flex min-h-[240px] flex-col items-center justify-center px-6 py-14 text-center`,children:[(0,q.jsx)(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-white/80 shadow-[0_18px_44px_rgba(0,0,0,0.08)]`,children:(0,q.jsx)(ot,{className:`h-8 w-8 text-[#d39a3b]`})}),(0,q.jsx)(`div`,{className:`text-lg font-semibold text-[#2f2212]`,children:n(`agentsEmpty`)}),(0,q.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-[#78644d]`,children:n(`agentsEmptyDescription`)}),(0,q.jsxs)(h,{type:`button`,variant:`primary`,className:`mt-5 rounded-2xl px-5`,onClick:()=>e.startAgentCreationDraft(sn),children:[(0,q.jsx)(xe,{className:`mr-2 h-4 w-4`}),n(`agentsCreateButton`)]})]})}):f.map(e=>(0,q.jsx)(un,{agent:e,runtimeOptions:m,defaultRuntimeLabel:_,updatePending:s.isPending,deletePending:c.isPending,onStartChat:()=>x(e),onEdit:()=>y(e),onDelete:()=>c.mutate({agentId:e.id})},e.id))}),(0,q.jsx)(an,{agent:l,pending:s.isPending,providerCatalog:p,runtimeOptions:m,defaultRuntime:g,onOpenChange:e=>{!e&&!s.isPending&&u(null)},onSubmit:b})]})}function fn(e,t){let n=t.trim().toLowerCase();return n?[e.id,e.name,e.payload.message,e.payload.sessionId??``,e.payload.channel??``,e.payload.to??``].join(` `).toLowerCase().includes(n):!0}function pn(e,t){return t===`all`?!0:t===`enabled`?e.enabled:!e.enabled}function mn(t){let{job:r,onDelete:i,onRun:a,onToggle:o}=t;return(0,q.jsx)(A,{className:`border border-gray-200`,children:(0,q.jsx)(v,{className:`pt-5 pb-5`,children:(0,q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,q.jsxs)(`div`,{className:`min-w-[220px] flex-1`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`text-sm font-semibold text-gray-900`,children:r.name||r.id}),(0,q.jsx)(`span`,{className:`rounded-full bg-gray-100 px-2 py-0.5 text-[10px] font-semibold text-gray-500`,children:r.id}),(0,q.jsx)(`span`,{className:e(`rounded-full px-2 py-0.5 text-[10px] font-semibold`,r.enabled?`bg-emerald-50 text-emerald-700`:`bg-gray-100 text-gray-500`),children:r.enabled?n(`enabled`):n(`disabled`)}),r.deleteAfterRun?(0,q.jsx)(`span`,{className:`rounded-full bg-amber-50 px-2 py-0.5 text-[10px] font-semibold text-amber-700`,children:n(`cronOneShot`)}):null]}),(0,q.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[n(`cronScheduleLabel`),`: `,st(r)]}),(0,q.jsx)(`div`,{className:`mt-2 whitespace-pre-wrap break-words text-sm text-gray-700`,children:r.payload.message}),(0,q.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[n(`cronSessionLabel`),`: `,wt(r)]}),(0,q.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[n(`cronDeliverTo`),`: `,at(r)]})]}),(0,q.jsxs)(`div`,{className:`min-w-[220px] space-y-2 text-xs text-gray-500`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[n(`cronNextRun`),`:`]}),` `,yt(r.state.nextRunAt)]}),(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[n(`cronLastRun`),`:`]}),` `,yt(r.state.lastRunAt)]}),(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[n(`cronLastStatus`),`:`]}),` `,r.state.lastStatus??`-`]}),r.state.lastError?(0,q.jsx)(`div`,{className:`break-words text-[11px] text-red-500`,children:r.state.lastError}):null]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-end gap-2`,children:[(0,q.jsxs)(h,{variant:`subtle`,size:`sm`,onClick:()=>a(r),className:`gap-1`,children:[(0,q.jsx)(be,{className:`h-3.5 w-3.5`}),n(`cronRunNow`)]}),(0,q.jsxs)(h,{variant:r.enabled?`outline`:`primary`,size:`sm`,onClick:()=>o(r),className:`gap-1`,children:[(0,q.jsx)(Qt,{className:`h-3.5 w-3.5`}),r.enabled?n(`cronDisable`):n(`cronEnable`)]}),(0,q.jsxs)(h,{variant:`destructive`,size:`sm`,onClick:()=>i(r),className:`gap-1`,children:[(0,q.jsx)(H,{className:`h-3.5 w-3.5`}),n(`delete`)]})]})]})})})}function hn(){let[t,r]=(0,K.useState)(``),[i,a]=(0,K.useState)(`all`),s=Mt({all:!0}),c=xt(),l=lt(),u=vt(),{confirm:d,ConfirmDialog:f}=dt(),p=(0,K.useMemo)(()=>(s.data?.jobs??[]).filter(e=>fn(e,t)).filter(e=>pn(e,i)),[s.data,t,i]),g=async e=>{await d({title:`${n(`cronDeleteConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,variant:`destructive`,confirmLabel:n(`delete`)})&&c.mutate({id:e.id})},_=async e=>{let t=!e.enabled;await d({title:t?`${n(`cronEnableConfirm`)}?`:`${n(`cronDisableConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,variant:t?`default`:`destructive`,confirmLabel:n(t?`cronEnable`:`cronDisable`)})&&l.mutate({id:e.id,enabled:t})},v=async e=>{let t=!e.enabled;await d({title:t?`${n(`cronRunForceConfirm`)}?`:`${n(`cronRunConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,confirmLabel:n(`cronRunNow`)})&&u.mutate({id:e.id,force:t})};return(0,q.jsxs)(o,{fullHeight:!0,children:[(0,q.jsx)(ee,{title:n(`cronPageTitle`),description:n(`cronPageDescription`),actions:(0,q.jsx)(h,{variant:`ghost`,size:`icon`,className:`h-9 w-9 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100`,onClick:()=>s.refetch(),children:(0,q.jsx)(Ue,{className:e(`h-4 w-4`,s.isFetching&&`animate-spin`)})})}),(0,q.jsx)(`div`,{className:`mb-6`,children:(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center`,children:[(0,q.jsxs)(`div`,{className:`relative flex-1 min-w-[240px]`,children:[(0,q.jsx)(m,{value:t,onChange:e=>r(e.target.value),placeholder:n(`cronSearchPlaceholder`),className:`pl-9`}),(0,q.jsx)(ct,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`})]}),(0,q.jsx)(`div`,{className:`min-w-[180px]`,children:(0,q.jsxs)(Pe,{value:i,onValueChange:e=>a(e),children:[(0,q.jsx)(Ze,{className:`w-full`,children:(0,q.jsx)(Xe,{placeholder:n(`cronStatusLabel`)})}),(0,q.jsxs)(Tt,{children:[(0,q.jsx)(V,{value:`all`,children:n(`cronStatusAll`)}),(0,q.jsx)(V,{value:`enabled`,children:n(`cronStatusEnabled`)}),(0,q.jsx)(V,{value:`disabled`,children:n(`cronStatusDisabled`)})]})]})}),(0,q.jsxs)(`div`,{className:`text-xs text-gray-500 ml-auto`,children:[n(`cronTotalLabel`),`: `,s.data?.total??0,` / `,p.length]})]})}),(0,q.jsx)(`div`,{className:`flex-1 overflow-auto custom-scrollbar`,children:s.isLoading?(0,q.jsx)(`div`,{className:`text-sm text-gray-400 p-4 text-center`,children:n(`cronLoading`)}):p.length===0?(0,q.jsx)(`div`,{className:`text-sm text-gray-400 p-4 text-center`,children:n(`cronEmpty`)}):(0,q.jsx)(`div`,{className:`space-y-4`,children:p.map(e=>(0,q.jsx)(mn,{job:e,onDelete:g,onRun:v,onToggle:_},e.id))})}),(0,q.jsx)(f,{})]})}function gn(e){return Array.from(new Set(e.map(e=>e.spec).filter(Boolean)))}function _n(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 vn(e,t){return!!(t.spec&&e.spec===t.spec||t.id&&e.id===t.id)}function yn(e,t){return t??{type:e,total:0,specs:[],records:[]}}function bn(e){let t=yn(e.result.type,e.view),n=_n(e),r=t.records.findIndex(e=>vn(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:gn(i),total:i.length}}function xn(e){let t=yn(e.result.type,e.view);if(e.result.action===`uninstall`||e.result.action===`remove`){let n=t.records.filter(t=>!vn(t,{id:e.result.id,spec:e.request.spec}));return{...t,records:n,specs:gn(n),total:n.length}}let n=t.records.map(t=>vn(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:gn(n),total:n.length}}function Sn(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&&Cn(r,e)?t:void 0},staleTime:15e3}),n=(0,K.useMemo)(()=>M(t.data),[t.data]);return{...t,data:n}}function Cn(e,t){return e.q===t.q&&e.tag===t.tag&&e.scene===t.scene&&e.sort===t.sort&&e.pageSize===t.pageSize}function wn(e=!0){return j({queryKey:[`marketplace-skill-scenes`],queryFn:O,enabled:e,staleTime:6e4})}function Tn(e,t=!0){let n=Ut({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,K.useMemo)(()=>{let t=new Map;return e.forEach((e,r)=>{let i=typeof e.count==`number`?e.count:n[r]?.data?.total;typeof i==`number`&&t.set(e.scene,i)}),t},[n,e])}function En(e){return j({queryKey:[`marketplace-installed`,e],queryFn:()=>c(e),staleTime:1e4})}function Dn(){let e=S();return _({mutationFn:e=>a(e),onSuccess:(t,r)=>{e.setQueryData([`marketplace-installed`,t.type],e=>bn({view:e,request:r,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`}),p.success(t.message||n(`marketplaceInstallSuccessSkill`))},onError:e=>{p.error(e.message||n(`marketplaceInstallFailed`))}})}function On(){let e=S();return _({mutationFn:e=>D(e),onSuccess:(t,r)=>{e.setQueryData([`marketplace-installed`,t.type],e=>xn({view:e,request:r,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`});let i=t.action===`enable`?n(`marketplaceEnableSuccess`):t.action===`disable`?n(`marketplaceDisableSuccess`):n(`marketplaceUninstallSuccess`);p.success(t.message||i)},onError:e=>{p.error(e.message||n(`marketplaceOperationFailed`))}})}function kn(e){return(e??``).trim().toLowerCase()}function J(e,t){let n=kn(t);return n.length>0?`${e}:${n}`:``}function An(e){let t=new Map;for(let n of e){let e=[n.install.spec,n.slug,n.id];for(let r of e){let e=J(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function jn(e){let t=new Map;for(let n of e){let e=[n.spec,n.id,n.label];for(let r of e){let e=J(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function Mn(e,t){let n=[e.install.spec,e.slug,e.id];for(let r of n){let n=J(e.type,r);if(!n)continue;let i=t.get(n);if(i)return i}}function Nn(e,t){return t.get(J(e.type,e.spec))||t.get(J(e.type,e.id))||t.get(J(e.type,e.label))}function Pn(e,t,n,r){let i=kn(n);if(!i)return!0;let a=N(t?.summaryI18n,t?.summary,r);return[e.id,e.spec,e.label,t?.name,t?.slug,t?.summary,a,...t?.tags??[]].map(e=>kn(e)).filter(Boolean).some(e=>e.includes(i))}function Y(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}function Fn(e){let t=e.replace(/\r\n/g,`
2
2
  `).split(`
3
3
  `);if(t[0]?.trim()!==`---`)return e;let n=t.findIndex((e,t)=>t>0&&e.trim()===`---`);return n>0?t.slice(n+1).join(`
4
4
  `).trim():e}function X(e){return Y(e).replace(/`([^`]+)`/g,`<code>$1</code>`).replace(/\*\*([^*]+)\*\*/g,`<strong>$1</strong>`).replace(/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)/g,`<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>`)}function In(e){return/^(#{1,4})\s+/.test(e)||/^([-*])\s+/.test(e)||/^\d+\.\s+/.test(e)||/^>\s?/.test(e)||/^```/.test(e)}function Ln(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(`
@@ -1 +1 @@
1
- import{d as e,i as t,m as n,n as r}from"./react-B2X_ph0a.js";import{At as i,Dt as a,Et as o,Nt as s,Ot as c,Tt as l,ft as u,jt as d,kt as f,mt as p,pt as m,wt as h}from"./api-DruAcori.js";import{t as g}from"./external-link-C3usm3se.js";import{J as _,K as v,Qt as y,X as b,Y as x,Zt as S,q as C,sn as w}from"./index-D2H2CKYR.js";var T=n(),E={checking:`desktopUpdatesStatusChecking`,"update-available":`desktopUpdatesStatusAvailable`,downloading:`desktopUpdatesStatusDownloading`,downloaded:`desktopUpdatesStatusDownloaded`,"up-to-date":`desktopUpdatesStatusUpToDate`,blocked:`desktopUpdatesStatusBlocked`,failed:`desktopUpdatesStatusFailed`};function D({status:t}){return(0,T.jsx)(`span`,{className:e(`inline-flex rounded-full px-3 py-1 text-xs font-medium ring-1`,L(t)),children:I(t)})}function O({label:e,value:t}){return(0,T.jsxs)(`div`,{className:`rounded-xl border border-gray-200 bg-gray-50/60 p-4`,children:[(0,T.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-[0.08em] text-gray-500`,children:e}),(0,T.jsx)(`p`,{className:`mt-2 text-base font-semibold text-gray-900`,children:t})]})}function k({snapshot:e}){if(e.status!==`downloading`)return null;let n=e.progress?.percent,r=n==null?t(`desktopUpdatesDownloadProgressUnknown`):t(`desktopUpdatesDownloadProgressPercent`).replace(`{percent}`,String(n)),i=N(e.progress?.downloadedBytes??0,e.progress?.totalBytes??null);return(0,T.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 p-4`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-amber-800`,children:r}),(0,T.jsx)(`p`,{className:`text-xs font-medium text-amber-700`,children:i})]}),(0,T.jsx)(`div`,{className:`mt-3 h-2 overflow-hidden rounded-full bg-amber-100`,children:(0,T.jsx)(`div`,{className:`h-full rounded-full bg-amber-500 transition-[width]`,style:{width:`${n??0}%`}})})]})}function A({label:e,help:t,checked:n,disabled:r,onCheckedChange:i}){return(0,T.jsxs)(`div`,{className:`flex items-start justify-between gap-4 rounded-xl border border-gray-200 p-4`,children:[(0,T.jsxs)(`div`,{className:`space-y-1`,children:[(0,T.jsx)(d,{children:e}),(0,T.jsx)(`p`,{className:`text-sm text-gray-500`,children:t})]}),(0,T.jsx)(u,{checked:n,disabled:r,onCheckedChange:i})]})}function j(e){return e?.trim()||`-`}function M(e){return e?r(e):`-`}function N(e,t){let n=P(e);return t&&t>0?`${n} / ${P(t)}`:n}function P(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n>=10||r===0?n.toFixed(0):n.toFixed(1)} ${t[r]}`}function F(e){return t(e===`beta`?`desktopUpdatesChannelBeta`:`desktopUpdatesChannelStable`)}function I(e){return t(E[e]??`desktopUpdatesStatusIdle`)}function L(e){return e===`downloaded`?`bg-emerald-50 text-emerald-700 ring-emerald-100`:e===`update-available`||e===`downloading`||e===`checking`?`bg-amber-50 text-amber-700 ring-amber-100`:e===`failed`||e===`blocked`?`bg-red-50 text-red-700 ring-red-100`:`bg-gray-100 text-gray-700 ring-gray-200`}function R(){return(0,T.jsxs)(i,{className:`space-y-6`,children:[(0,T.jsx)(f,{title:t(`runtimeUpdatesPageTitle`),description:t(`runtimeUpdatesPageDescription`)}),(0,T.jsxs)(h,{children:[(0,T.jsxs)(a,{children:[(0,T.jsx)(c,{children:t(`runtimeUpdatesUnavailableTitle`)}),(0,T.jsx)(o,{children:t(`runtimeUpdatesUnavailableDescription`)})]}),(0,T.jsx)(l,{children:(0,T.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`runtimeUpdatesUnavailableHint`)})})]})]})}function z(){let{supported:n,initialized:r,busyAction:u,snapshot:E}=p();if(!r)return(0,T.jsx)(`div`,{className:`p-8 text-gray-400`,children:t(`loading`)});if(!n||!E)return(0,T.jsx)(R,{});let N=u===`checking`,P=u===`downloading`,I=u===`applying`,L=u===`saving-preferences`,z=u===`switching-channel`,B=E.status===`update-available`&&!P&&!I,V=E.status===`downloaded`&&!I,H=[[t(`runtimeUpdatesHostVersion`),j(E.hostVersion)],[t(`desktopUpdatesCurrentBundleVersion`),j(E.currentVersion)],[t(`desktopUpdatesAvailableVersion`),j(E.availableVersion)],[t(`desktopUpdatesLastCheckedAt`),M(E.lastCheckedAt)],[t(`desktopUpdatesCurrentChannel`),F(E.channel)]];return(0,T.jsxs)(i,{className:`space-y-6`,children:[(0,T.jsx)(f,{title:t(`runtimeUpdatesPageTitle`),description:t(`runtimeUpdatesPageDescription`),actions:(0,T.jsxs)(s,{variant:`outline`,onClick:()=>void m.checkForUpdates(),disabled:N||P||I,children:[(0,T.jsx)(y,{className:e(`mr-2 h-4 w-4`,N&&`animate-spin`)}),t(`desktopUpdatesCheckNow`)]})}),(0,T.jsxs)(h,{children:[(0,T.jsxs)(a,{children:[(0,T.jsx)(c,{children:t(`desktopUpdatesOverviewTitle`)}),(0,T.jsx)(o,{children:t(`desktopUpdatesOverviewDescription`)})]}),(0,T.jsxs)(l,{className:`space-y-5`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,T.jsx)(`span`,{className:`text-sm font-medium text-gray-700`,children:t(`desktopUpdatesStatusLabel`)}),(0,T.jsx)(D,{status:E.status})]}),(0,T.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-5`,children:H.map(([e,t])=>(0,T.jsx)(O,{label:e,value:t},e))}),E.channel===`beta`?(0,T.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 p-4`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-amber-800`,children:t(`desktopUpdatesBetaBadgeTitle`)}),(0,T.jsx)(`p`,{className:`mt-1 text-sm text-amber-700`,children:t(`desktopUpdatesBetaBadgeDescription`)})]}):null,E.downloadedVersion?(0,T.jsxs)(`div`,{className:`rounded-2xl border border-emerald-200 bg-emerald-50/70 p-4`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-emerald-800`,children:t(`desktopUpdatesDownloadedBannerTitle`)}),(0,T.jsx)(`p`,{className:`mt-1 text-sm text-emerald-700`,children:t(`runtimeUpdatesDownloadedBannerDescription`).replace(`{version}`,E.downloadedVersion)})]}):null,(0,T.jsx)(k,{snapshot:E}),E.status===`blocked`?(0,T.jsxs)(`div`,{className:`rounded-2xl border border-red-200 bg-red-50/70 p-4`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-red-800`,children:t(`desktopUpdatesBlockedTitle`)}),(0,T.jsx)(`p`,{className:`mt-1 text-sm text-red-700`,children:E.errorMessage??t(`desktopUpdatesBlockedDescription`)}),E.recoveryCommand?(0,T.jsx)(`code`,{className:`mt-3 block rounded-lg bg-white/70 px-3 py-2 text-xs text-red-800`,children:E.recoveryCommand}):null]}):null,E.errorMessage&&E.status!==`blocked`?(0,T.jsx)(`div`,{className:`rounded-2xl border border-red-200 bg-red-50/70 p-4 text-sm text-red-700`,children:E.errorMessage}):null]})]}),(0,T.jsxs)(h,{children:[(0,T.jsxs)(a,{children:[(0,T.jsx)(c,{children:t(`desktopUpdatesPreferencesTitle`)}),(0,T.jsx)(o,{children:t(`desktopUpdatesPreferencesDescription`)})]}),(0,T.jsxs)(l,{className:`space-y-5`,children:[(0,T.jsx)(`div`,{className:`rounded-xl border border-gray-200 p-4`,children:(0,T.jsxs)(`div`,{className:`space-y-3`,children:[(0,T.jsxs)(`div`,{className:`space-y-1`,children:[(0,T.jsx)(d,{children:t(`desktopUpdatesReleaseChannel`)}),(0,T.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`desktopUpdatesReleaseChannelHelp`)})]}),(0,T.jsxs)(v,{value:E.channel,disabled:z||N||P||I,onValueChange:e=>void m.updateChannel(e),children:[(0,T.jsx)(x,{className:`w-full max-w-sm`,children:(0,T.jsx)(b,{placeholder:t(`desktopUpdatesReleaseChannel`)})}),(0,T.jsxs)(C,{children:[(0,T.jsx)(_,{value:`stable`,children:t(`desktopUpdatesChannelStable`)}),(0,T.jsx)(_,{value:`beta`,children:t(`desktopUpdatesChannelBeta`)})]})]}),(0,T.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`desktopUpdatesReleaseChannelDowngradeHint`)})]})}),(0,T.jsx)(A,{label:t(`desktopUpdatesAutomaticChecks`),help:t(`desktopUpdatesAutomaticChecksHelp`),checked:E.preferences.automaticChecks,disabled:L||z,onCheckedChange:e=>void m.updatePreferences({automaticChecks:e})}),(0,T.jsx)(A,{label:t(`desktopUpdatesAutoDownload`),help:t(`desktopUpdatesAutoDownloadHelp`),checked:E.preferences.autoDownload,disabled:L||z,onCheckedChange:e=>void m.updatePreferences({autoDownload:e})})]})]}),(0,T.jsxs)(h,{children:[(0,T.jsxs)(a,{children:[(0,T.jsx)(c,{children:t(`desktopUpdatesActionsTitle`)}),(0,T.jsx)(o,{children:t(`runtimeUpdatesActionsDescription`)})]}),(0,T.jsxs)(l,{className:`flex flex-wrap items-center gap-3`,children:[(0,T.jsxs)(s,{variant:`outline`,onClick:()=>void m.checkForUpdates(),disabled:N||P||I,children:[(0,T.jsx)(y,{className:e(`mr-2 h-4 w-4`,N&&`animate-spin`)}),t(`desktopUpdatesCheckNow`)]}),(0,T.jsxs)(s,{onClick:()=>void m.downloadUpdate(),disabled:!B,children:[(0,T.jsx)(w,{className:e(`mr-2 h-4 w-4`,P&&`animate-bounce`)}),t(`desktopUpdatesDownloadNow`)]}),(0,T.jsxs)(s,{variant:`secondary`,onClick:()=>void m.applyDownloadedUpdate(),disabled:!V,children:[(0,T.jsx)(S,{className:e(`mr-2 h-4 w-4`,I&&`animate-spin`)}),t(`runtimeUpdatesApplyNow`)]}),E.releaseNotesUrl?(0,T.jsxs)(s,{variant:`ghost`,onClick:()=>window.open(E.releaseNotesUrl??``,`_blank`,`noopener,noreferrer`),children:[(0,T.jsx)(g,{className:`mr-2 h-4 w-4`}),t(`desktopUpdatesReleaseNotes`)]}):null]})]})]})}export{z as DesktopUpdateConfig};
1
+ import{d as e,i as t,m as n,n as r}from"./react-B2X_ph0a.js";import{At as i,Dt as a,Et as o,Nt as s,Ot as c,Tt as l,ft as u,jt as d,kt as f,mt as p,pt as m,wt as h}from"./api-DruAcori.js";import{t as g}from"./external-link-C3usm3se.js";import{J as _,K as v,Qt as y,X as b,Y as x,Zt as S,q as C,sn as w}from"./index-GVTiCf1s.js";var T=n(),E={checking:`desktopUpdatesStatusChecking`,"update-available":`desktopUpdatesStatusAvailable`,downloading:`desktopUpdatesStatusDownloading`,downloaded:`desktopUpdatesStatusDownloaded`,"up-to-date":`desktopUpdatesStatusUpToDate`,blocked:`desktopUpdatesStatusBlocked`,failed:`desktopUpdatesStatusFailed`};function D({status:t}){return(0,T.jsx)(`span`,{className:e(`inline-flex rounded-full px-3 py-1 text-xs font-medium ring-1`,L(t)),children:I(t)})}function O({label:e,value:t}){return(0,T.jsxs)(`div`,{className:`rounded-xl border border-gray-200 bg-gray-50/60 p-4`,children:[(0,T.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-[0.08em] text-gray-500`,children:e}),(0,T.jsx)(`p`,{className:`mt-2 text-base font-semibold text-gray-900`,children:t})]})}function k({snapshot:e}){if(e.status!==`downloading`)return null;let n=e.progress?.percent,r=n==null?t(`desktopUpdatesDownloadProgressUnknown`):t(`desktopUpdatesDownloadProgressPercent`).replace(`{percent}`,String(n)),i=N(e.progress?.downloadedBytes??0,e.progress?.totalBytes??null);return(0,T.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 p-4`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-amber-800`,children:r}),(0,T.jsx)(`p`,{className:`text-xs font-medium text-amber-700`,children:i})]}),(0,T.jsx)(`div`,{className:`mt-3 h-2 overflow-hidden rounded-full bg-amber-100`,children:(0,T.jsx)(`div`,{className:`h-full rounded-full bg-amber-500 transition-[width]`,style:{width:`${n??0}%`}})})]})}function A({label:e,help:t,checked:n,disabled:r,onCheckedChange:i}){return(0,T.jsxs)(`div`,{className:`flex items-start justify-between gap-4 rounded-xl border border-gray-200 p-4`,children:[(0,T.jsxs)(`div`,{className:`space-y-1`,children:[(0,T.jsx)(d,{children:e}),(0,T.jsx)(`p`,{className:`text-sm text-gray-500`,children:t})]}),(0,T.jsx)(u,{checked:n,disabled:r,onCheckedChange:i})]})}function j(e){return e?.trim()||`-`}function M(e){return e?r(e):`-`}function N(e,t){let n=P(e);return t&&t>0?`${n} / ${P(t)}`:n}function P(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n>=10||r===0?n.toFixed(0):n.toFixed(1)} ${t[r]}`}function F(e){return t(e===`beta`?`desktopUpdatesChannelBeta`:`desktopUpdatesChannelStable`)}function I(e){return t(E[e]??`desktopUpdatesStatusIdle`)}function L(e){return e===`downloaded`?`bg-emerald-50 text-emerald-700 ring-emerald-100`:e===`update-available`||e===`downloading`||e===`checking`?`bg-amber-50 text-amber-700 ring-amber-100`:e===`failed`||e===`blocked`?`bg-red-50 text-red-700 ring-red-100`:`bg-gray-100 text-gray-700 ring-gray-200`}function R(){return(0,T.jsxs)(i,{className:`space-y-6`,children:[(0,T.jsx)(f,{title:t(`runtimeUpdatesPageTitle`),description:t(`runtimeUpdatesPageDescription`)}),(0,T.jsxs)(h,{children:[(0,T.jsxs)(a,{children:[(0,T.jsx)(c,{children:t(`runtimeUpdatesUnavailableTitle`)}),(0,T.jsx)(o,{children:t(`runtimeUpdatesUnavailableDescription`)})]}),(0,T.jsx)(l,{children:(0,T.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`runtimeUpdatesUnavailableHint`)})})]})]})}function z(){let{supported:n,initialized:r,busyAction:u,snapshot:E}=p();if(!r)return(0,T.jsx)(`div`,{className:`p-8 text-gray-400`,children:t(`loading`)});if(!n||!E)return(0,T.jsx)(R,{});let N=u===`checking`,P=u===`downloading`,I=u===`applying`,L=u===`saving-preferences`,z=u===`switching-channel`,B=E.status===`update-available`&&!P&&!I,V=E.status===`downloaded`&&!I,H=[[t(`runtimeUpdatesHostVersion`),j(E.hostVersion)],[t(`desktopUpdatesCurrentBundleVersion`),j(E.currentVersion)],[t(`desktopUpdatesAvailableVersion`),j(E.availableVersion)],[t(`desktopUpdatesLastCheckedAt`),M(E.lastCheckedAt)],[t(`desktopUpdatesCurrentChannel`),F(E.channel)]];return(0,T.jsxs)(i,{className:`space-y-6`,children:[(0,T.jsx)(f,{title:t(`runtimeUpdatesPageTitle`),description:t(`runtimeUpdatesPageDescription`),actions:(0,T.jsxs)(s,{variant:`outline`,onClick:()=>void m.checkForUpdates(),disabled:N||P||I,children:[(0,T.jsx)(y,{className:e(`mr-2 h-4 w-4`,N&&`animate-spin`)}),t(`desktopUpdatesCheckNow`)]})}),(0,T.jsxs)(h,{children:[(0,T.jsxs)(a,{children:[(0,T.jsx)(c,{children:t(`desktopUpdatesOverviewTitle`)}),(0,T.jsx)(o,{children:t(`desktopUpdatesOverviewDescription`)})]}),(0,T.jsxs)(l,{className:`space-y-5`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,T.jsx)(`span`,{className:`text-sm font-medium text-gray-700`,children:t(`desktopUpdatesStatusLabel`)}),(0,T.jsx)(D,{status:E.status})]}),(0,T.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-5`,children:H.map(([e,t])=>(0,T.jsx)(O,{label:e,value:t},e))}),E.channel===`beta`?(0,T.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 p-4`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-amber-800`,children:t(`desktopUpdatesBetaBadgeTitle`)}),(0,T.jsx)(`p`,{className:`mt-1 text-sm text-amber-700`,children:t(`desktopUpdatesBetaBadgeDescription`)})]}):null,E.downloadedVersion?(0,T.jsxs)(`div`,{className:`rounded-2xl border border-emerald-200 bg-emerald-50/70 p-4`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-emerald-800`,children:t(`desktopUpdatesDownloadedBannerTitle`)}),(0,T.jsx)(`p`,{className:`mt-1 text-sm text-emerald-700`,children:t(`runtimeUpdatesDownloadedBannerDescription`).replace(`{version}`,E.downloadedVersion)})]}):null,(0,T.jsx)(k,{snapshot:E}),E.status===`blocked`?(0,T.jsxs)(`div`,{className:`rounded-2xl border border-red-200 bg-red-50/70 p-4`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-red-800`,children:t(`desktopUpdatesBlockedTitle`)}),(0,T.jsx)(`p`,{className:`mt-1 text-sm text-red-700`,children:E.errorMessage??t(`desktopUpdatesBlockedDescription`)}),E.recoveryCommand?(0,T.jsx)(`code`,{className:`mt-3 block rounded-lg bg-white/70 px-3 py-2 text-xs text-red-800`,children:E.recoveryCommand}):null]}):null,E.errorMessage&&E.status!==`blocked`?(0,T.jsx)(`div`,{className:`rounded-2xl border border-red-200 bg-red-50/70 p-4 text-sm text-red-700`,children:E.errorMessage}):null]})]}),(0,T.jsxs)(h,{children:[(0,T.jsxs)(a,{children:[(0,T.jsx)(c,{children:t(`desktopUpdatesPreferencesTitle`)}),(0,T.jsx)(o,{children:t(`desktopUpdatesPreferencesDescription`)})]}),(0,T.jsxs)(l,{className:`space-y-5`,children:[(0,T.jsx)(`div`,{className:`rounded-xl border border-gray-200 p-4`,children:(0,T.jsxs)(`div`,{className:`space-y-3`,children:[(0,T.jsxs)(`div`,{className:`space-y-1`,children:[(0,T.jsx)(d,{children:t(`desktopUpdatesReleaseChannel`)}),(0,T.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`desktopUpdatesReleaseChannelHelp`)})]}),(0,T.jsxs)(v,{value:E.channel,disabled:z||N||P||I,onValueChange:e=>void m.updateChannel(e),children:[(0,T.jsx)(x,{className:`w-full max-w-sm`,children:(0,T.jsx)(b,{placeholder:t(`desktopUpdatesReleaseChannel`)})}),(0,T.jsxs)(C,{children:[(0,T.jsx)(_,{value:`stable`,children:t(`desktopUpdatesChannelStable`)}),(0,T.jsx)(_,{value:`beta`,children:t(`desktopUpdatesChannelBeta`)})]})]}),(0,T.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`desktopUpdatesReleaseChannelDowngradeHint`)})]})}),(0,T.jsx)(A,{label:t(`desktopUpdatesAutomaticChecks`),help:t(`desktopUpdatesAutomaticChecksHelp`),checked:E.preferences.automaticChecks,disabled:L||z,onCheckedChange:e=>void m.updatePreferences({automaticChecks:e})}),(0,T.jsx)(A,{label:t(`desktopUpdatesAutoDownload`),help:t(`desktopUpdatesAutoDownloadHelp`),checked:E.preferences.autoDownload,disabled:L||z,onCheckedChange:e=>void m.updatePreferences({autoDownload:e})})]})]}),(0,T.jsxs)(h,{children:[(0,T.jsxs)(a,{children:[(0,T.jsx)(c,{children:t(`desktopUpdatesActionsTitle`)}),(0,T.jsx)(o,{children:t(`runtimeUpdatesActionsDescription`)})]}),(0,T.jsxs)(l,{className:`flex flex-wrap items-center gap-3`,children:[(0,T.jsxs)(s,{variant:`outline`,onClick:()=>void m.checkForUpdates(),disabled:N||P||I,children:[(0,T.jsx)(y,{className:e(`mr-2 h-4 w-4`,N&&`animate-spin`)}),t(`desktopUpdatesCheckNow`)]}),(0,T.jsxs)(s,{onClick:()=>void m.downloadUpdate(),disabled:!B,children:[(0,T.jsx)(w,{className:e(`mr-2 h-4 w-4`,P&&`animate-bounce`)}),t(`desktopUpdatesDownloadNow`)]}),(0,T.jsxs)(s,{variant:`secondary`,onClick:()=>void m.applyDownloadedUpdate(),disabled:!V,children:[(0,T.jsx)(S,{className:e(`mr-2 h-4 w-4`,I&&`animate-spin`)}),t(`runtimeUpdatesApplyNow`)]}),E.releaseNotesUrl?(0,T.jsxs)(s,{variant:`ghost`,onClick:()=>window.open(E.releaseNotesUrl??``,`_blank`,`noopener,noreferrer`),children:[(0,T.jsx)(g,{className:`mr-2 h-4 w-4`}),t(`desktopUpdatesReleaseNotes`)]}):null]})]})]})}export{z as DesktopUpdateConfig};
@@ -0,0 +1,3 @@
1
+ import{d as e,h as t,i as n,m as r,v as i}from"./react-B2X_ph0a.js";import{t as a}from"./createLucideIcon-Br1EFMEr.js";import{n as o,t as s}from"./search-CdhgFNwf.js";import{t as c}from"./book-open-cPX0Za7Z.js";import{n as l,t as u}from"./wrench-qVIwShTF.js";import{t as d}from"./external-link-C3usm3se.js";import{t as f}from"./plus-BcIC8dG1.js";import{t as p}from"./x-Chb07O-Y.js";import{a as m,i as h,l as g,o as _,u as v}from"./doc-browser-route-registry.utils-x5ijvk0u.js";import{n as ee}from"./doc-browser-context-DB6TTHeE.js";var y=`modulepreload`,b=function(e){return`/`+e},x={},S=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=b(t,n),t in x)return;x[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:y,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},C=i(t(),1),w=`popstate`;function T(e={}){let{initialEntries:t=[`/`],initialIndex:n,v5Compat:r=!1}=e,i;i=t.map((e,t)=>u(e,typeof e==`string`?null:e.state,t===0?`default`:void 0));let a=c(n??i.length-1),o=`POP`,s=null;function c(e){return Math.min(Math.max(e,0),i.length-1)}function l(){return i[a]}function u(e,t=null,n){let r=k(i?l().pathname:`/`,e,t,n);return D(r.pathname.charAt(0)===`/`,`relative pathnames are not supported in memory history: ${JSON.stringify(e)}`),r}function d(e){return typeof e==`string`?e:A(e)}return{get index(){return a},get action(){return o},get location(){return l()},createHref:d,createURL(e){return new URL(d(e),`http://localhost`)},encodeLocation(e){let t=typeof e==`string`?j(e):e;return{pathname:t.pathname||``,search:t.search||``,hash:t.hash||``}},push(e,t){o=`PUSH`;let n=u(e,t);a+=1,i.splice(a,i.length,n),r&&s&&s({action:o,location:n,delta:1})},replace(e,t){o=`REPLACE`;let n=u(e,t);i[a]=n,r&&s&&s({action:o,location:n,delta:0})},go(e){o=`POP`;let t=c(a+e),n=i[t];a=t,s&&s({action:o,location:n,delta:e})},listen(e){return s=e,()=>{s=null}}}}function te(e={}){function t(e,t){let{pathname:n,search:r,hash:i}=e.location;return k(``,{pathname:n,search:r,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||`default`)}function n(e,t){return typeof t==`string`?t:A(t)}return M(t,n,null,e)}function E(e,t){if(e===!1||e==null)throw Error(t)}function D(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function ne(){return Math.random().toString(36).substring(2,10)}function O(e,t){return{usr:e.state,key:e.key,idx:t}}function k(e,t,n=null,r){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?j(t):t,state:n,key:t&&t.key||r||ne()}}function A({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function j(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function M(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=k(h.location,e,t);n&&n(r,e),l=u()+1;let d=O(r,l),f=h.createHref(r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=k(h.location,e,t);n&&n(r,e),l=u();let i=O(r,l),d=h.createHref(r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return re(e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(w,d),c=e,()=>{i.removeEventListener(w,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function re(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),E(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:A(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}function N(e,t,n=`/`){return ie(e,t,n,!1)}function ie(e,t,n,r){let i=B((typeof t==`string`?j(t):t).pathname||`/`,n);if(i==null)return null;let a=ae(e);se(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=he(i);o=pe(a[e],t,r)}return o}function P(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function ae(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;E(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=V([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(E(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),ae(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:R(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of oe(e.path))a(e,t,!0,n)}),t}function oe(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=oe(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function se(e){e.sort((e,t)=>e.score===t.score?fe(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var F=/^:[\w-]+$/,ce=3,I=2,le=1,ue=10,de=-2,L=e=>e===`*`;function R(e,t){let n=e.split(`/`),r=n.length;return n.some(L)&&(r+=de),t&&(r+=I),n.filter(e=>!L(e)).reduce((e,t)=>e+(F.test(t)?ce:t===``?le:ue),r)}function fe(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function pe(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=z({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=z({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:V([a,u.pathname]),pathnameBase:Ce(V([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=V([a,u.pathnameBase]))}return o}function z(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=me(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function me(e,t=!1,n=!0){D(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n)=>(r.push({paramName:t,isOptional:n!=null}),n?`/?([^\\/]+)?`:`/([^\\/]+)`)).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function he(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return D(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function B(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var ge=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function _e(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?j(e):e,a;return n?(n=n.replace(/\/\/+/g,`/`),a=n.startsWith(`/`)?ve(n.substring(1),`/`):ve(n,t)):a=t,{pathname:a,search:we(r),hash:Te(i)}}function ve(e,t){let n=t.replace(/\/+$/,``).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function ye(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function be(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function xe(e){let t=be(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Se(e,t,n,r=!1){let i;typeof e==`string`?i=j(e):(i={...e},E(!i.pathname||!i.pathname.includes(`?`),ye(`?`,`pathname`,`search`,i)),E(!i.pathname||!i.pathname.includes(`#`),ye(`#`,`pathname`,`hash`,i)),E(!i.search||!i.search.includes(`#`),ye(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=_e(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var V=e=>e.join(`/`).replace(/\/\/+/g,`/`),Ce=e=>e.replace(/\/+$/,``).replace(/^\/*/,`/`),we=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Te=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Ee=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function De(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Oe(e){return e.map(e=>e.route.path).filter(Boolean).join(`/`).replace(/\/\/*/g,`/`)||`/`}var ke=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Ae(e,t){let n=e;if(typeof n!=`string`||!ge.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(ke)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=B(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{D(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var je=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(je);var Me=[`GET`,...je];new Set(Me);var H=C.createContext(null);H.displayName=`DataRouter`;var U=C.createContext(null);U.displayName=`DataRouterState`;var Ne=C.createContext(!1),Pe=C.createContext({isTransitioning:!1});Pe.displayName=`ViewTransition`;var Fe=C.createContext(new Map);Fe.displayName=`Fetchers`;var Ie=C.createContext(null);Ie.displayName=`Await`;var W=C.createContext(null);W.displayName=`Navigation`;var G=C.createContext(null);G.displayName=`Location`;var K=C.createContext({outlet:null,matches:[],isDataRoute:!1});K.displayName=`Route`;var Le=C.createContext(null);Le.displayName=`RouteError`;var Re=`REACT_ROUTER_ERROR`,ze=`REDIRECT`,Be=`ROUTE_ERROR_RESPONSE`;function Ve(e){if(e.startsWith(`${Re}:${ze}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function He(e){if(e.startsWith(`${Re}:${Be}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Ee(t.status,t.statusText,t.data)}catch{}}function Ue(e,{relative:t}={}){E(q(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=C.useContext(W),{hash:i,pathname:a,search:o}=Y(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:V([n,a])),r.createHref({pathname:s,search:o,hash:i})}function q(){return C.useContext(G)!=null}function J(){return E(q(),`useLocation() may be used only in the context of a <Router> component.`),C.useContext(G).location}var We=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Ge(e){C.useContext(W).static||C.useLayoutEffect(e)}function Ke(){let{isDataRoute:e}=C.useContext(K);return e?pt():qe()}function qe(){E(q(),`useNavigate() may be used only in the context of a <Router> component.`);let e=C.useContext(H),{basename:t,navigator:n}=C.useContext(W),{matches:r}=C.useContext(K),{pathname:i}=J(),a=JSON.stringify(xe(r)),o=C.useRef(!1);return Ge(()=>{o.current=!0}),C.useCallback((r,s={})=>{if(D(o.current,We),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Se(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:V([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}C.createContext(null);function Je(){let{matches:e}=C.useContext(K),t=e[e.length-1];return t?t.params:{}}function Y(e,{relative:t}={}){let{matches:n}=C.useContext(K),{pathname:r}=J(),i=JSON.stringify(xe(n));return C.useMemo(()=>Se(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Ye(e,t){return Xe(e,t)}function Xe(e,t,n,r,i){E(q(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:a}=C.useContext(W),{matches:o}=C.useContext(K),s=o[o.length-1],c=s?s.params:{},l=s?s.pathname:`/`,u=s?s.pathnameBase:`/`,d=s&&s.route;{let e=d&&d.path||``;ht(l,!d||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
2
+
3
+ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let f=J(),p;if(t){let e=typeof t==`string`?j(t):t;E(u===`/`||e.pathname?.startsWith(u),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${u}" but pathname "${e.pathname}" was given in the \`location\` prop.`),p=e}else p=f;let m=p.pathname||`/`,h=m;if(u!==`/`){let e=u.replace(/^\//,``).split(`/`);h=`/`+m.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let g=N(e,{pathname:h});D(d||g!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),D(g==null||g[g.length-1].route.element!==void 0||g[g.length-1].route.Component!==void 0||g[g.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let _=rt(g&&g.map(e=>Object.assign({},e,{params:Object.assign({},c,e.params),pathname:V([u,a.encodeLocation?a.encodeLocation(e.pathname.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?u:V([u,a.encodeLocation?a.encodeLocation(e.pathnameBase.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),o,n,r,i);return t&&_?C.createElement(G.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,...p},navigationType:`POP`}},_):_}function Ze(){let e=ft(),t=De(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=C.createElement(C.Fragment,null,C.createElement(`p`,null,`💿 Hey developer 👋`),C.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,C.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,C.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),C.createElement(C.Fragment,null,C.createElement(`h2`,null,`Unexpected Application Error!`),C.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?C.createElement(`pre`,{style:i},n):null,o)}var Qe=C.createElement(Ze,null),$e=class extends C.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=He(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:C.createElement(K.Provider,{value:this.props.routeContext},C.createElement(Le.Provider,{value:e,children:this.props.component}));return this.context?C.createElement(tt,{error:e},t):t}};$e.contextType=Ne;var et=new WeakMap;function tt({children:e,error:t}){let{basename:n}=C.useContext(W);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Ve(t.digest);if(e){let r=et.get(t);if(r)throw r;let i=Ae(e.location,n);if(ke&&!et.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw et.set(t,n),n}return C.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function nt({routeContext:e,match:t,children:n}){let r=C.useContext(H);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),C.createElement(K.Provider,{value:e},n)}function rt(e,t=[],n=null,r=null,i=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,o=n?.errors;if(o!=null){let e=a.findIndex(e=>e.route.id&&o?.[e.route.id]!==void 0);E(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(`,`)}`),a=a.slice(0,Math.min(a.length,e+1))}let s=!1,c=-1;if(n)for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(c=e),t.route.id){let{loaderData:e,errors:r}=n,i=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!r||r[t.route.id]===void 0);if(t.route.lazy||i){s=!0,a=c>=0?a.slice(0,c+1):[a[0]];break}}}let l=n&&r?(e,t)=>{r(e,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:Oe(n.matches),errorInfo:t})}:void 0;return a.reduceRight((e,r,i)=>{let u,d=!1,f=null,p=null;n&&(u=o&&r.route.id?o[r.route.id]:void 0,f=r.route.errorElement||Qe,s&&(c<0&&i===0?(ht(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):c===i&&(d=!0,p=r.route.hydrateFallbackElement||null)));let m=t.concat(a.slice(0,i+1)),h=()=>{let t;return t=u?f:d?p:r.route.Component?C.createElement(r.route.Component,null):r.route.element?r.route.element:e,C.createElement(nt,{match:r,routeContext:{outlet:e,matches:m,isDataRoute:n!=null},children:t})};return n&&(r.route.ErrorBoundary||r.route.errorElement||i===0)?C.createElement($e,{location:n.location,revalidation:n.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function it(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function at(e){let t=C.useContext(H);return E(t,it(e)),t}function ot(e){let t=C.useContext(U);return E(t,it(e)),t}function st(e){let t=C.useContext(K);return E(t,it(e)),t}function ct(e){let t=st(e),n=t.matches[t.matches.length-1];return E(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function lt(){return ct(`useRouteId`)}function ut(){return ot(`useNavigation`).navigation}function dt(){let{matches:e,loaderData:t}=ot(`useMatches`);return C.useMemo(()=>e.map(e=>P(e,t)),[e,t])}function ft(){let e=C.useContext(Le),t=ot(`useRouteError`),n=ct(`useRouteError`);return e===void 0?t.errors?.[n]:e}function pt(){let{router:e}=at(`useNavigate`),t=ct(`useNavigate`),n=C.useRef(!1);return Ge(()=>{n.current=!0}),C.useCallback(async(r,i={})=>{D(n.current,We),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var mt={};function ht(e,t,n){!t&&!mt[e]&&(mt[e]=!0,D(!1,n))}C.useOptimistic,C.memo(gt);function gt({routes:e,future:t,state:n,onError:r}){return Xe(e,void 0,n,r,t)}function _t({basename:e,children:t,initialEntries:n,initialIndex:r,unstable_useTransitions:i}){let a=C.useRef();a.current??=T({initialEntries:n,initialIndex:r,v5Compat:!0});let o=a.current,[s,c]=C.useState({action:o.action,location:o.location}),l=C.useCallback(e=>{i===!1?c(e):C.startTransition(()=>c(e))},[i]);return C.useLayoutEffect(()=>o.listen(l),[o,l]),C.createElement(bt,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:o,unstable_useTransitions:i})}function vt({to:e,replace:t,state:n,relative:r}){E(q(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=C.useContext(W);D(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=C.useContext(K),{pathname:o}=J(),s=Ke(),c=Se(e,xe(a),o,r===`path`),l=JSON.stringify(c);return C.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function yt(e){E(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function bt({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:o}){E(!q(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=C.useMemo(()=>({basename:s,navigator:i,static:a,unstable_useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=j(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`}=n,m=C.useMemo(()=>{let e=B(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p},navigationType:r}},[s,l,u,d,f,p,r]);return D(m!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),m==null?null:C.createElement(W.Provider,{value:c},C.createElement(G.Provider,{children:t,value:m}))}function xt({children:e,location:t}){return Ye(St(e),t)}C.Component;function St(e,t=[]){let n=[];return C.Children.forEach(e,(e,r)=>{if(!C.isValidElement(e))return;let i=[...t,r];if(e.type===C.Fragment){n.push.apply(n,St(e.props.children,i));return}E(e.type===yt,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),E(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=St(e.props.children,i)),n.push(a)}),n}var Ct=`get`,wt=`application/x-www-form-urlencoded`;function Tt(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Et(e){return Tt(e)&&e.tagName.toLowerCase()===`button`}function Dt(e){return Tt(e)&&e.tagName.toLowerCase()===`form`}function Ot(e){return Tt(e)&&e.tagName.toLowerCase()===`input`}function kt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function At(e,t){return e.button===0&&(!t||t===`_self`)&&!kt(e)}var jt=null;function Mt(){if(jt===null)try{new FormData(document.createElement(`form`),0),jt=!1}catch{jt=!0}return jt}var Nt=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Pt(e){return e!=null&&!Nt.has(e)?(D(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${wt}"`),null):e}function Ft(e,t){let n,r,i,a,o;if(Dt(e)){let o=e.getAttribute(`action`);r=o?B(o,t):null,n=e.getAttribute(`method`)||Ct,i=Pt(e.getAttribute(`enctype`))||wt,a=new FormData(e)}else if(Et(e)||Ot(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?B(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Ct,i=Pt(e.getAttribute(`formenctype`))||Pt(o.getAttribute(`enctype`))||wt,a=new FormData(o,e),!Mt()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Tt(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Ct,r=null,i=wt,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var It={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Lt=/[&><\u2028\u2029]/g;function Rt(e){return e.replace(Lt,e=>It[e])}function zt(e,t){if(e===!1||e==null)throw Error(t)}function Bt(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&B(i.pathname,t)===`/`?i.pathname=`${t.replace(/\/$/,``)}/_root.${r}`:i.pathname=`${i.pathname.replace(/\/$/,``)}.${r}`,i}async function Vt(e,t){if(e.id in t)return t[e.id];try{let n=await S(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Ht(e){return e!=null&&typeof e.page==`string`}function Ut(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function Wt(e,t,n){return Yt((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Vt(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Ut).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Gt(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Kt(e,t,{includeHydrateFallback:n}={}){return qt(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function qt(e){return[...new Set(e)]}function Jt(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Yt(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Ht(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Jt(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Xt(){let e=C.useContext(H);return zt(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Zt(){let e=C.useContext(U);return zt(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var Qt=C.createContext(void 0);Qt.displayName=`FrameworkContext`;function $t(){let e=C.useContext(Qt);return zt(e,`You must render this element inside a <HydratedRouter> element`),e}function en(e,t){let n=C.useContext(Qt),[r,i]=C.useState(!1),[a,o]=C.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=C.useRef(null);C.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),C.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:X(s,p),onBlur:X(c,m),onMouseEnter:X(l,p),onMouseLeave:X(u,m),onTouchStart:X(d,p)}]:[a,f,{}]:[!1,f,{}]}function X(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function tn({page:e,...t}){let{router:n}=Xt(),r=C.useMemo(()=>N(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?C.createElement(rn,{page:e,matches:r,...t}):null}function nn(e){let{manifest:t,routeModules:n}=$t(),[r,i]=C.useState([]);return C.useEffect(()=>{let r=!1;return Wt(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function rn({page:e,matches:t,...n}){let r=J(),{future:i,manifest:a,routeModules:o}=$t(),{basename:s}=Xt(),{loaderData:c,matches:l}=Zt(),u=C.useMemo(()=>Gt(e,t,l,a,r,`data`),[e,t,l,a,r]),d=C.useMemo(()=>Gt(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=C.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=Bt(e,s,i.unstable_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.unstable_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=C.useMemo(()=>Kt(d,a),[d,a]),m=nn(d);return C.createElement(C.Fragment,null,f.map(e=>C.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>C.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>C.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function an(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}C.Component;var on=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{on&&(window.__reactRouterVersion=`7.13.0`)}catch{}function sn({basename:e,children:t,unstable_useTransitions:n,window:r}){let i=C.useRef();i.current??=te({window:r,v5Compat:!0});let a=i.current,[o,s]=C.useState({action:a.action,location:a.location}),c=C.useCallback(e=>{n===!1?s(e):C.startTransition(()=>s(e))},[n]);return C.useLayoutEffect(()=>a.listen(c),[a,c]),C.createElement(bt,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,unstable_useTransitions:n})}function cn({basename:e,children:t,history:n,unstable_useTransitions:r}){let[i,a]=C.useState({action:n.action,location:n.location}),o=C.useCallback(e=>{r===!1?a(e):C.startTransition(()=>a(e))},[r]);return C.useLayoutEffect(()=>n.listen(o),[n,o]),C.createElement(bt,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,unstable_useTransitions:r})}cn.displayName=`unstable_HistoryRouter`;var ln=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,un=C.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,state:o,target:s,to:c,preventScrollReset:l,viewTransition:u,unstable_defaultShouldRevalidate:d,...f},p){let{basename:m,unstable_useTransitions:h}=C.useContext(W),g=typeof c==`string`&&ln.test(c),_=Ae(c,m);c=_.to;let v=Ue(c,{relative:r}),[ee,y,b]=en(n,f),x=_n(c,{replace:a,state:o,target:s,preventScrollReset:l,relative:r,viewTransition:u,unstable_defaultShouldRevalidate:d,unstable_useTransitions:h});function S(t){e&&e(t),t.defaultPrevented||x(t)}let w=C.createElement(`a`,{...f,...b,href:_.absoluteURL||v,onClick:_.isExternal||i?e:S,ref:an(p,y),target:s,"data-discover":!g&&t===`render`?`true`:void 0});return ee&&!g?C.createElement(C.Fragment,null,w,C.createElement(tn,{page:v})):w});un.displayName=`Link`;var dn=C.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=Y(a,{relative:c.relative}),d=J(),f=C.useContext(U),{navigator:p,basename:m}=C.useContext(W),h=f!=null&&Dn(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=B(v,m)||v);let ee=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,y=_===g||!r&&_.startsWith(g)&&_.charAt(ee)===`/`,b=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),x={isActive:y,isPending:b,isTransitioning:h},S=y?e:void 0,w;w=typeof n==`function`?n(x):[n,y?`active`:null,b?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(x):i;return C.createElement(un,{...c,"aria-current":S,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(x):s)});dn.displayName=`NavLink`;var fn=C.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Ct,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m)=>{let{unstable_useTransitions:h}=C.useContext(W),g=bn(),_=xn(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,ee=typeof s==`string`&&ln.test(s);return C.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f});h&&n!==!1?C.startTransition(()=>p()):p()},...p,"data-discover":!ee&&e===`render`?`true`:void 0})});fn.displayName=`Form`;function pn({getKey:e,storageKey:t,...n}){let r=C.useContext(Qt),{basename:i}=C.useContext(W),a=J(),o=dt();Tn({getKey:e,storageKey:t});let s=C.useMemo(()=>{if(!r||!e)return null;let t=wn(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return C.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${Rt(JSON.stringify(t||Sn))}, ${Rt(JSON.stringify(s))})`}})}pn.displayName=`ScrollRestoration`;function mn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function hn(e){let t=C.useContext(H);return E(t,mn(e)),t}function gn(e){let t=C.useContext(U);return E(t,mn(e)),t}function _n(e,{target:t,replace:n,state:r,preventScrollReset:i,relative:a,viewTransition:o,unstable_defaultShouldRevalidate:s,unstable_useTransitions:c}={}){let l=Ke(),u=J(),d=Y(e,{relative:a});return C.useCallback(f=>{if(At(f,t)){f.preventDefault();let t=n===void 0?A(u)===A(d):n,p=()=>l(e,{replace:t,state:r,preventScrollReset:i,relative:a,viewTransition:o,unstable_defaultShouldRevalidate:s});c?C.startTransition(()=>p()):p()}},[u,l,d,n,r,t,e,i,a,o,s,c])}var vn=0,yn=()=>`__${String(++vn)}__`;function bn(){let{router:e}=hn(`useSubmit`),{basename:t}=C.useContext(W),n=lt(),r=e.fetch,i=e.navigate;return C.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Ft(e,t);a.navigate===!1?await r(a.fetcherKey||yn(),n,a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function xn(e,{relative:t}={}){let{basename:n}=C.useContext(W),r=C.useContext(K);E(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Y(e||`.`,{relative:t})},o=J();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:V([n,a.pathname])),A(a)}var Sn=`react-router-scroll-positions`,Cn={};function wn(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:B(e.pathname,n)||e.pathname},t)),i??=e.key,i}function Tn({getKey:e,storageKey:t}={}){let{router:n}=hn(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=gn(`useScrollRestoration`),{basename:a}=C.useContext(W),o=J(),s=dt(),c=ut();C.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),En(C.useCallback(()=>{if(c.state===`idle`){let t=wn(o,s,a,e);Cn[t]=window.scrollY}try{sessionStorage.setItem(t||Sn,JSON.stringify(Cn))}catch(e){D(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(C.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Sn);e&&(Cn=JSON.parse(e))}catch{}},[t]),C.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Cn,()=>window.scrollY,e?(t,n)=>wn(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),C.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{D(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function En(e,t){let{capture:n}=t||{};C.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Dn(e,{relative:t}={}){let n=C.useContext(Pe);E(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=hn(`useViewTransitionState`),i=Y(e,{relative:t});if(!n.isTransitioning)return!1;let a=B(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=B(n.nextLocation.pathname,r)||n.nextLocation.pathname;return z(i.pathname,o)!=null||z(i.pathname,a)!=null}var On=a(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),kn=a(`BrainCircuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),An=a(`Grid3x3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M3 15h18`,key:`5xshup`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),jn=a(`GripVertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Mn=a(`Maximize2`,[[`polyline`,{points:`15 3 21 3 21 9`,key:`mznyad`}],[`polyline`,{points:`9 21 3 21 3 15`,key:`1avn1i`}],[`line`,{x1:`21`,x2:`14`,y1:`3`,y2:`10`,key:`ota7mn`}],[`line`,{x1:`3`,x2:`10`,y1:`21`,y2:`14`,key:`1atl0r`}]]),Nn=a(`PanelRightOpen`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),Z=r(),Pn={apps:{accentClassName:`bg-emerald-50 text-emerald-700 border-emerald-100`,icon:(0,Z.jsx)(l,{className:`h-5 w-5`})},"service-apps":{accentClassName:`bg-sky-50 text-sky-700 border-sky-100`,icon:(0,Z.jsx)(An,{className:`h-5 w-5`})},docs:{accentClassName:`bg-amber-50 text-amber-700 border-amber-100`,icon:(0,Z.jsx)(c,{className:`h-5 w-5`})},"skill-marketplace":{accentClassName:`bg-rose-50 text-rose-700 border-rose-100`,icon:(0,Z.jsx)(kn,{className:`h-5 w-5`})},"mcp-marketplace":{accentClassName:`bg-indigo-50 text-indigo-700 border-indigo-100`,icon:(0,Z.jsx)(u,{className:`h-5 w-5`})}};function Fn(e){return Pn[e.id]??{accentClassName:`bg-gray-50 text-gray-700 border-gray-100`,icon:(0,Z.jsx)(l,{className:`h-5 w-5`})}}function In({open:t}){let n=Ke(),r=h.getHomeNavigationItems(),i=e=>{if(e.type===`app-route`){n(e.path);return}t(e.url,e.options)};return(0,Z.jsx)(`div`,{className:`h-full overflow-auto bg-[#fbfaf7] px-5 py-6`,children:(0,Z.jsx)(`div`,{className:`mx-auto w-full max-w-[640px]`,children:(0,Z.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(88px,1fr))] gap-x-3 gap-y-5`,children:r.map(t=>{let n=Fn(t);return(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>i(t.target),className:`group flex min-h-[82px] flex-col items-center gap-2 rounded-lg px-2 py-2 text-center transition-colors hover:bg-white/80`,children:[(0,Z.jsx)(`span`,{className:e(`flex h-12 w-12 shrink-0 items-center justify-center rounded-2xl border shadow-[0_1px_2px_rgba(30,20,10,0.04)] transition-transform group-hover:scale-[1.03]`,n.accentClassName),children:n.icon}),(0,Z.jsx)(`span`,{className:`min-w-0 max-w-full`,children:(0,Z.jsx)(`span`,{className:`line-clamp-2 block text-xs font-medium leading-snug text-gray-800`,children:t.label})})]},t.id)})})})})}function Ln({isDocsTab:e,onSubmit:t,onUrlInputChange:r,urlInput:i}){return e?(0,Z.jsx)(`div`,{className:`flex items-center gap-2 px-3.5 py-2 bg-white border-b border-gray-100 shrink-0`,children:(0,Z.jsxs)(`form`,{onSubmit:t,className:`flex-1 relative`,children:[(0,Z.jsx)(s,{className:`w-3.5 h-3.5 absolute left-3 top-1/2 -translate-y-1/2 text-gray-400`}),(0,Z.jsx)(`input`,{type:`text`,value:i,onChange:e=>r(e.target.value),placeholder:n(`docBrowserSearchPlaceholder`),className:`w-full h-8 pl-8 pr-3 rounded-lg bg-gray-50 border border-gray-200 text-xs text-gray-700 focus:outline-none focus:ring-1 focus:ring-primary/30 focus:border-primary/40 transition-colors placeholder:text-gray-400`})]})}):null}function Rn({currentTab:e,currentUrl:t,customContent:n,iframeRef:r,iframeInstanceId:i,iframeSandbox:a,isDragging:o,isResizing:s}){return(0,Z.jsxs)(`div`,{className:`flex-1 relative overflow-hidden`,children:[n||(0,Z.jsx)(`iframe`,{ref:r,src:t,className:`absolute inset-0 w-full h-full border-0`,title:e?.title||`NextClaw Docs`,sandbox:a,allow:`clipboard-read; clipboard-write`},i),(s||o)&&(0,Z.jsx)(`div`,{className:`absolute inset-0 z-10`})]})}function zn({currentUrl:e,isDocsTab:t}){return!t||!g(e)?null:(0,Z.jsx)(`div`,{className:`flex items-center justify-between px-4 py-2 bg-gray-50 border-t border-gray-200 shrink-0`,children:(0,Z.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,"data-doc-external":!0,className:`flex items-center gap-1.5 text-xs text-primary hover:text-primary-hover font-medium transition-colors`,children:[n(`docBrowserOpenExternal`),(0,Z.jsx)(d,{className:`w-3 h-3`})]})})}function Bn({tabs:t,activeTabId:r,canGoBack:i,canGoForward:a,isDocked:s,isFullscreen:c,onGoBack:l,onGoForward:u,onOpenNewTab:d,onSetActiveTab:m,onCloseTab:h,onClose:g,onDragStart:_,onToggleMode:v}){return(0,Z.jsxs)(`div`,{"data-testid":`doc-browser-tab-strip`,className:e(`flex h-11 items-stretch gap-2 px-2.5 bg-background border-b border-[#f1e7d4] shrink-0 select-none`,c&&`h-[calc(env(safe-area-inset-top,0px)+2.75rem)] pt-[env(safe-area-inset-top,0px)]`),onPointerDown:!s&&!c?_:void 0,children:[(0,Z.jsx)(`div`,{className:`doc-browser-tab-scrollbar flex h-full min-w-0 flex-1 items-center gap-1.5 overflow-x-auto`,onPointerDown:e=>e.stopPropagation(),children:t.map(t=>(0,Z.jsxs)(`div`,{className:e(`inline-flex items-center gap-1 h-7 px-1.5 rounded-lg text-xs border max-w-[220px] shrink-0 transition-colors`,t.id===r?`bg-amber-50/80 border-amber-200 text-amber-900 shadow-[0_1px_2px_rgba(30,20,10,0.04)]`:`bg-[#f9f8f5] border-[#eee3d1] text-[#78644d] hover:bg-[#fff7ea] hover:text-[#2f2212]`),children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>m(t.id),className:`truncate text-left px-1`,title:t.title,children:t.title||n(`docBrowserTabUntitled`)}),(0,Z.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),h(t.id)},className:`rounded p-0.5 hover:bg-black/10`,"aria-label":n(`docBrowserCloseTab`),children:(0,Z.jsx)(p,{className:`w-3 h-3`})})]},t.id))}),(0,Z.jsxs)(`div`,{className:`flex h-full items-center gap-1 shrink-0`,"data-testid":`doc-browser-tab-actions`,onPointerDown:e=>e.stopPropagation(),children:[(0,Z.jsx)(`button`,{type:`button`,onClick:l,disabled:!i,className:`rounded-md p-1.5 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 disabled:cursor-not-allowed disabled:text-gray-300 disabled:opacity-60 disabled:hover:bg-transparent disabled:hover:text-gray-300`,title:n(`docBrowserBack`),children:(0,Z.jsx)(o,{className:`w-3.5 h-3.5`})}),(0,Z.jsx)(`button`,{type:`button`,onClick:u,disabled:!a,className:`rounded-md p-1.5 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 disabled:cursor-not-allowed disabled:text-gray-300 disabled:opacity-60 disabled:hover:bg-transparent disabled:hover:text-gray-300`,title:n(`docBrowserForward`),children:(0,Z.jsx)(On,{className:`w-3.5 h-3.5`})}),(0,Z.jsx)(`button`,{type:`button`,onClick:d,className:`hover:bg-gray-100 rounded-md p-1.5 text-gray-500 hover:text-gray-700 transition-colors`,title:n(`docBrowserNewTab`),children:(0,Z.jsx)(f,{className:`w-3.5 h-3.5`})}),c?null:(0,Z.jsx)(`button`,{type:`button`,onClick:v,className:`hover:bg-gray-100 rounded-md p-1.5 text-gray-500 hover:text-gray-700 transition-colors`,title:n(s?`docBrowserFloatMode`:`docBrowserDockMode`),children:s?(0,Z.jsx)(Mn,{className:`w-3.5 h-3.5`}):(0,Z.jsx)(Nn,{className:`w-3.5 h-3.5`})}),(0,Z.jsx)(`button`,{type:`button`,onClick:g,className:`hover:bg-gray-100 rounded-md p-1.5 text-gray-500 hover:text-gray-700 transition-colors`,title:n(`docBrowserClose`),children:(0,Z.jsx)(p,{className:`w-3.5 h-3.5`})})]})]})}function Vn({children:t,className:n,style:r,defaultWidth:i=420,minWidth:a=320,maxWidth:o=860,overlay:s=!1,...c}){let l=(0,C.useRef)(null),[u,d]=(0,C.useState)(!1),[f,p]=(0,C.useState)(i),m=e=>{if(s)return;e.preventDefault(),e.stopPropagation(),d(!0),l.current={startX:e.clientX,startWidth:f};let t=e=>{let t=l.current;if(!t)return;let n=t.startWidth+t.startX-e.clientX;p(Math.max(a,Math.min(o,n)))},n=()=>{d(!1),l.current=null,window.removeEventListener(`mousemove`,t),window.removeEventListener(`mouseup`,n)};window.addEventListener(`mousemove`,t),window.addEventListener(`mouseup`,n)};return(0,Z.jsxs)(`aside`,{...c,className:e(`relative flex h-full min-h-0 shrink-0 overflow-hidden bg-white`,s?`fixed inset-0 z-40`:`border-l border-gray-200`,n),style:s?r:{...r,width:f},children:[s?null:(0,Z.jsx)(`div`,{className:`absolute left-0 top-0 z-20 h-full w-1.5 cursor-ew-resize transition-colors hover:bg-primary/10`,"data-testid":`resizable-right-panel-handle`,onMouseDown:m}),(0,Z.jsx)(`div`,{className:`flex h-full min-h-0 w-full flex-col overflow-hidden`,children:t}),u?(0,Z.jsx)(`div`,{className:`absolute inset-0 z-10`}):null]})}var Q=40,Hn=360,Un=400;function $(e,t,n){return Math.min(n,Math.max(t,e))}function Wn(){return{x:Math.max(Q,window.innerWidth-520),y:80,w:480,h:600}}function Gn({customTabRenderers:t={},displayMode:n=`desktop`}){let{isOpen:r,mode:i,tabs:a,activeTabId:o,activeHistory:s,activeHistoryIndex:c,currentTab:l,open:u,openNewTab:d,close:f,toggleMode:p,goBack:h,goForward:g,navigate:y,syncUrl:b,setActiveTab:x,closeTab:S}=ee(),[w,T]=(0,C.useState)(``),[te,E]=(0,C.useState)(0),[D,ne]=(0,C.useState)(Wn),[O,k]=(0,C.useState)(null),A=(0,C.useRef)(null),j=l?.currentUrl??m,M=l?.navVersion??0,re=`${o}:${M}:${te}`,N=(0,C.useRef)(null),ie=(0,C.useRef)(M),P=l?.kind===`docs`,ae=l?.kind===_,oe=c>0,se=c<s.length-1,F=l?t[l.kind]:void 0;(0,C.useEffect)(()=>{if(!P){T(``);return}try{T(new URL(j).pathname)}catch{T(j)}},[j,o,P]),(0,C.useEffect)(()=>{if(!P){N.current=null;return}if(M!==ie.current){ie.current=M,N.current=v(j);return}if(A.current?.contentWindow)try{let e=new URL(j).pathname;N.current=v(j),A.current.contentWindow.postMessage({type:`docs-navigate`,path:e},`*`)}catch{}},[j,M,P]),(0,C.useEffect)(()=>{let e=e=>{if(P&&e.data?.type===`docs-route-change`&&typeof e.data.url==`string`){let t=v(e.data.url);if(N.current&&t!==N.current)return;N.current=null,b(e.data.url)}};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[j,b,P]),(0,C.useEffect)(()=>{if(!l||!F?.onIframeMessage)return;let e=e=>{F.onIframeMessage?.({event:e,iframe:A.current,iframeInstanceId:re,tab:l})};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[l,F,re]);let ce=(0,C.useCallback)(e=>{e.preventDefault(),k({kind:`drag`,startX:e.clientX,startY:e.clientY,startRect:D})},[D]),I=(0,C.useCallback)(e=>t=>{t.preventDefault(),t.stopPropagation(),k({kind:`resize`,edge:e,startX:t.clientX,startY:t.clientY,startRect:D})},[D]);(0,C.useEffect)(()=>{if(!O)return;let e=e=>{let{startRect:t,startX:n,startY:r}=O,i=e.clientX-n,a=e.clientY-r;if(O.kind===`drag`){ne({...t,x:$(t.x+i,Q,window.innerWidth-Q-t.w),y:$(t.y+a,Q,window.innerHeight-Q-t.h)});return}if(O.edge===`left`||O.edge===`top`){let e=O.edge===`left`,n=e?t.x+t.w:t.y+t.h,r=$(e?t.x+i:t.y+a,Q,n-(e?Hn:Un));ne(e?{...t,x:r,w:n-r}:{...t,y:r,h:n-r});return}let o=$(t.x+t.w+i,t.x+Hn,window.innerWidth-Q),s=$(t.y+t.h+a,t.y+Un,window.innerHeight-Q);ne({...t,w:O.edge===`bottom`?t.w:o-t.x,h:O.edge===`right`?t.h:s-t.y})},t=()=>k(null);return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[O]);let le=(0,C.useCallback)(e=>{if(e.preventDefault(),!P)return;let t=w.trim();t&&(t.startsWith(`/`)?y(`${m}${t}`):t.startsWith(`http`)?y(t):y(`${m}/${t}`))},[w,y,P]),ue=(0,C.useCallback)(()=>{E(e=>e+1)},[]);if(!r)return null;let de=i===`docked`,L=n===`fullscreen`,R=l?{currentUrl:j,open:u,refreshIframe:ue,tab:l}:void 0,fe=R?F?.renderToolbar?.(R):null,pe=R?F?.renderContent?.(R)??(ae?(0,Z.jsx)(In,{open:u}):null):null,z=l?F?.getIframeSandbox?.(l)??`allow-same-origin allow-scripts allow-popups allow-forms`:`allow-same-origin allow-scripts allow-popups allow-forms`,me=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Bn,{tabs:a,activeTabId:o,canGoBack:oe,canGoForward:se,isDocked:de,isFullscreen:L,onGoBack:h,onGoForward:g,onOpenNewTab:d,onSetActiveTab:x,onCloseTab:S,onClose:f,onDragStart:ce,onToggleMode:p}),(0,Z.jsx)(Ln,{isDocsTab:P,onSubmit:le,onUrlInputChange:T,urlInput:w}),fe,(0,Z.jsx)(Rn,{currentTab:l,currentUrl:j,customContent:pe,iframeRef:A,iframeInstanceId:re,iframeSandbox:z,isDragging:O?.kind===`drag`,isResizing:O?.kind===`resize`}),(0,Z.jsx)(zn,{currentUrl:j,isDocsTab:P})]});return de&&!L?(0,Z.jsx)(Vn,{"data-testid":`doc-browser-panel`,defaultWidth:420,minWidth:320,maxWidth:860,children:me}):(0,Z.jsxs)(`div`,{"data-testid":`doc-browser-panel`,className:e(`flex flex-col bg-white overflow-hidden relative`,L?`fixed inset-0 z-[9999] h-[100dvh] w-screen rounded-none border-0 shadow-2xl`:`rounded-2xl shadow-2xl border border-gray-200`),style:L?void 0:{position:`fixed`,left:D.x,top:D.y,width:D.w,height:D.h,zIndex:9999},children:[me,!de&&!L&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`absolute top-0 left-0 h-1.5 w-full cursor-ns-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-top`,onPointerDown:I(`top`)}),(0,Z.jsx)(`div`,{className:`absolute top-0 left-0 w-1.5 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-left`,onPointerDown:I(`left`)}),(0,Z.jsx)(`div`,{className:`absolute top-0 right-0 w-1.5 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-right`,onPointerDown:I(`right`)}),(0,Z.jsx)(`div`,{className:`absolute bottom-0 left-0 h-1.5 w-full cursor-ns-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-bottom`,onPointerDown:I(`bottom`)}),(0,Z.jsx)(`div`,{className:`absolute bottom-0 right-0 w-4 h-4 cursor-se-resize z-30 flex items-center justify-center text-gray-300 hover:text-gray-500 transition-colors`,"data-testid":`doc-browser-resize-bottom-right`,onPointerDown:I(`bottom-right`),children:(0,Z.jsx)(jn,{className:`w-3 h-3 rotate-[-45deg]`})})]})]})}export{un as a,vt as c,J as d,Ke as f,sn as i,yt as l,S as m,Vn as n,_t as o,Je as p,kn as r,dn as s,Gn as t,xt as u};
@@ -0,0 +1 @@
1
+ import{t as e}from"./doc-browser-BI7HSaMK.js";export{e as DocBrowser};