@xopcai/xopc 0.0.129 → 0.0.131
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/icons/icon-128.png +0 -0
- package/dist/browser-ext/icons/icon-16.png +0 -0
- package/dist/browser-ext/icons/icon-32.png +0 -0
- package/dist/browser-ext/icons/icon-48.png +0 -0
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/apple-touch-icon.png +0 -0
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DHzfg5D-.js → agent-avatar-dicebear-BJYeTxQ9.js} +1 -1
- package/dist/gateway/static/root/assets/agents-kVsY4Iz_.js +2 -0
- package/dist/gateway/static/root/assets/app-management-settings-panel-Bj8iJ-7d.js +1 -0
- package/dist/gateway/static/root/assets/{appearance-settings-bYeEj3IW.js → appearance-settings-6TjISbHB.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-DC4YwXLL.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-Dy6lsTHw.js → archive-plugin-2G62raBg.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-qOtBYR6Y.js → attachment-load-kLNJMEJh.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-BFH-RfaV.js → automation-suggestion-card-CpcZSSD8.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-MZ8m4bYP.js +4 -0
- package/dist/gateway/static/root/assets/{binary-plugins-DJvi_thc.js → binary-plugins-C_zSrWow.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DlMnizlt.js → block-editor-D_PMrT-l.js} +4 -4
- package/dist/gateway/static/root/assets/browser-settings-page-C89wKfPd.js +8 -0
- package/dist/gateway/static/root/assets/capability-presets-api-CPFtajl7.js +1 -0
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-Dng8Grpv.js → capability-presets-settings-panel-DWw31-4v.js} +1 -1
- package/dist/gateway/static/root/assets/channel-recipient-api-BUi8syv2.js +1 -0
- package/dist/gateway/static/root/assets/channels-settings-DOYzcMAE.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-DCE-PgQF.js +2 -0
- package/dist/gateway/static/root/assets/desktop-pet-BYV16wez.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-settings-B-u63N4e.js → desktop-pet-settings-DGIaFqPR.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-8p1ehIHn.js → directory-picker-path-field-BEhDuShd.js} +1 -1
- package/dist/gateway/static/root/assets/dreaming-settings-BIkgLFDH.js +3 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DJ1ABK95.js → extension-debug-page-BIjLZMAQ.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CP9P2lGM.js → extension-page-Cxv4Bgj5.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-DNd0tRFl.js +1 -0
- package/dist/gateway/static/root/assets/fetch-Bl7zMnmd.js +1 -0
- package/dist/gateway/static/root/assets/gateway-config-api-BiqKIkkp.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-D_Cvasqi.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CY5W2Pp4.js → gateway-startup-retry-CPOgTcpv.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-create-dialog-2lPbGfp3.js → goal-create-dialog-DZ68qzpm.js} +1 -1
- package/dist/gateway/static/root/assets/goal-detail-page-DF8QhTHH.js +4 -0
- package/dist/gateway/static/root/assets/goals-config-api-h26_-2Vm.js +1 -0
- package/dist/gateway/static/root/assets/goals-page-BzBKHZJg.js +2 -0
- package/dist/gateway/static/root/assets/goals-settings-BFG1uTI8.js +1 -0
- package/dist/gateway/static/root/assets/heartbeat-settings-5vV8vTva.js +1 -0
- package/dist/gateway/static/root/assets/index-DOetFpTt.js +262 -0
- package/dist/gateway/static/root/assets/index-W4ogAiHt.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BrENZzM7.js → keyboard-shortcuts-settings-Dpx1ovO6.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-3QO3elfx.js +7 -0
- package/dist/gateway/static/root/assets/{markdown-split-BYF4ReGM.js → markdown-split-Ba4EsPkV.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CpQDz-QJ.js → media-plugins-lA5rvtCq.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-YzjnURPJ.js → messages-Bq4REfIj.js} +2 -2
- package/dist/gateway/static/root/assets/models-hub-panel-BBG87CHZ.js +2 -0
- package/dist/gateway/static/root/assets/notes-page-DrUGE-Hn.js +1 -0
- package/dist/gateway/static/root/assets/notes-workbench-eAIE8iKV.js +2 -0
- package/dist/gateway/static/root/assets/{page-tabs-RnYYOIWO.js → page-tabs-Cy7bX7Ce.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-CTRt06Ri.js → preview-open-alternatives-B9_iql49.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-Cwct6pCV.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BXZlzV8t.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-C29EWM0P.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-c4pZeikq.js → save-bar-controls-nMloZ0mp.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-Cb6R7iuP.js → schedule-field-BuajpVNF.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-BqET_hEP.js → schema-form-IeXV_yQk.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-DHHVDqsy.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-hDvmobsT.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-DuOvqNsI.js → settings-collapsible-section-ByixWwvu.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-DptSsbWd.js → settings-form-section-C-5-n-jM.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-BlVfBCb9.js → settings-loading-skeleton-CTA5Gje4.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-DzqxeemF.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-layout-DVt69dJJ.js → settings-page-layout-DgFTf6nM.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-svpHcJ62.js +1 -0
- package/dist/gateway/static/root/assets/share-preview-page-IOjU69FC.js +2 -0
- package/dist/gateway/static/root/assets/shares-settings-Ddg8gHPN.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DcNOEJsK.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-DoonnYRs.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-CW22OkZ4.js → system-settings-panel-BMDD7FXg.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-BqpGAKxV.js → typed-models-lib-DayamJ56.js} +1 -1
- package/dist/gateway/static/root/assets/use-channel-catalog-ChYwFiqo.js +1 -0
- package/dist/gateway/static/root/assets/{user-profile-settings-panel-CERVLuaW.js → user-profile-settings-panel-Dd0X3mPv.js} +1 -1
- package/dist/gateway/static/root/assets/{utils-BnmysurA.js → utils-D9v9ZpK4.js} +1 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-QXGvjTwa.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-CP-5OUYI.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Ci9GSPnS.js → workflow-run-setup-panel-IidqhbUI.js} +2 -2
- package/dist/gateway/static/root/assets/{workflow-start-dialog-BhDj8pqH.js → workflow-start-dialog-BQQkr8YD.js} +1 -1
- package/dist/gateway/static/root/assets/workflows-page-DtVIjVSX.js +18 -0
- package/dist/gateway/static/root/favicon-16x16.png +0 -0
- package/dist/gateway/static/root/favicon-32x32.png +0 -0
- package/dist/gateway/static/root/favicon-icon.svg +23 -1
- package/dist/gateway/static/root/favicon.ico +0 -0
- package/dist/gateway/static/root/favicon.png +0 -0
- package/dist/gateway/static/root/favicon.svg +20 -24
- package/dist/gateway/static/root/index.html +11 -11
- package/dist/gateway/static/root/logo-dark.svg +18 -23
- package/dist/gateway/static/root/logo.svg +18 -24
- package/dist/gateway/static/root/pwa-192x192.png +0 -0
- package/dist/gateway/static/root/pwa-512x512.png +0 -0
- package/dist/gateway/static/root/site.webmanifest +23 -0
- package/dist/package.js +1 -1
- package/dist/src/cli/commands/gateway/probe.js +6 -6
- package/dist/src/cli/commands/gateway/probe.js.map +1 -1
- package/dist/src/cli/commands/onboard.js +2 -2
- package/dist/src/cli/commands/onboard.js.map +1 -1
- package/dist/src/cli/commands/tui.js +11 -4
- package/dist/src/cli/commands/tui.js.map +1 -1
- package/dist/src/cli/utils/gateway-client-options.d.ts +3 -0
- package/dist/src/cli/utils/gateway-client-options.js +2 -1
- package/dist/src/cli/utils/gateway-client-options.js.map +1 -1
- package/dist/src/cli/utils/gateway-client.d.ts +6 -3
- package/dist/src/cli/utils/gateway-client.js +14 -8
- package/dist/src/cli/utils/gateway-client.js.map +1 -1
- package/dist/src/gateway/credential.d.ts +9 -0
- package/dist/src/gateway/credential.js +16 -0
- package/dist/src/gateway/credential.js.map +1 -0
- package/dist/src/gateway/hono/app.d.ts +0 -1
- package/dist/src/gateway/hono/app.js +2 -9
- package/dist/src/gateway/hono/app.js.map +1 -1
- package/dist/src/gateway/hono/middleware/auth.d.ts +0 -2
- package/dist/src/gateway/hono/middleware/auth.js +46 -21
- package/dist/src/gateway/hono/middleware/auth.js.map +1 -1
- package/dist/src/gateway/hono/routes/sessions.js +2 -27
- package/dist/src/gateway/hono/routes/sessions.js.map +1 -1
- package/dist/src/gateway/server.js +1 -5
- package/dist/src/gateway/server.js.map +1 -1
- package/dist/src/mcp/channel-bridge.d.ts +2 -1
- package/dist/src/mcp/channel-bridge.js +10 -6
- package/dist/src/mcp/channel-bridge.js.map +1 -1
- package/dist/src/mcp/channel-server.d.ts +2 -1
- package/dist/src/mcp/channel-server.js +1 -1
- package/dist/src/mcp/channel-server.js.map +1 -1
- package/dist/src/mcp/gateway-http-client.d.ts +3 -2
- package/dist/src/mcp/gateway-http-client.js +9 -7
- package/dist/src/mcp/gateway-http-client.js.map +1 -1
- package/dist/src/tui/backends/gateway-sse-backend.d.ts +3 -2
- package/dist/src/tui/backends/gateway-sse-backend.js +45 -41
- package/dist/src/tui/backends/gateway-sse-backend.js.map +1 -1
- package/dist/src/tui/tui-types.d.ts +3 -2
- package/dist/src/tui/tui-types.js.map +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/tui/tui.js.map +1 -1
- package/package.json +5 -2
- package/dist/gateway/static/root/assets/agents-CMxKKFQD.js +0 -2
- package/dist/gateway/static/root/assets/app-management-settings-panel-ptk9c5BN.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-DdZvDf5B.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-B8JTjkCr.js +0 -4
- package/dist/gateway/static/root/assets/browser-settings-page-slHLiZgi.js +0 -8
- package/dist/gateway/static/root/assets/capability-presets-api-D4q7vHVJ.js +0 -1
- package/dist/gateway/static/root/assets/channel-recipient-api-BrW5Kcgc.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-KIsISXw0.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-C5fx4Qs9.js +0 -2
- package/dist/gateway/static/root/assets/desktop-pet-Jmdn6q47.js +0 -1
- package/dist/gateway/static/root/assets/dreaming-settings-CCkKP-I4.js +0 -3
- package/dist/gateway/static/root/assets/extension-settings-page-DnhU-tx0.js +0 -1
- package/dist/gateway/static/root/assets/fetch-BMjlW0g1.js +0 -1
- package/dist/gateway/static/root/assets/gateway-config-api-CjxDn46s.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-TING7224.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-DHWVRafk.js +0 -4
- package/dist/gateway/static/root/assets/goals-config-api-BqhuxG8P.js +0 -1
- package/dist/gateway/static/root/assets/goals-page-CMk-9ZYN.js +0 -2
- package/dist/gateway/static/root/assets/goals-settings-BHzOAU_l.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-BQIm0P3V.js +0 -1
- package/dist/gateway/static/root/assets/index-C4k6QSXw.js +0 -257
- package/dist/gateway/static/root/assets/index-EKmpPvZj.css +0 -1
- package/dist/gateway/static/root/assets/logs-page-BiL302Ve.js +0 -2
- package/dist/gateway/static/root/assets/models-hub-panel-CFPpl3Cq.js +0 -2
- package/dist/gateway/static/root/assets/notes-page-BurgcdVZ.js +0 -1
- package/dist/gateway/static/root/assets/notes-workbench-BAELRM_O.js +0 -2
- package/dist/gateway/static/root/assets/project-detail-page-iXX1Ceo2.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-GDVTFAY7.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BUrbUnwv.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-CiOreA2k.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-C-qvptlu.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-xQx2Pkg5.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DWB8VdLK.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-8m_ACH0z.js +0 -2
- package/dist/gateway/static/root/assets/shares-settings-CgxfhNxI.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BBFUOxmf.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-bo695odu.js +0 -2
- package/dist/gateway/static/root/assets/url-DFGNSBNT.js +0 -1
- package/dist/gateway/static/root/assets/use-channel-catalog-CPdJ0o0i.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-Jr3jvPcB.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-B-8rex4u.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-Brb3UGvs.js +0 -18
|
@@ -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{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-Bq4REfIj.js";import{a as o,t as s}from"./fetch-Bl7zMnmd.js";import{n as c}from"./locale-store-Ba72bFmP.js";import{$a as l,Ac as u,Ba as d,Bi as f,Cc as p,Dc as m,Do as h,Eo as g,Ga as _,Gi as v,Ha as y,Hi as b,Ji as x,L as S,Nc as C,Oc as w,Os as T,Qc as E,Qi as D,Ra as O,Sc as k,Ss as A,Tl as j,Ts as M,Ua as N,Ui as P,Uo as F,Va as I,Vi as L,Wa as R,Wi as z,Xc as B,Xi as V,Yi as H,Yo as ee,Ys as te,Zi as ne,_i as re,_n as ie,_t as ae,a as oe,aa as se,at as ce,bs as le,bt as ue,ca as de,ci as fe,co as pe,cs as me,d as he,di as ge,ds as _e,ea as ve,ec as ye,er as be,f as xe,fa as Se,fi as Ce,gi as we,ha as Te,hi as Ee,hl as De,ht as Oe,i as ke,ia as Ae,is as je,ks as Me,l as U,la as Ne,lc as Pe,li as Fe,lo as Ie,mi as Le,mo as Re,mt as ze,na as Be,nl as Ve,o as He,oo as Ue,p as We,pi as Ge,ps as W,qi as Ke,r as qe,ra as Je,s as Ye,so as Xe,st as Ze,ta as Qe,tl as $e,to as et,u as tt,ui as nt,vc as rt,vi as it,vl as at,vn as ot,wl as st,wo as G,ws as ct,xl as lt,y as ut,yc as dt,za as ft,zc as pt,zo as mt,zr as ht,zs as gt}from"./index-DOetFpTt.js";import{t as _t}from"./notes-workbench-eAIE8iKV.js";import{t as vt}from"./page-tabs-Cy7bX7Ce.js";import{t as yt}from"./directory-picker-path-field-BEhDuShd.js";import{t as bt}from"./goals-config-api-h26_-2Vm.js";import{n as xt,t as St}from"./goal-create-dialog-DZ68qzpm.js";import{t as Ct}from"./workflow-start-dialog-BQQkr8YD.js";var K=n(),q=e(t(),1),J=r(),wt=`application/x-xopc-work-item`,Tt=[`backlog`,`todo`,`in_progress`,`blocked`,`needs_input`,`in_review`,`done`],Et=[`low`,`normal`,`high`,`urgent`];function Dt(e){return e===`done`||e===`in_review`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`blocked`||e===`needs_input`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`in_progress`?`bg-accent-soft text-accent-fg`:e===`backlog`||e===`todo`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-muted text-fg-subtle`}function Ot(e){return e?new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(e)):``}function kt(e){return!Number.isFinite(e)||e<=0?`0 B`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(+(e<10*1024))} KB`:`${(e/(1024*1024)).toFixed(+(e<10*1024*1024))} MB`}function Y(e){return`${e.name}:${e.size}:${e.lastModified}`}function At(e,t){return fe(e,t)!==`unsupported`}function jt(e,t){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:t===`image`||t===`audio`||t===`video`?t:`document`}function Mt(e,t){return{id:e.id,name:e.fileName,type:jt(e.mimeType,e.type),mimeType:e.mimeType,size:e.size,...t?{content:t,preview:e.mimeType.startsWith(`image/`)?t:void 0}:{}}}async function Nt(e,t){let n=nt(e.name||`upload`,e.type||`application/octet-stream`),r=de(await e.arrayBuffer());return{id:t,name:e.name||`upload`,type:jt(n),mimeType:n,size:e.size,content:r,preview:n.startsWith(`image/`)?r:void 0}}function Pt(e){let t=(0,K.c)(3),[n,r]=(0,q.useState)(``),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e){r(``);return}let t=URL.createObjectURL(e);return r(t),()=>URL.revokeObjectURL(t)},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,q.useEffect)(i,a),n}function Ft(e,t){let n=(0,K.c)(5),[r,i]=(0,q.useState)(``),a,o;return n[0]!==t.id||n[1]!==t.mimeType||n[2]!==e?(a=()=>{if(!e||!t.mimeType.startsWith(`image/`)){i(``);return}let n=!1,r=``;return(async()=>{let a=await s(We(e,t.id));if(!a.ok||n)return;let o=await a.blob();n||(r=URL.createObjectURL(o),i(r))})().catch(()=>{n||i(``)}),()=>{n=!0,r&&URL.revokeObjectURL(r)}},o=[t.id,t.mimeType,e],n[0]=t.id,n[1]=t.mimeType,n[2]=e,n[3]=a,n[4]=o):(a=n[3],o=n[4]),(0,q.useEffect)(a,o),r}function It(e){let t=(0,K.c)(11),{name:n,mimeType:r,thumbnailUrl:i,previewable:a,disabled:o,onOpen:s}=e,c;t[0]===r?c=t[1]:(c=r.startsWith(`image/`),t[0]=r,t[1]=c);let l=c,u;t[2]!==l||t[3]!==n||t[4]!==i?(u=l&&i?(0,J.jsx)(`img`,{src:i,alt:n,className:`size-10 rounded-md object-cover`}):(0,J.jsx)(`span`,{className:`inline-flex size-10 items-center justify-center rounded-md border border-edge bg-surface-muted`,children:(0,J.jsx)(p,{className:`size-4 text-fg-muted`,"aria-hidden":!0})}),t[2]=l,t[3]=n,t[4]=i,t[5]=u):u=t[5];let d=u;if(!a)return d;let f;return t[6]!==d||t[7]!==o||t[8]!==n||t[9]!==s?(f=(0,J.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel disabled:cursor-wait disabled:opacity-70`,title:n,"aria-label":n,disabled:o,onClick:s,children:d}),t[6]=d,t[7]=o,t[8]=n,t[9]=s,t[10]=f):f=t[10],f}function Lt(e){return e.kind===`chat`?`/chat/${encodeURIComponent(e.targetId)}`:e.kind===`goal`?`/goals/${encodeURIComponent(e.targetId)}`:e.kind===`workflow_run`?`/workflows?run=${encodeURIComponent(e.targetId)}`:e.kind===`automation`?`/automations?automationId=${encodeURIComponent(e.targetId)}`:`#`}function Rt(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}function zt(e,t){return e.nextAction||e.blockedReason||e.description||t.noNextAction}function Bt(e){let t=(0,K.c)(63),{item:n,dragging:r,onOpen:a,onToggleDone:o,onDragStart:s,onDragEnd:c,t:l}=e,u=n.status===`done`,d;t[0]!==n||t[1]!==s?(d=e=>s(n,e),t[0]=n,t[1]=s,t[2]=d):d=t[2];let f=l.dragToUpdate,p=r&&`opacity-50`,h;t[3]===p?h=t[4]:(h=i(`flex min-h-24 w-full min-w-0 max-w-full cursor-grab flex-col overflow-hidden rounded-lg bg-surface-panel px-3 py-3 shadow-surface transition-colors hover:bg-surface-hover active:cursor-grabbing`,p),t[3]=p,t[4]=h);let g=u?`border-success bg-success text-white`:`border-edge bg-surface-base hover:border-accent/50`,_;t[5]===g?_=t[6]:(_=i(`mt-0.5 inline-flex size-3.5 shrink-0 items-center justify-center rounded border transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,g),t[5]=g,t[6]=_);let v=u?l.markTodo:l.markDone,y=u?l.markTodo:l.markDone,b;t[7]!==n||t[8]!==o?(b=()=>o(n),t[7]=n,t[8]=o,t[9]=b):b=t[9];let x;t[10]===u?x=t[11]:(x=u?(0,J.jsx)(B,{className:`size-3`,"aria-hidden":!0}):null,t[10]=u,t[11]=x);let S;t[12]!==x||t[13]!==_||t[14]!==v||t[15]!==y||t[16]!==b?(S=(0,J.jsx)(`button`,{type:`button`,className:_,"aria-label":v,title:y,onClick:b,children:x}),t[12]=x,t[13]=_,t[14]=v,t[15]=y,t[16]=b,t[17]=S):S=t[17];let C;t[18]!==n||t[19]!==a?(C=()=>a(n),t[18]=n,t[19]=a,t[20]=C):C=t[20];let w;t[21]===n.title?w=t[22]:(w=(0,J.jsx)(`h4`,{className:`min-w-0 flex-1 basis-0 text-sm font-medium leading-5 text-fg line-clamp-2`,children:n.title}),t[21]=n.title,t[22]=w);let T;t[23]!==n||t[24]!==l?(T=zt(n,l),t[23]=n,t[24]=l,t[25]=T):T=t[25];let E;t[26]===T?E=t[27]:(E=(0,J.jsx)(`p`,{className:`mt-2 max-w-full break-words text-xs leading-5 text-fg-muted line-clamp-1`,children:T}),t[26]=T,t[27]=E);let D;t[28]!==C||t[29]!==w||t[30]!==E?(D=(0,J.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 text-left`,onClick:C,children:[w,E]}),t[28]=C,t[29]=w,t[30]=E,t[31]=D):D=t[31];let O;t[32]!==S||t[33]!==D?(O=(0,J.jsxs)(`div`,{className:`flex min-w-0 max-w-full items-start gap-2`,children:[S,D]}),t[32]=S,t[33]=D,t[34]=O):O=t[34];let k;t[35]===n.status?k=t[36]:(k=i(`rounded-full px-2 py-0.5 text-[11px] font-medium`,Dt(n.status)),t[35]=n.status,t[36]=k);let A=l.statuses[n.status],j;t[37]!==k||t[38]!==A?(j=(0,J.jsx)(`span`,{className:k,children:A}),t[37]=k,t[38]=A,t[39]=j):j=t[39];let M=l.priorities[n.priority],N;t[40]===M?N=t[41]:(N=(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:M}),t[40]=M,t[41]=N);let P;t[42]===n.attachments?P=t[43]:(P=n.attachments?.length?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:[(0,J.jsx)(Me,{className:`size-3`,"aria-hidden":!0}),n.attachments.length]}):null,t[42]=n.attachments,t[43]=P);let F;t[44]===n.links?F=t[45]:(F=n.links?.length?(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:n.links.length}):null,t[44]=n.links,t[45]=F);let I=`/work-items/${encodeURIComponent(n.id)}`,L;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,J.jsx)(m,{className:`size-3`,"aria-hidden":!0}),t[46]=L):L=t[46];let R;t[47]!==l.detail.openItem||t[48]!==I?(R=(0,J.jsxs)(lt,{to:I,className:`ml-auto inline-flex shrink-0 items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium text-accent hover:bg-accent-soft hover:text-accent-fg`,children:[l.detail.openItem,L]}),t[47]=l.detail.openItem,t[48]=I,t[49]=R):R=t[49];let z;t[50]!==j||t[51]!==N||t[52]!==P||t[53]!==F||t[54]!==R?(z=(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:[j,N,P,F,R]}),t[50]=j,t[51]=N,t[52]=P,t[53]=F,t[54]=R,t[55]=z):z=t[55];let V;return t[56]!==c||t[57]!==l.dragToUpdate||t[58]!==d||t[59]!==O||t[60]!==z||t[61]!==h?(V=(0,J.jsxs)(`article`,{draggable:!0,onDragStart:d,onDragEnd:c,title:f,className:h,children:[O,z]}),t[56]=c,t[57]=l.dragToUpdate,t[58]=d,t[59]=O,t[60]=z,t[61]=h,t[62]=V):V=t[62],V}function Vt(){let e=(0,K.c)(3),t,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`div`,{className:`size-3.5 shrink-0 rounded-full bg-surface-muted`}),(0,J.jsx)(`div`,{className:`h-3 w-36 rounded bg-surface-muted`})]}),n=(0,J.jsx)(`div`,{className:`mt-3 h-3 w-48 rounded bg-surface-muted`}),e[0]=t,e[1]=n):(t=e[0],n=e[1]);let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,J.jsxs)(`article`,{className:`flex h-24 w-full min-w-0 max-w-full flex-col overflow-hidden rounded-lg bg-surface-panel px-3 pt-3 pb-0 shadow-surface`,children:[t,n,(0,J.jsxs)(`div`,{className:`mt-3 flex gap-1.5`,children:[(0,J.jsx)(`div`,{className:`h-5 w-16 rounded-full bg-surface-muted`}),(0,J.jsx)(`div`,{className:`h-5 w-10 rounded-full bg-surface-muted`})]})]}),e[2]=r):r=e[2],r}function Ht(e){let t=(0,K.c)(44),{file:n,index:r,busy:a,previewBusy:o,t:s,onOpen:c,onRemove:l}=e,u,d,f,p;t[0]===n?(u=t[1],d=t[2],f=t[3],p=t[4]):(u=nt(n.name||`upload`,n.type||`application/octet-stream`),d=At(n.name||`upload`,u),f=Pt,p=u.startsWith(`image/`)?n:null,t[0]=n,t[1]=u,t[2]=d,t[3]=f,t[4]=p);let m=f(p),g=n.name||`upload`,_=a||o,v;t[5]!==n||t[6]!==c?(v=()=>c(n),t[5]=n,t[6]=c,t[7]=v):v=t[7];let y;t[8]!==u||t[9]!==d||t[10]!==g||t[11]!==_||t[12]!==v||t[13]!==m?(y=(0,J.jsx)(It,{name:g,mimeType:u,thumbnailUrl:m,previewable:d,disabled:_,onOpen:v}),t[8]=u,t[9]=d,t[10]=g,t[11]=_,t[12]=v,t[13]=m,t[14]=y):y=t[14];let b=d?`rounded-md hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`:`cursor-default`,x;t[15]===b?x=t[16]:(x=i(`min-w-0 flex-1 text-left`,b),t[15]=b,t[16]=x);let S=!d||a||o,C;t[17]!==n||t[18]!==c?(C=()=>c(n),t[17]=n,t[18]=c,t[19]=C):C=t[19];let w=n.name||`upload`,T;t[20]===w?T=t[21]:(T=(0,J.jsx)(`div`,{className:`truncate font-medium text-fg`,children:w}),t[20]=w,t[21]=T);let E;t[22]===n.size?E=t[23]:(E=kt(n.size),t[22]=n.size,t[23]=E);let D;t[24]===E?D=t[25]:(D=(0,J.jsx)(`div`,{className:`text-xs text-fg-subtle`,children:E}),t[24]=E,t[25]=D);let O;t[26]!==C||t[27]!==T||t[28]!==D||t[29]!==x||t[30]!==S?(O=(0,J.jsxs)(`button`,{type:`button`,className:x,disabled:S,onClick:C,children:[T,D]}),t[26]=C,t[27]=T,t[28]=D,t[29]=x,t[30]=S,t[31]=O):O=t[31];let k;t[32]!==r||t[33]!==l?(k=()=>l(r),t[32]=r,t[33]=l,t[34]=k):k=t[34];let A;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,J.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),t[35]=A):A=t[35];let j;t[36]!==a||t[37]!==s.attachments.remove||t[38]!==k?(j=(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:s.attachments.remove,"aria-label":s.attachments.remove,disabled:a,onClick:k,children:A}),t[36]=a,t[37]=s.attachments.remove,t[38]=k,t[39]=j):j=t[39];let M;return t[40]!==O||t[41]!==j||t[42]!==y?(M=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-panel px-2 py-2 text-sm`,children:[y,O,j]}),t[40]=O,t[41]=j,t[42]=y,t[43]=M):M=t[43],M}function Ut(e){let t=(0,K.c)(56),{item:n,attachment:r,busy:a,previewBusy:o,t:s,onOpen:c,onDownload:l,onRemove:d}=e,f;t[0]!==r.fileName||t[1]!==r.mimeType?(f=At(r.fileName,r.mimeType),t[0]=r.fileName,t[1]=r.mimeType,t[2]=f):f=t[2];let p=f,m=Ft(n.id,r),h=a||o,g;t[3]!==r||t[4]!==n||t[5]!==c?(g=()=>c(n,r),t[3]=r,t[4]=n,t[5]=c,t[6]=g):g=t[6];let _;t[7]!==r.fileName||t[8]!==r.mimeType||t[9]!==p||t[10]!==h||t[11]!==g||t[12]!==m?(_=(0,J.jsx)(It,{name:r.fileName,mimeType:r.mimeType,thumbnailUrl:m,previewable:p,disabled:h,onOpen:g}),t[7]=r.fileName,t[8]=r.mimeType,t[9]=p,t[10]=h,t[11]=g,t[12]=m,t[13]=_):_=t[13];let v=p?`rounded-md hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`:`cursor-default`,y;t[14]===v?y=t[15]:(y=i(`min-w-0 flex-1 text-left`,v),t[14]=v,t[15]=y);let b=!p||a||o,x;t[16]!==r||t[17]!==n||t[18]!==c?(x=()=>c(n,r),t[16]=r,t[17]=n,t[18]=c,t[19]=x):x=t[19];let S;t[20]===r.fileName?S=t[21]:(S=(0,J.jsx)(`div`,{className:`truncate font-medium text-fg`,children:r.fileName}),t[20]=r.fileName,t[21]=S);let C=r.mimeType,w;t[22]===r.size?w=t[23]:(w=kt(r.size),t[22]=r.size,t[23]=w);let T;t[24]!==r.mimeType||t[25]!==w?(T=(0,J.jsxs)(`div`,{className:`truncate text-xs text-fg-subtle`,children:[C,` · `,w]}),t[24]=r.mimeType,t[25]=w,t[26]=T):T=t[26];let E;t[27]!==T||t[28]!==y||t[29]!==b||t[30]!==x||t[31]!==S?(E=(0,J.jsxs)(`button`,{type:`button`,className:y,disabled:b,onClick:x,children:[S,T]}),t[27]=T,t[28]=y,t[29]=b,t[30]=x,t[31]=S,t[32]=E):E=t[32];let D;t[33]!==r||t[34]!==n||t[35]!==l?(D=()=>l(n,r),t[33]=r,t[34]=n,t[35]=l,t[36]=D):D=t[36];let O;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,J.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),t[37]=O):O=t[37];let k;t[38]!==a||t[39]!==s.attachments.download||t[40]!==D?(k=(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:s.attachments.download,"aria-label":s.attachments.download,disabled:a,onClick:D,children:O}),t[38]=a,t[39]=s.attachments.download,t[40]=D,t[41]=k):k=t[41];let A;t[42]!==r||t[43]!==n||t[44]!==d?(A=()=>d(n,r),t[42]=r,t[43]=n,t[44]=d,t[45]=A):A=t[45];let j;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,J.jsx)(mt,{className:`size-3.5`,"aria-hidden":!0}),t[46]=j):j=t[46];let M;t[47]!==a||t[48]!==s.attachments.remove||t[49]!==A?(M=(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-danger`,title:s.attachments.remove,"aria-label":s.attachments.remove,disabled:a,onClick:A,children:j}),t[47]=a,t[48]=s.attachments.remove,t[49]=A,t[50]=M):M=t[50];let N;return t[51]!==E||t[52]!==k||t[53]!==M||t[54]!==_?(N=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-panel px-2 py-2 text-sm`,children:[_,E,k,M]}),t[51]=E,t[52]=k,t[53]=M,t[54]=_,t[55]=N):N=t[55],N}function Wt({mode:e,item:t,pendingFiles:n,busy:r,t:a,onPendingFilesChange:c,onUpload:l,onRemove:u,onDownload:d,onPreviewError:f}){let p=(0,q.useRef)(null),[m,h]=(0,q.useState)(!1),[g,_]=(0,q.useState)(!1),[v,y]=(0,q.useState)(null),[b,x]=(0,q.useState)(null),S=o(e=>e.token),C=t?.attachments??[];function w(r){if(!r.length)return;if(e===`detail`&&t){l(t,r);return}let i=new Set(n.map(Y)),a=[...n];for(let e of r){let t=Y(e);i.has(t)||(i.add(t),a.push(e))}c(a)}function T(e){c(n.filter((t,n)=>n!==e))}async function E(e){let t=Y(e);x(`pending:${t}`);try{y(await Nt(e,`pending:${t}`)),_(!0)}catch(e){f(e instanceof Error?e.message:String(e))}finally{x(null)}}async function D(e,t){x(`saved:${t.id}`);try{let n=await s(We(e.id,t.id));if(!n.ok)throw Error(`HTTP ${n.status}`);y(Mt(t,de(await n.arrayBuffer()))),_(!0)}catch(e){f(e instanceof Error?e.message:String(e))}finally{x(null)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{className:i(`grid gap-3 rounded-lg border border-edge bg-surface-base p-3`,m&&`border-accent bg-accent-soft/40`),onDragOver:e=>{e.preventDefault(),h(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||h(!1)},onDrop:e=>{e.preventDefault(),h(!1),w(Array.from(e.dataTransfer.files))},children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`h3`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,J.jsx)(Me,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`truncate`,children:a.attachments.title})]}),(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:r,onClick:()=>p.current?.click(),children:[(0,J.jsx)(le,{className:`size-3.5`,"aria-hidden":!0}),a.attachments.add]}),(0,J.jsx)(`input`,{ref:p,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{w(Array.from(e.target.files??[])),e.currentTarget.value=``}})]}),n.length?(0,J.jsx)(`div`,{className:`grid gap-2`,children:n.map((e,t)=>(0,J.jsx)(Ht,{file:e,index:t,busy:r,previewBusy:b===`pending:${Y(e)}`,t:a,onOpen:e=>void E(e),onRemove:T},Y(e)))}):null,t&&C.length?(0,J.jsx)(`div`,{className:`grid gap-2`,children:C.map(e=>(0,J.jsx)(Ut,{item:t,attachment:e,busy:r,previewBusy:b===`saved:${e.id}`,t:a,onOpen:(e,t)=>void D(e,t),onDownload:d,onRemove:u},e.id))}):null,!n.length&&!C.length?(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a.attachments.empty}):null]}),(0,J.jsx)(ce,{open:g,attachment:v,authToken:S,layerClassName:`z-[100]`,onClose:()=>{_(!1),y(null)}})]})}function Gt(e){let t=(0,K.c)(170),{mode:n,item:r,initialStatus:a,events:o,busy:s,error:c,notice:u,t:f,onClose:p,onCreate:g,onSave:_,onStartChat:v,onCreateGoal:b,onAddAttachments:x,onRemoveAttachment:S,onDownloadAttachment:C,onPreviewError:w}=e,T=n!==null,[E,D]=(0,q.useState)(``),[k,A]=(0,q.useState)(``),[j,M]=(0,q.useState)(`todo`),[P,L]=(0,q.useState)(`normal`),[z,V]=(0,q.useState)(``),[H,ee]=(0,q.useState)(``),te;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(te=[],t[0]=te):te=t[0];let[ne,re]=(0,q.useState)(te),ie,ae;t[1]!==a||t[2]!==r||t[3]!==n?(ie=()=>{if(n===`create`){D(``),A(``),M(a),L(`normal`),V(``),ee(``),re([]);return}n===`detail`&&r&&(D(r.title),A(r.description??``),M(r.status),L(r.priority),V(r.nextAction??``),ee(r.blockedReason??``),re([]))},ae=[a,r,n],t[1]=a,t[2]=r,t[3]=n,t[4]=ie,t[5]=ae):(ie=t[4],ae=t[5]),(0,q.useEffect)(ie,ae);let oe;t[6]!==H||t[7]!==k||t[8]!==r||t[9]!==n||t[10]!==z||t[11]!==g||t[12]!==_||t[13]!==ne||t[14]!==P||t[15]!==j||t[16]!==E?(oe=function(e){e.preventDefault();let t=E.trim();if(t){if(n===`create`){g({title:t,description:k.trim()||void 0,priority:P,status:j,nextAction:z.trim()||void 0,blockedReason:H.trim()||void 0,attachments:ne});return}r&&_(r,{title:t,description:k.trim()||null,status:j,priority:P,nextAction:z.trim()||null,blockedReason:H.trim()||null})}},t[6]=H,t[7]=k,t[8]=r,t[9]=n,t[10]=z,t[11]=g,t[12]=_,t[13]=ne,t[14]=P,t[15]=j,t[16]=E,t[17]=oe):oe=t[17];let se=oe,ce;t[18]===p?ce=t[19]:(ce=e=>!e&&p(),t[18]=p,t[19]=ce);let ue;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[20]=ue):ue=t[20];let de=n===`create`?f.create.title:r?.title||f.title,fe;t[21]===de?fe=t[22]:(fe=(0,J.jsx)(R,{className:`truncate text-base font-semibold text-fg`,children:de}),t[21]=de,t[22]=fe);let pe;t[23]===f.detail.description?pe=t[24]:(pe=(0,J.jsx)(d,{className:`mt-1 text-sm text-fg-muted`,children:f.detail.description}),t[23]=f.detail.description,t[24]=pe);let me;t[25]!==fe||t[26]!==pe?(me=(0,J.jsxs)(`div`,{className:`min-w-0`,children:[fe,pe]}),t[25]=fe,t[26]=pe,t[27]=me):me=t[27];let he;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,J.jsx)(h,{className:`size-4`,"aria-hidden":!0}),t[28]=he):he=t[28];let ge;t[29]===s?ge=t[30]:(ge=(0,J.jsx)(O,{asChild:!0,children:(0,J.jsx)(`button`,{type:`button`,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,disabled:s,children:he})}),t[29]=s,t[30]=ge);let _e;t[31]!==me||t[32]!==ge?(_e=(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[me,ge]}),t[31]=me,t[32]=ge,t[33]=_e):_e=t[33];let ve;t[34]===c?ve=t[35]:(ve=c?(0,J.jsx)(`div`,{className:`rounded-lg border border-danger/30 bg-danger-soft px-3 py-2 text-sm text-danger`,children:c}):null,t[34]=c,t[35]=ve);let ye;t[36]!==c||t[37]!==u?(ye=!c&&u?(0,J.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-success/30 bg-success-soft px-3 py-2 text-sm text-fg`,role:`status`,"aria-live":`polite`,children:[(0,J.jsx)(B,{className:`mt-0.5 size-4 shrink-0 text-success`,"aria-hidden":!0}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`font-medium text-success`,children:u.title}),(0,J.jsx)(`div`,{className:`mt-1 text-fg-muted`,children:u.message})]})]}):null,t[36]=c,t[37]=u,t[38]=ye):ye=t[38];let be;t[39]===f.create.titleLabel?be=t[40]:(be=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:f.create.titleLabel}),t[39]=f.create.titleLabel,t[40]=be);let xe;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(xe=e=>D(e.target.value),t[41]=xe):xe=t[41];let Se=n===`create`,Ce;t[42]!==Se||t[43]!==E?(Ce=(0,J.jsx)(`input`,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:E,onChange:xe,autoFocus:Se}),t[42]=Se,t[43]=E,t[44]=Ce):Ce=t[44];let we;t[45]!==be||t[46]!==Ce?(we=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[be,Ce]}),t[45]=be,t[46]=Ce,t[47]=we):we=t[47];let Te;t[48]===f.detail.status?Te=t[49]:(Te=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:f.detail.status}),t[48]=f.detail.status,t[49]=Te);let Ee;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=e=>M(e.target.value),t[50]=Ee):Ee=t[50];let De;t[51]===f.statuses?De=t[52]:(De=Tt.map(e=>(0,J.jsx)(et,{value:e,children:f.statuses[e]},e)),t[51]=f.statuses,t[52]=De);let Oe;t[53]!==j||t[54]!==De?(Oe=(0,J.jsx)(l,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:j,onChange:Ee,children:De}),t[53]=j,t[54]=De,t[55]=Oe):Oe=t[55];let ke;t[56]!==Te||t[57]!==Oe?(ke=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Te,Oe]}),t[56]=Te,t[57]=Oe,t[58]=ke):ke=t[58];let Ae;t[59]===f.create.priorityLabel?Ae=t[60]:(Ae=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:f.create.priorityLabel}),t[59]=f.create.priorityLabel,t[60]=Ae);let je;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(je=e=>L(e.target.value),t[61]=je):je=t[61];let Me;t[62]===f.priorities?Me=t[63]:(Me=Et.map(e=>(0,J.jsx)(et,{value:e,children:f.priorities[e]},e)),t[62]=f.priorities,t[63]=Me);let U;t[64]!==P||t[65]!==Me?(U=(0,J.jsx)(l,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:P,onChange:je,children:Me}),t[64]=P,t[65]=Me,t[66]=U):U=t[66];let Ne;t[67]!==Ae||t[68]!==U?(Ne=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Ae,U]}),t[67]=Ae,t[68]=U,t[69]=Ne):Ne=t[69];let Pe;t[70]!==ke||t[71]!==Ne?(Pe=(0,J.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[ke,Ne]}),t[70]=ke,t[71]=Ne,t[72]=Pe):Pe=t[72];let Fe;t[73]===f.create.descriptionLabel?Fe=t[74]:(Fe=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:f.create.descriptionLabel}),t[73]=f.create.descriptionLabel,t[74]=Fe);let Ie;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=e=>A(e.target.value),t[75]=Ie):Ie=t[75];let Le;t[76]===k?Le=t[77]:(Le=(0,J.jsx)(`textarea`,{className:`min-h-28 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:k,onChange:Ie}),t[76]=k,t[77]=Le);let Re;t[78]!==Fe||t[79]!==Le?(Re=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Fe,Le]}),t[78]=Fe,t[79]=Le,t[80]=Re):Re=t[80];let ze;t[81]!==s||t[82]!==r||t[83]!==n||t[84]!==x||t[85]!==C||t[86]!==w||t[87]!==S||t[88]!==ne||t[89]!==f?(ze=(0,J.jsx)(Wt,{mode:n,item:r,pendingFiles:ne,busy:s,t:f,onPendingFilesChange:re,onUpload:x,onRemove:S,onDownload:C,onPreviewError:w}),t[81]=s,t[82]=r,t[83]=n,t[84]=x,t[85]=C,t[86]=w,t[87]=S,t[88]=ne,t[89]=f,t[90]=ze):ze=t[90];let Be;t[91]!==H||t[92]!==n||t[93]!==z||t[94]!==j||t[95]!==f.blockedReason||t[96]!==f.nextAction?(Be=n===`detail`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:f.nextAction}),(0,J.jsx)(`textarea`,{className:`min-h-20 rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:z,onChange:e=>V(e.target.value)})]}),(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:i(`font-medium`,j===`blocked`||j===`needs_input`?`text-red-700 dark:text-red-300`:`text-fg-muted`),children:f.blockedReason}),(0,J.jsx)(`textarea`,{className:i(`min-h-20 rounded-lg border bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,j===`blocked`||j===`needs_input`?`border-red-500/40`:`border-edge`),value:H,onChange:e=>ee(e.target.value)})]})]}):null,t[91]=H,t[92]=n,t[93]=z,t[94]=j,t[95]=f.blockedReason,t[96]=f.nextAction,t[97]=Be):Be=t[97];let Ve;t[98]!==ve||t[99]!==ye||t[100]!==we||t[101]!==Pe||t[102]!==Re||t[103]!==ze||t[104]!==Be?(Ve=(0,J.jsxs)(`div`,{className:`grid content-start gap-4`,children:[ve,ye,we,Pe,Re,ze,Be]}),t[98]=ve,t[99]=ye,t[100]=we,t[101]=Pe,t[102]=Re,t[103]=ze,t[104]=Be,t[105]=Ve):Ve=t[105];let He;t[106]!==s||t[107]!==r||t[108]!==n||t[109]!==b||t[110]!==v||t[111]!==f.detail.actions||t[112]!==f.detail.createGoal||t[113]!==f.detail.openItem||t[114]!==f.detail.startChat?(He=n===`detail`&&r?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:f.detail.actions}),(0,J.jsxs)(`div`,{className:`mt-2 grid gap-2`,children:[(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`justify-start rounded-lg`,disabled:s,onClick:()=>v(r),children:[(0,J.jsx)(gt,{className:`size-4`,"aria-hidden":!0}),f.detail.startChat]}),(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`justify-start rounded-lg`,disabled:s,onClick:()=>b(r),children:[(0,J.jsx)(F,{className:`size-4`,"aria-hidden":!0}),f.detail.createGoal]}),(0,J.jsx)(G,{asChild:!0,variant:`secondary`,className:`justify-start rounded-lg`,children:(0,J.jsxs)(lt,{to:`/work-items/${encodeURIComponent(r.id)}`,children:[(0,J.jsx)(m,{className:`size-4`,"aria-hidden":!0}),f.detail.openItem]})})]})]}):null,t[106]=s,t[107]=r,t[108]=n,t[109]=b,t[110]=v,t[111]=f.detail.actions,t[112]=f.detail.createGoal,t[113]=f.detail.openItem,t[114]=f.detail.startChat,t[115]=He):He=t[115];let Ue;t[116]===f.detail.links?Ue=t[117]:(Ue=(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:f.detail.links}),t[116]=f.detail.links,t[117]=Ue);let We;t[118]!==r||t[119]!==f.detail.noLinks||t[120]!==f.linkKinds?(We=r?.links?.length?r.links.slice(0,6).map(e=>(0,J.jsxs)(lt,{to:Lt(e),className:`flex min-w-0 items-center justify-between gap-3 rounded-md px-2 py-1.5 hover:bg-surface-hover`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.title||e.targetId}),(0,J.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[f.linkKinds[e.kind],(0,J.jsx)(m,{className:`size-3.5`,"aria-hidden":!0})]})]},e.id)):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f.detail.noLinks}),t[118]=r,t[119]=f.detail.noLinks,t[120]=f.linkKinds,t[121]=We):We=t[121];let Ge;t[122]===We?Ge=t[123]:(Ge=(0,J.jsx)(`div`,{className:`mt-2 grid gap-2 text-sm`,children:We}),t[122]=We,t[123]=Ge);let W;t[124]!==Ue||t[125]!==Ge?(W=(0,J.jsxs)(`section`,{children:[Ue,Ge]}),t[124]=Ue,t[125]=Ge,t[126]=W):W=t[126];let Ke;t[127]===f.detail.activity?Ke=t[128]:(Ke=(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:f.detail.activity}),t[127]=f.detail.activity,t[128]=Ke);let qe;t[129]!==o||t[130]!==f.detail.noActivity||t[131]!==f.eventTypes?(qe=o.length?o.slice(0,5).map(e=>(0,J.jsxs)(`div`,{className:`text-sm`,children:[(0,J.jsx)(`div`,{className:`font-medium text-fg`,children:f.eventTypes[e.type]??e.type}),(0,J.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-subtle`,children:Ot(e.createdAt)})]},e.id)):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f.detail.noActivity}),t[129]=o,t[130]=f.detail.noActivity,t[131]=f.eventTypes,t[132]=qe):qe=t[132];let Je;t[133]===qe?Je=t[134]:(Je=(0,J.jsx)(`div`,{className:`mt-2 grid gap-2`,children:qe}),t[133]=qe,t[134]=Je);let Ye;t[135]!==Ke||t[136]!==Je?(Ye=(0,J.jsxs)(`section`,{children:[Ke,Je]}),t[135]=Ke,t[136]=Je,t[137]=Ye):Ye=t[137];let Xe;t[138]!==He||t[139]!==W||t[140]!==Ye?(Xe=(0,J.jsxs)(`aside`,{className:`grid content-start gap-5`,children:[He,W,Ye]}),t[138]=He,t[139]=W,t[140]=Ye,t[141]=Xe):Xe=t[141];let Ze;t[142]!==Ve||t[143]!==Xe?(Ze=(0,J.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-6 overflow-y-auto px-5 py-4 lg:grid-cols-[minmax(0,1fr)_16rem]`,children:[Ve,Xe]}),t[142]=Ve,t[143]=Xe,t[144]=Ze):Ze=t[144];let Qe;t[145]!==s||t[146]!==p||t[147]!==f.create.cancel?(Qe=(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:p,disabled:s,children:f.create.cancel}),t[145]=s,t[146]=p,t[147]=f.create.cancel,t[148]=Qe):Qe=t[148];let $e;t[149]!==s||t[150]!==E?($e=s||!E.trim(),t[149]=s,t[150]=E,t[151]=$e):$e=t[151];let tt;t[152]===n?tt=t[153]:(tt=n===`create`?(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0}):null,t[152]=n,t[153]=tt);let nt=n===`create`?f.create.submit:f.detail.save,rt;t[154]!==$e||t[155]!==tt||t[156]!==nt?(rt=(0,J.jsxs)(G,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:$e,children:[tt,nt]}),t[154]=$e,t[155]=tt,t[156]=nt,t[157]=rt):rt=t[157];let it;t[158]!==Qe||t[159]!==rt?(it=(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[Qe,rt]}),t[158]=Qe,t[159]=rt,t[160]=it):it=t[160];let at;t[161]!==se||t[162]!==_e||t[163]!==Ze||t[164]!==it?(at=(0,J.jsxs)(y,{children:[ue,(0,J.jsx)(ft,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(86dvh,48rem)] w-[min(60rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:(0,J.jsxs)(`form`,{onSubmit:se,className:`flex min-h-0 flex-1 flex-col`,children:[_e,Ze,it]})})]}),t[161]=se,t[162]=_e,t[163]=Ze,t[164]=it,t[165]=at):at=t[165];let ot;return t[166]!==T||t[167]!==ce||t[168]!==at?(ot=(0,J.jsx)(N,{open:T,onOpenChange:ce,children:at}),t[166]=T,t[167]=ce,t[168]=at,t[169]=ot):ot=t[169],ot}function Kt({projectId:e,createRequestKey:t=0}){let n=st(),r=a(c(e=>e.language)).projectDetailPage.workItems,o=(0,q.useRef)(null),s=(0,q.useRef)(null),[l,u]=(0,q.useState)([]),[d,f]=(0,q.useState)(!0),[p,m]=(0,q.useState)(null),[h,g]=(0,q.useState)(null),[_,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(null),[x,S]=(0,q.useState)(null),[C,T]=(0,q.useState)(!1),[E,D]=(0,q.useState)(!1),[O,k]=(0,q.useState)(!1),[A,j]=(0,q.useState)(`todo`),[M,N]=(0,q.useState)(null),[P,F]=(0,q.useState)([]),I=(0,q.useCallback)(async(t=`replace`,n=0)=>{f(!0),m(null);try{let r=await Ye(e,{limit:100,offset:n});u(e=>t===`append`?[...e,...r.items]:r.items),D(r.hasMore)}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(!1)}},[e]);(0,q.useEffect)(()=>{I(`replace`,0)},[I]),(0,q.useEffect)(()=>{t&&(N(null),F([]),m(null),g(null),j(`todo`),k(!0))},[t]);let L=(0,q.useMemo)(()=>Tt.map(e=>({status:e,title:r.statuses[e],items:l.filter(t=>t.status===e)})),[l,r.statuses]),R=(0,q.useCallback)(e=>{u(t=>t.map(t=>t.id===e.id?e:t)),N(t=>t?.id===e.id?e:t)},[]),z=(0,q.useCallback)(async(e,t)=>{v(!0),m(null),g(null);try{let n=await tt(e.id,t);n.item.archivedAt?(u(e=>e.filter(e=>e.id!==n.item.id)),N(null)):(R(n.item),g({title:r.feedback.savedTitle,message:r.feedback.savedNext}))}catch(e){m(e instanceof Error?e.message:String(e))}finally{v(!1)}},[r.feedback.savedNext,r.feedback.savedTitle,R]),B=(0,q.useCallback)(async e=>{N(e),F([]),m(null),g(null);let t=await U(e.id).catch(()=>null);t&&F(t.events)},[]),V=(0,q.useCallback)(async t=>{v(!0),m(null),g(null);try{let n=await qe(e,t);u(e=>[n.item,...e]),k(!1),N(n.item),F((await U(n.item.id).catch(()=>({events:[]}))).events),g({title:r.feedback.createdTitle,message:r.feedback.createdNext})}catch(e){m(e instanceof Error?e.message:String(e))}finally{v(!1)}},[e,r.feedback.createdNext,r.feedback.createdTitle]),H=(0,q.useCallback)(async(e,t)=>{if(t.length){v(!0),m(null),g(null);try{let n=await xe(e.id,t);R(n.item),F((await U(n.item.id).catch(()=>({events:[]}))).events)}catch(e){m(e instanceof Error?e.message:String(e))}finally{v(!1)}}},[R]),ee=(0,q.useCallback)(async(e,t)=>{v(!0),m(null),g(null);try{let n=await oe(e.id,t.id);R(n.item),F((await U(n.item.id).catch(()=>({events:[]}))).events)}catch(e){m(e instanceof Error?e.message:String(e))}finally{v(!1)}},[R]),te=(0,q.useCallback)(async(e,t)=>{m(null),g(null);try{await He(e.id,t)}catch(e){m(e instanceof Error?e.message:String(e))}},[]),ne=(0,q.useCallback)(async e=>{v(!0),m(null),g(null);try{let t=await he(e.id);R(t.item),await B(t.item),n(`/chat/${encodeURIComponent(t.session.key)}`)}catch(e){m(e instanceof Error?e.message:String(e))}finally{v(!1)}},[n,B,R]),re=(0,q.useCallback)(async e=>{v(!0),m(null),g(null);try{let t=await ke(e.id);R(t.item),await B(t.item),n(`/goals/${encodeURIComponent(t.goal.id)}`)}catch(e){m(e instanceof Error?e.message:String(e))}finally{v(!1)}},[n,B,R]),ie=(0,q.useCallback)((e,t)=>{t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(wt,e.id),b(e.id)},[]),ae=(0,q.useCallback)((e,t)=>{t.preventDefault();let n=t.dataTransfer.getData(wt)||y;S(null),b(null);let r=l.find(e=>e.id===n);!r||r.status===e||z(r,{status:e})},[y,l,z]),se=(0,q.useCallback)(e=>{z(e,{status:e.status===`done`?`todo`:`done`})},[z]),ce=(0,q.useCallback)(e=>{N(null),F([]),m(null),g(null),j(e),k(!0)},[]),ue=(0,q.useCallback)(e=>{let t=s.current;!t||t.pointerId!==e.pointerId||(s.current=null,T(!1),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),de=(0,q.useCallback)(e=>{if(e.button!==0||y||Rt(e.target))return;let t=o.current;t&&(s.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},[y]),fe=(0,q.useCallback)(e=>{let t=s.current,n=o.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,T(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},[]);return(0,J.jsxs)(`section`,{id:`project-panel-work-items`,role:`tabpanel`,"aria-labelledby":`project-tab-work-items`,className:`flex h-full min-h-0 flex-col`,children:[p?(0,J.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:p}):null,(0,J.jsx)(`section`,{ref:o,className:i(`min-h-0 flex-1 overflow-x-auto rounded-lg px-2 py-2 transition-opacity`,d&&`opacity-60`,C?`cursor-grabbing select-none`:`cursor-grab`),"aria-label":r.boardAria,"aria-busy":d,onPointerDown:de,onPointerMove:fe,onPointerUp:ue,onPointerCancel:ue,onLostPointerCapture:e=>{s.current?.pointerId===e.pointerId&&(s.current=null,T(!1))},children:(0,J.jsx)(`div`,{className:`flex min-h-full min-w-max items-start gap-3 pr-4`,children:L.map(e=>(0,J.jsxs)(`section`,{className:i(`flex max-h-full w-72 min-w-72 max-w-72 shrink-0 flex-col overflow-y-auto rounded-lg bg-surface-base shadow-surface`,x===e.status&&`bg-surface-active`),"aria-label":e.title,onDragOver:t=>{y&&(t.preventDefault(),t.dataTransfer.dropEffect=`move`,S(e.status))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||S(null)},onDrop:t=>ae(e.status,t),children:[(0,J.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-2 px-3 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,J.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.title}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:e.items.length})]}),(0,J.jsx)(w,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]}),(0,J.jsxs)(`div`,{className:`mx-2 mt-3 grid min-h-0 min-w-0 content-start gap-2 pb-2 pr-1 [scrollbar-gutter:stable]`,children:[e.items.length?e.items.map(e=>(0,J.jsx)(Bt,{item:e,dragging:y===e.id,onOpen:B,onToggleDone:se,onDragStart:ie,onDragEnd:()=>{b(null),S(null)},t:r},e.id)):d?(0,J.jsxs)(`div`,{className:`grid gap-2 animate-pulse motion-reduce:animate-none`,children:[(0,J.jsx)(Vt,{}),(0,J.jsx)(Vt,{})]}):(0,J.jsx)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-6 text-center text-xs text-fg-subtle`,children:r.emptyColumn}),d?null:(0,J.jsx)(`button`,{type:`button`,className:`inline-flex h-8 w-full items-center justify-center rounded-lg bg-surface-panel/85 text-fg-muted transition-colors hover:bg-surface-hover 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-muted`,"aria-label":r.create.addToColumn.replace(`{{status}}`,e.title),title:r.create.addToColumn.replace(`{{status}}`,e.title),onClick:()=>ce(e.status),children:(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0})})]})]},e.status))})}),!d&&E?(0,J.jsx)(G,{type:`button`,variant:`secondary`,className:`justify-self-center`,onClick:()=>void I(`append`,l.length),children:r.loadMore}):null,(0,J.jsx)(Gt,{mode:O?`create`:M?`detail`:null,item:M,initialStatus:A,events:P,busy:_,error:p,notice:h,t:r,onClose:()=>{k(!1),N(null),F([]),m(null),g(null)},onCreate:V,onSave:(e,t)=>void z(e,t),onStartChat:ne,onCreateGoal:re,onAddAttachments:(e,t)=>void H(e,t),onRemoveAttachment:(e,t)=>void ee(e,t),onDownloadAttachment:(e,t)=>void te(e,t),onPreviewError:e=>{g(null),m(e)}})]})}var qt=[{id:`overview`,icon:ye},{id:`work-items`,icon:te},{id:`sessions`,icon:gt},{id:`goals`,icon:F},{id:`workflows`,icon:A},{id:`files`,icon:rt},{id:`activity`,icon:Pe},{id:`automations`,icon:g},{id:`notes`,icon:k},{id:`settings`,icon:je}],Jt=qt.map(e=>e.id),Yt=new Set(qt.map(e=>e.id)),Xt=`xopc.projectTabs.`,Zt=`xopc.projectFiles.panelWidthPx`,Qt=320,$t=220,en=560;function tn(e){return Math.min(en,Math.max($t,Math.round(e)))}function nn(){try{let e=window.localStorage.getItem(Zt);if(e==null)return Qt;let t=Number.parseInt(e,10);return Number.isFinite(t)?tn(t):Qt}catch{return Qt}}function rn(e){try{window.localStorage.setItem(Zt,String(tn(e)))}catch{}}function an(e){return!!(e&&Yt.has(e))}function on(e){return`${Xt}${e}`}function sn(e){let t=Array.isArray(e)?e:[],n=new Set,r=[];for(let e of t)!an(e)||n.has(e)||(n.add(e),r.push(e));for(let e of Jt)n.has(e)||r.push(e);return r}function cn(e){if(!e)return Jt;try{let t=window.localStorage.getItem(on(e));return sn(t?JSON.parse(t):null)}catch{return Jt}}function ln(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function un(e,t=``){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?String(e):new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(n)}function dn(e){return e===`active`?`bg-accent-soft text-accent-fg`:e===`done`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`paused`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`archived`?`bg-surface-muted text-fg-subtle`:`bg-surface-hover text-fg-muted`}function fn(e){return e===`succeeded`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`||e===`timeout`||e===`cancelled`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`running`||e===`queued`?`bg-accent-soft text-accent-fg`:`bg-surface-hover text-fg-muted`}function pn(e){let t=(0,K.c)(8),{label:n,hint:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,J.jsx)(`span`,{className:`text-xs leading-5 text-fg-subtle`,children:r}):null,t[2]=r,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[a,i,o]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function mn(e=!1){return i(`w-full rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,e?`min-h-24 py-2 leading-5`:`min-h-10`)}function hn(e){let t=(0,K.c)(10),{label:n,value:r,mono:a}=e,o=a===void 0?!1:a,s;t[0]===n?s=t[1]:(s=(0,J.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=s);let c=o&&`font-mono text-xs`,l;t[2]===c?l=t[3]:(l=i(`mt-1 min-w-0 truncate text-sm text-fg`,c),t[2]=c,t[3]=l);let u;t[4]!==l||t[5]!==r?(u=(0,J.jsx)(`div`,{className:l,title:r,children:r}),t[4]=l,t[5]=r,t[6]=u):u=t[6];let d;return t[7]!==s||t[8]!==u?(d=(0,J.jsxs)(`div`,{className:`min-w-0 rounded-md bg-surface-base px-3 py-2`,children:[s,u]}),t[7]=s,t[8]=u,t[9]=d):d=t[9],d}function X(e){return[e.name,e.slug,e.workspaceRoot,e.description,e.brief].filter(Boolean).join(` `).toLowerCase()}function gn(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function _n(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function vn(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function yn(e){let t=e.actor;return t.name?t.name:t.agentId?t.agentId:t.id?t.id:t.sessionKey?t.sessionKey:t.kind}function bn(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function xn(e){let t=e.source;return t.toolCallId?`${t.kind} · ${t.toolCallId}`:t.runId?`${t.kind} · ${t.runId}`:t.requestId?`${t.kind} · ${t.requestId}`:t.kind}function Sn(e){let t=e.payload.changes;if(Array.isArray(t)&&t.length)return t.filter(e=>typeof e==`string`).join(`, `);let n=e.payload.contentPreview;if(typeof n==`string`&&n.trim())return n.trim();let r=e.payload.title??e.payload.name;return typeof r==`string`&&r.trim()?r.trim():``}function Cn(e){return e.map(e=>({name:e.name,path:e.path,absolutePath:e.absolutePath,isDirectory:e.type===`directory`,children:e.type===`directory`?[]:void 0}))}function wn(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:wn(e.children,t,n)}:e)}function Tn({currentProject:e,pm:t,projectsText:n,wd:r}){let a=st(),[o,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)([e]),[u,f]=(0,q.useState)(``),[p,m]=(0,q.useState)(!1),[h,g]=(0,q.useState)(null),[_,v]=(0,q.useState)(!1),[b,x]=(0,q.useState)(`new`),[S,C]=(0,q.useState)(``),[w,T]=(0,q.useState)(``),[E,k]=(0,q.useState)(!1),[A,j]=(0,q.useState)(null),[M,P]=(0,q.useState)(null),F=(0,q.useCallback)(async()=>{m(!0),g(null);try{let t=await D({limit:100});l(n=>{let r=new Map;r.set(e.id,e);for(let e of n)r.set(e.id,e);for(let e of t.items)r.set(e.id,e);return Array.from(r.values())})}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(!1)}},[e]);(0,q.useEffect)(()=>{l(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,q.useEffect)(()=>{o&&F()},[F,o]);let z=(0,q.useMemo)(()=>{let t=u.trim().toLowerCase().split(/\s+/).filter(Boolean);return c.filter(t=>t.id!==e.id).filter(e=>{if(t.length===0)return!0;let n=X(e);return t.every(e=>n.includes(e))}).sort((e,t)=>gn(t)-gn(e))},[e.id,c,u]),B=e=>t.statuses[e.status]??e.status,V=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,H=e=>{x(e),C(``),T(``),j(null),v(!0),s(!1)},ee=(0,q.useCallback)(async(e={})=>{let t=w.trim(),n=S.trim()||(b===`directory`?_n(t):``);if(n){k(!0),j(null),P(null);try{let r=await L({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});v(!1),C(``),T(``),l(e=>[r,...e.filter(e=>e.id!==r.id)]),a(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=vn(e);t?(P(t),v(!1)):j(e instanceof Error?e.message:String(e))}finally{k(!1)}}},[b,S,a,w]),te=(0,q.useCallback)(e=>{e.preventDefault(),ee()},[ee]),ne=(0,q.useCallback)(()=>{ee({createWorkspaceRoot:!0})},[ee]),re=(0,q.useCallback)(()=>{P(null),v(!0)},[]),ie=e=>{T(e),b===`directory`&&!S.trim()&&C(_n(e))},ae=(e,t)=>(0,J.jsxs)(`button`,{type:`button`,className:i(`grid w-full grid-cols-[1rem_minmax(0,1fr)_auto] items-center gap-2 rounded-md px-2 py-2 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,t&&`bg-accent-soft/55 hover:bg-accent-soft/70`),onClick:()=>{s(!1),t||a(`/projects/${encodeURIComponent(e.id)}`)},children:[(0,J.jsx)(Ve,{className:i(`size-4 text-accent-fg`,!t&&`invisible`),"aria-hidden":!0}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:e.name}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:V(e)})]}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,dn(e.status)),children:B(e)})]},e.id);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(pe,{open:o,onOpenChange:s,children:[(0,J.jsx)(Ie,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`group -ml-2 flex max-w-full min-w-0 items-center gap-2 rounded-lg px-2 py-1 text-left hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":t.projectSwitcher.switchProject,title:t.projectSwitcher.switchProject,children:[(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:e.name}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,dn(e.status)),children:B(e)})]}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:V(e)})]}),(0,J.jsx)($e,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,J.jsx)(Xe,{children:(0,J.jsxs)(Ue,{side:`bottom`,align:`start`,sideOffset:6,className:`z-[70] w-[min(26rem,calc(100vw-2rem))] overflow-hidden rounded-xl border border-edge bg-surface-panel p-1.5 shadow-popover outline-none`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,J.jsxs)(`label`,{className:`relative block`,children:[(0,J.jsx)(me,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`search`,className:`h-9 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:u,onChange:e=>f(e.target.value),placeholder:t.projectSwitcher.searchPlaceholder,"aria-label":t.projectSwitcher.searchPlaceholder})]}),(0,J.jsxs)(`div`,{className:`mt-1 max-h-[min(54vh,24rem)] overflow-y-auto pr-0.5 [scrollbar-gutter:stable]`,children:[(0,J.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.current}),ae(e,!0),(0,J.jsx)(`div`,{className:`px-2 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.projectSwitcher.recent}),h?(0,J.jsx)(`div`,{className:`px-2 py-2 text-xs text-red-600 dark:text-red-400`,children:h}):null,p&&z.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!p&&z.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,z.map(e=>ae(e,!1))]}),(0,J.jsxs)(`div`,{className:`mt-1 border-t border-edge-subtle pt-1`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>H(`new`),children:[(0,J.jsx)(le,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.newProject})]}),(0,J.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>H(`directory`),children:[(0,J.jsx)(rt,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.openDirectory})]}),(0,J.jsxs)(`button`,{type:`button`,className:`flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,onClick:()=>{s(!1),a(`/projects`)},children:[(0,J.jsx)(je,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:t.projectSwitcher.manageProjects})]})]})]})})]}),(0,J.jsx)(N,{open:_,onOpenChange:e=>!E&&v(e),children:(0,J.jsxs)(y,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(ft,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(32rem,calc(100vh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,J.jsx)(R,{className:`text-base font-semibold text-fg`,children:b===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,J.jsx)(d,{className:`mt-1 text-sm text-fg-muted`,children:b===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,J.jsxs)(`form`,{onSubmit:te,className:`flex min-h-0 flex-1 flex-col`,children:[(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[A?(0,J.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:A}):null,(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.projectName}),(0,J.jsx)(`input`,{className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:S,onChange:e=>C(e.target.value),placeholder:`xopc`,autoFocus:!0})]}),(0,J.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:n.workspaceRoot}),(0,J.jsx)(yt,{value:w,onChange:ie,disabled:E,wd:r,placeholder:n.workspacePlaceholder,inputClassName:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`}),(0,J.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.workspaceHint})]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(O,{asChild:!0,children:(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:E,children:n.cancel})}),(0,J.jsxs)(G,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:E||!(S.trim()||b===`directory`&&_n(w)),children:[(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,J.jsx)(N,{open:!!M,onOpenChange:e=>{e||P(null)},children:(0,J.jsxs)(y,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(ft,{className:`fixed left-1/2 top-1/2 z-[110] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,J.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,J.jsx)(R,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,J.jsx)(d,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:M?ln(n.workspaceMissingDescription,{workspace:M}):null})]}),M?(0,J.jsx)(`div`,{className:`px-5 py-4`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,J.jsx)(rt,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:M})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:re,disabled:E,children:n.workspaceMissingBack}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:ne,disabled:E,children:[(0,J.jsx)(dt,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function En(){let{projectId:e=``,tabId:t,noteId:n}=j(),r=st(),o=c(e=>e.language),s=a(o),u=s.chat.workingDirectory,p=s.projectDetailPage,m=s.projectsPage,w=_(e=>e.setPageHeader),D=_(e=>e.clearPageHeader),[F,L]=(0,q.useState)(null),[B,te]=(0,q.useState)(null),[oe,ce]=(0,q.useState)([]),[de,pe]=(0,q.useState)(``),[he,ye]=(0,q.useState)([]),[xe,ke]=(0,q.useState)([]),[je,Me]=(0,q.useState)([]),[U,Pe]=(0,q.useState)([]),[Ie,Ve]=(0,q.useState)([]),[He,Ue]=(0,q.useState)(!1),[We,qe]=(0,q.useState)(null),[Ye,Xe]=(0,q.useState)([]),[$e,tt]=(0,q.useState)(0),[nt,K]=(0,q.useState)(!1),[wt,Tt]=(0,q.useState)(!1),[Et,Dt]=(0,q.useState)(!1),[Ot,kt]=(0,q.useState)([]),Y=(0,q.useRef)(new Set),[At,jt]=(0,q.useState)(null),[Mt,Nt]=(0,q.useState)(nn),[Pt,Ft]=(0,q.useState)(!1),[It,Lt]=(0,q.useState)(!1),[Rt,zt]=(0,q.useState)(``),[Bt,Vt]=(0,q.useState)([]),[Ht,Ut]=(0,q.useState)(!1),[Wt,Gt]=(0,q.useState)(null),[Yt,Xt]=(0,q.useState)(!1),[Zt,Qt]=(0,q.useState)(null),[$t,en]=(0,q.useState)([]),[X,gn]=(0,q.useState)(``),[_n,En]=(0,q.useState)(!0),[Dn,On]=(0,q.useState)(!1),[kn,An]=(0,q.useState)(!1),[jn,Mn]=(0,q.useState)(null),[Nn,Pn]=(0,q.useState)(!1),[Fn,In]=(0,q.useState)(`fixed`),[Ln,Rn]=(0,q.useState)(``),[zn,Bn]=(0,q.useState)(null),[Vn,Hn]=(0,q.useState)(!1),[Un,Wn]=(0,q.useState)(!1),[Gn,Kn]=(0,q.useState)(0),[qn,Jn]=(0,q.useState)(!1),[Yn,Xn]=(0,q.useState)(!1),[Zn,Qn]=(0,q.useState)(null),[$n,er]=(0,q.useState)(null),[tr,nr]=(0,q.useState)(!1),[rr,ir]=(0,q.useState)(!1),[ar,or]=(0,q.useState)(!1),[sr,Z]=(0,q.useState)(null),[cr,lr]=(0,q.useState)({defaultAgentId:``,agents:[],models:[],checklistDecomposePolicy:`empty_only`}),[ur,dr]=(0,q.useState)({title:``,reason:``}),[fr,pr]=(0,q.useState)(()=>cn(e)),[Q,mr]=(0,q.useState)({name:``,description:``,status:`active`,defaultAgentId:``,workspaceRoot:``,brief:``,instructions:``}),hr=fr[0]??Jt[0],$=n?`notes`:an(t)?t:hr,gr=(0,q.useCallback)(t=>{e&&r(`/projects/${encodeURIComponent(e)}/${t}`)},[r,e]),_r=(0,q.useCallback)(t=>e?`/projects/${encodeURIComponent(e)}/${t}`:`/projects`,[e]),vr=(0,q.useCallback)(e=>{let t=_r(`goals`);return`/goals/${encodeURIComponent(e)}?returnTo=${encodeURIComponent(t)}`},[_r]),yr=(0,q.useCallback)(t=>{e&&r(_r(t),{replace:!0})},[r,e,_r]),br=(0,q.useCallback)((e,t)=>{yr(e),r(t)},[r,yr]),xr=(0,q.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||yr(e)},[yr]),Sr=(0,q.useCallback)(e=>e.startsWith(`/goals/`)?`goals`:e.startsWith(`/chat/`)?`sessions`:e.startsWith(`/workflows`)?`workflows`:e.startsWith(`/automations`)?`automations`:e.startsWith(`/notes`)?`notes`:$,[$]);(0,q.useEffect)(()=>{!e||!t||an(t)||r(`/projects/${encodeURIComponent(e)}/${hr}`,{replace:!0})},[hr,r,e,t]),(0,q.useEffect)(()=>{pr(cn(e))},[e]);let Cr=(0,q.useCallback)((t,n,r=`before`)=>{t!==n&&pr(i=>{let a=sn(i),o=a.indexOf(t),s=a.indexOf(n);if(o<0||s<0)return a;let[c]=a.splice(o,1),l=a.indexOf(n);return l<0?sn(i):(a.splice(r===`after`?l+1:l,0,c),e&&window.localStorage.setItem(on(e),JSON.stringify(a)),a)})},[e]);(0,q.useEffect)(()=>{if(!e)return;let t=!1;return En(!0),Z(null),Promise.all([V(e),ne(e),H(e),be().catch(()=>null)]).then(([e,n,r,i])=>{if(t)return;let a=e.project;L(a),te(e),ce(n),ye(r),en(i?.agents??[]),gn(a.defaultAgentId??``),mr({name:a.name,description:a.description??``,status:a.status,defaultAgentId:a.defaultAgentId??``,workspaceRoot:a.workspaceRoot??``,brief:a.brief??``,instructions:a.instructions??``})}).catch(e=>{t||Z(e instanceof Error?e.message:String(e))}).finally(()=>{t||En(!1)}),()=>{t=!0}},[e]),(0,q.useEffect)(()=>{let e=!1;async function t(){let[t,n,r]=await Promise.allSettled([be(),ie(),Se()]);e||lr(e=>{let i=t.status===`fulfilled`?t.value.defaultId:e.defaultAgentId,a=F?.defaultAgentId||X||i,o=t.status===`fulfilled`?t.value.agents:e.agents,s=n.status===`fulfilled`?n.value:e.models,c=r.status===`fulfilled`?bt(r.value.payload?.config).checklistDecomposePolicy:e.checklistDecomposePolicy;return{defaultAgentId:a,agents:o.length?o:[{id:a||`main`,workspace:``,profileDir:``,typedModels:{defaultRole:`deep`,preset:[],effective:[]},extends:[],isDefault:!0,skills:{preset:[]},tools:{presetDenied:[],entryDisable:[],effectiveDisable:[]}}],models:s,checklistDecomposePolicy:c}})}return t(),()=>{e=!0}},[F?.defaultAgentId,X]);let wr=(0,q.useCallback)(async()=>{if(F){Jn(!0),Z(null);try{let[e,t]=await Promise.all([ze(),Oe(100,{ownerAgentId:X||void 0,projectId:F.id})]);ke(e),Me(t)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Jn(!1)}}},[F,X]);(0,q.useEffect)(()=>{F&&wr()},[F,wr]);let Tr=(0,q.useCallback)(async()=>{if(F){Ue(!0),Z(null);try{let[e,t]=await Promise.all([ut.list({projectId:F.id}),ut.runs(50,void 0,{projectId:F.id})]);Pe(e.automations),Ve(t.runs)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Ue(!1)}}},[F]);(0,q.useEffect)(()=>{$===`automations`&&Tr()},[Tr,$]);let Er=(0,q.useCallback)(async()=>{if(F){K(!0),Z(null);try{let e=await Ke(F.id,{includeRelated:wt,limit:100});Xe(e.items),tt(e.total)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{K(!1)}}},[F,wt]);(0,q.useEffect)(()=>{$===`activity`&&Er()},[Er,$]);let Dr=(0,q.useCallback)(async e=>{qe(`run:${e.id}`),Z(null);try{await ut.runNow(e.id),await Tr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{qe(null)}},[Tr]),Or=(0,q.useCallback)(async e=>{qe(`toggle:${e.id}`),Z(null);try{e.enabled?await ut.pause(e.id):await ut.resume(e.id),await Tr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{qe(null)}},[Tr]),kr=(0,q.useCallback)(async()=>{if(!F?.effectiveWorkspaceRoot?.trim()){kt([]),Y.current.clear(),Qt(null);return}Xt(!0),Qt(null),Y.current.clear();try{kt(Cn((await x(F.id,``)).entries)),Y.current.add(``)}catch(e){kt([]),Y.current.clear(),Qt(e instanceof Error?e.message:String(e))}finally{Xt(!1)}},[F]),Ar=(0,q.useCallback)(async e=>{if(!(!F?.effectiveWorkspaceRoot?.trim()||Y.current.has(e))){Y.current.add(e),Qt(null);try{let t=await x(F.id,e);kt(n=>wn(n,e,Cn(t.entries)))}catch(t){Y.current.delete(e),Qt(t instanceof Error?t.message:String(t))}}},[F]);(0,q.useEffect)(()=>{$===`files`&&kr()},[kr,$]);let jr=Rt.trim();(0,q.useEffect)(()=>{if($!==`files`||!F||!It||!jr){Vt([]),Ut(!1),Gt(null);return}let e=!1;Ut(!0),Gt(null),Vt([]);let t=window.setTimeout(()=>{Je(F.id,jr,50).then(t=>{e||Vt(t)}).catch(t=>{e||Gt(t instanceof Error?t.message:String(t))}).finally(()=>{e||Ut(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[jr,F,It,$]);let Mr=(0,q.useCallback)(async()=>{if(F){Wn(!0),Z(null);try{let e=await z(F.id);br(`sessions`,`/chat/${encodeURIComponent(e.key)}`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Wn(!1)}}},[br,F]),Nr=(0,q.useCallback)(()=>{gr(`work-items`),Kn(e=>e+1)},[gr]),Pr=(0,q.useCallback)(async()=>{if(!F)return;let[e,t]=await Promise.all([V(F.id),H(F.id)]);te(e),L(e.project),ye(t)},[F]),Fr=(0,q.useCallback)(async e=>{if(!F||!e.title.trim())return;let t=Number.parseInt(e.maxTurns,10),n=e.deadline?new Date(e.deadline).getTime():void 0;nr(!0),Z(null);try{await P(F.id,{title:e.title.trim(),description:e.description.trim()||void 0,attachments:e.attachments.length?e.attachments:void 0,priority:e.priority,deadlineAt:Number.isFinite(n)?n:void 0,maxTurns:Number.isFinite(t)?t:void 0,agentId:e.agentId.trim()||void 0,judgeModelRef:e.judgeModelRef.trim()||void 0,contract:{objective:e.objective.trim()||e.title.trim(),scopeBoundary:e.scopeBoundary.trim()||void 0,evidencePlan:xt(e.evidencePlan),criteria:xt(e.checklist)}}),or(!1),gr(`goals`),await Pr()}catch(e){throw Z(e instanceof Error?e.message:String(e)),e}finally{nr(!1)}},[gr,F,Pr]),Ir=(0,q.useCallback)(async e=>{if(e.preventDefault(),!(!F||!ur.title.trim())){ir(!0),Z(null);try{await b(F.id,{title:ur.title.trim(),reason:ur.reason.trim()||void 0}),dr({title:``,reason:``}),await Pr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{ir(!1)}}},[ur.reason,ur.title,F,Pr]),Lr=(0,q.useCallback)(async e=>{if(!(!F||!$n)){Xn(!0),Z(null);try{let t=X||F.defaultAgentId||void 0,n=await ue({definitionId:$n.id,projectId:F.id,agentId:t,goal:e.goal,input:e.input,concurrency:e.concurrency,maxSubagents:e.maxSubagents});er(null),await wr(),br(`workflows`,S(n.runId,{ownerAgentId:t}))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Xn(!1)}}},[br,F,wr,X,$n]),Rr=(0,q.useCallback)(async e=>{if(F){Qn(`retry:${e.id}`),Z(null);try{let t=await ae(e.id,{ownerAgentId:X||e.metadata?.agentId,projectId:e.metadata?.projectId||F.id});await wr(),br(`workflows`,S(t.runId,{ownerAgentId:X||e.metadata?.agentId||F.defaultAgentId}))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Qn(null)}}},[br,F,wr,X]),zr=(0,q.useCallback)(async e=>{Qn(`cancel:${e.id}`),Z(null);try{await Ze(e.id,{ownerAgentId:X||e.metadata?.agentId}),await wr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Qn(null)}},[wr,X]),Br=(0,q.useMemo)(()=>(0,J.jsx)(lt,{to:`/projects`,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":p.backToProjects,children:(0,J.jsx)(De,{className:`size-4`,"aria-hidden":!0})}),[p.backToProjects]),Vr=(0,q.useMemo)(()=>F?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(G,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:Nr,children:[(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0}),p.workItems.create.header]}),(0,J.jsxs)(G,{variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>void Mr(),disabled:Un,children:[(0,J.jsx)(gt,{className:`size-4`,"aria-hidden":!0}),p.common.newChat]})]}):null,[Nr,p.common.newChat,p.workItems.create.header,F,Mr,Un]);(0,q.useLayoutEffect)(()=>(w({startExtra:Br,main:F?(0,J.jsx)(Tn,{currentProject:F,pm:p,projectsText:m,wd:u}):(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:p.fallbackTitle}),(0,J.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:p.fallbackContext})]}),end:Vr}),()=>D()),[D,Vr,Br,p,F,m,w,u]);function Hr(e){L(t=>t?{...t,...e}:null),te(t=>t?{...t,project:{...t.project,...e}}:null),gn(e.defaultAgentId??``),mr(t=>({...t,name:e.name,description:e.description??``,status:e.status,defaultAgentId:e.defaultAgentId??``,workspaceRoot:e.workspaceRoot??``,brief:e.brief??``,instructions:e.instructions??``})),window.dispatchEvent(new CustomEvent(`project-updated`,{detail:{id:e.id}}))}async function Ur(){if(!(!F||!Q.name.trim())){On(!0),Z(null),Mn(null);try{Hr(await se(F.id,{name:Q.name.trim(),status:Q.status,description:Q.description,defaultAgentId:Q.defaultAgentId,brief:Q.brief,instructions:Q.instructions}))}catch(e){let t=vn(e);t?Mn(t):Z(e instanceof Error?e.message:String(e))}finally{On(!1)}}}function Wr(e){e.preventDefault(),Ur()}let Gr=(0,q.useCallback)(()=>{if(!F)return;let e=F.workspaceRoot?.trim()??``;In(e?`fixed`:`follow`),Rn(e||F.effectiveWorkspaceRoot||``),Pn(!0)},[F]);async function Kr(e={}){if(!F)return;let t=Fn===`fixed`?Ln.trim():``;if(!(Fn===`fixed`&&!t)){On(!0),Z(null),Mn(null);try{Hr(await se(F.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}})),Pn(!1),Mn(null)}catch(e){let t=vn(e);t?(Mn(t),Pn(!1)):Z(e instanceof Error?e.message:String(e))}finally{On(!1)}}}async function qr(){if(!(!F||zn)){Bn(`pin`),Z(null);try{Hr(F.pinnedAt?await Ae(F.id):await ve(F.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Bn(null)}}}async function Jr(){if(!(!F||zn)){Bn(`archive`),Z(null);try{Hr(F.status===`archived`?await Qe(F.id):await f(F.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Bn(null)}}}async function Yr(){if(F){Hn(!0),Z(null);try{await v(F.id),An(!1),r(`/projects`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Hn(!1)}}}async function Xr(){if(!(!F||Et)){Dt(!0),Z(null);try{await Be(F.id)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Dt(!1)}}}let Zr=(0,q.useCallback)(e=>{jt(e)},[]),Qr=(0,q.useCallback)((e,t)=>{t||jt(e)},[]),$r=(0,q.useCallback)(async(e,t,n)=>{let r=F?.id;if(r)switch(e){case`preview`:t.isDirectory||jt(t.path);break;case`download`:if(t.isDirectory)return;try{let e=Fe(t.path);if(ge(fe(e))!==`text`){let n=await Le(t.path,{projectId:r}),i=Ne(e)??`application/octet-stream`;Ce(e,await n.arrayBuffer(),i)}else{let{content:n}=await Ee(t.path,{projectId:r});Ge(e,n)}}catch(e){it(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await Re(t.absolutePath??t.path)&&it(`success`,s.workspace.pathCopied,void 0,{duration:2500})}catch{it(`warning`,s.clipboard.copyFailed,void 0,{duration:4e3})}break;case`openDefault`:if(!t.absolutePath||!window.electronAPI?.shell?.openPath)return;await window.electronAPI.shell.openPath(t.absolutePath);break;case`openWith`:if(!t.absolutePath||!window.electronAPI?.shell?.chooseAppAndOpenPath)return;await window.electronAPI.shell.chooseAppAndOpenPath(t.absolutePath);break;case`openWithApp`:if(!t.absolutePath||!n||!window.electronAPI?.shell?.openPathWithApp)return;await window.electronAPI.shell.openPathWithApp(t.absolutePath,n);break;case`revealInFolder`:if(!t.absolutePath||!window.electronAPI?.shell?.showItemInFolder)return;await window.electronAPI.shell.showItemInFolder(t.absolutePath);break;default:break}},[s.clipboard.copyFailed,s.workspace.pathCopied,F?.id]),ei=(0,q.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;e.preventDefault();let t=e.currentTarget,n=t.closest(`[data-project-files-grid]`);if(!n)return;t.setPointerCapture(e.pointerId),Ft(!0);let r=e.clientX,i=Mt,a=e.pointerId,o=0,s=i,c=i,l=()=>{o=0,c=s,n.style.setProperty(`--project-files-panel-width`,`${c}px`)},u=e=>{s=tn(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}Ft(!1),Nt(c),rn(c),window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d),window.removeEventListener(`pointercancel`,d)};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d),window.addEventListener(`pointercancel`,d)},[Mt]);if((0,q.useEffect)(()=>{$!==`files`&&jt(null)},[e,$]),_n)return(0,J.jsx)(`main`,{className:`w-full flex-1 px-3 py-3 text-sm text-fg-muted sm:px-5 sm:py-4 xl:px-6`,children:p.loading});if(!F)return(0,J.jsxs)(`main`,{className:`w-full flex-1 px-3 py-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,J.jsxs)(lt,{to:`/projects`,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,J.jsx)(De,{className:`size-4`,"aria-hidden":!0}),p.backToProjects]}),(0,J.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:sr||p.notFound})]});let ti=B?.recentSessions.length?B.recentSessions:F.recentSessions,ni=B?.attentionItems??[],ri=e=>p.statuses[e]??e,ii=e=>ln(p.common.messages,{count:e}),ai=de.trim().toLowerCase(),oi=ai?oe.filter(e=>{let t=un(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=e.name?.trim()||p.sessions.fallbackTitle,i=ii(e.messageCount??0);return[r,e.key,n,t,i].filter(Boolean).join(` `).toLowerCase().includes(ai)}):oe,si=oe.length>0&&oi.length===0,ci=$t.find(e=>e.id===Q.defaultAgentId)?.name||Q.defaultAgentId||p.settings.globalDefaultAgent,li=$t.find(e=>e.id===Q.defaultAgentId),ui=F.workspaceRoot?.trim()||``,di=F.status===`archived`,fi=!!F.pinnedAt,pi=!ui,mi=ui||li?.workspace||F.effectiveWorkspaceRoot||p.common.defaultWorkspace,hi=Fn===`fixed`?Ln.trim()||p.settings.workspacePlaceholder:li?.workspace||F.effectiveWorkspaceRoot||p.common.defaultWorkspace,gi=(Fn===`fixed`?Ln.trim():``)!==ui&&(Fn===`follow`||!!Ln.trim()),_i=fr.map(e=>{let t=qt.find(t=>t.id===e);return{...t,label:t.id===`work-items`?p.workItems.tab:p.tabs[t.id]}});async function vi(){if(!mi)return;let e=await Re(mi);it(e?`success`:`warning`,e?s.workspace.pathCopied:s.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function yi(){Mn(null),Pn(!0)}return(0,J.jsxs)(`main`,{className:`flex h-full min-h-0 w-full flex-1 flex-col overflow-hidden px-3 py-3 sm:px-5 sm:py-4 xl:px-6`,children:[(0,J.jsx)(vt,{items:_i,activeTab:$,onChange:gr,onReorder:Cr,ariaLabel:p.navAria,tabIdPrefix:`project-tab`,panelIdPrefix:`project-panel`,className:`shrink-0`}),sr?(0,J.jsx)(`p`,{className:`mt-3 shrink-0 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:sr}):null,(0,J.jsxs)(`div`,{className:i(`mt-3 min-h-0 flex-1`,$===`work-items`?`-mx-3 -mb-3 overflow-hidden sm:-mx-5 sm:-mb-4 xl:-mx-6`:$===`overview`?`overflow-y-auto pr-1 [scrollbar-gutter:stable] xl:overflow-hidden xl:pr-0`:`overflow-y-auto pr-1 [scrollbar-gutter:stable]`),children:[$===`overview`?(0,J.jsxs)(`section`,{id:`project-panel-overview`,role:`tabpanel`,"aria-labelledby":`project-tab-overview`,className:`grid min-h-full gap-4 xl:h-full xl:min-h-0 xl:grid-cols-[minmax(0,1fr)_20rem] xl:overflow-hidden`,children:[(0,J.jsxs)(`div`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,J.jsx)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.directionTitle}),(0,J.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:B?.digest?.summary||B?.recommendedAction||F.description||F.brief||p.overview.directionFallback}),B?.digest?.nextAction?(0,J.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:ln(p.overview.recommendedNext,{action:B.digest.nextAction})}):null]}),(0,J.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,J.jsxs)(G,{type:`button`,variant:`secondary`,onClick:()=>void Xr(),disabled:Et,children:[(0,J.jsx)(_e,{className:`size-4`,"aria-hidden":!0}),Et?p.overview.savingDigest:p.overview.saveDigest]})})]})}),(0,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.nextActions}),(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,onClick:()=>or(!0),children:[(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0}),p.overview.goal]})]}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:B?.nextActions.length?B.nextActions.map(e=>(0,J.jsxs)(lt,{to:vr(e.goalId),onClick:xr(`goals`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,dn(e.status)),children:ri(e.status)})]}),(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.nextAction})]},e.goalId)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noNextActions})})]})]}),(0,J.jsxs)(`aside`,{className:`grid min-w-0 content-start gap-4 xl:min-h-0 xl:overflow-y-auto xl:pr-1 xl:[scrollbar-gutter:stable]`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.overview.attention}),ni.length?(0,J.jsx)(`div`,{className:`mt-3 grid gap-3`,children:ni.map(e=>{let t=(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(E,{className:`size-4 text-amber-600 dark:text-amber-300`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title})]}),(0,J.jsxs)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:[p.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${ri(e.status)}`:``]})]});return e.href?(0,J.jsx)(lt,{to:e.href,onClick:xr(Sr(e.href)),className:`min-w-0 rounded-md bg-surface-base p-3 hover:bg-surface-hover`,children:t},e.id):(0,J.jsx)(`div`,{className:`min-w-0 rounded-md bg-surface-base p-3`,children:t},e.id)})}):(0,J.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:p.overview.noBlockedGoals}),(0,J.jsxs)(`form`,{onSubmit:Ir,className:`mt-4 flex gap-2 border-t border-edge pt-4`,children:[(0,J.jsx)(`input`,{className:`min-h-9 min-w-0 flex-1 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:ur.title,onChange:e=>dr(t=>({...t,title:e.target.value})),placeholder:p.overview.blockerTitlePlaceholder}),(0,J.jsx)(G,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:rr||!ur.title.trim(),"aria-label":rr?p.overview.addingBlocker:p.overview.addBlocker,title:rr?p.overview.addingBlocker:p.overview.addBlocker,children:(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0})})]})]}),(0,J.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(pt,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`h2`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:p.overview.recentSessions})]}),(0,J.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>gr(`sessions`),children:p.common.viewAll})]}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:ti.length?ti.map(e=>(0,J.jsxs)(lt,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:xr(`sessions`),className:`block px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.name||e.key}),(0,J.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:un(e.updatedAt)})]}),(0,J.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.agentId||p.common.agent})]},e.key)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.overview.noSessions})})]})]})]}):null,$===`work-items`?(0,J.jsx)(Kt,{projectId:F.id,createRequestKey:Gn}):null,$===`workflows`?(0,J.jsxs)(`section`,{id:`project-panel-workflows`,role:`tabpanel`,"aria-labelledby":`project-tab-workflows`,className:`grid h-full min-h-[28rem] gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,J.jsx)(`div`,{className:`min-h-0`,children:(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.workflows.runsTitle}),(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p.workflows.runsHint})]}),(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>void wr(),disabled:qn,children:[(0,J.jsx)(W,{className:`size-4`,"aria-hidden":!0}),p.common.refresh]})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 divide-y divide-edge overflow-y-auto`,children:qn&&je.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.workflows.loadingRuns}):je.length?je.map(e=>{let t=e.status===`queued`||e.status===`running`,n=e.status===`failed`||e.status===`timeout`||e.status===`cancelled`;return(0,J.jsxs)(`div`,{className:`grid gap-2 px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`button`,{type:`button`,className:`min-w-0 truncate text-left text-sm font-medium text-fg hover:text-accent-fg`,onClick:()=>br(`workflows`,S(e.id,{ownerAgentId:X||e.metadata?.agentId||F.defaultAgentId})),children:e.title||e.definitionId}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,fn(e.status)),children:ri(e.status)})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:ln(p.workflows.runMeta,{definitionId:e.definitionId,done:e.metrics.doneAgentCount,total:e.metrics.agentCount,time:un(e.createdAtMs)})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,onClick:()=>br(`workflows`,S(e.id,{ownerAgentId:X||e.metadata?.agentId||F.defaultAgentId})),children:p.common.open}),n?(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:Zn===`retry:${e.id}`,onClick:()=>void Rr(e),children:[(0,J.jsx)(W,{className:`size-3.5`,"aria-hidden":!0}),p.common.retry]}):null,t?(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:Zn===`cancel:${e.id}`,onClick:()=>void zr(e),children:[(0,J.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),p.common.cancel]}):null]})]})]},e.id)}):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.workflows.emptyRuns})})]})}),(0,J.jsx)(`aside`,{className:`min-h-0`,children:(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-4 py-3`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.workflows.startTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:p.workflows.startHint})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:(0,J.jsx)(`div`,{className:`grid gap-2`,children:xe.length?xe.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:`grid gap-1 rounded-md bg-surface-base p-3 text-left hover:bg-surface-hover focus:outline-none focus:ring-2 focus:ring-accent/30`,onClick:()=>er(e),children:[(0,J.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,J.jsx)(A,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title})]}),(0,J.jsx)(`span`,{className:`line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description||e.metadata.whenToUse||e.name})]},e.id)):(0,J.jsx)(`div`,{className:`px-1 py-3 text-sm text-fg-muted`,children:p.workflows.emptyDefinitions})})})]})})]}):null,$===`automations`?(0,J.jsxs)(`section`,{id:`project-panel-automations`,role:`tabpanel`,"aria-labelledby":`project-tab-automations`,className:`grid h-full min-h-[28rem] overflow-hidden gap-4 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,J.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.automations.title}),(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p.automations.hint})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>void Tr(),disabled:He,children:[(0,J.jsx)(W,{className:`size-4`,"aria-hidden":!0}),p.common.refresh]}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>br(`automations`,`/automations?projectId=${encodeURIComponent(F.id)}&action=create`),children:[(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0}),p.common.new]})]})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 divide-y divide-edge overflow-y-auto`,children:He&&U.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.automations.loading}):U.length?U.map(e=>{let t=Ie.find(t=>t.automationId===e.id),n=e.state.runningRunId?Ie.find(t=>t.id===e.state.runningRunId):null;return(0,J.jsxs)(`div`,{className:`grid gap-2 px-4 py-3 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`button`,{type:`button`,className:`min-w-0 truncate text-left text-sm font-medium text-fg hover:text-accent-fg`,onClick:()=>br(`automations`,`/automations?automation=${encodeURIComponent(e.id)}`),children:e.name}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,e.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`),children:e.enabled?p.automations.enabled:p.automations.paused})]}),(0,J.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:e.description||e.action.kind}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:ln(p.common.lastRun,{trigger:e.trigger.kind,action:e.action.kind,time:t?un(t.createdAtMs):p.common.never})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:We===`run:${e.id}`||!!n,onClick:()=>void Dr(e),children:[(0,J.jsx)(A,{className:`size-3.5`,"aria-hidden":!0}),p.automations.run]}),(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:We===`toggle:${e.id}`,onClick:()=>void Or(e),children:[e.enabled?(0,J.jsx)(T,{className:`size-3.5`,"aria-hidden":!0}):(0,J.jsx)(A,{className:`size-3.5`,"aria-hidden":!0}),e.enabled?p.automations.pause:p.automations.resume]})]})]})]},e.id)}):(0,J.jsxs)(`div`,{className:`grid gap-3 px-4 py-6 text-sm text-fg-muted`,children:[(0,J.jsx)(`p`,{children:p.automations.empty}),(0,J.jsx)(`div`,{children:(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>br(`automations`,`/automations?projectId=${encodeURIComponent(F.id)}&action=create`),children:[(0,J.jsx)(g,{className:`size-4`,"aria-hidden":!0}),p.automations.create]})})]})})]}),(0,J.jsxs)(`aside`,{className:`grid min-h-0 min-w-0 content-start gap-4 overflow-y-auto pr-1 [scrollbar-gutter:stable]`,children:[(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,J.jsx)(`div`,{className:`border-b border-edge px-4 py-3`,children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.automations.recentRuns})}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Ie.length?Ie.slice(0,8).map(e=>(0,J.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.automationName}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,fn(e.status)),children:ri(e.status)})]}),(0,J.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:un(e.createdAtMs)})]},e.id)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.automations.emptyRuns})})]}),(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.automations.contextTitle}),(0,J.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:p.automations.contextHint}),(0,J.jsx)(`p`,{className:`mt-3 break-all text-xs text-fg-subtle`,children:F.workspaceRoot||F.effectiveWorkspaceRoot||p.common.defaultWorkspace})]})]})]}):null,$===`notes`?(0,J.jsx)(`section`,{id:`project-panel-notes`,role:`tabpanel`,"aria-labelledby":`project-tab-notes`,className:`flex h-full min-h-[28rem] overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,J.jsx)(_t,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(F.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,listTag:`project:${F.id}`,captureTags:[`project:${F.id}`,F.slug],listTitle:p.notes.title,listDescription:p.notes.hint,emptyText:p.notes.emptyTitle,emptyDescription:p.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${F.id}`})}):null,$===`files`?(0,J.jsx)(`section`,{id:`project-panel-files`,role:`tabpanel`,"aria-labelledby":`project-tab-files`,className:`h-full min-h-[28rem]`,children:(0,J.jsx)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:F.effectiveWorkspaceRoot?(0,J.jsxs)(`div`,{"data-project-files-grid":!0,className:i(`grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[var(--project-files-panel-width)_6px_minmax(0,1fr)]`,Pt&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${Mt}px`},children:[(0,J.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-b border-edge lg:border-b-0 lg:border-r`,children:[(0,J.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b border-edge bg-surface-muted/50 px-3 text-sm`,children:[(0,J.jsx)(ht,{workspacePath:mi}),(0,J.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,J.jsx)(`button`,{type:`button`,className:i(`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,It&&`bg-surface-hover text-fg`),onClick:()=>Lt(!0),"aria-label":p.files.search,title:p.files.search,"aria-pressed":It,children:(0,J.jsx)(me,{className:`size-3.5`,"aria-hidden":!0})}),(0,J.jsx)(re,{className:`size-7 shrink-0 rounded-md p-0`,loading:Yt,label:s.cron.refresh,onClick:()=>void kr()})]})]}),It?(0,J.jsx)(`div`,{className:`shrink-0 border-b border-edge bg-surface-muted/40 px-3 py-2`,children:(0,J.jsxs)(`div`,{className:`flex h-8 items-center gap-2 rounded-md border border-edge bg-surface-panel px-2 focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20`,children:[(0,J.jsx)(me,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`text`,role:`searchbox`,value:Rt,onChange:e=>zt(e.target.value),placeholder:p.files.searchPlaceholder,"aria-label":p.files.searchPlaceholder,autoFocus:!0,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none placeholder:text-fg-subtle`}),(0,J.jsx)(`button`,{type:`button`,className:`flex size-6 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":p.files.clearSearch,title:p.files.clearSearch,onClick:()=>{zt(``),Lt(!1)},children:(0,J.jsx)(h,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,Zt?(0,J.jsx)(`div`,{className:`border-b border-edge bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300`,children:Zt}):null,jr?(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:Ht?(0,J.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,J.jsx)(Te,{className:`h-11 w-full`}),(0,J.jsx)(Te,{className:`h-11 w-full`}),(0,J.jsx)(Te,{className:`h-11 w-full`})]}):Wt?(0,J.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[s.workspace.loadError,`: `,Wt]}):Bt.length===0?(0,J.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:p.files.noSearchResults}):Bt.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:i(`flex w-full min-w-0 items-center gap-2 px-3 py-2 text-left hover:bg-surface-hover`,At===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>jt(e.path),title:e.path,children:[(0,J.jsx)(k,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.name}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-subtle`,children:e.path})]})]},e.path))}):Yt&&Ot.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:p.files.loading}):(0,J.jsx)(we,{tree:Ot,selectedPath:At,onSelectFile:Zr,onSelectEntry:Qr,onExpandDir:e=>void Ar(e),onAction:$r,actionLabels:{preview:s.workspace.preview,download:s.workspace.download,copyPath:s.workspace.copyPath,openDefault:s.workspace.openSystemApp,openWith:s.workspace.openWith,revealInFolder:s.workspace.revealInFolder,recommendedApps:s.workspace.recommendedApps},emptyHint:p.files.emptyDirectory})]}),(0,J.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":p.files.resizeHandle,className:i(`hidden cursor-col-resize touch-none items-stretch justify-center bg-surface-panel transition-colors hover:bg-surface-hover lg:flex`,Pt&&`bg-surface-hover`),onPointerDown:ei,children:(0,J.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70`})}),(0,J.jsx)(`div`,{className:`min-h-0 min-w-0 overflow-hidden bg-surface-base`,children:At?(0,J.jsx)(ot,{filePath:At,projectId:F.id,onClose:()=>jt(null)}):(0,J.jsx)(`div`,{className:`flex h-full min-h-[18rem] items-center justify-center px-6 text-center`,children:(0,J.jsxs)(`div`,{className:`max-w-sm`,children:[(0,J.jsx)(rt,{className:`mx-auto size-8 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:p.files.previewEmptyTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.files.previewEmptyDescription})]})})})]}):(0,J.jsxs)(`div`,{className:`grid gap-3 px-4 py-8 text-sm text-fg-muted`,children:[(0,J.jsx)(`p`,{children:p.files.needWorkspace}),(0,J.jsx)(`div`,{children:(0,J.jsx)(G,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>gr(`settings`),children:p.files.openSettings})})]})})}):null,$===`sessions`?(0,J.jsxs)(`section`,{id:`project-panel-sessions`,role:`tabpanel`,"aria-labelledby":`project-tab-sessions`,className:`grid min-h-full content-start gap-3`,children:[oe.length?(0,J.jsxs)(`label`,{className:`relative flex min-h-9 w-full max-w-lg cursor-text items-center rounded-lg bg-surface-panel py-1.5 pl-9 pr-9 shadow-surface`,children:[(0,J.jsx)(me,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:de,onChange:e=>pe(e.currentTarget.value),placeholder:p.sessions.searchPlaceholder,"aria-label":p.sessions.searchPlaceholder,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`}),de?(0,J.jsx)(`button`,{type:`button`,className:`absolute right-2 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":p.sessions.clearSearch,onClick:()=>pe(``),children:(0,J.jsx)(h,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,oi.length?(0,J.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:oi.map(e=>{let t=un(e.updatedAt),n=e.routing?.agentId||e.agentId||p.common.agent,r=e.name?.trim()||p.sessions.fallbackTitle,i=ii(e.messageCount??0);return(0,J.jsxs)(lt,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:xr(`sessions`),className:`group flex min-h-[11rem] min-w-0 flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,J.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-base text-fg-muted`,children:(0,J.jsx)(gt,{className:`size-4`,"aria-hidden":!0})}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:r}),(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 break-all font-mono text-xs leading-5 text-fg-muted`,title:e.key,children:e.key})]})]}),(0,J.jsxs)(`div`,{className:`mt-auto grid gap-2 pt-4 text-xs text-fg-muted`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`span`,{className:`min-w-0 max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[p.sessions.agent,`: `,n]}),(0,J.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:i})]}),t?(0,J.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[p.sessions.updated,`: `,t]}):null]})]},e.key)})}):si?(0,J.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.noMatches})}):(0,J.jsx)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel px-4 py-8 text-center shadow-surface`,children:(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:p.sessions.emptyTitle}),(0,J.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:p.sessions.emptyDescription})]})})]}):null,$===`goals`?(0,J.jsxs)(`section`,{id:`project-panel-goals`,role:`tabpanel`,"aria-labelledby":`project-tab-goals`,className:`grid min-h-full content-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`div`,{children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.goals.title})}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3`,disabled:tr,onClick:()=>or(!0),children:[(0,J.jsx)(le,{className:`size-4`,"aria-hidden":!0}),p.goals.new]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:he.length?he.map(e=>(0,J.jsxs)(lt,{to:vr(e.id),onClick:xr(`goals`),className:`grid gap-1 border-b border-edge px-4 py-3 last:border-b-0 hover:bg-surface-hover`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:e.title}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,dn(e.status)),children:ri(e.status)})]}),(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:e.nextAction||e.description||p.goals.noNextAction})]},e.id)):(0,J.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:p.goals.empty})})]}):null,$===`activity`?(0,J.jsxs)(`section`,{id:`project-panel-activity`,role:`tabpanel`,"aria-labelledby":`project-tab-activity`,className:`grid min-h-full content-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.activity.title}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ln(p.activity.count,{count:$e})})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`label`,{className:`inline-flex min-h-9 items-center gap-2 rounded-lg bg-surface-panel px-3 text-sm text-fg-muted shadow-surface`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:wt,onChange:e=>Tt(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),p.activity.includeRelated]}),(0,J.jsxs)(G,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void Er(),disabled:nt,children:[(0,J.jsx)(W,{className:i(`size-4`,nt&&`animate-spin`),"aria-hidden":!0}),p.common.refresh]})]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:nt&&Ye.length===0?(0,J.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.activity.loading}):Ye.length?(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Ye.map(e=>{let t=p.activity.types[e.type]??e.type,n=p.activity.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Sn(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===F.id);return(0,J.jsxs)(`article`,{className:`grid gap-2 px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,children:t}),i?(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:p.activity.related}):null]}),(0,J.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,bn(e)]})]}),(0,J.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:un(e.createdAt)})]}),r?(0,J.jsx)(`p`,{className:`line-clamp-2 text-sm leading-5 text-fg-muted`,children:r}):null,(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,J.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[p.activity.actor,`: `,yn(e)]}),(0,J.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[p.activity.source,`: `,xn(e)]})]})]},e.id)})}):(0,J.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:p.activity.empty})})]}):null,$===`settings`?(0,J.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-tab-settings`,onSubmit:Wr,className:`grid min-h-full content-start gap-4`,children:[(0,J.jsxs)(`section`,{className:`grid gap-3 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.contextTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.contextHint})]}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,dn(Q.status)),children:p.settings.statuses[Q.status]})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-5`,children:[(0,J.jsx)(hn,{label:p.settings.workspaceRoot,value:mi,mono:!0}),(0,J.jsx)(hn,{label:p.settings.defaultAgent,value:ci}),(0,J.jsx)(hn,{label:p.settings.pinState,value:fi?p.settings.pinned:p.settings.notPinned}),(0,J.jsx)(hn,{label:p.settings.createdAt,value:un(F.createdAt)||p.common.never}),(0,J.jsx)(hn,{label:p.settings.updatedAt,value:un(F.updatedAt)||p.common.never})]})]}),(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsx)(`div`,{children:(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.detailsTitle})}),(0,J.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,J.jsx)(pn,{label:p.settings.name,children:(0,J.jsx)(`input`,{className:mn(),value:Q.name,onChange:e=>mr(t=>({...t,name:e.target.value}))})}),(0,J.jsx)(pn,{label:p.settings.defaultAgent,children:(0,J.jsxs)(l,{className:mn(),value:Q.defaultAgentId,onChange:e=>mr(t=>({...t,defaultAgentId:e.target.value})),children:[(0,J.jsx)(et,{value:``,children:p.settings.globalDefaultAgent}),$t.map(e=>(0,J.jsx)(et,{value:e.id,children:e.name||e.id},e.id))]})}),(0,J.jsx)(pn,{label:p.settings.status,children:di?(0,J.jsx)(`div`,{className:`grid min-h-10 content-center rounded-md border border-edge bg-surface-muted px-3 text-sm text-fg-muted`,children:p.settings.statuses.archived}):(0,J.jsxs)(l,{className:mn(),value:Q.status===`archived`?`active`:Q.status,onChange:e=>mr(t=>({...t,status:e.target.value})),children:[(0,J.jsx)(et,{value:`active`,children:p.settings.statuses.active}),(0,J.jsx)(et,{value:`paused`,children:p.settings.statuses.paused})]})}),(0,J.jsx)(pn,{label:p.settings.description,hint:p.settings.descriptionHint,children:(0,J.jsx)(`textarea`,{className:mn(!0),value:Q.description,onChange:e=>mr(t=>({...t,description:e.target.value}))})})]})]}),(0,J.jsx)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:(0,J.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:p.settings.workspaceRoot}),(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base px-3 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 md:flex-row md:items-start md:justify-between`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,J.jsx)(`span`,{className:`rounded-md bg-surface-muted px-2 py-0.5 text-xs font-medium text-fg-muted`,children:pi?p.settings.workspaceModeFollow:p.settings.workspaceModeFixed})}),(0,J.jsx)(`div`,{className:`mt-2 break-all font-mono text-xs leading-5 text-fg`,title:mi,children:mi})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void vi(),children:[(0,J.jsx)(C,{className:`size-4`,"aria-hidden":!0}),p.settings.copyWorkspacePath]}),(0,J.jsx)(ht,{workspacePath:mi}),(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Gr,children:[(0,J.jsx)(dt,{className:`size-4`,"aria-hidden":!0}),p.settings.migrateWorkspace]})]})]}),(0,J.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceMigrationHint})]})]})}),(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.agentContextTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.agentContextHint})]}),(0,J.jsx)(pn,{label:p.settings.brief,hint:p.settings.briefHint,children:(0,J.jsx)(`textarea`,{className:mn(!0),value:Q.brief,onChange:e=>mr(t=>({...t,brief:e.target.value}))})}),(0,J.jsx)(pn,{label:p.settings.instructions,hint:p.settings.instructionsHint,children:(0,J.jsx)(`textarea`,{className:mn(!0),value:Q.instructions,onChange:e=>mr(t=>({...t,instructions:e.target.value}))})})]}),(0,J.jsxs)(`section`,{className:`grid gap-4 rounded-lg bg-surface-panel p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:p.settings.managementTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.managementHint})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base px-3 py-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:fi?p.settings.pinnedTitle:p.settings.pinTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:p.settings.pinHint})]}),(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:zn===`pin`,onClick:()=>void qr(),children:[fi?(0,J.jsx)(ct,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(M,{className:`size-4`,"aria-hidden":!0}),fi?p.settings.unpinProject:p.settings.pinProject]})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-edge bg-surface-base px-3 py-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:di?p.settings.restoreTitle:p.settings.archiveTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:di?p.settings.restoreHint:p.settings.archiveHint})]}),(0,J.jsxs)(G,{type:`button`,variant:di?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:zn===`archive`,onClick:()=>void Jr(),children:[di?(0,J.jsx)(W,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(at,{className:`size-4`,"aria-hidden":!0}),di?p.settings.restoreProject:p.settings.archiveProject]})]})]})]}),(0,J.jsxs)(`section`,{className:`grid gap-3 rounded-lg border border-red-500/20 bg-red-500/5 p-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-red-700 dark:text-red-300`,children:p.settings.dangerTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-red-700/80 dark:text-red-200/80`,children:p.settings.dangerHint})]}),(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`w-fit text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,onClick:()=>An(!0),children:[(0,J.jsx)(mt,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]}),(0,J.jsx)(`div`,{className:`flex flex-wrap justify-end gap-2 border-t border-edge pt-4`,children:(0,J.jsxs)(G,{type:`submit`,variant:`primary`,disabled:Dn||!Q.name.trim(),children:[(0,J.jsx)(_e,{className:`size-4`,"aria-hidden":!0}),p.common.save]})})]}):null]}),(0,J.jsx)(N,{open:kn,onOpenChange:e=>{Vn||An(e)},children:(0,J.jsxs)(y,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(ft,{className:`fixed left-1/2 top-1/2 z-[90] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-5 shadow-float focus:outline-none`,children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg bg-red-500/10 text-red-600 dark:text-red-400`,children:(0,J.jsx)(E,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(R,{className:`text-base font-semibold text-fg`,children:p.settings.deleteConfirmTitle}),(0,J.jsx)(d,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:F?ln(p.settings.deleteConfirm,{name:F.name}):p.settings.deleteConfirmFallback})]})]}),(0,J.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,J.jsx)(O,{asChild:!0,children:(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Vn,children:p.common.cancel})}),(0,J.jsxs)(G,{type:`button`,variant:`ghost`,className:`rounded-lg text-red-600 hover:bg-red-500/10 hover:text-red-700 focus-visible:ring-red-500 dark:text-red-400 dark:hover:text-red-300`,disabled:Vn||!F,onClick:()=>void Yr(),children:[(0,J.jsx)(mt,{className:`size-4`,"aria-hidden":!0}),p.settings.deleteConfirmAction]})]})]})]})}),(0,J.jsx)(N,{open:Nn,onOpenChange:e=>{Dn||Pn(e)},children:(0,J.jsxs)(y,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(ft,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(34rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,J.jsx)(R,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMigrationTitle}),(0,J.jsx)(d,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:p.settings.workspaceMigrationDescription})]}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,J.jsxs)(`div`,{className:`grid gap-2 text-sm`,children:[(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:p.settings.workspaceMode}),(0,J.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-2`,children:[(0,J.jsxs)(`label`,{className:i(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,Fn===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,J.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:Fn===`fixed`,onChange:()=>In(`fixed`),disabled:Dn}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFixed}),(0,J.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceMigrationFixedHint})]})]}),(0,J.jsxs)(`label`,{className:i(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,Fn===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,J.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:Fn===`follow`,onChange:()=>In(`follow`),disabled:Dn}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:p.settings.workspaceModeFollow}),(0,J.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:p.settings.workspaceHint})]})]})]})]}),Fn===`fixed`?(0,J.jsx)(yt,{value:Ln,onChange:Rn,disabled:Dn,wd:u,placeholder:p.settings.workspacePlaceholder,inputClassName:mn(),autoFocus:!0}):null,(0,J.jsx)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm leading-6 text-amber-800 dark:text-amber-200`,children:p.settings.workspaceMigrationImpact}),(0,J.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:ln(p.settings.workspaceCurrent,{workspace:hi})})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(O,{asChild:!0,children:(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Dn,children:p.common.cancel})}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:Dn||!gi,onClick:()=>void Kr(),children:[(0,J.jsx)(dt,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMigrationConfirm]})]})]})]})}),(0,J.jsx)(N,{open:!!jn,onOpenChange:e=>{e||Mn(null)},children:(0,J.jsxs)(y,{children:[(0,J.jsx)(I,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(ft,{className:`fixed left-1/2 top-1/2 z-[90] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,J.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,J.jsx)(R,{className:`text-base font-semibold text-fg`,children:p.settings.workspaceMissingTitle}),(0,J.jsx)(d,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:jn?ln(p.settings.workspaceMissingDescription,{workspace:jn}):null})]}),jn?(0,J.jsx)(`div`,{className:`px-5 py-4`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,J.jsx)(rt,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:jn})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(G,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:yi,disabled:Dn,children:p.settings.workspaceMissingBack}),(0,J.jsxs)(G,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void Kr({createWorkspaceRoot:!0}),disabled:Dn,children:[(0,J.jsx)(dt,{className:`size-4`,"aria-hidden":!0}),p.settings.workspaceMissingCreate]})]})]})]})}),(0,J.jsx)(St,{open:ar,t:s.goalsPage,chat:s.chat,busy:tr,options:cr,onClose:()=>!tr&&or(!1),onCreate:Fr}),(0,J.jsx)(Ct,{open:!!$n,definition:$n,language:o,starting:Yn,onClose:()=>!Yn&&er(null),onStart:e=>void Lr(e)})]})}export{En as ProjectDetailPage};
|
|
@@ -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{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-Bq4REfIj.js";import{n as o}from"./locale-store-Ba72bFmP.js";import{$a as s,$i as c,Ba as l,Ga as u,Ha as d,Qi as f,Ra as p,Ua as m,Va as h,Vi as g,Wa as _,bs as v,cs as y,er as b,ml as x,to as S,wl as ee,wo as C,xc as te,xl as w,yc as ne,za as T}from"./index-DOetFpTt.js";import{t as re}from"./directory-picker-path-field-BEhDuShd.js";var ie=n(),E=e(t(),1),D=r(),ae=[`all`,`active`,`paused`,`archived`],O=`__auto__`,k=`__global__`;function A(e){return e===`active`?`bg-accent-soft text-accent-fg`:e===`paused`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-muted text-fg-subtle`}function j(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function oe(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function se(e){let t=e?.body;return t?.code===`workspace_already_bound`&&t.project?t.project:null}function ce(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function M(e,t){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(n)}function le(e){let t=(0,ie.c)(37),{project:n,t:r}=e,a=r.statuses[n.status],o=`/projects/${encodeURIComponent(n.id)}`,s;t[0]===n.name?s=t[1]:(s=(0,D.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:n.name}),t[0]=n.name,t[1]=s);let c;t[2]===n.slug?c=t[3]:(c=(0,D.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.slug}),t[2]=n.slug,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,D.jsxs)(`div`,{className:`min-w-0`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===n.status?u=t[8]:(u=i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,A(n.status)),t[7]=n.status,t[8]=u);let d;t[9]!==a||t[10]!==u?(d=(0,D.jsx)(`span`,{className:u,children:a}),t[9]=a,t[10]=u,t[11]=d):d=t[11];let f;t[12]!==l||t[13]!==d?(f=(0,D.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[l,d]}),t[12]=l,t[13]=d,t[14]=f):f=t[14];let p=n.description||n.brief||r.noDescription,m;t[15]===p?m=t[16]:(m=(0,D.jsx)(`p`,{className:`mt-3 line-clamp-2 min-h-10 text-sm leading-5 text-fg-muted`,children:p}),t[15]=p,t[16]=m);let h=n.workspaceRoot||n.effectiveWorkspaceRoot||r.agentDefault,g;t[17]!==r.workspaceLabel||t[18]!==h?(g=j(r.workspaceLabel,{workspace:h}),t[17]=r.workspaceLabel,t[18]=h,t[19]=g):g=t[19];let _;t[20]===g?_=t[21]:(_=(0,D.jsx)(`div`,{className:`truncate`,children:g}),t[20]=g,t[21]=_);let v;t[22]!==n.lastActiveAt||t[23]!==n.updatedAt||t[24]!==r.lastActive||t[25]!==r.never?(v=j(r.lastActive,{time:M(n.lastActiveAt??n.updatedAt,r.never)}),t[22]=n.lastActiveAt,t[23]=n.updatedAt,t[24]=r.lastActive,t[25]=r.never,t[26]=v):v=t[26];let y;t[27]===v?y=t[28]:(y=(0,D.jsx)(`div`,{children:v}),t[27]=v,t[28]=y);let b;t[29]!==_||t[30]!==y?(b=(0,D.jsxs)(`div`,{className:`mt-auto grid gap-1 pt-4 text-xs text-fg-subtle`,children:[_,y]}),t[29]=_,t[30]=y,t[31]=b):b=t[31];let x;return t[32]!==o||t[33]!==b||t[34]!==f||t[35]!==m?(x=(0,D.jsxs)(w,{to:o,className:`group flex min-h-36 flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[f,m,b]}),t[32]=o,t[33]=b,t[34]=f,t[35]=m,t[36]=x):x=t[36],x}function N(){let e=ee(),t=a(o(e=>e.language)),n=t.chat.workingDirectory,r=t.projectsPage,w=u(e=>e.setPageHeader),ie=u(e=>e.clearPageHeader),[A,M]=(0,E.useState)([]),[N,ue]=(0,E.useState)(`all`),[P,de]=(0,E.useState)(``),[fe,pe]=(0,E.useState)(!0),[me,F]=(0,E.useState)(null),[I,L]=(0,E.useState)(``),[he,ge]=(0,E.useState)(!1),[R,_e]=(0,E.useState)(``),[z,B]=(0,E.useState)(`fixed`),[V,ve]=(0,E.useState)(`auto`),[H,ye]=(0,E.useState)(O),[U,be]=(0,E.useState)([]),[xe,Se]=(0,E.useState)(),[W,Ce]=(0,E.useState)(),[we,Te]=(0,E.useState)(`unknown`),[G,K]=(0,E.useState)(!1),[q,Ee]=(0,E.useState)(!1),[J,Y]=(0,E.useState)(null),[X,Z]=(0,E.useState)(null),De=(0,E.useCallback)(e=>{L(e),ge(!!e.trim())},[]),Oe=(0,E.useCallback)(e=>{_e(e),he||L(oe(e))},[he]);(0,E.useEffect)(()=>{let e=!1;return pe(!0),F(null),f({...N===`all`?{}:{status:N},...P.trim()?{search:P}:{},limit:100}).then(t=>{e||M(t.items)}).catch(t=>{e||F(t instanceof Error?t.message:String(t))}).finally(()=>{e||pe(!1)}),()=>{e=!0}},[P,N]),(0,E.useEffect)(()=>{if(!G)return;let e=!1;return b().then(t=>{e||(be(t.agents),Se(t.defaultId))}).catch(()=>{e||(be([]),Se(void 0))}),()=>{e=!0}},[G]),(0,E.useEffect)(()=>{if(!G)return;let e=!1,t=window.setTimeout(()=>{c({...I.trim()?{name:I.trim()}:{},...z===`fixed`&&R.trim()?{workspaceRoot:R.trim()}:{},projectKind:V}).then(t=>{e||(Ce(t.defaultAgentId),Te(t.inference.kind))}).catch(()=>{e||(Ce(void 0),Te(`unknown`))})},250);return()=>{e=!0,window.clearTimeout(t)}},[G,I,V,z,R]);let Q=(0,E.useMemo)(()=>({active:A.filter(e=>e.status===`active`),paused:A.filter(e=>e.status===`paused`),archived:A.filter(e=>e.status===`archived`)}),[A]),$=(0,E.useCallback)(async(e={})=>{let t=I.trim(),n=z===`fixed`?R.trim():``;if(!(!t&&!n)){Ee(!0),F(null),Z(null);try{let r=await g({...t?{name:t}:{},...n?{workspaceRoot:n}:{},projectKind:V,...H===O?{}:{defaultAgentId:H===k?``:H},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});M(e=>[r,...e]),L(``),ge(!1),_e(``),B(`fixed`),ve(`auto`),ye(O),K(!1)}catch(e){let t=se(e);if(t)M(e=>[t,...e.filter(e=>e.id!==t.id)]),Y(t),K(!1);else{let t=ce(e);t?(Z(t),K(!1)):F(e instanceof Error?e.message:String(e))}}finally{Ee(!1)}}},[H,I,V,z,R]),ke=(0,E.useCallback)(e=>{e.preventDefault(),$()},[$]),Ae=(0,E.useCallback)(()=>{if(!J)return;let t=J.id;Y(null),e(`/projects/${encodeURIComponent(t)}`)},[e,J]),je=(0,E.useCallback)(()=>{Y(null),K(!0)},[]),Me=(0,E.useCallback)(()=>{$({createWorkspaceRoot:!0})},[$]),Ne=(0,E.useCallback)(()=>{Z(null),K(!0)},[]),Pe=(0,E.useMemo)(()=>U.find(e=>e.id===W)?.name||W||``,[U,W]),Fe=(0,E.useMemo)(()=>H===k?xe:H===O?W||xe:H,[H,xe,W]),Ie=(0,E.useMemo)(()=>U.find(e=>e.id===Fe),[U,Fe]),Le=z===`fixed`?R.trim()||r.workspacePlaceholder:Ie?.workspace||r.workspacePlaceholder,Re=(0,E.useMemo)(()=>{if(H===k)return r.agentHintGlobal;if(H!==O){let e=U.find(e=>e.id===H);return j(r.agentHintSelected,{agent:e?.name||H})}return W?j(r.agentHintCoding,{agent:Pe}):we===`coding`?r.agentHintCoderUnavailable:V===`general`||we===`general`?r.agentHintGeneral:r.agentHintAuto},[H,U,Pe,W,we,V,r]),ze=(0,E.useMemo)(()=>(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`label`,{className:`relative block min-w-0`,children:[(0,D.jsx)(y,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,D.jsx)(`input`,{className:`h-9 w-40 rounded-lg border border-edge bg-surface-muted pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent sm:w-56 lg:w-72`,value:P,onChange:e=>de(e.target.value),placeholder:r.searchPlaceholder,"aria-label":r.searchPlaceholder})]}),(0,D.jsxs)(C,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>K(e=>!e),children:[(0,D.jsx)(v,{className:`size-4`,"aria-hidden":!0}),r.create]})]}),[P,r.create,r.searchPlaceholder]);(0,E.useLayoutEffect)(()=>(w({startExtra:null,main:(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r.title}),(0,D.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:j(r.summary,{count:A.length})})]}),end:ze}),()=>ie()),[ie,ze,A.length,w,r.summary,r.title]);let Be=N===`all`?[[r.statuses.active,Q.active],[r.statuses.paused,Q.paused],[r.statuses.archived,Q.archived]]:[[r.statuses[N],A]];return(0,D.jsxs)(`main`,{className:`flex w-full flex-1 flex-col gap-6 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,D.jsx)(m,{open:G,onOpenChange:K,children:(0,D.jsxs)(d,{children:[(0,D.jsx)(h,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,D.jsxs)(T,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(32rem,calc(100vh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,D.jsxs)(`div`,{className:`shrink-0 border-b border-edge px-5 py-4`,children:[(0,D.jsx)(_,{className:`text-base font-semibold text-fg`,children:r.createTitle}),(0,D.jsx)(l,{className:`mt-1 text-sm text-fg-muted`,children:r.createDescription})]}),(0,D.jsxs)(`form`,{onSubmit:ke,className:`flex min-h-0 flex-1 flex-col`,children:[(0,D.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,D.jsxs)(`div`,{className:`grid gap-1.5 text-sm`,children:[(0,D.jsx)(`span`,{className:`font-medium text-fg-muted`,children:r.workspaceRoot}),(0,D.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,D.jsxs)(`label`,{className:i(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2 text-sm`,z===`fixed`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,D.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:z===`fixed`,onChange:()=>B(`fixed`),disabled:q}),(0,D.jsxs)(`span`,{className:`min-w-0`,children:[(0,D.jsx)(`span`,{className:`block font-medium`,children:r.workspaceModeFixed}),(0,D.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:r.workspaceFixedHint})]})]}),(0,D.jsxs)(`label`,{className:i(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2 text-sm`,z===`follow`?`border-accent bg-accent-soft/40 text-fg`:`border-edge bg-surface-base text-fg-muted`),children:[(0,D.jsx)(`input`,{type:`radio`,className:`mt-0.5 size-4`,checked:z===`follow`,onChange:()=>B(`follow`),disabled:q}),(0,D.jsxs)(`span`,{className:`min-w-0`,children:[(0,D.jsx)(`span`,{className:`block font-medium`,children:r.workspaceModeFollow}),(0,D.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:r.workspaceFollowHint})]})]})]}),z===`fixed`?(0,D.jsx)(re,{value:R,onChange:Oe,disabled:q,wd:n,placeholder:r.workspacePlaceholder,inputClassName:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,autoFocus:!0}):null,(0,D.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:j(r.workspaceCurrent,{workspace:Le})})]}),(0,D.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,D.jsx)(`span`,{className:`font-medium text-fg-muted`,children:r.projectName}),(0,D.jsx)(`input`,{className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:I,onChange:e=>De(e.target.value),placeholder:R.trim()&&oe(R)||`xopc`})]}),(0,D.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,D.jsx)(`span`,{className:`font-medium text-fg-muted`,children:r.projectType}),(0,D.jsxs)(s,{className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:V,onChange:e=>ve(e.target.value),disabled:q,children:[(0,D.jsx)(S,{value:`auto`,children:r.projectTypes.auto}),(0,D.jsx)(S,{value:`coding`,children:r.projectTypes.coding}),(0,D.jsx)(S,{value:`general`,children:r.projectTypes.general})]})]}),(0,D.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,D.jsx)(`span`,{className:`font-medium text-fg-muted`,children:r.defaultAgent}),(0,D.jsxs)(s,{className:`min-h-10 rounded-md border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:H,onChange:e=>ye(e.target.value),disabled:q,children:[(0,D.jsx)(S,{value:O,children:r.agentAuto}),(0,D.jsx)(S,{value:k,children:r.agentGlobalDefault}),U.map(e=>(0,D.jsx)(S,{value:e.id,children:e.name||e.id},e.id))]}),(0,D.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:Re})]})]}),(0,D.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,D.jsx)(p,{asChild:!0,children:(0,D.jsx)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,children:r.cancel})}),(0,D.jsxs)(C,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:q||!I.trim()&&(z!==`fixed`||!R.trim()),children:[(0,D.jsx)(v,{className:`size-4`,"aria-hidden":!0}),r.create]})]})]})]})]})}),(0,D.jsx)(m,{open:!!J,onOpenChange:e=>{e||Y(null)},children:(0,D.jsxs)(d,{children:[(0,D.jsx)(h,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,D.jsxs)(T,{className:`fixed left-1/2 top-1/2 z-[110] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,D.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,D.jsx)(_,{className:`text-base font-semibold text-fg`,children:r.workspaceConflictTitle}),(0,D.jsx)(l,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:J?j(r.workspaceConflictDescription,{projectName:J.name}):null})]}),J?(0,D.jsx)(`div`,{className:`space-y-3 px-5 py-4`,children:(0,D.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,D.jsx)(te,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,D.jsx)(`span`,{className:`min-w-0 truncate`,children:j(r.workspaceConflictPath,{workspace:J.workspaceRoot||r.agentDefault})})]})}):null,(0,D.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,D.jsx)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:je,children:r.workspaceConflictBack}),(0,D.jsxs)(C,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:Ae,children:[(0,D.jsx)(x,{className:`size-4`,"aria-hidden":!0}),r.workspaceConflictOpen]})]})]})]})}),(0,D.jsx)(m,{open:!!X,onOpenChange:e=>{e||Z(null)},children:(0,D.jsxs)(d,{children:[(0,D.jsx)(h,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,D.jsxs)(T,{className:`fixed left-1/2 top-1/2 z-[110] flex w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,D.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[(0,D.jsx)(_,{className:`text-base font-semibold text-fg`,children:r.workspaceMissingTitle}),(0,D.jsx)(l,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:X?j(r.workspaceMissingDescription,{workspace:X}):null})]}),X?(0,D.jsx)(`div`,{className:`px-5 py-4`,children:(0,D.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-edge bg-surface-muted px-3 py-2 text-sm text-fg-muted`,children:[(0,D.jsx)(te,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,D.jsx)(`span`,{className:`min-w-0 truncate`,children:X})]})}):null,(0,D.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,D.jsx)(C,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:Ne,disabled:q,children:r.workspaceMissingBack}),(0,D.jsxs)(C,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:Me,disabled:q,children:[(0,D.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),r.workspaceMissingCreate]})]})]})]})}),(0,D.jsxs)(`section`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,D.jsx)(`div`,{className:`flex flex-wrap gap-1 rounded-lg bg-surface-panel p-1 shadow-surface`,children:ae.map(e=>(0,D.jsx)(`button`,{type:`button`,onClick:()=>ue(e),className:i(`rounded-md px-3 py-1.5 text-sm font-medium transition-colors`,N===e?`bg-accent text-white`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:e===`all`?r.all:r.statuses[e]},e))}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,D.jsx)(te,{className:`size-4`,"aria-hidden":!0}),r.optionalContext]})]}),me?(0,D.jsx)(`p`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:me}):null,fe?(0,D.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.loading}):null,!fe&&A.length===0?(0,D.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-8 text-center shadow-surface`,children:[(0,D.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.emptyTitle}),(0,D.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.emptyHint})]}):null,Be.map(([e,t])=>t.length?(0,D.jsxs)(`section`,{className:`space-y-3`,children:[(0,D.jsx)(`h2`,{className:`text-sm font-semibold uppercase tracking-wide text-fg-subtle`,children:e}),(0,D.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:t.map(e=>(0,D.jsx)(le,{project:e,t:r},e.id))})]},e):null)]})}export{N as ProjectsPage};
|
|
@@ -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{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-Bq4REfIj.js";import{a as o,c as s,n as c,o as l,s as u,t as d}from"./fetch-Bl7zMnmd.js";import{n as f}from"./locale-store-Ba72bFmP.js";import{a as p,i as m}from"./vendor-swr-BIWyz7Rc.js";import{$c as h,$o as g,Ba as _,C as v,Co as y,Cr as b,Dc as x,Dr as S,El as C,Er as w,Ha as T,Ho as E,La as D,Nc as O,Ns as k,Or as A,Ro as j,Sr as M,Tr as N,Tt as P,Ua as F,Uc as I,Us as L,Va as R,Wa as z,Xa as B,Yr as V,_r as H,br as U,ha as W,io as ee,kr as G,ln as te,ma as ne,mc as K,mo as q,ms as re,nc as ie,nl as ae,os as J,pa as Y,po as oe,ro as se,ts as ce,vr as le,wo as X,wr as ue,xl as de,xr as fe,yr as pe,ys as me,za as he}from"./index-DOetFpTt.js";import{n as ge,r as _e,t as ve}from"./settings-page-layout-DgFTf6nM.js";import{t as ye}from"./settings-collapsible-section-ByixWwvu.js";import{n as be,r as xe,t as Se}from"./settings-form-section-C-5-n-jM.js";import{t as Ce}from"./browser-BLJWD7WI.js";import{t as we}from"./page-tabs-Cy7bX7Ce.js";var Z=n(),Q=e(t(),1);function Te(e,t){let{mutate:n}=p(),[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(!1),l=(0,Q.useCallback)(async()=>{await Promise.all([n(`tunnel-pair-context`),n(`tunnel-pair`),n(`tunnel-status`),Y()])},[n]);return{busy:r,error:a,confirmOpen:s,setConfirmOpen:c,runEnableLanPairing:(0,Q.useCallback)(async()=>{if(!(!e||r)){i(!0),o(null);try{let n=await fe();if(!n.ok)throw Error(`Failed to enable LAN pairing`);if(n.requiresRestart){let t=await H();if(!t.ok)throw Error(t.message??`Gateway restart failed`);if(!await le(e))throw Error(`Gateway did not come back online in time`)}let r=n.requiresRestart?await pe():n.context;if(!r?.pairingReady)throw Error(`LAN pairing is still not ready after restart`);return await l(),t?.(r),c(!1),r}catch(e){return o(e instanceof Error?e.message:`Enable LAN pairing failed`),null}finally{i(!1)}}},[r,e,t,l]),clearError:()=>o(null)}}var $=r();function Ee(){return i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,y,`dark:border-edge`)}function De(e){let t=(0,Z.c)(122),{pairQr:n,gatewayToken:r,streamlined:o,lanOnly:s,onRefreshQr:c}=e,l=o===void 0?!1:o,u=s===void 0?!1:s,d=f(Ae),p;t[0]===d?p=t[1]:(p=a(d),t[0]=d,t[1]=p);let m=p,h=m.tunnelSettings,_=u?m.remoteAccess.lan:null,y;t[2]!==m.clipboard.copyFailed||t[3]!==h.pairCopied||t[4]!==h.pairCopyLink?(y={copy:h.pairCopyLink,copied:h.pairCopied,copyFailed:m.clipboard.copyFailed},t[2]=m.clipboard.copyFailed,t[3]=h.pairCopied,t[4]=h.pairCopyLink,t[5]=y):y=t[5];let b=y,{tunnelActive:x,tunnelStatus:S,tunnelQr:C,pairContext:w,pairBaseUrl:T,setPairBaseUrl:E,applySuggestedPairUrl:D,applyCandidateUrl:O,resetPairBaseFromContext:k,baseOk:A,localhostWarn:j,pairingBlocked:M,deepLink:N,qrPayload:P,qrDataUrl:F,qrGenFailed:I,encoding:R}=n,z;t[6]===k?z=t[7]:(z=e=>{k(e.recommended.url)},t[6]=k,t[7]=z);let B=Te(r,z),H,U,W,ee,G;if(t[8]!==O||t[9]!==D||t[10]!==A||t[11]!==B||t[12]!==r||t[13]!==_||t[14]!==u||t[15]!==j||t[16]!==c||t[17]!==T||t[18]!==w?.candidates||t[19]!==w?.recommended||t[20]!==M||t[21]!==E||t[22]!==l||t[23]!==h.pairBaseUrlHint||t[24]!==h.pairBaseUrlLabel||t[25]!==h.pairBaseUrlPlaceholder||t[26]!==h.pairBlockedLoopbackBody||t[27]!==h.pairBlockedNextSteps||t[28]!==h.pairBlockedTitle||t[29]!==h.pairCandidatesTitle||t[30]!==h.pairEnableLanButton||t[31]!==h.pairEnableLanEnabling||t[32]!==h.pairEnableLanSecurityAuditLink||t[33]!==h.pairInvalidBaseUrl||t[34]!==h.pairLocalhostWarning||t[35]!==h.pairSelectCandidateHint||t[36]!==h.pairSelectCandidateTitle||t[37]!==h.pairSubtitle||t[38]!==h.pairSuggestedLanLabel||t[39]!==h.pairTitle||t[40]!==h.pairTunnelActive||t[41]!==h.pairTunnelLanUrl||t[42]!==h.pairTunnelPublicUrl||t[43]!==h.pairUseSuggestedUrl||t[44]!==h.pairWaitingForTunnel||t[45]!==h.refreshQr||t[46]!==x||t[47]!==C||t[48]!==S?.publicUrl){G=Symbol.for(`react.early_return_sentinel`);bb0:{let e=w?.candidates.filter(ke)??[],n=u?(e.find(Oe)?.url??e[0]?.url??``).trim():w?.recommended.url?.trim()??``,a=(u||!x)&&e.length>1,o=function(t){if(e.length===0)return null;let n=t===`amber`?`text-amber-950 dark:text-amber-100`:`text-fg`,r=t===`amber`?`text-amber-950/80 dark:text-amber-200/90`:`text-fg-muted`;return(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:i(`text-xs font-medium`,r),children:a?h.pairSelectCandidateTitle:h.pairCandidatesTitle}),(0,$.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,className:i(`w-full rounded-md border px-2 py-1.5 text-left font-mono text-[11px] transition-colors`,t===`amber`?`border-amber-300/70 hover:bg-amber-100/80 dark:border-amber-800 dark:hover:bg-amber-950/50`:`border-edge hover:bg-surface-panel`,T.trim()===e.url&&`border-accent bg-accent/5`,n),onClick:()=>O(e.url),children:[e.label?`${e.label}: `:``,e.url]})},e.url))}),a?(0,$.jsx)(`p`,{className:i(`mt-1 text-[11px] leading-relaxed`,r),children:h.pairSelectCandidateHint}):null]})};if(H=l&&!u,H&&!x){let e;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(g,{className:`size-4 text-accent`,strokeWidth:1.75}),t[54]=e):e=t[54];let n;t[55]===h.pairTitle?n=t[56]:(n=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[e,h.pairTitle]}),t[55]=h.pairTitle,t[56]=n);let r;t[57]===h.pairWaitingForTunnel?r=t[58]:(r=(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:h.pairWaitingForTunnel}),t[57]=h.pairWaitingForTunnel,t[58]=r);let i;t[59]!==n||t[60]!==r?(i=(0,$.jsxs)(Se,{children:[n,r]}),t[59]=n,t[60]=r,t[61]=i):i=t[61],G=i;break bb0}let s=_?.pairTitle??h.pairTitle,d=u?_?.pairSubtitle??h.pairSubtitle:x?h.pairTunnelActive:h.pairSubtitle,f=!!(c&&(u||l&&x)),p=H?`mb-2`:`mb-3`,m;t[62]===p?m=t[63]:(m=i(`flex flex-wrap items-start justify-between gap-2`,p),t[62]=p,t[63]=m);let v;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(g,{className:`size-4 text-accent`,strokeWidth:1.75}),t[64]=v):v=t[64];let y;t[65]===s?y=t[66]:(y=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[v,s]}),t[65]=s,t[66]=y);let b;t[67]!==H||t[68]!==d||t[69]!==h.pairSubtitle?(b=H?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:h.pairSubtitle}):(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:d}),t[67]=H,t[68]=d,t[69]=h.pairSubtitle,t[70]=b):b=t[70];let k;t[71]!==y||t[72]!==b?(k=(0,$.jsxs)(`div`,{children:[y,b]}),t[71]=y,t[72]=b,t[73]=k):k=t[73];let N;t[74]!==c||t[75]!==f||t[76]!==h.refreshQr?(N=f?(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`shrink-0`,onClick:()=>void c(),children:[(0,$.jsx)(re,{className:`size-4`}),h.refreshQr]}):null,t[74]=c,t[75]=f,t[76]=h.refreshQr,t[77]=N):N=t[77],t[78]!==m||t[79]!==k||t[80]!==N?(U=(0,$.jsxs)(`div`,{className:m,children:[k,N]}),t[78]=m,t[79]=k,t[80]=N,t[81]=U):U=t[81],W=M?(0,$.jsxs)(`div`,{className:`mb-3 space-y-3 rounded-lg border border-amber-200 bg-amber-50 px-3 py-3 dark:border-amber-900/50 dark:bg-amber-950/30`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-amber-950 dark:text-amber-100`,children:h.pairBlockedTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-amber-900 dark:text-amber-200`,children:h.pairBlockedLoopbackBody})]}),n?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-amber-950/80 dark:text-amber-200/90`,children:h.pairSuggestedLanLabel}),(0,$.jsx)(`div`,{className:`mt-0.5 break-all font-mono text-xs text-amber-950 dark:text-amber-100`,children:n})]}),(0,$.jsx)(X,{type:`button`,variant:`secondary`,className:`w-full sm:w-auto`,onClick:D,children:h.pairUseSuggestedUrl})]}):null,e.length>0?o(`amber`):null,(0,$.jsx)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:(0,$.jsxs)(X,{type:`button`,className:`w-full sm:w-auto`,disabled:B.busy||!r,onClick:()=>B.setConfirmOpen(!0),children:[B.busy?(0,$.jsx)(L,{className:`size-3.5 animate-spin`}):null,B.busy?h.pairEnableLanEnabling:h.pairEnableLanButton]})}),B.error?(0,$.jsx)(`p`,{className:`text-xs text-red-800 dark:text-red-200`,children:B.error}):null,(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-amber-900 dark:text-amber-200`,children:u?_?.pairBlockedNextSteps??h.pairBlockedNextSteps:h.pairBlockedNextSteps}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(de,{to:`/settings/gateway`,className:`inline-block text-xs font-medium text-accent hover:underline`,children:h.pairEnableLanSecurityAuditLink}),u&&_?.pairPublicTabLink?(0,$.jsx)(de,{to:`/settings/remote-access?tab=public`,className:`inline-block text-xs font-medium text-accent hover:underline`,children:_.pairPublicTabLink}):null]})]}):null,ee=x&&!u?H?null:(0,$.jsxs)(`div`,{className:`mb-3 space-y-2 rounded-lg bg-surface-panel/80 px-3 py-3 shadow-surface`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.pairTunnelPublicUrl}),(0,$.jsx)(`div`,{className:`mt-0.5 break-all font-mono text-xs text-fg`,children:S?.publicUrl})]}),C?.lanUrl?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:h.pairTunnelLanUrl}),(0,$.jsx)(`div`,{className:`mt-0.5 break-all font-mono text-xs text-fg`,children:C.lanUrl})]}):null]}):(0,$.jsxs)(`div`,{className:`mb-3 space-y-1.5`,children:[(0,$.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`tunnel-mobile-pair-base`,children:h.pairBaseUrlLabel}),(0,$.jsx)(`input`,{id:`tunnel-mobile-pair-base`,className:i(Ee(),`font-mono text-xs`),type:`text`,autoComplete:`off`,spellCheck:!1,placeholder:n||h.pairBaseUrlPlaceholder,value:T,onChange:e=>E(e.target.value)}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:h.pairBaseUrlHint}),!A&&T.trim()?(0,$.jsx)(`p`,{className:`text-xs text-amber-800 dark:text-amber-200`,children:h.pairInvalidBaseUrl}):null,j?(0,$.jsx)(`p`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-100`,children:h.pairLocalhostWarning}):null,a?o(`neutral`):null]})}t[8]=O,t[9]=D,t[10]=A,t[11]=B,t[12]=r,t[13]=_,t[14]=u,t[15]=j,t[16]=c,t[17]=T,t[18]=w?.candidates,t[19]=w?.recommended,t[20]=M,t[21]=E,t[22]=l,t[23]=h.pairBaseUrlHint,t[24]=h.pairBaseUrlLabel,t[25]=h.pairBaseUrlPlaceholder,t[26]=h.pairBlockedLoopbackBody,t[27]=h.pairBlockedNextSteps,t[28]=h.pairBlockedTitle,t[29]=h.pairCandidatesTitle,t[30]=h.pairEnableLanButton,t[31]=h.pairEnableLanEnabling,t[32]=h.pairEnableLanSecurityAuditLink,t[33]=h.pairInvalidBaseUrl,t[34]=h.pairLocalhostWarning,t[35]=h.pairSelectCandidateHint,t[36]=h.pairSelectCandidateTitle,t[37]=h.pairSubtitle,t[38]=h.pairSuggestedLanLabel,t[39]=h.pairTitle,t[40]=h.pairTunnelActive,t[41]=h.pairTunnelLanUrl,t[42]=h.pairTunnelPublicUrl,t[43]=h.pairUseSuggestedUrl,t[44]=h.pairWaitingForTunnel,t[45]=h.refreshQr,t[46]=x,t[47]=C,t[48]=S?.publicUrl,t[49]=H,t[50]=U,t[51]=W,t[52]=ee,t[53]=G}else H=t[49],U=t[50],W=t[51],ee=t[52],G=t[53];if(G!==Symbol.for(`react.early_return_sentinel`))return G;let te;t[82]===h.pairSecurityNote?te=t[83]:(te=(0,$.jsx)(`p`,{className:`mb-3 text-xs text-fg-subtle`,children:h.pairSecurityNote}),t[82]=h.pairSecurityNote,t[83]=te);let ne;t[84]!==b||t[85]!==N||t[86]!==R||t[87]!==M||t[88]!==F||t[89]!==I||t[90]!==h.pairEncoding||t[91]!==h.pairImageError||t[92]!==h.pairQrDisabled?(ne=N?(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-3 sm:items-start`,children:[F&&!I?(0,$.jsx)(`img`,{src:F,alt:``,className:`size-56 rounded-lg border border-edge-subtle bg-white object-contain p-3 dark:border-edge`}):null,R?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:h.pairEncoding}):null,I?(0,$.jsx)(`p`,{className:`text-center text-sm text-fg-muted sm:text-left`,children:h.pairImageError}):null,(0,$.jsx)(V,{text:N,labels:b})]}):M?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:h.pairQrDisabled}):null,t[84]=b,t[85]=N,t[86]=R,t[87]=M,t[88]=F,t[89]=I,t[90]=h.pairEncoding,t[91]=h.pairImageError,t[92]=h.pairQrDisabled,t[93]=ne):ne=t[93];let K;t[94]!==H||t[95]!==P||t[96]!==h.deeplinkTitle?(K=P&&!H?(0,$.jsxs)(`details`,{className:`mt-3 rounded-lg bg-surface-panel/80 px-3 py-2 shadow-surface`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-muted`,children:h.deeplinkTitle}),(0,$.jsx)(`p`,{className:`mt-2 break-all font-mono text-[10px] leading-relaxed text-fg-subtle`,children:P})]}):null,t[94]=H,t[95]=P,t[96]=h.deeplinkTitle,t[97]=K):K=t[97];let q;t[98]!==H||t[99]!==h.pairMobileProbeHint||t[100]!==h.pairSchemeHint?(q=H?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`mt-3 break-all font-mono text-[10px] leading-relaxed text-fg-subtle`,children:h.pairSchemeHint}),(0,$.jsx)(`p`,{className:`mt-1 text-[10px] leading-relaxed text-fg-subtle`,children:h.pairMobileProbeHint})]}),t[98]=H,t[99]=h.pairMobileProbeHint,t[100]=h.pairSchemeHint,t[101]=q):q=t[101];let ie,ae;t[102]===B?(ie=t[103],ae=t[104]):(ie=()=>void B.runEnableLanPairing(),ae=()=>{B.busy||B.setConfirmOpen(!1)},t[102]=B,t[103]=ie,t[104]=ae);let J;t[105]!==B.confirmOpen||t[106]!==h.consentCancel||t[107]!==h.pairEnableLanButton||t[108]!==h.pairEnableLanConfirmBody||t[109]!==h.pairEnableLanConfirmTitle||t[110]!==ie||t[111]!==ae?(J=(0,$.jsx)(v,{open:B.confirmOpen,title:h.pairEnableLanConfirmTitle,description:h.pairEnableLanConfirmBody,confirmLabel:h.pairEnableLanButton,cancelLabel:h.consentCancel,onConfirm:ie,onCancel:ae}),t[105]=B.confirmOpen,t[106]=h.consentCancel,t[107]=h.pairEnableLanButton,t[108]=h.pairEnableLanConfirmBody,t[109]=h.pairEnableLanConfirmTitle,t[110]=ie,t[111]=ae,t[112]=J):J=t[112];let Y;return t[113]!==te||t[114]!==ne||t[115]!==K||t[116]!==q||t[117]!==J||t[118]!==U||t[119]!==W||t[120]!==ee?(Y=(0,$.jsx)(Se,{children:(0,$.jsxs)($.Fragment,{children:[U,W,ee,te,ne,K,q,J]})}),t[113]=te,t[114]=ne,t[115]=K,t[116]=q,t[117]=J,t[118]=U,t[119]=W,t[120]=ee,t[121]=Y):Y=t[121],Y}function Oe(e){return e.reachable}function ke(e){return e.kind===`lan`}function Ae(e){return e.language}function je(e){let t=(0,Z.c)(40),{open:n,title:r,intro:a,bullets:o,checkboxLabel:s,confirmLabel:c,cancelLabel:l,onConfirm:u,onCancel:d}=e,[f,p]=(0,Q.useState)(!1),m;t[0]===d?m=t[1]:(m=e=>{e||(p(!1),d())},t[0]=d,t[1]=m);let h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(R,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,ee)}),t[2]=h):h=t[2];let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=i(`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`,se),t[3]=g):g=t[3];let v;t[4]===r?v=t[5]:(v=(0,$.jsx)(z,{className:`text-base font-semibold text-fg`,children:r}),t[4]=r,t[5]=v);let y;t[6]===a?y=t[7]:(y=(0,$.jsx)(_,{className:`mt-2 text-sm text-fg-muted`,children:a}),t[6]=a,t[7]=y);let b;t[8]===o?b=t[9]:(b=o.map(Me),t[8]=o,t[9]=b);let x;t[10]===b?x=t[11]:(x=(0,$.jsx)(`ul`,{className:`mt-4 list-disc space-y-2 pl-5 text-sm text-fg-muted`,children:b}),t[10]=b,t[11]=x);let S;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>p(e.target.checked),t[12]=S):S=t[12];let C;t[13]===f?C=t[14]:(C=(0,$.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 shrink-0 rounded border-edge accent-accent`,checked:f,onChange:S}),t[13]=f,t[14]=C);let w;t[15]===s?w=t[16]:(w=(0,$.jsx)(`span`,{children:s}),t[15]=s,t[16]=w);let E;t[17]!==w||t[18]!==C?(E=(0,$.jsxs)(`label`,{className:`mt-5 flex cursor-pointer items-start gap-3 text-sm text-fg`,children:[C,w]}),t[17]=w,t[18]=C,t[19]=E):E=t[19];let D;t[20]!==l||t[21]!==d?(D=(0,$.jsx)(X,{type:`button`,variant:`secondary`,onClick:d,children:l}),t[20]=l,t[21]=d,t[22]=D):D=t[22];let O=!f,k;t[23]!==c||t[24]!==u||t[25]!==O?(k=(0,$.jsx)(X,{type:`button`,disabled:O,onClick:u,children:c}),t[23]=c,t[24]=u,t[25]=O,t[26]=k):k=t[26];let A;t[27]!==D||t[28]!==k?(A=(0,$.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[D,k]}),t[27]=D,t[28]=k,t[29]=A):A=t[29];let j;t[30]!==E||t[31]!==A||t[32]!==v||t[33]!==y||t[34]!==x?(j=(0,$.jsxs)(T,{children:[h,(0,$.jsxs)(he,{className:g,onOpenAutoFocus:Ne,children:[v,y,x,E,A]})]}),t[30]=E,t[31]=A,t[32]=v,t[33]=y,t[34]=x,t[35]=j):j=t[35];let M;return t[36]!==n||t[37]!==m||t[38]!==j?(M=(0,$.jsx)(F,{open:n,onOpenChange:m,children:j}),t[36]=n,t[37]=m,t[38]=j,t[39]=M):M=t[39],M}function Me(e){return(0,$.jsx)(`li`,{children:e},e)}function Ne(e){return e.preventDefault()}function Pe(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Fe=[`preparing_frpc`,`registering`,`starting_frpc`];function Ie(e){return e?e===`reconnecting_frpc`?Fe.indexOf(`starting_frpc`):Fe.indexOf(e):-1}function Le(e,t){if(t.state===`connected`)return`done`;let n=t.startProgress?.phase,r=Fe.indexOf(e),i=Ie(n);return i<0?t.state===`connecting`||t.state===`reconnecting`?`active`:`pending`:r<i?`done`:r===i?`active`:`pending`}function Re(e,t,n){let r=n.startProgress;return Le(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 ze(e,t){switch(t){case`preparing_frpc`:return e.stepPrepareFrpc;case`registering`:return e.stepRegister;case`starting_frpc`:return e.stepFrpcLogin}}function Be(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 Ve(e){let t=(0,Z.c)(31),{status:n,t:r}=e,[,a]=(0,Q.useState)(0),o;t[0]!==a||t[1]!==n.state?(o=()=>{if(n.state!==`connecting`&&n.state!==`reconnecting`)return;let e=window.setInterval(()=>a(He),1e3);return()=>window.clearInterval(e)},t[0]=a,t[1]=n.state,t[2]=o):o=t[2];let s=n.startProgress?.startedAt,c;if(t[3]!==n.state||t[4]!==s?(c=[n.state,s],t[3]=n.state,t[4]=s,t[5]=c):c=t[5],(0,Q.useEffect)(o,c),!(n.state===`connecting`||n.state===`reconnecting`||n.state===`connected`&&n.startProgress))return null;let l,u,d,f,p;if(t[6]!==n||t[7]!==r){let e=Be(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 px-3 py-3 shadow-surface`;let a;t[13]===r.startProgressTitle?a=t[14]:(a=(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:r.startProgressTitle}),t[13]=r.startProgressTitle,t[14]=a);let o;t[15]===r.startProgressHint?o=t[16]:(o=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.startProgressHint}),t[15]=r.startProgressHint,t[16]=o),t[17]!==a||t[18]!==o?(d=(0,$.jsxs)(`div`,{children:[a,o]}),t[17]=a,t[18]=o,t[19]=d):d=t[19];let s=Fe.map(e=>{let t=Le(e,n),a=Re(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)(ae,{className:`size-3.5 text-emerald-600 dark:text-emerald-400`}):t===`active`?(0,$.jsx)(L,{className:`size-3.5 animate-spin text-accent`}):(0,$.jsx)(I,{className:`size-3.5`})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:i(`font-medium`,t===`active`?`text-fg`:t===`done`?`text-fg-muted`:`text-fg-subtle`),children:ze(r,e)}),a?(0,$.jsx)(`div`,{className:`mt-0.5 text-fg-muted`,children:a}):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:i(`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:[Pe(n.frpcDownload.bytesReceived),` /`,` `,Pe(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]===s?f=t[21]:(f=(0,$.jsx)(`ol`,{className:`space-y-2`,children:s}),t[20]=s,t[21]=f),p=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]=d,t[11]=f,t[12]=p}else l=t[8],u=t[9],d=t[10],f=t[11],p=t[12];let m;t[22]!==l||t[23]!==r.publicUrlPendingNotice?(m=l?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.publicUrlPendingNotice}):null,t[22]=l,t[23]=r.publicUrlPendingNotice,t[24]=m):m=t[24];let h;return t[25]!==u||t[26]!==d||t[27]!==f||t[28]!==p||t[29]!==m?(h=(0,$.jsxs)(`div`,{className:u,children:[d,f,p,m]}),t[25]=u,t[26]=d,t[27]=f,t[28]=p,t[29]=m,t[30]=h):h=t[30],h}function He(e){return e+1}function Ue(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 We(e){return e.state===`connected`?`connected`:e.state===`error`?`error`:e.state===`connecting`||e.state===`reconnecting`||e.startProgress||e.frpcDownload?`progress`:`off`}function Ge(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 Ke(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 qe(e){let t=(0,Z.c)(61),{t:n,status:r,isLoading:a,statusErr:o,starting:s,stopping:c,showConsentExpired:l,copyLabels:u,startDisabled:d,startDisabledReason:f,stepLabel:p,onStart:m,onStop:h}=e,g=d===void 0?!1:d,_,v,y,b,x,S,C;t[0]!==r||t[1]!==s?(C=We(r),_=r.enabled||s,v=s||r.state===`connecting`||r.state===`reconnecting`||!!r.startProgress||!!r.frpcDownload,t[9]===Symbol.for(`react.memo_cache_sentinel`)?(S=i(xe(),`space-y-4`),t[9]=S):S=t[9],x=`flex flex-wrap items-start justify-between gap-3`,b=`flex items-center gap-2`,y=i(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium`,Ge(C)),t[0]=r,t[1]=s,t[2]=_,t[3]=v,t[4]=y,t[5]=b,t[6]=x,t[7]=S,t[8]=C):(_=t[2],v=t[3],y=t[4],b=t[5],x=t[6],S=t[7],C=t[8]);let w=C===`connected`&&`bg-emerald-500`,T=C===`progress`&&`bg-amber-500 animate-pulse`,E=C===`error`&&`bg-red-500`,D=C===`off`&&`bg-fg-subtle`,O;t[10]!==w||t[11]!==T||t[12]!==E||t[13]!==D?(O=i(`size-1.5 rounded-full`,w,T,E,D),t[10]=w,t[11]=T,t[12]=E,t[13]=D,t[14]=O):O=t[14];let k;t[15]===O?k=t[16]:(k=(0,$.jsx)(`span`,{className:O,"aria-hidden":!0}),t[15]=O,t[16]=k);let A;t[17]!==a||t[18]!==r||t[19]!==n?(A=a&&!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`}):Ue(n,r),t[17]=a,t[18]=r,t[19]=n,t[20]=A):A=t[20];let M;t[21]!==k||t[22]!==A||t[23]!==y?(M=(0,$.jsxs)(`span`,{className:y,children:[k,A]}),t[21]=k,t[22]=A,t[23]=y,t[24]=M):M=t[24];let N;t[25]!==r.connectedSince||t[26]!==r.state||t[27]!==n.uptime?(N=r.connectedSince&&r.state===`connected`?(0,$.jsxs)(`span`,{className:`text-xs text-fg-subtle`,children:[n.uptime,` `,Ke(r.connectedSince)]}):null,t[25]=r.connectedSince,t[26]=r.state,t[27]=n.uptime,t[28]=N):N=t[28];let P;t[29]!==M||t[30]!==N||t[31]!==b?(P=(0,$.jsxs)(`div`,{className:b,children:[M,N]}),t[29]=M,t[30]=N,t[31]=b,t[32]=P):P=t[32];let F;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(K,{className:`size-4 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[33]=F):F=t[33];let I;t[34]!==P||t[35]!==x?(I=(0,$.jsxs)(`div`,{className:x,children:[P,F]}),t[34]=P,t[35]=x,t[36]=I):I=t[36];let R;t[37]===o?R=t[38]:(R=o?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o instanceof Error?o.message:String(o)}):null,t[37]=o,t[38]=R);let z;t[39]!==l||t[40]!==n.consentExpiredBanner?(z=l?(0,$.jsx)(`p`,{className:`rounded-lg border border-amber-500/25 bg-amber-500/5 px-3 py-2 text-xs text-fg-muted`,children:n.consentExpiredBanner}):null,t[39]=l,t[40]=n.consentExpiredBanner,t[41]=z):z=t[41];let B;t[42]!==_||t[43]!==u||t[44]!==m||t[45]!==h||t[46]!==v||t[47]!==r||t[48]!==g||t[49]!==f||t[50]!==s||t[51]!==p||t[52]!==c||t[53]!==n?(B=_?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[r.publicUrl?(0,$.jsx)(`div`,{className:`rounded-xl bg-surface-panel/80 px-3 py-3 shadow-surface`,children:(0,$.jsx)(V,{label:n.publicUrlLabel,text:r.publicUrl,labels:u})}):null,v?(0,$.jsx)(Ve,{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)(X,{type:`button`,variant:`secondary`,disabled:c,onClick:h,children:[c?(0,$.jsx)(L,{className:`size-4 animate-spin`}):null,n.stop]}):(0,$.jsxs)(X,{type:`button`,disabled:s,onClick:m,children:[s?(0,$.jsx)(L,{className:`size-4 animate-spin`}):(0,$.jsx)(me,{className:`size-4`}),n.start]})})]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[p?(0,$.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:p}):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 border border-amber-500/25 bg-amber-500/5 px-3 py-2.5 text-xs text-fg-muted`,children:[(0,$.jsx)(j,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-400`}),(0,$.jsx)(`p`,{children:n.riskBannerBody})]}),g&&f?(0,$.jsx)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200`,children:f}):null,(0,$.jsxs)(X,{type:`button`,disabled:s||g,onClick:m,className:`w-full sm:w-auto`,children:[s?(0,$.jsx)(L,{className:`size-4 animate-spin`}):(0,$.jsx)(me,{className:`size-4`}),n.start]})]}),t[42]=_,t[43]=u,t[44]=m,t[45]=h,t[46]=v,t[47]=r,t[48]=g,t[49]=f,t[50]=s,t[51]=p,t[52]=c,t[53]=n,t[54]=B):B=t[54];let H;return t[55]!==I||t[56]!==R||t[57]!==z||t[58]!==B||t[59]!==S?(H=(0,$.jsxs)(`section`,{className:S,children:[I,R,z,B]}),t[55]=I,t[56]=R,t[57]=z,t[58]=B,t[59]=S,t[60]=H):H=t[60],H}var Je=`https://console.xopc.ai/keys/tunnel`,Ye={reconfiguring:!1};function Xe(e){let t=(0,Z.c)(84),{t:n,brokerSecretFromEnv:r,brokerSecretMissing:a,brokerSecretConfiguredInConfig:o,brokerSecretMaskedValue:s,brokerSecretDraft:c,savingBrokerSecret:l,brokerSecretNotice:u,copyFailedLabel:d,onDraftChange:f,onSave:p,onClear:m,sectionRef:h}=e,g=(0,Q.useId)(),_=a&&!r,v=!_,[y,b]=(0,Q.useReducer)(P,Ye),{reconfiguring:S}=y,C;t[0]!==o||t[1]!==c||t[2]!==r||t[3]!==S?(C=o&&!r&&!S&&!c.trim(),t[0]=o,t[1]=c,t[2]=r,t[3]=S,t[4]=C):C=t[4];let w=C,T;t[5]!==n.copied||t[6]!==n.copyKey||t[7]!==n.hideKey||t[8]!==n.showKey?(T={show:n.showKey,hide:n.hideKey,copy:n.copyKey,copied:n.copied},t[5]=n.copied,t[6]=n.copyKey,t[7]=n.hideKey,t[8]=n.showKey,t[9]=T):T=t[9];let E=T,D;t[10]===c?D=t[11]:(D=c.trim().length>0&&!te(c.trim()),t[10]=c,t[11]=D);let O=D,k;t[12]===f?k=t[13]:(k=()=>{b({type:`patch`,patch:{reconfiguring:!1}}),f(``)},t[12]=f,t[13]=k);let A=k,j=_&&`ring-1 ring-amber-500/30`,M;t[14]===j?M=t[15]:(M=i(j),t[14]=j,t[15]=M);let N=v?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:_?`bg-amber-500/10 text-amber-700 dark:text-amber-400`:`bg-surface-hover text-fg-muted`,F;t[16]===N?F=t[17]:(F=i(`flex size-9 shrink-0 items-center justify-center rounded-lg`,N),t[16]=N,t[17]=F);let I;t[18]===v?I=t[19]:(I=v?(0,$.jsx)(ae,{className:`size-4`,strokeWidth:2,"aria-hidden":!0}):(0,$.jsx)(ie,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[18]=v,t[19]=I);let R;t[20]!==F||t[21]!==I?(R=(0,$.jsx)(`span`,{className:F,children:I}),t[20]=F,t[21]=I,t[22]=R):R=t[22];let z=v?n.brokerSecretReadyTitle:n.brokerSecretStepTitle,B;t[23]===z?B=t[24]:(B=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:z}),t[23]=z,t[24]=B);let V=v?n.brokerSecretReadyHint:n.brokerSecretHint,H;t[25]===V?H=t[26]:(H=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:V}),t[25]=V,t[26]=H);let U;t[27]!==_||t[28]!==n.brokerSecretMissingHint?(U=_?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-amber-800 dark:text-amber-200`,children:n.brokerSecretMissingHint}):null,t[27]=_,t[28]=n.brokerSecretMissingHint,t[29]=U):U=t[29];let W;t[30]!==B||t[31]!==H||t[32]!==U?(W=(0,$.jsxs)(`div`,{children:[B,H,U]}),t[30]=B,t[31]=H,t[32]=U,t[33]=W):W=t[33];let ee;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(x,{className:`size-3`,"aria-hidden":!0}),t[34]=ee):ee=t[34];let G;t[35]===n.brokerSecretConsoleLink?G=t[36]:(G=(0,$.jsxs)(`a`,{href:Je,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,ee]}),t[35]=n.brokerSecretConsoleLink,t[36]=G);let ne;t[37]!==r||t[38]!==n.brokerSecretEnvHint?(ne=r?(0,$.jsx)(`p`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2 text-xs text-fg-muted shadow-surface`,children:n.brokerSecretEnvHint}):null,t[37]=r,t[38]=n.brokerSecretEnvHint,t[39]=ne):ne=t[39];let K;t[40]!==o||t[41]!==c||t[42]!==r||t[43]!==s||t[44]!==O||t[45]!==A||t[46]!==d||t[47]!==g||t[48]!==_||t[49]!==m||t[50]!==f||t[51]!==p||t[52]!==S||t[53]!==l||t[54]!==E||t[55]!==w||t[56]!==n.brokerSecretCancelReconfigure||t[57]!==n.brokerSecretClear||t[58]!==n.brokerSecretMaskedHelp||t[59]!==n.brokerSecretNotInConfigFile||t[60]!==n.brokerSecretPlaceholder||t[61]!==n.brokerSecretReconfigure||t[62]!==n.brokerSecretRevealFailed||t[63]!==n.brokerSecretSave||t[64]!==n.brokerSecretSaveAndContinue||t[65]!==n.brokerSecretTitle?(K=w?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:g,children:n.brokerSecretTitle}),(0,$.jsx)(oe,{id:g,value:s,labels:E,reveal:Ze,loadFailedLabel:d||n.brokerSecretRevealFailed,maskedHelp:n.brokerSecretMaskedHelp,notInConfigFile:n.brokerSecretNotInConfigFile,readOnly:!0}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(X,{type:`button`,variant:`secondary`,disabled:l,onClick:()=>{b({type:`patch`,patch:{reconfiguring:!0}})},children:n.brokerSecretReconfigure}),(0,$.jsx)(X,{type:`button`,variant:`ghost`,disabled:l,onClick:m,children:n.brokerSecretClear})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:g,children:n.brokerSecretTitle}),(0,$.jsx)(oe,{id:g,value:c,onChange:f,placeholder:n.brokerSecretPlaceholder,labels:E,disabled:l}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(X,{type:`button`,disabled:l||!O,onClick:p,children:[l?(0,$.jsx)(L,{className:`size-4 animate-spin`}):null,_?n.brokerSecretSaveAndContinue:n.brokerSecretSave]}),o||r?(0,$.jsx)(X,{type:`button`,variant:`ghost`,disabled:l,onClick:m,children:n.brokerSecretClear}):null,S?(0,$.jsx)(X,{type:`button`,variant:`ghost`,disabled:l,onClick:A,children:n.brokerSecretCancelReconfigure}):null]})]}),t[40]=o,t[41]=c,t[42]=r,t[43]=s,t[44]=O,t[45]=A,t[46]=d,t[47]=g,t[48]=_,t[49]=m,t[50]=f,t[51]=p,t[52]=S,t[53]=l,t[54]=E,t[55]=w,t[56]=n.brokerSecretCancelReconfigure,t[57]=n.brokerSecretClear,t[58]=n.brokerSecretMaskedHelp,t[59]=n.brokerSecretNotInConfigFile,t[60]=n.brokerSecretPlaceholder,t[61]=n.brokerSecretReconfigure,t[62]=n.brokerSecretRevealFailed,t[63]=n.brokerSecretSave,t[64]=n.brokerSecretSaveAndContinue,t[65]=n.brokerSecretTitle,t[66]=K):K=t[66];let q;t[67]===u?q=t[68]:(q=u?(0,$.jsx)(`p`,{className:`text-xs text-emerald-700 dark:text-emerald-400`,children:u}):null,t[67]=u,t[68]=q);let re;t[69]!==W||t[70]!==G||t[71]!==ne||t[72]!==K||t[73]!==q?(re=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[W,G,ne,K,q]}),t[69]=W,t[70]=G,t[71]=ne,t[72]=K,t[73]=q,t[74]=re):re=t[74];let J;t[75]!==R||t[76]!==re?(J=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[R,re]}),t[75]=R,t[76]=re,t[77]=J):J=t[77];let Y;t[78]!==J||t[79]!==M?(Y=(0,$.jsx)(Se,{className:M,children:J}),t[78]=J,t[79]=M,t[80]=Y):Y=t[80];let se;return t[81]!==h||t[82]!==Y?(se=(0,$.jsx)(`div`,{ref:h,id:`tunnel-broker-secret-setup`,children:Y}),t[81]=h,t[82]=Y,t[83]=se):se=t[83],se}function Ze(){return S().then(Qe)}function Qe(e){return e.registrationSecret??null}function $e(e){let t=(0,Z.c)(10),{language:n,label:r,section:a,className:o}=e,s;t[0]!==n||t[1]!==a?(s=B(n,a),t[0]=n,t[1]=a,t[2]=s):s=t[2];let c;t[3]===o?c=t[4]:(c=i(`inline-flex items-center gap-1 text-sm font-medium text-accent hover:underline`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,o),t[3]=o,t[4]=c);let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(x,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[5]=l):l=t[5];let u;return t[6]!==r||t[7]!==s||t[8]!==c?(u=(0,$.jsxs)(`a`,{href:s,target:`_blank`,rel:`noreferrer`,className:c,children:[r,l]}),t[6]=r,t[7]=s,t[8]=c,t[9]=u):u=t[9],u}var et=e(Ce(),1),tt={width:216,margin:2,errorCorrectionLevel:`M`,color:{dark:`#000000ff`,light:`#ffffffff`}};async function nt(e){return et.toDataURL(e,tt)}function rt(e){let t=e?.candidates??[],n=t.find(e=>e.kind===`lan`&&e.reachable),r=t.find(e=>e.kind===`lan`);return(n??r)?.url?.trim()??``}function it(e,t){let n=t.trim();return!n||!e?!1:e.candidates.some(e=>e.kind===`tunnel`&&e.url.trim()===n)}function at(e,t){return e?t?rt(e)||e.recommended.url?.trim()||``:e.recommended.url?.trim()||``:``}function ot(e,t){let n=t?.preferLan===!0,r=!!e,{mutate:i}=p(),a=(0,Q.useRef)(!1),{data:o}=m(r?`tunnel-status`:null,ue,{refreshInterval:6e4}),{data:c,mutate:l}=m(r?`tunnel-pair-context`:null,M,{refreshInterval:6e4});(0,Q.useEffect)(()=>{let e=()=>{i(`tunnel-status`),i(`tunnel-qr`),i(`tunnel-pair`),i(`tunnel-pair-context`)};return window.addEventListener(`tunnel-status`,e),()=>window.removeEventListener(`tunnel-status`,e)},[i]);let d=o?.state===`connected`&&!!o.publicUrl?.trim(),f=d&&!n,{data:h,mutate:g}=m(f&&r?`tunnel-qr`:null,b,{refreshInterval:4*6e4}),{data:_,mutate:v}=m(!f&&r&&c?.pairingReady?`tunnel-pair`:null,U,{refreshInterval:4*6e4}),[y,x]=(0,Q.useState)(``),[S,C]=(0,Q.useState)(``),[w,T]=(0,Q.useState)({pairContext:void 0,preferLan:n});if(!a.current&&(c!==w.pairContext||n!==w.preferLan)){T({pairContext:c,preferLan:n});let e=at(c,n);y!==e&&x(e)}let E=(0,Q.useCallback)(e=>{a.current=!0,x(e)},[]),O=(0,Q.useCallback)(()=>{let e=at(c,n);e&&(a.current=!0,x(e))},[c,n]),k=(0,Q.useCallback)(e=>{let t=e.trim();t&&(a.current=!0,x(t))},[]),A=(0,Q.useCallback)(e=>{a.current=!1,x(e?.trim()||at(c,n))},[c,n]),j=y.trim(),N=(0,Q.useMemo)(()=>{try{let e=new URL(j);return e.protocol===`http:`||e.protocol===`https:`}catch{return!1}},[j]),P=N&&s(j),F=!f&&!!(c&&!c.pairingReady&&c.blockReason===`GATEWAY_LOOPBACK_ONLY`),I=!f&&N&&!P&&!!_?.pairingSecret&&(c?.pairingReady===!0||!F),L=(0,Q.useMemo)(()=>{let e=rt(c);return n?e||(j&&!it(c,j)?j:``):j},[c,n,j]),R=(0,Q.useMemo)(()=>{if(!e)return``;if(S.trim())return S.trim();if(f&&h?.qrPayload?.trim())return h.qrPayload.trim();if(!I||!_?.pairingSecret)return``;let t=c?.candidates.find(e=>e.kind===`tunnel`&&e.reachable),r=c?.candidates.find(e=>e.kind===`lan`&&e.reachable),i=n?L:t?.url??j;return i?u({baseUrl:i,pairingSecret:_.pairingSecret,lanUrl:n?null:t&&r?r.url:null}):``},[e,L,_?.pairingSecret,I,S,n,j,f,h?.qrPayload,c?.candidates]),z=D(()=>nt(R),[R],{enabled:!!R,initial:null,errorData:null}),B=R?z.data:null,V=!!(R&&z.error!==null&&!z.loading);return{tunnelActive:d,tunnelStatus:o,tunnelQr:h,pairContext:c,pairBaseUrl:y,setPairBaseUrl:E,applySuggestedPairUrl:O,applyCandidateUrl:k,baseOk:N,localhostWarn:P,pairingBlocked:F,deepLink:R,qrPayload:R,qrDataUrl:B,qrGenFailed:V,encoding:!!(R&&!B&&!V),refreshQr:(0,Q.useCallback)(async e=>{if(e?.trim()){C(e.trim()),g({qrPayload:e.trim(),publicUrl:o?.publicUrl??``,lanUrl:h?.lanUrl??null},!1);return}C(``),await l(),f?await g():c?.pairingReady&&await v()},[v,l,g,c?.pairingReady,h?.lanUrl,o?.publicUrl,f]),resetPairBaseFromContext:A}}var st={actionError:null,starting:!1,stopping:!1,savingAutoStart:!1,consentOpen:!1,autoStartConfirmOpen:!1,releaseConfirmOpen:!1,releasing:!1,brokerSecretDraft:``,savingBrokerSecret:!1,brokerSecretNotice:null};function ct({embedded:e=!1}){let t=f(e=>e.language),n=a(t).tunnelSettings,r=o(e=>e.token),s=!!r,[c,l]=(0,Q.useReducer)(P,st),{actionError:u,starting:d,stopping:p,savingAutoStart:h,consentOpen:g,autoStartConfirmOpen:_,releaseConfirmOpen:y,releasing:b,brokerSecretDraft:x,savingBrokerSecret:S,brokerSecretNotice:C}=c,T=(0,Q.useRef)(null),E=ot(r??``),{data:D}=ne(s),{data:O,error:k,isLoading:j,mutate:M}=m(s?`tunnel-status`:null,ue,{refreshInterval:e=>d?1e3:e?.frpcDownload||e?.state===`connecting`||e?.state===`reconnecting`?2e3:6e4}),F=(0,Q.useMemo)(()=>{let e=D?.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 O?.config?.autoStart===!0},[D,O?.config?.autoStart]),I=(0,Q.useMemo)(()=>{let e=D?.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``},[D]),R=te(I),z=O?.registrationSecret?.source===`env`,B=O?.registrationSecret?.source===`missing`,V=O?.registrationSecret?.configured===!0;(0,Q.useEffect)(()=>{let e=()=>{M()};return window.addEventListener(`tunnel-status`,e),()=>window.removeEventListener(`tunnel-status`,e)},[M]);let H=(0,Q.useMemo)(()=>[n.consentBullet1,n.consentBullet2,n.consentBullet3],[n.consentBullet1,n.consentBullet2,n.consentBullet3]),U=(0,Q.useCallback)(async()=>{l({type:`patch`,patch:{actionError:null}}),l({type:`patch`,patch:{starting:!0}});try{let e=await A();await M(),Y(),await E.refreshQr(e.qrPayload)}catch(e){l({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{starting:!1}})}},[M,E.refreshQr]),W=(0,Q.useCallback)(()=>{if(!V){l({type:`patch`,patch:{actionError:n.brokerSecretRequiredBeforeStart}}),T.current?.scrollIntoView({behavior:`smooth`,block:`start`});return}if(O?.consentRequired){l({type:`patch`,patch:{consentOpen:!0}});return}U()},[V,O?.consentRequired,U,n.brokerSecretRequiredBeforeStart]),ee=(0,Q.useCallback)(async()=>{l({type:`patch`,patch:{consentOpen:!1}}),l({type:`patch`,patch:{actionError:null}});try{await w(),await Promise.all([M(),U()])}catch(e){l({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}},[M,U]),q=(0,Q.useCallback)(async()=>{l({type:`patch`,patch:{actionError:null}}),l({type:`patch`,patch:{stopping:!0}});try{await G(),await Promise.all([E.refreshQr(),M()]),Y()}catch(e){l({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{stopping:!1}})}},[M,E.refreshQr]),re=(0,Q.useCallback)(async e=>{l({type:`patch`,patch:{savingAutoStart:!0}}),l({type:`patch`,patch:{actionError:null}});try{await N({autoStart:e}),Y()}catch(e){l({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{savingAutoStart:!1}})}},[]),ie=(0,Q.useCallback)(()=>{if(F){re(!1);return}if(O?.consentRequired){l({type:`patch`,patch:{actionError:n.consentExpiredBanner}});return}if(!O?.canAutoStart){l({type:`patch`,patch:{actionError:n.autoStartHint}});return}l({type:`patch`,patch:{autoStartConfirmOpen:!0}})},[re,O?.canAutoStart,O?.consentRequired,n,F]),ae=(0,Q.useCallback)(async()=>{let e=x.trim();if(e){l({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await N({registrationSecret:e}),l({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretSaved}}),Y(),await M(),l({type:`patch`,patch:{actionError:null}})}catch(e){l({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{savingBrokerSecret:!1}})}}},[x,M,n.brokerSecretSaved]),J=(0,Q.useCallback)(async()=>{l({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await N({registrationSecret:null}),l({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretCleared}}),Y(),await M()}catch(e){l({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{savingBrokerSecret:!1}})}},[M,n.brokerSecretCleared]),oe=(0,Q.useCallback)(async()=>{l({type:`patch`,patch:{releaseConfirmOpen:!1,actionError:null,releasing:!0}});try{await G({release:!0}),await Promise.all([E.refreshQr(),M()]),Y()}catch(e){l({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{releasing:!1}})}},[M,E.refreshQr]),se=(0,Q.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:a(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]);if(!s)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 ce=O??{enabled:!1,state:`disconnected`,subdomain:null,publicUrl:null,connectedSince:null,frpcPid:null,lastHeartbeatAt:null,lastError:null,consentRequired:!0,config:{autoStart:F,brokerUrl:`https://frp.xopc.ai/api`}},le=O?.consentRequired&&(ce.enabled||F||O?.consent?.acceptedAt),de=(0,$.jsx)(Xe,{t:n,brokerSecretFromEnv:z,brokerSecretMissing:B,brokerSecretConfiguredInConfig:R,brokerSecretMaskedValue:R?I:``,brokerSecretDraft:x,savingBrokerSecret:S,brokerSecretNotice:C,copyFailedLabel:a(t).clipboard.copyFailed,onDraftChange:e=>l({type:`patch`,patch:{brokerSecretDraft:e}}),onSave:()=>void ae(),onClear:()=>void J(),sectionRef:T}),fe=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(je,{open:g,title:n.consentTitle,intro:n.consentIntro,bullets:H,checkboxLabel:n.consentCheckbox,confirmLabel:le?n.consentReconfirm:n.consentConfirm,cancelLabel:n.consentCancel,onConfirm:()=>void ee(),onCancel:()=>l({type:`patch`,patch:{consentOpen:!1}})},g?`consent-open`:`consent-closed`),(0,$.jsx)(v,{open:_,title:n.autoStartConfirmTitle,description:n.autoStartConfirmBody,confirmLabel:n.autoStartConfirmLabel,cancelLabel:n.consentCancel,onConfirm:()=>{l({type:`patch`,patch:{autoStartConfirmOpen:!1}}),re(!0)},onCancel:()=>l({type:`patch`,patch:{autoStartConfirmOpen:!1}})}),(0,$.jsx)(v,{open:y,title:n.releaseConfirmTitle,description:n.releaseConfirmBody,confirmLabel:n.releaseConfirmLabel,cancelLabel:n.consentCancel,destructive:!0,onConfirm:()=>void oe(),onCancel:()=>l({type:`patch`,patch:{releaseConfirmOpen:!1}})})]});return e?(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[u?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:u}):null,de,(0,$.jsx)(qe,{t:n,status:ce,isLoading:j,statusErr:k,starting:d,stopping:p,showConsentExpired:!!le,copyLabels:se,startDisabled:!V,startDisabledReason:V?void 0:n.brokerSecretRequiredBeforeStart,stepLabel:n.flowStepStart,onStart:W,onStop:()=>void q()}),(0,$.jsx)(De,{pairQr:E,gatewayToken:r??``,streamlined:!0,onRefreshQr:()=>void E.refreshQr()}),(0,$.jsxs)(ye,{showLabel:n.showOptions,hideLabel:n.hideOptions,children:[(0,$.jsxs)(`label`,{className:i(`flex items-center gap-3 text-sm text-fg`,!F&&!O?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:F,disabled:h||!F&&!O?.canAutoStart,onChange:ie}),n.autoStart]}),!O?.canAutoStart&&!F?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.autoStartHint}):null,ce.subdomain||ce.publicUrl?(0,$.jsxs)(`div`,{className:`space-y-2 border-t border-edge-subtle pt-4`,children:[(0,$.jsxs)(X,{type:`button`,variant:`secondary`,disabled:b||p,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>l({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[b?(0,$.jsx)(L,{className:`size-4 animate-spin`}):null,n.release]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint})]}):null]}),(0,$.jsx)(ye,{showLabel:n.showAdvanced,hideLabel:n.hideAdvanced,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-edge-subtle pt-4 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(K,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)($e,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]})}),fe]}):(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})]}),u?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:u}):null,de,(0,$.jsx)(qe,{t:n,status:ce,isLoading:j,statusErr:k,starting:d,stopping:p,showConsentExpired:!!le,copyLabels:se,startDisabled:!V,startDisabledReason:V?void 0:n.brokerSecretRequiredBeforeStart,onStart:W,onStop:()=>void q()}),(0,$.jsx)(De,{pairQr:E,gatewayToken:r??``}),ce.subdomain||ce.publicUrl?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,$.jsxs)(X,{type:`button`,variant:`secondary`,disabled:b||p,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>l({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[b?(0,$.jsx)(L,{className:`size-4 animate-spin`}):null,n.release]})}):null,ce.subdomain||ce.publicUrl?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.releaseHint}):null,(0,$.jsxs)(Se,{children:[(0,$.jsx)(`h2`,{className:`mb-3 text-sm font-semibold text-fg`,children:n.optionsTitle}),(0,$.jsxs)(`label`,{className:i(`flex items-center gap-3 text-sm text-fg`,!F&&!O?.canAutoStart?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-accent`,checked:F,disabled:h||!F&&!O?.canAutoStart,onChange:ie}),n.autoStart]}),!O?.canAutoStart&&!F?(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)(K,{className:`mt-0.5 size-4 shrink-0 text-accent`}),(0,$.jsx)(`span`,{children:n.brokerNote})]}),(0,$.jsx)($e,{language:t,label:n.brokerDocsLink,section:`public-tunnel`,className:`text-xs`})]}),fe]})}async function lt(){let e=await d(`/api/exposure/status`);if(!e.ok)throw Error(`Failed to load exposure status (${e.status})`);return await e.json()}async function ut(e=`serve`){let t=await d(`/api/exposure/tailscale/start`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({mode:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`Start failed (${t.status})`)}return await t.json()}async function dt(){let e=await d(`/api/exposure/tailscale/stop`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`Stop failed (${e.status})`)}return await e.json()}var ft=`https://tailscale.com/download`;function pt(e){let t=(0,Z.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`a`,{href:ft,target:`_blank`,rel:`noreferrer`,className:`font-medium text-accent hover:underline`,children:n}),t[0]=n,t[1]=r),r}function mt({embedded:e=!1}){let t=f(e=>e.language),n=a(t).remoteAccess.tailscale,r=(0,Q.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:a(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]),i=!!o(e=>e.token),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(null),{data:d,mutate:p,isLoading:h}=m(i?`exposure-status`:null,lt,{refreshInterval:3e4}),g=d?.tailscale.hostname,_=d?.tailscale.active===!0,v=d?.tailscale.cliAvailable!==!1,y=g?`https://${g}/`:null,b=(0,Q.useCallback)(async()=>{c(!0),u(null);try{await ut(`serve`),await p()}catch(e){u(e instanceof Error?e.message:String(e))}finally{c(!1)}},[p]),x=(0,Q.useCallback)(async()=>{c(!0),u(null);try{await dt(),await p()}catch(e){u(e instanceof Error?e.message:String(e))}finally{c(!1)}},[p]);if(!i)return null;let S=(0,$.jsxs)(`div`,{className:e?`space-y-4`:`mt-4 space-y-3`,children:[e?(0,$.jsxs)(`ol`,{className:`space-y-3 text-sm text-fg-muted`,children:[(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`1`}),(0,$.jsxs)(`span`,{children:[n.stepInstallBefore,(0,$.jsx)(pt,{label:n.stepInstallLink}),n.stepInstallAfter]})]}),(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`2`}),(0,$.jsx)(`span`,{children:n.stepEnable})]}),(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[(0,$.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`3`}),(0,$.jsx)(`span`,{children:n.stepCopy})]})]}):null,e&&d?.tailscale.cliAvailable===!1?(0,$.jsxs)(`p`,{className:`rounded-lg border border-amber-500/25 bg-amber-500/5 px-3 py-2 text-sm text-fg-muted`,children:[n.cliMissingIntro,` `,(0,$.jsx)(pt,{label:n.cliMissingDownloadLink}),n.cliMissingSuffix]}):null,h&&!d?(0,$.jsxs)(`div`,{className:`grid gap-3`,"aria-busy":`true`,children:[(0,$.jsx)(W,{className:`h-20 rounded-lg`}),(0,$.jsx)(W,{className:`h-20 rounded-lg`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(Se,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.statusLabel}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:_?n.statusActive:n.statusOff}),y?(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(V,{text:y,labels:r})}):null,l?(0,$.jsx)(`p`,{className:`mt-2 text-sm text-red-600 dark:text-red-400`,children:l}):null,(0,$.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:_?(0,$.jsxs)(X,{type:`button`,variant:`secondary`,disabled:s,onClick:()=>void x(),children:[s?(0,$.jsx)(L,{className:`mr-1 h-4 w-4 animate-spin`}):null,n.disableServe]}):(0,$.jsxs)(X,{type:`button`,disabled:s||!v,onClick:()=>void b(),children:[s?(0,$.jsx)(L,{className:`mr-1 h-4 w-4 animate-spin`}):(0,$.jsx)(me,{className:`mr-1 h-4 w-4`}),n.enableServe]})})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.hint}),(0,$.jsx)($e,{language:t,label:n.docsLink,section:`tailscale-serve`,className:`mt-2`})]})]});return e?S:(0,$.jsxs)(Se,{children:[(0,$.jsx)(be,{icon:K,title:n.title,subtitle:n.subtitle}),S]})}function ht(){let e=(0,Z.c)(26),t=f(_t),n=o(gt),r;e[0]===t?r=e[1]:(r=a(t),e[0]=t,e[1]=r);let i=r.remoteAccess.lan,s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s={preferLan:!0},e[2]=s):s=e[2];let c=ot(n??``,s),l;e[3]!==i.subtitle||e[4]!==i.title?(l=(0,$.jsx)(be,{icon:J,title:i.title,subtitle:i.subtitle}),e[3]=i.subtitle,e[4]=i.title,e[5]=l):l=e[5];let u;e[6]===i.body?u=e[7]:(u=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:i.body}),e[6]=i.body,e[7]=u);let d;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(x,{className:`size-3.5`,"aria-hidden":!0}),e[8]=d):d=e[8];let p;e[9]===i.link?p=e[10]:(p=(0,$.jsxs)(de,{to:`/settings/gateway`,className:`inline-flex items-center gap-1.5 text-sm font-medium text-accent hover:underline`,children:[i.link,d]}),e[9]=i.link,e[10]=p);let m;e[11]!==u||e[12]!==p?(m=(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[u,p]}),e[11]=u,e[12]=p,e[13]=m):m=e[13];let h;e[14]!==l||e[15]!==m?(h=(0,$.jsxs)(Se,{children:[l,m]}),e[14]=l,e[15]=m,e[16]=h):h=e[16];let g=n??``,_;e[17]===c?_=e[18]:(_=()=>void c.refreshQr(),e[17]=c,e[18]=_);let v;e[19]!==c||e[20]!==g||e[21]!==_?(v=(0,$.jsx)(De,{pairQr:c,gatewayToken:g,lanOnly:!0,onRefreshQr:_}),e[19]=c,e[20]=g,e[21]=_,e[22]=v):v=e[22];let y;return e[23]!==v||e[24]!==h?(y=(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[h,v]}),e[23]=v,e[24]=h,e[25]=y):y=e[25],y}function gt(e){return e.token}function _t(e){return e.language}function vt(e){let t=(0,Z.c)(30),{embedded:n}=e,r=n===void 0?!1:n,i=f(yt),o;t[0]===i?o=t[1]:(o=a(i),t[0]=i,t[1]=o);let s=o.remoteAccess.ssh,[c,l]=(0,Q.useState)(!1),u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=async()=>{await q(`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,p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(`pre`,{className:`overflow-x-auto rounded-lg border border-edge bg-surface 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]=p):p=t[3];let m,h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>void d(),h=(0,$.jsx)(O,{className:`mr-1 h-4 w-4`}),t[4]=m,t[5]=h):(m=t[4],h=t[5]);let g=c?s.copied:s.copy,_;t[6]===g?_=t[7]:(_=(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsxs)(X,{type:`button`,variant:`ghost`,onClick:m,children:[h,g]})}),t[6]=g,t[7]=_);let v;t[8]!==r||t[9]!==s.hint?(v=r?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:s.hint}):null,t[8]=r,t[9]=s.hint,t[10]=v):v=t[10];let y;t[11]!==_||t[12]!==v?(y=(0,$.jsxs)($.Fragment,{children:[p,_,v]}),t[11]=_,t[12]=v,t[13]=y):y=t[13];let b=y;if(r){let e;t[14]!==s.subtitle||t[15]!==s.title?(e=(0,$.jsx)(be,{icon:E,title:s.title,subtitle:s.subtitle}),t[14]=s.subtitle,t[15]=s.title,t[16]=e):e=t[16];let n;t[17]===b?n=t[18]:(n=(0,$.jsx)(`div`,{className:`mt-4 space-y-2`,children:b}),t[17]=b,t[18]=n);let r;return t[19]!==e||t[20]!==n?(r=(0,$.jsxs)(Se,{children:[e,n]}),t[19]=e,t[20]=n,t[21]=r):r=t[21],r}let x;t[22]!==s.subtitle||t[23]!==s.title?(x=(0,$.jsx)(be,{icon:E,title:s.title,subtitle:s.subtitle}),t[22]=s.subtitle,t[23]=s.title,t[24]=x):x=t[24];let S;t[25]===b?S=t[26]:(S=(0,$.jsx)(`div`,{className:`mt-4`,children:b}),t[25]=b,t[26]=S);let C;return t[27]!==x||t[28]!==S?(C=(0,$.jsxs)(Se,{children:[x,S]}),t[27]=x,t[28]=S,t[29]=C):C=t[29],C}function yt(e){return e.language}function bt(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(vt,{embedded:!0}),e[0]=t):t=e[0],t}function xt(e){switch(e){case`active`:return`bg-emerald-500/15 text-emerald-700 dark:text-emerald-400`;case`connecting`:return`bg-amber-500/15 text-amber-700 dark:text-amber-400`;default:return`bg-surface-hover text-fg-muted`}}function St(e){let t=(0,Z.c)(5),{label:n,kind:r}=e,a;t[0]===r?a=t[1]:(a=i(`rounded-full px-2 py-0.5 text-[11px] font-medium`,xt(r)),t[0]=r,t[1]=a);let o;return t[2]!==n||t[3]!==a?(o=(0,$.jsx)(`span`,{className:a,children:n}),t[2]=n,t[3]=a,t[4]=o):o=t[4],o}function Ct(e){let t=(0,Z.c)(32),{onOpenTab:n}=e,r=f(Et),s;t[0]===r?s=t[1]:(s=a(r),t[0]=r,t[1]=s);let c=s.remoteAccess.guide,l=!!o(Tt),u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u={refreshInterval:3e4},t[2]=u):u=t[2];let{data:d}=m(l?`exposure-status`:null,lt,u),p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p={refreshInterval:15e3},t[3]=p):p=t[3];let{data:h}=m(l?`tunnel-status`:null,ue,p),g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g={refreshInterval:6e4},t[4]=g):g=t[4];let{data:_}=m(l?`tunnel-pair-context`:null,M,g);if(!l)return null;let v=d?.tailscale.active===!0,y=h?.state,b=h?.enabled&&y===`connected`,x=h?.enabled&&(y===`connecting`||y===`reconnecting`||!!h?.startProgress||!!h?.frpcDownload),S=(_?.candidates??[]).some(wt),C=v?`active`:`off`,w=v?c.statusActive:c.statusOff,T;t[5]!==c.tailscaleCardTitle||t[6]!==C||t[7]!==w?(T={tab:`tailscale`,icon:K,title:c.tailscaleCardTitle,kind:C,statusLabel:w},t[5]=c.tailscaleCardTitle,t[6]=C,t[7]=w,t[8]=T):T=t[8];let D=b?`active`:x?`connecting`:`off`,O=b?c.statusActive:x?c.statusConnecting:c.statusOff,A;t[9]!==c.publicCardTitle||t[10]!==D||t[11]!==O?(A={tab:`public`,icon:k,title:c.publicCardTitle,kind:D,statusLabel:O},t[9]=c.publicCardTitle,t[10]=D,t[11]=O,t[12]=A):A=t[12];let j=S?`active`:`off`,N=S?c.statusActive:c.statusOff,P;t[13]!==c.reverseProxyCardTitle||t[14]!==j||t[15]!==N?(P={tab:`reverse-proxy`,icon:ce,title:c.reverseProxyCardTitle,kind:j,statusLabel:N},t[13]=c.reverseProxyCardTitle,t[14]=j,t[15]=N,t[16]=P):P=t[16];let F;t[17]!==c.sshCardStatus||t[18]!==c.sshCardTitle?(F={tab:`ssh`,icon:E,title:c.sshCardTitle,kind:`off`,statusLabel:c.sshCardStatus},t[17]=c.sshCardStatus,t[18]=c.sshCardTitle,t[19]=F):F=t[19];let I;t[20]!==c.lanCardStatus||t[21]!==c.lanCardTitle?(I={tab:`lan`,icon:J,title:c.lanCardTitle,kind:`off`,statusLabel:c.lanCardStatus},t[20]=c.lanCardStatus,t[21]=c.lanCardTitle,t[22]=I):I=t[22];let L;t[23]!==A||t[24]!==P||t[25]!==F||t[26]!==I||t[27]!==T?(L=[T,A,P,F,I],t[23]=A,t[24]=P,t[25]=F,t[26]=I,t[27]=T,t[28]=L):L=t[28];let R=L,z;return t[29]!==R||t[30]!==n?(z=(0,$.jsx)(`div`,{className:`grid gap-2 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:i(`flex items-start gap-3 rounded-xl bg-surface-base px-3 py-2.5 text-left shadow-surface transition-colors`,`hover:bg-surface-hover/50`,`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 rounded-lg bg-surface-hover/90 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)(St,{label:e.statusLabel,kind:e.kind})]})]},`${e.tab}-${e.title}`)})}),t[29]=R,t[30]=n,t[31]=z):z=t[31],z}function wt(e){return e.kind===`reverse-proxy`}function Tt(e){return e.token}function Et(e){return e.language}function Dt(e){let t=(0,Z.c)(26),{title:n,description:r,recommended:a,icon:o,onOpen:s,openLabel:c,recommendedLabel:l}=e,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=i(`group flex w-full flex-col rounded-2xl bg-surface-base px-4 py-4 text-left transition-colors`,`hover:bg-surface-hover/40`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),t[0]=u):u=t[0];let d;t[1]===o?d=t[2]:(d=(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover/90 text-fg-muted`,children:(0,$.jsx)(o,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}),t[1]=o,t[2]=d);let f;t[3]===n?f=t[4]:(f=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),t[3]=n,t[4]=f);let p;t[5]!==a||t[6]!==l?(p=a&&l?(0,$.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:l}):null,t[5]=a,t[6]=l,t[7]=p):p=t[7];let m;t[8]!==f||t[9]!==p?(m=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[f,p]}),t[8]=f,t[9]=p,t[10]=m):m=t[10];let g;t[11]===r?g=t[12]:(g=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:r}),t[11]=r,t[12]=g);let _;t[13]!==m||t[14]!==g?(_=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[m,g]}),t[13]=m,t[14]=g,t[15]=_):_=t[15];let v;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(h,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[16]=v):v=t[16];let y;t[17]!==d||t[18]!==_?(y=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[d,_,v]}),t[17]=d,t[18]=_,t[19]=y):y=t[19];let b;t[20]===c?b=t[21]:(b=(0,$.jsx)(`span`,{className:`mt-3 text-xs font-medium text-accent`,children:c}),t[20]=c,t[21]=b);let x;return t[22]!==s||t[23]!==b||t[24]!==y?(x=(0,$.jsxs)(`button`,{type:`button`,onClick:s,className:u,children:[y,b]}),t[22]=s,t[23]=b,t[24]=y,t[25]=x):x=t[25],x}function Ot(e){let t=(0,Z.c)(83),{onOpenTab:n}=e,r=f(jt),i;t[0]===r?i=t[1]:(i=a(r),t[0]=r,t[1]=i);let s=i.remoteAccess,c=s.guide,l=!!o(At),u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u={refreshInterval:3e4},t[2]=u):u=t[2];let{data:d}=m(l?`exposure-status`:null,lt,u),p;t[3]===d?.conflicts?p=t[4]:(p=d?.conflicts??[],t[3]=d?.conflicts,t[4]=p);let h=p;if(!l){let e;return t[5]===c.needToken?e=t[6]:(e=(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:c.needToken}),t[5]=c.needToken,t[6]=e),e}let g;t[7]===n?g=t[8]:(g=(0,$.jsx)(Ct,{onOpenTab:n}),t[7]=n,t[8]=g);let _;t[9]!==h||t[10]!==c.conflictsHint||t[11]!==c.conflictsTitle?(_=h.length>0?(0,$.jsxs)(`div`,{className:`rounded-xl border border-amber-500/30 bg-amber-500/5 px-4 py-3 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:c.conflictsTitle}),(0,$.jsx)(`p`,{className:`mt-1`,children:c.conflictsHint}),(0,$.jsx)(`ul`,{className:`mt-2 list-inside list-disc text-xs`,children:h.map(kt)})]}):null,t[9]=h,t[10]=c.conflictsHint,t[11]=c.conflictsTitle,t[12]=_):_=t[12];let v;t[13]===c.pickMethod?v=t[14]:(v=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:c.pickMethod}),t[13]=c.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]!==c.configure||t[18]!==c.recommended||t[19]!==c.tailscaleCardDesc||t[20]!==c.tailscaleCardTitle||t[21]!==y?(b=(0,$.jsx)(Dt,{icon:K,title:c.tailscaleCardTitle,description:c.tailscaleCardDesc,recommended:!0,recommendedLabel:c.recommended,openLabel:c.configure,onOpen:y}),t[17]=c.configure,t[18]=c.recommended,t[19]=c.tailscaleCardDesc,t[20]=c.tailscaleCardTitle,t[21]=y,t[22]=b):b=t[22];let x;t[23]===n?x=t[24]:(x=()=>n(`public`),t[23]=n,t[24]=x);let S;t[25]!==c.configure||t[26]!==c.publicCardDesc||t[27]!==c.publicCardTitle||t[28]!==x?(S=(0,$.jsx)(Dt,{icon:k,title:c.publicCardTitle,description:c.publicCardDesc,openLabel:c.configure,onOpen:x}),t[25]=c.configure,t[26]=c.publicCardDesc,t[27]=c.publicCardTitle,t[28]=x,t[29]=S):S=t[29];let C;t[30]===n?C=t[31]:(C=()=>n(`reverse-proxy`),t[30]=n,t[31]=C);let w;t[32]!==c.configure||t[33]!==c.reverseProxyCardDesc||t[34]!==c.reverseProxyCardTitle||t[35]!==C?(w=(0,$.jsx)(Dt,{icon:ce,title:c.reverseProxyCardTitle,description:c.reverseProxyCardDesc,openLabel:c.configure,onOpen:C}),t[32]=c.configure,t[33]=c.reverseProxyCardDesc,t[34]=c.reverseProxyCardTitle,t[35]=C,t[36]=w):w=t[36];let T;t[37]===n?T=t[38]:(T=()=>n(`ssh`),t[37]=n,t[38]=T);let D;t[39]!==c.configure||t[40]!==c.sshCardDesc||t[41]!==c.sshCardTitle||t[42]!==T?(D=(0,$.jsx)(Dt,{icon:E,title:c.sshCardTitle,description:c.sshCardDesc,openLabel:c.configure,onOpen:T}),t[39]=c.configure,t[40]=c.sshCardDesc,t[41]=c.sshCardTitle,t[42]=T,t[43]=D):D=t[43];let O;t[44]===n?O=t[45]:(O=()=>n(`lan`),t[44]=n,t[45]=O);let A;t[46]!==c.configure||t[47]!==c.lanCardDesc||t[48]!==c.lanCardTitle||t[49]!==O?(A=(0,$.jsx)(Dt,{icon:J,title:c.lanCardTitle,description:c.lanCardDesc,openLabel:c.configure,onOpen:O}),t[46]=c.configure,t[47]=c.lanCardDesc,t[48]=c.lanCardTitle,t[49]=O,t[50]=A):A=t[50];let j;t[51]!==S||t[52]!==w||t[53]!==D||t[54]!==A||t[55]!==b?(j=(0,$.jsxs)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:[b,S,w,D,A]}),t[51]=S,t[52]=w,t[53]=D,t[54]=A,t[55]=b,t[56]=j):j=t[56];let M;t[57]!==j||t[58]!==v?(M=(0,$.jsxs)(`div`,{children:[v,j]}),t[57]=j,t[58]=v,t[59]=M):M=t[59];let N;t[60]===c.oneAtATimeHint?N=t[61]:(N=(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:c.oneAtATimeHint}),t[60]=c.oneAtATimeHint,t[61]=N);let P;t[62]===s.advanced.proxyTitle?P=t[63]:(P=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:s.advanced.proxyTitle}),t[62]=s.advanced.proxyTitle,t[63]=P);let F;t[64]===s.advanced.proxyBody?F=t[65]:(F=(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:s.advanced.proxyBody}),t[64]=s.advanced.proxyBody,t[65]=F);let I;t[66]!==r||t[67]!==s.advanced.proxyDocs?(I=(0,$.jsx)($e,{language:r,label:s.advanced.proxyDocs,section:`advanced`,className:`mt-2`}),t[66]=r,t[67]=s.advanced.proxyDocs,t[68]=I):I=t[68];let L;t[69]!==P||t[70]!==F||t[71]!==I?(L=(0,$.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-4 py-3`,children:[P,F,I]}),t[69]=P,t[70]=F,t[71]=I,t[72]=L):L=t[72];let R;t[73]!==c.docsLink||t[74]!==r?(R=(0,$.jsx)($e,{language:r,label:c.docsLink}),t[73]=c.docsLink,t[74]=r,t[75]=R):R=t[75];let z;return t[76]!==M||t[77]!==N||t[78]!==L||t[79]!==R||t[80]!==g||t[81]!==_?(z=(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[g,_,M,N,L,R]}),t[76]=M,t[77]=N,t[78]=L,t[79]=R,t[80]=g,t[81]=_,t[82]=z):z=t[82],z}function kt(e){return(0,$.jsx)(`li`,{children:e.message},e.code)}function At(e){return e.token}function jt(e){return e.language}async function Mt(e){let t=await d(l(`/api/tunnel/pair/probe-public`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e})});if(!t.ok&&t.status!==400)throw Error(`Probe failed (${t.status})`);return await t.json()}async function Nt(e){await c(l(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{publicUrl:e??null}})})}function Pt(e){let t=e.split(`.`).map(e=>Number.parseInt(e,10));if(t.length!==4||t.some(e=>!Number.isFinite(e)))return!1;let[n,r]=t;return n===10||n===127||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168||n===100&&r>=64&&r<=127}function Ft(){return(0,Q.useMemo)(()=>{if(typeof window>`u`)return null;let{protocol:e,hostname:t,origin:n}=window.location;if(e!==`https:`&&e!==`http:`)return null;let r=t.toLowerCase();return!r||r===`localhost`||r===`127.0.0.1`||r===`::1`||r===`[::1]`||r.endsWith(`.local`)||r.endsWith(`.localhost`)||Pt(r)?null:n.toLowerCase().replace(/\/+$/,``)},[])}function It(){return i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,y,`dark:border-edge`)}function Lt(e){return(e?.candidates.find(e=>e.kind===`reverse-proxy`))?.url?.trim()||null}function Rt(e){return(e?.candidates.find(e=>e.kind===`lan`&&e.reachable))?.url?.trim()||null}function zt(){let e=f(e=>e.language),t=a(e).remoteAccess.reverseProxy,n=!!o(e=>e.token),r=Ft(),{mutate:s}=p(),{data:c,mutate:l}=m(n?`tunnel-pair-context`:null,M,{refreshInterval:6e4}),d=Lt(c),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)({busy:!1,result:null}),[y,b]=(0,Q.useState)({busy:!1,error:null});(0,Q.useEffect)(()=>{h||(d?g(d):r&&g(r))},[d,r,h]);let x=(0,Q.useMemo)(()=>h.trim()||(d??r??``),[d,r,h]),S=!d&&!!r&&x===r,C=Rt(c),{data:w,mutate:T}=m(n&&x?[`reverse-proxy-pair`,x]:null,()=>U(),{refreshInterval:4*6e4,revalidateOnFocus:!1}),E=(0,Q.useMemo)(()=>!x||!w?.pairingSecret?``:u({baseUrl:x,pairingSecret:w.pairingSecret,lanUrl:C}),[x,C,w?.pairingSecret]),O=D(()=>nt(E),[E],{enabled:!!E,initial:null,errorData:null}),k=(0,Q.useCallback)(async()=>{let e=h.trim()||x;if(e){v({busy:!0,result:null});try{v({busy:!1,result:await Mt(e)})}catch(e){v({busy:!1,result:{ok:!1,code:`NETWORK_ERROR`,message:e instanceof Error?e.message:String(e)}})}}},[h,x]),A=(0,Q.useCallback)(async()=>{let e=x.trim();if(e){b({busy:!0,error:null});try{await Nt(e),await l(),await s(`tunnel-pair-context`),b({busy:!1,error:null})}catch(e){b({busy:!1,error:e instanceof Error?e.message:String(e)})}}},[x,s,l]),j=(0,Q.useCallback)(async()=>{b({busy:!0,error:null});try{await Nt(null),await l(),await s(`tunnel-pair-context`),g(``),v({busy:!1,result:null}),b({busy:!1,error:null})}catch(e){b({busy:!1,error:e instanceof Error?e.message:String(e)})}},[s,l]),N=(0,Q.useCallback)(async()=>{await T()},[T]);return n?(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(Se,{children:[(0,$.jsx)(be,{icon:K,title:t.title,subtitle:t.subtitle}),(0,$.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,$.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`reverse-proxy-url`,children:t.urlLabel}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch`,children:[(0,$.jsx)(`input`,{id:`reverse-proxy-url`,className:i(It(),`font-mono text-xs sm:flex-1 sm:min-w-0 sm:w-auto`),type:`text`,autoComplete:`off`,spellCheck:!1,placeholder:t.urlPlaceholder,value:h,onChange:e=>{g(e.target.value),v({busy:!1,result:null})}}),(0,$.jsxs)(X,{type:`button`,variant:`secondary`,className:`shrink-0 whitespace-nowrap`,onClick:()=>void k(),disabled:_.busy||!h.trim(),children:[_.busy?(0,$.jsx)(L,{className:`size-3.5 animate-spin`}):null,_.busy?t.probing:t.probeButton]})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:t.urlHint}),S&&r?(0,$.jsxs)(`div`,{className:`rounded-lg border border-accent/40 bg-accent-soft/50 px-3 py-2 text-xs leading-relaxed text-accent-fg`,children:[(0,$.jsx)(`div`,{className:`font-medium`,children:t.autoDetectedTitle}),(0,$.jsx)(`div`,{className:`mt-1 break-all font-mono text-[11px]`,children:r}),(0,$.jsx)(`p`,{className:`mt-1`,children:t.autoDetectedHint})]}):null,_.result?(0,$.jsx)(Bt,{result:_.result,labels:t.probeStatus}):null,(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[x&&d!==x?(0,$.jsxs)(X,{type:`button`,onClick:()=>void A(),disabled:y.busy,children:[y.busy?(0,$.jsx)(L,{className:`size-3.5 animate-spin`}):null,y.busy?t.saving:t.saveAsDefault]}):null,d?(0,$.jsx)(X,{type:`button`,variant:`ghost`,onClick:()=>void j(),disabled:y.busy,children:t.clear}):null]}),y.error?(0,$.jsx)(`p`,{className:`text-xs text-red-800 dark:text-red-200`,children:y.error}):null,(0,$.jsx)(`div`,{className:`rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs leading-relaxed text-amber-950 dark:border-amber-800/60 dark:bg-amber-950/30 dark:text-amber-100`,children:t.certWarning})]})]}),(0,$.jsxs)(Se,{children:[(0,$.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-start justify-between gap-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:t.qrTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.qrSubtitle})]}),E?(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`shrink-0`,onClick:()=>void N(),children:[(0,$.jsx)(re,{className:`size-4`}),t.refreshQr]}):null]}),x?w?.pairingSecret?(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-3 sm:items-start`,children:[(0,$.jsxs)(`div`,{className:`break-all font-mono text-[11px] text-fg-muted`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:`baseUrl:`}),` `,x,C?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`br`,{}),(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:`lanUrl:`}),` `,C]}):null]}),O.data?(0,$.jsx)(`img`,{src:O.data,alt:``,className:`size-56 rounded-lg border border-edge-subtle bg-white object-contain p-3 dark:border-edge`}):O.loading?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.encoding}):null,(0,$.jsx)(V,{text:E,labels:{copy:t.copyLink,copied:t.copied,copyFailed:a(e).clipboard.copyFailed}})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.mintingSecret}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noUrlYet})]})]}):null}function Bt(e){let t=(0,Z.c)(18),{result:n,labels:r}=e;if(n.ok){let e;t[0]===r.ok?e=t[1]:(e=(0,$.jsx)(`span`,{className:`font-medium`,children:r.ok}),t[0]=r.ok,t[1]=e);let i;t[2]===n.latencyMs?i=t[3]:(i=(0,$.jsxs)(`span`,{className:`font-mono`,children:[n.latencyMs,`ms`]}),t[2]=n.latencyMs,t[3]=i);let a;t[4]!==r.mobileReady||t[5]!==n.mobilePairing?(a=n.mobilePairing?(0,$.jsxs)($.Fragment,{children:[` · `,(0,$.jsx)(`span`,{children:r.mobileReady})]}):null,t[4]=r.mobileReady,t[5]=n.mobilePairing,t[6]=a):a=t[6];let o;return t[7]!==e||t[8]!==i||t[9]!==a?(o=(0,$.jsxs)(`div`,{className:`rounded-lg border border-emerald-200 bg-emerald-50 px-3 py-2 text-xs text-emerald-900 dark:border-emerald-800/60 dark:bg-emerald-950/30 dark:text-emerald-100`,children:[e,` · `,i,a]}),t[7]=e,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}let i=r[`code_${n.code}`]??r.codeUnknown,a;t[11]===i?a=t[12]:(a=(0,$.jsx)(`span`,{className:`font-medium`,children:i}),t[11]=i,t[12]=a);let o;t[13]===n.message?o=t[14]:(o=n.message?(0,$.jsxs)($.Fragment,{children:[` — `,(0,$.jsx)(`span`,{className:`font-mono break-all`,children:n.message})]}):null,t[13]=n.message,t[14]=o);let s;return t[15]!==a||t[16]!==o?(s=(0,$.jsxs)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-900 dark:border-red-800/60 dark:bg-red-950/30 dark:text-red-100`,children:[a,o]}),t[15]=a,t[16]=o,t[17]=s):s=t[17],s}var Vt=[`guide`,`tailscale`,`public`,`reverse-proxy`,`ssh`,`lan`];function Ht(e){return e&&Vt.includes(e)?e:`guide`}function Ut(e,t){return e.tabs[t]}function Wt(e,t){return e.tabIntro[t]}function Gt(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 Kt(e){let t=(0,Z.c)(7),{tab:n,onOpenTab:r}=e;switch(n){case`guide`:{let e;return t[0]===r?e=t[1]:(e=(0,$.jsx)(Ot,{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)(mt,{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)(ct,{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)(zt,{}),t[4]=e):e=t[4],e}case`ssh`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(bt,{}),t[5]=e):e=t[5],e}case`lan`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ht,{}),t[6]=e):e=t[6],e}}}function qt(){let e=(0,Z.c)(2),t=f(Yt),n=a(t).remoteAccess,r=!!o(Jt),[i,s]=C(),c=Ht(i.get(`tab`)),l;e[0]===s?l=e[1]:(l=e=>{s(t=>{let n=new URLSearchParams(t);return e===`guide`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[0]=s,e[1]=l);let u=l,d=Wt(n,c),p=Vt.map(e=>({id:e,label:Ut(n,e)}));return(0,$.jsxs)(ve,{children:[(0,$.jsx)(ge,{title:n.pageTitle,subtitle:n.pageSubtitle,meta:(0,$.jsx)($e,{language:t,label:n.docsLink,section:Gt(c),className:`mt-1`})}),r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(we,{items:p,activeTab:c,onChange:u,ariaLabel:n.tabsAria,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`}),(0,$.jsx)(_e,{id:c,activeTab:c,tabIdPrefix:`remote-access-tab`,panelIdPrefix:`remote-access-panel`,title:Ut(n,c),hint:c===`public`?void 0:d,children:(0,$.jsx)(Kt,{tab:c,onOpenTab:u})})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.guide.needToken})]})}function Jt(e){return e.token}function Yt(e){return e.language}export{qt as RemoteAccessHub};
|
|
@@ -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"./cn-BQ_8x0bT.js";import{t as a}from"./messages-
|
|
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"./cn-BQ_8x0bT.js";import{t as a}from"./messages-Bq4REfIj.js";import{c as o,n as s}from"./locale-store-Ba72bFmP.js";import{Us as c,wo as l}from"./index-DOetFpTt.js";var u=e(t(),1);function d(e,t){let n=!1,r=0,i=t;for(let t of e.values())t.dirty&&(n=!0,r+=1),t.saving&&(i=!0);return{anyDirty:n,dirtyCount:r,anySaving:i}}var f=o((e,t)=>({sections:new Map,saveAllInFlight:!1,anyDirty:!1,dirtyCount:0,anySaving:!1,registerSection:t=>{e(e=>{let n=new Map(e.sections);return n.set(t.id,t),{sections:n,...d(n,e.saveAllInFlight)}})},unregisterSection:t=>{e(e=>{if(!e.sections.has(t))return e;let n=new Map(e.sections);return n.delete(t),{sections:n,...d(n,e.saveAllInFlight)}})},saveAll:async()=>{let n=Array.from(t().sections.values()).filter(e=>e.dirty);if(n.length===0)return{ok:!0,saved:0,failures:[]};e(e=>({saveAllInFlight:!0,...d(e.sections,!0)}));let r=[],i=0;try{let e=await Promise.all(n.map(async e=>{try{let t=await e.save();return{id:e.id,result:t}}catch(t){return{id:e.id,result:{ok:!1,error:t instanceof Error?t.message:String(t)}}}}));for(let{id:t,result:n}of e)n.ok?i+=1:r.push({id:t,error:n.error??`Save failed`})}finally{e(e=>({saveAllInFlight:!1,...d(e.sections,!1)}))}return{ok:r.length===0,saved:i,failures:r}},discardAll:()=>{for(let e of t().sections.values())e.dirty&&e.discard()}}));function p({id:e,dirty:t,saving:n,save:r,discard:i}){let a=(0,u.useRef)(r),o=(0,u.useRef)(i);a.current=r,o.current=i;let s=f(e=>e.registerSection),c=f(e=>e.unregisterSection);(0,u.useEffect)(()=>(s({id:e,dirty:t,saving:n,save:async()=>{try{return await a.current(),{ok:!0}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}},discard:()=>o.current()}),()=>c(e)),[e,t,n,s,c])}var m=n(),h=r();function g(){let e=(0,m.c)(26),t=a(s(S)).modelsHub.saveBar,n=f(x),r=f(b),o=f(y),d=f(v),p=f(_),g;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=[],e[0]=g):g=e[0];let[C,w]=(0,u.useState)(g),[T,E]=(0,u.useState)(!1);if(!n&&C.length===0&&!T)return null;let D;e[1]===d?D=e[2]:(D=async()=>{w([]),E(!1);let e=await d();e.ok&&e.saved>0?(E(!0),window.setTimeout(()=>E(!1),2500)):e.ok||w(e.failures)},e[1]=d,e[2]=D);let O=D,k;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(k=i(`sticky top-0 z-10 -mx-4 flex flex-col gap-2 border-b border-edge-subtle bg-surface-base/85 px-4 py-2 backdrop-blur`,`sm:flex-row sm:items-center sm:justify-between`),e[3]=k):k=e[3];let A=C.length>0?(0,h.jsx)(`span`,{className:`text-xs text-red-600 dark:text-red-400`,role:`alert`,children:t.failuresSummary.replace(`{{count}}`,String(C.length))}):null,j=!n||r,M;e[4]===p?M=e[5]:(M=()=>p(),e[4]=p,e[5]=M);let N;e[6]!==t.discardAll||e[7]!==j||e[8]!==M?(N=(0,h.jsx)(l,{type:`button`,variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:j,onClick:M,children:t.discardAll}),e[6]=t.discardAll,e[7]=j,e[8]=M,e[9]=N):N=e[9];let P=!n||r,F;e[10]===O?F=e[11]:(F=()=>void O(),e[10]=O,e[11]=F);let I;e[12]===r?I=e[13]:(I=r?(0,h.jsx)(c,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,e[12]=r,e[13]=I);let L=r?`ml-1.5`:void 0,R;e[14]!==t.saveAll||e[15]!==L?(R=(0,h.jsx)(`span`,{className:L,children:t.saveAll}),e[14]=t.saveAll,e[15]=L,e[16]=R):R=e[16];let z;e[17]!==I||e[18]!==R||e[19]!==P||e[20]!==F?(z=(0,h.jsxs)(l,{type:`button`,variant:`primary`,className:`px-2.5 py-1.5 text-xs`,disabled:P,onClick:F,children:[I,R]}),e[17]=I,e[18]=R,e[19]=P,e[20]=F,e[21]=z):z=e[21];let B;return e[22]!==z||e[23]!==A||e[24]!==N?(B=(0,h.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[A,N,z]}),e[22]=z,e[23]=A,e[24]=N,e[25]=B):B=e[25],(0,h.jsxs)(`div`,{className:k,role:`region`,"aria-label":t.title,children:[(0,h.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?t.dirtySummary.replace(`{{count}}`,String(o)):T?t.savedSummary:t.cleanSummary}),B]})}function _(e){return e.discardAll}function v(e){return e.saveAll}function y(e){return e.dirtyCount}function b(e){return e.anySaving}function x(e){return e.anyDirty}function S(e){return e.language}export{p as n,g as t};
|
package/dist/gateway/static/root/assets/{schedule-field-Cb6R7iuP.js → schedule-field-BuajpVNF.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{t as i}from"./cn-BQ_8x0bT.js";import{Co as a,Do as o,To as s,io as c,no as l}from"./index-C4k6QSXw.js";import{n as u,t as d}from"./cron-expression-B3B1eqnr.js";var f=n(),p=e(t(),1),m=r(),h=Array.from({length:60},(e,t)=>t),g=i(s,`min-w-0 shrink text-xs sm:min-w-[7rem] sm:max-w-[11rem]`),_=i(`h-9 min-w-[6.5rem] shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1.5 text-sm text-fg`,a,`dark:bg-surface-panel`),v=i(`h-9 min-w-[9.5rem] shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1.5 text-sm text-fg`,a),y=i(`h-9 w-14 shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1.5 text-center text-sm tabular-nums text-fg`,a),b=i(`min-h-[2.5rem] w-full rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 font-mono text-xs text-fg`,a);function x(e){return{...e,intervalMinutesDraft:null,intervalHoursDraft:null}}function S(e){let{intervalMinutesDraft:t,intervalHoursDraft:n,...r}=e;return r}function C(e,t){switch(t.type){case`reset`:return x(t.state);case`replace`:return t.state}}function w({value:e,onChange:t,labels:n,disabled:r,showHeading:a=!0}){let o=(0,p.useMemo)(()=>u(e),[e]),[s,f]=(0,p.useReducer)(C,o,x),w=(0,p.useRef)(e);w.current!==e&&(w.current=e,f({type:`reset`,state:o}));let T=(0,p.useCallback)(e=>{let n={...s,...e};f({type:`replace`,state:n});let r=S(n),i=S(s);Object.keys(r).some(e=>r[e]!==i[e])&&t(d(r))},[t,s]),{mode:E,intervalKind:D,onceDate:O,intervalMinutes:k,intervalHours:A,minute:j,hour:M,weekDays:N,dayOfMonth:P,rawCron:F,intervalMinutesDraft:I,intervalHoursDraft:L}=s,R=`${String(M).padStart(2,`0`)}:${String(j).padStart(2,`0`)}`,z=e=>{let t=e.target.value;if(!t)return;let[n,r]=t.split(`:`).map(e=>parseInt(e,10));Number.isNaN(n)||Number.isNaN(r)||T({minute:r,hour:n})},B=(0,m.jsxs)(`div`,{className:`flex min-w-0 flex-nowrap items-center gap-2 overflow-x-auto pb-0.5`,children:[(0,m.jsxs)(l,{className:g,disabled:r,value:E,onChange:e=>{let t=e.target.value;T({mode:t})},"aria-label":n.scheduleTimeLabel,children:[(0,m.jsx)(c,{value:`no_repeat`,children:n.modeNoRepeat}),(0,m.jsx)(c,{value:`interval`,children:n.modeInterval}),(0,m.jsx)(c,{value:`hourly`,children:n.modeHourly}),(0,m.jsx)(c,{value:`daily`,children:n.modeDaily}),(0,m.jsx)(c,{value:`weekly`,children:n.modeWeekly}),(0,m.jsx)(c,{value:`monthly`,children:n.modeMonthly}),(0,m.jsx)(c,{value:`custom`,children:n.modeCustom})]}),E===`no_repeat`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`input`,{type:`date`,disabled:r,className:v,value:O,onChange:e=>{T({onceDate:e.target.value})},"aria-label":n.modeNoRepeat}),(0,m.jsx)(`input`,{type:`time`,step:60,disabled:r,className:_,value:R,onChange:z,"aria-label":n.scheduleTimeLabel})]}),E===`interval`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(l,{className:i(g,`w-auto min-w-[5rem]`),disabled:r,value:D,onChange:e=>{let t=e.target.value;T({intervalKind:t,intervalMinutesDraft:null,intervalHoursDraft:null})},"aria-label":n.modeInterval,children:[(0,m.jsx)(c,{value:`minutes`,children:n.intervalKindMinutes}),(0,m.jsx)(c,{value:`hours`,children:n.intervalKindHours})]}),D===`minutes`?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`input`,{type:`number`,min:1,max:59,disabled:r,className:y,value:I??String(k),onChange:e=>{let t=e.target.value,n=parseInt(t,10),r={intervalMinutesDraft:t};Number.isFinite(n)&&n>=1&&n<=59&&(r.intervalMinutes=n),T(r)},onBlur:()=>{if(I===null)return;let e=parseInt(I,10);T({intervalMinutes:!Number.isFinite(e)||e<1?5:Math.min(59,Math.max(1,Math.round(e))),intervalMinutesDraft:null})},"aria-label":n.intervalMinutes}),(0,m.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`input`,{type:`number`,min:1,max:23,disabled:r,className:y,value:L??String(A),onChange:e=>{let t=e.target.value,n=parseInt(t,10),r={intervalHoursDraft:t};Number.isFinite(n)&&n>=1&&n<=23&&(r.intervalHours=n),T(r)},onBlur:()=>{if(L===null)return;let e=parseInt(L,10);T({intervalHours:!Number.isFinite(e)||e<1?2:Math.min(23,Math.max(1,Math.round(e))),intervalHoursDraft:null})},"aria-label":n.intervalHours}),(0,m.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.hourUnit}),(0,m.jsx)(l,{className:i(g,`w-auto min-w-[4rem]`),disabled:r,value:j,onChange:e=>{T({minute:parseInt(e.target.value,10)})},"aria-label":n.minuteAtHour,children:h.map(e=>(0,m.jsx)(c,{value:e,children:String(e).padStart(2,`0`)},e))}),(0,m.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]})]}),E===`daily`&&(0,m.jsx)(`input`,{type:`time`,step:60,disabled:r,className:_,value:R,onChange:z,"aria-label":n.scheduleTimeLabel}),E===`weekly`&&(0,m.jsx)(`input`,{type:`time`,step:60,disabled:r,className:_,value:R,onChange:z,"aria-label":n.scheduleTimeLabel}),E===`monthly`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(l,{className:i(g,`w-auto min-w-[4.5rem]`),disabled:r,value:P,onChange:e=>{T({dayOfMonth:parseInt(e.target.value,10)})},"aria-label":n.dayOfMonth,children:Array.from({length:31},(e,t)=>t+1).map(e=>(0,m.jsx)(c,{value:e,children:e},e))}),(0,m.jsx)(`input`,{type:`time`,step:60,disabled:r,className:_,value:R,onChange:z,"aria-label":n.scheduleTimeLabel})]}),E===`hourly`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(l,{className:i(g,`w-auto min-w-[4rem]`),disabled:r,value:j,onChange:e=>{T({minute:parseInt(e.target.value,10)})},"aria-label":n.minuteAtHour,children:h.map(e=>(0,m.jsx)(c,{value:e,children:String(e).padStart(2,`0`)},e))}),(0,m.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]})]}),V=E===`weekly`?(0,m.jsx)(`div`,{className:`flex flex-wrap gap-1.5 pt-1`,role:`group`,"aria-label":n.modeWeekly,children:n.weekdays.map((e,t)=>{let n=N[t];return(0,m.jsx)(`button`,{type:`button`,disabled:r,className:i(`flex size-9 select-none items-center justify-center rounded-full border text-xs font-medium transition-colors`,n?`border-fg bg-fg text-surface-panel`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),"aria-pressed":n,onClick:()=>{let e=[...N];e[t]=!e[t],T({weekDays:e})},children:e},e)})}):null,H=E===`custom`?(0,m.jsxs)(`div`,{className:`pt-1`,children:[(0,m.jsx)(`textarea`,{disabled:r,className:b,rows:2,spellCheck:!1,value:F,placeholder:`*/5 * * * *`,onChange:e=>{T({rawCron:e.target.value})},"aria-label":n.modeCustom}),(0,m.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.customCronHint})]}):null;return(0,m.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a?(0,m.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.scheduleTimeLabel}):null,B,V,H]})}var T=[3e4,6e4,3e5,6e5,9e5,18e5,36e5,72e5],E=new Set(T),D=i(`h-9 min-w-0 flex-1 rounded-lg border border-edge-subtle bg-surface-panel px-2.5 py-1.5 text-sm tabular-nums text-fg`,a),O=i(s,`h-9 max-w-[11rem] shrink-0 text-xs sm:max-w-[12rem]`);function k(e,t){switch(e){case 3e4:return t.every30s;case 6e4:return t.every1min;case 3e5:return t.every5min;case 6e5:return t.every10min;case 9e5:return t.every15min;case 18e5:return t.every30min;case 36e5:return t.every1h;case 72e5:return t.every2h;default:return String(e)}}function A({valueMs:e,onChangeMs:t,labels:n,disabled:r,presets:i=T,minSeconds:a=1}){let o=(0,p.useMemo)(()=>new Set(i),[i]),s=(0,p.useMemo)(()=>o.has(e)?String(e):``,[o,e]),[u,d]=(0,p.useState)(null),f=(0,p.useRef)(e);f.current!==e&&(f.current=e,d(null));let h=Math.max(a,Math.round(e/1e3)),g=u===null?String(h):u;return(0,m.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,m.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.secondsLabel}),(0,m.jsxs)(`div`,{className:`flex gap-2`,children:[(0,m.jsx)(`input`,{type:`number`,min:a,step:1,disabled:r,className:D,value:g,onChange:e=>{let n=e.target.value;d(n);let r=parseInt(n,10);Number.isFinite(r)&&r>=a&&t(r*1e3)},onBlur:()=>{if(u===null)return;let e=parseInt(u,10);t(!Number.isFinite(e)||e<a?a*1e3:e*1e3),d(null)}}),(0,m.jsxs)(l,{className:O,disabled:r,value:s,onChange:e=>{let n=e.target.value;n&&(t(parseInt(n,10)),d(null))},children:[(0,m.jsx)(c,{value:``,children:n.presets.custom}),i.map(e=>(0,m.jsx)(c,{value:String(e),children:k(e,n.presets)},e))]})]})]})}var j=i(`mt-1 w-full rounded-lg border border-edge-subtle bg-surface-panel px-2.5 py-1.5 text-sm text-fg`,a),M=()=>({start:`09:00`,end:`22:00`,timezone:``});function N(e){let t=(0,f.c)(55),{value:n,onChange:r,labels:i,disabled:a}=e;if(!n){let e;t[0]===r?e=t[1]:(e=()=>r(M()),t[0]=r,t[1]=e);let n;return t[2]!==a||t[3]!==i.add||t[4]!==e?(n=(0,m.jsx)(o,{type:`button`,variant:`secondary`,className:`text-sm`,disabled:a,onClick:e,children:i.add}),t[2]=a,t[3]=i.add,t[4]=e,t[5]=n):n=t[5],n}let s;t[6]===i.start?s=t[7]:(s=(0,m.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:i.start}),t[6]=i.start,t[7]=s);let c;t[8]!==r||t[9]!==n?(c=e=>r({...n,start:e.target.value}),t[8]=r,t[9]=n,t[10]=c):c=t[10];let l;t[11]!==a||t[12]!==c||t[13]!==n.start?(l=(0,m.jsx)(`input`,{type:`time`,step:60,disabled:a,className:j,value:n.start,onChange:c}),t[11]=a,t[12]=c,t[13]=n.start,t[14]=l):l=t[14];let u;t[15]!==s||t[16]!==l?(u=(0,m.jsxs)(`label`,{className:`block min-w-0`,children:[s,l]}),t[15]=s,t[16]=l,t[17]=u):u=t[17];let d;t[18]===i.end?d=t[19]:(d=(0,m.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:i.end}),t[18]=i.end,t[19]=d);let p;t[20]!==r||t[21]!==n?(p=e=>r({...n,end:e.target.value}),t[20]=r,t[21]=n,t[22]=p):p=t[22];let h;t[23]!==a||t[24]!==p||t[25]!==n.end?(h=(0,m.jsx)(`input`,{type:`time`,step:60,disabled:a,className:j,value:n.end,onChange:p}),t[23]=a,t[24]=p,t[25]=n.end,t[26]=h):h=t[26];let g;t[27]!==d||t[28]!==h?(g=(0,m.jsxs)(`label`,{className:`block min-w-0`,children:[d,h]}),t[27]=d,t[28]=h,t[29]=g):g=t[29];let _;t[30]===i.timezone?_=t[31]:(_=(0,m.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:i.timezone}),t[30]=i.timezone,t[31]=_);let v;t[32]!==r||t[33]!==n?(v=e=>r({...n,timezone:e.target.value}),t[32]=r,t[33]=n,t[34]=v):v=t[34];let y;t[35]!==a||t[36]!==v||t[37]!==n.timezone?(y=(0,m.jsx)(`input`,{type:`text`,disabled:a,className:j,value:n.timezone,onChange:v,placeholder:`Asia/Shanghai`,autoComplete:`off`}),t[35]=a,t[36]=v,t[37]=n.timezone,t[38]=y):y=t[38];let b;t[39]!==y||t[40]!==_?(b=(0,m.jsxs)(`label`,{className:`block min-w-0`,children:[_,y]}),t[39]=y,t[40]=_,t[41]=b):b=t[41];let x;t[42]!==b||t[43]!==u||t[44]!==g?(x=(0,m.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[u,g,b]}),t[42]=b,t[43]=u,t[44]=g,t[45]=x):x=t[45];let S;t[46]===r?S=t[47]:(S=()=>r(null),t[46]=r,t[47]=S);let C;t[48]!==a||t[49]!==i.clear||t[50]!==S?(C=(0,m.jsx)(o,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:a,onClick:S,children:i.clear}),t[48]=a,t[49]=i.clear,t[50]=S,t[51]=C):C=t[51];let w;return t[52]!==x||t[53]!==C?(w=(0,m.jsxs)(`div`,{className:`space-y-2`,children:[x,C]}),t[52]=x,t[53]=C,t[54]=w):w=t[54],w}function P(e){let t=(0,f.c)(34),{disabled:n,label:r,hint:a,className:o}=e,s;t[0]===o?s=t[1]:(s=i(`flex flex-col gap-2`,o),t[0]=o,t[1]=s);let c;t[2]===r?c=t[3]:(c=r?(0,m.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r}):null,t[2]=r,t[3]=c);let l;t[4]!==n||t[5]!==r||t[6]!==e.kind||t[7]!==e.labels||t[8]!==e.onChange||t[9]!==e.value?(l=e.kind===`cron`?(0,m.jsx)(w,{value:e.value,onChange:e.onChange,labels:e.labels,disabled:n,showHeading:!r}):null,t[4]=n,t[5]=r,t[6]=e.kind,t[7]=e.labels,t[8]=e.onChange,t[9]=e.value,t[10]=l):l=t[10];let u;t[11]!==n||t[12]!==e.kind||t[13]!==e.labels||t[14]!==e.minSeconds||t[15]!==e.onChangeMs||t[16]!==e.presets||t[17]!==e.valueMs?(u=e.kind===`interval`?(0,m.jsx)(A,{valueMs:e.valueMs,onChangeMs:e.onChangeMs,labels:e.labels,disabled:n,presets:e.presets??T,minSeconds:e.minSeconds}):null,t[11]=n,t[12]=e.kind,t[13]=e.labels,t[14]=e.minSeconds,t[15]=e.onChangeMs,t[16]=e.presets,t[17]=e.valueMs,t[18]=u):u=t[18];let d;t[19]!==n||t[20]!==e.kind||t[21]!==e.labels||t[22]!==e.onChange||t[23]!==e.value?(d=e.kind===`active-hours`?(0,m.jsx)(N,{value:e.value,onChange:e.onChange,labels:e.labels,disabled:n}):null,t[19]=n,t[20]=e.kind,t[21]=e.labels,t[22]=e.onChange,t[23]=e.value,t[24]=d):d=t[24];let p;t[25]===a?p=t[26]:(p=a?(0,m.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:a}):null,t[25]=a,t[26]=p);let h;return t[27]!==s||t[28]!==c||t[29]!==l||t[30]!==u||t[31]!==d||t[32]!==p?(h=(0,m.jsxs)(`div`,{className:s,children:[c,l,u,d,p]}),t[27]=s,t[28]=c,t[29]=l,t[30]=u,t[31]=d,t[32]=p,t[33]=h):h=t[33],h}export{E as n,P as t};
|
|
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"./cn-BQ_8x0bT.js";import{$a as a,So as o,bo as s,to as c,wo as l}from"./index-DOetFpTt.js";import{n as u,t as d}from"./cron-expression-B3B1eqnr.js";var f=n(),p=e(t(),1),m=r(),h=Array.from({length:60},(e,t)=>t),g=i(o,`min-w-0 shrink text-xs sm:min-w-[7rem] sm:max-w-[11rem]`),_=i(`h-9 min-w-[6.5rem] shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1.5 text-sm text-fg`,s,`dark:bg-surface-panel`),v=i(`h-9 min-w-[9.5rem] shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1.5 text-sm text-fg`,s),y=i(`h-9 w-14 shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1.5 text-center text-sm tabular-nums text-fg`,s),b=i(`min-h-[2.5rem] w-full rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 font-mono text-xs text-fg`,s);function x(e){return{...e,intervalMinutesDraft:null,intervalHoursDraft:null}}function S(e){let{intervalMinutesDraft:t,intervalHoursDraft:n,...r}=e;return r}function C(e,t){switch(t.type){case`reset`:return x(t.state);case`replace`:return t.state}}function w({value:e,onChange:t,labels:n,disabled:r,showHeading:o=!0}){let s=(0,p.useMemo)(()=>u(e),[e]),[l,f]=(0,p.useReducer)(C,s,x),w=(0,p.useRef)(e);w.current!==e&&(w.current=e,f({type:`reset`,state:s}));let T=(0,p.useCallback)(e=>{let n={...l,...e};f({type:`replace`,state:n});let r=S(n),i=S(l);Object.keys(r).some(e=>r[e]!==i[e])&&t(d(r))},[t,l]),{mode:E,intervalKind:D,onceDate:O,intervalMinutes:k,intervalHours:A,minute:j,hour:M,weekDays:N,dayOfMonth:P,rawCron:F,intervalMinutesDraft:I,intervalHoursDraft:L}=l,R=`${String(M).padStart(2,`0`)}:${String(j).padStart(2,`0`)}`,z=e=>{let t=e.target.value;if(!t)return;let[n,r]=t.split(`:`).map(e=>parseInt(e,10));Number.isNaN(n)||Number.isNaN(r)||T({minute:r,hour:n})},B=(0,m.jsxs)(`div`,{className:`flex min-w-0 flex-nowrap items-center gap-2 overflow-x-auto pb-0.5`,children:[(0,m.jsxs)(a,{className:g,disabled:r,value:E,onChange:e=>{let t=e.target.value;T({mode:t})},"aria-label":n.scheduleTimeLabel,children:[(0,m.jsx)(c,{value:`no_repeat`,children:n.modeNoRepeat}),(0,m.jsx)(c,{value:`interval`,children:n.modeInterval}),(0,m.jsx)(c,{value:`hourly`,children:n.modeHourly}),(0,m.jsx)(c,{value:`daily`,children:n.modeDaily}),(0,m.jsx)(c,{value:`weekly`,children:n.modeWeekly}),(0,m.jsx)(c,{value:`monthly`,children:n.modeMonthly}),(0,m.jsx)(c,{value:`custom`,children:n.modeCustom})]}),E===`no_repeat`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`input`,{type:`date`,disabled:r,className:v,value:O,onChange:e=>{T({onceDate:e.target.value})},"aria-label":n.modeNoRepeat}),(0,m.jsx)(`input`,{type:`time`,step:60,disabled:r,className:_,value:R,onChange:z,"aria-label":n.scheduleTimeLabel})]}),E===`interval`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(a,{className:i(g,`w-auto min-w-[5rem]`),disabled:r,value:D,onChange:e=>{let t=e.target.value;T({intervalKind:t,intervalMinutesDraft:null,intervalHoursDraft:null})},"aria-label":n.modeInterval,children:[(0,m.jsx)(c,{value:`minutes`,children:n.intervalKindMinutes}),(0,m.jsx)(c,{value:`hours`,children:n.intervalKindHours})]}),D===`minutes`?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`input`,{type:`number`,min:1,max:59,disabled:r,className:y,value:I??String(k),onChange:e=>{let t=e.target.value,n=parseInt(t,10),r={intervalMinutesDraft:t};Number.isFinite(n)&&n>=1&&n<=59&&(r.intervalMinutes=n),T(r)},onBlur:()=>{if(I===null)return;let e=parseInt(I,10);T({intervalMinutes:!Number.isFinite(e)||e<1?5:Math.min(59,Math.max(1,Math.round(e))),intervalMinutesDraft:null})},"aria-label":n.intervalMinutes}),(0,m.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`input`,{type:`number`,min:1,max:23,disabled:r,className:y,value:L??String(A),onChange:e=>{let t=e.target.value,n=parseInt(t,10),r={intervalHoursDraft:t};Number.isFinite(n)&&n>=1&&n<=23&&(r.intervalHours=n),T(r)},onBlur:()=>{if(L===null)return;let e=parseInt(L,10);T({intervalHours:!Number.isFinite(e)||e<1?2:Math.min(23,Math.max(1,Math.round(e))),intervalHoursDraft:null})},"aria-label":n.intervalHours}),(0,m.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.hourUnit}),(0,m.jsx)(a,{className:i(g,`w-auto min-w-[4rem]`),disabled:r,value:j,onChange:e=>{T({minute:parseInt(e.target.value,10)})},"aria-label":n.minuteAtHour,children:h.map(e=>(0,m.jsx)(c,{value:e,children:String(e).padStart(2,`0`)},e))}),(0,m.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]})]}),E===`daily`&&(0,m.jsx)(`input`,{type:`time`,step:60,disabled:r,className:_,value:R,onChange:z,"aria-label":n.scheduleTimeLabel}),E===`weekly`&&(0,m.jsx)(`input`,{type:`time`,step:60,disabled:r,className:_,value:R,onChange:z,"aria-label":n.scheduleTimeLabel}),E===`monthly`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(a,{className:i(g,`w-auto min-w-[4.5rem]`),disabled:r,value:P,onChange:e=>{T({dayOfMonth:parseInt(e.target.value,10)})},"aria-label":n.dayOfMonth,children:Array.from({length:31},(e,t)=>t+1).map(e=>(0,m.jsx)(c,{value:e,children:e},e))}),(0,m.jsx)(`input`,{type:`time`,step:60,disabled:r,className:_,value:R,onChange:z,"aria-label":n.scheduleTimeLabel})]}),E===`hourly`&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(a,{className:i(g,`w-auto min-w-[4rem]`),disabled:r,value:j,onChange:e=>{T({minute:parseInt(e.target.value,10)})},"aria-label":n.minuteAtHour,children:h.map(e=>(0,m.jsx)(c,{value:e,children:String(e).padStart(2,`0`)},e))}),(0,m.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]})]}),V=E===`weekly`?(0,m.jsx)(`div`,{className:`flex flex-wrap gap-1.5 pt-1`,role:`group`,"aria-label":n.modeWeekly,children:n.weekdays.map((e,t)=>{let n=N[t];return(0,m.jsx)(`button`,{type:`button`,disabled:r,className:i(`flex size-9 select-none items-center justify-center rounded-full border text-xs font-medium transition-colors`,n?`border-fg bg-fg text-surface-panel`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),"aria-pressed":n,onClick:()=>{let e=[...N];e[t]=!e[t],T({weekDays:e})},children:e},e)})}):null,H=E===`custom`?(0,m.jsxs)(`div`,{className:`pt-1`,children:[(0,m.jsx)(`textarea`,{disabled:r,className:b,rows:2,spellCheck:!1,value:F,placeholder:`*/5 * * * *`,onChange:e=>{T({rawCron:e.target.value})},"aria-label":n.modeCustom}),(0,m.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.customCronHint})]}):null;return(0,m.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[o?(0,m.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.scheduleTimeLabel}):null,B,V,H]})}var T=[3e4,6e4,3e5,6e5,9e5,18e5,36e5,72e5],E=new Set(T),D=i(`h-9 min-w-0 flex-1 rounded-lg border border-edge-subtle bg-surface-panel px-2.5 py-1.5 text-sm tabular-nums text-fg`,s),O=i(o,`h-9 max-w-[11rem] shrink-0 text-xs sm:max-w-[12rem]`);function k(e,t){switch(e){case 3e4:return t.every30s;case 6e4:return t.every1min;case 3e5:return t.every5min;case 6e5:return t.every10min;case 9e5:return t.every15min;case 18e5:return t.every30min;case 36e5:return t.every1h;case 72e5:return t.every2h;default:return String(e)}}function A({valueMs:e,onChangeMs:t,labels:n,disabled:r,presets:i=T,minSeconds:o=1}){let s=(0,p.useMemo)(()=>new Set(i),[i]),l=(0,p.useMemo)(()=>s.has(e)?String(e):``,[s,e]),[u,d]=(0,p.useState)(null),f=(0,p.useRef)(e);f.current!==e&&(f.current=e,d(null));let h=Math.max(o,Math.round(e/1e3)),g=u===null?String(h):u;return(0,m.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,m.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.secondsLabel}),(0,m.jsxs)(`div`,{className:`flex gap-2`,children:[(0,m.jsx)(`input`,{type:`number`,min:o,step:1,disabled:r,className:D,value:g,onChange:e=>{let n=e.target.value;d(n);let r=parseInt(n,10);Number.isFinite(r)&&r>=o&&t(r*1e3)},onBlur:()=>{if(u===null)return;let e=parseInt(u,10);t(!Number.isFinite(e)||e<o?o*1e3:e*1e3),d(null)}}),(0,m.jsxs)(a,{className:O,disabled:r,value:l,onChange:e=>{let n=e.target.value;n&&(t(parseInt(n,10)),d(null))},children:[(0,m.jsx)(c,{value:``,children:n.presets.custom}),i.map(e=>(0,m.jsx)(c,{value:String(e),children:k(e,n.presets)},e))]})]})]})}var j=i(`mt-1 w-full rounded-lg border border-edge-subtle bg-surface-panel px-2.5 py-1.5 text-sm text-fg`,s),M=()=>({start:`09:00`,end:`22:00`,timezone:``});function N(e){let t=(0,f.c)(55),{value:n,onChange:r,labels:i,disabled:a}=e;if(!n){let e;t[0]===r?e=t[1]:(e=()=>r(M()),t[0]=r,t[1]=e);let n;return t[2]!==a||t[3]!==i.add||t[4]!==e?(n=(0,m.jsx)(l,{type:`button`,variant:`secondary`,className:`text-sm`,disabled:a,onClick:e,children:i.add}),t[2]=a,t[3]=i.add,t[4]=e,t[5]=n):n=t[5],n}let o;t[6]===i.start?o=t[7]:(o=(0,m.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:i.start}),t[6]=i.start,t[7]=o);let s;t[8]!==r||t[9]!==n?(s=e=>r({...n,start:e.target.value}),t[8]=r,t[9]=n,t[10]=s):s=t[10];let c;t[11]!==a||t[12]!==s||t[13]!==n.start?(c=(0,m.jsx)(`input`,{type:`time`,step:60,disabled:a,className:j,value:n.start,onChange:s}),t[11]=a,t[12]=s,t[13]=n.start,t[14]=c):c=t[14];let u;t[15]!==o||t[16]!==c?(u=(0,m.jsxs)(`label`,{className:`block min-w-0`,children:[o,c]}),t[15]=o,t[16]=c,t[17]=u):u=t[17];let d;t[18]===i.end?d=t[19]:(d=(0,m.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:i.end}),t[18]=i.end,t[19]=d);let p;t[20]!==r||t[21]!==n?(p=e=>r({...n,end:e.target.value}),t[20]=r,t[21]=n,t[22]=p):p=t[22];let h;t[23]!==a||t[24]!==p||t[25]!==n.end?(h=(0,m.jsx)(`input`,{type:`time`,step:60,disabled:a,className:j,value:n.end,onChange:p}),t[23]=a,t[24]=p,t[25]=n.end,t[26]=h):h=t[26];let g;t[27]!==d||t[28]!==h?(g=(0,m.jsxs)(`label`,{className:`block min-w-0`,children:[d,h]}),t[27]=d,t[28]=h,t[29]=g):g=t[29];let _;t[30]===i.timezone?_=t[31]:(_=(0,m.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:i.timezone}),t[30]=i.timezone,t[31]=_);let v;t[32]!==r||t[33]!==n?(v=e=>r({...n,timezone:e.target.value}),t[32]=r,t[33]=n,t[34]=v):v=t[34];let y;t[35]!==a||t[36]!==v||t[37]!==n.timezone?(y=(0,m.jsx)(`input`,{type:`text`,disabled:a,className:j,value:n.timezone,onChange:v,placeholder:`Asia/Shanghai`,autoComplete:`off`}),t[35]=a,t[36]=v,t[37]=n.timezone,t[38]=y):y=t[38];let b;t[39]!==y||t[40]!==_?(b=(0,m.jsxs)(`label`,{className:`block min-w-0`,children:[_,y]}),t[39]=y,t[40]=_,t[41]=b):b=t[41];let x;t[42]!==b||t[43]!==u||t[44]!==g?(x=(0,m.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[u,g,b]}),t[42]=b,t[43]=u,t[44]=g,t[45]=x):x=t[45];let S;t[46]===r?S=t[47]:(S=()=>r(null),t[46]=r,t[47]=S);let C;t[48]!==a||t[49]!==i.clear||t[50]!==S?(C=(0,m.jsx)(l,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:a,onClick:S,children:i.clear}),t[48]=a,t[49]=i.clear,t[50]=S,t[51]=C):C=t[51];let w;return t[52]!==x||t[53]!==C?(w=(0,m.jsxs)(`div`,{className:`space-y-2`,children:[x,C]}),t[52]=x,t[53]=C,t[54]=w):w=t[54],w}function P(e){let t=(0,f.c)(34),{disabled:n,label:r,hint:a,className:o}=e,s;t[0]===o?s=t[1]:(s=i(`flex flex-col gap-2`,o),t[0]=o,t[1]=s);let c;t[2]===r?c=t[3]:(c=r?(0,m.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r}):null,t[2]=r,t[3]=c);let l;t[4]!==n||t[5]!==r||t[6]!==e.kind||t[7]!==e.labels||t[8]!==e.onChange||t[9]!==e.value?(l=e.kind===`cron`?(0,m.jsx)(w,{value:e.value,onChange:e.onChange,labels:e.labels,disabled:n,showHeading:!r}):null,t[4]=n,t[5]=r,t[6]=e.kind,t[7]=e.labels,t[8]=e.onChange,t[9]=e.value,t[10]=l):l=t[10];let u;t[11]!==n||t[12]!==e.kind||t[13]!==e.labels||t[14]!==e.minSeconds||t[15]!==e.onChangeMs||t[16]!==e.presets||t[17]!==e.valueMs?(u=e.kind===`interval`?(0,m.jsx)(A,{valueMs:e.valueMs,onChangeMs:e.onChangeMs,labels:e.labels,disabled:n,presets:e.presets??T,minSeconds:e.minSeconds}):null,t[11]=n,t[12]=e.kind,t[13]=e.labels,t[14]=e.minSeconds,t[15]=e.onChangeMs,t[16]=e.presets,t[17]=e.valueMs,t[18]=u):u=t[18];let d;t[19]!==n||t[20]!==e.kind||t[21]!==e.labels||t[22]!==e.onChange||t[23]!==e.value?(d=e.kind===`active-hours`?(0,m.jsx)(N,{value:e.value,onChange:e.onChange,labels:e.labels,disabled:n}):null,t[19]=n,t[20]=e.kind,t[21]=e.labels,t[22]=e.onChange,t[23]=e.value,t[24]=d):d=t[24];let p;t[25]===a?p=t[26]:(p=a?(0,m.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:a}):null,t[25]=a,t[26]=p);let h;return t[27]!==s||t[28]!==c||t[29]!==l||t[30]!==u||t[31]!==d||t[32]!==p?(h=(0,m.jsxs)(`div`,{className:s,children:[c,l,u,d,p]}),t[27]=s,t[28]=c,t[29]=l,t[30]=u,t[31]=d,t[32]=p,t[33]=h):h=t[33],h}export{E as n,P as t};
|