@nextclaw/ui 0.12.22 → 0.12.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/assets/{api-lwyw9j7i.js → api-BGd3rgv_.js} +5 -5
- package/dist/assets/app-manager-provider-BuJ_U9eC.js +1 -0
- package/dist/assets/{app-navigation.config-DgiR0c5_.js → app-navigation.config-BTdUuqXS.js} +1 -1
- package/dist/assets/{book-open-DgLqYpNY.js → book-open-DDlN5MvX.js} +1 -1
- package/dist/assets/{channels-list-page-Dl839n02.js → channels-list-page-BrwymXPe.js} +2 -2
- package/dist/assets/{chat-DwUf7AKR.js → chat-DGM6K3Qs.js} +5 -5
- package/dist/assets/{chat-page-B-FvPmA7.js → chat-page-DpmXMWNS.js} +1 -1
- package/dist/assets/{chunk-JZWAC4HX-u4uYphxM.js → chunk-JZWAC4HX-Kydj4yEz.js} +1 -1
- package/dist/assets/{config-split-page-BMRGuCJQ.js → config-split-page-DIOCjj2Q.js} +1 -1
- package/dist/assets/{createLucideIcon-BZkY6emz.js → createLucideIcon-BLMK3QUd.js} +1 -1
- package/dist/assets/{desktop-update-config-D5g_gPak.js → desktop-update-config-BGKiqc6q.js} +1 -1
- package/dist/assets/{dialog-CdtCU2xX.js → dialog-dxsKz7jJ.js} +1 -1
- package/dist/assets/{dist-CuqvE--P.js → dist-DsYTOyq7.js} +1 -1
- package/dist/assets/{doc-browser-BUlCkZo2.js → doc-browser-C8FM5fC0.js} +1 -1
- package/dist/assets/doc-browser-RJUOL_GO.js +1 -0
- package/dist/assets/{doc-browser-context-DfLHAWbG.js → doc-browser-context-BJuMaI3o.js} +1 -1
- package/dist/assets/{doc-browser-CzCV73NJ.js → doc-browser-p82AdNO-.js} +1 -1
- package/dist/assets/{es2015-yYU5Ad5w.js → es2015-V75WQJ2s.js} +1 -1
- package/dist/assets/{external-link-Sw3ah_JD.js → external-link-DwfSfTLB.js} +1 -1
- package/dist/assets/{folder-D7-VTnkz.js → folder-CeJKPx5P.js} +1 -1
- package/dist/assets/{hash-zajSTDXZ.js → hash-BqxRTZW5.js} +1 -1
- package/dist/assets/i18n-DnTGDIRw.js +1 -0
- package/dist/assets/{index-Doxyk7L2.js → index-BrEdR78s.js} +2 -2
- package/dist/assets/{key-round-CnI1mc9F.js → key-round-CJ5gDAAG.js} +1 -1
- package/dist/assets/loader-circle-fd-vQKtW.js +1 -0
- package/dist/assets/{logo-badge-BQgKnVtz.js → logo-badge-KAe-7d8c.js} +1 -1
- package/dist/assets/{logos-CqVm0q0W.js → logos-C4sYP1Vl.js} +1 -1
- package/dist/assets/marketplace-page-B2Pm2RDJ.js +1 -0
- package/dist/assets/{marketplace-page-CawcdL6Y.js → marketplace-page-CPHxlYL8.js} +1 -1
- package/dist/assets/mcp-marketplace-page-BcjVmw36.js +1 -0
- package/dist/assets/{mcp-marketplace-page-DEGfJ_70.js → mcp-marketplace-page-CswPXSjf.js} +1 -1
- package/dist/assets/message-square-z_osm9c0.js +1 -0
- package/dist/assets/{model-config-r-1RPSrZ.js → model-config-Cmruiqdx.js} +1 -1
- package/dist/assets/{notice-card-BPtCVEKW.js → notice-card-D1RNsTn_.js} +1 -1
- package/dist/assets/play-Dv6Nr1Ew.js +1 -0
- package/dist/assets/plus-D8eKFY7h.js +1 -0
- package/dist/assets/{popover-jbfQhYQh.js → popover-BMyiifTA.js} +1 -1
- package/dist/assets/{provider-scoped-model-input-gdk2lmRi.js → provider-scoped-model-input-D7ACiMAO.js} +1 -1
- package/dist/assets/{providers-list-DpISIr3M.js → providers-list-gg7LrfuB.js} +1 -1
- package/dist/assets/{refresh-ccw-Bii4w8aB.js → refresh-ccw-ByVwmnN_.js} +1 -1
- package/dist/assets/{refresh-cw-BxojR62w.js → refresh-cw-PcqoYB3K.js} +1 -1
- package/dist/assets/remote-Db2M39Cv.js +1 -0
- package/dist/assets/{rotate-cw-1Xqa7LZ8.js → rotate-cw-BZ2JObNs.js} +1 -1
- package/dist/assets/runtime-config-page-BT_VV41p.js +1 -0
- package/dist/assets/{save--BVI5wZX.js → save-euRxl8pI.js} +1 -1
- package/dist/assets/{search-vChioOoe.js → search-CLd7m0M7.js} +1 -1
- package/dist/assets/{search-config-BWqz8nqY.js → search-config-0VTPpz-w.js} +1 -1
- package/dist/assets/{secrets-config-CjzSNg0Y.js → secrets-config-DwQbLLEy.js} +1 -1
- package/dist/assets/{select-Cw5Zkb1w.js → select-DTdzR8j8.js} +1 -1
- package/dist/assets/{sessions-config-page-beoDPtII.js → sessions-config-page-CAG7Zevv.js} +1 -1
- package/dist/assets/{setting-row-Cjl2d40s.js → setting-row-CvKngoNI.js} +1 -1
- package/dist/assets/{settings-CiRChctQ.js → settings-drbWqzA4.js} +1 -1
- package/dist/assets/skeleton-BK1SOSRA.js +1 -0
- package/dist/assets/{sparkles-D1ZKWdm4.js → sparkles-DVfeSVJQ.js} +1 -1
- package/dist/assets/{status-dot-Dv_hiUVa.js → status-dot-ChvPCib9.js} +1 -1
- package/dist/assets/{tabs-custom-CsACkVji.js → tabs-custom-Hia_ong0.js} +1 -1
- package/dist/assets/{tag-chip-CoWHxYJj.js → tag-chip-BywQeHJj.js} +1 -1
- package/dist/assets/theme-provider-COAwWFv8.js +2 -0
- package/dist/assets/{tooltip-GYzH-Hfq.js → tooltip-BOYp8Ue7.js} +1 -1
- package/dist/assets/{trash-2-rY9ZteZX.js → trash-2-CBsHCfqq.js} +1 -1
- package/dist/assets/{use-config-BhJHD3-G.js → use-config-DTwhNDQE.js} +1 -1
- package/dist/assets/{use-confirm-dialog-Bqgy3Gi-.js → use-confirm-dialog-oeSqhmrx.js} +1 -1
- package/dist/assets/{use-infinite-scroll-loader-BfexitoF.js → use-infinite-scroll-loader-X3KGuME8.js} +1 -1
- package/dist/assets/{use-viewport-layout-D33zVbr5.js → use-viewport-layout-C0NJAVXs.js} +1 -1
- package/dist/assets/x-CM-XDMpk.js +1 -0
- package/dist/index.html +39 -39
- package/package.json +6 -6
- package/src/features/account/hooks/use-auth.test.ts +7 -5
- package/src/features/account/hooks/use-auth.ts +23 -20
- package/src/features/system-status/hooks/use-system-status.ts +6 -28
- package/src/features/system-status/index.ts +2 -1
- package/src/features/system-status/managers/system-status.manager.bootstrap-polling.test.ts +14 -4
- package/src/features/system-status/managers/system-status.manager.test.ts +2 -8
- package/src/features/system-status/managers/system-status.manager.ts +20 -30
- package/src/shared/components/common/brand-header.test.tsx +84 -3
- package/src/shared/components/common/brand-header.tsx +37 -39
- package/src/shared/lib/api/managers/client.manager.ts +30 -2
- package/src/shared/lib/api/utils/config.utils.ts +6 -4
- package/src/shared/lib/i18n/desktop-update-labels.utils.ts +3 -1
- package/src/shared/lib/transport/index.ts +1 -0
- package/src/shared/lib/transport/transport.types.ts +20 -0
- package/dist/assets/app-manager-provider-C0ONQxUg.js +0 -1
- package/dist/assets/doc-browser-Doh2541x.js +0 -1
- package/dist/assets/i18n-C5Mibli1.js +0 -1
- package/dist/assets/loader-circle-B5i8oMMY.js +0 -1
- package/dist/assets/marketplace-page-BRHkZaO5.js +0 -1
- package/dist/assets/mcp-marketplace-page-CL7BF4dD.js +0 -1
- package/dist/assets/message-square-D6Z4NwpG.js +0 -1
- package/dist/assets/play-D8WJLnJe.js +0 -1
- package/dist/assets/plus-Di0KAkiO.js +0 -1
- package/dist/assets/remote-BnRNqMlb.js +0 -1
- package/dist/assets/runtime-config-page-DQ8YY8Lc.js +0 -1
- package/dist/assets/skeleton-CFQRIUzt.js +0 -1
- package/dist/assets/theme-provider-B5XReW_-.js +0 -1
- package/dist/assets/x-DpTzXQcX.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,i as t,m as n,n as r,p as i,u as a}from"./i18n-C5Mibli1.js";import{Ct as o,Mt as s,Ot as c,gt as l,jt as u,kt as d,wt as f}from"./api-lwyw9j7i.js";import{c as p,l as m,s as h}from"./chunk-JZWAC4HX-u4uYphxM.js";import{a as g,i as _,n as v,o as y,r as b,t as x}from"./dialog-CdtCU2xX.js";import{t as S}from"./createLucideIcon-BZkY6emz.js";import{_ as C,m as w,v as T}from"./theme-provider-B5XReW_-.js";import{A as E,B as D,C as ee,D as O,E as te,F as ne,L as re,M as k,N as ie,O as ae,P as oe,S as se,T as ce,_ as le,a as ue,b as de,c as fe,d as pe,f as me,g as A,h as he,i as ge,j as _e,k as j,l as ve,m as M,n as ye,o as N,p as be,r as xe,s as Se,t as P,u as F,v as I,w as Ce,x as we,y as Te,z as L}from"./chat-DwUf7AKR.js";import{a as R,i as z,n as B,r as V,t as H}from"./select-Cw5Zkb1w.js";import{i as Ee,n as U,r as De,t as W}from"./provider-scoped-model-input-gdk2lmRi.js";import{t as Oe}from"./refresh-cw-BxojR62w.js";import"./mcp-marketplace-page-DEGfJ_70.js";import{t as ke}from"./play-D8WJLnJe.js";import{t as G}from"./plus-Di0KAkiO.js";import{t as K}from"./sparkles-D1ZKWdm4.js";import{t as q}from"./trash-2-rY9ZteZX.js";import{t as J}from"./notice-card-BPtCVEKW.js";import{t as Ae}from"./use-viewport-layout-D33zVbr5.js";import{g as je,m as Me,n as Y,o as Ne,p as Pe,r as Fe,s as Ie,y as Le}from"./use-config-BhJHD3-G.js";import{t as Re}from"./index-Doxyk7L2.js";import{t as ze}from"./tag-chip-CoWHxYJj.js";import{t as Be}from"./use-confirm-dialog-Bqgy3Gi-.js";import{t as Ve}from"./marketplace-page-CawcdL6Y.js";var He=S(`Power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Ue=S(`ShieldCheck`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),X=e(n(),1),Z=i(),Q=X.forwardRef(({className:e,...t},n)=>(0,Z.jsx)(`textarea`,{className:a(`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`,e),ref:n,...t}));Q.displayName=`Textarea`;var We={id:``,displayName:``,description:``,avatar:``,model:``,home:``,runtime:``};function Ge(e){return{displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,model:e.model??``,runtime:e.runtime??e.engine??``}}function Ke(e){let{runtimeOptions:t,currentRuntime:n}=e,r=n.trim();if(!r)return t;let i=M(r);return t.some(e=>e.value===i)?t:[...t,{value:i,label:A(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 qe({value:e,disabled:n=!1,runtimeOptions:r,defaultRuntime:i,onChange:a}){let o=e.trim()?M(e):``,s=Ke({runtimeOptions:r,currentRuntime:e}),c=s.find(e=>e.value===o)??null,l=c?.reasonMessage?.trim()||(c?.ready===!1?t(`agentsRuntimeUnavailableHelp`):``);return(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsxs)(H,{value:o||i,onValueChange:e=>a(e===i?``:e),disabled:n,children:[(0,Z.jsx)(z,{"aria-label":t(`agentsCardRuntimeLabel`),className:`rounded-xl`,children:(0,Z.jsx)(R,{placeholder:t(`agentsRuntimeSelectPlaceholder`)})}),(0,Z.jsx)(B,{className:`rounded-xl`,children:s.map(e=>(0,Z.jsx)(V,{value:e.value,disabled:e.ready===!1&&e.value!==o,className:`rounded-lg`,children:e.label},e.value))})]}),l?(0,Z.jsx)(`p`,{className:`text-xs text-gray-500`,children:l}):null]})}function Je({open:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,Z.jsx)(x,{open:e,onOpenChange:a,children:e||t?(0,Z.jsx)(Xe,{pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e?`create-open`:`create-closed`):null})}function Ye({agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,Z.jsx)(x,{open:e!==null,onOpenChange:a,children:e?(0,Z.jsx)(Ze,{agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e.id):null})}function Xe(e){let{pending:n,providerCatalog:r,runtimeOptions:i,defaultRuntime:a,onOpenChange:o,onSubmit:c}=e,[l,d]=(0,X.useState)(We);return(0,Z.jsxs)(v,{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,Z.jsx)(`div`,{className:`shrink-0 border-b border-[#f0e2c8] px-6 py-6`,children:(0,Z.jsxs)(g,{className:`text-left`,children:[(0,Z.jsx)(y,{children:t(`agentsCreateDialogTitle`)}),(0,Z.jsx)(b,{children:t(`agentsCreateDialogDescription`)})]})}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Z.jsx)(u,{value:l.id,onChange:e=>d(t=>({...t,id:e.target.value})),placeholder:t(`agentsFormIdPlaceholder`)}),(0,Z.jsx)(u,{value:l.displayName,onChange:e=>d(t=>({...t,displayName:e.target.value})),placeholder:t(`agentsFormNamePlaceholder`)}),(0,Z.jsx)(Q,{value:l.description,onChange:e=>d(t=>({...t,description:e.target.value})),placeholder:t(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,Z.jsx)(u,{value:l.avatar,onChange:e=>d(t=>({...t,avatar:e.target.value})),placeholder:t(`agentsFormAvatarPlaceholder`)}),(0,Z.jsx)(u,{value:l.home,onChange:e=>d(t=>({...t,home:e.target.value})),placeholder:t(`agentsFormHomePlaceholder`)}),(0,Z.jsx)(W,{value:l.model,onChange:e=>d(t=>({...t,model:e})),providerCatalog:r,disabled:n,className:`md:col-span-2`}),(0,Z.jsx)(qe,{value:l.runtime,onChange:e=>d(t=>({...t,runtime:e})),runtimeOptions:i,defaultRuntime:a,disabled:n})]}),(0,Z.jsx)(J,{tone:`warning`,title:t(`agentsCreateDialogHint`),className:`text-xs leading-6`})]})}),(0,Z.jsxs)(_,{className:`shrink-0 border-t border-[#f1e7d4] px-6 py-5`,children:[(0,Z.jsx)(s,{type:`button`,variant:`ghost`,onClick:()=>o(!1),disabled:n,children:t(`cancel`)}),(0,Z.jsxs)(s,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>void c(l),disabled:n||l.id.trim().length===0,children:[(0,Z.jsx)(G,{className:`mr-2 h-4 w-4`}),t(`agentsCreateAction`)]})]})]})}function Ze(e){let{agent:n,pending:r,providerCatalog:i,runtimeOptions:a,defaultRuntime:o,onOpenChange:c,onSubmit:l}=e,[d,f]=(0,X.useState)(Ge(n));return(0,Z.jsxs)(v,{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,Z.jsx)(`div`,{className:`shrink-0 border-b border-[#f0e2c8] px-6 py-6`,children:(0,Z.jsxs)(g,{className:`text-left`,children:[(0,Z.jsx)(y,{children:t(`agentsEditDialogTitle`)}),(0,Z.jsx)(b,{children:t(`agentsEditDialogDescription`)})]})}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(J,{tone:`warning`,title:t(`agentsEditHomeReadonly`),description:t(`agentsEditHomeReadonlyHint`),children:(0,Z.jsx)(`div`,{className:`break-all text-sm text-amber-950`,children:n.workspace??`-`})}),(0,Z.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Z.jsx)(u,{value:d.displayName,onChange:e=>f(t=>({...t,displayName:e.target.value})),placeholder:t(`agentsFormNamePlaceholder`)}),(0,Z.jsx)(Q,{value:d.description,onChange:e=>f(t=>({...t,description:e.target.value})),placeholder:t(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,Z.jsx)(u,{value:d.avatar,onChange:e=>f(t=>({...t,avatar:e.target.value})),placeholder:t(`agentsFormAvatarPlaceholder`)}),(0,Z.jsx)(W,{value:d.model,onChange:e=>f(t=>({...t,model:e})),providerCatalog:i,disabled:r,className:`md:col-span-2`}),(0,Z.jsx)(qe,{value:d.runtime,onChange:e=>f(t=>({...t,runtime:e})),runtimeOptions:a,defaultRuntime:o,disabled:r})]})]})}),(0,Z.jsxs)(_,{className:`shrink-0 border-t border-[#f1e7d4] px-6 py-5`,children:[(0,Z.jsx)(s,{type:`button`,variant:`ghost`,onClick:()=>c(!1),disabled:r,children:t(`cancel`)}),(0,Z.jsxs)(s,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>l(n.id,d),disabled:r,children:[(0,Z.jsx)(L,{className:`mr-2 h-4 w-4`}),t(`agentsEditSaveAction`)]})]})]})}var Qe=[{strip:`bg-[#efc37a]`,chip:`border-[#f2d7a7] bg-[#fff8eb] text-[#8d5a18]`},{strip:`bg-[#8fd4c0]`,chip:`border-[#bde6da] bg-[#effbf7] text-[#156653]`},{strip:`bg-[#b7c9fb]`,chip:`border-[#d7e2ff] bg-[#f4f7ff] text-[#2d4d8f]`}];function $e(e,t){return t?{strip:`bg-[#e6b765]`,chip:`border-[#f2d19c] bg-[#fff8ec] text-[#90550d]`}:Qe[e%Qe.length]}function et(e){let{agentCount:n,onCreate:r}=e;return(0,Z.jsxs)(`section`,{className:`relative overflow-hidden rounded-[28px] border border-[#f0d6aa] bg-[linear-gradient(135deg,#fff7ea_0%,#fff9f1_32%,#f2fbff_100%)] px-5 py-5 sm:px-6`,children:[(0,Z.jsx)(`div`,{className:`absolute inset-y-0 right-0 w-[46%] bg-[radial-gradient(circle_at_top_right,rgba(255,215,163,0.52),transparent_54%)]`}),(0,Z.jsx)(`div`,{className:`absolute -bottom-10 left-8 h-32 w-32 rounded-full bg-[#ffe6c0]/55 blur-3xl`}),(0,Z.jsxs)(`div`,{className:`relative grid gap-5 xl:grid-cols-[minmax(0,1fr)_320px] xl:items-center`,children:[(0,Z.jsxs)(`div`,{className:`max-w-3xl space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-white/70 bg-white/80 px-3 py-1 text-[11px] font-semibold tracking-[0.16em] text-[#9b6118]`,children:[(0,Z.jsx)(K,{className:`h-3.5 w-3.5`}),t(`agentsHeroEyebrow`)]}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`h1`,{className:`max-w-2xl text-[30px] font-semibold leading-tight tracking-[-0.05em] text-[#2f2212] sm:text-[38px]`,children:t(`agentsHeroTitle`)}),(0,Z.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-[#6d5841] sm:text-[15px] sm:leading-7`,children:t(`agentsHeroDescription`)})]}),(0,Z.jsx)(`div`,{className:`pt-1`,children:(0,Z.jsxs)(`div`,{className:`inline-flex items-center gap-3 rounded-2xl border border-[#f2d5a4] bg-white/82 px-3 py-2 text-[#7a4d12] shadow-[0_14px_30px_rgba(167,117,47,0.07)]`,children:[(0,Z.jsx)(`span`,{className:`text-[11px] font-semibold tracking-[0.14em]`,children:t(`agentsOverviewTotal`)}),(0,Z.jsx)(`span`,{className:`text-xl font-semibold tracking-[-0.04em] text-[#1f2937]`,children:n})]})})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-3`,children:[(0,Z.jsxs)(s,{type:`button`,variant:`primary`,className:`h-10 rounded-2xl px-5 text-sm font-semibold`,onClick:r,children:[(0,Z.jsx)(G,{className:`mr-2 h-4 w-4`}),t(`agentsCreateButton`)]}),(0,Z.jsx)(J,{title:t(`agentsCreateDialogHint`),className:`border-white/70 bg-white/72 text-xs leading-6 shadow-[0_18px_40px_rgba(167,117,47,0.08)]`})]})]})]})}function tt(e){let{agent:n,index:r,runtimeOptions:i,defaultRuntimeLabel:c,updatePending:l,deletePending:u,onStartChat:d,onEdit:p,onDelete:m}=e,h=$e(r,!!n.builtIn),g=n.runtime?.trim()||n.engine?.trim()||``,_=g?i.find(e=>e.value===M(g))?.label??A(g):c;return(0,Z.jsxs)(o,{className:`overflow-hidden border border-gray-200 bg-white shadow-sm transition-shadow duration-200 hover:shadow-md`,children:[(0,Z.jsx)(`div`,{className:a(`h-1.5 w-full`,h.strip)}),(0,Z.jsxs)(f,{className:`flex h-full flex-col gap-4 px-4 py-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Z.jsx)(re,{agentId:n.id,displayName:n.displayName,avatarUrl:n.avatarUrl,className:`h-11 w-11 shrink-0`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1 pt-0.5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`div`,{className:`truncate text-lg font-semibold tracking-[-0.03em] text-[#1f2937]`,children:n.displayName?.trim()||n.id}),n.builtIn?(0,Z.jsxs)(ze,{tone:`warning`,className:a(`gap-1`,h.chip),children:[(0,Z.jsx)(Ue,{className:`h-3 w-3`}),t(`agentsCardBuiltInTag`)]}):null]}),(0,Z.jsxs)(`div`,{className:`text-[11px] font-medium uppercase tracking-[0.18em] text-[#94a3b8]`,children:[`@`,n.id]})]})]}),(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-[#64748b]`,children:n.description?.trim()||(n.builtIn?t(`agentsCardBuiltInSummary`):t(`agentsCardCustomSummary`))}),(0,Z.jsxs)(`div`,{className:`mt-auto flex flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.18em] text-[#94a3b8]`,children:[(0,Z.jsx)(K,{className:`h-3.5 w-3.5`}),t(`agentsCardRuntimeLabel`)]}),(0,Z.jsx)(`div`,{className:`mt-1.5 text-sm leading-6 text-[#475569]`,children:_})]}),(0,Z.jsxs)(`div`,{className:`border-t border-gray-100 pt-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.18em] text-[#94a3b8]`,children:[(0,Z.jsx)(D,{className:`h-3.5 w-3.5`}),t(`agentsCardHomeLabel`)]}),(0,Z.jsx)(`div`,{className:`mt-1.5 break-all text-sm leading-6 text-[#475569]`,children:n.workspace??`-`})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(s,{type:`button`,variant:`primary`,className:`h-9 rounded-xl px-4`,onClick:d,children:[(0,Z.jsx)(w,{className:`mr-2 h-4 w-4`}),t(`agentsCardStartChat`)]}),(0,Z.jsxs)(s,{type:`button`,variant:`ghost`,className:`h-8 rounded-xl px-3 text-xs text-[#7b8794] hover:bg-[#f3f4f6] hover:text-[#475569]`,onClick:p,disabled:l,children:[(0,Z.jsx)(L,{className:`mr-1.5 h-3.5 w-3.5`}),t(`agentsEditAction`)]}),n.builtIn?null:(0,Z.jsxs)(s,{type:`button`,variant:`ghost`,className:`h-8 rounded-xl px-3 text-xs text-[#7b8794] hover:bg-[#f3f4f6] hover:text-[#475569]`,onClick:m,disabled:u,children:[(0,Z.jsx)(q,{className:`mr-1.5 h-3.5 w-3.5`}),t(`agentsRemoveAction`)]})]})]})]})]})}function nt(){let e=ne(),n=I(),r=Y(),i=Fe(),a=N(),c=Te(),l=we(),u=de(),[p,m]=(0,X.useState)(!1),[h,g]=(0,X.useState)(null),_=(0,X.useMemo)(()=>n.data?.agents??[],[n.data?.agents]),v=(0,X.useMemo)(()=>[..._].sort((e,t)=>Number(!!t.builtIn)-Number(!!e.builtIn)||e.id.localeCompare(t.id)),[_]),y=(0,X.useMemo)(()=>U({config:r.data,meta:i.data,onlyConfigured:!0}),[i.data,r.data]),b=(0,X.useMemo)(()=>be(a.data?.options??[]),[a.data?.options]),x=(0,X.useMemo)(()=>M(a.data?.defaultType??`native`),[a.data?.defaultType]),S=(0,X.useMemo)(()=>b.find(e=>e.value===x)?.label??A(x),[x,b]),w=async e=>{await c.mutateAsync({data:{id:e.id,...e.displayName.trim()?{displayName:e.displayName.trim()}:{},...e.description.trim()?{description:e.description.trim()}:{},...e.avatar.trim()?{avatar:e.avatar.trim()}:{},...e.home.trim()?{home:e.home.trim()}:{},...e.model.trim()?{model:e.model.trim()}:{},...e.runtime.trim()?{runtime:e.runtime.trim()}:{}}}),m(!1)},T=e=>{g(e)},E=async(e,t)=>{await l.mutateAsync({agentId:e,data:{displayName:t.displayName,description:t.description,avatar:t.avatar,model:t.model,...t.runtime.trim()?{runtime:t.runtime.trim()}:{runtime:``}}}),g(null)},D=t=>{e.chatSessionListManager.startAgentDraftChat(t.id,he(t,x))};return(0,Z.jsxs)(d,{className:`space-y-5`,children:[(0,Z.jsx)(et,{agentCount:_.length,onCreate:()=>m(!0)}),(0,Z.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:n.isLoading?(0,Z.jsx)(o,{className:`md:col-span-2 xl:col-span-3 border-dashed border-[#d9dce3] bg-white/70`,children:(0,Z.jsx)(f,{className:`py-14 text-center text-sm text-gray-500`,children:t(`agentsLoading`)})}):v.length===0?(0,Z.jsx)(o,{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,Z.jsxs)(f,{className:`flex min-h-[240px] flex-col items-center justify-center px-6 py-14 text-center`,children:[(0,Z.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,Z.jsx)(C,{className:`h-8 w-8 text-[#d39a3b]`})}),(0,Z.jsx)(`div`,{className:`text-lg font-semibold text-[#2f2212]`,children:t(`agentsEmpty`)}),(0,Z.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-[#78644d]`,children:t(`agentsEmptyDescription`)}),(0,Z.jsxs)(s,{type:`button`,variant:`primary`,className:`mt-5 rounded-2xl px-5`,onClick:()=>m(!0),children:[(0,Z.jsx)(G,{className:`mr-2 h-4 w-4`}),t(`agentsCreateButton`)]})]})}):v.map((e,t)=>(0,Z.jsx)(tt,{agent:e,index:t,runtimeOptions:b,defaultRuntimeLabel:S,updatePending:l.isPending,deletePending:u.isPending,onStartChat:()=>D(e),onEdit:()=>T(e),onDelete:()=>u.mutate({agentId:e.id})},e.id))}),(0,Z.jsx)(Je,{open:p,pending:c.isPending,providerCatalog:y,runtimeOptions:b,defaultRuntime:x,onOpenChange:m,onSubmit:w}),(0,Z.jsx)(Ye,{agent:h,pending:l.isPending,providerCatalog:y,runtimeOptions:b,defaultRuntime:x,onOpenChange:e=>{!e&&!l.isPending&&g(null)},onSubmit:E})]})}function $(e){return r(e??void 0)}function rt(e){return typeof e!=`number`||!Number.isFinite(e)?`-`:r(new Date(e))}function it(e){if(typeof e!=`number`||!Number.isFinite(e))return`-`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.round(t/60);if(n<60)return`${n}m`;let r=Math.round(n/60);return r<24?`${r}h`:`${Math.round(r/24)}d`}function at(e){let{schedule:t}=e;return t.kind===`cron`?t.expr?`cron ${t.expr}`:`cron`:t.kind===`every`?`every ${it(t.everyMs)}`:t.kind===`at`?`at ${rt(t.atMs)}`:`-`}function ot(e){return e.payload.deliver?`${e.payload.channel??`-`}:${e.payload.to??`-`}`:`-`}function st(e){return e.payload.sessionId?.trim()||`cron:${e.id}`}function ct(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 lt(e,t){return t===`all`?!0:t===`enabled`?e.enabled:!e.enabled}function ut(e){let{job:n,onDelete:r,onRun:i,onToggle:c}=e;return(0,Z.jsx)(o,{className:`border border-gray-200`,children:(0,Z.jsx)(f,{className:`pt-5 pb-5`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{className:`min-w-[220px] flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-semibold text-gray-900`,children:n.name||n.id}),(0,Z.jsx)(`span`,{className:`rounded-full bg-gray-100 px-2 py-0.5 text-[10px] font-semibold text-gray-500`,children:n.id}),(0,Z.jsx)(`span`,{className:a(`rounded-full px-2 py-0.5 text-[10px] font-semibold`,n.enabled?`bg-emerald-50 text-emerald-700`:`bg-gray-100 text-gray-500`),children:n.enabled?t(`enabled`):t(`disabled`)}),n.deleteAfterRun?(0,Z.jsx)(`span`,{className:`rounded-full bg-amber-50 px-2 py-0.5 text-[10px] font-semibold text-amber-700`,children:t(`cronOneShot`)}):null]}),(0,Z.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[t(`cronScheduleLabel`),`: `,at(n)]}),(0,Z.jsx)(`div`,{className:`mt-2 whitespace-pre-wrap break-words text-sm text-gray-700`,children:n.payload.message}),(0,Z.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[t(`cronSessionLabel`),`: `,st(n)]}),(0,Z.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[t(`cronDeliverTo`),`: `,ot(n)]})]}),(0,Z.jsxs)(`div`,{className:`min-w-[220px] space-y-2 text-xs text-gray-500`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[t(`cronNextRun`),`:`]}),` `,$(n.state.nextRunAt)]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[t(`cronLastRun`),`:`]}),` `,$(n.state.lastRunAt)]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[t(`cronLastStatus`),`:`]}),` `,n.state.lastStatus??`-`]}),n.state.lastError?(0,Z.jsx)(`div`,{className:`break-words text-[11px] text-red-500`,children:n.state.lastError}):null]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-end gap-2`,children:[(0,Z.jsxs)(s,{variant:`subtle`,size:`sm`,onClick:()=>i(n),className:`gap-1`,children:[(0,Z.jsx)(ke,{className:`h-3.5 w-3.5`}),t(`cronRunNow`)]}),(0,Z.jsxs)(s,{variant:n.enabled?`outline`:`primary`,size:`sm`,onClick:()=>c(n),className:`gap-1`,children:[(0,Z.jsx)(He,{className:`h-3.5 w-3.5`}),n.enabled?t(`cronDisable`):t(`cronEnable`)]}),(0,Z.jsxs)(s,{variant:`destructive`,size:`sm`,onClick:()=>r(n),className:`gap-1`,children:[(0,Z.jsx)(q,{className:`h-3.5 w-3.5`}),t(`delete`)]})]})]})})})}function dt(){let[e,n]=(0,X.useState)(``),[r,i]=(0,X.useState)(`all`),o=Ne({all:!0}),l=Ie(),f=Le(),p=je(),{confirm:m,ConfirmDialog:h}=Be(),g=(0,X.useMemo)(()=>(o.data?.jobs??[]).filter(t=>ct(t,e)).filter(e=>lt(e,r)),[o.data,e,r]),_=async e=>{await m({title:`${t(`cronDeleteConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,variant:`destructive`,confirmLabel:t(`delete`)})&&l.mutate({id:e.id})},v=async e=>{let n=!e.enabled;await m({title:n?`${t(`cronEnableConfirm`)}?`:`${t(`cronDisableConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,variant:n?`default`:`destructive`,confirmLabel:t(n?`cronEnable`:`cronDisable`)})&&f.mutate({id:e.id,enabled:n})},y=async e=>{let n=!e.enabled;await m({title:n?`${t(`cronRunForceConfirm`)}?`:`${t(`cronRunConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,confirmLabel:t(`cronRunNow`)})&&p.mutate({id:e.id,force:n})};return(0,Z.jsxs)(d,{fullHeight:!0,children:[(0,Z.jsx)(c,{title:t(`cronPageTitle`),description:t(`cronPageDescription`),actions:(0,Z.jsx)(s,{variant:`ghost`,size:`icon`,className:`h-9 w-9 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100`,onClick:()=>o.refetch(),children:(0,Z.jsx)(Oe,{className:a(`h-4 w-4`,o.isFetching&&`animate-spin`)})})}),(0,Z.jsx)(`div`,{className:`mb-6`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center`,children:[(0,Z.jsxs)(`div`,{className:`relative flex-1 min-w-[240px]`,children:[(0,Z.jsx)(u,{value:e,onChange:e=>n(e.target.value),placeholder:t(`cronSearchPlaceholder`),className:`pl-9`}),(0,Z.jsx)(T,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`})]}),(0,Z.jsx)(`div`,{className:`min-w-[180px]`,children:(0,Z.jsxs)(H,{value:r,onValueChange:e=>i(e),children:[(0,Z.jsx)(z,{className:`w-full`,children:(0,Z.jsx)(R,{placeholder:t(`cronStatusLabel`)})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(V,{value:`all`,children:t(`cronStatusAll`)}),(0,Z.jsx)(V,{value:`enabled`,children:t(`cronStatusEnabled`)}),(0,Z.jsx)(V,{value:`disabled`,children:t(`cronStatusDisabled`)})]})]})}),(0,Z.jsxs)(`div`,{className:`text-xs text-gray-500 ml-auto`,children:[t(`cronTotalLabel`),`: `,o.data?.total??0,` / `,g.length]})]})}),(0,Z.jsx)(`div`,{className:`flex-1 overflow-auto custom-scrollbar`,children:o.isLoading?(0,Z.jsx)(`div`,{className:`text-sm text-gray-400 p-4 text-center`,children:t(`cronLoading`)}):g.length===0?(0,Z.jsx)(`div`,{className:`text-sm text-gray-400 p-4 text-center`,children:t(`cronEmpty`)}):(0,Z.jsx)(`div`,{className:`space-y-4`,children:g.map(e=>(0,Z.jsx)(ut,{job:e,onDelete:_,onRun:y,onToggle:v},e.id))})}),(0,Z.jsx)(h,{})]})}function ft(e){let{view:t,routeSessionKey:n,selectedSessionKey:r,setSelectedSessionKey:i,selectedSessionKeyRef:a,resetStreamState:o}=e;(0,X.useEffect)(()=>{if(t===`chat`){if(n){r!==n&&i(n);return}r!==null&&(i(null),o())}},[o,n,r,i,t]),(0,X.useEffect)(()=>{a.current=r},[r,a])}function pt({view:e,confirmDialog:t}){let{isMobile:n}=Ae();return(0,Z.jsxs)(`div`,{className:`h-full flex`,children:[n?null:(0,Z.jsx)(ve,{}),e===`chat`?n?(0,Z.jsx)(Re,{}):(0,Z.jsx)(me,{}):(0,Z.jsx)(`section`,{className:`flex-1 min-h-0 overflow-hidden bg-gradient-to-b from-gray-50/60 to-white`,children:e===`cron`?(0,Z.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,Z.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1120px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,Z.jsx)(dt,{})})}):e===`agents`?(0,Z.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,Z.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1180px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,Z.jsx)(nt,{})})}):(0,Z.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,Z.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full max-w-[min(1120px,100%)] flex-col px-4 py-4 sm:px-6 sm:py-5`,children:(0,Z.jsx)(Ve,{forcedType:`skills`})})})}),t]})}function mt(e,t){return e.filter(e=>pe(e,t))}function ht(e){let{config:t,meta:n}=e;return(0,X.useMemo)(()=>{let e=U({meta:n,config:t,onlyConfigured:!0}),r=new Set,i=[];for(let t of e)for(let e of t.models){let n=De(t.prefix,e);!n||r.has(n)||(r.add(n),i.push({value:n,modelLabel:e,providerLabel:t.displayName,thinkingCapability:Ee(t.modelThinking,e,t.aliases)}))}return i.sort((e,t)=>{let n=e.providerLabel.localeCompare(t.providerLabel);return n===0?e.modelLabel.localeCompare(t.modelLabel):n})},[t,n])}function gt(e){let{sessions:t,sessionKey:n,sessionType:r}=e;return{recentSessionPreferredModel:(0,X.useMemo)(()=>P({sessions:t,selectedSessionKey:n,sessionType:r,readPreference:e=>e.preferredModel?.trim()||void 0}),[n,r,t]),recentSessionPreferredThinking:(0,X.useMemo)(()=>P({sessions:t,selectedSessionKey:n,sessionType:r,readPreference:e=>e.preferredThinking??void 0}),[n,r,t])}}function _t(e){let{currentSelectedModel:t,modelOptions:n}=e,r=(0,X.useMemo)(()=>n.find(e=>e.value===t),[t,n]);return{supportedThinkingLevels:(0,X.useMemo)(()=>r?.thinkingCapability?.supported??[],[r?.thinkingCapability?.supported]),defaultThinkingLevel:(0,X.useMemo)(()=>r?.thinkingCapability?.default??null,[r?.thinkingCapability?.default])}}function vt(e){let{modelOptions:t,supportedModels:n}=e;if(!n||n.length===0)return t;let r=new Set(n),i=t.filter(e=>r.has(e.value));return i.length>0?i:t}function yt(e){let{currentSelectedModel:t,pendingSessionType:n,projectRootOverride:r,query:i,sessionKey:a,setPendingSessionType:o,setSelectedModel:s,setSelectedThinkingLevel:c}=e,l=Y(),u=Fe(),d=Me({limit:200}),f=N(),p=Pe({sessionId:a,...Object.prototype.hasOwnProperty.call(e,`projectRootOverride`)?{projectRoot:r??null}:{}}),m=(l.isFetched||l.isSuccess)&&(u.isFetched||u.isSuccess),h=ht({config:l.data,meta:u.data}),g=(0,X.useMemo)(()=>d.data?.sessions??[],[d.data?.sessions]),_=(0,X.useMemo)(()=>ae(g),[g]),v=(0,X.useMemo)(()=>mt(_,i),[_,i]),y=(0,X.useMemo)(()=>_.find(e=>e.key===a)??null,[_,a]),b=(0,X.useMemo)(()=>p.data?.records??[],[p.data?.records]),x=le({selectedSession:y,pendingSessionType:n,setPendingSessionType:o,sessionTypesData:f.data}),S=(0,X.useMemo)(()=>vt({modelOptions:h,supportedModels:x.selectedSessionTypeOption?.supportedModels}),[h,x.selectedSessionTypeOption?.supportedModels]),{recentSessionPreferredModel:C,recentSessionPreferredThinking:w}=gt({sessions:_,sessionKey:a,sessionType:x.selectedSessionType}),{supportedThinkingLevels:T,defaultThinkingLevel:E}=_t({currentSelectedModel:t,modelOptions:S});return ye({modelOptions:S,selectedSessionKey:a,selectedSessionExists:!!y,selectedSessionPreferredModel:y?.preferredModel,fallbackPreferredModel:x.selectedSessionTypeOption?.recommendedModel??C,defaultModel:x.selectedSessionTypeOption?.recommendedModel??l.data?.agents.defaults.model,setSelectedModel:s}),xe({supportedThinkingLevels:T,selectedSessionKey:a,selectedSessionExists:!!y,selectedSessionPreferredThinking:y?.preferredThinking??null,fallbackPreferredThinking:w??null,defaultThinkingLevel:E,setSelectedThinkingLevel:c}),{configQuery:l,configMetaQuery:u,sessionsQuery:d,sessionTypesQuery:f,sessionSkillsQuery:p,isProviderStateResolved:m,modelOptions:S,sessionSummaries:g,sessions:v,skillRecords:b,selectedSession:y,...x}}function bt(e){return e.parentSessionKey?e.sessionSummaries.map(j).filter(t=>t.parentSessionId===e.parentSessionKey).sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)).map(e=>({sessionKey:e.key,parentSessionKey:e.parentSessionId??null,label:e.label??null,agentId:e.agentId??null})):[]}function xt(e){let{availableAgents:t,parentSessionId:n,selectedAgentId:r,selectedSession:i,selectedSessionType:a,sessionKey:o,sessionSummaries:s,sessionTypeOptions:c}=e,l=i?F(i):void 0,u=i?.agentId??r,d=t.find(e=>e.id===u)??null,f=(0,X.useMemo)(()=>{if(!n)return null;let e=s.find(e=>e.sessionId===n)??null;return e?j(e):null},[n,s]),p=c.find(e=>e.value===a)??null;return{currentSessionDisplayName:l,currentAgentId:u,currentAgent:d,parentSession:f,currentSessionTypeLabel:p?.label??A(a),currentSessionTypeIcon:p?.icon??null,currentChildSessionTabs:(0,X.useMemo)(()=>bt({parentSessionKey:o,sessionSummaries:s}),[o,s])}}function St(e){(0,X.useEffect)(()=>{e.presenter.chatInputManager.syncSnapshot({isProviderStateResolved:e.isProviderStateResolved,defaultSessionType:e.defaultSessionType,canStopGeneration:e.canStopCurrentRun,stopDisabledReason:e.stopDisabledReason,stopSupported:!0,stopReason:void 0,sendError:e.lastSendError,isSending:e.isSending,modelOptions:e.modelOptions,sessionTypeOptions:e.sessionTypeOptions,selectedSessionType:e.selectedSessionType,canEditSessionType:e.canEditSessionType,sessionTypeUnavailable:e.sessionTypeUnavailable,skillRecords:e.skillRecords,isSkillsLoading:e.isSkillsLoading}),e.presenter.chatThreadManager.syncSnapshot({isProviderStateResolved:e.isProviderStateResolved,modelOptions:e.modelOptions,sessionTypeUnavailable:e.sessionTypeUnavailable,sessionTypeUnavailableMessage:e.sessionTypeUnavailableMessage,sessionTypeLabel:e.currentSessionTypeLabel,sessionTypeIcon:e.currentSessionTypeIcon,sessionKey:e.sessionKey,agentId:e.currentAgentId,agentDisplayName:e.currentAgent?.displayName??null,agentAvatarUrl:e.currentAgent?.avatarUrl??null,availableAgents:e.availableAgents,sessionDisplayName:e.currentSessionDisplayName,sessionProjectRoot:e.effectiveSessionProjectRoot,sessionProjectName:e.effectiveSessionProjectName,canDeleteSession:!!e.selectedSession,threadRef:e.threadRef,isHistoryLoading:e.agent.isHydrating,messages:e.agent.visibleMessages,isSending:e.isSending,isAwaitingAssistantOutput:e.isAwaitingAssistantOutput,contextWindow:se(e.agent.snapshot.contextWindow),parentSessionKey:e.parentSession?.key??null,parentSessionLabel:e.parentSession?F(e.parentSession):null,childSessionTabs:e.childSessionTabs})},[e])}function Ct(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function wt(e){let t={};e.model?.trim()&&(t.model=e.model.trim(),t.preferred_model=e.model.trim()),e.thinkingLevel?.trim()&&(t.thinking=e.thinkingLevel.trim(),t.preferred_thinking=e.thinkingLevel.trim()),e.sessionType?.trim()&&(t.session_type=e.sessionType.trim(),t.runtime=e.sessionType.trim()),e.agentId?.trim()&&(t.agent_id=e.agentId.trim());let n=_e(e.projectRoot);n&&(t.project_root=n);let r=Ct(e.requestedSkills);r.length>0&&(t.requested_skill_refs=r);let i=e.composerNodes?Ce(e.composerNodes):[];return i.length>0&&(t[ee]=i),t}function Tt(e){let{pendingProjectRoot:t,pendingProjectRootSessionKey:n,sessionKey:r,selectedSessionProjectRoot:i}=e;return t!==null&&n!==null&&r===n&&(i??null)===t}function Et(e){let t=O(e=>e.snapshot.query),n=O(e=>e.snapshot.selectedSessionKey),r=O(e=>e.snapshot.draftSessionKey),i=O(e=>e.snapshot.selectedAgentId),a=k(e=>e.snapshot.pendingSessionType),o=k(e=>e.snapshot.pendingProjectRoot),s=k(e=>e.snapshot.pendingProjectRootSessionKey),c=k(e=>e.snapshot.selectedModel),u=l(),d=ce(u),f=I(),{confirm:g,ConfirmDialog:_}=Be(),v=h(),y=p(),{sessionId:b}=m(),x=(0,X.useRef)(null),S=(0,X.useRef)(n),C=(0,X.useMemo)(()=>ue(b),[b]),w=C??n??r,T=o!==null&&s===w,E=yt({query:t,sessionKey:w,projectRootOverride:T?o:void 0,currentSelectedModel:c,pendingSessionType:a,setPendingSessionType:e.chatInputManager.setPendingSessionType,setSelectedModel:e.chatInputManager.setSelectedModel,setSelectedThinkingLevel:e.chatInputManager.setSelectedThinkingLevel});return{presenter:e,selectedSessionKey:n,selectedAgentId:i,pendingProjectRoot:o,pendingProjectRootSessionKey:s,systemStatus:u,isRuntimeBlocked:d,agentsQuery:f,confirm:g,ConfirmDialog:_,location:v,navigate:y,threadRef:x,selectedSessionKeyRef:S,routeSessionKey:C,sessionKey:w,hasSessionProjectRootOverride:T,agent:fe(w),...E}}function Dt(e){let t=Et(e),{agent:n,agentsQuery:r,hasSessionProjectRootOverride:i,pendingProjectRoot:a,isRuntimeBlocked:o,systemStatus:s,selectedAgentId:c,selectedSession:l,selectedSessionType:u,sessionKey:d,sessionSummaries:f,sessionTypeOptions:p}=t,m=i?a:l?.projectRoot??null,h=i?E(m):l?.projectName??E(m),g=n.hydrateError?.message??n.snapshot.error?.message??null,_=s.phase===`ready`&&Se(g)?null:g,v=(r.data?.agents?.length??0)>0?r.data?.agents??[]:[{id:l?.agentId??c}],y=xt({sessionKey:d,selectedSession:l,selectedAgentId:c,availableAgents:v,parentSessionId:l?.parentSessionId??null,sessionSummaries:f,selectedSessionType:u,sessionTypeOptions:p});return{...t,availableAgents:v,effectiveSessionProjectRoot:m,effectiveSessionProjectName:h,isSending:n.isSending||n.isRunning,isAwaitingAssistantOutput:n.isRunning,canStopCurrentRun:n.isRunning,stopDisabledReason:n.isRunning?null:`__preparing__`,lastSendError:o?null:s.phase===`ready`?_:te({message:_,status:s}),...y}}function Ot(e){let{agent:t,pendingProjectRoot:n,pendingProjectRootSessionKey:r,presenter:i,selectedSession:a,selectedSessionKey:o,selectedSessionKeyRef:s,sessionKey:c}=e;(0,X.useEffect)(()=>{i.chatStreamActionsManager.bind({sendMessage:async e=>{if(e.sessionKey!==c)return;let o=wt({agentId:e.agentId,model:e.model,thinkingLevel:e.thinkingLevel,sessionType:e.sessionType,projectRoot:e.sessionKey===r?n:a?.projectRoot??null,requestedSkills:e.requestedSkills,composerNodes:e.composerNodes}),s=ie({sessionId:e.sessionKey,text:e.message,attachments:e.attachments,parts:e.parts,metadata:o});if(s)try{await t.send(s)}catch(t){throw e.restoreDraftOnError&&(e.composerNodes&&e.composerNodes.length>0?i.chatInputManager.restoreComposerState?.(e.composerNodes,e.attachments??[]):i.chatInputManager.setDraft(t=>t.trim().length===0?e.message:t)),t}},stopCurrentRun:async()=>{await t.abort()},resumeRun:async e=>{e.sessionKey===c&&await t.streamRun()},resetStreamState:()=>{s.current=null},applyHistoryMessages:()=>{}})},[t,n,r,i,o,a?.projectRoot,s,c])}function kt(e){let{pendingProjectRoot:t,pendingProjectRootSessionKey:n,selectedSession:r,selectedSessionKey:i}=e;(0,X.useEffect)(()=>{!r||!Tt({pendingProjectRoot:t,pendingProjectRootSessionKey:n,sessionKey:r.key,selectedSessionProjectRoot:r.projectRoot??null})||k.getState().setSnapshot({pendingProjectRoot:null,pendingProjectRootSessionKey:null})},[t,n,r,i])}function At(e){let{confirm:t,location:n,navigate:r,presenter:i}=e;(0,X.useEffect)(()=>{i.chatUiManager.syncState({pathname:n.pathname}),i.chatUiManager.bindActions({navigate:r,confirm:t})},[t,n.pathname,r,i])}function jt(e){let{presenter:t,selectedAgentId:n,selectedSession:r}=e;(0,X.useEffect)(()=>{!r?.agentId||n===r.agentId||t.chatSessionListManager.setSelectedAgentId(r.agentId)},[t,n,r?.agentId])}function Mt({view:e}){let[t]=(0,X.useState)(()=>new ge),n=Dt(t);return Ot(n),kt(n),At(n),jt(n),ft({view:e,routeSessionKey:n.routeSessionKey,selectedSessionKey:n.selectedSessionKey,setSelectedSessionKey:t.chatSessionListManager.setSelectedSessionKey,selectedSessionKeyRef:n.selectedSessionKeyRef,resetStreamState:t.chatStreamActionsManager.resetStreamState}),St({presenter:t,isProviderStateResolved:n.isProviderStateResolved,defaultSessionType:n.defaultSessionType,canStopCurrentRun:n.canStopCurrentRun,stopDisabledReason:n.stopDisabledReason,lastSendError:n.lastSendError,isSending:n.isSending,modelOptions:n.modelOptions,sessionTypeOptions:n.sessionTypeOptions,selectedSessionType:n.selectedSessionType,canEditSessionType:n.canEditSessionType,sessionTypeUnavailable:n.sessionTypeUnavailable,skillRecords:n.skillRecords,isSkillsLoading:n.sessionSkillsQuery.isLoading,sessionTypeUnavailableMessage:n.sessionTypeUnavailableMessage,currentSessionTypeLabel:n.currentSessionTypeLabel,currentSessionTypeIcon:n.currentSessionTypeIcon,sessionKey:n.sessionKey,currentAgentId:n.currentAgentId,currentAgent:n.currentAgent,availableAgents:n.availableAgents,currentSessionDisplayName:n.currentSessionDisplayName,effectiveSessionProjectRoot:n.effectiveSessionProjectRoot,effectiveSessionProjectName:n.effectiveSessionProjectName,selectedSession:n.selectedSession,threadRef:n.threadRef,agent:n.agent,isAwaitingAssistantOutput:n.isAwaitingAssistantOutput,parentSession:n.parentSession,childSessionTabs:n.currentChildSessionTabs}),(0,Z.jsx)(oe,{presenter:t,children:(0,Z.jsx)(pt,{view:e,confirmDialog:(0,Z.jsx)(n.ConfirmDialog,{})})})}function Nt({view:e}){return(0,Z.jsx)(Mt,{view:e})}export{Nt as ChatPage};
|
|
1
|
+
import{_ as e,i as t,m as n,n as r,p as i,u as a}from"./i18n-DnTGDIRw.js";import{Ct as o,Mt as s,Ot as c,_t as l,jt as u,kt as d,wt as f}from"./api-BGd3rgv_.js";import{c as p,l as m,s as h}from"./chunk-JZWAC4HX-Kydj4yEz.js";import{a as g,i as _,n as v,o as y,r as b,t as x}from"./dialog-dxsKz7jJ.js";import{t as S}from"./createLucideIcon-BLMK3QUd.js";import{_ as C,m as w,v as T}from"./theme-provider-COAwWFv8.js";import{A as E,B as D,C as ee,D as O,E as te,F as ne,L as re,M as k,N as ie,O as ae,P as oe,S as se,T as ce,_ as le,a as ue,b as de,c as fe,d as pe,f as me,g as A,h as he,i as ge,j as _e,k as j,l as ve,m as M,n as ye,o as N,p as be,r as xe,s as Se,t as P,u as F,v as I,w as Ce,x as we,y as Te,z as L}from"./chat-DGM6K3Qs.js";import{a as R,i as z,n as B,r as V,t as H}from"./select-DTdzR8j8.js";import{i as Ee,n as U,r as De,t as W}from"./provider-scoped-model-input-D7ACiMAO.js";import{t as Oe}from"./refresh-cw-PcqoYB3K.js";import"./mcp-marketplace-page-CswPXSjf.js";import{t as ke}from"./play-Dv6Nr1Ew.js";import{t as G}from"./plus-D8eKFY7h.js";import{t as K}from"./sparkles-DVfeSVJQ.js";import{t as q}from"./trash-2-CBsHCfqq.js";import{t as J}from"./notice-card-D1RNsTn_.js";import{t as Ae}from"./use-viewport-layout-C0NJAVXs.js";import{g as je,m as Me,n as Y,o as Ne,p as Pe,r as Fe,s as Ie,y as Le}from"./use-config-DTwhNDQE.js";import{t as Re}from"./index-BrEdR78s.js";import{t as ze}from"./tag-chip-BywQeHJj.js";import{t as Be}from"./use-confirm-dialog-oeSqhmrx.js";import{t as Ve}from"./marketplace-page-CPHxlYL8.js";var He=S(`Power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Ue=S(`ShieldCheck`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),X=e(n(),1),Z=i(),Q=X.forwardRef(({className:e,...t},n)=>(0,Z.jsx)(`textarea`,{className:a(`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`,e),ref:n,...t}));Q.displayName=`Textarea`;var We={id:``,displayName:``,description:``,avatar:``,model:``,home:``,runtime:``};function Ge(e){return{displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,model:e.model??``,runtime:e.runtime??e.engine??``}}function Ke(e){let{runtimeOptions:t,currentRuntime:n}=e,r=n.trim();if(!r)return t;let i=M(r);return t.some(e=>e.value===i)?t:[...t,{value:i,label:A(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 qe({value:e,disabled:n=!1,runtimeOptions:r,defaultRuntime:i,onChange:a}){let o=e.trim()?M(e):``,s=Ke({runtimeOptions:r,currentRuntime:e}),c=s.find(e=>e.value===o)??null,l=c?.reasonMessage?.trim()||(c?.ready===!1?t(`agentsRuntimeUnavailableHelp`):``);return(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsxs)(H,{value:o||i,onValueChange:e=>a(e===i?``:e),disabled:n,children:[(0,Z.jsx)(z,{"aria-label":t(`agentsCardRuntimeLabel`),className:`rounded-xl`,children:(0,Z.jsx)(R,{placeholder:t(`agentsRuntimeSelectPlaceholder`)})}),(0,Z.jsx)(B,{className:`rounded-xl`,children:s.map(e=>(0,Z.jsx)(V,{value:e.value,disabled:e.ready===!1&&e.value!==o,className:`rounded-lg`,children:e.label},e.value))})]}),l?(0,Z.jsx)(`p`,{className:`text-xs text-gray-500`,children:l}):null]})}function Je({open:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,Z.jsx)(x,{open:e,onOpenChange:a,children:e||t?(0,Z.jsx)(Xe,{pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e?`create-open`:`create-closed`):null})}function Ye({agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,Z.jsx)(x,{open:e!==null,onOpenChange:a,children:e?(0,Z.jsx)(Ze,{agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e.id):null})}function Xe(e){let{pending:n,providerCatalog:r,runtimeOptions:i,defaultRuntime:a,onOpenChange:o,onSubmit:c}=e,[l,d]=(0,X.useState)(We);return(0,Z.jsxs)(v,{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,Z.jsx)(`div`,{className:`shrink-0 border-b border-[#f0e2c8] px-6 py-6`,children:(0,Z.jsxs)(g,{className:`text-left`,children:[(0,Z.jsx)(y,{children:t(`agentsCreateDialogTitle`)}),(0,Z.jsx)(b,{children:t(`agentsCreateDialogDescription`)})]})}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Z.jsx)(u,{value:l.id,onChange:e=>d(t=>({...t,id:e.target.value})),placeholder:t(`agentsFormIdPlaceholder`)}),(0,Z.jsx)(u,{value:l.displayName,onChange:e=>d(t=>({...t,displayName:e.target.value})),placeholder:t(`agentsFormNamePlaceholder`)}),(0,Z.jsx)(Q,{value:l.description,onChange:e=>d(t=>({...t,description:e.target.value})),placeholder:t(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,Z.jsx)(u,{value:l.avatar,onChange:e=>d(t=>({...t,avatar:e.target.value})),placeholder:t(`agentsFormAvatarPlaceholder`)}),(0,Z.jsx)(u,{value:l.home,onChange:e=>d(t=>({...t,home:e.target.value})),placeholder:t(`agentsFormHomePlaceholder`)}),(0,Z.jsx)(W,{value:l.model,onChange:e=>d(t=>({...t,model:e})),providerCatalog:r,disabled:n,className:`md:col-span-2`}),(0,Z.jsx)(qe,{value:l.runtime,onChange:e=>d(t=>({...t,runtime:e})),runtimeOptions:i,defaultRuntime:a,disabled:n})]}),(0,Z.jsx)(J,{tone:`warning`,title:t(`agentsCreateDialogHint`),className:`text-xs leading-6`})]})}),(0,Z.jsxs)(_,{className:`shrink-0 border-t border-[#f1e7d4] px-6 py-5`,children:[(0,Z.jsx)(s,{type:`button`,variant:`ghost`,onClick:()=>o(!1),disabled:n,children:t(`cancel`)}),(0,Z.jsxs)(s,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>void c(l),disabled:n||l.id.trim().length===0,children:[(0,Z.jsx)(G,{className:`mr-2 h-4 w-4`}),t(`agentsCreateAction`)]})]})]})}function Ze(e){let{agent:n,pending:r,providerCatalog:i,runtimeOptions:a,defaultRuntime:o,onOpenChange:c,onSubmit:l}=e,[d,f]=(0,X.useState)(Ge(n));return(0,Z.jsxs)(v,{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,Z.jsx)(`div`,{className:`shrink-0 border-b border-[#f0e2c8] px-6 py-6`,children:(0,Z.jsxs)(g,{className:`text-left`,children:[(0,Z.jsx)(y,{children:t(`agentsEditDialogTitle`)}),(0,Z.jsx)(b,{children:t(`agentsEditDialogDescription`)})]})}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(J,{tone:`warning`,title:t(`agentsEditHomeReadonly`),description:t(`agentsEditHomeReadonlyHint`),children:(0,Z.jsx)(`div`,{className:`break-all text-sm text-amber-950`,children:n.workspace??`-`})}),(0,Z.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,Z.jsx)(u,{value:d.displayName,onChange:e=>f(t=>({...t,displayName:e.target.value})),placeholder:t(`agentsFormNamePlaceholder`)}),(0,Z.jsx)(Q,{value:d.description,onChange:e=>f(t=>({...t,description:e.target.value})),placeholder:t(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,Z.jsx)(u,{value:d.avatar,onChange:e=>f(t=>({...t,avatar:e.target.value})),placeholder:t(`agentsFormAvatarPlaceholder`)}),(0,Z.jsx)(W,{value:d.model,onChange:e=>f(t=>({...t,model:e})),providerCatalog:i,disabled:r,className:`md:col-span-2`}),(0,Z.jsx)(qe,{value:d.runtime,onChange:e=>f(t=>({...t,runtime:e})),runtimeOptions:a,defaultRuntime:o,disabled:r})]})]})}),(0,Z.jsxs)(_,{className:`shrink-0 border-t border-[#f1e7d4] px-6 py-5`,children:[(0,Z.jsx)(s,{type:`button`,variant:`ghost`,onClick:()=>c(!1),disabled:r,children:t(`cancel`)}),(0,Z.jsxs)(s,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>l(n.id,d),disabled:r,children:[(0,Z.jsx)(L,{className:`mr-2 h-4 w-4`}),t(`agentsEditSaveAction`)]})]})]})}var Qe=[{strip:`bg-[#efc37a]`,chip:`border-[#f2d7a7] bg-[#fff8eb] text-[#8d5a18]`},{strip:`bg-[#8fd4c0]`,chip:`border-[#bde6da] bg-[#effbf7] text-[#156653]`},{strip:`bg-[#b7c9fb]`,chip:`border-[#d7e2ff] bg-[#f4f7ff] text-[#2d4d8f]`}];function $e(e,t){return t?{strip:`bg-[#e6b765]`,chip:`border-[#f2d19c] bg-[#fff8ec] text-[#90550d]`}:Qe[e%Qe.length]}function et(e){let{agentCount:n,onCreate:r}=e;return(0,Z.jsxs)(`section`,{className:`relative overflow-hidden rounded-[28px] border border-[#f0d6aa] bg-[linear-gradient(135deg,#fff7ea_0%,#fff9f1_32%,#f2fbff_100%)] px-5 py-5 sm:px-6`,children:[(0,Z.jsx)(`div`,{className:`absolute inset-y-0 right-0 w-[46%] bg-[radial-gradient(circle_at_top_right,rgba(255,215,163,0.52),transparent_54%)]`}),(0,Z.jsx)(`div`,{className:`absolute -bottom-10 left-8 h-32 w-32 rounded-full bg-[#ffe6c0]/55 blur-3xl`}),(0,Z.jsxs)(`div`,{className:`relative grid gap-5 xl:grid-cols-[minmax(0,1fr)_320px] xl:items-center`,children:[(0,Z.jsxs)(`div`,{className:`max-w-3xl space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-white/70 bg-white/80 px-3 py-1 text-[11px] font-semibold tracking-[0.16em] text-[#9b6118]`,children:[(0,Z.jsx)(K,{className:`h-3.5 w-3.5`}),t(`agentsHeroEyebrow`)]}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`h1`,{className:`max-w-2xl text-[30px] font-semibold leading-tight tracking-[-0.05em] text-[#2f2212] sm:text-[38px]`,children:t(`agentsHeroTitle`)}),(0,Z.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-[#6d5841] sm:text-[15px] sm:leading-7`,children:t(`agentsHeroDescription`)})]}),(0,Z.jsx)(`div`,{className:`pt-1`,children:(0,Z.jsxs)(`div`,{className:`inline-flex items-center gap-3 rounded-2xl border border-[#f2d5a4] bg-white/82 px-3 py-2 text-[#7a4d12] shadow-[0_14px_30px_rgba(167,117,47,0.07)]`,children:[(0,Z.jsx)(`span`,{className:`text-[11px] font-semibold tracking-[0.14em]`,children:t(`agentsOverviewTotal`)}),(0,Z.jsx)(`span`,{className:`text-xl font-semibold tracking-[-0.04em] text-[#1f2937]`,children:n})]})})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-3`,children:[(0,Z.jsxs)(s,{type:`button`,variant:`primary`,className:`h-10 rounded-2xl px-5 text-sm font-semibold`,onClick:r,children:[(0,Z.jsx)(G,{className:`mr-2 h-4 w-4`}),t(`agentsCreateButton`)]}),(0,Z.jsx)(J,{title:t(`agentsCreateDialogHint`),className:`border-white/70 bg-white/72 text-xs leading-6 shadow-[0_18px_40px_rgba(167,117,47,0.08)]`})]})]})]})}function tt(e){let{agent:n,index:r,runtimeOptions:i,defaultRuntimeLabel:c,updatePending:l,deletePending:u,onStartChat:d,onEdit:p,onDelete:m}=e,h=$e(r,!!n.builtIn),g=n.runtime?.trim()||n.engine?.trim()||``,_=g?i.find(e=>e.value===M(g))?.label??A(g):c;return(0,Z.jsxs)(o,{className:`overflow-hidden border border-gray-200 bg-white shadow-sm transition-shadow duration-200 hover:shadow-md`,children:[(0,Z.jsx)(`div`,{className:a(`h-1.5 w-full`,h.strip)}),(0,Z.jsxs)(f,{className:`flex h-full flex-col gap-4 px-4 py-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Z.jsx)(re,{agentId:n.id,displayName:n.displayName,avatarUrl:n.avatarUrl,className:`h-11 w-11 shrink-0`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1 pt-0.5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`div`,{className:`truncate text-lg font-semibold tracking-[-0.03em] text-[#1f2937]`,children:n.displayName?.trim()||n.id}),n.builtIn?(0,Z.jsxs)(ze,{tone:`warning`,className:a(`gap-1`,h.chip),children:[(0,Z.jsx)(Ue,{className:`h-3 w-3`}),t(`agentsCardBuiltInTag`)]}):null]}),(0,Z.jsxs)(`div`,{className:`text-[11px] font-medium uppercase tracking-[0.18em] text-[#94a3b8]`,children:[`@`,n.id]})]})]}),(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-[#64748b]`,children:n.description?.trim()||(n.builtIn?t(`agentsCardBuiltInSummary`):t(`agentsCardCustomSummary`))}),(0,Z.jsxs)(`div`,{className:`mt-auto flex flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.18em] text-[#94a3b8]`,children:[(0,Z.jsx)(K,{className:`h-3.5 w-3.5`}),t(`agentsCardRuntimeLabel`)]}),(0,Z.jsx)(`div`,{className:`mt-1.5 text-sm leading-6 text-[#475569]`,children:_})]}),(0,Z.jsxs)(`div`,{className:`border-t border-gray-100 pt-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.18em] text-[#94a3b8]`,children:[(0,Z.jsx)(D,{className:`h-3.5 w-3.5`}),t(`agentsCardHomeLabel`)]}),(0,Z.jsx)(`div`,{className:`mt-1.5 break-all text-sm leading-6 text-[#475569]`,children:n.workspace??`-`})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(s,{type:`button`,variant:`primary`,className:`h-9 rounded-xl px-4`,onClick:d,children:[(0,Z.jsx)(w,{className:`mr-2 h-4 w-4`}),t(`agentsCardStartChat`)]}),(0,Z.jsxs)(s,{type:`button`,variant:`ghost`,className:`h-8 rounded-xl px-3 text-xs text-[#7b8794] hover:bg-[#f3f4f6] hover:text-[#475569]`,onClick:p,disabled:l,children:[(0,Z.jsx)(L,{className:`mr-1.5 h-3.5 w-3.5`}),t(`agentsEditAction`)]}),n.builtIn?null:(0,Z.jsxs)(s,{type:`button`,variant:`ghost`,className:`h-8 rounded-xl px-3 text-xs text-[#7b8794] hover:bg-[#f3f4f6] hover:text-[#475569]`,onClick:m,disabled:u,children:[(0,Z.jsx)(q,{className:`mr-1.5 h-3.5 w-3.5`}),t(`agentsRemoveAction`)]})]})]})]})]})}function nt(){let e=ne(),n=I(),r=Y(),i=Fe(),a=N(),c=Te(),l=we(),u=de(),[p,m]=(0,X.useState)(!1),[h,g]=(0,X.useState)(null),_=(0,X.useMemo)(()=>n.data?.agents??[],[n.data?.agents]),v=(0,X.useMemo)(()=>[..._].sort((e,t)=>Number(!!t.builtIn)-Number(!!e.builtIn)||e.id.localeCompare(t.id)),[_]),y=(0,X.useMemo)(()=>U({config:r.data,meta:i.data,onlyConfigured:!0}),[i.data,r.data]),b=(0,X.useMemo)(()=>be(a.data?.options??[]),[a.data?.options]),x=(0,X.useMemo)(()=>M(a.data?.defaultType??`native`),[a.data?.defaultType]),S=(0,X.useMemo)(()=>b.find(e=>e.value===x)?.label??A(x),[x,b]),w=async e=>{await c.mutateAsync({data:{id:e.id,...e.displayName.trim()?{displayName:e.displayName.trim()}:{},...e.description.trim()?{description:e.description.trim()}:{},...e.avatar.trim()?{avatar:e.avatar.trim()}:{},...e.home.trim()?{home:e.home.trim()}:{},...e.model.trim()?{model:e.model.trim()}:{},...e.runtime.trim()?{runtime:e.runtime.trim()}:{}}}),m(!1)},T=e=>{g(e)},E=async(e,t)=>{await l.mutateAsync({agentId:e,data:{displayName:t.displayName,description:t.description,avatar:t.avatar,model:t.model,...t.runtime.trim()?{runtime:t.runtime.trim()}:{runtime:``}}}),g(null)},D=t=>{e.chatSessionListManager.startAgentDraftChat(t.id,he(t,x))};return(0,Z.jsxs)(d,{className:`space-y-5`,children:[(0,Z.jsx)(et,{agentCount:_.length,onCreate:()=>m(!0)}),(0,Z.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:n.isLoading?(0,Z.jsx)(o,{className:`md:col-span-2 xl:col-span-3 border-dashed border-[#d9dce3] bg-white/70`,children:(0,Z.jsx)(f,{className:`py-14 text-center text-sm text-gray-500`,children:t(`agentsLoading`)})}):v.length===0?(0,Z.jsx)(o,{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,Z.jsxs)(f,{className:`flex min-h-[240px] flex-col items-center justify-center px-6 py-14 text-center`,children:[(0,Z.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,Z.jsx)(C,{className:`h-8 w-8 text-[#d39a3b]`})}),(0,Z.jsx)(`div`,{className:`text-lg font-semibold text-[#2f2212]`,children:t(`agentsEmpty`)}),(0,Z.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-[#78644d]`,children:t(`agentsEmptyDescription`)}),(0,Z.jsxs)(s,{type:`button`,variant:`primary`,className:`mt-5 rounded-2xl px-5`,onClick:()=>m(!0),children:[(0,Z.jsx)(G,{className:`mr-2 h-4 w-4`}),t(`agentsCreateButton`)]})]})}):v.map((e,t)=>(0,Z.jsx)(tt,{agent:e,index:t,runtimeOptions:b,defaultRuntimeLabel:S,updatePending:l.isPending,deletePending:u.isPending,onStartChat:()=>D(e),onEdit:()=>T(e),onDelete:()=>u.mutate({agentId:e.id})},e.id))}),(0,Z.jsx)(Je,{open:p,pending:c.isPending,providerCatalog:y,runtimeOptions:b,defaultRuntime:x,onOpenChange:m,onSubmit:w}),(0,Z.jsx)(Ye,{agent:h,pending:l.isPending,providerCatalog:y,runtimeOptions:b,defaultRuntime:x,onOpenChange:e=>{!e&&!l.isPending&&g(null)},onSubmit:E})]})}function $(e){return r(e??void 0)}function rt(e){return typeof e!=`number`||!Number.isFinite(e)?`-`:r(new Date(e))}function it(e){if(typeof e!=`number`||!Number.isFinite(e))return`-`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.round(t/60);if(n<60)return`${n}m`;let r=Math.round(n/60);return r<24?`${r}h`:`${Math.round(r/24)}d`}function at(e){let{schedule:t}=e;return t.kind===`cron`?t.expr?`cron ${t.expr}`:`cron`:t.kind===`every`?`every ${it(t.everyMs)}`:t.kind===`at`?`at ${rt(t.atMs)}`:`-`}function ot(e){return e.payload.deliver?`${e.payload.channel??`-`}:${e.payload.to??`-`}`:`-`}function st(e){return e.payload.sessionId?.trim()||`cron:${e.id}`}function ct(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 lt(e,t){return t===`all`?!0:t===`enabled`?e.enabled:!e.enabled}function ut(e){let{job:n,onDelete:r,onRun:i,onToggle:c}=e;return(0,Z.jsx)(o,{className:`border border-gray-200`,children:(0,Z.jsx)(f,{className:`pt-5 pb-5`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{className:`min-w-[220px] flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-semibold text-gray-900`,children:n.name||n.id}),(0,Z.jsx)(`span`,{className:`rounded-full bg-gray-100 px-2 py-0.5 text-[10px] font-semibold text-gray-500`,children:n.id}),(0,Z.jsx)(`span`,{className:a(`rounded-full px-2 py-0.5 text-[10px] font-semibold`,n.enabled?`bg-emerald-50 text-emerald-700`:`bg-gray-100 text-gray-500`),children:n.enabled?t(`enabled`):t(`disabled`)}),n.deleteAfterRun?(0,Z.jsx)(`span`,{className:`rounded-full bg-amber-50 px-2 py-0.5 text-[10px] font-semibold text-amber-700`,children:t(`cronOneShot`)}):null]}),(0,Z.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[t(`cronScheduleLabel`),`: `,at(n)]}),(0,Z.jsx)(`div`,{className:`mt-2 whitespace-pre-wrap break-words text-sm text-gray-700`,children:n.payload.message}),(0,Z.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[t(`cronSessionLabel`),`: `,st(n)]}),(0,Z.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[t(`cronDeliverTo`),`: `,ot(n)]})]}),(0,Z.jsxs)(`div`,{className:`min-w-[220px] space-y-2 text-xs text-gray-500`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[t(`cronNextRun`),`:`]}),` `,$(n.state.nextRunAt)]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[t(`cronLastRun`),`:`]}),` `,$(n.state.lastRunAt)]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[t(`cronLastStatus`),`:`]}),` `,n.state.lastStatus??`-`]}),n.state.lastError?(0,Z.jsx)(`div`,{className:`break-words text-[11px] text-red-500`,children:n.state.lastError}):null]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-end gap-2`,children:[(0,Z.jsxs)(s,{variant:`subtle`,size:`sm`,onClick:()=>i(n),className:`gap-1`,children:[(0,Z.jsx)(ke,{className:`h-3.5 w-3.5`}),t(`cronRunNow`)]}),(0,Z.jsxs)(s,{variant:n.enabled?`outline`:`primary`,size:`sm`,onClick:()=>c(n),className:`gap-1`,children:[(0,Z.jsx)(He,{className:`h-3.5 w-3.5`}),n.enabled?t(`cronDisable`):t(`cronEnable`)]}),(0,Z.jsxs)(s,{variant:`destructive`,size:`sm`,onClick:()=>r(n),className:`gap-1`,children:[(0,Z.jsx)(q,{className:`h-3.5 w-3.5`}),t(`delete`)]})]})]})})})}function dt(){let[e,n]=(0,X.useState)(``),[r,i]=(0,X.useState)(`all`),o=Ne({all:!0}),l=Ie(),f=Le(),p=je(),{confirm:m,ConfirmDialog:h}=Be(),g=(0,X.useMemo)(()=>(o.data?.jobs??[]).filter(t=>ct(t,e)).filter(e=>lt(e,r)),[o.data,e,r]),_=async e=>{await m({title:`${t(`cronDeleteConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,variant:`destructive`,confirmLabel:t(`delete`)})&&l.mutate({id:e.id})},v=async e=>{let n=!e.enabled;await m({title:n?`${t(`cronEnableConfirm`)}?`:`${t(`cronDisableConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,variant:n?`default`:`destructive`,confirmLabel:t(n?`cronEnable`:`cronDisable`)})&&f.mutate({id:e.id,enabled:n})},y=async e=>{let n=!e.enabled;await m({title:n?`${t(`cronRunForceConfirm`)}?`:`${t(`cronRunConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,confirmLabel:t(`cronRunNow`)})&&p.mutate({id:e.id,force:n})};return(0,Z.jsxs)(d,{fullHeight:!0,children:[(0,Z.jsx)(c,{title:t(`cronPageTitle`),description:t(`cronPageDescription`),actions:(0,Z.jsx)(s,{variant:`ghost`,size:`icon`,className:`h-9 w-9 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100`,onClick:()=>o.refetch(),children:(0,Z.jsx)(Oe,{className:a(`h-4 w-4`,o.isFetching&&`animate-spin`)})})}),(0,Z.jsx)(`div`,{className:`mb-6`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center`,children:[(0,Z.jsxs)(`div`,{className:`relative flex-1 min-w-[240px]`,children:[(0,Z.jsx)(u,{value:e,onChange:e=>n(e.target.value),placeholder:t(`cronSearchPlaceholder`),className:`pl-9`}),(0,Z.jsx)(T,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`})]}),(0,Z.jsx)(`div`,{className:`min-w-[180px]`,children:(0,Z.jsxs)(H,{value:r,onValueChange:e=>i(e),children:[(0,Z.jsx)(z,{className:`w-full`,children:(0,Z.jsx)(R,{placeholder:t(`cronStatusLabel`)})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(V,{value:`all`,children:t(`cronStatusAll`)}),(0,Z.jsx)(V,{value:`enabled`,children:t(`cronStatusEnabled`)}),(0,Z.jsx)(V,{value:`disabled`,children:t(`cronStatusDisabled`)})]})]})}),(0,Z.jsxs)(`div`,{className:`text-xs text-gray-500 ml-auto`,children:[t(`cronTotalLabel`),`: `,o.data?.total??0,` / `,g.length]})]})}),(0,Z.jsx)(`div`,{className:`flex-1 overflow-auto custom-scrollbar`,children:o.isLoading?(0,Z.jsx)(`div`,{className:`text-sm text-gray-400 p-4 text-center`,children:t(`cronLoading`)}):g.length===0?(0,Z.jsx)(`div`,{className:`text-sm text-gray-400 p-4 text-center`,children:t(`cronEmpty`)}):(0,Z.jsx)(`div`,{className:`space-y-4`,children:g.map(e=>(0,Z.jsx)(ut,{job:e,onDelete:_,onRun:y,onToggle:v},e.id))})}),(0,Z.jsx)(h,{})]})}function ft(e){let{view:t,routeSessionKey:n,selectedSessionKey:r,setSelectedSessionKey:i,selectedSessionKeyRef:a,resetStreamState:o}=e;(0,X.useEffect)(()=>{if(t===`chat`){if(n){r!==n&&i(n);return}r!==null&&(i(null),o())}},[o,n,r,i,t]),(0,X.useEffect)(()=>{a.current=r},[r,a])}function pt({view:e,confirmDialog:t}){let{isMobile:n}=Ae();return(0,Z.jsxs)(`div`,{className:`h-full flex`,children:[n?null:(0,Z.jsx)(ve,{}),e===`chat`?n?(0,Z.jsx)(Re,{}):(0,Z.jsx)(me,{}):(0,Z.jsx)(`section`,{className:`flex-1 min-h-0 overflow-hidden bg-gradient-to-b from-gray-50/60 to-white`,children:e===`cron`?(0,Z.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,Z.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1120px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,Z.jsx)(dt,{})})}):e===`agents`?(0,Z.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,Z.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1180px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,Z.jsx)(nt,{})})}):(0,Z.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,Z.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full max-w-[min(1120px,100%)] flex-col px-4 py-4 sm:px-6 sm:py-5`,children:(0,Z.jsx)(Ve,{forcedType:`skills`})})})}),t]})}function mt(e,t){return e.filter(e=>pe(e,t))}function ht(e){let{config:t,meta:n}=e;return(0,X.useMemo)(()=>{let e=U({meta:n,config:t,onlyConfigured:!0}),r=new Set,i=[];for(let t of e)for(let e of t.models){let n=De(t.prefix,e);!n||r.has(n)||(r.add(n),i.push({value:n,modelLabel:e,providerLabel:t.displayName,thinkingCapability:Ee(t.modelThinking,e,t.aliases)}))}return i.sort((e,t)=>{let n=e.providerLabel.localeCompare(t.providerLabel);return n===0?e.modelLabel.localeCompare(t.modelLabel):n})},[t,n])}function gt(e){let{sessions:t,sessionKey:n,sessionType:r}=e;return{recentSessionPreferredModel:(0,X.useMemo)(()=>P({sessions:t,selectedSessionKey:n,sessionType:r,readPreference:e=>e.preferredModel?.trim()||void 0}),[n,r,t]),recentSessionPreferredThinking:(0,X.useMemo)(()=>P({sessions:t,selectedSessionKey:n,sessionType:r,readPreference:e=>e.preferredThinking??void 0}),[n,r,t])}}function _t(e){let{currentSelectedModel:t,modelOptions:n}=e,r=(0,X.useMemo)(()=>n.find(e=>e.value===t),[t,n]);return{supportedThinkingLevels:(0,X.useMemo)(()=>r?.thinkingCapability?.supported??[],[r?.thinkingCapability?.supported]),defaultThinkingLevel:(0,X.useMemo)(()=>r?.thinkingCapability?.default??null,[r?.thinkingCapability?.default])}}function vt(e){let{modelOptions:t,supportedModels:n}=e;if(!n||n.length===0)return t;let r=new Set(n),i=t.filter(e=>r.has(e.value));return i.length>0?i:t}function yt(e){let{currentSelectedModel:t,pendingSessionType:n,projectRootOverride:r,query:i,sessionKey:a,setPendingSessionType:o,setSelectedModel:s,setSelectedThinkingLevel:c}=e,l=Y(),u=Fe(),d=Me({limit:200}),f=N(),p=Pe({sessionId:a,...Object.prototype.hasOwnProperty.call(e,`projectRootOverride`)?{projectRoot:r??null}:{}}),m=(l.isFetched||l.isSuccess)&&(u.isFetched||u.isSuccess),h=ht({config:l.data,meta:u.data}),g=(0,X.useMemo)(()=>d.data?.sessions??[],[d.data?.sessions]),_=(0,X.useMemo)(()=>ae(g),[g]),v=(0,X.useMemo)(()=>mt(_,i),[_,i]),y=(0,X.useMemo)(()=>_.find(e=>e.key===a)??null,[_,a]),b=(0,X.useMemo)(()=>p.data?.records??[],[p.data?.records]),x=le({selectedSession:y,pendingSessionType:n,setPendingSessionType:o,sessionTypesData:f.data}),S=(0,X.useMemo)(()=>vt({modelOptions:h,supportedModels:x.selectedSessionTypeOption?.supportedModels}),[h,x.selectedSessionTypeOption?.supportedModels]),{recentSessionPreferredModel:C,recentSessionPreferredThinking:w}=gt({sessions:_,sessionKey:a,sessionType:x.selectedSessionType}),{supportedThinkingLevels:T,defaultThinkingLevel:E}=_t({currentSelectedModel:t,modelOptions:S});return ye({modelOptions:S,selectedSessionKey:a,selectedSessionExists:!!y,selectedSessionPreferredModel:y?.preferredModel,fallbackPreferredModel:x.selectedSessionTypeOption?.recommendedModel??C,defaultModel:x.selectedSessionTypeOption?.recommendedModel??l.data?.agents.defaults.model,setSelectedModel:s}),xe({supportedThinkingLevels:T,selectedSessionKey:a,selectedSessionExists:!!y,selectedSessionPreferredThinking:y?.preferredThinking??null,fallbackPreferredThinking:w??null,defaultThinkingLevel:E,setSelectedThinkingLevel:c}),{configQuery:l,configMetaQuery:u,sessionsQuery:d,sessionTypesQuery:f,sessionSkillsQuery:p,isProviderStateResolved:m,modelOptions:S,sessionSummaries:g,sessions:v,skillRecords:b,selectedSession:y,...x}}function bt(e){return e.parentSessionKey?e.sessionSummaries.map(j).filter(t=>t.parentSessionId===e.parentSessionKey).sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)).map(e=>({sessionKey:e.key,parentSessionKey:e.parentSessionId??null,label:e.label??null,agentId:e.agentId??null})):[]}function xt(e){let{availableAgents:t,parentSessionId:n,selectedAgentId:r,selectedSession:i,selectedSessionType:a,sessionKey:o,sessionSummaries:s,sessionTypeOptions:c}=e,l=i?F(i):void 0,u=i?.agentId??r,d=t.find(e=>e.id===u)??null,f=(0,X.useMemo)(()=>{if(!n)return null;let e=s.find(e=>e.sessionId===n)??null;return e?j(e):null},[n,s]),p=c.find(e=>e.value===a)??null;return{currentSessionDisplayName:l,currentAgentId:u,currentAgent:d,parentSession:f,currentSessionTypeLabel:p?.label??A(a),currentSessionTypeIcon:p?.icon??null,currentChildSessionTabs:(0,X.useMemo)(()=>bt({parentSessionKey:o,sessionSummaries:s}),[o,s])}}function St(e){(0,X.useEffect)(()=>{e.presenter.chatInputManager.syncSnapshot({isProviderStateResolved:e.isProviderStateResolved,defaultSessionType:e.defaultSessionType,canStopGeneration:e.canStopCurrentRun,stopDisabledReason:e.stopDisabledReason,stopSupported:!0,stopReason:void 0,sendError:e.lastSendError,isSending:e.isSending,modelOptions:e.modelOptions,sessionTypeOptions:e.sessionTypeOptions,selectedSessionType:e.selectedSessionType,canEditSessionType:e.canEditSessionType,sessionTypeUnavailable:e.sessionTypeUnavailable,skillRecords:e.skillRecords,isSkillsLoading:e.isSkillsLoading}),e.presenter.chatThreadManager.syncSnapshot({isProviderStateResolved:e.isProviderStateResolved,modelOptions:e.modelOptions,sessionTypeUnavailable:e.sessionTypeUnavailable,sessionTypeUnavailableMessage:e.sessionTypeUnavailableMessage,sessionTypeLabel:e.currentSessionTypeLabel,sessionTypeIcon:e.currentSessionTypeIcon,sessionKey:e.sessionKey,agentId:e.currentAgentId,agentDisplayName:e.currentAgent?.displayName??null,agentAvatarUrl:e.currentAgent?.avatarUrl??null,availableAgents:e.availableAgents,sessionDisplayName:e.currentSessionDisplayName,sessionProjectRoot:e.effectiveSessionProjectRoot,sessionProjectName:e.effectiveSessionProjectName,canDeleteSession:!!e.selectedSession,threadRef:e.threadRef,isHistoryLoading:e.agent.isHydrating,messages:e.agent.visibleMessages,isSending:e.isSending,isAwaitingAssistantOutput:e.isAwaitingAssistantOutput,contextWindow:se(e.agent.snapshot.contextWindow),parentSessionKey:e.parentSession?.key??null,parentSessionLabel:e.parentSession?F(e.parentSession):null,childSessionTabs:e.childSessionTabs})},[e])}function Ct(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function wt(e){let t={};e.model?.trim()&&(t.model=e.model.trim(),t.preferred_model=e.model.trim()),e.thinkingLevel?.trim()&&(t.thinking=e.thinkingLevel.trim(),t.preferred_thinking=e.thinkingLevel.trim()),e.sessionType?.trim()&&(t.session_type=e.sessionType.trim(),t.runtime=e.sessionType.trim()),e.agentId?.trim()&&(t.agent_id=e.agentId.trim());let n=_e(e.projectRoot);n&&(t.project_root=n);let r=Ct(e.requestedSkills);r.length>0&&(t.requested_skill_refs=r);let i=e.composerNodes?Ce(e.composerNodes):[];return i.length>0&&(t[ee]=i),t}function Tt(e){let{pendingProjectRoot:t,pendingProjectRootSessionKey:n,sessionKey:r,selectedSessionProjectRoot:i}=e;return t!==null&&n!==null&&r===n&&(i??null)===t}function Et(e){let t=O(e=>e.snapshot.query),n=O(e=>e.snapshot.selectedSessionKey),r=O(e=>e.snapshot.draftSessionKey),i=O(e=>e.snapshot.selectedAgentId),a=k(e=>e.snapshot.pendingSessionType),o=k(e=>e.snapshot.pendingProjectRoot),s=k(e=>e.snapshot.pendingProjectRootSessionKey),c=k(e=>e.snapshot.selectedModel),u=l(),d=ce(u),f=I(),{confirm:g,ConfirmDialog:_}=Be(),v=h(),y=p(),{sessionId:b}=m(),x=(0,X.useRef)(null),S=(0,X.useRef)(n),C=(0,X.useMemo)(()=>ue(b),[b]),w=C??n??r,T=o!==null&&s===w,E=yt({query:t,sessionKey:w,projectRootOverride:T?o:void 0,currentSelectedModel:c,pendingSessionType:a,setPendingSessionType:e.chatInputManager.setPendingSessionType,setSelectedModel:e.chatInputManager.setSelectedModel,setSelectedThinkingLevel:e.chatInputManager.setSelectedThinkingLevel});return{presenter:e,selectedSessionKey:n,selectedAgentId:i,pendingProjectRoot:o,pendingProjectRootSessionKey:s,systemStatus:u,isRuntimeBlocked:d,agentsQuery:f,confirm:g,ConfirmDialog:_,location:v,navigate:y,threadRef:x,selectedSessionKeyRef:S,routeSessionKey:C,sessionKey:w,hasSessionProjectRootOverride:T,agent:fe(w),...E}}function Dt(e){let t=Et(e),{agent:n,agentsQuery:r,hasSessionProjectRootOverride:i,pendingProjectRoot:a,isRuntimeBlocked:o,systemStatus:s,selectedAgentId:c,selectedSession:l,selectedSessionType:u,sessionKey:d,sessionSummaries:f,sessionTypeOptions:p}=t,m=i?a:l?.projectRoot??null,h=i?E(m):l?.projectName??E(m),g=n.hydrateError?.message??n.snapshot.error?.message??null,_=s.phase===`ready`&&Se(g)?null:g,v=(r.data?.agents?.length??0)>0?r.data?.agents??[]:[{id:l?.agentId??c}],y=xt({sessionKey:d,selectedSession:l,selectedAgentId:c,availableAgents:v,parentSessionId:l?.parentSessionId??null,sessionSummaries:f,selectedSessionType:u,sessionTypeOptions:p});return{...t,availableAgents:v,effectiveSessionProjectRoot:m,effectiveSessionProjectName:h,isSending:n.isSending||n.isRunning,isAwaitingAssistantOutput:n.isRunning,canStopCurrentRun:n.isRunning,stopDisabledReason:n.isRunning?null:`__preparing__`,lastSendError:o?null:s.phase===`ready`?_:te({message:_,status:s}),...y}}function Ot(e){let{agent:t,pendingProjectRoot:n,pendingProjectRootSessionKey:r,presenter:i,selectedSession:a,selectedSessionKey:o,selectedSessionKeyRef:s,sessionKey:c}=e;(0,X.useEffect)(()=>{i.chatStreamActionsManager.bind({sendMessage:async e=>{if(e.sessionKey!==c)return;let o=wt({agentId:e.agentId,model:e.model,thinkingLevel:e.thinkingLevel,sessionType:e.sessionType,projectRoot:e.sessionKey===r?n:a?.projectRoot??null,requestedSkills:e.requestedSkills,composerNodes:e.composerNodes}),s=ie({sessionId:e.sessionKey,text:e.message,attachments:e.attachments,parts:e.parts,metadata:o});if(s)try{await t.send(s)}catch(t){throw e.restoreDraftOnError&&(e.composerNodes&&e.composerNodes.length>0?i.chatInputManager.restoreComposerState?.(e.composerNodes,e.attachments??[]):i.chatInputManager.setDraft(t=>t.trim().length===0?e.message:t)),t}},stopCurrentRun:async()=>{await t.abort()},resumeRun:async e=>{e.sessionKey===c&&await t.streamRun()},resetStreamState:()=>{s.current=null},applyHistoryMessages:()=>{}})},[t,n,r,i,o,a?.projectRoot,s,c])}function kt(e){let{pendingProjectRoot:t,pendingProjectRootSessionKey:n,selectedSession:r,selectedSessionKey:i}=e;(0,X.useEffect)(()=>{!r||!Tt({pendingProjectRoot:t,pendingProjectRootSessionKey:n,sessionKey:r.key,selectedSessionProjectRoot:r.projectRoot??null})||k.getState().setSnapshot({pendingProjectRoot:null,pendingProjectRootSessionKey:null})},[t,n,r,i])}function At(e){let{confirm:t,location:n,navigate:r,presenter:i}=e;(0,X.useEffect)(()=>{i.chatUiManager.syncState({pathname:n.pathname}),i.chatUiManager.bindActions({navigate:r,confirm:t})},[t,n.pathname,r,i])}function jt(e){let{presenter:t,selectedAgentId:n,selectedSession:r}=e;(0,X.useEffect)(()=>{!r?.agentId||n===r.agentId||t.chatSessionListManager.setSelectedAgentId(r.agentId)},[t,n,r?.agentId])}function Mt({view:e}){let[t]=(0,X.useState)(()=>new ge),n=Dt(t);return Ot(n),kt(n),At(n),jt(n),ft({view:e,routeSessionKey:n.routeSessionKey,selectedSessionKey:n.selectedSessionKey,setSelectedSessionKey:t.chatSessionListManager.setSelectedSessionKey,selectedSessionKeyRef:n.selectedSessionKeyRef,resetStreamState:t.chatStreamActionsManager.resetStreamState}),St({presenter:t,isProviderStateResolved:n.isProviderStateResolved,defaultSessionType:n.defaultSessionType,canStopCurrentRun:n.canStopCurrentRun,stopDisabledReason:n.stopDisabledReason,lastSendError:n.lastSendError,isSending:n.isSending,modelOptions:n.modelOptions,sessionTypeOptions:n.sessionTypeOptions,selectedSessionType:n.selectedSessionType,canEditSessionType:n.canEditSessionType,sessionTypeUnavailable:n.sessionTypeUnavailable,skillRecords:n.skillRecords,isSkillsLoading:n.sessionSkillsQuery.isLoading,sessionTypeUnavailableMessage:n.sessionTypeUnavailableMessage,currentSessionTypeLabel:n.currentSessionTypeLabel,currentSessionTypeIcon:n.currentSessionTypeIcon,sessionKey:n.sessionKey,currentAgentId:n.currentAgentId,currentAgent:n.currentAgent,availableAgents:n.availableAgents,currentSessionDisplayName:n.currentSessionDisplayName,effectiveSessionProjectRoot:n.effectiveSessionProjectRoot,effectiveSessionProjectName:n.effectiveSessionProjectName,selectedSession:n.selectedSession,threadRef:n.threadRef,agent:n.agent,isAwaitingAssistantOutput:n.isAwaitingAssistantOutput,parentSession:n.parentSession,childSessionTabs:n.currentChildSessionTabs}),(0,Z.jsx)(oe,{presenter:t,children:(0,Z.jsx)(pt,{view:e,confirmDialog:(0,Z.jsx)(n.ConfirmDialog,{})})})}function Nt({view:e}){return(0,Z.jsx)(Mt,{view:e})}export{Nt as ChatPage};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{_ as e,m as t}from"./i18n-C5Mibli1.js";var n=`modulepreload`,r=function(e){return`/`+e},i={},a=function(e,t,a){let o=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),s=document.querySelector(`meta[property=csp-nonce]`),c=s?.nonce||s?.getAttribute(`nonce`);function l(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}o=l(t.map(t=>{if(t=r(t,a),t in i)return;i[t]=!0;let o=t.endsWith(`.css`),s=o?`[rel="stylesheet"]`:``;if(a)for(let n=e.length-1;n>=0;n--){let r=e[n];if(r.href===t&&(!o||r.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${s}`))return;let l=document.createElement(`link`);if(l.rel=o?`stylesheet`:n,o||(l.as=`script`),l.crossOrigin=``,l.href=t,c&&l.setAttribute(`nonce`,c),document.head.appendChild(l),o)return new Promise((e,n)=>{l.addEventListener(`load`,e),l.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function s(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return o.then(t=>{for(let e of t||[])e.status===`rejected`&&s(e.reason);return e().catch(s)})},o=e(t(),1),s=`popstate`;function c(e={}){function t(e,t){let{pathname:n,search:r,hash:i}=e.location;return p(``,{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:m(t)}return g(t,n,null,e)}function l(e,t){if(e===!1||e==null)throw Error(t)}function u(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function d(){return Math.random().toString(36).substring(2,10)}function f(e,t){return{usr:e.state,key:e.key,idx:t}}function p(e,t,n=null,r){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?h(t):t,state:n,key:t&&t.key||r||d()}}function m({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 h(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 g(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,c=`POP`,l=null,u=d();u??(u=0,o.replaceState({...o.state,idx:u},``));function d(){return(o.state||{idx:null}).idx}function m(){c=`POP`;let e=d(),t=e==null?null:e-u;u=e,l&&l({action:c,location:y.location,delta:t})}function h(e,t){c=`PUSH`;let r=p(y.location,e,t);n&&n(r,e),u=d()+1;let s=f(r,u),m=y.createHref(r);try{o.pushState(s,``,m)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(m)}a&&l&&l({action:c,location:y.location,delta:1})}function g(e,t){c=`REPLACE`;let r=p(y.location,e,t);n&&n(r,e),u=d();let i=f(r,u),s=y.createHref(r);o.replaceState(i,``,s),a&&l&&l({action:c,location:y.location,delta:0})}function v(e){return _(e)}let y={get action(){return c},get location(){return e(i,o)},listen(e){if(l)throw Error(`A history only accepts one active listener`);return i.addEventListener(s,m),l=e,()=>{i.removeEventListener(s,m),l=null}},createHref(e){return t(i,e)},createURL:v,encodeLocation(e){let t=v(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:h,replace:g,go(e){return o.go(e)}};return y}function _(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),l(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:m(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}function v(e,t,n=`/`){return y(e,t,n,!1)}function y(e,t,n,r){let i=D((typeof t==`string`?h(t):t).pathname||`/`,n);if(i==null)return null;let a=x(e);C(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=le(i);o=se(a[e],t,r)}return o}function b(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 x(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;l(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 u=j([r,c.relativePath]),d=n.concat(c);e.children&&e.children.length>0&&(l(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${u}".`),x(e.children,t,d,u,o)),!(e.path==null&&!e.index)&&t.push({path:u,score:ae(u,e.index),routesMeta:d})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of S(e.path))a(e,t,!0,n)}),t}function S(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=S(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 C(e){e.sort((e,t)=>e.score===t.score?oe(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var w=/^:[\w-]+$/,T=3,ee=2,te=1,ne=10,re=-2,ie=e=>e===`*`;function ae(e,t){let n=e.split(`/`),r=n.length;return n.some(ie)&&(r+=re),t&&(r+=ee),n.filter(e=>!ie(e)).reduce((e,t)=>e+(w.test(t)?T:t===``?te:ne),r)}function oe(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 se(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=E({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=E({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:j([a,u.pathname]),pathnameBase:me(j([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=j([a,u.pathnameBase]))}return o}function E(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=ce(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 ce(e,t=!1,n=!0){u(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 le(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return u(!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 D(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 ue=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function de(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?h(e):e,a;return n?(n=n.replace(/\/\/+/g,`/`),a=n.startsWith(`/`)?fe(n.substring(1),`/`):fe(n,t)):a=t,{pathname:a,search:he(r),hash:ge(i)}}function fe(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 O(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 pe(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function k(e){let t=pe(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function A(e,t,n,r=!1){let i;typeof e==`string`?i=h(e):(i={...e},l(!i.pathname||!i.pathname.includes(`?`),O(`?`,`pathname`,`search`,i)),l(!i.pathname||!i.pathname.includes(`#`),O(`#`,`pathname`,`hash`,i)),l(!i.search||!i.search.includes(`#`),O(`#`,`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=de(i,s),u=o&&o!==`/`&&o.endsWith(`/`),d=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(u||d)&&(c.pathname+=`/`),c}var j=e=>e.join(`/`).replace(/\/\/+/g,`/`),me=e=>e.replace(/\/+$/,``).replace(/^\/*/,`/`),he=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,ge=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,_e=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 ve(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function ye(e){return e.map(e=>e.route.path).filter(Boolean).join(`/`).replace(/\/\/*/g,`/`)||`/`}var be=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function xe(e,t){let n=e;if(typeof n!=`string`||!ue.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(be)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=D(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{u(!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 Se=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Se);var Ce=[`GET`,...Se];new Set(Ce);var M=o.createContext(null);M.displayName=`DataRouter`;var N=o.createContext(null);N.displayName=`DataRouterState`;var we=o.createContext(!1),Te=o.createContext({isTransitioning:!1});Te.displayName=`ViewTransition`;var Ee=o.createContext(new Map);Ee.displayName=`Fetchers`;var De=o.createContext(null);De.displayName=`Await`;var P=o.createContext(null);P.displayName=`Navigation`;var F=o.createContext(null);F.displayName=`Location`;var I=o.createContext({outlet:null,matches:[],isDataRoute:!1});I.displayName=`Route`;var L=o.createContext(null);L.displayName=`RouteError`;var Oe=`REACT_ROUTER_ERROR`,ke=`REDIRECT`,Ae=`ROUTE_ERROR_RESPONSE`;function je(e){if(e.startsWith(`${Oe}:${ke}:{`))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 Me(e){if(e.startsWith(`${Oe}:${Ae}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new _e(t.status,t.statusText,t.data)}catch{}}function Ne(e,{relative:t}={}){l(R(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=o.useContext(P),{hash:i,pathname:a,search:s}=V(e,{relative:t}),c=a;return n!==`/`&&(c=a===`/`?n:j([n,a])),r.createHref({pathname:c,search:s,hash:i})}function R(){return o.useContext(F)!=null}function z(){return l(R(),`useLocation() may be used only in the context of a <Router> component.`),o.useContext(F).location}var Pe=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Fe(e){o.useContext(P).static||o.useLayoutEffect(e)}function B(){let{isDataRoute:e}=o.useContext(I);return e?tt():Ie()}function Ie(){l(R(),`useNavigate() may be used only in the context of a <Router> component.`);let e=o.useContext(M),{basename:t,navigator:n}=o.useContext(P),{matches:r}=o.useContext(I),{pathname:i}=z(),a=JSON.stringify(k(r)),s=o.useRef(!1);return Fe(()=>{s.current=!0}),o.useCallback((r,o={})=>{if(u(s.current,Pe),!s.current)return;if(typeof r==`number`){n.go(r);return}let c=A(r,JSON.parse(a),i,o.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:j([t,c.pathname])),(o.replace?n.replace:n.push)(c,o.state,o)},[t,n,a,i,e])}o.createContext(null);function Le(){let{matches:e}=o.useContext(I),t=e[e.length-1];return t?t.params:{}}function V(e,{relative:t}={}){let{matches:n}=o.useContext(I),{pathname:r}=z(),i=JSON.stringify(k(n));return o.useMemo(()=>A(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Re(e,t){return ze(e,t)}function ze(e,t,n,r,i){l(R(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:a}=o.useContext(P),{matches:s}=o.useContext(I),c=s[s.length-1],d=c?c.params:{},f=c?c.pathname:`/`,p=c?c.pathnameBase:`/`,m=c&&c.route;{let e=m&&m.path||``;rt(f,!m||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (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.
|
|
1
|
+
import{_ as e,m as t}from"./i18n-DnTGDIRw.js";var n=`modulepreload`,r=function(e){return`/`+e},i={},a=function(e,t,a){let o=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),s=document.querySelector(`meta[property=csp-nonce]`),c=s?.nonce||s?.getAttribute(`nonce`);function l(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}o=l(t.map(t=>{if(t=r(t,a),t in i)return;i[t]=!0;let o=t.endsWith(`.css`),s=o?`[rel="stylesheet"]`:``;if(a)for(let n=e.length-1;n>=0;n--){let r=e[n];if(r.href===t&&(!o||r.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${s}`))return;let l=document.createElement(`link`);if(l.rel=o?`stylesheet`:n,o||(l.as=`script`),l.crossOrigin=``,l.href=t,c&&l.setAttribute(`nonce`,c),document.head.appendChild(l),o)return new Promise((e,n)=>{l.addEventListener(`load`,e),l.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function s(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return o.then(t=>{for(let e of t||[])e.status===`rejected`&&s(e.reason);return e().catch(s)})},o=e(t(),1),s=`popstate`;function c(e={}){function t(e,t){let{pathname:n,search:r,hash:i}=e.location;return p(``,{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:m(t)}return g(t,n,null,e)}function l(e,t){if(e===!1||e==null)throw Error(t)}function u(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function d(){return Math.random().toString(36).substring(2,10)}function f(e,t){return{usr:e.state,key:e.key,idx:t}}function p(e,t,n=null,r){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?h(t):t,state:n,key:t&&t.key||r||d()}}function m({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 h(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 g(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,c=`POP`,l=null,u=d();u??(u=0,o.replaceState({...o.state,idx:u},``));function d(){return(o.state||{idx:null}).idx}function m(){c=`POP`;let e=d(),t=e==null?null:e-u;u=e,l&&l({action:c,location:y.location,delta:t})}function h(e,t){c=`PUSH`;let r=p(y.location,e,t);n&&n(r,e),u=d()+1;let s=f(r,u),m=y.createHref(r);try{o.pushState(s,``,m)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(m)}a&&l&&l({action:c,location:y.location,delta:1})}function g(e,t){c=`REPLACE`;let r=p(y.location,e,t);n&&n(r,e),u=d();let i=f(r,u),s=y.createHref(r);o.replaceState(i,``,s),a&&l&&l({action:c,location:y.location,delta:0})}function v(e){return _(e)}let y={get action(){return c},get location(){return e(i,o)},listen(e){if(l)throw Error(`A history only accepts one active listener`);return i.addEventListener(s,m),l=e,()=>{i.removeEventListener(s,m),l=null}},createHref(e){return t(i,e)},createURL:v,encodeLocation(e){let t=v(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:h,replace:g,go(e){return o.go(e)}};return y}function _(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),l(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:m(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}function v(e,t,n=`/`){return y(e,t,n,!1)}function y(e,t,n,r){let i=D((typeof t==`string`?h(t):t).pathname||`/`,n);if(i==null)return null;let a=x(e);C(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=le(i);o=se(a[e],t,r)}return o}function b(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 x(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;l(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 u=j([r,c.relativePath]),d=n.concat(c);e.children&&e.children.length>0&&(l(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${u}".`),x(e.children,t,d,u,o)),!(e.path==null&&!e.index)&&t.push({path:u,score:ae(u,e.index),routesMeta:d})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of S(e.path))a(e,t,!0,n)}),t}function S(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=S(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 C(e){e.sort((e,t)=>e.score===t.score?oe(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var w=/^:[\w-]+$/,T=3,ee=2,te=1,ne=10,re=-2,ie=e=>e===`*`;function ae(e,t){let n=e.split(`/`),r=n.length;return n.some(ie)&&(r+=re),t&&(r+=ee),n.filter(e=>!ie(e)).reduce((e,t)=>e+(w.test(t)?T:t===``?te:ne),r)}function oe(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 se(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=E({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=E({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:j([a,u.pathname]),pathnameBase:me(j([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=j([a,u.pathnameBase]))}return o}function E(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=ce(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 ce(e,t=!1,n=!0){u(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 le(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return u(!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 D(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 ue=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function de(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?h(e):e,a;return n?(n=n.replace(/\/\/+/g,`/`),a=n.startsWith(`/`)?fe(n.substring(1),`/`):fe(n,t)):a=t,{pathname:a,search:he(r),hash:ge(i)}}function fe(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 O(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 pe(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function k(e){let t=pe(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function A(e,t,n,r=!1){let i;typeof e==`string`?i=h(e):(i={...e},l(!i.pathname||!i.pathname.includes(`?`),O(`?`,`pathname`,`search`,i)),l(!i.pathname||!i.pathname.includes(`#`),O(`#`,`pathname`,`hash`,i)),l(!i.search||!i.search.includes(`#`),O(`#`,`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=de(i,s),u=o&&o!==`/`&&o.endsWith(`/`),d=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(u||d)&&(c.pathname+=`/`),c}var j=e=>e.join(`/`).replace(/\/\/+/g,`/`),me=e=>e.replace(/\/+$/,``).replace(/^\/*/,`/`),he=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,ge=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,_e=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 ve(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function ye(e){return e.map(e=>e.route.path).filter(Boolean).join(`/`).replace(/\/\/*/g,`/`)||`/`}var be=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function xe(e,t){let n=e;if(typeof n!=`string`||!ue.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(be)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=D(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{u(!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 Se=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Se);var Ce=[`GET`,...Se];new Set(Ce);var M=o.createContext(null);M.displayName=`DataRouter`;var N=o.createContext(null);N.displayName=`DataRouterState`;var we=o.createContext(!1),Te=o.createContext({isTransitioning:!1});Te.displayName=`ViewTransition`;var Ee=o.createContext(new Map);Ee.displayName=`Fetchers`;var De=o.createContext(null);De.displayName=`Await`;var P=o.createContext(null);P.displayName=`Navigation`;var F=o.createContext(null);F.displayName=`Location`;var I=o.createContext({outlet:null,matches:[],isDataRoute:!1});I.displayName=`Route`;var L=o.createContext(null);L.displayName=`RouteError`;var Oe=`REACT_ROUTER_ERROR`,ke=`REDIRECT`,Ae=`ROUTE_ERROR_RESPONSE`;function je(e){if(e.startsWith(`${Oe}:${ke}:{`))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 Me(e){if(e.startsWith(`${Oe}:${Ae}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new _e(t.status,t.statusText,t.data)}catch{}}function Ne(e,{relative:t}={}){l(R(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=o.useContext(P),{hash:i,pathname:a,search:s}=V(e,{relative:t}),c=a;return n!==`/`&&(c=a===`/`?n:j([n,a])),r.createHref({pathname:c,search:s,hash:i})}function R(){return o.useContext(F)!=null}function z(){return l(R(),`useLocation() may be used only in the context of a <Router> component.`),o.useContext(F).location}var Pe=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Fe(e){o.useContext(P).static||o.useLayoutEffect(e)}function B(){let{isDataRoute:e}=o.useContext(I);return e?tt():Ie()}function Ie(){l(R(),`useNavigate() may be used only in the context of a <Router> component.`);let e=o.useContext(M),{basename:t,navigator:n}=o.useContext(P),{matches:r}=o.useContext(I),{pathname:i}=z(),a=JSON.stringify(k(r)),s=o.useRef(!1);return Fe(()=>{s.current=!0}),o.useCallback((r,o={})=>{if(u(s.current,Pe),!s.current)return;if(typeof r==`number`){n.go(r);return}let c=A(r,JSON.parse(a),i,o.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:j([t,c.pathname])),(o.replace?n.replace:n.push)(c,o.state,o)},[t,n,a,i,e])}o.createContext(null);function Le(){let{matches:e}=o.useContext(I),t=e[e.length-1];return t?t.params:{}}function V(e,{relative:t}={}){let{matches:n}=o.useContext(I),{pathname:r}=z(),i=JSON.stringify(k(n));return o.useMemo(()=>A(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Re(e,t){return ze(e,t)}function ze(e,t,n,r,i){l(R(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:a}=o.useContext(P),{matches:s}=o.useContext(I),c=s[s.length-1],d=c?c.params:{},f=c?c.pathname:`/`,p=c?c.pathnameBase:`/`,m=c&&c.route;{let e=m&&m.path||``;rt(f,!m||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (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
2
|
|
|
3
3
|
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let g=z(),_;if(t){let e=typeof t==`string`?h(t):t;l(p===`/`||e.pathname?.startsWith(p),`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 "${p}" but pathname "${e.pathname}" was given in the \`location\` prop.`),_=e}else _=g;let y=_.pathname||`/`,b=y;if(p!==`/`){let e=p.replace(/^\//,``).split(`/`);b=`/`+y.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let x=v(e,{pathname:b});u(m||x!=null,`No routes matched location "${_.pathname}${_.search}${_.hash}" `),u(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${_.pathname}${_.search}${_.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 S=Ge(x&&x.map(e=>Object.assign({},e,{params:Object.assign({},d,e.params),pathname:j([p,a.encodeLocation?a.encodeLocation(e.pathname.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?p:j([p,a.encodeLocation?a.encodeLocation(e.pathnameBase.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),s,n,r,i);return t&&S?o.createElement(F.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,..._},navigationType:`POP`}},S):S}function Be(){let e=et(),t=ve(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},s=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),s=o.createElement(o.Fragment,null,o.createElement(`p`,null,`💿 Hey developer 👋`),o.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,o.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,o.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),o.createElement(o.Fragment,null,o.createElement(`h2`,null,`Unexpected Application Error!`),o.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?o.createElement(`pre`,{style:i},n):null,s)}var Ve=o.createElement(Be,null),He=class extends o.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=Me(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:o.createElement(I.Provider,{value:this.props.routeContext},o.createElement(L.Provider,{value:e,children:this.props.component}));return this.context?o.createElement(Ue,{error:e},t):t}};He.contextType=we;var H=new WeakMap;function Ue({children:e,error:t}){let{basename:n}=o.useContext(P);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=je(t.digest);if(e){let r=H.get(t);if(r)throw r;let i=xe(e.location,n);if(be&&!H.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 H.set(t,n),n}return o.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function We({routeContext:e,match:t,children:n}){let r=o.useContext(M);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),o.createElement(I.Provider,{value:e},n)}function Ge(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,s=n?.errors;if(s!=null){let e=a.findIndex(e=>e.route.id&&s?.[e.route.id]!==void 0);l(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(`,`)}`),a=a.slice(0,Math.min(a.length,e+1))}let c=!1,u=-1;if(n)for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(u=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){c=!0,a=u>=0?a.slice(0,u+1):[a[0]];break}}}let d=n&&r?(e,t)=>{r(e,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:ye(n.matches),errorInfo:t})}:void 0;return a.reduceRight((e,r,i)=>{let l,f=!1,p=null,m=null;n&&(l=s&&r.route.id?s[r.route.id]:void 0,p=r.route.errorElement||Ve,c&&(u<0&&i===0?(rt(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),f=!0,m=null):u===i&&(f=!0,m=r.route.hydrateFallbackElement||null)));let h=t.concat(a.slice(0,i+1)),g=()=>{let t;return t=l?p:f?m:r.route.Component?o.createElement(r.route.Component,null):r.route.element?r.route.element:e,o.createElement(We,{match:r,routeContext:{outlet:e,matches:h,isDataRoute:n!=null},children:t})};return n&&(r.route.ErrorBoundary||r.route.errorElement||i===0)?o.createElement(He,{location:n.location,revalidation:n.revalidation,component:p,error:l,children:g(),routeContext:{outlet:null,matches:h,isDataRoute:!0},onError:d}):g()},null)}function Ke(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function qe(e){let t=o.useContext(M);return l(t,Ke(e)),t}function Je(e){let t=o.useContext(N);return l(t,Ke(e)),t}function Ye(e){let t=o.useContext(I);return l(t,Ke(e)),t}function Xe(e){let t=Ye(e),n=t.matches[t.matches.length-1];return l(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Ze(){return Xe(`useRouteId`)}function Qe(){return Je(`useNavigation`).navigation}function $e(){let{matches:e,loaderData:t}=Je(`useMatches`);return o.useMemo(()=>e.map(e=>b(e,t)),[e,t])}function et(){let e=o.useContext(L),t=Je(`useRouteError`),n=Xe(`useRouteError`);return e===void 0?t.errors?.[n]:e}function tt(){let{router:e}=qe(`useNavigate`),t=Xe(`useNavigate`),n=o.useRef(!1);return Fe(()=>{n.current=!0}),o.useCallback(async(r,i={})=>{u(n.current,Pe),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var nt={};function rt(e,t,n){!t&&!nt[e]&&(nt[e]=!0,u(!1,n))}o.useOptimistic,o.memo(it);function it({routes:e,future:t,state:n,onError:r}){return ze(e,void 0,n,r,t)}function at({to:e,replace:t,state:n,relative:r}){l(R(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=o.useContext(P);u(!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}=o.useContext(I),{pathname:s}=z(),c=B(),d=A(e,k(a),s,r===`path`),f=JSON.stringify(d);return o.useEffect(()=>{c(JSON.parse(f),{replace:t,state:n,relative:r})},[c,f,r,t,n]),null}function ot(e){l(!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 st({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:s}){l(!R(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let c=e.replace(/^\/*/,`/`),d=o.useMemo(()=>({basename:c,navigator:i,static:a,unstable_useTransitions:s,future:{}}),[c,i,a,s]);typeof n==`string`&&(n=h(n));let{pathname:f=`/`,search:p=``,hash:m=``,state:g=null,key:_=`default`}=n,v=o.useMemo(()=>{let e=D(f,c);return e==null?null:{location:{pathname:e,search:p,hash:m,state:g,key:_},navigationType:r}},[c,f,p,m,g,_,r]);return u(v!=null,`<Router basename="${c}"> is not able to match the URL "${f}${p}${m}" because it does not start with the basename, so the <Router> won't render anything.`),v==null?null:o.createElement(P.Provider,{value:d},o.createElement(F.Provider,{children:t,value:v}))}function ct({children:e,location:t}){return Re(U(e),t)}o.Component;function U(e,t=[]){let n=[];return o.Children.forEach(e,(e,r)=>{if(!o.isValidElement(e))return;let i=[...t,r];if(e.type===o.Fragment){n.push.apply(n,U(e.props.children,i));return}l(e.type===ot,`[${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>`),l(!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=U(e.props.children,i)),n.push(a)}),n}var W=`get`,G=`application/x-www-form-urlencoded`;function K(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function lt(e){return K(e)&&e.tagName.toLowerCase()===`button`}function ut(e){return K(e)&&e.tagName.toLowerCase()===`form`}function dt(e){return K(e)&&e.tagName.toLowerCase()===`input`}function ft(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function pt(e,t){return e.button===0&&(!t||t===`_self`)&&!ft(e)}var q=null;function mt(){if(q===null)try{new FormData(document.createElement(`form`),0),q=!1}catch{q=!0}return q}var ht=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function J(e){return e!=null&&!ht.has(e)?(u(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${G}"`),null):e}function gt(e,t){let n,r,i,a,o;if(ut(e)){let o=e.getAttribute(`action`);r=o?D(o,t):null,n=e.getAttribute(`method`)||W,i=J(e.getAttribute(`enctype`))||G,a=new FormData(e)}else if(lt(e)||dt(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?D(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||W,i=J(e.getAttribute(`formenctype`))||J(o.getAttribute(`enctype`))||G,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(K(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=W,r=null,i=G,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 _t={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},vt=/[&><\u2028\u2029]/g;function yt(e){return e.replace(vt,e=>_t[e])}function Y(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&&D(i.pathname,t)===`/`?i.pathname=`${t.replace(/\/$/,``)}/_root.${r}`:i.pathname=`${i.pathname.replace(/\/$/,``)}.${r}`,i}async function xt(e,t){if(e.id in t)return t[e.id];try{let n=await a(()=>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 St(e){return e!=null&&typeof e.page==`string`}function Ct(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 kt((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await xt(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Ct).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Tt(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 Et(e,t,{includeHydrateFallback:n}={}){return Dt(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 Dt(e){return[...new Set(e)]}function Ot(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function kt(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!St(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Ot(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function At(){let e=o.useContext(M);return Y(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function jt(){let e=o.useContext(N);return Y(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var X=o.createContext(void 0);X.displayName=`FrameworkContext`;function Mt(){let e=o.useContext(X);return Y(e,`You must render this element inside a <HydratedRouter> element`),e}function Nt(e,t){let n=o.useContext(X),[r,i]=o.useState(!1),[a,s]=o.useState(!1),{onFocus:c,onBlur:l,onMouseEnter:u,onMouseLeave:d,onTouchStart:f}=t,p=o.useRef(null);o.useEffect(()=>{if(e===`render`&&s(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{s(e.isIntersecting)})},{threshold:.5});return p.current&&e.observe(p.current),()=>{e.disconnect()}}},[e]),o.useEffect(()=>{if(r){let e=setTimeout(()=>{s(!0)},100);return()=>{clearTimeout(e)}}},[r]);let m=()=>{i(!0)},h=()=>{i(!1),s(!1)};return n?e===`intent`?[a,p,{onFocus:Z(c,m),onBlur:Z(l,h),onMouseEnter:Z(u,m),onMouseLeave:Z(d,h),onTouchStart:Z(f,m)}]:[a,p,{}]:[!1,p,{}]}function Z(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Pt({page:e,...t}){let{router:n}=At(),r=o.useMemo(()=>v(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?o.createElement(It,{page:e,matches:r,...t}):null}function Ft(e){let{manifest:t,routeModules:n}=Mt(),[r,i]=o.useState([]);return o.useEffect(()=>{let r=!1;return wt(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function It({page:e,matches:t,...n}){let r=z(),{future:i,manifest:a,routeModules:s}=Mt(),{basename:c}=At(),{loaderData:l,matches:u}=jt(),d=o.useMemo(()=>Tt(e,t,u,a,r,`data`),[e,t,u,a,r]),f=o.useMemo(()=>Tt(e,t,u,a,r,`assets`),[e,t,u,a,r]),p=o.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,o=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!d.some(t=>t.route.id===e.route.id)&&e.route.id in l&&s[e.route.id]?.shouldRevalidate||t.hasClientLoader?o=!0:n.add(e.route.id))}),n.size===0)return[];let u=bt(e,c,i.unstable_trailingSlashAwareDataRequests,`data`);return o&&n.size>0&&u.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[u.pathname+u.search]},[c,i.unstable_trailingSlashAwareDataRequests,l,r,a,d,t,e,s]),m=o.useMemo(()=>Et(f,a),[f,a]),h=Ft(f);return o.createElement(o.Fragment,null,p.map(e=>o.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),m.map(e=>o.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),h.map(({key:e,link:t})=>o.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Lt(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}o.Component;var Rt=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Rt&&(window.__reactRouterVersion=`7.13.0`)}catch{}function zt({basename:e,children:t,unstable_useTransitions:n,window:r}){let i=o.useRef();i.current??=c({window:r,v5Compat:!0});let a=i.current,[s,l]=o.useState({action:a.action,location:a.location}),u=o.useCallback(e=>{n===!1?l(e):o.startTransition(()=>l(e))},[n]);return o.useLayoutEffect(()=>a.listen(u),[a,u]),o.createElement(st,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:a,unstable_useTransitions:n})}function Bt({basename:e,children:t,history:n,unstable_useTransitions:r}){let[i,a]=o.useState({action:n.action,location:n.location}),s=o.useCallback(e=>{r===!1?a(e):o.startTransition(()=>a(e))},[r]);return o.useLayoutEffect(()=>n.listen(s),[n,s]),o.createElement(st,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,unstable_useTransitions:r})}Bt.displayName=`unstable_HistoryRouter`;var Vt=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Q=o.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m){let{basename:h,unstable_useTransitions:g}=o.useContext(P),_=typeof l==`string`&&Vt.test(l),v=xe(l,h);l=v.to;let y=Ne(l,{relative:r}),[b,x,S]=Nt(n,p),C=Jt(l,{replace:a,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,unstable_defaultShouldRevalidate:f,unstable_useTransitions:g});function w(t){e&&e(t),t.defaultPrevented||C(t)}let T=o.createElement(`a`,{...p,...S,href:v.absoluteURL||y,onClick:v.isExternal||i?e:w,ref:Lt(m,x),target:c,"data-discover":!_&&t===`render`?`true`:void 0});return b&&!_?o.createElement(o.Fragment,null,T,o.createElement(Pt,{page:y})):T});Q.displayName=`Link`;var Ht=o.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:s,children:c,...l},u){let d=V(a,{relative:l.relative}),f=z(),p=o.useContext(N),{navigator:m,basename:h}=o.useContext(P),g=p!=null&&rn(d)&&s===!0,_=m.encodeLocation?m.encodeLocation(d).pathname:d.pathname,v=f.pathname,y=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;t||(v=v.toLowerCase(),y=y?y.toLowerCase():null,_=_.toLowerCase()),y&&h&&(y=D(y,h)||y);let b=_!==`/`&&_.endsWith(`/`)?_.length-1:_.length,x=v===_||!r&&v.startsWith(_)&&v.charAt(b)===`/`,S=y!=null&&(y===_||!r&&y.startsWith(_)&&y.charAt(_.length)===`/`),C={isActive:x,isPending:S,isTransitioning:g},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,g?`transitioning`:null].filter(Boolean).join(` `);let ee=typeof i==`function`?i(C):i;return o.createElement(Q,{...l,"aria-current":w,className:T,ref:u,style:ee,to:a,viewTransition:s},typeof c==`function`?c(C):c)});Ht.displayName=`NavLink`;var Ut=o.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:s=W,action:c,onSubmit:l,relative:u,preventScrollReset:d,viewTransition:f,unstable_defaultShouldRevalidate:p,...m},h)=>{let{unstable_useTransitions:g}=o.useContext(P),_=Zt(),v=Qt(c,{relative:u}),y=s.toLowerCase()===`get`?`get`:`post`,b=typeof c==`string`&&Vt.test(c);return o.createElement(`form`,{ref:h,method:y,action:v,onSubmit:r?l:e=>{if(l&&l(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,c=r?.getAttribute(`formmethod`)||s,m=()=>_(r||e.currentTarget,{fetcherKey:t,method:c,navigate:n,replace:i,state:a,relative:u,preventScrollReset:d,viewTransition:f,unstable_defaultShouldRevalidate:p});g&&n!==!1?o.startTransition(()=>m()):m()},...m,"data-discover":!b&&e===`render`?`true`:void 0})});Ut.displayName=`Form`;function Wt({getKey:e,storageKey:t,...n}){let r=o.useContext(X),{basename:i}=o.useContext(P),a=z(),s=$e();tn({getKey:e,storageKey:t});let c=o.useMemo(()=>{if(!r||!e)return null;let t=en(a,s,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let l=((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 o.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${l})(${yt(JSON.stringify(t||$t))}, ${yt(JSON.stringify(c))})`}})}Wt.displayName=`ScrollRestoration`;function Gt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Kt(e){let t=o.useContext(M);return l(t,Gt(e)),t}function qt(e){let t=o.useContext(N);return l(t,Gt(e)),t}function Jt(e,{target:t,replace:n,state:r,preventScrollReset:i,relative:a,viewTransition:s,unstable_defaultShouldRevalidate:c,unstable_useTransitions:l}={}){let u=B(),d=z(),f=V(e,{relative:a});return o.useCallback(p=>{if(pt(p,t)){p.preventDefault();let t=n===void 0?m(d)===m(f):n,h=()=>u(e,{replace:t,state:r,preventScrollReset:i,relative:a,viewTransition:s,unstable_defaultShouldRevalidate:c});l?o.startTransition(()=>h()):h()}},[d,u,f,n,r,t,e,i,a,s,c,l])}var Yt=0,Xt=()=>`__${String(++Yt)}__`;function Zt(){let{router:e}=Kt(`useSubmit`),{basename:t}=o.useContext(P),n=Ze(),r=e.fetch,i=e.navigate;return o.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=gt(e,t);a.navigate===!1?await r(a.fetcherKey||Xt(),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 Qt(e,{relative:t}={}){let{basename:n}=o.useContext(P),r=o.useContext(I);l(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...V(e||`.`,{relative:t})},s=z();if(e==null){a.search=s.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:j([n,a.pathname])),m(a)}var $t=`react-router-scroll-positions`,$={};function en(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:D(e.pathname,n)||e.pathname},t)),i??=e.key,i}function tn({getKey:e,storageKey:t}={}){let{router:n}=Kt(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=qt(`useScrollRestoration`),{basename:a}=o.useContext(P),s=z(),c=$e(),l=Qe();o.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),nn(o.useCallback(()=>{if(l.state===`idle`){let t=en(s,c,a,e);$[t]=window.scrollY}try{sessionStorage.setItem(t||$t,JSON.stringify($))}catch(e){u(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[l.state,e,a,s,c,t])),typeof document<`u`&&(o.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||$t);e&&($=JSON.parse(e))}catch{}},[t]),o.useLayoutEffect(()=>{let t=n?.enableScrollRestoration($,()=>window.scrollY,e?(t,n)=>en(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),o.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(s.hash){let e=document.getElementById(decodeURIComponent(s.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{u(!1,`"${s.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[s,r,i]))}function nn(e,t){let{capture:n}=t||{};o.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function rn(e,{relative:t}={}){let n=o.useContext(Te);l(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Kt(`useViewTransitionState`),i=V(e,{relative:t});if(!n.isTransitioning)return!1;let a=D(n.currentLocation.pathname,r)||n.currentLocation.pathname,s=D(n.nextLocation.pathname,r)||n.nextLocation.pathname;return E(i.pathname,s)!=null||E(i.pathname,a)!=null}export{ot as a,B as c,at as i,Le as l,Q as n,ct as o,Ht as r,z as s,zt as t,a as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,i as t,m as n,p as r,u as i}from"./i18n-
|
|
1
|
+
import{_ as e,i as t,m as n,p as r,u as i}from"./i18n-DnTGDIRw.js";import{n as a}from"./search-CLd7m0M7.js";var o=e(n(),1),s=r(),c=`min-w-0 overflow-hidden rounded-2xl border border-gray-200/70 bg-white shadow-card xl:h-[calc(100vh-180px)] xl:max-h-[860px]`;function l({className:e,...t}){return(0,s.jsx)(`section`,{className:i(c,`flex flex-col`,e),...t})}function u({className:e,children:n,mobileView:r,onMobileBack:c,mobileListLabel:l,...u}){let[d,f,...p]=o.Children.toArray(n);return r&&d&&f?(0,s.jsx)(`div`,{className:i(`grid min-h-0 grid-cols-1 gap-4`,e),...u,children:r===`detail`?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`div`,{className:`shrink-0`,children:(0,s.jsxs)(`button`,{type:`button`,onClick:c,className:`inline-flex items-center gap-2 rounded-full border border-gray-200 bg-white px-3 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50 hover:text-gray-900`,children:[(0,s.jsx)(a,{className:`h-4 w-4`}),(0,s.jsx)(`span`,{children:l??t(`backToMain`)})]})}),f,p]}):(0,s.jsxs)(s.Fragment,{children:[d,p]})}):(0,s.jsx)(`div`,{className:i(`grid min-h-0 grid-cols-1 gap-5 xl:flex-1 xl:grid-cols-[340px_minmax(0,1fr)]`,e),...u,children:n})}function d({className:e,...t}){return(0,s.jsx)(`section`,{className:i(c,`flex items-center justify-center px-6 py-12 text-center`,e),...t})}function f({className:e,...t}){return(0,s.jsx)(`div`,{className:i(`shrink-0 border-b border-gray-100`,e),...t})}function p({className:e,scrollOnDesktop:t=!0,...n}){return(0,s.jsx)(`div`,{className:i(`min-h-0 flex-1`,t&&`overflow-visible xl:overflow-y-auto xl:overscroll-contain`,e),...n})}function m({className:e,...t}){return(0,s.jsx)(`div`,{className:i(`shrink-0 border-t border-gray-100`,e),...t})}function h({active:e=!1,className:t,type:n=`button`,...r}){return(0,s.jsx)(`button`,{type:n,className:i(`w-full rounded-xl border p-2.5 text-left transition-all`,e?`border-primary/30 bg-primary-50/40 shadow-sm`:`border-gray-200/70 bg-white hover:border-gray-300 hover:bg-gray-50/70`,t),...r})}function g({icon:e,title:t,description:n,className:r,...a}){return(0,s.jsxs)(`div`,{className:i(`flex min-h-[220px] flex-col items-center justify-center rounded-xl border border-dashed border-gray-200 bg-gray-50/70 px-4 py-10 text-center`,r),...a,children:[(0,s.jsx)(`div`,{className:`mb-3 flex h-10 w-10 items-center justify-center rounded-lg bg-white`,children:(0,s.jsx)(e,{className:`h-5 w-5 text-gray-300`})}),(0,s.jsx)(`p`,{className:`text-sm font-medium text-gray-700`,children:t}),n?(0,s.jsx)(`p`,{className:`mt-2 text-xs text-gray-500`,children:n}):null]})}export{l as a,f as c,u as i,d as n,p as o,g as r,m as s,h as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,m as t}from"./i18n-
|
|
1
|
+
import{_ as e,m as t}from"./i18n-DnTGDIRw.js";var n=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),r=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),i={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},a=e(t()),o=(0,a.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:s=``,children:c,iconNode:l,...u},d)=>(0,a.createElement)(`svg`,{ref:d,...i,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:r(`lucide`,s),...u},[...l.map(([e,t])=>(0,a.createElement)(e,t)),...Array.isArray(c)?c:[c]])),s=(e,t)=>{let i=(0,a.forwardRef)(({className:i,...s},c)=>(0,a.createElement)(o,{ref:c,iconNode:t,className:r(`lucide-${n(e)}`,i),...s}));return i.displayName=`${e}`,i};export{s as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t,p as n,u as r}from"./i18n-
|
|
1
|
+
import{i as e,n as t,p as n,u as r}from"./i18n-DnTGDIRw.js";import{At as i,Ct as a,Dt as o,Et as s,Mt as c,Ot as l,Tt as u,ft as d,kt as f,mt as p,pt as m,wt as h}from"./api-BGd3rgv_.js";import{a as g,i as _,n as v,r as y,t as b}from"./select-DTdzR8j8.js";import{n as x,t as S}from"./refresh-cw-PcqoYB3K.js";import{t as C}from"./external-link-DwfSfTLB.js";import{t as w}from"./rotate-cw-BZ2JObNs.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:e}){return(0,T.jsx)(`span`,{className:r(`inline-flex rounded-full px-3 py-1 text-xs font-medium ring-1`,L(e)),children:I(e)})}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:t}){if(t.status!==`downloading`)return null;let n=t.progress?.percent,r=n==null?e(`desktopUpdatesDownloadProgressUnknown`):e(`desktopUpdatesDownloadProgressPercent`).replace(`{percent}`,String(n)),i=N(t.progress?.downloadedBytes??0,t.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:a}){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)(i,{children:e}),(0,T.jsx)(`p`,{className:`text-sm text-gray-500`,children:t})]}),(0,T.jsx)(d,{checked:n,disabled:r,onCheckedChange:a})]})}function j(e){return e?.trim()||`-`}function M(e){return e?t(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(t){return e(t===`beta`?`desktopUpdatesChannelBeta`:`desktopUpdatesChannelStable`)}function I(t){return e(E[t]??`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)(f,{className:`space-y-6`,children:[(0,T.jsx)(l,{title:e(`runtimeUpdatesPageTitle`),description:e(`runtimeUpdatesPageDescription`)}),(0,T.jsxs)(a,{children:[(0,T.jsxs)(s,{children:[(0,T.jsx)(o,{children:e(`runtimeUpdatesUnavailableTitle`)}),(0,T.jsx)(u,{children:e(`runtimeUpdatesUnavailableDescription`)})]}),(0,T.jsx)(h,{children:(0,T.jsx)(`p`,{className:`text-sm text-gray-500`,children:e(`runtimeUpdatesUnavailableHint`)})})]})]})}function z(){let{supported:t,initialized:n,busyAction:d,snapshot:E}=p();if(!n)return(0,T.jsx)(`div`,{className:`p-8 text-gray-400`,children:e(`loading`)});if(!t||!E)return(0,T.jsx)(R,{});let N=d===`checking`,P=d===`downloading`,I=d===`applying`,L=d===`saving-preferences`,z=d===`switching-channel`,B=E.status===`update-available`&&!P&&!I,V=E.status===`downloaded`&&!I,H=[[e(`runtimeUpdatesHostVersion`),j(E.hostVersion)],[e(`desktopUpdatesCurrentBundleVersion`),j(E.currentVersion)],[e(`desktopUpdatesAvailableVersion`),j(E.availableVersion)],[e(`desktopUpdatesLastCheckedAt`),M(E.lastCheckedAt)],[e(`desktopUpdatesCurrentChannel`),F(E.channel)]];return(0,T.jsxs)(f,{className:`space-y-6`,children:[(0,T.jsx)(l,{title:e(`runtimeUpdatesPageTitle`),description:e(`runtimeUpdatesPageDescription`),actions:(0,T.jsxs)(c,{variant:`outline`,onClick:()=>void m.checkForUpdates(),disabled:N||P||I,children:[(0,T.jsx)(S,{className:r(`mr-2 h-4 w-4`,N&&`animate-spin`)}),e(`desktopUpdatesCheckNow`)]})}),(0,T.jsxs)(a,{children:[(0,T.jsxs)(s,{children:[(0,T.jsx)(o,{children:e(`desktopUpdatesOverviewTitle`)}),(0,T.jsx)(u,{children:e(`desktopUpdatesOverviewDescription`)})]}),(0,T.jsxs)(h,{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:e(`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:e(`desktopUpdatesBetaBadgeTitle`)}),(0,T.jsx)(`p`,{className:`mt-1 text-sm text-amber-700`,children:e(`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:e(`desktopUpdatesDownloadedBannerTitle`)}),(0,T.jsx)(`p`,{className:`mt-1 text-sm text-emerald-700`,children:e(`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:e(`desktopUpdatesBlockedTitle`)}),(0,T.jsx)(`p`,{className:`mt-1 text-sm text-red-700`,children:E.errorMessage??e(`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)(a,{children:[(0,T.jsxs)(s,{children:[(0,T.jsx)(o,{children:e(`desktopUpdatesPreferencesTitle`)}),(0,T.jsx)(u,{children:e(`desktopUpdatesPreferencesDescription`)})]}),(0,T.jsxs)(h,{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)(i,{children:e(`desktopUpdatesReleaseChannel`)}),(0,T.jsx)(`p`,{className:`text-sm text-gray-500`,children:e(`desktopUpdatesReleaseChannelHelp`)})]}),(0,T.jsxs)(b,{value:E.channel,disabled:z||N||P||I,onValueChange:e=>void m.updateChannel(e),children:[(0,T.jsx)(_,{className:`w-full max-w-sm`,children:(0,T.jsx)(g,{placeholder:e(`desktopUpdatesReleaseChannel`)})}),(0,T.jsxs)(v,{children:[(0,T.jsx)(y,{value:`stable`,children:e(`desktopUpdatesChannelStable`)}),(0,T.jsx)(y,{value:`beta`,children:e(`desktopUpdatesChannelBeta`)})]})]}),(0,T.jsx)(`p`,{className:`text-sm text-gray-500`,children:e(`desktopUpdatesReleaseChannelDowngradeHint`)})]})}),(0,T.jsx)(A,{label:e(`desktopUpdatesAutomaticChecks`),help:e(`desktopUpdatesAutomaticChecksHelp`),checked:E.preferences.automaticChecks,disabled:L||z,onCheckedChange:e=>void m.updatePreferences({automaticChecks:e})}),(0,T.jsx)(A,{label:e(`desktopUpdatesAutoDownload`),help:e(`desktopUpdatesAutoDownloadHelp`),checked:E.preferences.autoDownload,disabled:L||z,onCheckedChange:e=>void m.updatePreferences({autoDownload:e})})]})]}),(0,T.jsxs)(a,{children:[(0,T.jsxs)(s,{children:[(0,T.jsx)(o,{children:e(`desktopUpdatesActionsTitle`)}),(0,T.jsx)(u,{children:e(`runtimeUpdatesActionsDescription`)})]}),(0,T.jsxs)(h,{className:`flex flex-wrap items-center gap-3`,children:[(0,T.jsxs)(c,{variant:`outline`,onClick:()=>void m.checkForUpdates(),disabled:N||P||I,children:[(0,T.jsx)(S,{className:r(`mr-2 h-4 w-4`,N&&`animate-spin`)}),e(`desktopUpdatesCheckNow`)]}),(0,T.jsxs)(c,{onClick:()=>void m.downloadUpdate(),disabled:!B,children:[(0,T.jsx)(x,{className:r(`mr-2 h-4 w-4`,P&&`animate-bounce`)}),e(`desktopUpdatesDownloadNow`)]}),(0,T.jsxs)(c,{variant:`secondary`,onClick:()=>void m.applyDownloadedUpdate(),disabled:!V,children:[(0,T.jsx)(w,{className:r(`mr-2 h-4 w-4`,I&&`animate-spin`)}),e(`runtimeUpdatesApplyNow`)]}),E.releaseNotesUrl?(0,T.jsxs)(c,{variant:`ghost`,onClick:()=>window.open(E.releaseNotesUrl??``,`_blank`,`noopener,noreferrer`),children:[(0,T.jsx)(C,{className:`mr-2 h-4 w-4`}),e(`desktopUpdatesReleaseNotes`)]}):null]})]})]})}export{z as DesktopUpdateConfig};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as e,m as t,p as n,u as r}from"./i18n-
|
|
1
|
+
import{_ as e,m as t,p as n,u as r}from"./i18n-DnTGDIRw.js";import{_ as i,a,c as o,d as s,f as c,g as l,h as u,i as d,l as f,m as ee,n as te,o as p,r as ne,t as re}from"./es2015-V75WQJ2s.js";import{t as m}from"./dist-DsYTOyq7.js";import{t as ie}from"./x-CM-XDMpk.js";var h=e(t(),1),g=n(),_=`Dialog`,[v,ae]=u(_),[y,b]=v(_),x=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,l=h.useRef(null),u=h.useRef(null),[d,f]=s({prop:r,defaultProp:i??!1,onChange:a,caller:_});return(0,g.jsx)(y,{scope:t,triggerRef:l,contentRef:u,contentId:c(),titleId:c(),descriptionId:c(),open:d,onOpenChange:f,onOpenToggle:h.useCallback(()=>f(e=>!e),[f]),modal:o,children:n})};x.displayName=_;var S=`DialogTrigger`,oe=h.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,a=b(S,n),s=l(t,a.triggerRef);return(0,g.jsx)(o.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.contentId,"data-state":z(a.open),...r,ref:s,onClick:i(e.onClick,a.onOpenToggle)})});oe.displayName=S;var C=`DialogPortal`,[se,w]=v(C,{forceMount:void 0}),T=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=b(C,t);return(0,g.jsx)(se,{scope:t,forceMount:n,children:h.Children.map(r,e=>(0,g.jsx)(m,{present:n||a.open,children:(0,g.jsx)(d,{asChild:!0,container:i,children:e})}))})};T.displayName=C;var E=`DialogOverlay`,D=h.forwardRef((e,t)=>{let n=w(E,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=b(E,e.__scopeDialog);return a.modal?(0,g.jsx)(m,{present:r||a.open,children:(0,g.jsx)(k,{...i,ref:t})}):null});D.displayName=E;var O=f(`DialogOverlay.RemoveScroll`),k=h.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=b(E,n);return(0,g.jsx)(te,{as:O,allowPinchZoom:!0,shards:[i.contentRef],children:(0,g.jsx)(o.div,{"data-state":z(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),A=`DialogContent`,j=h.forwardRef((e,t)=>{let n=w(A,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=b(A,e.__scopeDialog);return(0,g.jsx)(m,{present:r||a.open,children:a.modal?(0,g.jsx)(ce,{...i,ref:t}):(0,g.jsx)(le,{...i,ref:t})})});j.displayName=A;var ce=h.forwardRef((e,t)=>{let n=b(A,e.__scopeDialog),r=h.useRef(null),a=l(t,n.contentRef,r);return h.useEffect(()=>{let e=r.current;if(e)return re(e)},[]),(0,g.jsx)(M,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:i(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:i(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:i(e.onFocusOutside,e=>e.preventDefault())})}),le=h.forwardRef((e,t)=>{let n=b(A,e.__scopeDialog),r=h.useRef(!1),i=h.useRef(!1);return(0,g.jsx)(M,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),M=h.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,...s}=e,c=b(A,n),u=h.useRef(null),d=l(t,u);return ne(),(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(a,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:(0,g.jsx)(p,{role:`dialog`,id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":z(c.open),...s,ref:d,onDismiss:()=>c.onOpenChange(!1)})}),(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(H,{titleId:c.titleId}),(0,g.jsx)(de,{contentRef:u,descriptionId:c.descriptionId})]})]})}),N=`DialogTitle`,P=h.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=b(N,n);return(0,g.jsx)(o.h2,{id:i.titleId,...r,ref:t})});P.displayName=N;var F=`DialogDescription`,I=h.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=b(F,n);return(0,g.jsx)(o.p,{id:i.descriptionId,...r,ref:t})});I.displayName=F;var L=`DialogClose`,R=h.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,a=b(L,n);return(0,g.jsx)(o.button,{type:`button`,...r,ref:t,onClick:i(e.onClick,()=>a.onOpenChange(!1))})});R.displayName=L;function z(e){return e?`open`:`closed`}var B=`DialogTitleWarning`,[ue,V]=ee(B,{contentName:A,titleName:N,docsSlug:`dialog`}),H=({titleId:e})=>{let t=V(B),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
2
2
|
|
|
3
3
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,m as t}from"./i18n-
|
|
1
|
+
import{_ as e,m as t}from"./i18n-DnTGDIRw.js";import{g as n,p as r}from"./es2015-V75WQJ2s.js";var i=e(t(),1);function a(e,t){return i.useReducer((e,n)=>t[e][n]??e,e)}var o=e=>{let{present:t,children:r}=e,a=s(t),o=typeof r==`function`?r({present:a.isPresent}):i.Children.only(r),c=n(a.ref,l(o));return typeof r==`function`||a.isPresent?i.cloneElement(o,{ref:c}):null};o.displayName=`Presence`;function s(e){let[t,n]=i.useState(),o=i.useRef(null),s=i.useRef(e),l=i.useRef(`none`),[u,d]=a(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return i.useEffect(()=>{let e=c(o.current);l.current=u===`mounted`?e:`none`},[u]),r(()=>{let t=o.current,n=s.current;if(n!==e){let r=l.current,i=c(t);e?d(`MOUNT`):i===`none`||t?.display===`none`?d(`UNMOUNT`):d(n&&r!==i?`ANIMATION_OUT`:`UNMOUNT`),s.current=e}},[e,d]),r(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,r=r=>{let i=c(o.current).includes(CSS.escape(r.animationName));if(r.target===t&&i&&(d(`ANIMATION_END`),!s.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},i=e=>{e.target===t&&(l.current=c(o.current))};return t.addEventListener(`animationstart`,i),t.addEventListener(`animationcancel`,r),t.addEventListener(`animationend`,r),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,i),t.removeEventListener(`animationcancel`,r),t.removeEventListener(`animationend`,r)}}else d(`ANIMATION_END`)},[t,d]),{isPresent:[`mounted`,`unmountSuspended`].includes(u),ref:i.useCallback(e=>{o.current=e?getComputedStyle(e):null,n(e)},[])}}function c(e){return e?.animationName||`none`}function l(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}export{o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,c as t,i as n,l as r,m as i,o as a,p as o,s}from"./i18n-
|
|
1
|
+
import{_ as e,c as t,i as n,l as r,m as i,o as a,p as o,s}from"./i18n-DnTGDIRw.js";import"./doc-browser-p82AdNO-.js";import{i as c,r as l}from"./doc-browser-context-BJuMaI3o.js";var u=e(i(),1);function d(){let e=c();(0,u.useEffect)(()=>{let t=t=>{let n=t.target.closest(`a[href]`);if(!n)return;let r=n.getAttribute(`href`)||``;l(r)&&(n.hasAttribute(`data-doc-external`)||t.ctrlKey||t.metaKey||t.shiftKey||(t.preventDefault(),t.stopPropagation(),e.open(r)))};return document.addEventListener(`click`,t,!0),()=>document.removeEventListener(`click`,t,!0)},[e])}var f=o(),p=(0,u.createContext)(null);function m({children:e}){let[n,i]=(0,u.useState)(()=>s());(0,u.useEffect)(()=>r(e=>{i(e)}),[]);let o=(0,u.useCallback)(e=>{t(e),i(a())},[]),c=(0,u.useCallback)(()=>{o(n===`en`?`zh`:`en`)},[n,o]),l=(0,u.useMemo)(()=>({language:n,setLanguage:o,toggleLanguage:c}),[n,o,c]);return(0,f.jsx)(p.Provider,{value:l,children:e})}function h(){let e=(0,u.useContext)(p);if(!e)throw Error(`useI18n must be used within I18nProvider`);return{...e,t:n}}export{h as n,d as r,m as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./doc-browser-p82AdNO-.js";export{e as DocBrowser};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,m as t,o as n,p as r}from"./i18n-
|
|
1
|
+
import{_ as e,m as t,o as n,p as r}from"./i18n-DnTGDIRw.js";var i=e(t(),1),a=r(),o=`docs.nextclaw.io`,s=`nextclaw-docs.pages.dev`,c=new Set([o,`www.${o}`,s,`www.${s}`]),l=`https://${o}`,u=`/guide/getting-started`,d=(0,i.createContext)(null),f=0;function p(){return f+=1,`doc-tab-${Date.now()}-${f}`}function m(e){try{return new URL(e).pathname.replace(/\.html$/,``).replace(/\/$/,``)}catch{return e}}function h(e){return e===`zh`?`zh`:`en`}function g(e,t){let n=e.startsWith(`/`)?e:`/${e}`;return n===`/`||n===``?`/${t}/`:/^\/(en|zh)(\/|$)/.test(n)?n:`/${t}${n}`}function _(e){let t=h(n());try{let n=new URL(e,l);return c.has(n.hostname)&&(n.pathname=g(n.pathname,t)),n.toString()}catch{return new URL(`/${t}${u}`,l).toString()}}function v(){return _(u)}function y(e,t,n=`Docs`){try{let r=new URL(e,l);if(r.protocol===`data:`)return t===`docs`?n:`Detail`;let i=r.pathname.split(`/`).filter(Boolean),a=i[i.length-1]??n;return decodeURIComponent(a).replace(/[-_]/g,` `).slice(0,40)||n}catch{return n}}function b(e,t,n,r){let i=n?.trim()||y(e,t,t===`docs`?`Docs`:`Detail`);return{id:p(),kind:t,title:i,currentUrl:e,dedupeKey:r,history:[e],historyIndex:0,navVersion:0}}function x(e,t){return S(e,e.activeTabId,t)}function S(e,t,n){return{...e,tabs:e.tabs.map(e=>e.id===t?n(e):e)}}function C(e,t,n,r,i){let a={...e,title:r?.title||e.title,kind:n,dedupeKey:i};return m(t)===m(e.currentUrl)?a:{...a,currentUrl:t,history:[...e.history.slice(0,e.historyIndex+1),t],historyIndex:e.historyIndex+1,navVersion:e.navVersion+1}}function w(){let e=(0,i.useContext)(d);if(!e)throw Error(`useDocBrowser must be used within DocBrowserProvider`);return e}function T(e){try{let t=new URL(e,window.location.origin);return c.has(t.hostname)}catch{return!1}}function E(e){return T(e)?`docs`:`content`}function D(e,t){return t===`docs`?_(e):e}function O(e){return e.url&&e.url.trim().length>0?D(e.url,e.kind):e.kind===`docs`?v():e.activeTab?.currentUrl??v()}function k(e,t,n){let{activate:r,dedupeKey:i,kind:a,newTab:o,title:s}=n??{},c=e.tabs.find(t=>t.id===e.activeTabId)??e.tabs[0],l=a??(t?E(t):c?.kind??`docs`),u=O({url:t,kind:l,activeTab:c}),d=i?.trim()||void 0,f=d?e.tabs.find(e=>e.dedupeKey===d):void 0;if(f)return{...S(e,f.id,e=>C(e,u,l,n,d)),activeTabId:r===!1?e.activeTabId:f.id,isOpen:!0};if(o||d||!c||c.kind!==l){let t=b(u,l,s,d);return{...e,isOpen:!0,tabs:[...e.tabs,t],activeTabId:t.id}}return{...x(e,e=>C(e,u,l,n,d)),isOpen:!0}}function A({children:e}){let t=b(v(),`docs`,`Docs`),[n,r]=(0,i.useState)({isOpen:!1,mode:`docked`,tabs:[t],activeTabId:t.id}),o=(0,i.useMemo)(()=>n.tabs.find(e=>e.id===n.activeTabId)??n.tabs[0],[n.tabs,n.activeTabId]),s=(0,i.useCallback)((e,t)=>{r(n=>k(n,e,t))},[]),c=(0,i.useCallback)(()=>{r(e=>({...e,isOpen:!1}))},[]),l=(0,i.useCallback)(()=>{r(e=>({...e,mode:e.mode===`floating`?`docked`:`floating`}))},[]),u=(0,i.useCallback)(e=>{r(t=>({...t,mode:e}))},[]),f=(0,i.useCallback)(e=>{r(t=>{if(!t.tabs.length){let e=b(v(),`docs`,`Docs`);return{...t,tabs:[e],activeTabId:e.id,isOpen:!0}}return x(t,t=>{if(t.kind!==`docs`)return t;let n=D(e,`docs`);return m(n)===m(t.currentUrl)?t:{...t,currentUrl:n,history:[...t.history.slice(0,t.historyIndex+1),n],historyIndex:t.historyIndex+1,navVersion:t.navVersion+1}})})},[]),p=(0,i.useCallback)(e=>{r(t=>{if(!t.tabs.length){let e=b(v(),`docs`,`Docs`);return{...t,tabs:[e],activeTabId:e.id}}return x(t,t=>t.kind!==`docs`||m(e)===m(t.currentUrl)?t:{...t,currentUrl:e,history:[...t.history.slice(0,t.historyIndex+1),e],historyIndex:t.historyIndex+1})})},[]),h=(0,i.useCallback)(()=>{r(e=>x(e,e=>{if(e.kind!==`docs`||e.historyIndex<=0)return e;let t=e.historyIndex-1;return{...e,historyIndex:t,currentUrl:e.history[t]}}))},[]),g=(0,i.useCallback)(()=>{r(e=>x(e,e=>{if(e.kind!==`docs`||e.historyIndex>=e.history.length-1)return e;let t=e.historyIndex+1;return{...e,historyIndex:t,currentUrl:e.history[t]}}))},[]),_=(0,i.useCallback)((e,t)=>{s(e,{...t??{},newTab:!0})},[s]),y=(0,i.useCallback)(e=>{r(t=>{if(t.tabs.length<=1){let e=b(v(),`docs`,`Docs`);return{...t,isOpen:!1,tabs:[e],activeTabId:e.id}}let n=t.tabs.findIndex(t=>t.id===e);if(n<0)return t;let r=t.tabs.filter(t=>t.id!==e),i=t.activeTabId===e?r[Math.max(0,n-1)]?.id??r[0].id:t.activeTabId;return{...t,tabs:r,activeTabId:i}})},[]),S=(0,i.useCallback)(e=>{r(t=>t.tabs.some(t=>t.id===e)?{...t,activeTabId:e,isOpen:!0}:t)},[]),C=!!(o&&o.kind===`docs`&&o.historyIndex>0),w=!!(o&&o.kind===`docs`&&o.historyIndex<o.history.length-1),T=(0,i.useMemo)(()=>({...n,currentTab:o,currentUrl:o?.currentUrl??v(),navVersion:o?.navVersion??0,open:s,close:c,toggleMode:l,setMode:u,navigate:f,syncUrl:p,goBack:h,goForward:g,openNewTab:_,closeTab:y,setActiveTab:S,canGoBack:C,canGoForward:w}),[n,o,s,c,l,u,f,p,h,g,_,y,S,C,w]);return(0,a.jsx)(d.Provider,{value:T,children:e})}export{w as i,A as n,T as r,l as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,i as t,m as n,p as r,u as i}from"./i18n-
|
|
1
|
+
import{_ as e,i as t,m as n,p as r,u as i}from"./i18n-DnTGDIRw.js";import{t as a}from"./createLucideIcon-BLMK3QUd.js";import{n as o,t as ee}from"./search-CLd7m0M7.js";import{t as s}from"./book-open-DDlN5MvX.js";import{t as c}from"./external-link-DwfSfTLB.js";import{t as l}from"./plus-D8eKFY7h.js";import{t as u}from"./x-CM-XDMpk.js";import{i as d,r as f,t as p}from"./doc-browser-context-BJuMaI3o.js";var te=a(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),m=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`}]]),h=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`}]]),g=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`}]]),_=e(n(),1),v=r();function y(e,t){return i(`flex flex-col bg-white overflow-hidden relative`,e?`fixed inset-0 z-[9999] h-[100dvh] w-screen rounded-none border-0 shadow-2xl`:t?`h-full border-l border-gray-200 shrink-0`:`rounded-2xl shadow-2xl border border-gray-200`)}function b(e){let{isFullscreen:t,isDocked:n,dockedWidth:r,floatPos:i,floatSize:a}=e;if(!t)return n?{width:r}:{position:`fixed`,left:i.x,top:i.y,width:a.w,height:a.h,zIndex:9999}}function x({displayMode:e=`desktop`}){let{isOpen:n,mode:r,tabs:a,activeTabId:x,currentTab:S,currentUrl:C,navVersion:w,close:T,toggleMode:E,goBack:D,goForward:ne,canGoBack:re,canGoForward:ie,navigate:O,syncUrl:k,setActiveTab:ae,closeTab:oe,openNewTab:A}=d(),[j,M]=(0,_.useState)(``),[N,P]=(0,_.useState)(!1),[F,I]=(0,_.useState)(!1),[L,R]=(0,_.useState)(()=>({x:Math.max(40,window.innerWidth-520),y:80})),[z,B]=(0,_.useState)({w:480,h:600}),[V,H]=(0,_.useState)(420),U=(0,_.useRef)(null),W=(0,_.useRef)(null),G=(0,_.useRef)(null),K=(0,_.useRef)(null),q=(0,_.useRef)(w),J=S?.kind===`docs`;(0,_.useEffect)(()=>{if(!J){M(``);return}try{M(new URL(C).pathname)}catch{M(C)}},[C,x,J]),(0,_.useEffect)(()=>{if(J){if(w!==q.current){q.current=w;return}if(K.current?.contentWindow)try{let e=new URL(C).pathname;K.current.contentWindow.postMessage({type:`docs-navigate`,path:e},`*`)}catch{}}},[C,w,J]),(0,_.useEffect)(()=>{r===`floating`&&R(e=>({x:Math.max(40,window.innerWidth-z.w-40),y:e.y}))},[r,z.w]),(0,_.useEffect)(()=>{let e=e=>{J&&e.data?.type===`docs-route-change`&&typeof e.data.url==`string`&&k(e.data.url)};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[k,J]);let se=(0,_.useCallback)(e=>{if(e.preventDefault(),!J)return;let t=j.trim();t&&(t.startsWith(`/`)?O(`${p}${t}`):t.startsWith(`http`)?O(t):O(`${p}/${t}`))},[j,O,J]),ce=(0,_.useCallback)(e=>{r===`floating`&&(P(!0),U.current={startX:e.clientX,startY:e.clientY,startPosX:L.x,startPosY:L.y})},[r,L]);(0,_.useEffect)(()=>{if(!N)return;let e=e=>{U.current&&R({x:U.current.startPosX+(e.clientX-U.current.startX),y:U.current.startPosY+(e.clientY-U.current.startY)})},t=()=>{P(!1),U.current=null};return window.addEventListener(`mousemove`,e),window.addEventListener(`mouseup`,t),()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`mouseup`,t)}},[N]);let Y=(0,_.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),I(!0);let{axis:t}=e.currentTarget.dataset;W.current={startX:e.clientX,startY:e.clientY,startW:z.w,startH:z.h};let n=e=>{W.current&&B(n=>({w:t===`y`?n.w:Math.max(360,W.current.startW+(e.clientX-W.current.startX)),h:t===`x`?n.h:Math.max(400,W.current.startH+(e.clientY-W.current.startY))}))},r=()=>{I(!1),W.current=null,window.removeEventListener(`mousemove`,n),window.removeEventListener(`mouseup`,r)};window.addEventListener(`mousemove`,n),window.addEventListener(`mouseup`,r)},[z]),le=(0,_.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),I(!0),G.current={startX:e.clientX,startW:V};let t=e=>{if(!G.current)return;let t=G.current.startX-e.clientX;H(Math.max(320,Math.min(860,G.current.startW+t)))},n=()=>{I(!1),G.current=null,window.removeEventListener(`mousemove`,t),window.removeEventListener(`mouseup`,n)};window.addEventListener(`mousemove`,t),window.addEventListener(`mouseup`,n)},[V]),X=(0,_.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),I(!0);let t=e.clientX,n=z.w,r=L.x,i=e=>{let i=t-e.clientX,a=Math.max(360,n+i);B(e=>({...e,w:a})),R(e=>({...e,x:r-(a-n)}))},a=()=>{I(!1),window.removeEventListener(`mousemove`,i),window.removeEventListener(`mouseup`,a)};window.addEventListener(`mousemove`,i),window.addEventListener(`mouseup`,a)},[z.w,L.x]);if(!n)return null;let Z=r===`docked`,Q=e===`fullscreen`,$=!Z&&!Q;return(0,v.jsxs)(`div`,{"data-testid":`doc-browser-panel`,className:y(Q,Z),style:b({isFullscreen:Q,isDocked:Z,dockedWidth:V,floatPos:L,floatSize:z}),children:[Z&&!Q&&(0,v.jsx)(`div`,{className:`absolute top-0 left-0 w-1.5 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors`,onMouseDown:le}),(0,v.jsxs)(`div`,{className:i(`flex items-center justify-between px-4 py-2.5 bg-gray-50 border-b border-gray-200 shrink-0 select-none`,$&&`cursor-grab active:cursor-grabbing`,Q&&`pt-[calc(env(safe-area-inset-top,0px)+0.625rem)]`),onMouseDown:$?ce:void 0,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[(0,v.jsx)(s,{className:`w-4 h-4 text-primary shrink-0`}),(0,v.jsx)(`span`,{className:`text-sm font-semibold text-gray-900 truncate`,children:t(`docBrowserTitle`)})]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-1`,children:[Q?null:(0,v.jsx)(`button`,{onClick:E,className:`hover:bg-gray-200 rounded-md p-1.5 text-gray-500 hover:text-gray-700 transition-colors`,title:t(Z?`docBrowserFloatMode`:`docBrowserDockMode`),children:Z?(0,v.jsx)(h,{className:`w-3.5 h-3.5`}):(0,v.jsx)(g,{className:`w-3.5 h-3.5`})}),(0,v.jsx)(`button`,{onClick:T,className:`hover:bg-gray-200 rounded-md p-1.5 text-gray-500 hover:text-gray-700 transition-colors`,title:t(`docBrowserClose`),children:(0,v.jsx)(u,{className:`w-3.5 h-3.5`})})]})]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 py-2 bg-white border-b border-gray-100 overflow-x-auto custom-scrollbar`,children:[a.map(e=>(0,v.jsxs)(`div`,{className:i(`inline-flex items-center gap-1 h-7 px-1.5 rounded-lg text-xs border max-w-[220px] shrink-0 transition-colors`,e.id===x?`bg-blue-50 border-blue-300 text-blue-700`:`bg-gray-50 border-gray-200 text-gray-600 hover:bg-gray-100`),children:[(0,v.jsx)(`button`,{type:`button`,onClick:()=>ae(e.id),className:`truncate text-left px-1`,title:e.title,children:e.title||t(`docBrowserTabUntitled`)}),(0,v.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),oe(e.id)},className:`rounded p-0.5 hover:bg-black/10`,"aria-label":t(`docBrowserCloseTab`),children:(0,v.jsx)(u,{className:`w-3 h-3`})})]},e.id)),(0,v.jsx)(`button`,{onClick:()=>A(void 0,{kind:`docs`,title:`Docs`}),className:`inline-flex items-center justify-center w-7 h-7 rounded-lg border border-gray-200 bg-white text-gray-600 hover:bg-gray-100 shrink-0`,title:t(`docBrowserNewTab`),children:(0,v.jsx)(l,{className:`w-3.5 h-3.5`})})]}),J&&(0,v.jsxs)(`div`,{className:`flex items-center gap-2 px-3.5 py-2 bg-white border-b border-gray-100 shrink-0`,children:[(0,v.jsx)(`button`,{onClick:D,disabled:!re,className:`p-1.5 rounded-md hover:bg-gray-100 disabled:opacity-30 disabled:cursor-not-allowed text-gray-600 transition-colors`,children:(0,v.jsx)(o,{className:`w-4 h-4`})}),(0,v.jsx)(`button`,{onClick:ne,disabled:!ie,className:`p-1.5 rounded-md hover:bg-gray-100 disabled:opacity-30 disabled:cursor-not-allowed text-gray-600 transition-colors`,children:(0,v.jsx)(te,{className:`w-4 h-4`})}),(0,v.jsxs)(`form`,{onSubmit:se,className:`flex-1 relative`,children:[(0,v.jsx)(ee,{className:`w-3.5 h-3.5 absolute left-3 top-1/2 -translate-y-1/2 text-gray-400`}),(0,v.jsx)(`input`,{type:`text`,value:j,onChange:e=>M(e.target.value),placeholder:t(`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`})]})]}),(0,v.jsxs)(`div`,{className:`flex-1 relative overflow-hidden`,children:[(0,v.jsx)(`iframe`,{ref:K,src:C,className:`absolute inset-0 w-full h-full border-0`,title:S?.title||`NextClaw Docs`,sandbox:`allow-same-origin allow-scripts allow-popups allow-forms`,allow:`clipboard-read; clipboard-write`},`${x}:${w}`),(F||N)&&(0,v.jsx)(`div`,{className:`absolute inset-0 z-10`})]}),J&&f(C)&&(0,v.jsx)(`div`,{className:`flex items-center justify-between px-4 py-2 bg-gray-50 border-t border-gray-200 shrink-0`,children:(0,v.jsxs)(`a`,{href:C,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:[t(`docBrowserOpenExternal`),(0,v.jsx)(c,{className:`w-3 h-3`})]})}),!Z&&!Q&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`div`,{className:`absolute top-0 left-0 w-1.5 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors`,onMouseDown:X}),(0,v.jsx)(`div`,{className:`absolute top-0 right-0 w-1.5 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors`,onMouseDown:Y,"data-axis":`x`}),(0,v.jsx)(`div`,{className:`absolute bottom-0 left-0 h-1.5 w-full cursor-ns-resize z-20 hover:bg-primary/10 transition-colors`,onMouseDown:Y,"data-axis":`y`}),(0,v.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`,onMouseDown:Y,children:(0,v.jsx)(m,{className:`w-3 h-3 rotate-[-45deg]`})})]})]})}export{x as t};
|