@xopcai/xopc 0.0.301 → 0.0.302
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-sCQ2ErNm.js → activity-store-DCi5rh4e.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-L6Vh9fL1.js → agent-avatar-dicebear-C0zP6W2B.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-D0ITeUFb.js +1 -0
- package/dist/gateway/static/root/assets/{agents-CjwnFadx.js → agents-DcfWhk2S.js} +1 -1
- package/dist/gateway/static/root/assets/{api-pwK0DxZJ.js → api-CAV9PN9i.js} +1 -1
- package/dist/gateway/static/root/assets/api-fPapljyb.js +1 -0
- package/dist/gateway/static/root/assets/app-management-settings-panel-U3yDRzKF.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-ZFjV_opr.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-FgMHY1Pr.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BT7OnQyy.js → archive-plugin-MaKWrpgC.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CQGhCfVn.js → attachment-load-IfqbP2BN.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CHeFkkKk.js → automations-page-CeI2NGSO.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-B_-VM4Va.js → automations-workspace-DxaiBwrD.js} +3 -3
- package/dist/gateway/static/root/assets/{binary-plugins-D_8pZaqQ.js → binary-plugins-jvQ6FaBZ.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-m48cnmng.js → block-editor-B7U3qlB3.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automation-inputs-jciex8-r.js → browser-automation-inputs-BGT0xoTv.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-ct9dHGJF.js → browser-automations-page-DvLAwoiQ.js} +1 -1
- package/dist/gateway/static/root/assets/browser-settings-page-CHrfg3BX.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DpYDPk_o.js +8 -0
- package/dist/gateway/static/root/assets/{channels-settings-BeDwuVtH.js → channels-settings-DMq-NBUQ.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-status-swr-Cz3X8Gfa.js → channels-status-swr-C_icwbWj.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-Bn_th7oe.js → chat-terminal-dock-BtL71IOs.js} +1 -1
- package/dist/gateway/static/root/assets/computer-settings-page-Bu6ZJtmS.js +1 -0
- package/dist/gateway/static/root/assets/{connectors-page-D9xCnhbY.js → connectors-page-LsEiI9L5.js} +1 -1
- package/dist/gateway/static/root/assets/{cron-expression-C0ogAVG7.js → cron-expression-B25FHn4w.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-HtU776kx.js → date-picker-CzVHO7z9.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-DvDdN4Xu.js → dependency-picker-BNugauiZ.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-BWi5FE7D.js → desktop-pet-DTy_3-OY.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-CXfnejTb.js +1 -0
- package/dist/gateway/static/root/assets/device-pairing-wizard-CxKwfncn.js +1 -0
- package/dist/gateway/static/root/assets/extension-debug-page-C3F7RiGW.js +1 -0
- package/dist/gateway/static/root/assets/{extension-page-DxotmtcG.js → extension-page-C0jhcCT_.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-CNvJQkrr.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-COJzzscc.js → gateway-config-swr-D5AM8cyQ.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-CQTcIvlZ.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-211-jptU.js → gateway-startup-retry-CSJWdnFs.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-DAHqGRKZ.js → heartbeat-settings-Cd1VJsHe.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-BU59mAGQ.js → home-page-B_uyfCGq.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-sO31fQr_.js → image-generation-api-BNh604hw.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-BQ4HTIVc.js → imports-page-DXNfRmk9.js} +1 -1
- package/dist/gateway/static/root/assets/index-BAqVpc1H.css +1 -0
- package/dist/gateway/static/root/assets/index-hlU8MUEz.js +79 -0
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-CgW5_XVP.js +1 -0
- package/dist/gateway/static/root/assets/{local-app-workbench-page-BtEQDQeQ.js → local-app-workbench-page-C4h3qDRL.js} +2 -2
- package/dist/gateway/static/root/assets/{local-apps-page-BrEO9hz5.js → local-apps-page-DyrFxW3G.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DuG-kbsP.js → locale-store-DLK05Y1a.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-Goy_QHfL.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-DC67VTpr.js → management-settings-DgQyGEpR.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-B1q2w6W_.js → markdown-view-B8maDRWh.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DdoSox1I.js → media-plugins-5DakFba_.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-BYbx4OuI.js → messages-C9h8SImu.js} +3 -3
- package/dist/gateway/static/root/assets/note-detail-panel-lcZby9NY.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-CDGPPI-W.js +8 -0
- package/dist/gateway/static/root/assets/{page-tabs-B_I0YuTK.js → page-tabs-DzJpglJJ.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives--5Zt1oSs.js → preview-open-alternatives-Dj6LJsuQ.js} +1 -1
- package/dist/gateway/static/root/assets/{proactive-page-BBJZB2RV.js → proactive-page-CwudBdrQ.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-CKFPKr0A.js → product-open-page-CujZXOea.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-CyAf_sK-.js +1 -0
- package/dist/gateway/static/root/assets/{projects-page-BUsI5G7U.js → projects-page-BW5m_HhZ.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-BDgFNu05.js → registry-api-BMFL4vis.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-B4JgwB0s.js +1 -0
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-DV554qyN.js +5 -0
- package/dist/gateway/static/root/assets/{schema-form-CuIDQtYN.js → schema-form-Bh2Er67B.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-D5SmvlQ1.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DDALROy_.js +1 -0
- package/dist/gateway/static/root/assets/settings-form-section-BsdM7P1d.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-BBG4jliE.js → settings-page-3yEAqoME.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-layout-X1x-2Cp9.js +1 -0
- package/dist/gateway/static/root/assets/{setup-status-panel-DXqDeXNi.js → setup-status-panel-BOHNZ-S3.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-DbE7gsDd.js → share-preview-page-wV056nz2.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-io4NzfJL.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-CERFaxLj.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-Dh33NKoP.js → skills-page-CtwUqvsE.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-BNz7GQvw.js → skills-page.utils-dHBD7YqU.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-C3L8_KEq.js → system-settings-panel-lItR5Kah.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-CCKc67a-.js +1 -0
- package/dist/gateway/static/root/assets/theme-store-KfFEGMlp.js +1 -0
- package/dist/gateway/static/root/assets/tunnel-api-DPyLgmWw.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-DSrlXbBg.js → use-autosave-DO50_g_S.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-CcnGgH1n.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-9P97T0CT.js → voice-api-key-field-k7tWLXzM.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-DJvwbFbz.js → voice-config-api-bZqN8-UF.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CoVHgrQY.js → work-discovery-overlay-BHI6gO_u.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BR-S_IGS.js → workflow-run-setup-panel-jEMtNIG8.js} +1 -1
- package/dist/gateway/static/root/assets/workflows-page-CX4bcAD-.js +6 -0
- package/dist/gateway/static/root/index.html +10 -10
- package/dist/package.js +1 -1
- package/dist/src/cli/commands/connectors.js +1 -1
- package/dist/src/connectors/auth-provider-registry.js +1 -1
- package/dist/src/connectors/connected-source-ingestion.js +1 -1
- package/dist/src/connectors/connection-recovery-service.js +1 -1
- package/dist/src/connectors/health.js +1 -1
- package/dist/src/gateway/automation-agent-session.js +6 -2
- package/dist/src/gateway/heartbeat/service.js +2 -2
- package/dist/src/gateway/hono/routes/capabilities.js +1 -1
- package/dist/src/gateway/hono/routes/connectors.js +3 -3
- package/dist/src/gateway/hono/routes/mcp.js +1 -1
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/storage/sqlite/session-repository.js +9 -0
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/package.json +4 -4
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-C22DdeJ6.js +0 -1
- package/dist/gateway/static/root/assets/api-BjlN9GPQ.js +0 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-BPanjQB6.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-CUWA2E_f.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-D8hP1XhF.js +0 -1
- package/dist/gateway/static/root/assets/browser-settings-page-DNX0BZFM.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-settings-panel-nvCpR13B.js +0 -8
- package/dist/gateway/static/root/assets/computer-model-settings-BOObauzH.js +0 -1
- package/dist/gateway/static/root/assets/computer-settings-page-BicG-IvN.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-CptAwdZd.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-C8BiZYwP.js +0 -1
- package/dist/gateway/static/root/assets/extension-debug-page-nRRdMurF.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-BK2t7aFl.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-rIGo_jeB.js +0 -1
- package/dist/gateway/static/root/assets/index-54o0AGdj.js +0 -79
- package/dist/gateway/static/root/assets/index-R89i_XYi.css +0 -1
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-BSgsIe7E.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-DhXIIoc0.js +0 -2
- package/dist/gateway/static/root/assets/note-detail-panel-CCIA4VbP.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-C8JeFMSH.js +0 -8
- package/dist/gateway/static/root/assets/project-detail-page-DeTeDel1.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-DSGwCc4h.js +0 -1
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-BY9oD7eN.js +0 -5
- package/dist/gateway/static/root/assets/sessions-page-zAeJa1Ae.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BG4EILeB.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-C4D1p0xR.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-layout-CsUQKRq0.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BN_O6Dwt.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Sq-IWawl.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-CJ1WpRpN.js +0 -1
- package/dist/gateway/static/root/assets/theme-store-JzZVUvEh.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-GLzwLaUZ.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-CX9eizCN.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-ea-j18xi.js +0 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,h as a,t as o}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as s}from"./check-DUBLcKHA.js";import{t as c}from"./copy-Dv6d4Dvw.js";import{t as l}from"./external-link-DjqjBmc3.js";import{t as u}from"./globe-DSSGFWFn.js";import{t as d}from"./loader-circle-CifKLtgG.js";import{t as f}from"./cn-JdwAhgNB.js";import{c as p,n as m}from"./locale-store-DLK05Y1a.js";import{t as h}from"./messages-C9h8SImu.js";import{a as g,i as _,o as v,r as y,s as b,t as x}from"./dist-BGTk37IG.js";import{t as S}from"./copy-to-clipboard-HOJ79TWv.js";import{i as C}from"./vendor-swr-BIWyz7Rc.js";import{t as w}from"./button-CGlRPNzi.js";import{n as T,r as E}from"./gateway-config-swr-D5AM8cyQ.js";import{i as D,o as O}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{At as k,B as A,Cc as j,Ct as M,Et as N,Fu as P,H as F,Nu as I,Pl as L,Tu as R,Ui as z,V as B,Vc as V,Zu as H,ac as U,ca as ee,ia as te,jo as ne,kc as W,lc as G,rl as K,wt as re,xc as ie}from"./index-hlU8MUEz.js";import{n as ae,r as q,t as oe}from"./settings-page-layout-X1x-2Cp9.js";import{n as J,r as se,t as ce}from"./settings-form-section-BsdM7P1d.js";import{S as Y,a as le,b as ue,c as de,g as fe,i as pe,n as me,o as he,r as ge,s as _e,t as X,x as ve,y as ye}from"./tunnel-api-DPyLgmWw.js";import{t as be}from"./page-tabs-DzJpglJJ.js";import{t as xe}from"./settings-advanced-gate-DDALROy_.js";var Z=e(t(),1),Q=n(),$=r();function Se(e){switch(e){case`active`:return`text-emerald-700 dark:text-emerald-400`;case`connecting`:return`text-amber-700 dark:text-amber-400`;default:return`text-fg-muted`}}function Ce(e){let t=(0,Q.c)(11),{label:n,kind:r}=e,i;t[0]===r?i=t[1]:(i=f(`inline-flex items-center gap-1.5 text-xs font-medium`,Se(r)),t[0]=r,t[1]=i);let a=r===`active`&&`bg-emerald-500`,o=r===`connecting`&&`bg-amber-500`,s;t[2]!==a||t[3]!==o?(s=f(`size-1.5 rounded-full bg-fg-subtle/50`,a,o),t[2]=a,t[3]=o,t[4]=s):s=t[4];let c;t[5]===s?c=t[6]:(c=(0,$.jsx)(`span`,{className:s,"aria-hidden":!0}),t[5]=s,t[6]=c);let l;return t[7]!==n||t[8]!==i||t[9]!==c?(l=(0,$.jsxs)(`span`,{className:i,children:[c,n]}),t[7]=n,t[8]=i,t[9]=c,t[10]=l):l=t[10],l}function we(e){let t=(0,Q.c)(31),{onOpenTab:n}=e,r=m(Ee),i;t[0]===r?i=t[1]:(i=h(r),t[0]=r,t[1]=i);let a=i.remoteAccess.guide,o=!!p(Te),s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={refreshInterval:3e4},t[2]=s):s=t[2];let{data:c}=C(o?`exposure-status`:null,ve,s),l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l={refreshInterval:15e3},t[3]=l):l=t[3];let{data:d}=C(o?`tunnel-status`:null,me,l),g=E(o);if(!o)return null;let _=c?.tailscale.active===!0,v=d?.state,y=d?.enabled&&v===`connected`,b=d?.enabled&&(v===`connecting`||v===`reconnecting`||!!d?.startProgress||!!d?.frpcDownload),x=g.data?.payload?.config,S=!!(x&&typeof x==`object`&&!Array.isArray(x)&&x.gateway?.publicUrl),w=_?`active`:`off`,T=_?a.statusActive:a.statusOff,D;t[4]!==a.tailscaleCardTitle||t[5]!==w||t[6]!==T?(D={tab:`tailscale`,icon:u,title:a.tailscaleCardTitle,kind:w,statusLabel:T},t[4]=a.tailscaleCardTitle,t[5]=w,t[6]=T,t[7]=D):D=t[7];let O=y?`active`:b?`connecting`:`off`,k=y?a.statusActive:b?a.statusConnecting:a.statusOff,A;t[8]!==a.publicCardTitle||t[9]!==O||t[10]!==k?(A={tab:`public`,icon:K,title:a.publicCardTitle,kind:O,statusLabel:k},t[8]=a.publicCardTitle,t[9]=O,t[10]=k,t[11]=A):A=t[11];let M=S?`active`:`off`,N=S?a.statusActive:a.statusOff,P;t[12]!==a.reverseProxyCardTitle||t[13]!==M||t[14]!==N?(P={tab:`reverse-proxy`,icon:j,title:a.reverseProxyCardTitle,kind:M,statusLabel:N},t[12]=a.reverseProxyCardTitle,t[13]=M,t[14]=N,t[15]=P):P=t[15];let F;t[16]!==a.sshCardStatus||t[17]!==a.sshCardTitle?(F={tab:`ssh`,icon:G,title:a.sshCardTitle,kind:`off`,statusLabel:a.sshCardStatus},t[16]=a.sshCardStatus,t[17]=a.sshCardTitle,t[18]=F):F=t[18];let I;t[19]!==a.lanCardStatus||t[20]!==a.lanCardTitle?(I={tab:`lan`,icon:W,title:a.lanCardTitle,kind:`off`,statusLabel:a.lanCardStatus},t[19]=a.lanCardStatus,t[20]=a.lanCardTitle,t[21]=I):I=t[21];let L;t[22]!==P||t[23]!==F||t[24]!==I||t[25]!==D||t[26]!==A?(L=[D,A,P,F,I],t[22]=P,t[23]=F,t[24]=I,t[25]=D,t[26]=A,t[27]=L):L=t[27];let R=L,z;return t[28]!==R||t[29]!==n?(z=(0,$.jsx)(`div`,{className:`grid gap-1 rounded-xl bg-surface-hover/20 p-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5`,children:R.map(e=>{let t=e.icon;return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e.tab),className:f(`flex items-start gap-3 rounded-lg bg-surface-base/45 px-2 py-3 text-left transition-colors`,`hover:bg-surface-hover/30`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center text-fg-muted`,children:(0,$.jsx)(t,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(Ce,{label:e.statusLabel,kind:e.kind})]})]},`${e.tab}-${e.title}`)})}),t[28]=R,t[29]=n,t[30]=z):z=t[30],z}function Te(e){return e.conversationId}function Ee(e){return e.language}function De(e){let t=(0,Q.c)(21),{title:n,description:r,recommended:i,icon:a,onOpen:o,recommendedLabel:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=f(`group flex w-full items-start gap-3 px-3 py-4 text-left transition-colors`,`hover:bg-surface-hover/30`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),t[0]=c):c=t[0];let l;t[1]===a?l=t[2]:(l=(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover/70 text-fg-muted`,children:(0,$.jsx)(a,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),t[1]=a,t[2]=l);let u;t[3]===n?u=t[4]:(u=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[3]=n,t[4]=u);let d;t[5]!==i||t[6]!==s?(d=i&&s?(0,$.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:s}):null,t[5]=i,t[6]=s,t[7]=d):d=t[7];let p;t[8]!==u||t[9]!==d?(p=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[u,d]}),t[8]=u,t[9]=d,t[10]=p):p=t[10];let m;t[11]===r?m=t[12]:(m=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:r}),t[11]=r,t[12]=m);let h;t[13]!==p||t[14]!==m?(h=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[p,m]}),t[13]=p,t[14]=m,t[15]=h):h=t[15];let g;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(I,{className:`mt-2 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5 group-hover:text-fg-muted`,"aria-hidden":!0}),t[16]=g):g=t[16];let _;return t[17]!==o||t[18]!==l||t[19]!==h?(_=(0,$.jsxs)(`button`,{type:`button`,onClick:o,className:c,children:[l,h,g]}),t[17]=o,t[18]=l,t[19]=h,t[20]=_):_=t[20],_}function Oe(e){let t=(0,Q.c)(74),{onOpenTab:n}=e,r=m(je),i;t[0]===r?i=t[1]:(i=h(r),t[0]=r,t[1]=i);let a=i.remoteAccess,o=a.guide,s=!!p(Ae),c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c={refreshInterval:3e4},t[2]=c):c=t[2];let{data:l}=C(s?`exposure-status`:null,ve,c),d;t[3]===l?.conflicts?d=t[4]:(d=l?.conflicts??[],t[3]=l?.conflicts,t[4]=d);let f=d;if(!s){let e;return t[5]===o.needToken?e=t[6]:(e=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.needToken}),t[5]=o.needToken,t[6]=e),e}let g;t[7]===n?g=t[8]:(g=(0,$.jsx)(we,{onOpenTab:n}),t[7]=n,t[8]=g);let _;t[9]!==f||t[10]!==o.conflictsHint||t[11]!==o.conflictsTitle?(_=f.length>0?(0,$.jsxs)(`div`,{className:`rounded-xl bg-amber-500/10 px-4 py-3 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:o.conflictsTitle}),(0,$.jsx)(`p`,{className:`mt-1`,children:o.conflictsHint}),(0,$.jsx)(`ul`,{className:`mt-2 list-inside list-disc text-xs`,children:f.map(ke)})]}):null,t[9]=f,t[10]=o.conflictsHint,t[11]=o.conflictsTitle,t[12]=_):_=t[12];let v;t[13]===o.pickMethod?v=t[14]:(v=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:o.pickMethod}),t[13]=o.pickMethod,t[14]=v);let y;t[15]===n?y=t[16]:(y=()=>n(`tailscale`),t[15]=n,t[16]=y);let b;t[17]!==o.recommended||t[18]!==o.tailscaleCardDesc||t[19]!==o.tailscaleCardTitle||t[20]!==y?(b=(0,$.jsx)(De,{icon:u,title:o.tailscaleCardTitle,description:o.tailscaleCardDesc,recommended:!0,recommendedLabel:o.recommended,onOpen:y}),t[17]=o.recommended,t[18]=o.tailscaleCardDesc,t[19]=o.tailscaleCardTitle,t[20]=y,t[21]=b):b=t[21];let x;t[22]===n?x=t[23]:(x=()=>n(`public`),t[22]=n,t[23]=x);let S;t[24]!==o.publicCardDesc||t[25]!==o.publicCardTitle||t[26]!==x?(S=(0,$.jsx)(De,{icon:K,title:o.publicCardTitle,description:o.publicCardDesc,onOpen:x}),t[24]=o.publicCardDesc,t[25]=o.publicCardTitle,t[26]=x,t[27]=S):S=t[27];let w;t[28]===n?w=t[29]:(w=()=>n(`reverse-proxy`),t[28]=n,t[29]=w);let T;t[30]!==o.reverseProxyCardDesc||t[31]!==o.reverseProxyCardTitle||t[32]!==w?(T=(0,$.jsx)(De,{icon:j,title:o.reverseProxyCardTitle,description:o.reverseProxyCardDesc,onOpen:w}),t[30]=o.reverseProxyCardDesc,t[31]=o.reverseProxyCardTitle,t[32]=w,t[33]=T):T=t[33];let E;t[34]===n?E=t[35]:(E=()=>n(`ssh`),t[34]=n,t[35]=E);let D;t[36]!==o.sshCardDesc||t[37]!==o.sshCardTitle||t[38]!==E?(D=(0,$.jsx)(De,{icon:G,title:o.sshCardTitle,description:o.sshCardDesc,onOpen:E}),t[36]=o.sshCardDesc,t[37]=o.sshCardTitle,t[38]=E,t[39]=D):D=t[39];let O;t[40]===n?O=t[41]:(O=()=>n(`lan`),t[40]=n,t[41]=O);let k;t[42]!==o.lanCardDesc||t[43]!==o.lanCardTitle||t[44]!==O?(k=(0,$.jsx)(De,{icon:W,title:o.lanCardTitle,description:o.lanCardDesc,onOpen:O}),t[42]=o.lanCardDesc,t[43]=o.lanCardTitle,t[44]=O,t[45]=k):k=t[45];let A;t[46]!==S||t[47]!==T||t[48]!==D||t[49]!==k||t[50]!==b?(A=(0,$.jsxs)(`div`,{className:`mt-2 flex max-w-3xl flex-col gap-1 rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:[b,S,T,D,k]}),t[46]=S,t[47]=T,t[48]=D,t[49]=k,t[50]=b,t[51]=A):A=t[51];let M;t[52]!==A||t[53]!==v?(M=(0,$.jsxs)(`div`,{children:[v,A]}),t[52]=A,t[53]=v,t[54]=M):M=t[54];let N;t[55]===o.oneAtATimeHint?N=t[56]:(N=(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:o.oneAtATimeHint}),t[55]=o.oneAtATimeHint,t[56]=N);let P;t[57]===a.advanced.proxyTitle?P=t[58]:(P=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.advanced.proxyTitle}),t[57]=a.advanced.proxyTitle,t[58]=P);let F;t[59]===a.advanced.proxyBody?F=t[60]:(F=(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:a.advanced.proxyBody}),t[59]=a.advanced.proxyBody,t[60]=F);let I;t[61]!==r||t[62]!==a.advanced.proxyDocs?(I=(0,$.jsx)(Y,{language:r,label:a.advanced.proxyDocs,section:`advanced`,className:`mt-2`}),t[61]=r,t[62]=a.advanced.proxyDocs,t[63]=I):I=t[63];let L;t[64]!==P||t[65]!==F||t[66]!==I?(L=(0,$.jsxs)(`div`,{className:`max-w-3xl rounded-xl bg-surface-hover/20 px-4 py-4`,children:[P,F,I]}),t[64]=P,t[65]=F,t[66]=I,t[67]=L):L=t[67];let R;return t[68]!==M||t[69]!==N||t[70]!==L||t[71]!==g||t[72]!==_?(R=(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[g,_,M,N,L]}),t[68]=M,t[69]=N,t[70]=L,t[71]=g,t[72]=_,t[73]=R):R=t[73],R}function ke(e){return(0,$.jsx)(`li`,{children:e.message},e.code)}function Ae(e){return e.conversationId}function je(e){return e.language}function Me(){let e=(0,Q.c)(16),t=m(Ne),n;e[0]===t?n=e[1]:(n=h(t),e[0]=t,e[1]=n);let r=n.remoteAccess.lan,i;e[2]!==r.subtitle||e[3]!==r.title?(i=(0,$.jsx)(J,{icon:W,title:r.title,subtitle:r.subtitle}),e[2]=r.subtitle,e[3]=r.title,e[4]=i):i=e[4];let a;e[5]===r.body?a=e[6]:(a=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.body}),e[5]=r.body,e[6]=a);let s;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),e[7]=s):s=e[7];let c;e[8]===r.link?c=e[9]:(c=(0,$.jsxs)(o,{to:`/settings/gateway`,className:`inline-flex items-center gap-1.5 text-sm font-medium text-accent hover:underline`,children:[r.link,s]}),e[8]=r.link,e[9]=c);let u;e[10]!==a||e[11]!==c?(u=(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[a,c]}),e[10]=a,e[11]=c,e[12]=u):u=e[12];let d;return e[13]!==i||e[14]!==u?(d=(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,$.jsxs)(ce,{children:[i,u]})}),e[13]=i,e[14]=u,e[15]=d):d=e[15],d}function Ne(e){return e.language}function Pe(e){let t=(0,Q.c)(30),{embedded:n}=e,r=n===void 0?!1:n,i=m(Fe),a;t[0]===i?a=t[1]:(a=h(i),t[0]=i,t[1]=a);let o=a.remoteAccess.ssh,[s,l]=(0,Z.useState)(!1),u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=async()=>{await S(`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`)&&(l(!0),setTimeout(()=>l(!1),2e3))},t[2]=u):u=t[2];let d=u,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`pre`,{className:`overflow-x-auto rounded-lg bg-surface-base/55 px-3 py-2 text-xs text-fg-muted`,children:`xopc gateway ssh-tunnel --target user@your-host --local-port 18790 --remote-port 18790`}),t[3]=f):f=t[3];let p,g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>void d(),g=(0,$.jsx)(c,{className:`mr-1 size-4`}),t[4]=p,t[5]=g):(p=t[4],g=t[5]);let _=s?o.copied:o.copy,v;t[6]===_?v=t[7]:(v=(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsxs)(w,{type:`button`,variant:`ghost`,onClick:p,children:[g,_]})}),t[6]=_,t[7]=v);let y;t[8]!==r||t[9]!==o.hint?(y=r?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:o.hint}):null,t[8]=r,t[9]=o.hint,t[10]=y):y=t[10];let b;t[11]!==v||t[12]!==y?(b=(0,$.jsxs)($.Fragment,{children:[f,v,y]}),t[11]=v,t[12]=y,t[13]=b):b=t[13];let x=b;if(r){let e;t[14]!==o.subtitle||t[15]!==o.title?(e=(0,$.jsx)(J,{icon:G,title:o.title,subtitle:o.subtitle}),t[14]=o.subtitle,t[15]=o.title,t[16]=e):e=t[16];let n;t[17]===x?n=t[18]:(n=(0,$.jsx)(`div`,{className:`mt-4 space-y-2`,children:x}),t[17]=x,t[18]=n);let r;return t[19]!==e||t[20]!==n?(r=(0,$.jsxs)(ce,{children:[e,n]}),t[19]=e,t[20]=n,t[21]=r):r=t[21],r}let C;t[22]!==o.subtitle||t[23]!==o.title?(C=(0,$.jsx)(J,{icon:G,title:o.title,subtitle:o.subtitle}),t[22]=o.subtitle,t[23]=o.title,t[24]=C):C=t[24];let T;t[25]===x?T=t[26]:(T=(0,$.jsx)(`div`,{className:`mt-4`,children:x}),t[25]=x,t[26]=T);let E;return t[27]!==C||t[28]!==T?(E=(0,$.jsxs)(ce,{children:[C,T]}),t[27]=C,t[28]=T,t[29]=E):E=t[29],E}function Fe(e){return e.language}function Ie(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Pe,{embedded:!0}),e[0]=t):t=e[0],t}var Le=[`guide`,`tailscale`,`public`,`reverse-proxy`,`ssh`,`lan`];function Re(e){return e&&Le.includes(e)?e:`guide`}function ze(e){let t=(0,Q.c)(32),{showLabel:n,hideLabel:r,icon:i,hint:a,children:o,className:s,defaultOpen:c,advancedOnly:l}=e,u=l===void 0?!1:l,[d,p]=(0,Z.useState)(c??!1),m;t[0]===s?m=t[1]:(m=f(`rounded-xl bg-surface-hover/20`,s),t[0]=s,t[1]=m);let h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>p(Be),t[2]=h):h=t[2];let g=d&&`rotate-180`,_;t[3]===g?_=t[4]:(_=f(`size-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,g),t[3]=g,t[4]=_);let v;t[5]===_?v=t[6]:(v=(0,$.jsx)(P,{className:_,"aria-hidden":!0}),t[5]=_,t[6]=v);let y;t[7]===i?y=t[8]:(y=i?(0,$.jsx)(i,{className:`size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}):null,t[7]=i,t[8]=y);let b=d?r:n,x;t[9]===b?x=t[10]:(x=(0,$.jsx)(`span`,{children:b}),t[9]=b,t[10]=x);let S;t[11]!==d||t[12]!==v||t[13]!==y||t[14]!==x?(S=(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":d,onClick:h,className:`flex w-full items-center gap-2 rounded-2xl px-4 py-3.5 text-left text-sm font-medium text-fg transition-colors hover:text-fg`,children:[v,y,x]}),t[11]=d,t[12]=v,t[13]=y,t[14]=x,t[15]=S):S=t[15];let C=d?`grid-rows-[1fr] opacity-100`:`grid-rows-[0fr] opacity-0`,w;t[16]===C?w=t[17]:(w=f(`grid transition-[grid-template-rows,opacity] duration-200 ease-out motion-reduce:transition-none`,C),t[16]=C,t[17]=w);let T;t[18]===a?T=t[19]:(T=a?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:a}):null,t[18]=a,t[19]=T);let E;t[20]!==o||t[21]!==T?(E=(0,$.jsx)(`div`,{className:`overflow-hidden`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-4 px-4 pb-4 pt-1`,children:[T,o]})}),t[20]=o,t[21]=T,t[22]=E):E=t[22];let D;t[23]!==w||t[24]!==E?(D=(0,$.jsx)(`div`,{className:w,children:E}),t[23]=w,t[24]=E,t[25]=D):D=t[25];let O;t[26]!==S||t[27]!==D||t[28]!==m?(O=(0,$.jsxs)(`section`,{className:m,children:[S,D]}),t[26]=S,t[27]=D,t[28]=m,t[29]=O):O=t[29];let k=O;if(u){let e;return t[30]===k?e=t[31]:(e=(0,$.jsx)(xe,{children:k}),t[30]=k,t[31]=e),e}return k}function Be(e){return!e}function Ve(e){let t=(0,Q.c)(40),{open:n,title:r,intro:i,bullets:a,checkboxLabel:o,confirmLabel:s,cancelLabel:c,onConfirm:l,onCancel:u}=e,[d,p]=(0,Z.useState)(!1),m;t[0]===u?m=t[1]:(m=e=>{e||(p(!1),u())},t[0]=u,t[1]=m);let h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(g,{className:f(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,O)}),t[2]=h):h=t[2];let S;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(S=f(`fixed left-1/2 top-1/2 max-h-[min(90vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-y-auto rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`,D),t[3]=S):S=t[3];let C;t[4]===r?C=t[5]:(C=(0,$.jsx)(b,{className:`text-base font-semibold text-fg`,children:r}),t[4]=r,t[5]=C);let T;t[6]===i?T=t[7]:(T=(0,$.jsx)(_,{className:`mt-2 text-sm text-fg-muted`,children:i}),t[6]=i,t[7]=T);let E;t[8]===a?E=t[9]:(E=a.map(He),t[8]=a,t[9]=E);let k;t[10]===E?k=t[11]:(k=(0,$.jsx)(`ul`,{className:`mt-4 list-disc space-y-2 pl-5 text-sm text-fg-muted`,children:E}),t[10]=E,t[11]=k);let A;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>p(e.target.checked),t[12]=A):A=t[12];let j;t[13]===d?j=t[14]:(j=(0,$.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 shrink-0 rounded border-edge accent-accent`,checked:d,onChange:A}),t[13]=d,t[14]=j);let M;t[15]===o?M=t[16]:(M=(0,$.jsx)(`span`,{children:o}),t[15]=o,t[16]=M);let N;t[17]!==M||t[18]!==j?(N=(0,$.jsxs)(`label`,{className:`mt-5 flex cursor-pointer items-start gap-3 text-sm text-fg`,children:[j,M]}),t[17]=M,t[18]=j,t[19]=N):N=t[19];let P;t[20]!==c||t[21]!==u?(P=(0,$.jsx)(w,{type:`button`,variant:`secondary`,onClick:u,children:c}),t[20]=c,t[21]=u,t[22]=P):P=t[22];let F=!d,I;t[23]!==s||t[24]!==l||t[25]!==F?(I=(0,$.jsx)(w,{type:`button`,disabled:F,onClick:l,children:s}),t[23]=s,t[24]=l,t[25]=F,t[26]=I):I=t[26];let L;t[27]!==P||t[28]!==I?(L=(0,$.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[P,I]}),t[27]=P,t[28]=I,t[29]=L):L=t[29];let R;t[30]!==N||t[31]!==L||t[32]!==C||t[33]!==T||t[34]!==k?(R=(0,$.jsxs)(v,{children:[h,(0,$.jsxs)(y,{className:S,onOpenAutoFocus:Ue,children:[C,T,k,N,L]})]}),t[30]=N,t[31]=L,t[32]=C,t[33]=T,t[34]=k,t[35]=R):R=t[35];let z;return t[36]!==n||t[37]!==m||t[38]!==R?(z=(0,$.jsx)(x,{open:n,onOpenChange:m,children:R}),t[36]=n,t[37]=m,t[38]=R,t[39]=z):z=t[39],z}function He(e){return(0,$.jsx)(`li`,{children:e},e)}function Ue(e){return e.preventDefault()}function We(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Ge=[`preparing_frpc`,`registering`,`starting_frpc`];function Ke(e){return e?e===`reconnecting_frpc`?Ge.indexOf(`starting_frpc`):Ge.indexOf(e):-1}function qe(e,t){if(t.state===`connected`)return`done`;let n=t.startProgress?.phase,r=Ge.indexOf(e),i=Ke(n);return i<0?t.state===`connecting`||t.state===`reconnecting`?`active`:`pending`:r<i?`done`:r===i?`active`:`pending`}function Je(e,t,n){let r=n.startProgress;return qe(t,n)===`active`?t===`preparing_frpc`&&n.frpcDownload?n.frpcDownload.phase===`extracting`?e.frpcExtracting:n.frpcDownload.percent==null?e.frpcDownloading:e.frpcDownloadingPercent.replace(`{{percent}}`,String(n.frpcDownload.percent)):t===`registering`&&r?.publicUrl?e.stepRegisterDetail:t===`starting_frpc`?r?.phase===`reconnecting_frpc`?e.stepReconnectDetail:e.stepFrpcDetail:null:null}function Ye(e,t){switch(t){case`preparing_frpc`:return e.stepPrepareFrpc;case`registering`:return e.stepRegister;case`starting_frpc`:return e.stepFrpcLogin}}function Xe(e){if(!e)return null;let t=Math.max(0,Math.floor((Date.now()-new Date(e).getTime())/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function Ze(e){let t=(0,Q.c)(31),{status:n,t:r}=e,[,i]=(0,Z.useState)(0),a;t[0]!==i||t[1]!==n.state?(a=()=>{if(n.state!==`connecting`&&n.state!==`reconnecting`)return;let e=window.setInterval(()=>i(Qe),1e3);return()=>window.clearInterval(e)},t[0]=i,t[1]=n.state,t[2]=a):a=t[2];let o=n.startProgress?.startedAt,c;if(t[3]!==n.state||t[4]!==o?(c=[n.state,o],t[3]=n.state,t[4]=o,t[5]=c):c=t[5],(0,Z.useEffect)(a,c),!(n.state===`connecting`||n.state===`reconnecting`||n.state===`connected`&&n.startProgress))return null;let l,u,p,m,h;if(t[6]!==n||t[7]!==r){let e=Xe(n.startProgress?.startedAt);l=!!n.publicUrl&&n.state!==`connected`&&n.startProgress?.phase!==`registering`,u=`mt-3 space-y-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface`;let i;t[13]===r.startProgressTitle?i=t[14]:(i=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:r.startProgressTitle}),t[13]=r.startProgressTitle,t[14]=i);let a;t[15]===r.startProgressHint?a=t[16]:(a=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.startProgressHint}),t[15]=r.startProgressHint,t[16]=a),t[17]!==i||t[18]!==a?(p=(0,$.jsxs)(`div`,{children:[i,a]}),t[17]=i,t[18]=a,t[19]=p):p=t[19];let o=Ge.map(e=>{let t=qe(e,n),i=Je(r,e,n);return(0,$.jsxs)(`li`,{className:`flex gap-2 text-xs`,children:[(0,$.jsx)(`span`,{className:`mt-0.5 shrink-0 text-fg-subtle`,"aria-hidden":!0,children:t===`done`?(0,$.jsx)(s,{className:`size-3.5 text-emerald-600 dark:text-emerald-400`}):t===`active`?(0,$.jsx)(d,{className:`size-3.5 animate-spin text-accent`}):(0,$.jsx)(R,{className:`size-3.5`})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:f(`font-medium`,t===`active`?`text-fg`:t===`done`?`text-fg-muted`:`text-fg-subtle`),children:Ye(r,e)}),i?(0,$.jsx)(`div`,{className:`mt-0.5 text-fg-muted`,children:i}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload&&n.frpcDownload.phase===`downloading`?(0,$.jsxs)(`div`,{className:`mt-2 space-y-1`,children:[(0,$.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-surface-panel`,children:(0,$.jsx)(`div`,{className:f(`h-full rounded-full bg-accent transition-[width] duration-300`,n.frpcDownload.percent==null&&`w-1/3 animate-pulse`),style:n.frpcDownload.percent==null?void 0:{width:`${n.frpcDownload.percent}%`}})}),n.frpcDownload.bytesReceived!=null&&n.frpcDownload.totalBytes?(0,$.jsxs)(`p`,{className:`text-fg-subtle`,children:[We(n.frpcDownload.bytesReceived),` /`,` `,We(n.frpcDownload.totalBytes)]}):null]}):null,e===`preparing_frpc`&&t===`active`&&n.frpcDownload?.url?(0,$.jsxs)(`p`,{className:`mt-2 text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`font-sans`,children:[r.frpcDownloadingUrlLabel,`: `]}),(0,$.jsx)(`a`,{href:n.frpcDownload.url,target:`_blank`,rel:`noopener noreferrer`,className:`break-all font-mono text-[11px] text-accent hover:underline`,children:n.frpcDownload.url})]}):null]})]},e)});t[20]===o?m=t[21]:(m=(0,$.jsx)(`ol`,{className:`space-y-2`,children:o}),t[20]=o,t[21]=m),h=e&&n.startProgress?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.startProgressElapsed.replace(`{{elapsed}}`,e)}):null,t[6]=n,t[7]=r,t[8]=l,t[9]=u,t[10]=p,t[11]=m,t[12]=h}else l=t[8],u=t[9],p=t[10],m=t[11],h=t[12];let g;t[22]!==l||t[23]!==r.publicUrlPendingNotice?(g=l?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.publicUrlPendingNotice}):null,t[22]=l,t[23]=r.publicUrlPendingNotice,t[24]=g):g=t[24];let _;return t[25]!==u||t[26]!==p||t[27]!==m||t[28]!==h||t[29]!==g?(_=(0,$.jsxs)(`div`,{className:u,children:[p,m,h,g]}),t[25]=u,t[26]=p,t[27]=m,t[28]=h,t[29]=g,t[30]=_):_=t[30],_}function Qe(e){return e+1}function $e(e,t){return t.state===`connected`?e.statusConnected:t.state===`error`?e.statusError:t.startProgress?.phase===`reconnecting_frpc`?e.statusReconnecting:t.startProgress?.phase===`starting_frpc`?e.statusStartingFrpc:t.startProgress?.phase===`registering`?e.statusRegistering:t.startProgress?.phase===`preparing_frpc`||t.frpcDownload?e.statusPreparingFrpc:t.state===`connecting`||t.state===`reconnecting`?e.statusConnecting:e.statusOff}function et(e){return e.state===`connected`?`connected`:e.state===`error`?`error`:e.state===`connecting`||e.state===`reconnecting`||e.startProgress||e.frpcDownload?`progress`:`off`}function tt(e){switch(e){case`connected`:return`bg-emerald-500/15 text-emerald-700 dark:text-emerald-400`;case`progress`:return`bg-amber-500/15 text-amber-700 dark:text-amber-400`;case`error`:return`bg-red-500/15 text-red-700 dark:text-red-400`;default:return`bg-surface-hover text-fg-muted`}}function nt(e){if(!e)return`—`;let t=Date.now()-new Date(e).getTime();if(t<0)return`—`;let n=Math.floor(t/6e4);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function rt(e){let t=(0,Q.c)(61),{t:n,status:r,isLoading:i,statusErr:a,starting:o,stopping:s,showConsentExpired:c,copyLabels:l,startDisabled:p,startDisabledReason:m,stepLabel:h,onStart:g,onStop:_}=e,v=p===void 0?!1:p,y,b,x,S,C,T,E;t[0]!==r||t[1]!==o?(E=et(r),y=r.enabled||o,b=o||r.state===`connecting`||r.state===`reconnecting`||!!r.startProgress||!!r.frpcDownload,t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=f(se(),`space-y-4`),t[9]=T):T=t[9],C=`flex flex-wrap items-start justify-between gap-3`,S=`flex items-center gap-2`,x=f(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium`,tt(E)),t[0]=r,t[1]=o,t[2]=y,t[3]=b,t[4]=x,t[5]=S,t[6]=C,t[7]=T,t[8]=E):(y=t[2],b=t[3],x=t[4],S=t[5],C=t[6],T=t[7],E=t[8]);let D=E===`connected`&&`bg-emerald-500`,O=E===`progress`&&`bg-amber-500 animate-pulse`,k=E===`error`&&`bg-red-500`,A=E===`off`&&`bg-fg-subtle`,j;t[10]!==D||t[11]!==O||t[12]!==k||t[13]!==A?(j=f(`size-1.5 rounded-full`,D,O,k,A),t[10]=D,t[11]=O,t[12]=k,t[13]=A,t[14]=j):j=t[14];let M;t[15]===j?M=t[16]:(M=(0,$.jsx)(`span`,{className:j,"aria-hidden":!0}),t[15]=j,t[16]=M);let N;t[17]!==i||t[18]!==r||t[19]!==n?(N=i&&!r.enabled?(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block h-3 w-16 animate-pulse rounded-full bg-surface-hover/70 motion-reduce:animate-none`}):$e(n,r),t[17]=i,t[18]=r,t[19]=n,t[20]=N):N=t[20];let P;t[21]!==M||t[22]!==N||t[23]!==x?(P=(0,$.jsxs)(`span`,{className:x,children:[M,N]}),t[21]=M,t[22]=N,t[23]=x,t[24]=P):P=t[24];let F;t[25]!==r.connectedSince||t[26]!==r.state||t[27]!==n.uptime?(F=r.connectedSince&&r.state===`connected`?(0,$.jsxs)(`span`,{className:`text-xs text-fg-subtle`,children:[n.uptime,` `,nt(r.connectedSince)]}):null,t[25]=r.connectedSince,t[26]=r.state,t[27]=n.uptime,t[28]=F):F=t[28];let I;t[29]!==P||t[30]!==F||t[31]!==S?(I=(0,$.jsxs)(`div`,{className:S,children:[P,F]}),t[29]=P,t[30]=F,t[31]=S,t[32]=I):I=t[32];let L;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(u,{className:`size-4 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[33]=L):L=t[33];let R;t[34]!==I||t[35]!==C?(R=(0,$.jsxs)(`div`,{className:C,children:[I,L]}),t[34]=I,t[35]=C,t[36]=R):R=t[36];let B;t[37]===a?B=t[38]:(B=a?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:a instanceof Error?a.message:String(a)}):null,t[37]=a,t[38]=B);let H;t[39]!==c||t[40]!==n.consentExpiredBanner?(H=c?(0,$.jsx)(`p`,{className:`rounded-lg bg-amber-500/10 px-3 py-2 text-xs text-fg-muted`,children:n.consentExpiredBanner}):null,t[39]=c,t[40]=n.consentExpiredBanner,t[41]=H):H=t[41];let ee;t[42]!==y||t[43]!==l||t[44]!==g||t[45]!==_||t[46]!==b||t[47]!==r||t[48]!==v||t[49]!==m||t[50]!==o||t[51]!==h||t[52]!==s||t[53]!==n?(ee=y?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[r.publicUrl?(0,$.jsx)(`div`,{className:`rounded-xl bg-surface-panel/80 p-3 shadow-surface`,children:(0,$.jsx)(z,{label:n.publicUrlLabel,text:r.publicUrl,labels:l})}):null,b?(0,$.jsx)(Ze,{status:r,t:n}):null,r.lastError&&r.state===`error`?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:r.lastError}):null,(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.enabled?(0,$.jsxs)(w,{type:`button`,variant:`secondary`,disabled:s,onClick:_,children:[s?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,n.stop]}):(0,$.jsxs)(w,{type:`button`,disabled:o,onClick:g,children:[o?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(V,{className:`size-4`}),n.start]})})]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[h?(0,$.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:h}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.emptyStateTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:n.emptyStateBody})]}),(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg bg-amber-500/10 px-3 py-2.5 text-xs text-fg-muted`,children:[(0,$.jsx)(U,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-400`}),(0,$.jsx)(`p`,{children:n.riskBannerBody})]}),v&&m?(0,$.jsx)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200`,children:m}):null,(0,$.jsxs)(w,{type:`button`,disabled:o||v,onClick:g,className:`w-full sm:w-auto`,children:[o?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(V,{className:`size-4`}),n.start]})]}),t[42]=y,t[43]=l,t[44]=g,t[45]=_,t[46]=b,t[47]=r,t[48]=v,t[49]=m,t[50]=o,t[51]=h,t[52]=s,t[53]=n,t[54]=ee):ee=t[54];let te;return t[55]!==R||t[56]!==B||t[57]!==H||t[58]!==ee||t[59]!==T?(te=(0,$.jsxs)(`section`,{className:T,children:[R,B,H,ee]}),t[55]=R,t[56]=B,t[57]=H,t[58]=ee,t[59]=T,t[60]=te):te=t[60],te}var it={reconfiguring:!1};function at(e){let t=(0,Q.c)(89),{t:n,brokerSecretReady:r,brokerSecretConfiguredInConfig:i,brokerSecretMaskedValue:a,brokerSecretDraft:o,savingBrokerSecret:c,authorizingBrokerSecret:u,brokerSecretAuthorizationUrl:p,brokerSecretNotice:m,copyFailedLabel:h,onDraftChange:g,onSave:_,onAuthorize:v,onClear:y,sectionRef:b}=e,x=(0,Z.useId)(),S=r,C=!S,[T,E]=(0,Z.useReducer)(ee,it),{reconfiguring:D}=T,O;t[0]!==i||t[1]!==o||t[2]!==D?(O=i&&!D&&!o.trim(),t[0]=i,t[1]=o,t[2]=D,t[3]=O):O=t[3];let A=O,j;t[4]!==n.copied||t[5]!==n.copyKey||t[6]!==n.hideKey||t[7]!==n.showKey?(j={show:n.showKey,hide:n.hideKey,copy:n.copyKey,copied:n.copied},t[4]=n.copied,t[5]=n.copyKey,t[6]=n.hideKey,t[7]=n.showKey,t[8]=j):j=t[8];let M=j,N;t[9]===o?N=t[10]:(N=o.trim().length>0&&!k(o.trim()),t[9]=o,t[10]=N);let P=N,F;t[11]===g?F=t[12]:(F=()=>{E({type:`patch`,patch:{reconfiguring:!1}}),g(``)},t[11]=g,t[12]=F);let I=F,R=C&&`ring-1 ring-amber-500/30`,z;t[13]===R?z=t[14]:(z=f(R),t[13]=R,t[14]=z);let B=S?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:C?`bg-amber-500/10 text-amber-700 dark:text-amber-400`:`bg-surface-hover text-fg-muted`,V;t[15]===B?V=t[16]:(V=f(`flex size-9 shrink-0 items-center justify-center rounded-lg`,B),t[15]=B,t[16]=V);let H;t[17]===S?H=t[18]:(H=S?(0,$.jsx)(s,{className:`size-4`,strokeWidth:2,"aria-hidden":!0}):(0,$.jsx)(L,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[17]=S,t[18]=H);let U;t[19]!==V||t[20]!==H?(U=(0,$.jsx)(`span`,{className:V,children:H}),t[19]=V,t[20]=H,t[21]=U):U=t[21];let te=S?n.brokerSecretReadyTitle:n.brokerSecretStepTitle,W;t[22]===te?W=t[23]:(W=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:te}),t[22]=te,t[23]=W);let G=S?n.brokerSecretReadyHint:n.brokerSecretHint,K;t[24]===G?K=t[25]:(K=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:G}),t[24]=G,t[25]=K);let re;t[26]!==C||t[27]!==n.brokerSecretMissingHint?(re=C?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-amber-800 dark:text-amber-200`,children:n.brokerSecretMissingHint}):null,t[26]=C,t[27]=n.brokerSecretMissingHint,t[28]=re):re=t[28];let ie;t[29]!==W||t[30]!==K||t[31]!==re?(ie=(0,$.jsxs)(`div`,{children:[W,K,re]}),t[29]=W,t[30]=K,t[31]=re,t[32]=ie):ie=t[32];let ae;t[33]!==u||t[34]!==C||t[35]!==v||t[36]!==D||t[37]!==c||t[38]!==n.brokerSecretAuthorize||t[39]!==n.brokerSecretAuthorizing||t[40]!==n.brokerSecretConsoleLink?(ae=C||D?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(w,{type:`button`,disabled:c||u,onClick:v,children:[u?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,u?n.brokerSecretAuthorizing:n.brokerSecretAuthorize]}),(0,$.jsxs)(`a`,{href:X,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[n.brokerSecretConsoleLink,(0,$.jsx)(l,{className:`size-3`,"aria-hidden":!0})]})]}):null,t[33]=u,t[34]=C,t[35]=v,t[36]=D,t[37]=c,t[38]=n.brokerSecretAuthorize,t[39]=n.brokerSecretAuthorizing,t[40]=n.brokerSecretConsoleLink,t[41]=ae):ae=t[41];let q;t[42]!==u||t[43]!==p||t[44]!==n.brokerSecretOpenAuthorization?(q=u&&p?(0,$.jsxs)(`a`,{href:p,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,children:[n.brokerSecretOpenAuthorization,(0,$.jsx)(l,{className:`size-3`,"aria-hidden":!0})]}):null,t[42]=u,t[43]=p,t[44]=n.brokerSecretOpenAuthorization,t[45]=q):q=t[45];let oe;t[46]!==i||t[47]!==o||t[48]!==a||t[49]!==P||t[50]!==I||t[51]!==h||t[52]!==x||t[53]!==C||t[54]!==y||t[55]!==g||t[56]!==_||t[57]!==D||t[58]!==c||t[59]!==M||t[60]!==A||t[61]!==n.brokerSecretCancelReconfigure||t[62]!==n.brokerSecretClear||t[63]!==n.brokerSecretMaskedHelp||t[64]!==n.brokerSecretNotInConfigFile||t[65]!==n.brokerSecretPlaceholder||t[66]!==n.brokerSecretReconfigure||t[67]!==n.brokerSecretRevealFailed||t[68]!==n.brokerSecretSave||t[69]!==n.brokerSecretSaveAndContinue||t[70]!==n.brokerSecretTitle?(oe=A?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:x,children:n.brokerSecretTitle}),(0,$.jsx)(ne,{id:x,value:a,labels:M,reveal:ot,loadFailedLabel:h||n.brokerSecretRevealFailed,maskedHelp:n.brokerSecretMaskedHelp,notInConfigFile:n.brokerSecretNotInConfigFile,readOnly:!0}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(w,{type:`button`,variant:`secondary`,disabled:c,onClick:()=>{E({type:`patch`,patch:{reconfiguring:!0}})},children:n.brokerSecretReconfigure}),(0,$.jsx)(w,{type:`button`,variant:`ghost`,disabled:c,onClick:y,children:n.brokerSecretClear})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:x,children:n.brokerSecretTitle}),(0,$.jsx)(ne,{id:x,value:o,onChange:g,placeholder:n.brokerSecretPlaceholder,labels:M,disabled:c}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(w,{type:`button`,disabled:c||!P,onClick:_,children:[c?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,C?n.brokerSecretSaveAndContinue:n.brokerSecretSave]}),i?(0,$.jsx)(w,{type:`button`,variant:`ghost`,disabled:c,onClick:y,children:n.brokerSecretClear}):null,D?(0,$.jsx)(w,{type:`button`,variant:`ghost`,disabled:c,onClick:I,children:n.brokerSecretCancelReconfigure}):null]})]}),t[46]=i,t[47]=o,t[48]=a,t[49]=P,t[50]=I,t[51]=h,t[52]=x,t[53]=C,t[54]=y,t[55]=g,t[56]=_,t[57]=D,t[58]=c,t[59]=M,t[60]=A,t[61]=n.brokerSecretCancelReconfigure,t[62]=n.brokerSecretClear,t[63]=n.brokerSecretMaskedHelp,t[64]=n.brokerSecretNotInConfigFile,t[65]=n.brokerSecretPlaceholder,t[66]=n.brokerSecretReconfigure,t[67]=n.brokerSecretRevealFailed,t[68]=n.brokerSecretSave,t[69]=n.brokerSecretSaveAndContinue,t[70]=n.brokerSecretTitle,t[71]=oe):oe=t[71];let J;t[72]===m?J=t[73]:(J=m?(0,$.jsx)(`p`,{className:`text-xs text-emerald-700 dark:text-emerald-400`,children:m}):null,t[72]=m,t[73]=J);let se;t[74]!==ie||t[75]!==ae||t[76]!==q||t[77]!==oe||t[78]!==J?(se=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[ie,ae,q,oe,J]}),t[74]=ie,t[75]=ae,t[76]=q,t[77]=oe,t[78]=J,t[79]=se):se=t[79];let Y;t[80]!==U||t[81]!==se?(Y=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[U,se]}),t[80]=U,t[81]=se,t[82]=Y):Y=t[82];let le;t[83]!==Y||t[84]!==z?(le=(0,$.jsx)(ce,{className:z,children:Y}),t[83]=Y,t[84]=z,t[85]=le):le=t[85];let ue;return t[86]!==b||t[87]!==le?(ue=(0,$.jsx)(`div`,{ref:b,id:`tunnel-broker-secret-setup`,children:le}),t[86]=b,t[87]=le,t[88]=ue):ue=t[88],ue}function ot(){return he().then(st)}function st(e){return e.registrationSecret??null}var ct={actionError:null,starting:!1,stopping:!1,savingAutoStart:!1,consentOpen:!1,autoStartConfirmOpen:!1,releaseConfirmOpen:!1,releasing:!1,brokerSecretDraft:``,savingBrokerSecret:!1,authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null};function lt({embedded:e=!1}){let t=m(e=>e.language),n=h(t).tunnelSettings,r=!!p(e=>e.conversationId),[i,a]=(0,Z.useReducer)(ee,ct),{actionError:o,starting:s,stopping:c,savingAutoStart:l,consentOpen:g,autoStartConfirmOpen:_,releaseConfirmOpen:v,releasing:y,brokerSecretDraft:b,savingBrokerSecret:x,authorizingBrokerSecret:S,brokerSecretAuthorizationUrl:D,brokerSecretNotice:O}=i,j=(0,Z.useRef)(null),{data:P}=E(r),{data:I,error:L,isLoading:R,mutate:z}=C(r?`tunnel-status`:null,me,{refreshInterval:e=>s?1e3:e?.frpcDownload||e?.state===`connecting`||e?.state===`reconnecting`?2e3:6e4}),V=(0,Z.useMemo)(()=>{let e=P?.payload?.config;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.tunnel;if(t&&typeof t==`object`&&!Array.isArray(t)&&t.autoStart===!0)return!0}return I?.config?.autoStart===!0},[P,I?.config?.autoStart]),H=(0,Z.useMemo)(()=>{let e=P?.payload?.config;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e.tunnel;if(t&&typeof t==`object`&&!Array.isArray(t)){let e=t.registrationSecret;if(typeof e==`string`)return e}}return``},[P]),U=k(H),ne=I?.registrationSecret?.configured??U;(0,Z.useEffect)(()=>{let e=()=>{z()};return window.addEventListener(`tunnel-status`,e),()=>window.removeEventListener(`tunnel-status`,e)},[z]);let W=(0,Z.useMemo)(()=>[n.consentBullet1,n.consentBullet2,n.consentBullet3],[n.consentBullet1,n.consentBullet2,n.consentBullet3]),G=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{starting:!0}});try{await _e(),await z(),T()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{starting:!1}})}},[z]),K=(0,Z.useCallback)(()=>{if(!ne){a({type:`patch`,patch:{actionError:n.brokerSecretRequiredBeforeStart}}),j.current?.scrollIntoView({behavior:`smooth`,block:`start`});return}if(I?.consentRequired){a({type:`patch`,patch:{consentOpen:!0}});return}G()},[ne,I?.consentRequired,G,n.brokerSecretRequiredBeforeStart]),ie=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{consentOpen:!1}}),a({type:`patch`,patch:{actionError:null}});try{await le(),await Promise.all([z(),G()])}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}},[z,G]),ae=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{actionError:null}}),a({type:`patch`,patch:{stopping:!0}});try{await de(),await z(),T()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{stopping:!1}})}},[z]),q=(0,Z.useCallback)(async e=>{a({type:`patch`,patch:{savingAutoStart:!0}}),a({type:`patch`,patch:{actionError:null}});try{await ge({autoStart:e}),T()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingAutoStart:!1}})}},[]),oe=(0,Z.useCallback)(()=>{if(V){q(!1);return}if(I?.consentRequired){a({type:`patch`,patch:{actionError:n.consentExpiredBanner}});return}if(!I?.canAutoStart){a({type:`patch`,patch:{actionError:n.autoStartHint}});return}a({type:`patch`,patch:{autoStartConfirmOpen:!0}})},[q,I?.canAutoStart,I?.consentRequired,n,V]),J=(0,Z.useCallback)(async()=>{let e=b.trim();if(e){a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await ge({registrationSecret:e}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretSaved}}),T(),await z(),a({type:`patch`,patch:{actionError:null}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingBrokerSecret:!1}})}}},[b,z,n.brokerSecretSaved]),se=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await ge({registrationSecret:null}),a({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretCleared}}),T(),await z()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{savingBrokerSecret:!1}})}},[z,n.brokerSecretCleared]),ue=(0,Z.useCallback)(async()=>{let e=F(),t=null,r=null;a({type:`patch`,patch:{authorizingBrokerSecret:!0,brokerSecretAuthorizationUrl:null,brokerSecretNotice:null,actionError:null}});try{for(t=(await N(`xopc-tunnel`)).sessionId;;){await new Promise(e=>window.setTimeout(e,1e3));let i=await re(t);if(i.authUrl&&i.authUrl!==r&&(r=i.authUrl,a({type:`patch`,patch:{brokerSecretAuthorizationUrl:i.authUrl}}),await B(i.authUrl,e)),i.status===`failed`||i.status===`cancelled`)throw Error(i.error??i.message??`OAuth authorization failed`);if(i.status===`completed`){await pe(),await Promise.all([z(),T()]),a({type:`patch`,patch:{brokerSecretNotice:n.brokerSecretSaved,brokerSecretDraft:``}});return}}}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{A(e),t&&M(t).catch(()=>void 0),a({type:`patch`,patch:{authorizingBrokerSecret:!1,brokerSecretAuthorizationUrl:null}})}},[z,n.brokerSecretSaved]),fe=(0,Z.useCallback)(async()=>{a({type:`patch`,patch:{releaseConfirmOpen:!1,actionError:null,releasing:!0}});try{await de({release:!0}),await z(),T()}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{a({type:`patch`,patch:{releasing:!1}})}},[z]),he=(0,Z.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:h(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]);if(!r)return(0,$.jsx)(`div`,{className:e?void 0:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})});let X=I??{enabled:!1,state:`disconnected`,subdomain:null,publicUrl:null,connectedSince:null,frpcPid:null,lastHeartbeatAt:null,lastError:null,consentRequired:!0,config:{autoStart:V,brokerUrl:`https://frp.xopc.ai/api`}},ve=I?.consentRequired&&(X.enabled||V||I?.consent?.acceptedAt),ye=(0,$.jsx)(at,{t:n,brokerSecretReady:ne,brokerSecretConfiguredInConfig:U,brokerSecretMaskedValue:U?H:``,brokerSecretDraft:b,savingBrokerSecret:x,authorizingBrokerSecret:S,brokerSecretAuthorizationUrl:D,brokerSecretNotice:O,copyFailedLabel:h(t).clipboard.copyFailed,onDraftChange:e=>a({type:`patch`,patch:{brokerSecretDraft:e}}),onSave:()=>void J(),onAuthorize:()=>void ue(),onClear:()=>void se(),sectionRef:j}),be=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ve,{open:g,title:n.consentTitle,intro:n.consentIntro,bullets:W,checkboxLabel:n.consentCheckbox,confirmLabel:ve?n.consentReconfirm:n.consentConfirm,cancelLabel:n.consentCancel,onConfirm:()=>void ie(),onCancel:()=>a({type:`patch`,patch:{consentOpen:!1}})},g?`consent-open`:`consent-closed`),(0,$.jsx)(te,{open:_,title:n.autoStartConfirmTitle,description:n.autoStartConfirmBody,confirmLabel:n.autoStartConfirmLabel,cancelLabel:n.consentCancel,onConfirm:()=>{a({type:`patch`,patch:{autoStartConfirmOpen:!1}}),q(!0)},onCancel:()=>a({type:`patch`,patch:{autoStartConfirmOpen:!1}})}),(0,$.jsx)(te,{open:v,title:n.releaseConfirmTitle,description:n.releaseConfirmBody,confirmLabel:n.releaseConfirmLabel,cancelLabel:n.consentCancel,destructive:!0,onConfirm:()=>void fe(),onCancel:()=>a({type:`patch`,patch:{releaseConfirmOpen:!1}})})]});return e?(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[o?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o}):null,ye,(0,$.jsx)(rt,{t:n,status:X,isLoading:R,statusErr:L,starting:s,stopping:c,showConsentExpired:!!ve,copyLabels:he,startDisabled:!ne,startDisabledReason:ne?void 0:n.brokerSecretRequiredBeforeStart,stepLabel:n.flowStepStart,onStart:K,onStop:()=>void ae()}),(0,$.jsxs)(ze,{showLabel:n.showOptions,hideLabel:n.hideOptions,children:[(0,$.jsxs)(`label`,{className:f(`flex items-center gap-3 text-sm text-fg`,!V&&!I?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:V,disabled:l||!V&&!I?.canAutoStart,onChange:oe}),n.autoStart]}),!I?.canAutoStart&&!V?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.autoStartHint}):null,X.subdomain||X.publicUrl?(0,$.jsxs)(`div`,{className:`space-y-2 rounded-xl bg-surface-base/45 p-4`,children:[(0,$.jsxs)(w,{type:`button`,variant:`secondary`,disabled:y||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[y?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,n.release]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint})]}):null]}),(0,$.jsx)(ze,{showLabel:n.showAdvanced,hideLabel:n.hideAdvanced,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-base/45 p-4 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(Y,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]})}),be]}):(0,$.jsxs)(`div`,{className:e?`flex w-full flex-col gap-6`:`flex w-full flex-col gap-6 px-3 py-8 sm:px-5 xl:px-6`,children:[e?null:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:n.title}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.subtitle})]}),o?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o}):null,ye,(0,$.jsx)(rt,{t:n,status:X,isLoading:R,statusErr:L,starting:s,stopping:c,showConsentExpired:!!ve,copyLabels:he,startDisabled:!ne,startDisabledReason:ne?void 0:n.brokerSecretRequiredBeforeStart,onStart:K,onStop:()=>void ae()}),X.subdomain||X.publicUrl?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,$.jsxs)(w,{type:`button`,variant:`secondary`,disabled:y||c,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>a({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[y?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,n.release]})}):null,X.subdomain||X.publicUrl?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint}):null,(0,$.jsxs)(ce,{children:[(0,$.jsx)(`h2`,{className:`mb-3 text-sm font-semibold text-fg`,children:n.optionsTitle}),(0,$.jsxs)(`label`,{className:f(`flex items-center gap-3 text-sm text-fg`,!V&&!I?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:V,disabled:l||!V&&!I?.canAutoStart,onChange:oe}),n.autoStart]}),!I?.canAutoStart&&!V?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n.autoStartHint}):null]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 text-xs text-fg-subtle shadow-surface`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)(Y,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]}),be]})}function ut(e,t){return e.tabs[t]}function dt(e,t){return e.tabIntro[t]}function ft(e){switch(e){case`tailscale`:return`tailscale-serve`;case`public`:return`public-tunnel`;case`reverse-proxy`:return`reverse-proxy`;case`ssh`:return`ssh-tunnel`;case`lan`:return`lan`;default:return}}function pt(e){let t=(0,Q.c)(7),{tab:n,onOpenTab:r}=e;switch(n){case`guide`:{let e;return t[0]===r?e=t[1]:(e=(0,$.jsx)(Oe,{onOpenTab:r}),t[0]=r,t[1]=e),e}case`tailscale`:{let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ue,{embedded:!0}),t[2]=e):e=t[2],e}case`public`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(lt,{embedded:!0}),t[3]=e):e=t[3],e}case`reverse-proxy`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ye,{}),t[4]=e):e=t[4],e}case`ssh`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ie,{}),t[5]=e):e=t[5],e}case`lan`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Me,{}),t[6]=e):e=t[6],e}}}function mt(){let e=(0,Q.c)(3),t=i(),n=m(gt),r=h(n).remoteAccess,o=!!p(ht),[s,c]=a(),l=Re(s.get(`tab`)),u=s.get(`intent`)===`mobile-pairing`,d;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(d={refreshInterval:2e3},e[0]=d):d=e[0];let f=C(u?`device-pairing-readiness`:null,fe,d),g;e[1]===c?g=e[2]:(g=e=>{c(t=>{let n=new URLSearchParams(t);return e===`guide`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[1]=c,e[2]=g);let _=g,v=dt(r,l),y=Le.map(e=>({id:e,label:ut(r,e)}));return(0,$.jsxs)(q,{children:[(0,$.jsx)(ae,{title:r.pageTitle,meta:(0,$.jsx)(Y,{language:n,label:r.docsLink,section:ft(l),className:`mt-1`})}),o?(0,$.jsxs)($.Fragment,{children:[u?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl bg-accent-soft px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(ie,{className:`mt-0.5 size-5 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.mobilePairingFlow.title}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:f.data?.ready?r.mobilePairingFlow.ready:r.mobilePairingFlow.hint})]})]}),(0,$.jsxs)(w,{variant:`primary`,disabled:!f.data?.ready,onClick:()=>t(`/settings/devices?startDevicePairing=mobile`),children:[f.data?.ready?r.mobilePairingFlow.continue:r.mobilePairingFlow.waiting,(0,$.jsx)(H,{className:`size-4`,"aria-hidden":!0})]})]}):null,(0,$.jsx)(be,{items:y,activeTab:l,onChange:_,ariaLabel:r.tabsAria,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`}),(0,$.jsx)(oe,{id:l,activeTab:l,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`,title:ut(r,l),hint:l===`public`?void 0:v,showHeading:!1,framed:!1,children:(0,$.jsx)(pt,{tab:l,onOpenTab:_})})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.guide.needToken})]})}function ht(e){return e.conversationId}function gt(e){return e.language}export{mt as RemoteAccessHub};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r,r as i}from"./popover-select-DldSX8GX.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./download-Dk-ZjtO6.js";import{a as s,i as c,n as l,r as u}from"./locale-store-DLK05Y1a.js";import{t as d}from"./messages-C9h8SImu.js";import{i as f}from"./vendor-swr-BIWyz7Rc.js";import{t as p}from"./button-CGlRPNzi.js";import{Fc as m,Ic as h,Mu as g}from"./index-hlU8MUEz.js";import{n as _,r as v}from"./settings-page-layout-X1x-2Cp9.js";import{n as y}from"./settings-loading-skeleton-CAmWMaOT.js";import{t as b}from"./settings-advanced-gate-DDALROy_.js";var x=e(t(),1);async function S(e){await s(u(`/api/runtime-tools/config`),{method:`PATCH`,body:JSON.stringify(e)})}async function C(){return(await s(u(`/api/runtime-tools/prune`),{method:`POST`})).payload}async function w(e){let t=await c(u(`/api/runtime-tools/${e.runtime}/${e.action}/stream`),{method:`POST`,headers:{Accept:`text/event-stream`},body:JSON.stringify({version:e.version})});if(!t.ok||!t.body)throw Error(`HTTP ${t.status}`);let n=t.body.getReader(),r=new TextDecoder,i=``,a=!1;try{for(;!a;){let{done:t,value:o}=await n.read();if(t)break;i+=r.decode(o,{stream:!0}).replace(/\r\n/g,`
|
|
2
|
+
`);let s=i.split(`
|
|
3
|
+
|
|
4
|
+
`);i=s.pop()??``;for(let t of s){let n=``,r=``;for(let e of t.split(`
|
|
5
|
+
`))e.startsWith(`event:`)&&(n=e.slice(6).trim()),e.startsWith(`data:`)&&(r+=e.slice(5).trimStart());if(!r)continue;let i=JSON.parse(r);if(n===`progress`&&e.onProgress(i),n===`result`&&(a=!0,!i.ok))throw Error(i.message??`${e.action} failed`)}}}finally{n.releaseLock()}if(!a)throw Error(`Runtime operation ended without a result`)}var T=n(),E=[`node`,`python`,`uv`];function D(){let e=d(l(e=>e.language)).runtimeToolsSettings,{data:t,error:n,isLoading:s,mutate:c}=f(u(`/api/runtime-tools`)),[D,O]=(0,x.useState)(null),[k,A]=(0,x.useState)(!1),[j,M]=(0,x.useState)(!1),[N,P]=(0,x.useState)(null),[F,I]=(0,x.useState)({}),[L,R]=(0,x.useState)(null);if((0,x.useEffect)(()=>{t?.payload.config&&O(structuredClone(t.payload.config))},[t?.payload.config]),n)return(0,T.jsxs)(v,{children:[(0,T.jsx)(_,{title:e.title,subtitle:e.loadError}),(0,T.jsx)(p,{onClick:()=>void c(),children:e.refresh})]});if(s||!D)return(0,T.jsx)(v,{children:(0,T.jsx)(y,{sections:3})});let z=new Map(t?.payload.statuses.map(e=>[e.runtime,e])),B=(e,t)=>O(n=>n&&{...n,[e]:{...n[e],...t}}),V=async()=>{A(!0),R(null);try{await S(D),await c()}catch(e){R(e instanceof Error?e.message:String(e))}finally{A(!1)}},H=async(e,t)=>{P(e),R(null);try{await S(D),await w({runtime:e,action:t,version:e===`uv`?D.uv.version:D[e].version,onProgress:t=>I(n=>({...n,[e]:t}))}),await c()}catch(e){R(e instanceof Error?e.message:String(e))}finally{P(null)}},U=async()=>{M(!0),R(null);try{await C(),await c()}catch(e){R(e instanceof Error?e.message:String(e))}finally{M(!1)}};return(0,T.jsxs)(v,{gap:`gap-6`,children:[(0,T.jsx)(_,{title:e.title,actions:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(p,{onClick:()=>void c(),disabled:N!==null,children:[(0,T.jsx)(h,{className:`size-4`}),e.refresh]}),(0,T.jsx)(p,{onClick:()=>void U(),disabled:j||N!==null,children:j?e.pruning:e.prune}),(0,T.jsx)(p,{variant:`primary`,onClick:()=>void V(),disabled:k||N!==null,children:k?e.saving:e.save})]})}),L?(0,T.jsx)(`div`,{className:`rounded-xl bg-danger/10 px-4 py-3 text-sm text-danger`,children:L}):null,(0,T.jsx)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:(0,T.jsxs)(`label`,{className:`flex items-center justify-between gap-4`,children:[(0,T.jsxs)(`span`,{children:[(0,T.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.enabled}),(0,T.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.enabledHint})]}),(0,T.jsx)(`input`,{type:`checkbox`,checked:D.enabled,onChange:e=>O({...D,enabled:e.target.checked}),className:`size-4 accent-accent`})]})}),(0,T.jsx)(b,{children:(0,T.jsxs)(`section`,{className:`grid gap-4 rounded-xl bg-surface-hover/20 p-4 md:grid-cols-2`,children:[(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.downloadSource,(0,T.jsxs)(r,{value:D.download.source,onChange:e=>O({...D,download:{...D.download,source:e.target.value}}),children:[(0,T.jsx)(i,{value:`auto`,children:e.downloadSources.auto}),(0,T.jsx)(i,{value:`website-only`,children:e.downloadSources.websiteOnly}),(0,T.jsx)(i,{value:`direct-only`,children:e.downloadSources.directOnly})]})]}),(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.gatewayBaseUrl,(0,T.jsx)(`input`,{value:D.download.gatewayBaseUrl,disabled:D.download.source===`direct-only`,onChange:e=>O({...D,download:{...D.download,gatewayBaseUrl:e.target.value}}),className:`h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-edge-strong disabled:opacity-50`})]}),(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.offlineBundle,(0,T.jsx)(`input`,{value:D.download.bundleDir??``,placeholder:e.offlineBundlePlaceholder,onChange:e=>O({...D,download:{...D.download,bundleDir:e.target.value||void 0}}),className:`h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-edge-strong`})]}),(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.proxy,(0,T.jsx)(`input`,{value:D.download.proxy??``,placeholder:`http://127.0.0.1:7890`,onChange:e=>O({...D,download:{...D.download,proxy:e.target.value||void 0}}),className:`h-10 w-full rounded-lg border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-edge-strong`})]})]})}),(0,T.jsx)(`div`,{className:`grid gap-4 xl:grid-cols-3`,children:E.map(t=>{let n=z.get(t),s=n?.state===`ready`,c=F[t],l=t===`uv`?D.uv:D[t];return(0,T.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-4 rounded-xl bg-surface-base/55 p-4`,children:[(0,T.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:e.runtimeNames[t]}),(0,T.jsx)(`p`,{className:`mt-1 break-words text-xs text-fg-muted`,children:n?.message??e.unknown})]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s?(0,T.jsx)(a,{className:`size-5 shrink-0 text-success`}):(0,T.jsx)(g,{className:`size-5 shrink-0 text-warning`}),(0,T.jsx)(`input`,{type:`checkbox`,"aria-label":`${e.runtimeNames[t]} ${e.enabled}`,checked:l.enabled,onChange:e=>{t===`uv`?O({...D,uv:{...D.uv,enabled:e.target.checked}}):B(t,{enabled:e.target.checked})},className:`size-4 accent-accent`})]})]}),(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.version,(0,T.jsx)(`input`,{value:l.version??``,placeholder:n?.requestedVersion,onChange:e=>{let n=e.target.value||void 0;t===`uv`?O({...D,uv:{...D.uv,version:n}}):B(t,{version:n})},className:`h-10 w-full rounded-lg border border-edge bg-surface-subtle px-3 text-sm text-fg outline-none focus:border-edge-strong`})]}),t===`uv`?null:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.sourcePolicy,(0,T.jsxs)(r,{value:D[t].preference,onChange:e=>B(t,{preference:e.target.value}),children:[(0,T.jsx)(i,{value:`managed-first`,children:e.preferences.managedFirst}),(0,T.jsx)(i,{value:`system-first`,children:e.preferences.systemFirst}),(0,T.jsx)(i,{value:`managed-only`,children:e.preferences.managedOnly}),(0,T.jsx)(i,{value:`system-only`,children:e.preferences.systemOnly})]})]}),(0,T.jsxs)(`label`,{className:`space-y-1.5 text-xs font-medium text-fg-muted`,children:[e.provisionPolicy,(0,T.jsxs)(r,{value:D[t].provision,onChange:e=>B(t,{provision:e.target.value}),children:[(0,T.jsx)(i,{value:`eager`,children:e.provisions.eager}),(0,T.jsx)(i,{value:`on-demand`,children:e.provisions.onDemand}),(0,T.jsx)(i,{value:`disabled`,children:e.provisions.disabled})]})]})]}),c&&N===t?(0,T.jsxs)(`div`,{className:`rounded-lg bg-accent-soft px-3 py-2 text-xs text-accent-fg`,children:[c.message,c.totalBytes&&c.downloadedBytes?` · ${Math.round(c.downloadedBytes/c.totalBytes*100)}%`:``]}):null,(0,T.jsxs)(`div`,{className:`mt-auto flex gap-2`,children:[(0,T.jsxs)(p,{variant:`primary`,disabled:!D.enabled||!l.enabled||N!==null,onClick:()=>void H(t,`install`),children:[(0,T.jsx)(o,{className:`size-4`}),N===t?e.working:e.install]}),n?.repairable?(0,T.jsxs)(p,{disabled:!D.enabled||!l.enabled||N!==null,onClick:()=>void H(t,`repair`),children:[(0,T.jsx)(m,{className:`size-4`}),e.repair]}):null]}),(0,T.jsx)(b,{children:n?.resolved?.executable?(0,T.jsx)(`code`,{className:`break-all text-[11px] text-fg-subtle`,children:n.resolved.executable}):null})]},t)})})]})}export{D as RuntimeToolsSettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r,r as i}from"./popover-select-DldSX8GX.js";import{t as a}from"./cn-JdwAhgNB.js";import{Oo as o,jo as s}from"./index-54o0AGdj.js";var c=t();e();var l=n();function u(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function d(e){let t=e[`x-order`];return typeof t==`number`&&!Number.isNaN(t)?t:999}function f(e){let t=e[`x-group`];return typeof t==`string`&&t.length>0?t:``}function p(e){return e[`x-hidden`]===!0}function m(e){let t=e.properties;if(!u(t))return[];let n=[];for(let[e,r]of Object.entries(t))u(r)&&(p(r)||n.push({key:e,sub:r,order:d(r),group:f(r),hidden:!1}));return n.sort((e,t)=>e.order-t.order||e.key.localeCompare(t.key)),n}function h(e){let t=new Map;for(let n of e){let e=n.group;t.has(e)||t.set(e,[]),t.get(e).push(n)}return t}function g(e){let t=(0,c.c)(38),{name:n,s:i,value:a,onChange:u,disabled:d}=e,f=typeof i.description==`string`?i.description:void 0,p=(typeof i[`x-placeholder`]==`string`?i[`x-placeholder`]:null)||f,m=i.format;if(Array.isArray(i.enum)&&i.enum.every(v)){let e;t[0]===f?e=t[1]:(e=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[0]=f,t[1]=e);let o;t[2]===u?o=t[3]:(o=e=>u(e.target.value),t[2]=u,t[3]=o);let s;t[4]===i.enum?s=t[5]:(s=i.enum.map(_),t[4]=i.enum,t[5]=s);let c;t[6]!==d||t[7]!==n||t[8]!==o||t[9]!==s||t[10]!==a?(c=(0,l.jsx)(r,{name:n,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:a,disabled:d,onChange:o,children:s}),t[6]=d,t[7]=n,t[8]=o,t[9]=s,t[10]=a,t[11]=c):c=t[11];let p;return t[12]!==e||t[13]!==c?(p=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,c]}),t[12]=e,t[13]=c,t[14]=p):p=t[14],p}if(m===`password`){let e;t[15]===f?e=t[16]:(e=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[15]=f,t[16]=e);let n;t[17]!==d||t[18]!==u||t[19]!==p||t[20]!==a?(n=(0,l.jsx)(s,{value:a,onChange:u,placeholder:p,labels:o,disabled:d,inputClassName:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`}),t[17]=d,t[18]=u,t[19]=p,t[20]=a,t[21]=n):n=t[21];let r;return t[22]!==e||t[23]!==n?(r=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,n]}),t[22]=e,t[23]=n,t[24]=r):r=t[24],r}let h;t[25]===f?h=t[26]:(h=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[25]=f,t[26]=h);let g;t[27]===u?g=t[28]:(g=e=>u(e.target.value),t[27]=u,t[28]=g);let y;t[29]!==d||t[30]!==n||t[31]!==p||t[32]!==g||t[33]!==a?(y=(0,l.jsx)(`input`,{name:n,type:`text`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`,value:a,placeholder:p,disabled:d,onChange:g}),t[29]=d,t[30]=n,t[31]=p,t[32]=g,t[33]=a,t[34]=y):y=t[34];let b;return t[35]!==h||t[36]!==y?(b=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[h,y]}),t[35]=h,t[36]=y,t[37]=b):b=t[37],b}function _(e){return(0,l.jsx)(i,{value:e,children:e},e)}function v(e){return typeof e==`string`}function y(e){let t=(0,c.c)(11),{s:n,value:r,onChange:i,disabled:a}=e,o=typeof n.description==`string`?n.description:void 0,s;t[0]===o?s=t[1]:(s=o?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:o}):null,t[0]=o,t[1]=s);let u=Number.isFinite(r)?r:0,d;t[2]===i?d=t[3]:(d=e=>i(Number(e.target.value)),t[2]=i,t[3]=d);let f;t[4]!==a||t[5]!==u||t[6]!==d?(f=(0,l.jsx)(`input`,{type:`number`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg`,value:u,disabled:a,onChange:d}),t[4]=a,t[5]=u,t[6]=d,t[7]=f):f=t[7];let p;return t[8]!==s||t[9]!==f?(p=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s,f]}),t[8]=s,t[9]=f,t[10]=p):p=t[10],p}function b(e){let t=(0,c.c)(11),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=(typeof n.description==`string`?n.description:void 0)??(typeof n.title==`string`&&n.title.length>0?n.title:o?.defaultBooleanLabel??`Enable`),u;t[0]===i?u=t[1]:(u=e=>i(e.target.checked),t[0]=i,t[1]=u);let d;t[2]!==a||t[3]!==u||t[4]!==r?(d=(0,l.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border border-edge`,checked:r,disabled:a,onChange:u}),t[2]=a,t[3]=u,t[4]=r,t[5]=d):d=t[5];let f;t[6]===s?f=t[7]:(f=(0,l.jsx)(`span`,{children:s}),t[6]=s,t[7]=f);let p;return t[8]!==d||t[9]!==f?(p=(0,l.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[d,f]}),t[8]=d,t[9]=f,t[10]=p):p=t[10],p}function x(e){let t=(0,c.c)(27),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=typeof n.description==`string`?n.description:void 0,d=n.items,f=u(d)?d.type:void 0;if(!(f===`string`||Array.isArray(f)&&f.includes(`string`))){let e=o?.unsupportedArrayType??`Unsupported array type`,n;return t[0]===e?n=t[1]:(n=(0,l.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e}),t[0]=e,t[1]=n),n}let p,m,h,g,_;if(t[2]!==s||t[3]!==a||t[4]!==i||t[5]!==r){let e=r.map(String);p=t=>{let n=t.trim();!n||e.includes(n)||i([...e,n])},g=`flex flex-col gap-1.5`,t[11]===s?_=t[12]:(_=s?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:s}):null,t[11]=s,t[12]=_),m=`flex flex-wrap gap-1`,h=e.map(t=>(0,l.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-sm`,children:[t,(0,l.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,disabled:a,onClick:()=>i(e.filter(e=>e!==t)),children:`×`})]},t)),t[2]=s,t[3]=a,t[4]=i,t[5]=r,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_}else p=t[6],m=t[7],h=t[8],g=t[9],_=t[10];let v;t[13]!==m||t[14]!==h?(v=(0,l.jsx)(`div`,{className:m,children:h}),t[13]=m,t[14]=h,t[15]=v):v=t[15];let y=o?.arrayAddPlaceholder??`Add and press Enter`,b;t[16]===p?b=t[17]:(b=e=>{e.key===`Enter`&&(e.preventDefault(),p(e.target.value),e.target.value=``)},t[16]=p,t[17]=b);let x;t[18]!==a||t[19]!==y||t[20]!==b?(x=(0,l.jsx)(`input`,{className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm`,disabled:a,placeholder:y,onKeyDown:b}),t[18]=a,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;return t[22]!==g||t[23]!==_||t[24]!==v||t[25]!==x?(S=(0,l.jsxs)(`div`,{className:g,children:[_,v,x]}),t[22]=g,t[23]=_,t[24]=v,t[25]=x,t[26]=S):S=t[26],S}function S(e){let t=(0,c.c)(66),{k:n,sub:r,value:i,onValue:a,disabled:o,labels:s}=e,d=r.type,f=(typeof r.title==`string`&&r.title.length>0?r.title:null)??n;if(d===`boolean`){let e;t[0]===f?e=t[1]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[0]=f,t[1]=e);let n=i===!0,c;t[2]===a?c=t[3]:(c=e=>a(e),t[2]=a,t[3]=c);let u;t[4]!==o||t[5]!==s||t[6]!==r||t[7]!==n||t[8]!==c?(u=(0,l.jsx)(b,{s:r,value:n,disabled:o,onChange:c,labels:s}),t[4]=o,t[5]=s,t[6]=r,t[7]=n,t[8]=c,t[9]=u):u=t[9];let d;return t[10]!==e||t[11]!==u?(d=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,u]}),t[10]=e,t[11]=u,t[12]=d):d=t[12],d}if(d===`number`||d===`integer`){let e;t[13]===f?e=t[14]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[13]=f,t[14]=e);let n=typeof i==`number`?i:0,s;t[15]!==o||t[16]!==a||t[17]!==r||t[18]!==n?(s=(0,l.jsx)(y,{s:r,value:n,disabled:o,onChange:a}),t[15]=o,t[16]=a,t[17]=r,t[18]=n,t[19]=s):s=t[19];let c;return t[20]!==e||t[21]!==s?(c=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,s]}),t[20]=e,t[21]=s,t[22]=c):c=t[22],c}if(d===`string`){let e;t[23]===f?e=t[24]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[23]=f,t[24]=e);let s=typeof i==`string`?i:``,c;t[25]!==o||t[26]!==n||t[27]!==a||t[28]!==r||t[29]!==s?(c=(0,l.jsx)(g,{name:n,s:r,value:s,disabled:o,onChange:a}),t[25]=o,t[26]=n,t[27]=a,t[28]=r,t[29]=s,t[30]=c):c=t[30];let u;return t[31]!==e||t[32]!==c?(u=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[31]=e,t[32]=c,t[33]=u):u=t[33],u}if(d===`array`){let e=r.items,n=u(e)?e.type:void 0;if(n===`string`||Array.isArray(n)&&n.includes(`string`)){let e;t[34]===f?e=t[35]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[34]=f,t[35]=e);let n;t[36]===i?n=t[37]:(n=Array.isArray(i)&&i.every(C)?i.map(String):[],t[36]=i,t[37]=n);let c;t[38]!==o||t[39]!==s||t[40]!==a||t[41]!==r||t[42]!==n?(c=(0,l.jsx)(x,{s:r,value:n,disabled:o,onChange:a,labels:s}),t[38]=o,t[39]=s,t[40]=a,t[41]=r,t[42]=n,t[43]=c):c=t[43];let u;return t[44]!==e||t[45]!==c?(u=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[44]=e,t[45]=c,t[46]=u):u=t[46],u}}if(d===`object`){let e;t[47]===i?e=t[48]:(e=u(i)?i:{},t[47]=i,t[48]=e);let n=e,c;t[49]===f?c=t[50]:(c=(0,l.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:f}),t[49]=f,t[50]=c);let d;t[51]!==o||t[52]!==s||t[53]!==n||t[54]!==a||t[55]!==r?(d=(0,l.jsx)(`div`,{className:`border-t border-edge p-3`,children:(0,l.jsx)(w,{schema:r,values:n,onChange:a,disabled:o,labels:s})}),t[51]=o,t[52]=s,t[53]=n,t[54]=a,t[55]=r,t[56]=d):d=t[56];let p;return t[57]!==c||t[58]!==d?(p=(0,l.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[c,d]}),t[57]=c,t[58]=d,t[59]=p):p=t[59],p}let p;t[60]!==s||t[61]!==d||t[62]!==f?(p=s?.unsupportedFieldType?.(f,typeof d==`string`?d:void 0)??`${f}: unsupported field type${typeof d==`string`?` (${d})`:``}`,t[60]=s,t[61]=d,t[62]=f,t[63]=p):p=t[63];let m;return t[64]===p?m=t[65]:(m=(0,l.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[64]=p,t[65]=m),m}function C(e){return typeof e==`string`||typeof e==`number`}function w(e){let t=(0,c.c)(28),{schema:n,values:r,onChange:i,disabled:o,className:s,labels:d}=e,f=o===void 0?!1:o,p;bb0:{if(n.type!==`object`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],p=e;break bb0}let e;t[1]===n?e=t[2]:(e=m(n),t[1]=n,t[2]=e),p=e}let g=p,_;bb1:{if(g.length===0){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=new Map,t[3]=e):e=t[3],_=e;break bb1}let e;t[4]===g?e=t[5]:(e=h(g),t[4]=g,t[5]=e),_=e}let v=_,y;t[6]!==i||t[7]!==r?(y=(e,t)=>{i({...r,[e]:t})},t[6]=i,t[7]=r,t[8]=y):y=t[8];let b=y;if(n.type!==`object`||!u(n.properties)||g.length===0)return null;let x,C;if(t[9]!==s||t[10]!==f||t[11]!==v||t[12]!==d||t[13]!==b||t[14]!==r){let e=Array.from(v.keys()).sort(T);t[17]===s?x=t[18]:(x=a(`flex flex-col gap-4`,s),t[17]=s,t[18]=x);let n;t[19]!==f||t[20]!==v||t[21]!==d||t[22]!==b||t[23]!==r?(n=e=>{let t=(v.get(e)??[]).map(e=>(0,l.jsx)(S,{k:e.key,sub:e.sub,value:r[e.key],onValue:t=>b(e.key,t),disabled:f,labels:d},e.key));return e===``?(0,l.jsx)(`div`,{children:t},`default`):(0,l.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[(0,l.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:e}),(0,l.jsx)(`div`,{className:`space-y-4 border-t border-edge p-3`,children:t})]},e)},t[19]=f,t[20]=v,t[21]=d,t[22]=b,t[23]=r,t[24]=n):n=t[24],C=e.map(n),t[9]=s,t[10]=f,t[11]=v,t[12]=d,t[13]=b,t[14]=r,t[15]=x,t[16]=C}else x=t[15],C=t[16];let w;return t[25]!==x||t[26]!==C?(w=(0,l.jsx)(`div`,{className:x,children:C}),t[25]=x,t[26]=C,t[27]=w):w=t[27],w}function T(e,t){return e===``?-1:t===``?1:e.localeCompare(t)}export{w as t};
|
|
1
|
+
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r,r as i}from"./popover-select-DldSX8GX.js";import{t as a}from"./cn-JdwAhgNB.js";import{Oo as o,jo as s}from"./index-hlU8MUEz.js";var c=t();e();var l=n();function u(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function d(e){let t=e[`x-order`];return typeof t==`number`&&!Number.isNaN(t)?t:999}function f(e){let t=e[`x-group`];return typeof t==`string`&&t.length>0?t:``}function p(e){return e[`x-hidden`]===!0}function m(e){let t=e.properties;if(!u(t))return[];let n=[];for(let[e,r]of Object.entries(t))u(r)&&(p(r)||n.push({key:e,sub:r,order:d(r),group:f(r),hidden:!1}));return n.sort((e,t)=>e.order-t.order||e.key.localeCompare(t.key)),n}function h(e){let t=new Map;for(let n of e){let e=n.group;t.has(e)||t.set(e,[]),t.get(e).push(n)}return t}function g(e){let t=(0,c.c)(38),{name:n,s:i,value:a,onChange:u,disabled:d}=e,f=typeof i.description==`string`?i.description:void 0,p=(typeof i[`x-placeholder`]==`string`?i[`x-placeholder`]:null)||f,m=i.format;if(Array.isArray(i.enum)&&i.enum.every(v)){let e;t[0]===f?e=t[1]:(e=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[0]=f,t[1]=e);let o;t[2]===u?o=t[3]:(o=e=>u(e.target.value),t[2]=u,t[3]=o);let s;t[4]===i.enum?s=t[5]:(s=i.enum.map(_),t[4]=i.enum,t[5]=s);let c;t[6]!==d||t[7]!==n||t[8]!==o||t[9]!==s||t[10]!==a?(c=(0,l.jsx)(r,{name:n,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:a,disabled:d,onChange:o,children:s}),t[6]=d,t[7]=n,t[8]=o,t[9]=s,t[10]=a,t[11]=c):c=t[11];let p;return t[12]!==e||t[13]!==c?(p=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,c]}),t[12]=e,t[13]=c,t[14]=p):p=t[14],p}if(m===`password`){let e;t[15]===f?e=t[16]:(e=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[15]=f,t[16]=e);let n;t[17]!==d||t[18]!==u||t[19]!==p||t[20]!==a?(n=(0,l.jsx)(s,{value:a,onChange:u,placeholder:p,labels:o,disabled:d,inputClassName:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`}),t[17]=d,t[18]=u,t[19]=p,t[20]=a,t[21]=n):n=t[21];let r;return t[22]!==e||t[23]!==n?(r=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,n]}),t[22]=e,t[23]=n,t[24]=r):r=t[24],r}let h;t[25]===f?h=t[26]:(h=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[25]=f,t[26]=h);let g;t[27]===u?g=t[28]:(g=e=>u(e.target.value),t[27]=u,t[28]=g);let y;t[29]!==d||t[30]!==n||t[31]!==p||t[32]!==g||t[33]!==a?(y=(0,l.jsx)(`input`,{name:n,type:`text`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`,value:a,placeholder:p,disabled:d,onChange:g}),t[29]=d,t[30]=n,t[31]=p,t[32]=g,t[33]=a,t[34]=y):y=t[34];let b;return t[35]!==h||t[36]!==y?(b=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[h,y]}),t[35]=h,t[36]=y,t[37]=b):b=t[37],b}function _(e){return(0,l.jsx)(i,{value:e,children:e},e)}function v(e){return typeof e==`string`}function y(e){let t=(0,c.c)(11),{s:n,value:r,onChange:i,disabled:a}=e,o=typeof n.description==`string`?n.description:void 0,s;t[0]===o?s=t[1]:(s=o?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:o}):null,t[0]=o,t[1]=s);let u=Number.isFinite(r)?r:0,d;t[2]===i?d=t[3]:(d=e=>i(Number(e.target.value)),t[2]=i,t[3]=d);let f;t[4]!==a||t[5]!==u||t[6]!==d?(f=(0,l.jsx)(`input`,{type:`number`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg`,value:u,disabled:a,onChange:d}),t[4]=a,t[5]=u,t[6]=d,t[7]=f):f=t[7];let p;return t[8]!==s||t[9]!==f?(p=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s,f]}),t[8]=s,t[9]=f,t[10]=p):p=t[10],p}function b(e){let t=(0,c.c)(11),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=(typeof n.description==`string`?n.description:void 0)??(typeof n.title==`string`&&n.title.length>0?n.title:o?.defaultBooleanLabel??`Enable`),u;t[0]===i?u=t[1]:(u=e=>i(e.target.checked),t[0]=i,t[1]=u);let d;t[2]!==a||t[3]!==u||t[4]!==r?(d=(0,l.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border border-edge`,checked:r,disabled:a,onChange:u}),t[2]=a,t[3]=u,t[4]=r,t[5]=d):d=t[5];let f;t[6]===s?f=t[7]:(f=(0,l.jsx)(`span`,{children:s}),t[6]=s,t[7]=f);let p;return t[8]!==d||t[9]!==f?(p=(0,l.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[d,f]}),t[8]=d,t[9]=f,t[10]=p):p=t[10],p}function x(e){let t=(0,c.c)(27),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=typeof n.description==`string`?n.description:void 0,d=n.items,f=u(d)?d.type:void 0;if(!(f===`string`||Array.isArray(f)&&f.includes(`string`))){let e=o?.unsupportedArrayType??`Unsupported array type`,n;return t[0]===e?n=t[1]:(n=(0,l.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e}),t[0]=e,t[1]=n),n}let p,m,h,g,_;if(t[2]!==s||t[3]!==a||t[4]!==i||t[5]!==r){let e=r.map(String);p=t=>{let n=t.trim();!n||e.includes(n)||i([...e,n])},g=`flex flex-col gap-1.5`,t[11]===s?_=t[12]:(_=s?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:s}):null,t[11]=s,t[12]=_),m=`flex flex-wrap gap-1`,h=e.map(t=>(0,l.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-sm`,children:[t,(0,l.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,disabled:a,onClick:()=>i(e.filter(e=>e!==t)),children:`×`})]},t)),t[2]=s,t[3]=a,t[4]=i,t[5]=r,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_}else p=t[6],m=t[7],h=t[8],g=t[9],_=t[10];let v;t[13]!==m||t[14]!==h?(v=(0,l.jsx)(`div`,{className:m,children:h}),t[13]=m,t[14]=h,t[15]=v):v=t[15];let y=o?.arrayAddPlaceholder??`Add and press Enter`,b;t[16]===p?b=t[17]:(b=e=>{e.key===`Enter`&&(e.preventDefault(),p(e.target.value),e.target.value=``)},t[16]=p,t[17]=b);let x;t[18]!==a||t[19]!==y||t[20]!==b?(x=(0,l.jsx)(`input`,{className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm`,disabled:a,placeholder:y,onKeyDown:b}),t[18]=a,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;return t[22]!==g||t[23]!==_||t[24]!==v||t[25]!==x?(S=(0,l.jsxs)(`div`,{className:g,children:[_,v,x]}),t[22]=g,t[23]=_,t[24]=v,t[25]=x,t[26]=S):S=t[26],S}function S(e){let t=(0,c.c)(66),{k:n,sub:r,value:i,onValue:a,disabled:o,labels:s}=e,d=r.type,f=(typeof r.title==`string`&&r.title.length>0?r.title:null)??n;if(d===`boolean`){let e;t[0]===f?e=t[1]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[0]=f,t[1]=e);let n=i===!0,c;t[2]===a?c=t[3]:(c=e=>a(e),t[2]=a,t[3]=c);let u;t[4]!==o||t[5]!==s||t[6]!==r||t[7]!==n||t[8]!==c?(u=(0,l.jsx)(b,{s:r,value:n,disabled:o,onChange:c,labels:s}),t[4]=o,t[5]=s,t[6]=r,t[7]=n,t[8]=c,t[9]=u):u=t[9];let d;return t[10]!==e||t[11]!==u?(d=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,u]}),t[10]=e,t[11]=u,t[12]=d):d=t[12],d}if(d===`number`||d===`integer`){let e;t[13]===f?e=t[14]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[13]=f,t[14]=e);let n=typeof i==`number`?i:0,s;t[15]!==o||t[16]!==a||t[17]!==r||t[18]!==n?(s=(0,l.jsx)(y,{s:r,value:n,disabled:o,onChange:a}),t[15]=o,t[16]=a,t[17]=r,t[18]=n,t[19]=s):s=t[19];let c;return t[20]!==e||t[21]!==s?(c=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,s]}),t[20]=e,t[21]=s,t[22]=c):c=t[22],c}if(d===`string`){let e;t[23]===f?e=t[24]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[23]=f,t[24]=e);let s=typeof i==`string`?i:``,c;t[25]!==o||t[26]!==n||t[27]!==a||t[28]!==r||t[29]!==s?(c=(0,l.jsx)(g,{name:n,s:r,value:s,disabled:o,onChange:a}),t[25]=o,t[26]=n,t[27]=a,t[28]=r,t[29]=s,t[30]=c):c=t[30];let u;return t[31]!==e||t[32]!==c?(u=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[31]=e,t[32]=c,t[33]=u):u=t[33],u}if(d===`array`){let e=r.items,n=u(e)?e.type:void 0;if(n===`string`||Array.isArray(n)&&n.includes(`string`)){let e;t[34]===f?e=t[35]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[34]=f,t[35]=e);let n;t[36]===i?n=t[37]:(n=Array.isArray(i)&&i.every(C)?i.map(String):[],t[36]=i,t[37]=n);let c;t[38]!==o||t[39]!==s||t[40]!==a||t[41]!==r||t[42]!==n?(c=(0,l.jsx)(x,{s:r,value:n,disabled:o,onChange:a,labels:s}),t[38]=o,t[39]=s,t[40]=a,t[41]=r,t[42]=n,t[43]=c):c=t[43];let u;return t[44]!==e||t[45]!==c?(u=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[44]=e,t[45]=c,t[46]=u):u=t[46],u}}if(d===`object`){let e;t[47]===i?e=t[48]:(e=u(i)?i:{},t[47]=i,t[48]=e);let n=e,c;t[49]===f?c=t[50]:(c=(0,l.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:f}),t[49]=f,t[50]=c);let d;t[51]!==o||t[52]!==s||t[53]!==n||t[54]!==a||t[55]!==r?(d=(0,l.jsx)(`div`,{className:`border-t border-edge p-3`,children:(0,l.jsx)(w,{schema:r,values:n,onChange:a,disabled:o,labels:s})}),t[51]=o,t[52]=s,t[53]=n,t[54]=a,t[55]=r,t[56]=d):d=t[56];let p;return t[57]!==c||t[58]!==d?(p=(0,l.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[c,d]}),t[57]=c,t[58]=d,t[59]=p):p=t[59],p}let p;t[60]!==s||t[61]!==d||t[62]!==f?(p=s?.unsupportedFieldType?.(f,typeof d==`string`?d:void 0)??`${f}: unsupported field type${typeof d==`string`?` (${d})`:``}`,t[60]=s,t[61]=d,t[62]=f,t[63]=p):p=t[63];let m;return t[64]===p?m=t[65]:(m=(0,l.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[64]=p,t[65]=m),m}function C(e){return typeof e==`string`||typeof e==`number`}function w(e){let t=(0,c.c)(28),{schema:n,values:r,onChange:i,disabled:o,className:s,labels:d}=e,f=o===void 0?!1:o,p;bb0:{if(n.type!==`object`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],p=e;break bb0}let e;t[1]===n?e=t[2]:(e=m(n),t[1]=n,t[2]=e),p=e}let g=p,_;bb1:{if(g.length===0){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=new Map,t[3]=e):e=t[3],_=e;break bb1}let e;t[4]===g?e=t[5]:(e=h(g),t[4]=g,t[5]=e),_=e}let v=_,y;t[6]!==i||t[7]!==r?(y=(e,t)=>{i({...r,[e]:t})},t[6]=i,t[7]=r,t[8]=y):y=t[8];let b=y;if(n.type!==`object`||!u(n.properties)||g.length===0)return null;let x,C;if(t[9]!==s||t[10]!==f||t[11]!==v||t[12]!==d||t[13]!==b||t[14]!==r){let e=Array.from(v.keys()).sort(T);t[17]===s?x=t[18]:(x=a(`flex flex-col gap-4`,s),t[17]=s,t[18]=x);let n;t[19]!==f||t[20]!==v||t[21]!==d||t[22]!==b||t[23]!==r?(n=e=>{let t=(v.get(e)??[]).map(e=>(0,l.jsx)(S,{k:e.key,sub:e.sub,value:r[e.key],onValue:t=>b(e.key,t),disabled:f,labels:d},e.key));return e===``?(0,l.jsx)(`div`,{children:t},`default`):(0,l.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[(0,l.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:e}),(0,l.jsx)(`div`,{className:`space-y-4 border-t border-edge p-3`,children:t})]},e)},t[19]=f,t[20]=v,t[21]=d,t[22]=b,t[23]=r,t[24]=n):n=t[24],C=e.map(n),t[9]=s,t[10]=f,t[11]=v,t[12]=d,t[13]=b,t[14]=r,t[15]=x,t[16]=C}else x=t[15],C=t[16];let w;return t[25]!==x||t[26]!==C?(w=(0,l.jsx)(`div`,{className:x,children:C}),t[25]=x,t[26]=C,t[27]=w):w=t[27],w}function T(e,t){return e===``?-1:t===``?1:e.localeCompare(t)}export{w as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{h as i}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{n as a,r as o}from"./popover-select-DldSX8GX.js";import{t as s}from"./download-Dk-ZjtO6.js";import{t as c}from"./plus-Q2yW6OE7.js";import{t as l}from"./x-B_N4OPjy.js";import{t as u}from"./cn-JdwAhgNB.js";import{a as d,c as f,n as p,r as m}from"./locale-store-DLK05Y1a.js";import{t as h}from"./messages-C9h8SImu.js";import{a as g,n as _,o as v,r as y,s as ee,t as te}from"./dist-BGTk37IG.js";import{i as ne}from"./vendor-swr-BIWyz7Rc.js";import{t as b}from"./button-CGlRPNzi.js";import{n as x,r as S}from"./gateway-config-swr-D5AM8cyQ.js";import{t as C}from"./skeleton-BwbyijEw.js";import{i as re,o as w}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as T,t as E}from"./registry-api-BMFL4vis.js";import{Aa as D,Bt as O,Ca as k,Da as A,Dc as j,Ea as M,F as N,Kc as P,Lo as F,Ol as I,Ql as L,Sa as R,Ta as z,Ts as B,Tu as V,Vt as H,Ys as ie,_i as U,ba as W,ca as ae,ed as oe,fu as se,ga as ce,jc as le,jl as ue,ka as de,kl as fe,ll as pe,oa as G,oc as me,qc as he,sa as K,sl as q,td as ge,wa as _e,ws as ve,xa as ye,ya as be}from"./index-hlU8MUEz.js";import{n as xe,r as Se}from"./settings-page-layout-X1x-2Cp9.js";import{n as Ce,t as J}from"./settings-form-section-BsdM7P1d.js";import{n as Y,t as we}from"./use-autosave-DO50_g_S.js";import{t as Te}from"./page-tabs-DzJpglJJ.js";import{t as Ee}from"./settings-advanced-gate-DDALROy_.js";var X=e(t(),1),De=n(),Z=r();function Oe(e){let t=new Date(e),n=Math.floor((new Date().getTime()-t.getTime())/(1e3*60*60*24));return n===0?t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):n===1?`Yesterday`:n<7?t.toLocaleDateString([],{weekday:`short`}):t.toLocaleDateString([],{month:`short`,day:`numeric`})}function ke(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Ae(e){let t=(0,De.c)(113),{session:n,variant:r,labels:i,sessionAgentId:a,sessionAgentAvatar:o,onOpen:c,onAction:l}=e,d;t[0]!==i.unnamedSession||t[1]!==n.name?(d=n.name?.trim()||i.unnamedSession,t[0]=i.unnamedSession,t[1]=n.name,t[2]=d):d=t[2];let f=d,m=p(Pe),g;t[3]!==m||t[4]!==n?(g=W(n,h(m).sidebar.sessionFilters),t[3]=m,t[4]=n,t[5]=g):g=t[5];let _=g,v;t[6]===n.name?v=t[7]:(v=n.name?.trim(),t[6]=n.name,t[7]=v);let y=!!v,ee=n.status===`archived`,te=n.status===`pinned`,ne=r===`list`&&`sm:flex-row sm:items-center sm:gap-4`,b;t[8]===ne?b=t[9]:(b=u(`group flex min-w-0 w-full max-w-full cursor-pointer flex-col rounded-xl bg-surface-base text-left transition-colors duration-150 ease-out`,`hover:bg-surface-hover active:scale-[0.99]`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,ne),t[8]=ne,t[9]=b);let x;t[10]===c?x=t[11]:(x=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())},t[10]=c,t[11]=x);let S=r===`list`&&`sm:py-3`,C;t[12]===S?C=t[13]:(C=u(`flex min-w-0 items-start justify-between gap-2 bg-surface-hover/35 px-3 py-2 dark:bg-surface-hover/25`,S),t[12]=S,t[13]=C);let re;t[14]===n?re=t[15]:(re=(0,Z.jsx)(be,{sourceChannel:n.sourceChannel,session:n,className:`size-3.5`}),t[14]=n,t[15]=re);let w;t[16]===_?w=t[17]:(w=(0,Z.jsx)(`span`,{className:`truncate text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:_}),t[16]=_,t[17]=w);let T;t[18]!==w||t[19]!==re?(T=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[re,w]}),t[18]=w,t[19]=re,t[20]=T):T=t[20];let E;t[21]===te?E=t[22]:(E=te?(0,Z.jsx)(he,{className:`size-3.5 text-accent-fg`,strokeWidth:1.75,"aria-hidden":!0}):null,t[21]=te,t[22]=E);let D;t[23]===n.updatedAt?D=t[24]:(D=Oe(n.updatedAt),t[23]=n.updatedAt,t[24]=D);let O;t[25]===D?O=t[26]:(O=(0,Z.jsx)(`span`,{children:D}),t[25]=D,t[26]=O);let k;t[27]!==E||t[28]!==O?(k=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-fg-muted`,children:[E,O]}),t[27]=E,t[28]=O,t[29]=k):k=t[29];let A;t[30]!==T||t[31]!==k||t[32]!==C?(A=(0,Z.jsxs)(`div`,{className:C,children:[T,k]}),t[30]=T,t[31]=k,t[32]=C,t[33]=A):A=t[33];let j=r===`list`&&`sm:py-3`,M;t[34]===j?M=t[35]:(M=u(`min-w-0 flex-1 px-3 py-2`,j),t[34]=j,t[35]=M);let F=r===`list`&&`sm:items-start`,I;t[36]===F?I=t[37]:(I=u(`flex gap-3`,F),t[36]=F,t[37]=I);let L;t[38]!==o||t[39]!==a?(L=(0,Z.jsx)(N,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}),t[38]=o,t[39]=a,t[40]=L):L=t[40];let R;t[41]===f?R=t[42]:(R=(0,Z.jsx)(`div`,{className:`min-w-0 max-w-full truncate text-sm font-semibold text-fg`,title:f,children:f}),t[41]=f,t[42]=R);let z;t[43]!==n.key||t[44]!==y?(z=y?(0,Z.jsx)(`div`,{className:`mt-0.5 min-w-0 max-w-full truncate font-mono text-[11px] text-fg-subtle`,title:n.key,children:n.key}):null,t[43]=n.key,t[44]=y,t[45]=z):z=t[45];let B;t[46]!==R||t[47]!==z?(B=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[R,z]}),t[46]=R,t[47]=z,t[48]=B):B=t[48];let V;t[49]!==I||t[50]!==L||t[51]!==B?(V=(0,Z.jsxs)(`div`,{className:I,children:[L,B]}),t[49]=I,t[50]=L,t[51]=B,t[52]=V):V=t[52];let H;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(pe,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[53]=H):H=t[53];let U;t[54]===n.messageCount?U=t[55]:(U=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[H,n.messageCount]}),t[54]=n.messageCount,t[55]=U);let ae;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(ie,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[56]=ae):ae=t[56];let se;t[57]===n.estimatedTokens?se=t[58]:(se=ke(n.estimatedTokens),t[57]=n.estimatedTokens,t[58]=se);let ce;t[59]===se?ce=t[60]:(ce=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[ae,se]}),t[59]=se,t[60]=ce);let le;t[61]!==U||t[62]!==ce?(le=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[U,ce]}),t[61]=U,t[62]=ce,t[63]=le):le=t[63];let ue;t[64]===n.tags?ue=t[65]:(ue=n.tags.length>0?(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[n.tags.slice(0,3).map(Ne),n.tags.length>3?(0,Z.jsxs)(`span`,{className:`text-[11px] text-fg-disabled`,children:[`+`,n.tags.length-3]}):null]}):null,t[64]=n.tags,t[65]=ue);let de;t[66]!==M||t[67]!==V||t[68]!==le||t[69]!==ue?(de=(0,Z.jsxs)(`div`,{className:M,children:[V,le,ue]}),t[66]=M,t[67]=V,t[68]=le,t[69]=ue,t[70]=de):de=t[70];let fe;t[71]===l?fe=t[72]:(fe=()=>l(`continue`),t[71]=l,t[72]=fe);let G;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(pe,{className:`size-4`,strokeWidth:1.75}),t[73]=G):G=t[73];let K;t[74]!==i.continueChat||t[75]!==fe?(K=(0,Z.jsx)(`button`,{type:`button`,className:ve,title:i.continueChat,"aria-label":i.continueChat,onClick:fe,children:G}),t[74]=i.continueChat,t[75]=fe,t[76]=K):K=t[76];let q;t[77]!==ee||t[78]!==i.archive||t[79]!==i.unarchive||t[80]!==l?(q=ee?(0,Z.jsx)(`button`,{type:`button`,className:ve,title:i.unarchive,"aria-label":i.unarchive,onClick:()=>l(`unarchive`),children:(0,Z.jsx)(ge,{className:`size-4`,strokeWidth:1.75})}):(0,Z.jsx)(`button`,{type:`button`,className:ve,title:i.archive,"aria-label":i.archive,onClick:()=>l(`archive`),children:(0,Z.jsx)(oe,{className:`size-4`,strokeWidth:1.75})}),t[77]=ee,t[78]=i.archive,t[79]=i.unarchive,t[80]=l,t[81]=q):q=t[81];let _e;t[82]!==te||t[83]!==i.pin||t[84]!==i.unpin||t[85]!==l?(_e=te?(0,Z.jsx)(`button`,{type:`button`,className:ve,title:i.unpin,"aria-label":i.unpin,onClick:()=>l(`unpin`),children:(0,Z.jsx)(P,{className:`size-4`,strokeWidth:1.75})}):(0,Z.jsx)(`button`,{type:`button`,className:ve,title:i.pin,"aria-label":i.pin,onClick:()=>l(`pin`),children:(0,Z.jsx)(he,{className:`size-4`,strokeWidth:1.75})}),t[82]=te,t[83]=i.pin,t[84]=i.unpin,t[85]=l,t[86]=_e):_e=t[86];let ye;t[87]===l?ye=t[88]:(ye=()=>l(`export`),t[87]=l,t[88]=ye);let xe;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Z.jsx)(s,{className:`size-4`,strokeWidth:1.75}),t[89]=xe):xe=t[89];let Se;t[90]!==i.export||t[91]!==ye?(Se=(0,Z.jsx)(`button`,{type:`button`,className:ve,title:i.export,"aria-label":i.export,onClick:ye,children:xe}),t[90]=i.export,t[91]=ye,t[92]=Se):Se=t[92];let Ce;t[93]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=u(ve,`text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`),t[93]=Ce):Ce=t[93];let J;t[94]===l?J=t[95]:(J=()=>l(`delete`),t[94]=l,t[95]=J);let Y;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Z.jsx)(me,{className:`size-4`,strokeWidth:1.75}),t[96]=Y):Y=t[96];let we;t[97]!==i.delete||t[98]!==J?(we=(0,Z.jsx)(`button`,{type:`button`,className:Ce,title:i.delete,"aria-label":i.delete,onClick:J,children:Y}),t[97]=i.delete,t[98]=J,t[99]=we):we=t[99];let Te;t[100]!==K||t[101]!==q||t[102]!==_e||t[103]!==Se||t[104]!==we?(Te=(0,Z.jsxs)(`div`,{role:`group`,className:`m-1 mt-0 flex flex-wrap items-center gap-0.5 rounded-lg bg-surface-hover/35 p-1.5`,onClick:Me,onKeyDown:je,children:[K,q,_e,Se,we]}),t[100]=K,t[101]=q,t[102]=_e,t[103]=Se,t[104]=we,t[105]=Te):Te=t[105];let Ee;return t[106]!==c||t[107]!==A||t[108]!==de||t[109]!==Te||t[110]!==b||t[111]!==x?(Ee=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,className:b,onClick:c,onKeyDown:x,children:[A,de,Te]}),t[106]=c,t[107]=A,t[108]=de,t[109]=Te,t[110]=b,t[111]=x,t[112]=Ee):Ee=t[112],Ee}function je(e){return e.stopPropagation()}function Me(e){return e.stopPropagation()}function Ne(e){return(0,Z.jsx)(`span`,{className:`max-w-full break-words rounded-md bg-surface-hover px-1.5 py-0.5 text-[11px] text-fg-muted`,children:e},e)}function Pe(e){return e.language}function Fe(e,t){return e.routing?.agentId?.trim().toLowerCase()||t.trim().toLowerCase()||`main`}function Ie(e,t){return t.find(t=>t.id===e)?.avatar}var Le={enabled:!0,triggerThreshold:.8,reserveTokens:8192,minMessagesBeforeCompact:10,keepRecentTokens:2e4,recentTurnsPreserve:3,summaryMaxTokens:16e3,summaryChunkTokens:24e3,summaryTimeoutMs:18e4,summaryRetries:2,qualityGuard:!0,gapAudit:!0,minToolResultKeepChars:1e3,maxActiveTranscriptBytes:2e6,postCompactionSections:[`Session Startup`,`Red Lines`]};function Re(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ze(e,t,n,r=1/0){return typeof e==`number`&&Number.isFinite(e)&&e>=n&&e<=r?e:t}function Q(e,t,n,r=1/0){return Number.isInteger(e)&&e>=n&&e<=r?e:t}function Be(e){let t=Re(e)?e:{},n=Re(t.userContext)?t.userContext:{},r=Re(n.contextPlanning)?n.contextPlanning:{},i=Re(r.compaction)?r.compaction:{},a=Le,o=typeof i.model==`string`&&i.model.trim()?i.model.trim():void 0,s=Array.isArray(i.postCompactionSections)&&i.postCompactionSections.length<=12&&i.postCompactionSections.every(e=>typeof e==`string`&&e.trim())?[...new Set(i.postCompactionSections.map(e=>e.trim()))]:[...a.postCompactionSections];return{enabled:typeof i.enabled==`boolean`?i.enabled:a.enabled,triggerThreshold:ze(i.triggerThreshold,a.triggerThreshold,.1,.98),reserveTokens:Q(i.reserveTokens,a.reserveTokens,1024),minMessagesBeforeCompact:Q(i.minMessagesBeforeCompact,a.minMessagesBeforeCompact,2),keepRecentTokens:Q(i.keepRecentTokens,a.keepRecentTokens,1e3),recentTurnsPreserve:Q(i.recentTurnsPreserve,a.recentTurnsPreserve,1,12),summaryMaxTokens:Q(i.summaryMaxTokens,a.summaryMaxTokens,256),summaryChunkTokens:Q(i.summaryChunkTokens,a.summaryChunkTokens,1e3),summaryTimeoutMs:Q(i.summaryTimeoutMs,a.summaryTimeoutMs,1e3,6e5),summaryRetries:Q(i.summaryRetries,a.summaryRetries,0,5),qualityGuard:typeof i.qualityGuard==`boolean`?i.qualityGuard:a.qualityGuard,gapAudit:typeof i.gapAudit==`boolean`?i.gapAudit:a.gapAudit,...o?{model:o}:{},minToolResultKeepChars:Q(i.minToolResultKeepChars,a.minToolResultKeepChars,200),maxActiveTranscriptBytes:Q(i.maxActiveTranscriptBytes,a.maxActiveTranscriptBytes,64e3),postCompactionSections:s}}function Ve(e){return e.triggerThreshold<.1||e.triggerThreshold>.98?`triggerThreshold`:!Number.isInteger(e.reserveTokens)||e.reserveTokens<1024?`reserveTokens`:!Number.isInteger(e.minMessagesBeforeCompact)||e.minMessagesBeforeCompact<2?`minMessagesBeforeCompact`:!Number.isInteger(e.keepRecentTokens)||e.keepRecentTokens<1e3?`keepRecentTokens`:!Number.isInteger(e.recentTurnsPreserve)||e.recentTurnsPreserve<1||e.recentTurnsPreserve>12?`recentTurnsPreserve`:!Number.isInteger(e.summaryMaxTokens)||e.summaryMaxTokens<256?`summaryMaxTokens`:!Number.isInteger(e.summaryChunkTokens)||e.summaryChunkTokens<1e3?`summaryChunkTokens`:!Number.isInteger(e.summaryTimeoutMs)||e.summaryTimeoutMs<1e3||e.summaryTimeoutMs>6e5?`summaryTimeoutMs`:!Number.isInteger(e.summaryRetries)||e.summaryRetries<0||e.summaryRetries>5?`summaryRetries`:e.model!==void 0&&!e.model.trim()?`model`:!Number.isInteger(e.minToolResultKeepChars)||e.minToolResultKeepChars<200?`minToolResultKeepChars`:!Number.isInteger(e.maxActiveTranscriptBytes)||e.maxActiveTranscriptBytes<64e3?`maxActiveTranscriptBytes`:e.postCompactionSections.length>12||e.postCompactionSections.some(e=>!e.trim())?`postCompactionSections`:null}function He(e){let t={...e,...e.model?.trim()?{model:e.model.trim()}:{}};return e.model?.trim()||delete t.model,{userContext:{contextPlanning:{compaction:t}}}}async function Ue(e){await d(m(`/api/config`),{method:`PATCH`,body:JSON.stringify(He(e))}),await x()}var We=128e3,Ge={balanced:Le,preserve:{...Le,triggerThreshold:.88,keepRecentTokens:32e3,recentTurnsPreserve:5,maxActiveTranscriptBytes:4e6},early:{...Le,triggerThreshold:.65,reserveTokens:12e3,minMessagesBeforeCompact:6,keepRecentTokens:12e3,recentTurnsPreserve:2}},Ke=G();function qe(){return u(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg disabled:cursor-not-allowed disabled:opacity-55`,F,`dark:border-edge`)}function Je(e){let{enabled:t,model:n,postCompactionSections:r,...i}=e;return JSON.stringify(i)}function Ye(e){let t=Je(e);for(let[e,n]of Object.entries(Ge))if(t===Je(n))return e;return`custom`}function Xe(e){return e>=1e6?`${(e/1e6).toFixed(e%1e6==0?0:1)}m`:e>=1e3?`${(e/1e3).toFixed(e%1e3==0?0:1)}k`:String(e)}function $(e){let t=(0,De.c)(20),{id:n,label:r,hint:i,value:a,min:o,max:s,step:c,disabled:l,onChange:u}=e,d=c===void 0?1:c,f;t[0]!==n||t[1]!==r?(f=(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=qe(),t[3]=p):p=t[3];let m;t[4]===u?m=t[5]:(m=e=>{if(!e.target.value.trim())return;let t=Number(e.target.value);Number.isFinite(t)&&u(t)},t[4]=u,t[5]=m);let h;t[6]!==l||t[7]!==n||t[8]!==s||t[9]!==o||t[10]!==d||t[11]!==m||t[12]!==a?(h=(0,Z.jsx)(`input`,{id:n,type:`number`,min:o,max:s,step:d,disabled:l,className:p,value:a,onChange:m}),t[6]=l,t[7]=n,t[8]=s,t[9]=o,t[10]=d,t[11]=m,t[12]=a,t[13]=h):h=t[13];let g;t[14]===i?g=t[15]:(g=i?(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}):null,t[14]=i,t[15]=g);let _;return t[16]!==f||t[17]!==h||t[18]!==g?(_=(0,Z.jsxs)(`div`,{children:[f,h,g]}),t[16]=f,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function Ze(e){let t=(0,De.c)(19),{label:n,hint:r,checked:i,disabled:a,onChange:o}=e,s=a?`cursor-not-allowed opacity-55`:`cursor-pointer`,c;t[0]===s?c=t[1]:(c=u(`flex items-start gap-2 text-sm text-fg`,s),t[0]=s,t[1]=c);let l;t[2]===o?l=t[3]:(l=e=>o(e.target.checked),t[2]=o,t[3]=l);let d;t[4]!==i||t[5]!==a||t[6]!==l?(d=(0,Z.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:i,disabled:a,onChange:l}),t[4]=i,t[5]=a,t[6]=l,t[7]=d):d=t[7];let f;t[8]===n?f=t[9]:(f=(0,Z.jsx)(`span`,{className:`font-medium`,children:n}),t[8]=n,t[9]=f);let p;t[10]===r?p=t[11]:(p=(0,Z.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:r}),t[10]=r,t[11]=p);let m;t[12]!==f||t[13]!==p?(m=(0,Z.jsxs)(`span`,{children:[f,p]}),t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;return t[15]!==c||t[16]!==d||t[17]!==m?(h=(0,Z.jsxs)(`label`,{className:c,children:[d,m]}),t[15]=c,t[16]=d,t[17]=m,t[18]=h):h=t[18],h}function Qe({hasToken:e}){let t=h(p(e=>e.language)).sessions.compaction,{data:n,isLoading:r}=S(e),{data:i=[],isLoading:a}=ne(e?E:null,T,{revalidateOnFocus:!1}),o=(0,X.useMemo)(()=>n?.payload?.config===void 0?null:Be(n.payload.config),[n]),[s,d]=(0,X.useReducer)(Ke,{form:null,baseline:null}),[f,m]=(0,X.useState)(``),g=(0,X.useRef)(!1),_=(0,X.useRef)(s.form);_.current=s.form;let v=(0,X.useRef)(null);K({enabled:e,parsed:o,dirty:g.current,trackedParsedRef:v,dispatch:d,onResetDirty:()=>{g.current=!1}});let y=s.form,ee=s.baseline,te=!!(y&&ee&&JSON.stringify(y)!==JSON.stringify(ee)),x=(0,X.useCallback)(e=>{g.current=!0,d({type:`patch`,patch:e})},[]),re=(0,X.useCallback)(e=>({enabled:t.enabled,triggerThreshold:t.triggerThreshold,reserveTokens:t.reserveTokens,minMessagesBeforeCompact:t.minMessagesBeforeCompact,keepRecentTokens:t.keepRecentTokens,recentTurnsPreserve:t.recentTurnsPreserve,summaryMaxTokens:t.summaryMaxTokens,summaryChunkTokens:t.summaryChunkTokens,summaryTimeoutMs:t.summaryTimeoutSeconds,summaryRetries:t.summaryRetries,qualityGuard:t.qualityGuard,gapAudit:t.gapAudit,model:t.summaryModel,minToolResultKeepChars:t.minToolResultKeepChars,maxActiveTranscriptBytes:t.maxActiveTranscriptMb,postCompactionSections:t.postCompactionSections})[e],[t]),w=we({value:y,dirty:te,onSave:(0,X.useCallback)(async e=>{try{await Ue(e),d({type:`saved`,value:e}),g.current=!!(_.current&&JSON.stringify(_.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError]),validate:e=>{let n=Ve(e);return n?t.invalidValue.replace(`{{field}}`,re(n)):null}});if(!e||!y)return r?(0,Z.jsx)(J,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Z.jsx)(C,{className:`h-5 w-48`}),(0,Z.jsx)(C,{className:`h-20 w-full rounded-xl`}),(0,Z.jsx)(C,{className:`h-36 w-full rounded-xl`})]})}):null;let D=Ye(y),O=Math.max(0,We-y.reserveTokens),k=Math.min(Math.floor(We*y.triggerThreshold),O),A=Math.min(100,k/We*100),j=Math.min(100,O/We*100),M=y.model?i.find(e=>e.id===y.model):void 0,N=M?.contextWindow&&y.summaryChunkTokens+y.summaryMaxTokens+4096>M.contextWindow,P=y.keepRecentTokens+y.reserveTokens>k,F=Math.round(y.summaryTimeoutMs*(y.summaryRetries+1)/1e3),I=e=>{let t=Ge[e];x({...t,...y.model?{model:y.model}:{model:void 0},postCompactionSections:y.postCompactionSections})},L={balanced:{title:t.presetBalanced,hint:t.presetBalancedHint},preserve:{title:t.presetPreserve,hint:t.presetPreserveHint},early:{title:t.presetEarly,hint:t.presetEarlyHint}},R=()=>{let e=f.trim();!e||y.postCompactionSections.includes(e)||y.postCompactionSections.length>=12||(x({postCompactionSections:[...y.postCompactionSections,e]}),m(``))};return(0,Z.jsxs)(J,{onBlurCapture:w.onBlurCapture,children:[(0,Z.jsx)(Ce,{icon:q,title:t.title,subtitle:t.hint,trailing:(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(Y,{status:w.status,error:w.error}),(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm font-medium text-fg`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:y.enabled,onChange:e=>x({enabled:e.target.checked})}),y.enabled?t.enabled:t.disabled]})]})}),w.error?(0,Z.jsx)(`p`,{className:`mb-4 rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:w.error}):null,y.enabled?null:(0,Z.jsx)(`p`,{className:`mb-4 rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.disabledWarning}),(0,Z.jsxs)(`fieldset`,{disabled:!y.enabled,className:`space-y-5 disabled:opacity-60`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.presetTitle}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.presetHint})]}),D===`custom`?(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.presetCustom}):null]}),(0,Z.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[`balanced`,`preserve`,`early`].map(e=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":D===e,className:u(`rounded-xl bg-surface-base/55 px-3 py-3 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,B.transition,B.focusRingPanel,D===e?`bg-accent-soft text-accent-fg shadow-surface`:`text-fg hover:bg-surface-hover`),onClick:()=>I(e),children:[(0,Z.jsx)(`span`,{className:`block text-sm font-medium`,children:L[e].title}),(0,Z.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:L[e].hint})]},e))})]}),(0,Z.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.budgetPreview}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.budgetPreviewHint})]}),(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2.5 py-1 font-mono text-xs text-fg-muted`,children:t.previewModel128k})]}),(0,Z.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Z.jsx)(`span`,{children:t.compactionTrigger}),(0,Z.jsx)(`span`,{className:`font-mono text-fg`,children:Xe(k)})]}),(0,Z.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Z.jsx)(`div`,{className:`h-full rounded-full bg-accent`,style:{width:`${A}%`}})})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Z.jsx)(`span`,{children:t.hardInputLimit}),(0,Z.jsx)(`span`,{className:`font-mono text-fg`,children:Xe(O)})]}),(0,Z.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Z.jsx)(`div`,{className:`h-full rounded-full bg-fg-subtle`,style:{width:`${j}%`}})})]})]}),(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:t.budgetFormula})]}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)($,{id:`compaction-trigger-threshold`,label:t.triggerThreshold,hint:t.triggerThresholdHint,value:Number((y.triggerThreshold*100).toFixed(2)),min:10,max:98,step:.1,onChange:e=>x({triggerThreshold:e/100})}),(0,Z.jsx)($,{id:`compaction-reserve-tokens`,label:t.reserveTokens,hint:t.reserveTokensHint.replace(`{{tokens}}`,Xe(y.reserveTokens)),value:y.reserveTokens,min:1024,step:1024,onChange:e=>x({reserveTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-recent-turns`,label:t.recentTurnsPreserve,hint:t.recentTurnsPreserveHint,value:y.recentTurnsPreserve,min:1,max:12,onChange:e=>x({recentTurnsPreserve:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-keep-recent-tokens`,label:t.keepRecentTokens,hint:t.keepRecentTokensHint.replace(`{{tokens}}`,Xe(y.keepRecentTokens)),value:y.keepRecentTokens,min:1e3,step:1e3,onChange:e=>x({keepRecentTokens:Math.floor(e)})})]}),P?(0,Z.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.retentionWarning}):null,(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.summaryModel}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,Z.jsx)(U,{value:y.model??``,disabled:!y.enabled,placeholder:t.summaryModelInherited,searchPlaceholder:t.summaryModelSearch,noMatches:t.summaryModelNoMatches,models:i,modelsLoading:a,className:`min-w-0 flex-1 justify-between`,contentAlign:`start`,showProviderSettingsFooter:!0,onChange:e=>x({model:e})}),y.model?(0,Z.jsx)(b,{type:`button`,variant:`secondary`,onClick:()=>x({model:void 0}),children:t.summaryModelUseSession}):null]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.summaryModelHint})]}),(0,Z.jsx)(Ze,{label:t.qualityGuard,hint:t.qualityGuardHint,checked:y.qualityGuard,onChange:e=>x({qualityGuard:e})}),(0,Z.jsx)(Ze,{label:t.gapAudit,hint:t.gapAuditHint,checked:y.gapAudit,onChange:e=>x({gapAudit:e})})]}),y.qualityGuard?null:(0,Z.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.qualityGuardWarning}),(0,Z.jsx)(Ee,{children:(0,Z.jsxs)(`div`,{className:`space-y-5 rounded-xl bg-surface-base/45 p-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:t.advancedTitle}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.advancedHint})]}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)($,{id:`compaction-min-messages`,label:t.minMessagesBeforeCompact,hint:t.minMessagesBeforeCompactHint,value:y.minMessagesBeforeCompact,min:2,onChange:e=>x({minMessagesBeforeCompact:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-max-transcript-mb`,label:t.maxActiveTranscriptMb,hint:t.maxActiveTranscriptMbHint,value:Number((y.maxActiveTranscriptBytes/1e6).toFixed(3)),min:.064,step:.1,onChange:e=>x({maxActiveTranscriptBytes:Math.max(64e3,Math.round(e*1e6))})}),(0,Z.jsx)($,{id:`compaction-summary-max-tokens`,label:t.summaryMaxTokens,hint:t.summaryMaxTokensHint,value:y.summaryMaxTokens,min:256,step:256,onChange:e=>x({summaryMaxTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-summary-chunk-tokens`,label:t.summaryChunkTokens,hint:t.summaryChunkTokensHint,value:y.summaryChunkTokens,min:1e3,step:1e3,onChange:e=>x({summaryChunkTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-summary-timeout`,label:t.summaryTimeoutSeconds,hint:t.summaryTimeoutSecondsHint.replace(`{{seconds}}`,String(F)),value:y.summaryTimeoutMs/1e3,min:1,max:600,onChange:e=>x({summaryTimeoutMs:Math.round(e*1e3)})}),(0,Z.jsx)($,{id:`compaction-summary-retries`,label:t.summaryRetries,hint:t.summaryRetriesHint,value:y.summaryRetries,min:0,max:5,onChange:e=>x({summaryRetries:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-min-tool-result-chars`,label:t.minToolResultKeepChars,hint:t.minToolResultKeepCharsHint,value:y.minToolResultKeepChars,min:200,step:100,onChange:e=>x({minToolResultKeepChars:Math.floor(e)})})]}),N?(0,Z.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:t.summaryBudgetWarning}):null,(0,Z.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.postCompactionSections}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.postCompactionSectionsHint}),y.postCompactionSections.length>0?(0,Z.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:y.postCompactionSections.map(e=>(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 py-1.5 text-xs text-fg`,children:[e,(0,Z.jsx)(`button`,{type:`button`,className:u(`text-fg-muted hover:text-fg`,B.press),"aria-label":t.removeSection.replace(`{{section}}`,e),onClick:()=>x({postCompactionSections:y.postCompactionSections.filter(t=>t!==e)}),children:(0,Z.jsx)(l,{className:`size-3.5`,"aria-hidden":!0})})]},e))}):(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.postCompactionSectionsEmpty}),(0,Z.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,Z.jsx)(`input`,{className:qe(),value:f,maxLength:120,disabled:y.postCompactionSections.length>=12,placeholder:t.postCompactionSectionsPlaceholder,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),R())}}),(0,Z.jsxs)(b,{type:`button`,variant:`secondary`,disabled:!f.trim()||y.postCompactionSections.length>=12,onClick:R,children:[(0,Z.jsx)(c,{className:`size-4`,"aria-hidden":!0}),t.addSection]})]})]})]})})]})]})}function $e(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function et(e){return e===`main`||e===`per-peer`||e===`per-channel-peer`||e===`per-account-channel-peer`?e:`main`}function tt(e){let t=$e(e)?e:{},n=$e(t.session)?t.session:{},r=$e(n.storage)?n.storage:{},i=typeof r.pruneAfterDays==`number`&&Number.isFinite(r.pruneAfterDays)?Math.max(0,Math.floor(r.pruneAfterDays)):typeof r.pruneAfterMs==`number`&&Number.isFinite(r.pruneAfterMs)?Math.max(0,Math.round(r.pruneAfterMs/864e5)):null,a=typeof r.maxEntries==`number`&&Number.isFinite(r.maxEntries)?Math.max(1,Math.floor(r.maxEntries)):null;return{dmScope:et(n.dmScope),pruneAfterDays:i,maxEntries:a}}async function nt(e){await d(m(`/api/config`),{method:`PATCH`,body:JSON.stringify({session:{dmScope:e.dmScope,storage:{pruneAfterMs:e.pruneAfterDays===null?null:e.pruneAfterDays*864e5,maxEntries:e.maxEntries}}})}),x()}function rt(){return u(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,F,`dark:border-edge`)}var it=G();function at({hasToken:e}){let t=h(p(e=>e.language)).sessions.config,{data:n,isLoading:r}=S(e),i=(0,X.useMemo)(()=>n?.payload?.config===void 0?null:tt(n.payload.config),[n]),[s,c]=(0,X.useReducer)(it,{form:null,baseline:null}),l=s.form,u=s.baseline,d=(0,X.useRef)(!1),f=(0,X.useRef)(l);f.current=l;let m=(0,X.useRef)(null);K({enabled:e,parsed:i,dirty:d.current,trackedParsedRef:m,dispatch:c,onResetDirty:()=>{d.current=!1}});let g=!!(l&&u&&JSON.stringify(l)!==JSON.stringify(u)),_=(0,X.useCallback)(e=>{d.current=!0,c({type:`patch`,patch:e})},[]),v=we({value:l,dirty:g,onSave:(0,X.useCallback)(async e=>{try{await nt(e),c({type:`saved`,value:e}),d.current=!!(f.current&&JSON.stringify(f.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError])});return!e||!l?r?(0,Z.jsx)(J,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Z.jsx)(C,{className:`h-5 w-40`}),(0,Z.jsx)(C,{className:`h-24 w-full rounded-xl`})]})}):null:(0,Z.jsxs)(J,{onBlurCapture:v.onBlurCapture,children:[(0,Z.jsx)(Ce,{icon:se,title:t.title,subtitle:t.hint,trailing:(0,Z.jsx)(Y,{status:v.status,error:v.error})}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.dmScope}),(0,Z.jsxs)(a,{className:rt(),value:l.dmScope,onChange:e=>_({dmScope:e.target.value}),children:[(0,Z.jsx)(o,{value:`main`,children:t.dmScopeMain}),(0,Z.jsx)(o,{value:`per-peer`,children:t.dmScopePerPeer}),(0,Z.jsx)(o,{value:`per-channel-peer`,children:t.dmScopePerChannelPeer}),(0,Z.jsx)(o,{value:`per-account-channel-peer`,children:t.dmScopePerAccountChannelPeer})]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.dmScopeHint})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.pruneAfterDays}),(0,Z.jsx)(`input`,{type:`number`,min:0,className:rt(),value:l.pruneAfterDays??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();_({pruneAfterDays:t===``?null:Math.max(0,Math.floor(Number(t)||0))})}})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.maxEntries}),(0,Z.jsx)(`input`,{type:`number`,min:1,className:rt(),value:l.maxEntries??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();_({maxEntries:t===``?null:Math.max(1,Math.floor(Number(t)||1))})}})]})]})]})}function ot(e){if(typeof e==`string`)return e.length>2e3?`${e.slice(0,2e3)}…`:e;try{let t=JSON.stringify(e,null,2);return t.length>2e3?`${t.slice(0,2e3)}…`:t}catch{return String(e)}}function st(e){let t=(0,De.c)(60),{open:n,loading:r,session:i,sessionAgentId:a,sessionAgentAvatar:o,labels:s,onClose:c,onArchive:d,onUnarchive:f,onPin:p,onUnpin:m,onExport:h,onDelete:ne}=e,x=i?.status===`archived`,S=i?.status===`pinned`,C;t[0]===c?C=t[1]:(C=e=>!e&&c(),t[0]=c,t[1]=C);let T;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(g,{className:u(`xopc-dialog-overlay fixed inset-0 bg-scrim`,w)}),t[2]=T):T=t[2];let E;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(E=u(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-panel shadow-popover outline-none`,re,`dark:border-edge`),t[3]=E):E=t[3];let D;t[4]!==i||t[5]!==o||t[6]!==a?(D=i&&a?(0,Z.jsx)(N,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}):null,t[4]=i,t[5]=o,t[6]=a,t[7]=D):D=t[7];let O;t[8]!==s.unnamedSession||t[9]!==i?.name?(O=i?.name?.trim()||s.unnamedSession,t[8]=s.unnamedSession,t[9]=i?.name,t[10]=O):O=t[10];let k;t[11]===O?k=t[12]:(k=(0,Z.jsx)(ee,{className:`min-w-0 flex-1 truncate text-base font-semibold tracking-tight text-fg`,children:O}),t[11]=O,t[12]=k);let A;t[13]!==D||t[14]!==k?(A=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[D,k]}),t[13]=D,t[14]=k,t[15]=A):A=t[15];let j;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(l,{className:`size-5`,strokeWidth:1.75}),t[16]=j):j=t[16];let M;t[17]===s.close?M=t[18]:(M=(0,Z.jsx)(_,{asChild:!0,children:(0,Z.jsx)(b,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":s.close,children:j})}),t[17]=s.close,t[18]=M);let P;t[19]!==A||t[20]!==M?(P=(0,Z.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[A,M]}),t[19]=A,t[20]=M,t[21]=P):P=t[21];let F;t[22]!==s.detailLoading||t[23]!==s.detailMessages||t[24]!==r||t[25]!==i?(F=r?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:s.detailLoading}):i?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`dl`,{className:`mb-4 grid gap-2 text-xs text-fg-muted`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-fg-disabled`,children:`Key`}),(0,Z.jsx)(`dd`,{className:`mt-0.5 break-all font-mono text-fg`,children:i.key})]}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-4`,children:(0,Z.jsxs)(`span`,{children:[i.messageCount,` msgs · `,i.estimatedTokens,` tok`]})})]}),(0,Z.jsx)(`h3`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:s.detailMessages}),(0,Z.jsx)(`ul`,{className:`space-y-3`,children:i.messages.map(ct)})]}):null,t[22]=s.detailLoading,t[23]=s.detailMessages,t[24]=r,t[25]=i,t[26]=F):F=t[26];let I;t[27]===F?I=t[28]:(I=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:F}),t[27]=F,t[28]=I);let L;t[29]!==s.detailExport||t[30]!==h?(L=(0,Z.jsx)(b,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:h,children:s.detailExport}),t[29]=s.detailExport,t[30]=h,t[31]=L):L=t[31];let R;t[32]!==x||t[33]!==s.archive||t[34]!==s.unarchive||t[35]!==d||t[36]!==f?(R=x?(0,Z.jsx)(b,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:f,children:s.unarchive}):(0,Z.jsx)(b,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:d,children:s.archive}),t[32]=x,t[33]=s.archive,t[34]=s.unarchive,t[35]=d,t[36]=f,t[37]=R):R=t[37];let z;t[38]!==S||t[39]!==s.pin||t[40]!==s.unpin||t[41]!==p||t[42]!==m?(z=S?(0,Z.jsx)(b,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:m,children:s.unpin}):(0,Z.jsx)(b,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:p,children:s.pin}),t[38]=S,t[39]=s.pin,t[40]=s.unpin,t[41]=p,t[42]=m,t[43]=z):z=t[43];let B;t[44]!==s.delete||t[45]!==ne?(B=(0,Z.jsx)(b,{type:`button`,variant:`secondary`,className:`text-sm text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`,onClick:ne,children:s.delete}),t[44]=s.delete,t[45]=ne,t[46]=B):B=t[46];let V;t[47]!==L||t[48]!==R||t[49]!==z||t[50]!==B?(V=(0,Z.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3 dark:border-edge`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[L,R,z,B]})}),t[47]=L,t[48]=R,t[49]=z,t[50]=B,t[51]=V):V=t[51];let H;t[52]!==P||t[53]!==I||t[54]!==V?(H=(0,Z.jsxs)(v,{children:[T,(0,Z.jsxs)(y,{className:E,"aria-describedby":void 0,children:[P,I,V]})]}),t[52]=P,t[53]=I,t[54]=V,t[55]=H):H=t[55];let ie;return t[56]!==n||t[57]!==C||t[58]!==H?(ie=(0,Z.jsx)(te,{open:n,onOpenChange:C,children:H}),t[56]=n,t[57]=C,t[58]=H,t[59]=ie):ie=t[59],ie}function ct(e){return(0,Z.jsxs)(`li`,{className:`rounded-lg border border-edge-subtle bg-surface-hover/50 p-2 dark:border-edge`,children:[(0,Z.jsx)(`div`,{className:`mb-1 text-[10px] font-medium uppercase text-fg-subtle`,children:e.role}),(0,Z.jsx)(`pre`,{className:`max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-relaxed text-fg-muted`,children:ot(e.content)})]},`${e.timestamp??``}-${e.role}-${ot(e.content).slice(0,24)}`)}var lt=20;function ut(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}var dt=new Set([`all`,`active`,`pinned`,`archived`]),ft=new Set([`grid`,`list`]),pt=[`sessions`,`settings`];function mt(e){return e&&pt.includes(e)?e:`sessions`}function ht(e,t){return t===`sessions`?e.tabsSessions:e.tabsSettings}function gt(e,t){return t===`sessions`?e.tabsSessionsHint:e.tabsSettingsHint}function _t(e){let t=(0,De.c)(7),{s:n,activeTab:r,onChange:i}=e,a;t[0]===n?a=t[1]:(a=pt.map(e=>({id:e,label:ht(n,e),icon:e===`sessions`?ue:j})),t[0]=n,t[1]=a);let o=a,s;return t[2]!==r||t[3]!==o||t[4]!==i||t[5]!==n.tabsAriaLabel?(s=(0,Z.jsx)(Te,{items:o,activeTab:r,onChange:i,ariaLabel:n.tabsAriaLabel,tabIdPrefix:`sessions-tab`,panelIdPrefix:`sessions-panel`}),t[2]=r,t[3]=o,t[4]=i,t[5]=n.tabsAriaLabel,t[6]=s):s=t[6],s}function vt(e){let t=(0,De.c)(10),{s:n,id:r,activeTab:i,plain:a,children:o}=e,s=a===void 0?!1:a;if(i!==r)return null;let c=`sessions-panel-${r}`,l=`sessions-tab-${r}`,u=s?`contents`:`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,d;t[0]!==o||t[1]!==r||t[2]!==s||t[3]!==n?(d=s?o:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`mb-5`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:ht(n,r)}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:gt(n,r)})]}),(0,Z.jsx)(`div`,{className:`space-y-4`,children:o})]}),t[0]=o,t[1]=r,t[2]=s,t[3]=n,t[4]=d):d=t[4];let f;return t[5]!==c||t[6]!==l||t[7]!==u||t[8]!==d?(f=(0,Z.jsx)(`section`,{id:c,role:`tabpanel`,"aria-labelledby":l,className:u,children:d}),t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f):f=t[9],f}function yt(e){let t=e.get(`status`),n=e.get(`view`);return{searchInput:e.get(`q`)??``,debouncedSearch:(e.get(`q`)??``).trim(),statusFilter:dt.has(t)?t:`all`,viewMode:ft.has(n)?n:`grid`,channelFilter:(e.get(`channel`)??``).trim(),sessions:[],loading:!1,error:null,hasMore:!1,stats:null,detailOpen:!1,detailLoading:!1,detailSession:null,confirmOpen:!1,confirmKey:null}}function bt(){let e=h(p(e=>e.language)),t=e.sessions,n=f(e=>e.conversationId),r=!!n,{data:a,mutate:o}=ne(r?[`gateway-chat-agents`,n]:null,ce,{revalidateOnFocus:!1}),s=a?.defaultId??`main`,c=a?.items??[],[l,d]=i(),m=mt(l.get(`tab`)),_=(0,X.useCallback)(e=>{let t=new URLSearchParams(l);e===`sessions`?t.delete(`tab`):t.set(`tab`,e),d(t,{replace:!0})},[l,d]),[x,S]=(0,X.useReducer)(ae,l,yt),{searchInput:C,debouncedSearch:T,statusFilter:E,viewMode:j,channelFilter:N,sessions:P,loading:F,error:ie,hasMore:U,stats:W,detailOpen:se,detailLoading:pe,detailSession:G,confirmOpen:me,confirmKey:K}=x;(0,X.useEffect)(()=>{let e=setTimeout(()=>{let e=C.trim();T!==e&&S({type:`patch`,patch:{debouncedSearch:e}})},300);return()=>clearTimeout(e)},[C,T]);let q=l.toString(),ge=(0,X.useRef)(q);if(ge.current!==q){ge.current=q;let e=l.get(`q`)??``,t=l.get(`status`),n=l.get(`view`),r=(l.get(`channel`)??``).trim(),i=dt.has(t)?t:`all`,a=ft.has(n)?n:`grid`,o=e.trim();S({type:`patch`,patch:{...C===e?{}:{searchInput:e},...T===o?{}:{debouncedSearch:o},...E===i?{}:{statusFilter:i},...j===a?{}:{viewMode:a},...N===r?{}:{channelFilter:r}}})}(0,X.useEffect)(()=>{let e=new URLSearchParams(l),t=T.trim();t?e.set(`q`,t):e.delete(`q`),E===`all`?e.delete(`status`):e.set(`status`,E),j===`grid`?e.delete(`view`):e.set(`view`,j),N?e.set(`channel`,N):e.delete(`channel`),e.toString()!==l.toString()&&d(e,{replace:!0})},[T,l,d,E,j,N]),(0,X.useEffect)(()=>{if(!r||m!==`sessions`)return;let e=!1;return(async()=>{S({type:`patch`,patch:{loading:!0,error:null}});try{let t=await M({limit:lt,offset:0,...T?{search:T}:{},...E===`all`?{}:{status:E},...N?{channel:N}:{}});if(e)return;S({type:`patch`,patch:{sessions:t.items,hasMore:t.hasMore}})}catch(n){e||S({type:`patch`,patch:{error:n instanceof Error?n.message:t.loadError}})}finally{e||S({type:`patch`,patch:{loading:!1}})}})(),()=>{e=!0}},[r,m,T,E,N,t.loadError]),(0,X.useEffect)(()=>{!r||m!==`sessions`||z().then(e=>S({type:`patch`,patch:{stats:e}})).catch(()=>{})},[r,m]),(0,X.useEffect)(()=>{if(!r||m!==`sessions`)return;let e=()=>void o();return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[r,m,o]),(0,X.useEffect)(()=>{if(!r||m!==`sessions`)return;let e=e=>{let t=e.detail;!t?.key||t.name===void 0||S({type:`patch`,patch:{sessions:P.map(e=>e.key===t.key?{...e,name:t.name}:e),detailSession:G&&G.key===t.key?{...G,name:t.name}:G}})};return window.addEventListener(`session-updated`,e),()=>{window.removeEventListener(`session-updated`,e)}},[r,m,P,G]);let ve=(0,X.useCallback)(async()=>{if(!(!r||F||!U)){S({type:`patch`,patch:{loading:!0,error:null}});try{let e=await M({limit:lt,offset:P.length,...T?{search:T}:{},...E===`all`?{}:{status:E},...N?{channel:N}:{}});S({type:`patch`,patch:{sessions:[...P,...e.items],hasMore:e.hasMore}})}catch(e){S({type:`patch`,patch:{error:e instanceof Error?e.message:t.loadError}})}finally{S({type:`patch`,patch:{loading:!1}})}}},[r,F,U,P.length,T,E,N,t.loadError]),be=(0,X.useCallback)((e,t)=>{S({type:`patch`,patch:{sessions:P.map(n=>n.key===e?{...n,status:t}:n),detailSession:G&&G.key===e?{...G,status:t}:G}})},[P,G]),Ce=(0,X.useCallback)(async e=>{S({type:`patch`,patch:{detailOpen:!0,detailLoading:!0,detailSession:null}});try{S({type:`patch`,patch:{detailSession:await _e(e)}})}catch{S({type:`patch`,patch:{detailOpen:!1}})}finally{S({type:`patch`,patch:{detailLoading:!1}})}},[]),J=e=>{Ce(e)},Y=async(e,t)=>{if(t===`continue`){window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:e},bubbles:!0}));return}if(t===`delete`){S({type:`patch`,patch:{confirmKey:e,confirmOpen:!0}});return}try{switch(t){case`archive`:await ye(e),be(e,`archived`);break;case`unarchive`:await de(e),be(e,`active`);break;case`pin`:await A(e),be(e,`pinned`);break;case`unpin`:await D(e),be(e,`active`);break;case`export`:{let t=await k(e),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`session-${e.replace(/[^a-z0-9]/gi,`_`)}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r);break}default:break}z().then(e=>S({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},we=async e=>{try{await R(e),S({type:`patch`,patch:{sessions:P.filter(t=>t.key!==e),detailSession:G?.key===e?null:G,...G?.key===e?{detailOpen:!1}:{}}}),z().then(e=>S({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},Te={continueChat:t.continueChat,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,export:t.export,delete:t.delete,unnamedSession:e.chat.newSession},Ee={close:t.close,detailLoading:t.detailLoading,detailMessages:t.detailMessages,detailExport:t.detailExport,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,delete:t.delete,unnamedSession:e.chat.newSession},De=[{key:`all`,label:t.filterAll,icon:ue},{key:`active`,label:t.filterActive,icon:V},{key:`pinned`,label:t.filterPinned,icon:he},{key:`archived`,label:t.filterArchived,icon:oe}],Oe=(()=>{let e=Object.entries(W?.byChannel??{}).sort((e,t)=>t[1]-e[1]).slice(0,6).map(([e])=>e),t=new Set(e);for(let n of[`telegram`,`weixin`,`feishu`])t.has(n)||(e.push(n),t.add(n));return e.slice(0,8)})();return r?(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-surface-panel`,children:[(0,Z.jsxs)(Se,{gap:`gap-6`,children:[(0,Z.jsx)(xe,{title:t.title}),(0,Z.jsx)(_t,{s:t,activeTab:m,onChange:_}),(0,Z.jsx)(vt,{s:t,id:`settings`,activeTab:m,plain:!0,children:(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(Qe,{hasToken:r}),(0,Z.jsx)(at,{hasToken:r})]})}),(0,Z.jsxs)(vt,{s:t,id:`sessions`,activeTab:m,plain:!0,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:De.map(({key:e,label:t,icon:n})=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":E===e,onClick:()=>S({type:`patch`,patch:{statusFilter:e}}),className:u(`inline-flex items-center gap-1.5 rounded-xl px-3 py-2 text-sm font-medium`,B.transition,B.focusRingPanel,E===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[(0,Z.jsx)(n,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t]},e))}),(0,Z.jsxs)(`div`,{className:`flex min-h-11 w-full min-w-0 items-center gap-2 rounded-xl bg-surface-base focus-within:ring-2 focus-within:ring-accent px-3 py-2 transition-colors lg:max-w-md dark:bg-surface-hover/40`,children:[(0,Z.jsx)(le,{className:`size-4 shrink-0 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`input`,{type:`search`,value:C,onChange:e=>S({type:`patch`,patch:{searchInput:e.target.value}}),placeholder:t.searchPlaceholder,"aria-label":t.searchPlaceholder,"data-debounced-query":T||void 0,className:`min-w-0 flex-1 border-0 bg-transparent text-base sm:text-sm text-fg placeholder:text-fg-disabled focus:outline-none focus:ring-0`})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg-subtle`,children:t.filterChannelLabel}),(0,Z.jsx)(`button`,{type:`button`,"aria-pressed":!N,onClick:()=>S({type:`patch`,patch:{channelFilter:``}}),className:u(`touch-target inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,B.transition,B.focusRingPanel,N?`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`:`bg-accent-soft text-accent-fg`),children:t.filterChannelAll}),Oe.map(e=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":N===e,onClick:()=>S({type:`patch`,patch:{channelFilter:e}}),className:u(`touch-target inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,B.transition,B.focusRingPanel,N===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[e,W?.byChannel?.[e]==null?null:(0,Z.jsx)(`span`,{className:`ml-2 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] text-fg-subtle`,children:W.byChannel[e]})]},e))]}),W?(0,Z.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[[W.totalSessions,t.totalSessions],[W.activeSessions,t.activeSessions],[W.pinnedSessions,t.pinnedSessions],[W.archivedSessions,t.archivedSessions]].map(([e,t])=>(0,Z.jsxs)(`div`,{className:`rounded-xl bg-surface-base p-3 dark:bg-surface-hover/30`,children:[(0,Z.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-fg`,children:e}),(0,Z.jsx)(`div`,{className:`text-xs text-fg-muted`,children:t})]},t))}):null,ie?(0,Z.jsx)(`div`,{className:`rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700 dark:bg-red-950/40 dark:text-red-300`,children:ie}):null,(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:ut(t.sessionCount,{count:P.length})}),(0,Z.jsxs)(`div`,{className:H,role:`group`,"aria-label":t.layoutToggleGroup,children:[(0,Z.jsx)(b,{type:`button`,variant:`segmented`,title:t.gridView,"aria-pressed":j===`grid`,onClick:()=>S({type:`patch`,patch:{viewMode:`grid`}}),className:u(O,`size-7 p-0`,j===`grid`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,j===`grid`&&`text-accent-fg`),children:(0,Z.jsx)(fe,{className:`size-3.5`,strokeWidth:1.5})}),(0,Z.jsx)(b,{type:`button`,variant:`segmented`,title:t.listView,"aria-pressed":j===`list`,onClick:()=>S({type:`patch`,patch:{viewMode:`list`}}),className:u(O,`size-9 p-0`,j===`list`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,j===`list`&&`text-accent-fg`),children:(0,Z.jsx)(I,{className:`size-3.5`,strokeWidth:1.5})})]})]}),F&&P.length===0?(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:6}).map((e,t)=>(0,Z.jsx)(`div`,{className:`h-40 animate-pulse rounded-xl bg-surface-hover/60 dark:bg-surface-hover/40`},t))}):P.length===0?(0,Z.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-2xl bg-surface-base py-16 text-center dark:bg-surface-hover/25`,children:[(0,Z.jsx)(L,{className:`mb-3 size-12 text-fg-disabled`,strokeWidth:1.25,"aria-hidden":!0}),(0,Z.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:t.noSessions}),(0,Z.jsx)(`p`,{className:`mt-1 max-w-sm text-sm text-fg-muted`,children:t.noSessionsDescription}),(0,Z.jsx)(b,{variant:`primary`,className:`mt-6`,onClick:()=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{conversationId:``},bubbles:!0}))},children:t.startNewChat})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:u(`grid min-w-0 gap-3`,j===`grid`?`sm:grid-cols-2 lg:grid-cols-3`:`grid-cols-1`),"data-debounced-query":T||void 0,children:P.map(e=>{let t=Fe(e,s);return(0,Z.jsx)(Ae,{session:e,variant:j,labels:Te,sessionAgentId:t,sessionAgentAvatar:Ie(t,c),onOpen:()=>J(e.key),onAction:t=>void Y(e.key,t)},e.key)})}),U?(0,Z.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Z.jsx)(b,{type:`button`,variant:`secondary`,disabled:F,onClick:()=>void ve(),children:t.loadMore})}):null]})]})]}),(0,Z.jsx)(st,{open:se,loading:pe,session:G,sessionAgentId:G?Fe(G,s):void 0,sessionAgentAvatar:G?Ie(Fe(G,s),c):void 0,labels:Ee,onClose:()=>{S({type:`patch`,patch:{detailOpen:!1,detailSession:null}})},onArchive:()=>G&&void Y(G.key,`archive`),onUnarchive:()=>G&&void Y(G.key,`unarchive`),onPin:()=>G&&void Y(G.key,`pin`),onUnpin:()=>G&&void Y(G.key,`unpin`),onExport:()=>G&&void Y(G.key,`export`),onDelete:()=>G&&S({type:`patch`,patch:{confirmKey:G.key,confirmOpen:!0}})}),(0,Z.jsx)(te,{open:me,onOpenChange:e=>S({type:`patch`,patch:{confirmOpen:e}}),children:(0,Z.jsxs)(v,{children:[(0,Z.jsx)(g,{className:u(`xopc-dialog-overlay fixed inset-0 bg-scrim`,w)}),(0,Z.jsxs)(y,{className:u(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,re),children:[(0,Z.jsx)(ee,{className:`text-base font-semibold text-fg`,children:t.deleteSessionTitle}),(0,Z.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:K?ut(t.deleteSessionMessage,{name:P.find(e=>e.key===K)?.name?.trim()||e.chat.newSession}):``}),(0,Z.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Z.jsx)(b,{type:`button`,variant:`secondary`,onClick:()=>S({type:`patch`,patch:{confirmOpen:!1}}),children:t.cancel}),(0,Z.jsx)(b,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:()=>{K&&we(K),S({type:`patch`,patch:{confirmOpen:!1,confirmKey:null}})},children:t.delete})]})]})]})})]}):(0,Z.jsx)(`div`,{className:`w-full px-3 py-16 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:t.needToken})}export{bt as SessionsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Sn as e}from"./index-hlU8MUEz.js";function t(t){let{children:n,fallback:r}=t,i=r===void 0?null:r;return e()?n:i}export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{Jc as r,Ts as i}from"./index-hlU8MUEz.js";var a=e();function o(){return`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`}var s=t();function c(e){let t=(0,a.c)(7),{children:r,className:i,id:c,onBlurCapture:l}=e,u;t[0]===i?u=t[1]:(u=n(o(),i),t[0]=i,t[1]=u);let d;return t[2]!==r||t[3]!==c||t[4]!==l||t[5]!==u?(d=(0,s.jsx)(`section`,{id:c,className:u,onBlurCapture:l,children:r}),t[2]=r,t[3]=c,t[4]=l,t[5]=u,t[6]=d):d=t[6],d}var l=`mt-0.5 flex size-7 shrink-0 items-center justify-center text-fg-muted transition-colors`;function u(e){let t=(0,a.c)(27),{icon:o,title:c,subtitle:u,trailing:d,titleAccessory:f,className:p,iconInteractive:m,iconLeading:h}=e,g;t[0]===o?g=t[1]:(g=(0,s.jsx)(o,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=o,t[1]=g);let _=h??g,v,y;if(t[2]!==p||t[3]!==m||t[4]!==h||t[5]!==_){let e=h?n(`flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-surface-panel p-0 ring-1 ring-inset ring-edge-subtle transition-[box-shadow] hover:ring-accent/40 dark:ring-edge-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,i.press):n(l,`hover:text-fg`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,i.press),a=!!(m&&h);t[8]===p?v=t[9]:(v=n(`mb-4 flex items-start gap-2.5`,p),t[8]=p,t[9]=v),y=m?a?(0,s.jsxs)(`span`,{className:`relative shrink-0`,children:[(0,s.jsx)(`button`,{type:`button`,id:m.id,onClick:m.onClick,"aria-label":m.ariaLabel,className:n(`touch-target`,e),children:_}),(0,s.jsx)(`span`,{className:`pointer-events-none absolute -bottom-0.5 -right-0.5 flex size-4 items-center justify-center rounded-md border border-edge bg-surface-panel text-fg-muted shadow-sm dark:border-edge dark:bg-surface-base`,"aria-hidden":!0,children:(0,s.jsx)(r,{className:`size-2.5`,strokeWidth:2.25})})]}):(0,s.jsx)(`button`,{type:`button`,id:m.id,onClick:m.onClick,"aria-label":m.ariaLabel,className:n(`touch-target`,e),children:_}):(0,s.jsx)(`div`,{className:n(h?`flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-surface-panel ring-1 ring-inset ring-edge-subtle dark:ring-edge-subtle`:l),"aria-hidden":!h,children:_}),t[2]=p,t[3]=m,t[4]=h,t[5]=_,t[6]=v,t[7]=y}else v=t[6],y=t[7];let b;t[10]===c?b=t[11]:(b=(0,s.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:c}),t[10]=c,t[11]=b);let x;t[12]!==b||t[13]!==f?(x=(0,s.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[b,f]}),t[12]=b,t[13]=f,t[14]=x):x=t[14];let S;t[15]===u?S=t[16]:(S=u?(0,s.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:u}):null,t[15]=u,t[16]=S);let C;t[17]!==x||t[18]!==S?(C=(0,s.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S]}),t[17]=x,t[18]=S,t[19]=C):C=t[19];let w;t[20]===d?w=t[21]:(w=d?(0,s.jsx)(`div`,{className:`shrink-0`,children:d}):null,t[20]=d,t[21]=w);let T;return t[22]!==v||t[23]!==y||t[24]!==C||t[25]!==w?(T=(0,s.jsxs)(`div`,{className:v,children:[y,C,w]}),t[22]=v,t[23]=y,t[24]=C,t[25]=w,t[26]=T):T=t[26],T}export{u as n,o as r,c as t};
|
package/dist/gateway/static/root/assets/{settings-page-BBG4jliE.js → settings-page-3yEAqoME.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{p as i,r as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{n as o}from"./locale-store-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{p as i,r as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{n as o}from"./locale-store-DLK05Y1a.js";import{t as s}from"./messages-C9h8SImu.js";import{_o as c,co as l,do as u,fo as d,go as f,ho as p,lo as m,mo as h,po as g,so as _,uo as v,vo as y,yo as b}from"./index-hlU8MUEz.js";var x=n(),S=e(t(),1),C=r(),w=[`overview`,`appearance`,`keyboard-shortcuts`,`system`,`desktop-pet`,`desktop-app`,`agent-defaults`,`gateway`,`runtimes`,`devices`,`heartbeat`,`remote-access`,`shares`],T=(0,S.lazy)(()=>c().then(e=>({default:e.SetupStatusPanel}))),E=(0,S.lazy)(()=>m().then(e=>({default:e.AppearanceSettingsPanel}))),D=(0,S.lazy)(()=>h().then(e=>({default:e.KeyboardShortcutsSettingsPanel}))),O=(0,S.lazy)(()=>b().then(e=>({default:e.SystemSettingsPanel}))),k=(0,S.lazy)(()=>v().then(e=>({default:e.DesktopPetSettings}))),A=(0,S.lazy)(()=>l().then(e=>({default:e.AppManagementSettingsPanel}))),j=(0,S.lazy)(()=>d().then(e=>({default:e.GatewaySettingsPanel}))),M=(0,S.lazy)(()=>f().then(e=>({default:e.RuntimeToolsSettingsPanel}))),N=(0,S.lazy)(()=>g().then(e=>({default:e.HeartbeatSettingsPanel}))),P=(0,S.lazy)(()=>p().then(e=>({default:e.RemoteAccessHub}))),F=(0,S.lazy)(()=>y().then(e=>({default:e.SharesSettingsPanel}))),I=(0,S.lazy)(()=>_().then(e=>({default:e.AgentDefaultsSettingsPanel}))),L=(0,S.lazy)(()=>u().then(e=>({default:e.EndpointToolsManagementSettings})));function R(){let e=(0,x.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsxs)(`div`,{className:`w-full flex-1 px-3 py-8 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,C.jsx)(`div`,{className:`h-8 w-48 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,C.jsx)(`div`,{className:`mt-6 h-36 animate-pulse rounded-xl bg-surface-hover`}),(0,C.jsx)(`div`,{className:`mt-4 h-24 animate-pulse rounded-xl bg-surface-hover`})]}),e[0]=t):t=e[0],t}function z(e){return(0,C.jsx)(S.Suspense,{fallback:(0,C.jsx)(R,{}),children:(0,C.jsx)(e,{})})}function B(){let e=(0,x.c)(28),{section:t}=i(),n=o(V),r,c,l,u,d;if(e[0]!==n||e[1]!==t){d=Symbol.for(`react.early_return_sentinel`);bb0:{let i=s(n);if(!t||!w.includes(t)){let t;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,C.jsx)(a,{to:`/settings/overview`,replace:!0}),e[7]=t):t=e[7],d=t;break bb0}let o=t;if(o===`overview`){let t;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(T),e[8]=t):t=e[8],d=t;break bb0}let f=i.settingsSections[o];if(o===`appearance`){let t;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(E),e[9]=t):t=e[9],d=t;break bb0}if(o===`keyboard-shortcuts`){let t;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(D),e[10]=t):t=e[10],d=t;break bb0}if(o===`system`){let t;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(O),e[11]=t):t=e[11],d=t;break bb0}if(o===`desktop-pet`){let t;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(k),e[12]=t):t=e[12],d=t;break bb0}if(o===`desktop-app`){let t;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(A),e[13]=t):t=e[13],d=t;break bb0}if(o===`agent-defaults`){let t;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(I),e[14]=t):t=e[14],d=t;break bb0}if(o===`gateway`){let t;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(j),e[15]=t):t=e[15],d=t;break bb0}if(o===`runtimes`){let t;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(M),e[16]=t):t=e[16],d=t;break bb0}if(o===`devices`){let t;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(L),e[17]=t):t=e[17],d=t;break bb0}if(o===`heartbeat`){let t;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(N),e[18]=t):t=e[18],d=t;break bb0}if(o===`remote-access`){let t;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(P),e[19]=t):t=e[19],d=t;break bb0}if(o===`shares`){let t;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(t=z(F),e[20]=t):t=e[20],d=t;break bb0}l=`flex w-full flex-col gap-3 px-3 py-8 sm:px-5 xl:px-6`,u=(0,C.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:f}),r=`text-sm text-fg-muted`,c=i.settingsPage.comingSoon.replace(`{{title}}`,f)}e[0]=n,e[1]=t,e[2]=r,e[3]=c,e[4]=l,e[5]=u,e[6]=d}else r=e[2],c=e[3],l=e[4],u=e[5],d=e[6];if(d!==Symbol.for(`react.early_return_sentinel`))return d;let f;e[21]!==r||e[22]!==c?(f=(0,C.jsx)(`p`,{className:r,children:c}),e[21]=r,e[22]=c,e[23]=f):f=e[23];let p;return e[24]!==l||e[25]!==u||e[26]!==f?(p=(0,C.jsxs)(`div`,{className:l,children:[u,f]}),e[24]=l,e[25]=u,e[26]=f,e[27]=p):p=e[27],p}function V(e){return e.language}export{B as SettingsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./external-link-DjqjBmc3.js";import{t as r}from"./cn-JdwAhgNB.js";var i=e(),a=t();function o(e){let t=(0,i.c)(14),n,o,s,c,l;t[0]===e?(n=t[1],o=t[2],s=t[3],c=t[4],l=t[5]):({children:n,className:o,gap:c,padding:l,...s}=e,t[0]=e,t[1]=n,t[2]=o,t[3]=s,t[4]=c,t[5]=l);let u=c===void 0?`gap-5`:c,d=l===void 0?`px-4 py-6 sm:px-5 xl:px-6`:l,f;t[6]!==o||t[7]!==u||t[8]!==d?(f=r(`settings-page-frame mx-auto flex min-h-full w-full max-w-[56rem] flex-col`,u,d,o),t[6]=o,t[7]=u,t[8]=d,t[9]=f):f=t[9];let p;return t[10]!==n||t[11]!==s||t[12]!==f?(p=(0,a.jsx)(`div`,{className:f,...s,children:n}),t[10]=n,t[11]=s,t[12]=f,t[13]=p):p=t[13],p}function s(e){let t=(0,i.c)(20),{title:o,subtitle:s,docsLink:c,docsLabel:l,meta:u,actions:d,className:f}=e,p;t[0]===f?p=t[1]:(p=r(`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,f),t[0]=f,t[1]=p);let m;t[2]===o?m=t[3]:(m=(0,a.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight sm:text-lg text-fg`,children:o}),t[2]=o,t[3]=m);let h;t[4]===s?h=t[5]:(h=s?(0,a.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-fg-muted sm:mt-1`,children:s}):null,t[4]=s,t[5]=h);let g;t[6]!==l||t[7]!==c?(g=c&&l?(0,a.jsxs)(`a`,{href:c,target:`_blank`,rel:`noreferrer`,className:`touch-target mt-1 inline-flex items-center gap-1 text-sm text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[l,(0,a.jsx)(n,{className:`size-3.5`,"aria-hidden":!0})]}):null,t[6]=l,t[7]=c,t[8]=g):g=t[8];let _;t[9]!==u||t[10]!==m||t[11]!==h||t[12]!==g?(_=(0,a.jsxs)(`div`,{className:`min-w-0`,children:[m,h,g,u]}),t[9]=u,t[10]=m,t[11]=h,t[12]=g,t[13]=_):_=t[13];let v;t[14]===d?v=t[15]:(v=d?(0,a.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-start gap-2 sm:justify-end`,children:d}):null,t[14]=d,t[15]=v);let y;return t[16]!==p||t[17]!==_||t[18]!==v?(y=(0,a.jsxs)(`header`,{className:p,children:[_,v]}),t[16]=p,t[17]=_,t[18]=v,t[19]=y):y=t[19],y}function c(e){let t=(0,i.c)(13),{id:n,activeTab:o,tabIdPrefix:s,panelIdPrefix:c,title:l,hint:u,showHeading:d,framed:f,children:p,className:m}=e,h=d===void 0?!0:d,g=f===void 0?!0:f;if(o!==n)return null;let _=`${c}-${n}`,v=`${s}-${n}`,y=g&&`rounded-xl bg-surface-hover/20 px-4 py-5 sm:px-5`,b;t[0]!==m||t[1]!==y?(b=r(`min-w-0`,y,m),t[0]=m,t[1]=y,t[2]=b):b=t[2];let x;t[3]!==u||t[4]!==h||t[5]!==l?(x=h&&(l||u)?(0,a.jsxs)(`div`,{className:`mb-5`,children:[l?(0,a.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:l}):null,u?(0,a.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:u}):null]}):null,t[3]=u,t[4]=h,t[5]=l,t[6]=x):x=t[6];let S;return t[7]!==p||t[8]!==_||t[9]!==v||t[10]!==b||t[11]!==x?(S=(0,a.jsxs)(`section`,{id:_,role:`tabpanel`,"aria-labelledby":v,className:b,children:[x,p]}),t[7]=p,t[8]=_,t[9]=v,t[10]=b,t[11]=x,t[12]=S):S=t[12],S}export{s as n,o as r,c as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as s}from"./cn-JdwAhgNB.js";import{a as c,c as l,n as u,r as d}from"./locale-store-DuG-kbsP.js";import{t as f}from"./messages-BYbx4OuI.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{r as m}from"./gateway-config-swr-COJzzscc.js";import{n as h}from"./electron-env-Dit0bHgy.js";import{n as g,t as _}from"./registry-api-BDgFNu05.js";import{Eu as v,Ic as y,Il as b,Mo as x,Nu as S,Ts as C,Tu as w,ac as T,ao as E,kt as D,mc as O,rd as k,yn as A}from"./index-54o0AGdj.js";import{n as j,r as M}from"./settings-page-layout-CsUQKRq0.js";import{n as N,t as P}from"./settings-form-section-C4D1p0xR.js";import{n as F}from"./settings-loading-skeleton-CAmWMaOT.js";import{t as I}from"./settings-advanced-gate-BG4EILeB.js";var L=e(t(),1),R=n();function z(e){if(!e||typeof e!=`object`)return 0;let t=e.providers;return!t||typeof t!=`object`||Array.isArray(t)?0:Object.values(t).filter(e=>typeof e==`string`&&x(e)).length}function B(e){if(!e||typeof e!=`object`)return``;let t=e.agents;if(!t||typeof t!=`object`||Array.isArray(t))return``;let n=t.defaults,r=n&&typeof n==`object`&&!Array.isArray(n)?n.models:void 0;if(!r||typeof r!=`object`||Array.isArray(r))return``;let i=r.chat;if(!i||typeof i!=`object`||Array.isArray(i))return``;let a=i.primary;return typeof a==`string`?a.trim():``}function ee(e){if(!e||typeof e!=`object`)return!1;let t=e.channels;return!t||typeof t!=`object`||Array.isArray(t)?!1:Object.values(t).some(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;if(`configured`in t||`config`in t||`schema`in t||`uiHints`in t){if(t.configured===!0)return!0;let e=t.config;if(!e||typeof e!=`object`||Array.isArray(e))return!1;let n=e;return n.enabled===!0||Object.keys(n).length>0}return t.enabled===!0||Object.keys(t).length>0})}function te(e){if(!e||typeof e!=`object`)return{enabled:!1,driverKind:`extension`};let t=e.browser;if(!t||typeof t!=`object`||Array.isArray(t))return{enabled:!1,driverKind:`extension`};let n=t,r=n.driver&&typeof n.driver==`object`&&!Array.isArray(n.driver)?n.driver:void 0;return{enabled:n.enabled===!0,driverKind:typeof r?.kind==`string`&&r.kind.trim()?r.kind.trim():`extension`}}function V(e){return e?`pass`:`fail`}function H(e){if(e===`tool-runtimes`)return`/settings/runtimes`;if(e===`provider-auth`)return`/settings/capabilities/models`;if(e===`config-health`)return`/settings/gateway`;if(e===`state-integrity`||e===`workspace-status`)return`/agents`;if(e===`database-schema`||e===`session-integrity`)return`/settings/sessions`;if(e===`channel-config`||e===`channel-pairing-pending`||e.startsWith(`channel:`))return`/channels`;if(e===`security-audit`||e===`gateway-service`||e===`gateway-health`)return`/settings/gateway`;if(e===`version-check`)return`/settings/desktop-app`}function U(e){return{fail:4,warn:3,skip:2,pass:1}[e]}function ne(e,t){let n=e.match(/^Run(?::|\s)(.*)$/i);if(n?.[1])return t.runCommand(n[1].trim());let r=e.match(/^Install(?::|\s)(.*)$/i);if(r?.[1])return t.installCommand(r[1].trim());let i=e.match(/^Start(?::|\s)(.*)$/i);return i?.[1]?t.startCommand(i[1].trim()):e}function W(e,t){if(!t)return e;let n=e.message;if(e.id===`tool-runtimes`){let r=e.message.match(/^(.*) runtime is not installed\.$/),i=e.message.match(/^(.*) runtime installation is invalid\.$/);r?.[1]?n=t.runtimeMissing(r[1]):i?.[1]&&(n=t.runtimeInvalid(i[1]))}else if(e.id===`gateway-service`)if(e.message===`Gateway is not installed as a system service.`)n=t.gatewayNotInstalled;else{let r=e.message.match(/^Service backend unavailable: (.*)$/),i=e.message.match(/^Gateway service is installed but not running \(status: (.*)\)\.$/);r?.[1]?n=t.gatewayUnavailable(r[1]):i?.[1]&&(n=t.gatewayNotRunning(i[1]))}else e.id===`provider-auth`&&e.message===`No API keys detected for configured providers.`&&(n=t.providerAuthMissing);return{...e,label:t.labels[e.id]??e.label,message:n,hints:e.hints.map(e=>ne(e,t))}}function G(e,t){return e.filter(e=>e.status===`fail`||e.status===`warn`).map(e=>{let n=W(e,t);return{id:n.id,label:n.label,status:n.status,message:n.message,hints:n.hints,path:H(n.id),source:`doctor`}}).toSorted((e,t)=>U(t.status)-U(e.status)||e.label.localeCompare(t.label))}function re(e){let t=new Map(e.doctorChecks.map(e=>[e.id,e])),n=[];for(let r of[`security-audit`,`channel-config`,`channel-pairing-pending`,`gateway-health`]){let i=t.get(r);if(i){let t=W(i,e.copy);n.push({id:t.id,label:t.label,status:t.status,message:t.message,path:H(t.id)})}}if(e.logsHealth){let t=e.logsHealth.stats?.errorsLast24h??0;n.push({id:`logs-health`,label:e.copy?.labels[`logs-health`]??`Logs`,status:e.logsHealth.shuttingDown||t>0?`warn`:`pass`,message:e.copy?e.logsHealth.shuttingDown?e.copy.logsShuttingDown:t>0?e.copy.logsErrors(t):e.copy.logsHealthy:e.logsHealth.shuttingDown?`Logger is shutting down.`:t>0?`${t} error(s) in the last 24 hours.`:`Log system is healthy.`,path:`/settings/logs`})}for(let t of e.browserDiagnostics??[]){let r=t.message;if(e.copy){r={"Local Chromium is installed.":e.copy.chromiumInstalled,"Local Chromium is not installed.":e.copy.chromiumNotInstalled,"Chrome extension bridge is connected.":e.copy.extensionConnected,"Chrome extension needs refresh.":e.copy.extensionNeedsRefresh,"Chrome extension is installed but not connected.":e.copy.extensionNotConnected,"Chrome extension is not installed.":e.copy.extensionNotInstalled}[t.message]??t.message;let n=t.message.match(/^Browser driver "(.*)" is configured\.$/);n?.[1]&&(r=e.copy.browserDriverConfigured(n[1]))}n.push({...t,label:e.copy?.labels[t.id]??t.label,message:r})}return n}function ie(e){let t=z(e.config),n=e.providerMeta?.configured??t,r=e.providerMeta?.total??0,i=n>0||t>0,a=B(e.config),o=a.length>0,s=e.hasToken&&e.realtimeConnected,c=ee(e.config),l=e.skillCount>0,u=(e.doctorChecks??[]).filter(t=>!e.isElectron||t.id!==`gateway-service`),d=G(u,e.labels.diagnostics),f=[{id:`gateway`,done:s,detail:s?e.labels.gatewayOnline:e.labels.gatewayOffline},{id:`provider`,done:i,detail:i?e.providerMeta&&e.providerMeta.total>0?e.labels.providersMetaReady(n,r):e.labels.providersConfigured(t):e.labels.providersMissing},{id:`defaultModel`,done:o,detail:o?e.labels.modelConfigured(a):e.labels.modelMissing},{id:`channel`,done:c,optional:!0,detail:c?e.labels.channelConfigured:e.labels.channelMissing},{id:`skill`,done:l,optional:!0,detail:l?e.labels.skillsConfigured(e.skillCount):e.labels.skillsMissing}],p=f.filter(e=>!e.optional).every(e=>e.done),m=f.every(e=>e.done),h=[{id:`gateway`,status:V(s),title:`Gateway`,detail:s?e.labels.gatewayOnline:e.labels.gatewayOffline,path:`/settings/gateway`},{id:`provider`,status:V(i),title:`Model provider`,detail:i?e.providerMeta&&e.providerMeta.total>0?e.labels.providersMetaReady(n,r):e.labels.providersConfigured(t):e.labels.providersMissing,path:`/settings/capabilities/models`},{id:`defaultModel`,status:V(o),title:`Default model`,detail:o?e.labels.modelConfigured(a):e.labels.modelMissing,path:`/settings/capabilities/models`},{id:`ready`,status:p?`pass`:`fail`,title:`Chat readiness`,detail:p?e.labels.readyToChat:e.labels.modelMissing,path:`/chat`}],g=d.some(e=>e.status===`fail`),_=d.some(e=>e.status===`warn`),v=g?`blocked`:_?`attention`:p?`ready`:`setup`,y=re({doctorChecks:u,logsHealth:e.logsHealth,browserDiagnostics:e.browserDiagnostics,copy:e.labels.diagnostics});return{gatewayConnected:s,providerConfigured:i,providerCount:t,providerMetaConfigured:n,providerMetaTotal:r,defaultModel:a,defaultModelConfigured:o,channelConfigured:c,skillInstalled:l,skillCount:e.skillCount,checklist:f,readiness:h,issues:d,healthTier:v,diagnosticSignals:y,requiredComplete:p,allComplete:m}}function ae(e){return te(e)}function oe(e){return!e.id||!e.label||!e.status||!e.message||![`pass`,`warn`,`fail`,`skip`].includes(e.status)?null:{id:e.id,label:e.label,status:e.status,message:e.message,hints:Array.isArray(e.hints)?e.hints.filter(e=>typeof e==`string`):[],fixed:e.fixed===!0,findings:Array.isArray(e.findings)?e.findings:void 0}}function se(){return d(`/api/doctor`)}async function ce(){return((await c(se())).checks??[]).map(oe).filter(e=>e!==null)}function le(){return d(`/api/logs/health`)}async function ue(){return c(le())}function K(e){return e?`pass`:`warn`}function de(e){return e?.enabled?[`setup-browser-diagnostics`,e]:null}async function q(e){if(!e.enabled)return[];if(e.driverKind===`playwright`){let e=await c(d(`/api/browser/playwright/doctor`)),t=e.payload?.installed===!0;return[{id:`browser-playwright`,label:`Browser: Playwright`,status:K(t),message:t?`Local Chromium is installed.`:e.payload?.reason??`Local Chromium is not installed.`,path:`/settings/agent-browser`}]}if(e.driverKind===`extension`){let e=await c(d(`/api/browser/extension-status?probe=true`)),t=e.artifacts?.installed===!0,n=e.connected===!0,r=e.artifacts?.needsRefresh===!0||e.artifacts?.needsChromeReload===!0;return[{id:`browser-extension`,label:`Browser: Chrome extension`,status:n?`pass`:`warn`,message:n?`Chrome extension bridge is connected.`:t?r?`Chrome extension needs refresh.`:`Chrome extension is installed but not connected.`:`Chrome extension is not installed.`,path:`/settings/agent-browser`}]}return[{id:`browser-playwright`,label:`Browser`,status:`skip`,message:`Browser driver "${e.driverKind}" is configured.`,path:`/settings/agent-browser`}]}function J(){let e=(0,R.c)(95),t=l(_e),n=u(ge),r;e[0]===n?r=e[1]:(r=f(n),e[0]=n,e[1]=r);let i=r,a=i.setupStatus.labels,o=i.setupStatus.diagnostics,s=E(he),{data:c,error:d,isLoading:v,mutate:y}=m(!!t),b;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(b={revalidateOnFocus:!1},e[2]=b):b=e[2];let{data:x,error:S,isLoading:C,mutate:w}=p(t?`setup-checklist-skills`:null,me,b),T;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(T={revalidateOnFocus:!1},e[3]=T):T=e[3];let{data:O,error:k,isLoading:A,mutate:j}=p(t?`setup-checklist-provider-meta`:null,D,T),M;e[4]===t?M=e[5]:(M=t?se():null,e[4]=t,e[5]=M);let N;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(N={revalidateOnFocus:!1},e[6]=N):N=e[6];let{data:P,error:F,isLoading:I,mutate:L}=p(M,ce,N),z;e[7]===t?z=e[8]:(z=t?le():null,e[7]=t,e[8]=z);let B;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(B={revalidateOnFocus:!1},e[9]=B):B=e[9];let{data:ee,isLoading:te,mutate:V}=p(z,ue,B);c?.payload?.config;let H=c?.payload?.config,U;e[10]===H?U=e[11]:(U=ae(H),e[10]=H,e[11]=U);let ne=t?U:null,W;e[12]===ne?W=e[13]:(W=de(ne),e[12]=ne,e[13]=W);let G;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(G={revalidateOnFocus:!1},e[14]=G):G=e[14];let{data:re,isLoading:oe,mutate:K}=p(W,pe,G),q;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(q={revalidateOnFocus:!1},e[15]=q):q=e[15],p(t?_:null,g,q);let J=!t||!v&&!C&&!A&&!I&&!te&&!oe,Y=!!(d||S||k||F),ve;bb0:{if(!t||!J){ve=null;break bb0}let n=x?.catalog?.length??0,r;if(e[16]!==re||e[17]!==c?.payload?.config||e[18]!==o.browserDriverConfigured||e[19]!==o.chromiumInstalled||e[20]!==o.chromiumNotInstalled||e[21]!==o.extensionConnected||e[22]!==o.extensionNeedsRefresh||e[23]!==o.extensionNotConnected||e[24]!==o.extensionNotInstalled||e[25]!==o.gatewayNotInstalled||e[26]!==o.gatewayNotRunning||e[27]!==o.gatewayUnavailable||e[28]!==o.installCommand||e[29]!==o.labels||e[30]!==o.logsErrors||e[31]!==o.logsHealthy||e[32]!==o.logsShuttingDown||e[33]!==o.providerAuthMissing||e[34]!==o.runCommand||e[35]!==o.runtimeInvalid||e[36]!==o.runtimeMissing||e[37]!==o.startCommand||e[38]!==P||e[39]!==a.channelConfigured||e[40]!==a.channelMissing||e[41]!==a.gatewayOffline||e[42]!==a.gatewayOnline||e[43]!==a.modelConfigured||e[44]!==a.modelMissing||e[45]!==a.providersConfigured||e[46]!==a.providersMetaReady||e[47]!==a.providersMissing||e[48]!==a.skillsConfigured||e[49]!==a.skillsMissing||e[50]!==ee||e[51]!==i.setupStatus.requiredCompleteMessage||e[52]!==O||e[53]!==s||e[54]!==n||e[55]!==t){let l=O?.filter(fe).length??0,u=O?.length??0,d;e[57]===a.providersConfigured?d=e[58]:(d=e=>a.providersConfigured.replace(`{{count}}`,String(e)),e[57]=a.providersConfigured,e[58]=d);let f;e[59]===a.providersMetaReady?f=e[60]:(f=(e,t)=>a.providersMetaReady.replace(`{{configured}}`,String(e)).replace(`{{total}}`,String(t)),e[59]=a.providersMetaReady,e[60]=f);let p;e[61]===a.modelConfigured?p=e[62]:(p=e=>a.modelConfigured.replace(`{{model}}`,e),e[61]=a.modelConfigured,e[62]=p);let m;e[63]===a.skillsConfigured?m=e[64]:(m=e=>a.skillsConfigured.replace(`{{count}}`,String(e)),e[63]=a.skillsConfigured,e[64]=m);let g;e[65]===o.runtimeMissing?g=e[66]:(g=e=>o.runtimeMissing.replace(`{{runtimes}}`,e),e[65]=o.runtimeMissing,e[66]=g);let _;e[67]===o.runtimeInvalid?_=e[68]:(_=e=>o.runtimeInvalid.replace(`{{runtimes}}`,e),e[67]=o.runtimeInvalid,e[68]=_);let v;e[69]===o.gatewayUnavailable?v=e[70]:(v=e=>o.gatewayUnavailable.replace(`{{detail}}`,e),e[69]=o.gatewayUnavailable,e[70]=v);let y;e[71]===o.gatewayNotRunning?y=e[72]:(y=e=>o.gatewayNotRunning.replace(`{{status}}`,e),e[71]=o.gatewayNotRunning,e[72]=y);let b;e[73]===o.runCommand?b=e[74]:(b=e=>o.runCommand.replace(`{{command}}`,e),e[73]=o.runCommand,e[74]=b);let x;e[75]===o.installCommand?x=e[76]:(x=e=>o.installCommand.replace(`{{command}}`,e),e[75]=o.installCommand,e[76]=x);let S;e[77]===o.startCommand?S=e[78]:(S=e=>o.startCommand.replace(`{{command}}`,e),e[77]=o.startCommand,e[78]=S);let C;e[79]===o.logsErrors?C=e[80]:(C=e=>o.logsErrors.replace(`{{count}}`,String(e)),e[79]=o.logsErrors,e[80]=C);let w;e[81]===o.browserDriverConfigured?w=e[82]:(w=e=>o.browserDriverConfigured.replace(`{{driver}}`,e),e[81]=o.browserDriverConfigured,e[82]=w),r=ie({isElectron:h(),hasToken:!!t,realtimeConnected:s,config:c?.payload?.config,skillCount:n,providerMeta:u>0?{configured:l,total:u}:null,doctorChecks:P,logsHealth:ee,browserDiagnostics:re,labels:{gatewayOnline:a.gatewayOnline,gatewayOffline:a.gatewayOffline,providersConfigured:d,providersMetaReady:f,providersMissing:a.providersMissing,modelConfigured:p,modelMissing:a.modelMissing,channelConfigured:a.channelConfigured,channelMissing:a.channelMissing,skillsConfigured:m,skillsMissing:a.skillsMissing,readyToChat:i.setupStatus.requiredCompleteMessage,diagnostics:{labels:o.labels,runtimeMissing:g,runtimeInvalid:_,gatewayNotInstalled:o.gatewayNotInstalled,gatewayUnavailable:v,gatewayNotRunning:y,providerAuthMissing:o.providerAuthMissing,runCommand:b,installCommand:x,startCommand:S,logsHealthy:o.logsHealthy,logsShuttingDown:o.logsShuttingDown,logsErrors:C,chromiumInstalled:o.chromiumInstalled,chromiumNotInstalled:o.chromiumNotInstalled,extensionConnected:o.extensionConnected,extensionNeedsRefresh:o.extensionNeedsRefresh,extensionNotConnected:o.extensionNotConnected,extensionNotInstalled:o.extensionNotInstalled,browserDriverConfigured:w}}}),e[16]=re,e[17]=c?.payload?.config,e[18]=o.browserDriverConfigured,e[19]=o.chromiumInstalled,e[20]=o.chromiumNotInstalled,e[21]=o.extensionConnected,e[22]=o.extensionNeedsRefresh,e[23]=o.extensionNotConnected,e[24]=o.extensionNotInstalled,e[25]=o.gatewayNotInstalled,e[26]=o.gatewayNotRunning,e[27]=o.gatewayUnavailable,e[28]=o.installCommand,e[29]=o.labels,e[30]=o.logsErrors,e[31]=o.logsHealthy,e[32]=o.logsShuttingDown,e[33]=o.providerAuthMissing,e[34]=o.runCommand,e[35]=o.runtimeInvalid,e[36]=o.runtimeMissing,e[37]=o.startCommand,e[38]=P,e[39]=a.channelConfigured,e[40]=a.channelMissing,e[41]=a.gatewayOffline,e[42]=a.gatewayOnline,e[43]=a.modelConfigured,e[44]=a.modelMissing,e[45]=a.providersConfigured,e[46]=a.providersMetaReady,e[47]=a.providersMissing,e[48]=a.skillsConfigured,e[49]=a.skillsMissing,e[50]=ee,e[51]=i.setupStatus.requiredCompleteMessage,e[52]=O,e[53]=s,e[54]=n,e[55]=t,e[56]=r}else r=e[56];ve=r}let X=ve,Z;e[83]!==K||e[84]!==y||e[85]!==L||e[86]!==V||e[87]!==j||e[88]!==w?(Z=async()=>{await Promise.all([y(),w(),j(),L(),V(),K()])},e[83]=K,e[84]=y,e[85]=L,e[86]=V,e[87]=j,e[88]=w,e[89]=Z):Z=e[89];let Q=Z,$;return e[90]!==Y||e[91]!==J||e[92]!==Q||e[93]!==X?($={ready:J,error:Y,snapshot:X,refresh:Q},e[90]=Y,e[91]=J,e[92]=Q,e[93]=X,e[94]=$):$=e[94],$}function fe(e){return e.configured}function pe(e){let[,t]=e;return q(t)}function me(){return A()}function he(e){return e.connectionState===`connected`}function ge(e){return e.language}function _e(e){return e.conversationId}var Y=r();function ve(e){return e===`pass`?`border-success/30 bg-success-soft text-success`:e===`warn`?`border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`fail`?`border-red-500/30 bg-red-500/10 text-red-700 dark:text-red-300`:`border-edge bg-surface-hover text-fg-muted`}function X(e){return e===`pass`?a:e===`warn`?T:e===`fail`?v:b}function Z(e,t){return e===`blocked`?{icon:v,className:`bg-red-500/10 text-red-950 dark:text-red-100`,title:t.health.blockedTitle,body:t.health.blockedBody,action:t.health.viewIssues,targetId:`next-steps`}:e===`attention`?{icon:T,className:`bg-amber-500/10 text-amber-950 dark:text-amber-100`,title:t.health.attentionTitle,body:t.health.attentionBody,action:t.health.viewIssues,targetId:`next-steps`}:e===`setup`?{icon:w,className:`bg-surface-base text-fg shadow-surface`,title:t.health.setupTitle,body:t.health.setupBody,action:t.health.continueSetup,targetId:`next-steps`}:{icon:a,className:`bg-success-soft text-success`,title:t.health.readyTitle,body:t.health.readyBody,action:t.health.startChat,actionPath:`/chat`}}function Q(e){let t=(0,R.c)(46),{tier:n,issueCount:r,onRunDoctor:a,ready:c,doctorRunning:l,doctorRunState:d}=e,p=u($),m,h,g,_,v,b,x,w,T;if(t[0]!==r||t[1]!==p||t[2]!==n){h=f(p).setupStatus;let e=Z(n,h),a=e.icon,o=`targetId`in e&&typeof e.targetId==`string`?e.targetId:null,c=`actionPath`in e&&typeof e.actionPath==`string`?e.actionPath:`/chat`;m=o?(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>document.getElementById(o)?.scrollIntoView({block:`start`,behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`}),className:`inline-flex items-center gap-1 rounded-lg bg-surface-base px-3 py-2 text-sm font-medium text-fg shadow-sm hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.action,(0,Y.jsx)(S,{className:`size-4`,"aria-hidden":!0})]}):(0,Y.jsxs)(i,{to:c,className:`inline-flex items-center gap-1 rounded-lg bg-surface-base px-3 py-2 text-sm font-medium text-fg shadow-sm hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.action,(0,Y.jsx)(S,{className:`size-4`,"aria-hidden":!0})]}),T=s(`rounded-xl p-4`,e.className),w=`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,b=`flex min-w-0 gap-3`,x=(0,Y.jsx)(a,{className:`mt-0.5 size-5 shrink-0`,"aria-hidden":!0}),g=`min-w-0`,_=(0,Y.jsx)(`h2`,{className:`text-base font-semibold`,children:e.title}),v=r>0?(0,Y.jsx)(`p`,{className:`mt-1 text-sm opacity-80`,children:h.health.issueCount.replace(`{{count}}`,String(r))}):null,t[0]=r,t[1]=p,t[2]=n,t[3]=m,t[4]=h,t[5]=g,t[6]=_,t[7]=v,t[8]=b,t[9]=x,t[10]=w,t[11]=T}else m=t[3],h=t[4],g=t[5],_=t[6],v=t[7],b=t[8],x=t[9],w=t[10],T=t[11];let E;t[12]!==g||t[13]!==_||t[14]!==v?(E=(0,Y.jsxs)(`div`,{className:g,children:[_,v]}),t[12]=g,t[13]=_,t[14]=v,t[15]=E):E=t[15];let D;t[16]!==b||t[17]!==x||t[18]!==E?(D=(0,Y.jsxs)(`div`,{className:b,children:[x,E]}),t[16]=b,t[17]=x,t[18]=E,t[19]=D):D=t[19];let O;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(O=s(`inline-flex items-center gap-2 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,C.press),t[20]=O):O=t[20];let k=!c||l,A;t[21]===l?A=t[22]:(A=l?(0,Y.jsx)(o,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,Y.jsx)(y,{className:`size-4`,"aria-hidden":!0}),t[21]=l,t[22]=A);let j=l?h.health.runDoctorRunning:h.health.runDoctor,M;t[23]!==l||t[24]!==a||t[25]!==k||t[26]!==A||t[27]!==j?(M=(0,Y.jsxs)(`button`,{type:`button`,className:O,onClick:a,disabled:k,"aria-busy":l,children:[A,j]}),t[23]=l,t[24]=a,t[25]=k,t[26]=A,t[27]=j,t[28]=M):M=t[28];let N;t[29]!==m||t[30]!==M?(N=(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[m,M]}),t[29]=m,t[30]=M,t[31]=N):N=t[31];let P;t[32]!==N||t[33]!==w||t[34]!==D?(P=(0,Y.jsxs)(`div`,{className:w,children:[D,N]}),t[32]=N,t[33]=w,t[34]=D,t[35]=P):P=t[35];let F;t[36]!==d||t[37]!==l||t[38]!==h.health.doctorCompleteMessage||t[39]!==h.health.doctorFailedMessage||t[40]!==h.health.doctorRunningMessage?(F=l||d!==`idle`?(0,Y.jsx)(`p`,{className:`mt-3 text-xs opacity-75`,role:`status`,"aria-live":`polite`,children:l?h.health.doctorRunningMessage:d===`success`?h.health.doctorCompleteMessage:h.health.doctorFailedMessage}):null,t[36]=d,t[37]=l,t[38]=h.health.doctorCompleteMessage,t[39]=h.health.doctorFailedMessage,t[40]=h.health.doctorRunningMessage,t[41]=F):F=t[41];let I;return t[42]!==P||t[43]!==F||t[44]!==T?(I=(0,Y.jsxs)(`section`,{className:T,children:[P,F]}),t[42]=P,t[43]=F,t[44]=T,t[45]=I):I=t[45],I}function $(e){return e.language}function ye(e){let t=(0,R.c)(26),{issue:n,fixLabel:r}=e,a;t[0]===n.status?a=t[1]:(a=X(n.status),t[0]=n.status,t[1]=a);let o=a,s;t[2]===o?s=t[3]:(s=(0,Y.jsx)(o,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),t[2]=o,t[3]=s);let c;t[4]===n.label?c=t[5]:(c=(0,Y.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:n.label}),t[4]=n.label,t[5]=c);let l;t[6]===n.message?l=t[7]:(l=(0,Y.jsx)(`span`,{className:`mt-1 block text-sm text-fg-muted`,children:n.message}),t[6]=n.message,t[7]=l);let u;t[8]===n.hints[0]?u=t[9]:(u=n.hints[0]?(0,Y.jsx)(`span`,{className:`mt-1 block truncate text-xs text-fg-subtle`,children:n.hints[0]}):null,t[8]=n.hints[0],t[9]=u);let d;t[10]!==c||t[11]!==l||t[12]!==u?(d=(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[c,l,u]}),t[10]=c,t[11]=l,t[12]=u,t[13]=d):d=t[13];let f;t[14]!==r||t[15]!==n.path?(f=n.path?(0,Y.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs font-medium text-accent-fg`,children:[r,(0,Y.jsx)(S,{className:`size-4`,"aria-hidden":!0})]}):null,t[14]=r,t[15]=n.path,t[16]=f):f=t[16];let p;t[17]!==s||t[18]!==d||t[19]!==f?(p=(0,Y.jsxs)(Y.Fragment,{children:[s,d,f]}),t[17]=s,t[18]=d,t[19]=f,t[20]=p):p=t[20];let m=p;if(n.path){let e;return t[21]!==m||t[22]!==n.path?(e=(0,Y.jsx)(i,{to:n.path,className:`flex items-start gap-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface hover:bg-surface-hover/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:m}),t[21]=m,t[22]=n.path,t[23]=e):e=t[23],e}let h;return t[24]===m?h=t[25]:(h=(0,Y.jsx)(`div`,{className:`flex items-start gap-3 rounded-lg bg-surface-panel/80 p-3 shadow-surface`,children:m}),t[24]=m,t[25]=h),h}function be(e){let t=(0,R.c)(27),{item:n,labels:r}=e,a;t[0]===n.status?a=t[1]:(a=X(n.status),t[0]=n.status,t[1]=a);let o=a,c=r[n.id]??n.title,l;t[2]===n.status?l=t[3]:(l=s(`flex size-7 shrink-0 items-center justify-center rounded-full border`,ve(n.status)),t[2]=n.status,t[3]=l);let u;t[4]===o?u=t[5]:(u=(0,Y.jsx)(o,{className:`size-4`,"aria-hidden":!0}),t[4]=o,t[5]=u);let d;t[6]!==l||t[7]!==u?(d=(0,Y.jsx)(`span`,{className:l,children:u}),t[6]=l,t[7]=u,t[8]=d):d=t[8];let f;t[9]===c?f=t[10]:(f=(0,Y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:c}),t[9]=c,t[10]=f);let p;t[11]===n.detail?p=t[12]:(p=(0,Y.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.detail}),t[11]=n.detail,t[12]=p);let m;t[13]!==f||t[14]!==p?(m=(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;t[16]===n.path?h=t[17]:(h=n.path?(0,Y.jsx)(S,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[16]=n.path,t[17]=h);let g;t[18]!==d||t[19]!==m||t[20]!==h?(g=(0,Y.jsxs)(Y.Fragment,{children:[d,m,h]}),t[18]=d,t[19]=m,t[20]=h,t[21]=g):g=t[21];let _=g;if(n.path){let e;return t[22]!==_||t[23]!==n.path?(e=(0,Y.jsx)(i,{to:n.path,className:`flex items-center gap-3 rounded-lg p-3 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:_}),t[22]=_,t[23]=n.path,t[24]=e):e=t[24],e}let v;return t[25]===_?v=t[26]:(v=(0,Y.jsx)(`div`,{className:`flex items-center gap-3 rounded-lg p-3`,children:_}),t[25]=_,t[26]=v),v}function xe(e){let t=(0,R.c)(23),{signal:n,fixLabel:r}=e,a;t[0]===n.status?a=t[1]:(a=X(n.status),t[0]=n.status,t[1]=a);let o=a,s;t[2]===o?s=t[3]:(s=(0,Y.jsx)(o,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),t[2]=o,t[3]=s);let c;t[4]===n.label?c=t[5]:(c=(0,Y.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:n.label}),t[4]=n.label,t[5]=c);let l;t[6]===n.message?l=t[7]:(l=(0,Y.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.message}),t[6]=n.message,t[7]=l);let u;t[8]!==c||t[9]!==l?(u=(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[c,l]}),t[8]=c,t[9]=l,t[10]=u):u=t[10];let d;t[11]!==r||t[12]!==n.path?(d=n.path?(0,Y.jsx)(`span`,{className:`sr-only`,children:r}):null,t[11]=r,t[12]=n.path,t[13]=d):d=t[13];let f;t[14]!==s||t[15]!==u||t[16]!==d?(f=(0,Y.jsxs)(Y.Fragment,{children:[s,u,d]}),t[14]=s,t[15]=u,t[16]=d,t[17]=f):f=t[17];let p=f;if(n.path){let e;return t[18]!==p||t[19]!==n.path?(e=(0,Y.jsx)(i,{to:n.path,className:`flex min-w-0 items-start gap-2 rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface hover:bg-surface-hover/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:p}),t[18]=p,t[19]=n.path,t[20]=e):e=t[20],e}let m;return t[21]===p?m=t[22]:(m=(0,Y.jsx)(`div`,{className:`flex min-w-0 items-start gap-2 rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface`,children:p}),t[21]=p,t[22]=m),m}function Se(){let e=f(u(e=>e.language)).setupStatus,{ready:t,error:n,snapshot:r,refresh:i}=J(),[a,o]=(0,L.useState)(!1),[s,c]=(0,L.useState)(`idle`),l=r?.diagnosticSignals.filter(e=>e.status===`fail`||e.status===`warn`)??[],d=async()=>{if(!(a||!t)){o(!0),c(`idle`);try{await i(),c(`success`)}catch{c(`error`)}finally{o(!1)}}};return(0,Y.jsxs)(M,{gap:`gap-6`,children:[(0,Y.jsx)(j,{title:e.title}),n?(0,Y.jsx)(`p`,{className:`rounded-xl border border-red-300/40 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/40 dark:bg-red-950/30 dark:text-red-300`,children:e.loadError}):null,!t||!r?(0,Y.jsx)(F,{sections:2}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{tier:r.healthTier,issueCount:r.issues.length,ready:t,onRunDoctor:()=>void d(),doctorRunning:a,doctorRunState:s}),(0,Y.jsxs)(P,{id:`next-steps`,children:[(0,Y.jsx)(N,{icon:r.issues.length?T:k,title:e.nextStepsTitle}),r.issues.length?(0,Y.jsx)(`div`,{className:`mt-4 flex flex-col gap-2`,children:r.issues.slice(0,8).map(t=>(0,Y.jsx)(ye,{issue:t,fixLabel:e.fixIssue},`${t.source}:${t.id}`))}):(0,Y.jsx)(`div`,{className:`mt-4 rounded-lg bg-surface-panel/80 shadow-surface`,children:r.readiness.map(t=>(0,Y.jsx)(be,{item:t,labels:e.readinessLabels},t.id))})]}),(0,Y.jsx)(I,{children:(0,Y.jsxs)(P,{children:[(0,Y.jsx)(N,{icon:O,title:e.diagnosticsTitle}),l.length?(0,Y.jsx)(`div`,{className:`mt-4 grid gap-2 md:grid-cols-2`,children:l.map(t=>(0,Y.jsx)(xe,{signal:t,fixLabel:e.fixIssue},t.id))}):(0,Y.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-panel/80 p-3 text-sm text-fg-muted shadow-surface`,children:r.diagnosticSignals.length?e.diagnosticsAllClear:e.diagnosticsEmpty})]})})]})]})}export{Se as SetupStatusPanel};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as a}from"./circle-check-C23XjkUj.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as s}from"./cn-JdwAhgNB.js";import{a as c,c as l,n as u,r as d}from"./locale-store-DLK05Y1a.js";import{t as f}from"./messages-C9h8SImu.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{r as m}from"./gateway-config-swr-D5AM8cyQ.js";import{n as h}from"./electron-env-Dit0bHgy.js";import{n as g,t as _}from"./registry-api-BMFL4vis.js";import{Eu as v,Ic as y,Il as b,Mo as x,Nu as S,Ts as C,Tu as w,ac as T,ao as E,kt as D,mc as O,nd as k,yn as A}from"./index-hlU8MUEz.js";import{n as j,r as M}from"./settings-page-layout-X1x-2Cp9.js";import{n as N,t as P}from"./settings-form-section-BsdM7P1d.js";import{n as F}from"./settings-loading-skeleton-CAmWMaOT.js";import{t as I}from"./settings-advanced-gate-DDALROy_.js";var L=e(t(),1),R=n();function z(e){if(!e||typeof e!=`object`)return 0;let t=e.providers;return!t||typeof t!=`object`||Array.isArray(t)?0:Object.values(t).filter(e=>typeof e==`string`&&x(e)).length}function B(e){if(!e||typeof e!=`object`)return``;let t=e.agents;if(!t||typeof t!=`object`||Array.isArray(t))return``;let n=t.defaults,r=n&&typeof n==`object`&&!Array.isArray(n)?n.models:void 0;if(!r||typeof r!=`object`||Array.isArray(r))return``;let i=r.chat;if(!i||typeof i!=`object`||Array.isArray(i))return``;let a=i.primary;return typeof a==`string`?a.trim():``}function ee(e){if(!e||typeof e!=`object`)return!1;let t=e.channels;return!t||typeof t!=`object`||Array.isArray(t)?!1:Object.values(t).some(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;if(`configured`in t||`config`in t||`schema`in t||`uiHints`in t){if(t.configured===!0)return!0;let e=t.config;if(!e||typeof e!=`object`||Array.isArray(e))return!1;let n=e;return n.enabled===!0||Object.keys(n).length>0}return t.enabled===!0||Object.keys(t).length>0})}function te(e){if(!e||typeof e!=`object`)return{enabled:!1,driverKind:`extension`};let t=e.browser;if(!t||typeof t!=`object`||Array.isArray(t))return{enabled:!1,driverKind:`extension`};let n=t,r=n.driver&&typeof n.driver==`object`&&!Array.isArray(n.driver)?n.driver:void 0;return{enabled:n.enabled===!0,driverKind:typeof r?.kind==`string`&&r.kind.trim()?r.kind.trim():`extension`}}function V(e){return e?`pass`:`fail`}function H(e){if(e===`tool-runtimes`)return`/settings/runtimes`;if(e===`provider-auth`)return`/settings/capabilities/models`;if(e===`config-health`)return`/settings/gateway`;if(e===`state-integrity`||e===`workspace-status`)return`/agents`;if(e===`database-schema`||e===`session-integrity`)return`/settings/sessions`;if(e===`channel-config`||e===`channel-pairing-pending`||e.startsWith(`channel:`))return`/channels`;if(e===`security-audit`||e===`gateway-service`||e===`gateway-health`)return`/settings/gateway`;if(e===`version-check`)return`/settings/desktop-app`}function U(e){return{fail:4,warn:3,skip:2,pass:1}[e]}function ne(e,t){let n=e.match(/^Run(?::|\s)(.*)$/i);if(n?.[1])return t.runCommand(n[1].trim());let r=e.match(/^Install(?::|\s)(.*)$/i);if(r?.[1])return t.installCommand(r[1].trim());let i=e.match(/^Start(?::|\s)(.*)$/i);return i?.[1]?t.startCommand(i[1].trim()):e}function W(e,t){if(!t)return e;let n=e.message;if(e.id===`tool-runtimes`){let r=e.message.match(/^(.*) runtime is not installed\.$/),i=e.message.match(/^(.*) runtime installation is invalid\.$/);r?.[1]?n=t.runtimeMissing(r[1]):i?.[1]&&(n=t.runtimeInvalid(i[1]))}else if(e.id===`gateway-service`)if(e.message===`Gateway is not installed as a system service.`)n=t.gatewayNotInstalled;else{let r=e.message.match(/^Service backend unavailable: (.*)$/),i=e.message.match(/^Gateway service is installed but not running \(status: (.*)\)\.$/);r?.[1]?n=t.gatewayUnavailable(r[1]):i?.[1]&&(n=t.gatewayNotRunning(i[1]))}else e.id===`provider-auth`&&e.message===`No API keys detected for configured providers.`&&(n=t.providerAuthMissing);return{...e,label:t.labels[e.id]??e.label,message:n,hints:e.hints.map(e=>ne(e,t))}}function G(e,t){return e.filter(e=>e.status===`fail`||e.status===`warn`).map(e=>{let n=W(e,t);return{id:n.id,label:n.label,status:n.status,message:n.message,hints:n.hints,path:H(n.id),source:`doctor`}}).toSorted((e,t)=>U(t.status)-U(e.status)||e.label.localeCompare(t.label))}function re(e){let t=new Map(e.doctorChecks.map(e=>[e.id,e])),n=[];for(let r of[`security-audit`,`channel-config`,`channel-pairing-pending`,`gateway-health`]){let i=t.get(r);if(i){let t=W(i,e.copy);n.push({id:t.id,label:t.label,status:t.status,message:t.message,path:H(t.id)})}}if(e.logsHealth){let t=e.logsHealth.stats?.errorsLast24h??0;n.push({id:`logs-health`,label:e.copy?.labels[`logs-health`]??`Logs`,status:e.logsHealth.shuttingDown||t>0?`warn`:`pass`,message:e.copy?e.logsHealth.shuttingDown?e.copy.logsShuttingDown:t>0?e.copy.logsErrors(t):e.copy.logsHealthy:e.logsHealth.shuttingDown?`Logger is shutting down.`:t>0?`${t} error(s) in the last 24 hours.`:`Log system is healthy.`,path:`/settings/logs`})}for(let t of e.browserDiagnostics??[]){let r=t.message;if(e.copy){r={"Local Chromium is installed.":e.copy.chromiumInstalled,"Local Chromium is not installed.":e.copy.chromiumNotInstalled,"Chrome extension bridge is connected.":e.copy.extensionConnected,"Chrome extension needs refresh.":e.copy.extensionNeedsRefresh,"Chrome extension is installed but not connected.":e.copy.extensionNotConnected,"Chrome extension is not installed.":e.copy.extensionNotInstalled}[t.message]??t.message;let n=t.message.match(/^Browser driver "(.*)" is configured\.$/);n?.[1]&&(r=e.copy.browserDriverConfigured(n[1]))}n.push({...t,label:e.copy?.labels[t.id]??t.label,message:r})}return n}function ie(e){let t=z(e.config),n=e.providerMeta?.configured??t,r=e.providerMeta?.total??0,i=n>0||t>0,a=B(e.config),o=a.length>0,s=e.hasToken&&e.realtimeConnected,c=ee(e.config),l=e.skillCount>0,u=(e.doctorChecks??[]).filter(t=>!e.isElectron||t.id!==`gateway-service`),d=G(u,e.labels.diagnostics),f=[{id:`gateway`,done:s,detail:s?e.labels.gatewayOnline:e.labels.gatewayOffline},{id:`provider`,done:i,detail:i?e.providerMeta&&e.providerMeta.total>0?e.labels.providersMetaReady(n,r):e.labels.providersConfigured(t):e.labels.providersMissing},{id:`defaultModel`,done:o,detail:o?e.labels.modelConfigured(a):e.labels.modelMissing},{id:`channel`,done:c,optional:!0,detail:c?e.labels.channelConfigured:e.labels.channelMissing},{id:`skill`,done:l,optional:!0,detail:l?e.labels.skillsConfigured(e.skillCount):e.labels.skillsMissing}],p=f.filter(e=>!e.optional).every(e=>e.done),m=f.every(e=>e.done),h=[{id:`gateway`,status:V(s),title:`Gateway`,detail:s?e.labels.gatewayOnline:e.labels.gatewayOffline,path:`/settings/gateway`},{id:`provider`,status:V(i),title:`Model provider`,detail:i?e.providerMeta&&e.providerMeta.total>0?e.labels.providersMetaReady(n,r):e.labels.providersConfigured(t):e.labels.providersMissing,path:`/settings/capabilities/models`},{id:`defaultModel`,status:V(o),title:`Default model`,detail:o?e.labels.modelConfigured(a):e.labels.modelMissing,path:`/settings/capabilities/models`},{id:`ready`,status:p?`pass`:`fail`,title:`Chat readiness`,detail:p?e.labels.readyToChat:e.labels.modelMissing,path:`/chat`}],g=d.some(e=>e.status===`fail`),_=d.some(e=>e.status===`warn`),v=g?`blocked`:_?`attention`:p?`ready`:`setup`,y=re({doctorChecks:u,logsHealth:e.logsHealth,browserDiagnostics:e.browserDiagnostics,copy:e.labels.diagnostics});return{gatewayConnected:s,providerConfigured:i,providerCount:t,providerMetaConfigured:n,providerMetaTotal:r,defaultModel:a,defaultModelConfigured:o,channelConfigured:c,skillInstalled:l,skillCount:e.skillCount,checklist:f,readiness:h,issues:d,healthTier:v,diagnosticSignals:y,requiredComplete:p,allComplete:m}}function ae(e){return te(e)}function oe(e){return!e.id||!e.label||!e.status||!e.message||![`pass`,`warn`,`fail`,`skip`].includes(e.status)?null:{id:e.id,label:e.label,status:e.status,message:e.message,hints:Array.isArray(e.hints)?e.hints.filter(e=>typeof e==`string`):[],fixed:e.fixed===!0,findings:Array.isArray(e.findings)?e.findings:void 0}}function se(){return d(`/api/doctor`)}async function ce(){return((await c(se())).checks??[]).map(oe).filter(e=>e!==null)}function le(){return d(`/api/logs/health`)}async function ue(){return c(le())}function K(e){return e?`pass`:`warn`}function de(e){return e?.enabled?[`setup-browser-diagnostics`,e]:null}async function q(e){if(!e.enabled)return[];if(e.driverKind===`playwright`){let e=await c(d(`/api/browser/playwright/doctor`)),t=e.payload?.installed===!0;return[{id:`browser-playwright`,label:`Browser: Playwright`,status:K(t),message:t?`Local Chromium is installed.`:e.payload?.reason??`Local Chromium is not installed.`,path:`/settings/agent-browser`}]}if(e.driverKind===`extension`){let e=await c(d(`/api/browser/extension-status?probe=true`)),t=e.artifacts?.installed===!0,n=e.connected===!0,r=e.artifacts?.needsRefresh===!0||e.artifacts?.needsChromeReload===!0;return[{id:`browser-extension`,label:`Browser: Chrome extension`,status:n?`pass`:`warn`,message:n?`Chrome extension bridge is connected.`:t?r?`Chrome extension needs refresh.`:`Chrome extension is installed but not connected.`:`Chrome extension is not installed.`,path:`/settings/agent-browser`}]}return[{id:`browser-playwright`,label:`Browser`,status:`skip`,message:`Browser driver "${e.driverKind}" is configured.`,path:`/settings/agent-browser`}]}function J(){let e=(0,R.c)(95),t=l(_e),n=u(ge),r;e[0]===n?r=e[1]:(r=f(n),e[0]=n,e[1]=r);let i=r,a=i.setupStatus.labels,o=i.setupStatus.diagnostics,s=E(he),{data:c,error:d,isLoading:v,mutate:y}=m(!!t),b;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(b={revalidateOnFocus:!1},e[2]=b):b=e[2];let{data:x,error:S,isLoading:C,mutate:w}=p(t?`setup-checklist-skills`:null,me,b),T;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(T={revalidateOnFocus:!1},e[3]=T):T=e[3];let{data:O,error:k,isLoading:A,mutate:j}=p(t?`setup-checklist-provider-meta`:null,D,T),M;e[4]===t?M=e[5]:(M=t?se():null,e[4]=t,e[5]=M);let N;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(N={revalidateOnFocus:!1},e[6]=N):N=e[6];let{data:P,error:F,isLoading:I,mutate:L}=p(M,ce,N),z;e[7]===t?z=e[8]:(z=t?le():null,e[7]=t,e[8]=z);let B;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(B={revalidateOnFocus:!1},e[9]=B):B=e[9];let{data:ee,isLoading:te,mutate:V}=p(z,ue,B);c?.payload?.config;let H=c?.payload?.config,U;e[10]===H?U=e[11]:(U=ae(H),e[10]=H,e[11]=U);let ne=t?U:null,W;e[12]===ne?W=e[13]:(W=de(ne),e[12]=ne,e[13]=W);let G;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(G={revalidateOnFocus:!1},e[14]=G):G=e[14];let{data:re,isLoading:oe,mutate:K}=p(W,pe,G),q;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(q={revalidateOnFocus:!1},e[15]=q):q=e[15],p(t?_:null,g,q);let J=!t||!v&&!C&&!A&&!I&&!te&&!oe,Y=!!(d||S||k||F),ve;bb0:{if(!t||!J){ve=null;break bb0}let n=x?.catalog?.length??0,r;if(e[16]!==re||e[17]!==c?.payload?.config||e[18]!==o.browserDriverConfigured||e[19]!==o.chromiumInstalled||e[20]!==o.chromiumNotInstalled||e[21]!==o.extensionConnected||e[22]!==o.extensionNeedsRefresh||e[23]!==o.extensionNotConnected||e[24]!==o.extensionNotInstalled||e[25]!==o.gatewayNotInstalled||e[26]!==o.gatewayNotRunning||e[27]!==o.gatewayUnavailable||e[28]!==o.installCommand||e[29]!==o.labels||e[30]!==o.logsErrors||e[31]!==o.logsHealthy||e[32]!==o.logsShuttingDown||e[33]!==o.providerAuthMissing||e[34]!==o.runCommand||e[35]!==o.runtimeInvalid||e[36]!==o.runtimeMissing||e[37]!==o.startCommand||e[38]!==P||e[39]!==a.channelConfigured||e[40]!==a.channelMissing||e[41]!==a.gatewayOffline||e[42]!==a.gatewayOnline||e[43]!==a.modelConfigured||e[44]!==a.modelMissing||e[45]!==a.providersConfigured||e[46]!==a.providersMetaReady||e[47]!==a.providersMissing||e[48]!==a.skillsConfigured||e[49]!==a.skillsMissing||e[50]!==ee||e[51]!==i.setupStatus.requiredCompleteMessage||e[52]!==O||e[53]!==s||e[54]!==n||e[55]!==t){let l=O?.filter(fe).length??0,u=O?.length??0,d;e[57]===a.providersConfigured?d=e[58]:(d=e=>a.providersConfigured.replace(`{{count}}`,String(e)),e[57]=a.providersConfigured,e[58]=d);let f;e[59]===a.providersMetaReady?f=e[60]:(f=(e,t)=>a.providersMetaReady.replace(`{{configured}}`,String(e)).replace(`{{total}}`,String(t)),e[59]=a.providersMetaReady,e[60]=f);let p;e[61]===a.modelConfigured?p=e[62]:(p=e=>a.modelConfigured.replace(`{{model}}`,e),e[61]=a.modelConfigured,e[62]=p);let m;e[63]===a.skillsConfigured?m=e[64]:(m=e=>a.skillsConfigured.replace(`{{count}}`,String(e)),e[63]=a.skillsConfigured,e[64]=m);let g;e[65]===o.runtimeMissing?g=e[66]:(g=e=>o.runtimeMissing.replace(`{{runtimes}}`,e),e[65]=o.runtimeMissing,e[66]=g);let _;e[67]===o.runtimeInvalid?_=e[68]:(_=e=>o.runtimeInvalid.replace(`{{runtimes}}`,e),e[67]=o.runtimeInvalid,e[68]=_);let v;e[69]===o.gatewayUnavailable?v=e[70]:(v=e=>o.gatewayUnavailable.replace(`{{detail}}`,e),e[69]=o.gatewayUnavailable,e[70]=v);let y;e[71]===o.gatewayNotRunning?y=e[72]:(y=e=>o.gatewayNotRunning.replace(`{{status}}`,e),e[71]=o.gatewayNotRunning,e[72]=y);let b;e[73]===o.runCommand?b=e[74]:(b=e=>o.runCommand.replace(`{{command}}`,e),e[73]=o.runCommand,e[74]=b);let x;e[75]===o.installCommand?x=e[76]:(x=e=>o.installCommand.replace(`{{command}}`,e),e[75]=o.installCommand,e[76]=x);let S;e[77]===o.startCommand?S=e[78]:(S=e=>o.startCommand.replace(`{{command}}`,e),e[77]=o.startCommand,e[78]=S);let C;e[79]===o.logsErrors?C=e[80]:(C=e=>o.logsErrors.replace(`{{count}}`,String(e)),e[79]=o.logsErrors,e[80]=C);let w;e[81]===o.browserDriverConfigured?w=e[82]:(w=e=>o.browserDriverConfigured.replace(`{{driver}}`,e),e[81]=o.browserDriverConfigured,e[82]=w),r=ie({isElectron:h(),hasToken:!!t,realtimeConnected:s,config:c?.payload?.config,skillCount:n,providerMeta:u>0?{configured:l,total:u}:null,doctorChecks:P,logsHealth:ee,browserDiagnostics:re,labels:{gatewayOnline:a.gatewayOnline,gatewayOffline:a.gatewayOffline,providersConfigured:d,providersMetaReady:f,providersMissing:a.providersMissing,modelConfigured:p,modelMissing:a.modelMissing,channelConfigured:a.channelConfigured,channelMissing:a.channelMissing,skillsConfigured:m,skillsMissing:a.skillsMissing,readyToChat:i.setupStatus.requiredCompleteMessage,diagnostics:{labels:o.labels,runtimeMissing:g,runtimeInvalid:_,gatewayNotInstalled:o.gatewayNotInstalled,gatewayUnavailable:v,gatewayNotRunning:y,providerAuthMissing:o.providerAuthMissing,runCommand:b,installCommand:x,startCommand:S,logsHealthy:o.logsHealthy,logsShuttingDown:o.logsShuttingDown,logsErrors:C,chromiumInstalled:o.chromiumInstalled,chromiumNotInstalled:o.chromiumNotInstalled,extensionConnected:o.extensionConnected,extensionNeedsRefresh:o.extensionNeedsRefresh,extensionNotConnected:o.extensionNotConnected,extensionNotInstalled:o.extensionNotInstalled,browserDriverConfigured:w}}}),e[16]=re,e[17]=c?.payload?.config,e[18]=o.browserDriverConfigured,e[19]=o.chromiumInstalled,e[20]=o.chromiumNotInstalled,e[21]=o.extensionConnected,e[22]=o.extensionNeedsRefresh,e[23]=o.extensionNotConnected,e[24]=o.extensionNotInstalled,e[25]=o.gatewayNotInstalled,e[26]=o.gatewayNotRunning,e[27]=o.gatewayUnavailable,e[28]=o.installCommand,e[29]=o.labels,e[30]=o.logsErrors,e[31]=o.logsHealthy,e[32]=o.logsShuttingDown,e[33]=o.providerAuthMissing,e[34]=o.runCommand,e[35]=o.runtimeInvalid,e[36]=o.runtimeMissing,e[37]=o.startCommand,e[38]=P,e[39]=a.channelConfigured,e[40]=a.channelMissing,e[41]=a.gatewayOffline,e[42]=a.gatewayOnline,e[43]=a.modelConfigured,e[44]=a.modelMissing,e[45]=a.providersConfigured,e[46]=a.providersMetaReady,e[47]=a.providersMissing,e[48]=a.skillsConfigured,e[49]=a.skillsMissing,e[50]=ee,e[51]=i.setupStatus.requiredCompleteMessage,e[52]=O,e[53]=s,e[54]=n,e[55]=t,e[56]=r}else r=e[56];ve=r}let X=ve,Z;e[83]!==K||e[84]!==y||e[85]!==L||e[86]!==V||e[87]!==j||e[88]!==w?(Z=async()=>{await Promise.all([y(),w(),j(),L(),V(),K()])},e[83]=K,e[84]=y,e[85]=L,e[86]=V,e[87]=j,e[88]=w,e[89]=Z):Z=e[89];let Q=Z,$;return e[90]!==Y||e[91]!==J||e[92]!==Q||e[93]!==X?($={ready:J,error:Y,snapshot:X,refresh:Q},e[90]=Y,e[91]=J,e[92]=Q,e[93]=X,e[94]=$):$=e[94],$}function fe(e){return e.configured}function pe(e){let[,t]=e;return q(t)}function me(){return A()}function he(e){return e.connectionState===`connected`}function ge(e){return e.language}function _e(e){return e.conversationId}var Y=r();function ve(e){return e===`pass`?`bg-success-soft text-success`:e===`warn`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`fail`?`bg-red-500/10 text-red-700 dark:text-red-300`:`bg-surface-hover text-fg-muted`}function X(e){return e===`pass`?a:e===`warn`?T:e===`fail`?v:b}function Z(e,t){return e===`blocked`?{icon:v,className:`bg-red-500/10 text-red-950 dark:text-red-100`,title:t.health.blockedTitle,body:t.health.blockedBody,action:t.health.viewIssues,targetId:`next-steps`}:e===`attention`?{icon:T,className:`bg-amber-500/10 text-amber-950 dark:text-amber-100`,title:t.health.attentionTitle,body:t.health.attentionBody,action:t.health.viewIssues,targetId:`next-steps`}:e===`setup`?{icon:w,className:`bg-surface-hover/50 text-fg`,title:t.health.setupTitle,body:t.health.setupBody,action:t.health.continueSetup,targetId:`next-steps`}:{icon:a,className:`bg-success-soft text-success`,title:t.health.readyTitle,body:t.health.readyBody,action:t.health.startChat,actionPath:`/chat`}}function Q(e){let t=(0,R.c)(46),{tier:n,issueCount:r,onRunDoctor:a,ready:c,doctorRunning:l,doctorRunState:d}=e,p=u($),m,h,g,_,v,b,x,w,T;if(t[0]!==r||t[1]!==p||t[2]!==n){h=f(p).setupStatus;let e=Z(n,h),a=e.icon,o=`targetId`in e&&typeof e.targetId==`string`?e.targetId:null,c=`actionPath`in e&&typeof e.actionPath==`string`?e.actionPath:`/chat`;m=o?(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>document.getElementById(o)?.scrollIntoView({block:`start`,behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`}),className:`inline-flex items-center gap-1 rounded-lg bg-surface-base px-3 py-2 text-sm font-medium text-fg shadow-sm hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.action,(0,Y.jsx)(S,{className:`size-4`,"aria-hidden":!0})]}):(0,Y.jsxs)(i,{to:c,className:`inline-flex items-center gap-1 rounded-lg bg-surface-base px-3 py-2 text-sm font-medium text-fg shadow-sm hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.action,(0,Y.jsx)(S,{className:`size-4`,"aria-hidden":!0})]}),T=s(`rounded-xl p-4`,e.className),w=`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,b=`flex min-w-0 gap-3`,x=(0,Y.jsx)(a,{className:`mt-0.5 size-5 shrink-0`,"aria-hidden":!0}),g=`min-w-0`,_=(0,Y.jsx)(`h2`,{className:`text-base font-semibold`,children:e.title}),v=r>0?(0,Y.jsx)(`p`,{className:`mt-1 text-sm opacity-80`,children:h.health.issueCount.replace(`{{count}}`,String(r))}):null,t[0]=r,t[1]=p,t[2]=n,t[3]=m,t[4]=h,t[5]=g,t[6]=_,t[7]=v,t[8]=b,t[9]=x,t[10]=w,t[11]=T}else m=t[3],h=t[4],g=t[5],_=t[6],v=t[7],b=t[8],x=t[9],w=t[10],T=t[11];let E;t[12]!==g||t[13]!==_||t[14]!==v?(E=(0,Y.jsxs)(`div`,{className:g,children:[_,v]}),t[12]=g,t[13]=_,t[14]=v,t[15]=E):E=t[15];let D;t[16]!==b||t[17]!==x||t[18]!==E?(D=(0,Y.jsxs)(`div`,{className:b,children:[x,E]}),t[16]=b,t[17]=x,t[18]=E,t[19]=D):D=t[19];let O;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(O=s(`inline-flex items-center gap-2 rounded-lg bg-surface-base/70 px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,C.press),t[20]=O):O=t[20];let k=!c||l,A;t[21]===l?A=t[22]:(A=l?(0,Y.jsx)(o,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,Y.jsx)(y,{className:`size-4`,"aria-hidden":!0}),t[21]=l,t[22]=A);let j=l?h.health.runDoctorRunning:h.health.runDoctor,M;t[23]!==l||t[24]!==a||t[25]!==k||t[26]!==A||t[27]!==j?(M=(0,Y.jsxs)(`button`,{type:`button`,className:O,onClick:a,disabled:k,"aria-busy":l,children:[A,j]}),t[23]=l,t[24]=a,t[25]=k,t[26]=A,t[27]=j,t[28]=M):M=t[28];let N;t[29]!==m||t[30]!==M?(N=(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[m,M]}),t[29]=m,t[30]=M,t[31]=N):N=t[31];let P;t[32]!==N||t[33]!==w||t[34]!==D?(P=(0,Y.jsxs)(`div`,{className:w,children:[D,N]}),t[32]=N,t[33]=w,t[34]=D,t[35]=P):P=t[35];let F;t[36]!==d||t[37]!==l||t[38]!==h.health.doctorCompleteMessage||t[39]!==h.health.doctorFailedMessage||t[40]!==h.health.doctorRunningMessage?(F=l||d!==`idle`?(0,Y.jsx)(`p`,{className:`mt-3 text-xs opacity-75`,role:`status`,"aria-live":`polite`,children:l?h.health.doctorRunningMessage:d===`success`?h.health.doctorCompleteMessage:h.health.doctorFailedMessage}):null,t[36]=d,t[37]=l,t[38]=h.health.doctorCompleteMessage,t[39]=h.health.doctorFailedMessage,t[40]=h.health.doctorRunningMessage,t[41]=F):F=t[41];let I;return t[42]!==P||t[43]!==F||t[44]!==T?(I=(0,Y.jsxs)(`section`,{className:T,children:[P,F]}),t[42]=P,t[43]=F,t[44]=T,t[45]=I):I=t[45],I}function $(e){return e.language}function ye(e){let t=(0,R.c)(26),{issue:n,fixLabel:r}=e,a;t[0]===n.status?a=t[1]:(a=X(n.status),t[0]=n.status,t[1]=a);let o=a,s;t[2]===o?s=t[3]:(s=(0,Y.jsx)(o,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),t[2]=o,t[3]=s);let c;t[4]===n.label?c=t[5]:(c=(0,Y.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:n.label}),t[4]=n.label,t[5]=c);let l;t[6]===n.message?l=t[7]:(l=(0,Y.jsx)(`span`,{className:`mt-1 block text-sm text-fg-muted`,children:n.message}),t[6]=n.message,t[7]=l);let u;t[8]===n.hints[0]?u=t[9]:(u=n.hints[0]?(0,Y.jsx)(`span`,{className:`mt-1 block truncate text-xs text-fg-subtle`,children:n.hints[0]}):null,t[8]=n.hints[0],t[9]=u);let d;t[10]!==c||t[11]!==l||t[12]!==u?(d=(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[c,l,u]}),t[10]=c,t[11]=l,t[12]=u,t[13]=d):d=t[13];let f;t[14]!==r||t[15]!==n.path?(f=n.path?(0,Y.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs font-medium text-accent-fg`,children:[r,(0,Y.jsx)(S,{className:`size-4`,"aria-hidden":!0})]}):null,t[14]=r,t[15]=n.path,t[16]=f):f=t[16];let p;t[17]!==s||t[18]!==d||t[19]!==f?(p=(0,Y.jsxs)(Y.Fragment,{children:[s,d,f]}),t[17]=s,t[18]=d,t[19]=f,t[20]=p):p=t[20];let m=p;if(n.path){let e;return t[21]!==m||t[22]!==n.path?(e=(0,Y.jsx)(i,{to:n.path,className:`flex items-start gap-3 px-1 py-3 hover:bg-surface-hover/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:m}),t[21]=m,t[22]=n.path,t[23]=e):e=t[23],e}let h;return t[24]===m?h=t[25]:(h=(0,Y.jsx)(`div`,{className:`flex items-start gap-3 px-1 py-3`,children:m}),t[24]=m,t[25]=h),h}function be(e){let t=(0,R.c)(27),{item:n,labels:r}=e,a;t[0]===n.status?a=t[1]:(a=X(n.status),t[0]=n.status,t[1]=a);let o=a,c=r[n.id]??n.title,l;t[2]===n.status?l=t[3]:(l=s(`flex size-7 shrink-0 items-center justify-center rounded-full`,ve(n.status)),t[2]=n.status,t[3]=l);let u;t[4]===o?u=t[5]:(u=(0,Y.jsx)(o,{className:`size-4`,"aria-hidden":!0}),t[4]=o,t[5]=u);let d;t[6]!==l||t[7]!==u?(d=(0,Y.jsx)(`span`,{className:l,children:u}),t[6]=l,t[7]=u,t[8]=d):d=t[8];let f;t[9]===c?f=t[10]:(f=(0,Y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:c}),t[9]=c,t[10]=f);let p;t[11]===n.detail?p=t[12]:(p=(0,Y.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.detail}),t[11]=n.detail,t[12]=p);let m;t[13]!==f||t[14]!==p?(m=(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;t[16]===n.path?h=t[17]:(h=n.path?(0,Y.jsx)(S,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[16]=n.path,t[17]=h);let g;t[18]!==d||t[19]!==m||t[20]!==h?(g=(0,Y.jsxs)(Y.Fragment,{children:[d,m,h]}),t[18]=d,t[19]=m,t[20]=h,t[21]=g):g=t[21];let _=g;if(n.path){let e;return t[22]!==_||t[23]!==n.path?(e=(0,Y.jsx)(i,{to:n.path,className:`flex items-center gap-3 rounded-lg p-3 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:_}),t[22]=_,t[23]=n.path,t[24]=e):e=t[24],e}let v;return t[25]===_?v=t[26]:(v=(0,Y.jsx)(`div`,{className:`flex items-center gap-3 rounded-lg p-3`,children:_}),t[25]=_,t[26]=v),v}function xe(e){let t=(0,R.c)(23),{signal:n,fixLabel:r}=e,a;t[0]===n.status?a=t[1]:(a=X(n.status),t[0]=n.status,t[1]=a);let o=a,s;t[2]===o?s=t[3]:(s=(0,Y.jsx)(o,{className:`mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),t[2]=o,t[3]=s);let c;t[4]===n.label?c=t[5]:(c=(0,Y.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:n.label}),t[4]=n.label,t[5]=c);let l;t[6]===n.message?l=t[7]:(l=(0,Y.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.message}),t[6]=n.message,t[7]=l);let u;t[8]!==c||t[9]!==l?(u=(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[c,l]}),t[8]=c,t[9]=l,t[10]=u):u=t[10];let d;t[11]!==r||t[12]!==n.path?(d=n.path?(0,Y.jsx)(`span`,{className:`sr-only`,children:r}):null,t[11]=r,t[12]=n.path,t[13]=d):d=t[13];let f;t[14]!==s||t[15]!==u||t[16]!==d?(f=(0,Y.jsxs)(Y.Fragment,{children:[s,u,d]}),t[14]=s,t[15]=u,t[16]=d,t[17]=f):f=t[17];let p=f;if(n.path){let e;return t[18]!==p||t[19]!==n.path?(e=(0,Y.jsx)(i,{to:n.path,className:`flex min-w-0 items-start gap-2 px-1 py-3 hover:bg-surface-hover/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:p}),t[18]=p,t[19]=n.path,t[20]=e):e=t[20],e}let m;return t[21]===p?m=t[22]:(m=(0,Y.jsx)(`div`,{className:`flex min-w-0 items-start gap-2 px-1 py-3`,children:p}),t[21]=p,t[22]=m),m}function Se(){let e=f(u(e=>e.language)).setupStatus,{ready:t,error:n,snapshot:r,refresh:i}=J(),[a,o]=(0,L.useState)(!1),[s,c]=(0,L.useState)(`idle`),l=r?.diagnosticSignals.filter(e=>e.status===`fail`||e.status===`warn`)??[],d=async()=>{if(!(a||!t)){o(!0),c(`idle`);try{await i(),c(`success`)}catch{c(`error`)}finally{o(!1)}}};return(0,Y.jsxs)(M,{gap:`gap-6`,children:[(0,Y.jsx)(j,{title:e.title}),n?(0,Y.jsx)(`p`,{className:`rounded-xl bg-red-50 px-4 py-3 text-sm text-red-700 dark:bg-red-950/30 dark:text-red-300`,children:e.loadError}):null,!t||!r?(0,Y.jsx)(F,{sections:2}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{tier:r.healthTier,issueCount:r.issues.length,ready:t,onRunDoctor:()=>void d(),doctorRunning:a,doctorRunState:s}),(0,Y.jsxs)(P,{id:`next-steps`,children:[(0,Y.jsx)(N,{icon:r.issues.length?T:k,title:e.nextStepsTitle}),r.issues.length?(0,Y.jsx)(`div`,{className:`mt-3 flex flex-col gap-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45 [&>*]:px-3`,children:r.issues.slice(0,8).map(t=>(0,Y.jsx)(ye,{issue:t,fixLabel:e.fixIssue},`${t.source}:${t.id}`))}):(0,Y.jsx)(`div`,{className:`mt-3 flex flex-col gap-1 [&>*]:bg-surface-base/45`,children:r.readiness.map(t=>(0,Y.jsx)(be,{item:t,labels:e.readinessLabels},t.id))})]}),(0,Y.jsx)(I,{children:(0,Y.jsxs)(P,{children:[(0,Y.jsx)(N,{icon:O,title:e.diagnosticsTitle}),l.length?(0,Y.jsx)(`div`,{className:`mt-3 flex flex-col gap-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45 [&>*]:px-3`,children:l.map(t=>(0,Y.jsx)(xe,{signal:t,fixLabel:e.fixIssue},t.id))}):(0,Y.jsx)(`p`,{className:`mt-3 py-2 text-sm text-fg-muted`,children:r.diagnosticSignals.length?e.diagnosticsAllClear:e.diagnosticsEmpty})]})})]})]})}export{Se as SetupStatusPanel};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-process-heavy-Db4nTY5N.js","assets/rolldown-runtime-aKtaBQYM.js","assets/preload-helper-zJ_50EbN.js","assets/pdf-runtime-DU_sMPjG.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{p as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as o}from"./markdown-view-B1q2w6W_.js";import{t as s}from"./cn-JdwAhgNB.js";import{n as c,r as l}from"./locale-store-DuG-kbsP.js";import{t as u}from"./messages-BYbx4OuI.js";import{t as d}from"./copy-to-clipboard-HOJ79TWv.js";import{t as f}from"./skeleton-BwbyijEw.js";import{Ji as p,Ki as m,Yi as h,ai as g,da as _,ii as v,qo as y}from"./index-54o0AGdj.js";var b=e(t(),1),x=n(),S=/^ {0,3}\[([^\]]+)\]:\s*<?(https?:\/\/[^\s>]+)>?(?:\s+.*)?$/gim,C=/!\[([^\]]*)\]\(\s*<?(https?:\/\/[^\s)>]+)>?(?:\s+(?:"[^"]*"|'[^']*'|\([^)]*\)))?\s*\)/gi,w=/!\[([^\]]*)\]\[([^\]]+)\]/g;function T(e,t){let n=new Map;for(let t of e.matchAll(S))n.set(E(t[1]??``),t[2]??``);return e.replace(C,(e,n,r)=>`[${n.trim()||t}](${r})`).replace(w,(e,r,i)=>{let a=n.get(E(i));return a?`[${r.trim()||t}](${a})`:e})}function E(e){return e.trim().replace(/\s+/g,` `).toLowerCase()}var D=r();function O(){return{textContent:null,binaryBuffer:null,extractedText:null,extractedTextTruncated:!1}}function k(e){let t=(0,x.c)(30),{subtitle:n,openInlineUrl:r,landingUrl:i,...a}=e,{expanded:o,setExpanded:c}=v(),l=u(a.language),f;t[0]===l?f=t[1]:(f=async()=>{let e=await d(window.location.href);y(e?`success`:`warning`,e?l.sharesSettings.copied:l.clipboard.copyFailed)},t[0]=l,t[1]=f);let p=f,m=o&&`fixed inset-0 z-[65] h-[100dvh] max-w-none`,h;t[2]===m?h=t[3]:(h=s(`mx-auto flex h-full min-h-0 w-full max-w-[var(--max-width-app-main)] flex-col bg-surface-panel`,m),t[2]=m,t[3]=h);let _;t[4]!==c||t[5]!==a.loadError||t[6]!==a.loading?(_=!a.loading&&!a.loadError?()=>c(A):void 0,t[4]=c,t[5]=a.loadError,t[6]=a.loading,t[7]=_):_=t[7];let b;t[8]===i?b=t[9]:(b=()=>window.location.assign(i),t[8]=i,t[9]=b);let S;t[10]===p?S=t[11]:(S=()=>void p(),t[10]=p,t[11]=S);let C=a.loading||!!a.loadError,w;t[12]!==S||t[13]!==C?(w={onClick:S,disabled:C},t[12]=S,t[13]=C,t[14]=w):w=t[14];let T;t[15]===r?T=t[16]:(T={href:r},t[15]=r,t[16]=T);let E;t[17]!==o||t[18]!==n||t[19]!==_||t[20]!==b||t[21]!==w||t[22]!==T?(E={subtitle:n,expanded:o,onToggleExpanded:_,onClose:b,share:w,openInBrowser:T},t[17]=o,t[18]=n,t[19]=_,t[20]=b,t[21]=w,t[22]=T,t[23]=E):E=t[23];let O;t[24]!==a||t[25]!==E?(O=(0,D.jsx)(g,{...a,header:E}),t[24]=a,t[25]=E,t[26]=O):O=t[26];let k;return t[27]!==O||t[28]!==h?(k=(0,D.jsx)(`div`,{className:h,children:O}),t[27]=O,t[28]=h,t[29]=k):k=t[29],k}function A(e){return!e}function j(){let{token:e}=a(),t=c(e=>e.language),n=t===`zh`?P:F,[r,s]=(0,b.useState)(null),[u,d]=(0,b.useState)(O),[g,v]=(0,b.useState)(!0),[y,x]=(0,b.useState)(null),[S,C]=(0,b.useState)(null),[w,E]=(0,b.useState)(null),A=(0,b.useMemo)(()=>{if(!r||!e||r.kind!==`file`)return null;let t=p(r.fileName,r.mimeType);return{id:`share:${e}:${r.fileName}`,context:`share`,fileName:r.fileName,mimeType:t,size:r.fileSize,type:m(r.fileName,t),source:{kind:`share`,token:e}}},[r,e]);(0,b.useEffect)(()=>{if(!e){x(n.invalidLink),v(!1);return}let t=!1;return(async()=>{try{v(!0),x(null),d(O()),C(null),E(null);let r=await fetch(l(`/s/${encodeURIComponent(e)}/meta`));if(!r.ok){t||x(r.status===404?n.notFound:n.expired);return}let a=await r.json();if(t)return;if(s(a),!a.valid){x(n.expired);return}if(a.kind===`note`||a.kind===`session`){let r=await fetch(l(`/s/${encodeURIComponent(e)}/view`),{method:`POST`});if(!r.ok){x(r.status===404?n.notFound:n.expired);return}let i=await r.json();!t&&i.payload?.kind===`note`&&C(i.payload),!t&&i.payload?.kind===`session`&&E(i.payload);return}if(a.kind!==`file`)return;let o=p(a.fileName,a.mimeType),c=m(a.fileName,o),u=h(c),f=l(`/s/${encodeURIComponent(e)}?inline=1`);if(u===`text`){if(a.fileSize>5242880){x(n.tooLarge);return}let e=await fetch(f);if(!e.ok){x(n.expired);return}let r=await e.text();t||d({...O(),textContent:r});return}if(u===`binary`){if(a.fileSize>33554432){x(n.tooLarge);return}let e=await fetch(f);if(!e.ok){x(n.expired);return}let r=await e.arrayBuffer();if(t)return;if(c===`pptx`){let{processPptx:e}=await i(async()=>{let{processPptx:e}=await import(`./attachment-process-heavy-Db4nTY5N.js`);return{processPptx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:t}=await e(r,a.fileName),n=t.length>_;d({textContent:null,binaryBuffer:r,extractedText:n?t.slice(0,_):t,extractedTextTruncated:n});return}d({...O(),binaryBuffer:r})}}catch(e){t||x(e instanceof Error?e.message:String(e))}finally{t||v(!1)}})(),()=>{t=!0}},[e,n.expired,n.invalidLink,n.notFound,n.tooLarge]);let j=e?l(`/s/${encodeURIComponent(e)}?dl=1`):`#`,I=e?l(`/s/${encodeURIComponent(e)}?inline=1`):`#`;return A&&r&&e?(0,D.jsx)(k,{language:t,descriptor:A,loading:g,loadError:y,textContent:u.textContent,binaryBuffer:u.binaryBuffer,extractedText:u.extractedText,extractedTextTruncated:u.extractedTextTruncated,subtitle:(0,D.jsxs)(`span`,{className:`truncate`,children:[N(r.fileSize),` · `,n.expiresAt,` `,new Date(r.expiresAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`)]}),openInlineUrl:I,landingUrl:l(`/s/${encodeURIComponent(e)}`),actions:{onDownload:()=>{window.location.href=j},canDownload:!g&&!y}}):(0,D.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden bg-surface-base`,children:[(0,D.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center gap-3 border-b border-edge px-4`,children:[(0,D.jsx)(`span`,{className:`text-lg`,"aria-hidden":!0,children:`#`}),(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r?(0,D.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,title:r.fileName,children:r.fileName}):g?(0,D.jsx)(f,{className:`h-4 w-48 max-w-full`}):(0,D.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:n.error}),r?(0,D.jsxs)(`div`,{className:`truncate text-xs text-fg-muted`,children:[N(r.fileSize),` · `,n.expiresAt,` `,new Date(r.expiresAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`)]}):null]})]}),(0,D.jsx)(`main`,{className:`flex min-h-0 w-full flex-1 flex-col overflow-y-auto overscroll-contain px-3 py-6 sm:px-5 xl:px-6`,children:g?(0,D.jsxs)(`div`,{className:`flex min-h-[70vh] flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel p-4 shadow-surface`,"aria-busy":`true`,children:[(0,D.jsx)(f,{className:`h-5 w-56 max-w-full`}),(0,D.jsxs)(`div`,{className:`mt-5 grid gap-3`,children:[(0,D.jsx)(f,{className:`h-4 w-full`}),(0,D.jsx)(f,{className:`h-4 w-11/12`}),(0,D.jsx)(f,{className:`h-4 w-10/12`}),(0,D.jsx)(f,{className:`h-4 w-3/4`})]}),(0,D.jsx)(f,{className:`mt-6 min-h-0 flex-1 rounded-lg`})]}):y?(0,D.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-6 shadow-surface text-sm text-fg`,children:[(0,D.jsx)(`p`,{className:`font-medium`,children:n.error}),(0,D.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:y})]}):r?.kind===`directory`?(0,D.jsx)(`div`,{className:`rounded-lg bg-surface-panel p-6 shadow-surface text-sm text-fg-muted`,children:n.directoryHint}):r?.kind===`note`&&S?(0,D.jsxs)(`article`,{className:`mx-auto w-full max-w-3xl rounded-xl border border-edge-subtle bg-surface-panel px-6 py-8 shadow-surface sm:px-10 sm:py-10`,children:[(0,D.jsx)(`h1`,{className:`text-3xl font-bold tracking-tight text-fg`,children:S.title}),(0,D.jsxs)(`div`,{className:`mt-2 text-xs text-fg-muted`,children:[n.sharedAt,` `,new Date(S.snapshotAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`),` · `,n.expiresAt,` `,new Date(S.expiresAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`)]}),S.description?(0,D.jsx)(`p`,{className:`mt-5 rounded-lg bg-surface-subtle px-4 py-3 text-sm leading-6 text-fg-muted`,children:S.description}):null,(0,D.jsx)(o,{content:T(S.markdown,n.remoteImageBlocked),className:`mt-8`}),(0,D.jsx)(`footer`,{className:`mt-10 border-t border-edge-subtle pt-4 text-center text-xs text-fg-subtle`,children:n.sharedVia})]}):r?.kind===`session`&&w?(0,D.jsxs)(`article`,{className:`mx-auto w-full max-w-4xl rounded-xl border border-edge-subtle bg-surface-panel px-4 py-7 shadow-surface sm:px-8 sm:py-9`,children:[(0,D.jsxs)(`header`,{className:`mx-auto max-w-3xl border-b border-edge-subtle pb-5`,children:[(0,D.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight text-fg sm:text-3xl`,children:w.title}),(0,D.jsxs)(`div`,{className:`mt-2 text-xs text-fg-muted`,children:[n.sharedAt,` `,new Date(w.snapshotAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`),` · `,n.expiresAt,` `,new Date(w.expiresAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`)]}),w.description?(0,D.jsx)(`p`,{className:`mt-4 text-sm leading-6 text-fg-muted`,children:w.description}):null]}),(0,D.jsxs)(`div`,{className:`mx-auto mt-6 max-w-3xl space-y-5`,children:[w.messages.map(e=>(0,D.jsxs)(`section`,{className:e.role===`user`?`ml-auto max-w-[85%]`:`mr-auto max-w-full`,children:[(0,D.jsx)(`div`,{className:`mb-1 text-xs font-medium text-fg-subtle`,children:e.role===`user`?n.you:n.assistant}),(0,D.jsxs)(`div`,{className:e.role===`user`?`rounded-2xl bg-surface-subtle px-4 py-3`:`px-1 py-1`,children:[(0,D.jsx)(o,{content:T(e.markdown,n.remoteImageBlocked)}),w.attachments.filter(t=>e.attachmentIds.includes(t.id)).map(e=>(0,D.jsx)(M,{attachment:e},e.id)),w.toolActivities.filter(t=>t.messageId===e.id).map(e=>(0,D.jsxs)(`div`,{className:`mt-2 inline-flex items-center gap-1.5 rounded-md border border-edge-subtle px-2 py-1 text-xs text-fg-muted`,children:[(0,D.jsx)(`span`,{children:e.toolName}),(0,D.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,D.jsx)(`span`,{children:e.status===`completed`?n.toolCompleted:n.toolFailed})]},e.id))]})]},e.id)),w.toolActivities.filter(e=>!e.messageId).map(e=>(0,D.jsxs)(`div`,{className:`text-center text-xs text-fg-muted`,children:[e.toolName,` · `,e.status===`completed`?n.toolCompleted:n.toolFailed]},e.id))]}),(0,D.jsx)(`footer`,{className:`mx-auto mt-10 max-w-3xl border-t border-edge-subtle pt-4 text-center text-xs text-fg-subtle`,children:n.sharedVia})]}):null})]})}function M(e){let t=(0,x.c)(15),{attachment:n}=e;if(n.mimeType.startsWith(`image/`)){let e;return t[0]!==n.fileName||t[1]!==n.url?(e=(0,D.jsx)(`img`,{src:n.url,alt:n.fileName,loading:`lazy`,className:`mt-3 max-h-[28rem] max-w-full rounded-lg border border-edge-subtle object-contain`}),t[0]=n.fileName,t[1]=n.url,t[2]=e):e=t[2],e}if(n.mimeType.startsWith(`audio/`)){let e;return t[3]===n.url?e=t[4]:(e=(0,D.jsx)(`audio`,{src:n.url,controls:!0,preload:`none`,className:`mt-3 max-w-full`}),t[3]=n.url,t[4]=e),e}let r=n.url,i;t[5]===n.fileName?i=t[6]:(i=(0,D.jsx)(`span`,{className:`min-w-0 truncate`,children:n.fileName}),t[5]=n.fileName,t[6]=i);let a;t[7]===n.size?a=t[8]:(a=N(n.size),t[7]=n.size,t[8]=a);let o;t[9]===a?o=t[10]:(o=(0,D.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:a}),t[9]=a,t[10]=o);let s;return t[11]!==n.url||t[12]!==i||t[13]!==o?(s=(0,D.jsxs)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,className:`mt-3 flex items-center justify-between gap-3 rounded-lg border border-edge-subtle px-3 py-2 text-sm text-accent hover:bg-surface-hover`,children:[i,o]}),t[11]=n.url,t[12]=i,t[13]=o,t[14]=s):s=t[14],s}function N(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:e<1073741824?`${(e/1048576).toFixed(1)} MB`:`${(e/1073741824).toFixed(1)} GB`}var P={error:`加载失败`,expired:`链接已失效`,notFound:`链接不存在`,invalidLink:`链接无效`,expiresAt:`有效期至`,directoryHint:`目录分享请使用主页面浏览。`,tooLarge:`文件过大,无法在线预览,请下载查看。`,sharedAt:`分享于`,sharedVia:`通过 xopc 分享`,you:`你`,assistant:`助手`,toolCompleted:`已完成`,toolFailed:`失败`,remoteImageBlocked:`远程图片(点击打开)`},F={error:`Failed to load`,expired:`Link no longer valid`,notFound:`Link not found`,invalidLink:`Invalid link`,expiresAt:`Expires`,directoryHint:`Directory shares are browsed from the main page.`,tooLarge:`This file is too large to preview here. Please download it instead.`,sharedAt:`Shared`,sharedVia:`Shared via xopc`,you:`You`,assistant:`Assistant`,toolCompleted:`completed`,toolFailed:`failed`,remoteImageBlocked:`Remote image (open manually)`};export{j as SharePreviewPage};
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{p as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as o}from"./markdown-view-B8maDRWh.js";import{t as s}from"./cn-JdwAhgNB.js";import{n as c,r as l}from"./locale-store-DLK05Y1a.js";import{t as u}from"./messages-C9h8SImu.js";import{t as d}from"./copy-to-clipboard-HOJ79TWv.js";import{t as f}from"./skeleton-BwbyijEw.js";import{Ji as p,Ki as m,Yi as h,ai as g,da as _,ii as v,qo as y}from"./index-hlU8MUEz.js";var b=e(t(),1),x=n(),S=/^ {0,3}\[([^\]]+)\]:\s*<?(https?:\/\/[^\s>]+)>?(?:\s+.*)?$/gim,C=/!\[([^\]]*)\]\(\s*<?(https?:\/\/[^\s)>]+)>?(?:\s+(?:"[^"]*"|'[^']*'|\([^)]*\)))?\s*\)/gi,w=/!\[([^\]]*)\]\[([^\]]+)\]/g;function T(e,t){let n=new Map;for(let t of e.matchAll(S))n.set(E(t[1]??``),t[2]??``);return e.replace(C,(e,n,r)=>`[${n.trim()||t}](${r})`).replace(w,(e,r,i)=>{let a=n.get(E(i));return a?`[${r.trim()||t}](${a})`:e})}function E(e){return e.trim().replace(/\s+/g,` `).toLowerCase()}var D=r();function O(){return{textContent:null,binaryBuffer:null,extractedText:null,extractedTextTruncated:!1}}function k(e){let t=(0,x.c)(30),{subtitle:n,openInlineUrl:r,landingUrl:i,...a}=e,{expanded:o,setExpanded:c}=v(),l=u(a.language),f;t[0]===l?f=t[1]:(f=async()=>{let e=await d(window.location.href);y(e?`success`:`warning`,e?l.sharesSettings.copied:l.clipboard.copyFailed)},t[0]=l,t[1]=f);let p=f,m=o&&`fixed inset-0 z-[65] h-[100dvh] max-w-none`,h;t[2]===m?h=t[3]:(h=s(`mx-auto flex h-full min-h-0 w-full max-w-[var(--max-width-app-main)] flex-col bg-surface-panel`,m),t[2]=m,t[3]=h);let _;t[4]!==c||t[5]!==a.loadError||t[6]!==a.loading?(_=!a.loading&&!a.loadError?()=>c(A):void 0,t[4]=c,t[5]=a.loadError,t[6]=a.loading,t[7]=_):_=t[7];let b;t[8]===i?b=t[9]:(b=()=>window.location.assign(i),t[8]=i,t[9]=b);let S;t[10]===p?S=t[11]:(S=()=>void p(),t[10]=p,t[11]=S);let C=a.loading||!!a.loadError,w;t[12]!==S||t[13]!==C?(w={onClick:S,disabled:C},t[12]=S,t[13]=C,t[14]=w):w=t[14];let T;t[15]===r?T=t[16]:(T={href:r},t[15]=r,t[16]=T);let E;t[17]!==o||t[18]!==n||t[19]!==_||t[20]!==b||t[21]!==w||t[22]!==T?(E={subtitle:n,expanded:o,onToggleExpanded:_,onClose:b,share:w,openInBrowser:T},t[17]=o,t[18]=n,t[19]=_,t[20]=b,t[21]=w,t[22]=T,t[23]=E):E=t[23];let O;t[24]!==a||t[25]!==E?(O=(0,D.jsx)(g,{...a,header:E}),t[24]=a,t[25]=E,t[26]=O):O=t[26];let k;return t[27]!==O||t[28]!==h?(k=(0,D.jsx)(`div`,{className:h,children:O}),t[27]=O,t[28]=h,t[29]=k):k=t[29],k}function A(e){return!e}function j(){let{token:e}=a(),t=c(e=>e.language),n=t===`zh`?P:F,[r,s]=(0,b.useState)(null),[u,d]=(0,b.useState)(O),[g,v]=(0,b.useState)(!0),[y,x]=(0,b.useState)(null),[S,C]=(0,b.useState)(null),[w,E]=(0,b.useState)(null),A=(0,b.useMemo)(()=>{if(!r||!e||r.kind!==`file`)return null;let t=p(r.fileName,r.mimeType);return{id:`share:${e}:${r.fileName}`,context:`share`,fileName:r.fileName,mimeType:t,size:r.fileSize,type:m(r.fileName,t),source:{kind:`share`,token:e}}},[r,e]);(0,b.useEffect)(()=>{if(!e){x(n.invalidLink),v(!1);return}let t=!1;return(async()=>{try{v(!0),x(null),d(O()),C(null),E(null);let r=await fetch(l(`/s/${encodeURIComponent(e)}/meta`));if(!r.ok){t||x(r.status===404?n.notFound:n.expired);return}let a=await r.json();if(t)return;if(s(a),!a.valid){x(n.expired);return}if(a.kind===`note`||a.kind===`session`){let r=await fetch(l(`/s/${encodeURIComponent(e)}/view`),{method:`POST`});if(!r.ok){x(r.status===404?n.notFound:n.expired);return}let i=await r.json();!t&&i.payload?.kind===`note`&&C(i.payload),!t&&i.payload?.kind===`session`&&E(i.payload);return}if(a.kind!==`file`)return;let o=p(a.fileName,a.mimeType),c=m(a.fileName,o),u=h(c),f=l(`/s/${encodeURIComponent(e)}?inline=1`);if(u===`text`){if(a.fileSize>5242880){x(n.tooLarge);return}let e=await fetch(f);if(!e.ok){x(n.expired);return}let r=await e.text();t||d({...O(),textContent:r});return}if(u===`binary`){if(a.fileSize>33554432){x(n.tooLarge);return}let e=await fetch(f);if(!e.ok){x(n.expired);return}let r=await e.arrayBuffer();if(t)return;if(c===`pptx`){let{processPptx:e}=await i(async()=>{let{processPptx:e}=await import(`./attachment-process-heavy-Db4nTY5N.js`);return{processPptx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:t}=await e(r,a.fileName),n=t.length>_;d({textContent:null,binaryBuffer:r,extractedText:n?t.slice(0,_):t,extractedTextTruncated:n});return}d({...O(),binaryBuffer:r})}}catch(e){t||x(e instanceof Error?e.message:String(e))}finally{t||v(!1)}})(),()=>{t=!0}},[e,n.expired,n.invalidLink,n.notFound,n.tooLarge]);let j=e?l(`/s/${encodeURIComponent(e)}?dl=1`):`#`,I=e?l(`/s/${encodeURIComponent(e)}?inline=1`):`#`;return A&&r&&e?(0,D.jsx)(k,{language:t,descriptor:A,loading:g,loadError:y,textContent:u.textContent,binaryBuffer:u.binaryBuffer,extractedText:u.extractedText,extractedTextTruncated:u.extractedTextTruncated,subtitle:(0,D.jsxs)(`span`,{className:`truncate`,children:[N(r.fileSize),` · `,n.expiresAt,` `,new Date(r.expiresAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`)]}),openInlineUrl:I,landingUrl:l(`/s/${encodeURIComponent(e)}`),actions:{onDownload:()=>{window.location.href=j},canDownload:!g&&!y}}):(0,D.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden bg-surface-base`,children:[(0,D.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center gap-3 border-b border-edge px-4`,children:[(0,D.jsx)(`span`,{className:`text-lg`,"aria-hidden":!0,children:`#`}),(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r?(0,D.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,title:r.fileName,children:r.fileName}):g?(0,D.jsx)(f,{className:`h-4 w-48 max-w-full`}):(0,D.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:n.error}),r?(0,D.jsxs)(`div`,{className:`truncate text-xs text-fg-muted`,children:[N(r.fileSize),` · `,n.expiresAt,` `,new Date(r.expiresAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`)]}):null]})]}),(0,D.jsx)(`main`,{className:`flex min-h-0 w-full flex-1 flex-col overflow-y-auto overscroll-contain px-3 py-6 sm:px-5 xl:px-6`,children:g?(0,D.jsxs)(`div`,{className:`flex min-h-[70vh] flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel p-4 shadow-surface`,"aria-busy":`true`,children:[(0,D.jsx)(f,{className:`h-5 w-56 max-w-full`}),(0,D.jsxs)(`div`,{className:`mt-5 grid gap-3`,children:[(0,D.jsx)(f,{className:`h-4 w-full`}),(0,D.jsx)(f,{className:`h-4 w-11/12`}),(0,D.jsx)(f,{className:`h-4 w-10/12`}),(0,D.jsx)(f,{className:`h-4 w-3/4`})]}),(0,D.jsx)(f,{className:`mt-6 min-h-0 flex-1 rounded-lg`})]}):y?(0,D.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-6 shadow-surface text-sm text-fg`,children:[(0,D.jsx)(`p`,{className:`font-medium`,children:n.error}),(0,D.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:y})]}):r?.kind===`directory`?(0,D.jsx)(`div`,{className:`rounded-lg bg-surface-panel p-6 shadow-surface text-sm text-fg-muted`,children:n.directoryHint}):r?.kind===`note`&&S?(0,D.jsxs)(`article`,{className:`mx-auto w-full max-w-3xl rounded-xl border border-edge-subtle bg-surface-panel px-6 py-8 shadow-surface sm:px-10 sm:py-10`,children:[(0,D.jsx)(`h1`,{className:`text-3xl font-bold tracking-tight text-fg`,children:S.title}),(0,D.jsxs)(`div`,{className:`mt-2 text-xs text-fg-muted`,children:[n.sharedAt,` `,new Date(S.snapshotAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`),` · `,n.expiresAt,` `,new Date(S.expiresAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`)]}),S.description?(0,D.jsx)(`p`,{className:`mt-5 rounded-lg bg-surface-subtle px-4 py-3 text-sm leading-6 text-fg-muted`,children:S.description}):null,(0,D.jsx)(o,{content:T(S.markdown,n.remoteImageBlocked),className:`mt-8`}),(0,D.jsx)(`footer`,{className:`mt-10 border-t border-edge-subtle pt-4 text-center text-xs text-fg-subtle`,children:n.sharedVia})]}):r?.kind===`session`&&w?(0,D.jsxs)(`article`,{className:`mx-auto w-full max-w-4xl rounded-xl border border-edge-subtle bg-surface-panel px-4 py-7 shadow-surface sm:px-8 sm:py-9`,children:[(0,D.jsxs)(`header`,{className:`mx-auto max-w-3xl border-b border-edge-subtle pb-5`,children:[(0,D.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight text-fg sm:text-3xl`,children:w.title}),(0,D.jsxs)(`div`,{className:`mt-2 text-xs text-fg-muted`,children:[n.sharedAt,` `,new Date(w.snapshotAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`),` · `,n.expiresAt,` `,new Date(w.expiresAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`)]}),w.description?(0,D.jsx)(`p`,{className:`mt-4 text-sm leading-6 text-fg-muted`,children:w.description}):null]}),(0,D.jsxs)(`div`,{className:`mx-auto mt-6 max-w-3xl space-y-5`,children:[w.messages.map(e=>(0,D.jsxs)(`section`,{className:e.role===`user`?`ml-auto max-w-[85%]`:`mr-auto max-w-full`,children:[(0,D.jsx)(`div`,{className:`mb-1 text-xs font-medium text-fg-subtle`,children:e.role===`user`?n.you:n.assistant}),(0,D.jsxs)(`div`,{className:e.role===`user`?`rounded-2xl bg-surface-subtle px-4 py-3`:`px-1 py-1`,children:[(0,D.jsx)(o,{content:T(e.markdown,n.remoteImageBlocked)}),w.attachments.filter(t=>e.attachmentIds.includes(t.id)).map(e=>(0,D.jsx)(M,{attachment:e},e.id)),w.toolActivities.filter(t=>t.messageId===e.id).map(e=>(0,D.jsxs)(`div`,{className:`mt-2 inline-flex items-center gap-1.5 rounded-md border border-edge-subtle px-2 py-1 text-xs text-fg-muted`,children:[(0,D.jsx)(`span`,{children:e.toolName}),(0,D.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,D.jsx)(`span`,{children:e.status===`completed`?n.toolCompleted:n.toolFailed})]},e.id))]})]},e.id)),w.toolActivities.filter(e=>!e.messageId).map(e=>(0,D.jsxs)(`div`,{className:`text-center text-xs text-fg-muted`,children:[e.toolName,` · `,e.status===`completed`?n.toolCompleted:n.toolFailed]},e.id))]}),(0,D.jsx)(`footer`,{className:`mx-auto mt-10 max-w-3xl border-t border-edge-subtle pt-4 text-center text-xs text-fg-subtle`,children:n.sharedVia})]}):null})]})}function M(e){let t=(0,x.c)(15),{attachment:n}=e;if(n.mimeType.startsWith(`image/`)){let e;return t[0]!==n.fileName||t[1]!==n.url?(e=(0,D.jsx)(`img`,{src:n.url,alt:n.fileName,loading:`lazy`,className:`mt-3 max-h-[28rem] max-w-full rounded-lg border border-edge-subtle object-contain`}),t[0]=n.fileName,t[1]=n.url,t[2]=e):e=t[2],e}if(n.mimeType.startsWith(`audio/`)){let e;return t[3]===n.url?e=t[4]:(e=(0,D.jsx)(`audio`,{src:n.url,controls:!0,preload:`none`,className:`mt-3 max-w-full`}),t[3]=n.url,t[4]=e),e}let r=n.url,i;t[5]===n.fileName?i=t[6]:(i=(0,D.jsx)(`span`,{className:`min-w-0 truncate`,children:n.fileName}),t[5]=n.fileName,t[6]=i);let a;t[7]===n.size?a=t[8]:(a=N(n.size),t[7]=n.size,t[8]=a);let o;t[9]===a?o=t[10]:(o=(0,D.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:a}),t[9]=a,t[10]=o);let s;return t[11]!==n.url||t[12]!==i||t[13]!==o?(s=(0,D.jsxs)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,className:`mt-3 flex items-center justify-between gap-3 rounded-lg border border-edge-subtle px-3 py-2 text-sm text-accent hover:bg-surface-hover`,children:[i,o]}),t[11]=n.url,t[12]=i,t[13]=o,t[14]=s):s=t[14],s}function N(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:e<1073741824?`${(e/1048576).toFixed(1)} MB`:`${(e/1073741824).toFixed(1)} GB`}var P={error:`加载失败`,expired:`链接已失效`,notFound:`链接不存在`,invalidLink:`链接无效`,expiresAt:`有效期至`,directoryHint:`目录分享请使用主页面浏览。`,tooLarge:`文件过大,无法在线预览,请下载查看。`,sharedAt:`分享于`,sharedVia:`通过 xopc 分享`,you:`你`,assistant:`助手`,toolCompleted:`已完成`,toolFailed:`失败`,remoteImageBlocked:`远程图片(点击打开)`},F={error:`Failed to load`,expired:`Link no longer valid`,notFound:`Link not found`,invalidLink:`Invalid link`,expiresAt:`Expires`,directoryHint:`Directory shares are browsed from the main page.`,tooLarge:`This file is too large to preview here. Please download it instead.`,sharedAt:`Shared`,sharedVia:`Shared via xopc`,you:`You`,assistant:`Assistant`,toolCompleted:`completed`,toolFailed:`failed`,remoteImageBlocked:`Remote image (open manually)`};export{j as SharePreviewPage};
|