@xopcai/xopc 0.0.141 → 0.0.142
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BRTCpm3t.js → agent-avatar-dicebear-BawPxiu5.js} +1 -1
- package/dist/gateway/static/root/assets/agents-CyvCIHnB.js +2 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DaMMZBAT.js → app-management-settings-panel-81xd1p9R.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BXHThPyM.js → appearance-settings-DYeQsYU8.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-B4omjLxa.js → apps-page-DK_Vx6nl.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-izB-4N4L.js → archive-plugin-D_oa7oti.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CJihXa5y.js → attachment-load-Cd-bwI2N.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-fgtj5Gek.js → automation-suggestion-card-B1LV3YYv.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-fzrovqhv.js +4 -0
- package/dist/gateway/static/root/assets/{binary-plugins-D3VUeG8s.js → binary-plugins-O8svLKWw.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-KnA0sLI3.js → block-editor-Dhj5f4Bx.js} +47 -47
- package/dist/gateway/static/root/assets/browser-settings-page-BDn-n-UB.js +8 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-D8rRNhc6.js → capability-presets-api-dJy1Eqgx.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-sCHojZr4.js → capability-presets-settings-panel-Co5ipo_Q.js} +1 -1
- package/dist/gateway/static/root/assets/{channel-recipient-api-BWgqwC5h.js → channel-recipient-api-Bfuhp2ty.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-BWlpaxg9.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-D_jkIZLV.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-BcekbW4q.js +2 -0
- package/dist/gateway/static/root/assets/{desktop-pet-CzdqX001.js → desktop-pet-DFMfIb5F.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DqqUPC7G.js → desktop-pet-settings-BJCUuL8Y.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-PzlO5tSM.js → directory-picker-path-field-BrYt1gAr.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-BmL54kQq.js → dreaming-settings-BN1Z2mIo.js} +3 -3
- package/dist/gateway/static/root/assets/{extension-debug-page-DcW8Ie3r.js → extension-debug-page-Bh630pLD.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DT5cpace.js → extension-page-B-1KxvVy.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CbMk4GhQ.js → extension-settings-page-BF9NACI3.js} +1 -1
- package/dist/gateway/static/root/assets/{fetch-06q5eCMA.js → fetch-B1WtuprY.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-4VXUJtLz.js → gateway-config-api-De2N821l.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-CdghmKHJ.js → gateway-settings-DN9sNREz.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-2f7_vsv7.js → gateway-startup-retry-nEujFSDj.js} +1 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-BpoQW8cD.js +1 -0
- package/dist/gateway/static/root/assets/goal-detail-page-CBRSPd0b.js +4 -0
- package/dist/gateway/static/root/assets/{goals-config-api-BpuQTufF.js → goals-config-api-DUy3eEse.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-BCcBi407.js +2 -0
- package/dist/gateway/static/root/assets/{goals-settings-CW1NwxvV.js → goals-settings-pkTXzXkh.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-C86k5tff.js → heartbeat-settings-ezsufgLQ.js} +1 -1
- package/dist/gateway/static/root/assets/{index-ehajXmqL.js → index-DcUaXYeb.js} +65 -65
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-CVIwwM15.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-DQtTRXtj.js +7 -0
- package/dist/gateway/static/root/assets/{markdown-split-zS4KLNAf.js → markdown-split-B_6us9j7.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-_BgNJ9_7.js → media-plugins-D_fryIyj.js} +1 -1
- package/dist/gateway/static/root/assets/messages-BXNELNBa.js +3 -0
- package/dist/gateway/static/root/assets/models-hub-panel-BP2M9n6Q.js +2 -0
- package/dist/gateway/static/root/assets/notes-page-CspveYaO.js +1 -0
- package/dist/gateway/static/root/assets/notes-workbench-BHwzJ0OC.js +2 -0
- package/dist/gateway/static/root/assets/{page-tabs-B7sGQkgU.js → page-tabs-D_8jGlqx.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-D1ri4s_O.js → preview-open-alternatives-BBLMK8Mp.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-Dy3rsobs.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-CWKpPE0L.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-CqNRyXEo.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-BClrOinh.js → save-bar-controls-DVS3FR5r.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-CL7YTwLV.js → schedule-field-D6vKd6-T.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-ww4PiIje.js → schema-form-BPy4lbIh.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-MEME7ivF.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-JVd0qaSF.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-D9gEEVm2.js → settings-collapsible-section-WzdikxPt.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-DGeEoBkb.js → settings-form-section-CvfzhBV-.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-BXUeMR37.js → settings-loading-skeleton-BxR-Ulhi.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-C5G2klUB.js → settings-page-DYEbB1EV.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-CEepfbCa.js → settings-page-layout-CKefvbYi.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-oQ8OLnw3.js → setup-status-panel-dWN8BJ3z.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-CXtDHMSi.js → share-preview-page-D8foINzP.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-Tgbv1s7G.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-D_YK0b_Z.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-DGytfoZK.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-W6MBJXrr.js → system-settings-panel-BokgAgf7.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-BkODXN7T.js → typed-models-lib-BwHlNL3L.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-CTbwLZXc.js → use-channel-catalog-DR11ap3A.js} +1 -1
- package/dist/gateway/static/root/assets/{user-profile-settings-panel-CeC308-E.js → user-profile-settings-panel-8YtygcJp.js} +1 -1
- package/dist/gateway/static/root/assets/{utils-ZxrKHxyb.js → utils-BKUWB-TT.js} +1 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-BVH71EFf.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-JeTE7XNM.js +1 -0
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-CL_rnAUB.js +3 -0
- package/dist/gateway/static/root/assets/{workflow-start-dialog-CtLTtNUB.js → workflow-start-dialog-_u8Uc1ze.js} +1 -1
- package/dist/gateway/static/root/assets/workflows-page-ixgk_y1l.js +18 -0
- package/dist/gateway/static/root/index.html +4 -4
- package/dist/package.js +1 -1
- package/dist/src/agent/embedded/session-runner.js +5 -5
- package/dist/src/agent/embedded/session-runner.js.map +1 -1
- package/dist/src/agent/embedded/xopc-auth-storage.d.ts +4 -3
- package/dist/src/agent/embedded/xopc-auth-storage.js +6 -6
- package/dist/src/agent/embedded/xopc-auth-storage.js.map +1 -1
- package/dist/src/agent/embedded/xopc-stream-bridge.js +1 -0
- package/dist/src/agent/embedded/xopc-stream-bridge.js.map +1 -1
- package/dist/src/agent/goals/checklist-judge.js +3 -3
- package/dist/src/agent/goals/checklist-judge.js.map +1 -1
- package/dist/src/agent/goals/judge.js +2 -2
- package/dist/src/agent/goals/judge.js.map +1 -1
- package/dist/src/agent/image/understanding/pi-ai-provider.js +2 -2
- package/dist/src/agent/image/understanding/pi-ai-provider.js.map +1 -1
- package/dist/src/agent/memory/compaction.js +2 -2
- package/dist/src/agent/memory/compaction.js.map +1 -1
- package/dist/src/agent/service/btw-query.d.ts +4 -0
- package/dist/src/agent/service/btw-query.js +94 -13
- package/dist/src/agent/service/btw-query.js.map +1 -1
- package/dist/src/agent/session/session-inspector.js +9 -1
- package/dist/src/agent/session/session-inspector.js.map +1 -1
- package/dist/src/agent/tools/session-search-tool.js +2 -2
- package/dist/src/agent/tools/session-search-tool.js.map +1 -1
- package/dist/src/agent/tools/web-extract.js +2 -2
- package/dist/src/agent/tools/web-extract.js.map +1 -1
- package/dist/src/ai-assist/text-assist.d.ts +2 -1
- package/dist/src/ai-assist/text-assist.js +10 -23
- package/dist/src/ai-assist/text-assist.js.map +1 -1
- package/dist/src/auth/credentials.js +5 -2
- package/dist/src/auth/credentials.js.map +1 -1
- package/dist/src/auth/oauth/github-copilot.d.ts +3 -4
- package/dist/src/auth/oauth/github-copilot.js +66 -2
- package/dist/src/auth/oauth/github-copilot.js.map +1 -0
- package/dist/src/auth/oauth/index.js +2 -2
- package/dist/src/automations/draft/automation-draft-service.js +3 -3
- package/dist/src/automations/draft/automation-draft-service.js.map +1 -1
- package/dist/src/chat-commands/builtins/review.js +22 -5
- package/dist/src/chat-commands/builtins/review.js.map +1 -1
- package/dist/src/chat-commands/types.d.ts +4 -0
- package/dist/src/gateway/hono/routes/models.js +1 -0
- package/dist/src/gateway/hono/routes/models.js.map +1 -1
- package/dist/src/gateway/hono/routes/voice.js +2 -2
- package/dist/src/gateway/hono/routes/voice.js.map +1 -1
- package/dist/src/goals/goal-contract-draft.js +2 -2
- package/dist/src/goals/goal-contract-draft.js.map +1 -1
- package/dist/src/goals/goal-evidence-review.js +2 -2
- package/dist/src/goals/goal-evidence-review.js.map +1 -1
- package/dist/src/notes/service.js +2 -2
- package/dist/src/notes/service.js.map +1 -1
- package/dist/src/providers/constants.d.ts +2 -0
- package/dist/src/providers/constants.js +11 -0
- package/dist/src/providers/constants.js.map +1 -0
- package/dist/src/providers/extension-stream-bridge.js +1 -0
- package/dist/src/providers/extension-stream-bridge.js.map +1 -1
- package/dist/src/providers/index.d.ts +3 -3
- package/dist/src/providers/index.js +5 -4
- package/dist/src/providers/index.js.map +1 -1
- package/dist/src/providers/model-call.d.ts +17 -0
- package/dist/src/providers/model-call.js +60 -0
- package/dist/src/providers/model-call.js.map +1 -0
- package/dist/src/session/session-title.js +2 -2
- package/dist/src/session/session-title.js.map +1 -1
- package/dist/src/voice/tts/summarize.js +2 -2
- package/dist/src/voice/tts/summarize.js.map +1 -1
- package/dist/src/workflows/draft/workflow-draft-service.js +2 -2
- package/dist/src/workflows/draft/workflow-draft-service.js.map +1 -1
- package/package.json +5 -5
- package/dist/gateway/static/root/assets/agents-Bd863Akz.js +0 -2
- package/dist/gateway/static/root/assets/automations-page-Dz2mgjIR.js +0 -4
- package/dist/gateway/static/root/assets/browser-settings-page-DZZz5v_i.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-UyVSnf9s.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-CB5FzcLf.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-BzhHiUO4.js +0 -2
- package/dist/gateway/static/root/assets/goal-create-dialog-CAlsM9MP.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-CLPa4F2y.js +0 -4
- package/dist/gateway/static/root/assets/goals-page-B2VpdzfH.js +0 -2
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-8xwKEhui.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-C_BMONOO.js +0 -7
- package/dist/gateway/static/root/assets/messages-B-8CqAeX.js +0 -3
- package/dist/gateway/static/root/assets/models-hub-panel-Do_cwNjF.js +0 -2
- package/dist/gateway/static/root/assets/notes-page-5IdlPHaX.js +0 -1
- package/dist/gateway/static/root/assets/notes-workbench-0KsRZJIZ.js +0 -2
- package/dist/gateway/static/root/assets/project-detail-page-Dk2zB1gy.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-CJQntm2G.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CHeZZg7O.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-9Hb_r0AG.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-PmzVFvAv.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BlNoairj.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BYV5x1KO.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-ClBcKQZP.js +0 -2
- package/dist/gateway/static/root/assets/voice-api-key-field-BE57S-nS.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-Di1ww5Aa.js +0 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-CzK84i-B.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-CZFZdua9.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-BXNELNBa.js";import{a as o,t as s}from"./fetch-B1WtuprY.js";import{n as c}from"./locale-store-Ba72bFmP.js";import{$i as l,Al as u,As as d,Ci as f,Dl as p,Es as m,Fs as h,Ga as g,Gc as _,Gi as v,Gs as y,Ic as b,Ja as x,Ji as S,Jo as C,Ka as w,Ki as T,Mo as E,Nc as D,Oc as O,Os as k,Pc as A,Ps as j,Qi as M,Qn as N,Si as P,St as F,Tc as I,Ua as L,Wa as R,Wo as z,Wr as B,Xa as V,Xi as H,Ya as ee,Yi as te,_a as ne,_i as re,_t as ie,a as ae,aa as oe,ar as se,ba as ce,bi as le,bn as ue,c as U,ca as de,cl as fe,d as pe,do as me,ea as he,es as ge,f as _e,fo as ve,gi as ye,gs as be,gt as xe,h as Se,hc as Ce,hi as we,i as Te,il as Ee,io as De,jl as Oe,jo as ke,js as Ae,kc as je,ko as W,la as Me,ls as Ne,lt as Pe,m as Fe,ma as Ie,mi as Le,mo as Re,na as ze,nl as Be,o as Ve,oa as He,oc as Ue,oo as We,pa as Ge,pi as Ke,po as qe,ps as Je,qa as Ye,qi as Xe,ra as Ze,s as Qe,sa as $e,sl as et,st as tt,ta as nt,tc as rt,u as G,ua as it,vi as at,vs as ot,wc as st,wl as ct,x as lt,xi as ut,xl as dt,yi as ft,yn as pt,yo as mt,yt as ht,z as gt,zc as _t}from"./index-DcUaXYeb.js";import{t as vt}from"./notes-workbench-BHwzJ0OC.js";import{t as yt}from"./page-tabs-D_8jGlqx.js";import{t as bt}from"./directory-picker-path-field-BrYt1gAr.js";import{t as xt}from"./goals-config-api-DUy3eEse.js";import{n as St,t as Ct}from"./goal-create-dialog-BpoQW8cD.js";import{t as wt}from"./workflow-start-dialog-_u8Uc1ze.js";var K=n(),q=e(t(),1),J=r(),Tt=`application/x-xopc-work-item`,Et=[`backlog`,`todo`,`in_progress`,`blocked`,`needs_input`,`in_review`,`done`],Dt=[`low`,`normal`,`high`,`urgent`];function Ot(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 kt(e){return e?new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(e)):``}function At(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 jt(e,t){return Ke(e,t)!==`unsupported`}function Mt(e,t){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:t===`image`||t===`audio`||t===`video`?t:`document`}function Nt(e,t){return{id:e.id,name:e.fileName,type:Mt(e.mimeType,e.type),mimeType:e.mimeType,size:e.size,...t?{content:t,preview:e.mimeType.startsWith(`image/`)?t:void 0}:{}}}async function Pt(e,t){let n=we(e.name||`upload`,e.type||`application/octet-stream`),r=Ge(await e.arrayBuffer());return{id:t,name:e.name||`upload`,type:Mt(n),mimeType:n,size:e.size,content:r,preview:n.startsWith(`image/`)?r:void 0}}function Ft(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 It(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(Se(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 Lt(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)(je,{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 Rt(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 zt(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}function Bt(e,t){return e.nextAction||e.blockedReason||e.description||t.noNextAction}function Vt(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,m=r&&`opacity-50`,g;t[3]===m?g=t[4]:(g=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`,m),t[3]=m,t[4]=g);let _=u?`border-success bg-success text-white`:`border-edge bg-surface-base hover:border-accent/50`,v;t[5]===_?v=t[6]:(v=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`,_),t[5]=_,t[6]=v);let y=u?l.markTodo:l.markDone,b=u?l.markTodo:l.markDone,x;t[7]!==n||t[8]!==o?(x=()=>o(n),t[7]=n,t[8]=o,t[9]=x):x=t[9];let S;t[10]===u?S=t[11]:(S=u?(0,J.jsx)(Be,{className:`size-3`,"aria-hidden":!0}):null,t[10]=u,t[11]=S);let C;t[12]!==S||t[13]!==v||t[14]!==y||t[15]!==b||t[16]!==x?(C=(0,J.jsx)(`button`,{type:`button`,className:v,"aria-label":y,title:b,onClick:x,children:S}),t[12]=S,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=C):C=t[17];let w;t[18]!==n||t[19]!==a?(w=()=>a(n),t[18]=n,t[19]=a,t[20]=w):w=t[20];let T;t[21]===n.title?T=t[22]:(T=(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]=T);let E;t[23]!==n||t[24]!==l?(E=Bt(n,l),t[23]=n,t[24]=l,t[25]=E):E=t[25];let O;t[26]===E?O=t[27]:(O=(0,J.jsx)(`p`,{className:`mt-2 max-w-full break-words text-xs leading-5 text-fg-muted line-clamp-1`,children:E}),t[26]=E,t[27]=O);let k;t[28]!==w||t[29]!==T||t[30]!==O?(k=(0,J.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 text-left`,onClick:w,children:[T,O]}),t[28]=w,t[29]=T,t[30]=O,t[31]=k):k=t[31];let A;t[32]!==C||t[33]!==k?(A=(0,J.jsxs)(`div`,{className:`flex min-w-0 max-w-full items-start gap-2`,children:[C,k]}),t[32]=C,t[33]=k,t[34]=A):A=t[34];let j;t[35]===n.status?j=t[36]:(j=i(`rounded-full px-2 py-0.5 text-[11px] font-medium`,Ot(n.status)),t[35]=n.status,t[36]=j);let M=l.statuses[n.status],N;t[37]!==j||t[38]!==M?(N=(0,J.jsx)(`span`,{className:j,children:M}),t[37]=j,t[38]=M,t[39]=N):N=t[39];let P=l.priorities[n.priority],F;t[40]===P?F=t[41]:(F=(0,J.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:P}),t[40]=P,t[41]=F);let I;t[42]===n.attachments?I=t[43]:(I=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)(h,{className:`size-3`,"aria-hidden":!0}),n.attachments.length]}):null,t[42]=n.attachments,t[43]=I);let L;t[44]===n.links?L=t[45]:(L=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]=L);let R=`/work-items/${encodeURIComponent(n.id)}`,z;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,J.jsx)(D,{className:`size-3`,"aria-hidden":!0}),t[46]=z):z=t[46];let B;t[47]!==l.detail.openItem||t[48]!==R?(B=(0,J.jsxs)(p,{to:R,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,z]}),t[47]=l.detail.openItem,t[48]=R,t[49]=B):B=t[49];let V;t[50]!==N||t[51]!==F||t[52]!==I||t[53]!==L||t[54]!==B?(V=(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:[N,F,I,L,B]}),t[50]=N,t[51]=F,t[52]=I,t[53]=L,t[54]=B,t[55]=V):V=t[55];let H;return t[56]!==c||t[57]!==l.dragToUpdate||t[58]!==d||t[59]!==A||t[60]!==V||t[61]!==g?(H=(0,J.jsxs)(`article`,{draggable:!0,onDragStart:d,onDragEnd:c,title:f,className:g,children:[A,V]}),t[56]=c,t[57]=l.dragToUpdate,t[58]=d,t[59]=A,t[60]=V,t[61]=g,t[62]=H):H=t[62],H}function Ht(){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 Ut(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=we(n.name||`upload`,n.type||`application/octet-stream`),d=jt(n.name||`upload`,u),f=Ft,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),h=n.name||`upload`,g=a||o,_;t[5]!==n||t[6]!==c?(_=()=>c(n),t[5]=n,t[6]=c,t[7]=_):_=t[7];let v;t[8]!==u||t[9]!==d||t[10]!==h||t[11]!==g||t[12]!==_||t[13]!==m?(v=(0,J.jsx)(Lt,{name:h,mimeType:u,thumbnailUrl:m,previewable:d,disabled:g,onOpen:_}),t[8]=u,t[9]=d,t[10]=h,t[11]=g,t[12]=_,t[13]=m,t[14]=v):v=t[14];let y=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`,b;t[15]===y?b=t[16]:(b=i(`min-w-0 flex-1 text-left`,y),t[15]=y,t[16]=b);let x=!d||a||o,S;t[17]!==n||t[18]!==c?(S=()=>c(n),t[17]=n,t[18]=c,t[19]=S):S=t[19];let C=n.name||`upload`,w;t[20]===C?w=t[21]:(w=(0,J.jsx)(`div`,{className:`truncate font-medium text-fg`,children:C}),t[20]=C,t[21]=w);let T;t[22]===n.size?T=t[23]:(T=At(n.size),t[22]=n.size,t[23]=T);let D;t[24]===T?D=t[25]:(D=(0,J.jsx)(`div`,{className:`text-xs text-fg-subtle`,children:T}),t[24]=T,t[25]=D);let O;t[26]!==S||t[27]!==w||t[28]!==D||t[29]!==b||t[30]!==x?(O=(0,J.jsxs)(`button`,{type:`button`,className:b,disabled:x,onClick:S,children:[w,D]}),t[26]=S,t[27]=w,t[28]=D,t[29]=b,t[30]=x,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)(E,{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]!==v?(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:[v,O,j]}),t[40]=O,t[41]=j,t[42]=v,t[43]=M):M=t[43],M}function Wt(e){let t=(0,K.c)(56),{item:n,attachment:r,busy:a,previewBusy:o,t:s,onOpen:c,onDownload:l,onRemove:u}=e,d;t[0]!==r.fileName||t[1]!==r.mimeType?(d=jt(r.fileName,r.mimeType),t[0]=r.fileName,t[1]=r.mimeType,t[2]=d):d=t[2];let f=d,p=It(n.id,r),m=a||o,h;t[3]!==r||t[4]!==n||t[5]!==c?(h=()=>c(n,r),t[3]=r,t[4]=n,t[5]=c,t[6]=h):h=t[6];let g;t[7]!==r.fileName||t[8]!==r.mimeType||t[9]!==f||t[10]!==m||t[11]!==h||t[12]!==p?(g=(0,J.jsx)(Lt,{name:r.fileName,mimeType:r.mimeType,thumbnailUrl:p,previewable:f,disabled:m,onOpen:h}),t[7]=r.fileName,t[8]=r.mimeType,t[9]=f,t[10]=m,t[11]=h,t[12]=p,t[13]=g):g=t[13];let _=f?`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`,v;t[14]===_?v=t[15]:(v=i(`min-w-0 flex-1 text-left`,_),t[14]=_,t[15]=v);let y=!f||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=At(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]!==v||t[29]!==y||t[30]!==x||t[31]!==S?(E=(0,J.jsxs)(`button`,{type:`button`,className:v,disabled:y,onClick:x,children:[S,T]}),t[27]=T,t[28]=v,t[29]=y,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)(b,{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]!==u?(A=()=>u(n,r),t[42]=r,t[43]=n,t[44]=u,t[45]=A):A=t[45];let j;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,J.jsx)(z,{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]!==g?(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:[g,E,k,M]}),t[51]=E,t[52]=k,t[53]=M,t[54]=g,t[55]=N):N=t[55],N}function Gt({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),[g,_]=(0,q.useState)(!1),[v,y]=(0,q.useState)(!1),[b,x]=(0,q.useState)(null),[S,C]=(0,q.useState)(null),w=o(e=>e.token),T=t?.attachments??[];function E(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 D(e){c(n.filter((t,n)=>n!==e))}async function O(e){let t=Y(e);C(`pending:${t}`);try{x(await Pt(e,`pending:${t}`)),y(!0)}catch(e){f(e instanceof Error?e.message:String(e))}finally{C(null)}}async function k(e,t){C(`saved:${t.id}`);try{let n=await s(Se(e.id,t.id));if(!n.ok)throw Error(`HTTP ${n.status}`);x(Nt(t,Ge(await n.arrayBuffer()))),y(!0)}catch(e){f(e instanceof Error?e.message:String(e))}finally{C(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`,g&&`border-accent bg-accent-soft/40`),onDragOver:e=>{e.preventDefault(),_(!0)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||_(!1)},onDrop:e=>{e.preventDefault(),_(!1),E(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)(h,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`truncate`,children:a.attachments.title})]}),(0,J.jsxs)(W,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:r,onClick:()=>p.current?.click(),children:[(0,J.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),a.attachments.add]}),(0,J.jsx)(`input`,{ref:p,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{E(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)(Ut,{file:e,index:t,busy:r,previewBusy:S===`pending:${Y(e)}`,t:a,onOpen:e=>void O(e),onRemove:D},Y(e)))}):null,t&&T.length?(0,J.jsx)(`div`,{className:`grid gap-2`,children:T.map(e=>(0,J.jsx)(Wt,{item:t,attachment:e,busy:r,previewBusy:S===`saved:${e.id}`,t:a,onOpen:(e,t)=>void k(e,t),onDownload:d,onRemove:u},e.id))}):null,!n.length&&!T.length?(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a.attachments.empty}):null]}),(0,J.jsx)(tt,{open:v,attachment:b,authToken:w,layerClassName:`z-[100]`,onClose:()=>{y(!1),x(null)}})]})}function Kt(e){let t=(0,K.c)(170),{mode:n,item:r,initialStatus:a,events:o,busy:s,error:c,notice:l,t:u,onClose:d,onCreate:f,onSave:h,onStartChat:_,onCreateGoal:v,onAddAttachments:b,onRemoveAttachment:S,onDownloadAttachment:T,onPreviewError:O}=e,k=n!==null,[A,j]=(0,q.useState)(``),[M,N]=(0,q.useState)(``),[P,F]=(0,q.useState)(`todo`),[I,z]=(0,q.useState)(`normal`),[B,V]=(0,q.useState)(``),[H,te]=(0,q.useState)(``),ne;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(ne=[],t[0]=ne):ne=t[0];let[re,ie]=(0,q.useState)(ne),ae,oe;t[1]!==a||t[2]!==r||t[3]!==n?(ae=()=>{if(n===`create`){j(``),N(``),F(a),z(`normal`),V(``),te(``),ie([]);return}n===`detail`&&r&&(j(r.title),N(r.description??``),F(r.status),z(r.priority),V(r.nextAction??``),te(r.blockedReason??``),ie([]))},oe=[a,r,n],t[1]=a,t[2]=r,t[3]=n,t[4]=ae,t[5]=oe):(ae=t[4],oe=t[5]),(0,q.useEffect)(ae,oe);let se;t[6]!==H||t[7]!==M||t[8]!==r||t[9]!==n||t[10]!==B||t[11]!==f||t[12]!==h||t[13]!==re||t[14]!==I||t[15]!==P||t[16]!==A?(se=function(e){e.preventDefault();let t=A.trim();if(t){if(n===`create`){f({title:t,description:M.trim()||void 0,priority:I,status:P,nextAction:B.trim()||void 0,blockedReason:H.trim()||void 0,attachments:re});return}r&&h(r,{title:t,description:M.trim()||null,status:P,priority:I,nextAction:B.trim()||null,blockedReason:H.trim()||null})}},t[6]=H,t[7]=M,t[8]=r,t[9]=n,t[10]=B,t[11]=f,t[12]=h,t[13]=re,t[14]=I,t[15]=P,t[16]=A,t[17]=se):se=t[17];let ce=se,le;t[18]===d?le=t[19]:(le=e=>!e&&d(),t[18]=d,t[19]=le);let ue;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,J.jsx)(w,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[20]=ue):ue=t[20];let U=n===`create`?u.create.title:r?.title||u.title,de;t[21]===U?de=t[22]:(de=(0,J.jsx)(ee,{className:`truncate text-base font-semibold text-fg`,children:U}),t[21]=U,t[22]=de);let fe;t[23]===u.detail.description?fe=t[24]:(fe=(0,J.jsx)(g,{className:`mt-1 text-sm text-fg-muted`,children:u.detail.description}),t[23]=u.detail.description,t[24]=fe);let pe;t[25]!==de||t[26]!==fe?(pe=(0,J.jsxs)(`div`,{className:`min-w-0`,children:[de,fe]}),t[25]=de,t[26]=fe,t[27]=pe):pe=t[27];let me;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,J.jsx)(E,{className:`size-4`,"aria-hidden":!0}),t[28]=me):me=t[28];let he;t[29]===s?he=t[30]:(he=(0,J.jsx)(L,{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:me})}),t[29]=s,t[30]=he);let ge;t[31]!==pe||t[32]!==he?(ge=(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[pe,he]}),t[31]=pe,t[32]=he,t[33]=ge):ge=t[33];let _e;t[34]===c?_e=t[35]:(_e=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]=_e);let ve;t[36]!==c||t[37]!==l?(ve=!c&&l?(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)(Be,{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:l.title}),(0,J.jsx)(`div`,{className:`mt-1 text-fg-muted`,children:l.message})]})]}):null,t[36]=c,t[37]=l,t[38]=ve):ve=t[38];let ye;t[39]===u.create.titleLabel?ye=t[40]:(ye=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:u.create.titleLabel}),t[39]=u.create.titleLabel,t[40]=ye);let be;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(be=e=>j(e.target.value),t[41]=be):be=t[41];let xe=n===`create`,Se;t[42]!==xe||t[43]!==A?(Se=(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:A,onChange:be,autoFocus:xe}),t[42]=xe,t[43]=A,t[44]=Se):Se=t[44];let Ce;t[45]!==ye||t[46]!==Se?(Ce=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[ye,Se]}),t[45]=ye,t[46]=Se,t[47]=Ce):Ce=t[47];let we;t[48]===u.detail.status?we=t[49]:(we=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:u.detail.status}),t[48]=u.detail.status,t[49]=we);let Te;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(Te=e=>F(e.target.value),t[50]=Te):Te=t[50];let Ee;t[51]===u.statuses?Ee=t[52]:(Ee=Et.map(e=>(0,J.jsx)(We,{value:e,children:u.statuses[e]},e)),t[51]=u.statuses,t[52]=Ee);let Oe;t[53]!==P||t[54]!==Ee?(Oe=(0,J.jsx)(De,{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:Te,children:Ee}),t[53]=P,t[54]=Ee,t[55]=Oe):Oe=t[55];let ke;t[56]!==we||t[57]!==Oe?(ke=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[we,Oe]}),t[56]=we,t[57]=Oe,t[58]=ke):ke=t[58];let Ae;t[59]===u.create.priorityLabel?Ae=t[60]:(Ae=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:u.create.priorityLabel}),t[59]=u.create.priorityLabel,t[60]=Ae);let je;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(je=e=>z(e.target.value),t[61]=je):je=t[61];let Me;t[62]===u.priorities?Me=t[63]:(Me=Dt.map(e=>(0,J.jsx)(We,{value:e,children:u.priorities[e]},e)),t[62]=u.priorities,t[63]=Me);let Ne;t[64]!==I||t[65]!==Me?(Ne=(0,J.jsx)(De,{className:`h-10 rounded-lg border border-edge bg-surface-base px-3 text-sm text-fg outline-none focus:border-accent`,value:I,onChange:je,children:Me}),t[64]=I,t[65]=Me,t[66]=Ne):Ne=t[66];let Pe;t[67]!==Ae||t[68]!==Ne?(Pe=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Ae,Ne]}),t[67]=Ae,t[68]=Ne,t[69]=Pe):Pe=t[69];let Fe;t[70]!==ke||t[71]!==Pe?(Fe=(0,J.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[ke,Pe]}),t[70]=ke,t[71]=Pe,t[72]=Fe):Fe=t[72];let Ie;t[73]===u.create.descriptionLabel?Ie=t[74]:(Ie=(0,J.jsx)(`span`,{className:`font-medium text-fg-muted`,children:u.create.descriptionLabel}),t[73]=u.create.descriptionLabel,t[74]=Ie);let Le;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(Le=e=>N(e.target.value),t[75]=Le):Le=t[75];let Re;t[76]===M?Re=t[77]:(Re=(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:M,onChange:Le}),t[76]=M,t[77]=Re);let ze;t[78]!==Ie||t[79]!==Re?(ze=(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[Ie,Re]}),t[78]=Ie,t[79]=Re,t[80]=ze):ze=t[80];let Ve;t[81]!==s||t[82]!==r||t[83]!==n||t[84]!==b||t[85]!==T||t[86]!==O||t[87]!==S||t[88]!==re||t[89]!==u?(Ve=(0,J.jsx)(Gt,{mode:n,item:r,pendingFiles:re,busy:s,t:u,onPendingFilesChange:ie,onUpload:b,onRemove:S,onDownload:T,onPreviewError:O}),t[81]=s,t[82]=r,t[83]=n,t[84]=b,t[85]=T,t[86]=O,t[87]=S,t[88]=re,t[89]=u,t[90]=Ve):Ve=t[90];let He;t[91]!==H||t[92]!==n||t[93]!==B||t[94]!==P||t[95]!==u.blockedReason||t[96]!==u.nextAction?(He=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:u.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:B,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`,P===`blocked`||P===`needs_input`?`text-red-700 dark:text-red-300`:`text-fg-muted`),children:u.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`,P===`blocked`||P===`needs_input`?`border-red-500/40`:`border-edge`),value:H,onChange:e=>te(e.target.value)})]})]}):null,t[91]=H,t[92]=n,t[93]=B,t[94]=P,t[95]=u.blockedReason,t[96]=u.nextAction,t[97]=He):He=t[97];let Ue;t[98]!==_e||t[99]!==ve||t[100]!==Ce||t[101]!==Fe||t[102]!==ze||t[103]!==Ve||t[104]!==He?(Ue=(0,J.jsxs)(`div`,{className:`grid content-start gap-4`,children:[_e,ve,Ce,Fe,ze,Ve,He]}),t[98]=_e,t[99]=ve,t[100]=Ce,t[101]=Fe,t[102]=ze,t[103]=Ve,t[104]=He,t[105]=Ue):Ue=t[105];let Ge;t[106]!==s||t[107]!==r||t[108]!==n||t[109]!==v||t[110]!==_||t[111]!==u.detail.actions||t[112]!==u.detail.createGoal||t[113]!==u.detail.openItem||t[114]!==u.detail.startChat?(Ge=n===`detail`&&r?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:u.detail.actions}),(0,J.jsxs)(`div`,{className:`mt-2 grid gap-2`,children:[(0,J.jsxs)(W,{type:`button`,variant:`secondary`,className:`justify-start rounded-lg`,disabled:s,onClick:()=>_(r),children:[(0,J.jsx)(y,{className:`size-4`,"aria-hidden":!0}),u.detail.startChat]}),(0,J.jsxs)(W,{type:`button`,variant:`secondary`,className:`justify-start rounded-lg`,disabled:s,onClick:()=>v(r),children:[(0,J.jsx)(C,{className:`size-4`,"aria-hidden":!0}),u.detail.createGoal]}),(0,J.jsx)(W,{asChild:!0,variant:`secondary`,className:`justify-start rounded-lg`,children:(0,J.jsxs)(p,{to:`/work-items/${encodeURIComponent(r.id)}`,children:[(0,J.jsx)(D,{className:`size-4`,"aria-hidden":!0}),u.detail.openItem]})})]})]}):null,t[106]=s,t[107]=r,t[108]=n,t[109]=v,t[110]=_,t[111]=u.detail.actions,t[112]=u.detail.createGoal,t[113]=u.detail.openItem,t[114]=u.detail.startChat,t[115]=Ge):Ge=t[115];let Ke;t[116]===u.detail.links?Ke=t[117]:(Ke=(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:u.detail.links}),t[116]=u.detail.links,t[117]=Ke);let qe;t[118]!==r||t[119]!==u.detail.noLinks||t[120]!==u.linkKinds?(qe=r?.links?.length?r.links.slice(0,6).map(e=>(0,J.jsxs)(p,{to:Rt(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:[u.linkKinds[e.kind],(0,J.jsx)(D,{className:`size-3.5`,"aria-hidden":!0})]})]},e.id)):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:u.detail.noLinks}),t[118]=r,t[119]=u.detail.noLinks,t[120]=u.linkKinds,t[121]=qe):qe=t[121];let Je;t[122]===qe?Je=t[123]:(Je=(0,J.jsx)(`div`,{className:`mt-2 grid gap-2 text-sm`,children:qe}),t[122]=qe,t[123]=Je);let Xe;t[124]!==Ke||t[125]!==Je?(Xe=(0,J.jsxs)(`section`,{children:[Ke,Je]}),t[124]=Ke,t[125]=Je,t[126]=Xe):Xe=t[126];let Ze;t[127]===u.detail.activity?Ze=t[128]:(Ze=(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:u.detail.activity}),t[127]=u.detail.activity,t[128]=Ze);let Qe;t[129]!==o||t[130]!==u.detail.noActivity||t[131]!==u.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:u.eventTypes[e.type]??e.type}),(0,J.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-subtle`,children:kt(e.createdAt)})]},e.id)):(0,J.jsx)(`p`,{className:`text-sm text-fg-muted`,children:u.detail.noActivity}),t[129]=o,t[130]=u.detail.noActivity,t[131]=u.eventTypes,t[132]=Qe):Qe=t[132];let $e;t[133]===Qe?$e=t[134]:($e=(0,J.jsx)(`div`,{className:`mt-2 grid gap-2`,children:Qe}),t[133]=Qe,t[134]=$e);let et;t[135]!==Ze||t[136]!==$e?(et=(0,J.jsxs)(`section`,{children:[Ze,$e]}),t[135]=Ze,t[136]=$e,t[137]=et):et=t[137];let tt;t[138]!==Ge||t[139]!==Xe||t[140]!==et?(tt=(0,J.jsxs)(`aside`,{className:`grid content-start gap-5`,children:[Ge,Xe,et]}),t[138]=Ge,t[139]=Xe,t[140]=et,t[141]=tt):tt=t[141];let nt;t[142]!==Ue||t[143]!==tt?(nt=(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:[Ue,tt]}),t[142]=Ue,t[143]=tt,t[144]=nt):nt=t[144];let rt;t[145]!==s||t[146]!==d||t[147]!==u.create.cancel?(rt=(0,J.jsx)(W,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:d,disabled:s,children:u.create.cancel}),t[145]=s,t[146]=d,t[147]=u.create.cancel,t[148]=rt):rt=t[148];let G;t[149]!==s||t[150]!==A?(G=s||!A.trim(),t[149]=s,t[150]=A,t[151]=G):G=t[151];let it;t[152]===n?it=t[153]:(it=n===`create`?(0,J.jsx)(m,{className:`size-4`,"aria-hidden":!0}):null,t[152]=n,t[153]=it);let at=n===`create`?u.create.submit:u.detail.save,ot;t[154]!==G||t[155]!==it||t[156]!==at?(ot=(0,J.jsxs)(W,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:G,children:[it,at]}),t[154]=G,t[155]=it,t[156]=at,t[157]=ot):ot=t[157];let st;t[158]!==rt||t[159]!==ot?(st=(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[rt,ot]}),t[158]=rt,t[159]=ot,t[160]=st):st=t[160];let ct;t[161]!==ce||t[162]!==ge||t[163]!==nt||t[164]!==st?(ct=(0,J.jsxs)(Ye,{children:[ue,(0,J.jsx)(R,{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:ce,className:`flex min-h-0 flex-1 flex-col`,children:[ge,nt,st]})})]}),t[161]=ce,t[162]=ge,t[163]=nt,t[164]=st,t[165]=ct):ct=t[165];let lt;return t[166]!==k||t[167]!==le||t[168]!==ct?(lt=(0,J.jsx)(x,{open:k,onOpenChange:le,children:ct}),t[166]=k,t[167]=le,t[168]=ct,t[169]=lt):lt=t[169],lt}function qt({projectId:e,createRequestKey:t=0}){let n=u(),r=a(c(e=>e.language)).projectDetailPage.workItems,o=(0,q.useRef)(null),s=(0,q.useRef)(null),[l,d]=(0,q.useState)([]),[f,p]=(0,q.useState)(!0),[h,g]=(0,q.useState)(null),[_,v]=(0,q.useState)(null),[y,b]=(0,q.useState)(!1),[x,S]=(0,q.useState)(null),[C,w]=(0,q.useState)(null),[T,E]=(0,q.useState)(!1),[D,O]=(0,q.useState)(!1),[k,j]=(0,q.useState)(!1),[M,N]=(0,q.useState)(`todo`),[P,F]=(0,q.useState)(null),[I,L]=(0,q.useState)([]),R=(0,q.useCallback)(async(t=`replace`,n=0)=>{p(!0),g(null);try{let r=await U(e,{limit:100,offset:n});d(e=>t===`append`?[...e,...r.items]:r.items),O(r.hasMore)}catch(e){g(e instanceof Error?e.message:String(e))}finally{p(!1)}},[e]);(0,q.useEffect)(()=>{R(`replace`,0)},[R]),(0,q.useEffect)(()=>{t&&(F(null),L([]),g(null),v(null),N(`todo`),j(!0))},[t]);let z=(0,q.useMemo)(()=>Et.map(e=>({status:e,title:r.statuses[e],items:l.filter(t=>t.status===e)})),[l,r.statuses]),B=(0,q.useCallback)(e=>{d(t=>t.map(t=>t.id===e.id?e:t)),F(t=>t?.id===e.id?e:t)},[]),V=(0,q.useCallback)(async(e,t)=>{b(!0),g(null),v(null);try{let n=await pe(e.id,t);n.item.archivedAt?(d(e=>e.filter(e=>e.id!==n.item.id)),F(null)):(B(n.item),v({title:r.feedback.savedTitle,message:r.feedback.savedNext}))}catch(e){g(e instanceof Error?e.message:String(e))}finally{b(!1)}},[r.feedback.savedNext,r.feedback.savedTitle,B]),H=(0,q.useCallback)(async e=>{F(e),L([]),g(null),v(null);let t=await G(e.id).catch(()=>null);t&&L(t.events)},[]),ee=(0,q.useCallback)(async t=>{b(!0),g(null),v(null);try{let n=await Te(e,t);d(e=>[n.item,...e]),j(!1),F(n.item),L((await G(n.item.id).catch(()=>({events:[]}))).events),v({title:r.feedback.createdTitle,message:r.feedback.createdNext})}catch(e){g(e instanceof Error?e.message:String(e))}finally{b(!1)}},[e,r.feedback.createdNext,r.feedback.createdTitle]),te=(0,q.useCallback)(async(e,t)=>{if(t.length){b(!0),g(null),v(null);try{let n=await Fe(e.id,t);B(n.item),L((await G(n.item.id).catch(()=>({events:[]}))).events)}catch(e){g(e instanceof Error?e.message:String(e))}finally{b(!1)}}},[B]),ne=(0,q.useCallback)(async(e,t)=>{b(!0),g(null),v(null);try{let n=await Ve(e.id,t.id);B(n.item),L((await G(n.item.id).catch(()=>({events:[]}))).events)}catch(e){g(e instanceof Error?e.message:String(e))}finally{b(!1)}},[B]),re=(0,q.useCallback)(async(e,t)=>{g(null),v(null);try{await Qe(e.id,t)}catch(e){g(e instanceof Error?e.message:String(e))}},[]),ie=(0,q.useCallback)(async e=>{b(!0),g(null),v(null);try{let t=await _e(e.id);B(t.item),await H(t.item),n(`/chat/${encodeURIComponent(t.session.key)}`)}catch(e){g(e instanceof Error?e.message:String(e))}finally{b(!1)}},[n,H,B]),oe=(0,q.useCallback)(async e=>{b(!0),g(null),v(null);try{let t=await ae(e.id);B(t.item),await H(t.item),n(`/goals/${encodeURIComponent(t.goal.id)}`)}catch(e){g(e instanceof Error?e.message:String(e))}finally{b(!1)}},[n,H,B]),se=(0,q.useCallback)((e,t)=>{t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(Tt,e.id),S(e.id)},[]),ce=(0,q.useCallback)((e,t)=>{t.preventDefault();let n=t.dataTransfer.getData(Tt)||x;w(null),S(null);let r=l.find(e=>e.id===n);!r||r.status===e||V(r,{status:e})},[x,l,V]),le=(0,q.useCallback)(e=>{V(e,{status:e.status===`done`?`todo`:`done`})},[V]),ue=(0,q.useCallback)(e=>{F(null),L([]),g(null),v(null),N(e),j(!0)},[]),de=(0,q.useCallback)(e=>{let t=s.current;!t||t.pointerId!==e.pointerId||(s.current=null,E(!1),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),fe=(0,q.useCallback)(e=>{if(e.button!==0||x||zt(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))},[x]),me=(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,E(!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:[h?(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:h}):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`,f&&`opacity-60`,T?`cursor-grabbing select-none`:`cursor-grab`),"aria-label":r.boardAria,"aria-busy":f,onPointerDown:fe,onPointerMove:me,onPointerUp:de,onPointerCancel:de,onLostPointerCapture:e=>{s.current?.pointerId===e.pointerId&&(s.current=null,E(!1))},children:(0,J.jsx)(`div`,{className:`flex min-h-full min-w-max items-start gap-3 pr-4`,children:z.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`,C===e.status&&`bg-surface-active`),"aria-label":e.title,onDragOver:t=>{x&&(t.preventDefault(),t.dataTransfer.dropEffect=`move`,w(e.status))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||w(null)},onDrop:t=>ce(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)(A,{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)(Vt,{item:e,dragging:x===e.id,onOpen:H,onToggleDone:le,onDragStart:se,onDragEnd:()=>{S(null),w(null)},t:r},e.id)):f?(0,J.jsxs)(`div`,{className:`grid gap-2 animate-pulse motion-reduce:animate-none`,children:[(0,J.jsx)(Ht,{}),(0,J.jsx)(Ht,{})]}):(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}),f?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:()=>ue(e.status),children:(0,J.jsx)(m,{className:`size-4`,"aria-hidden":!0})})]})]},e.status))})}),!f&&D?(0,J.jsx)(W,{type:`button`,variant:`secondary`,className:`justify-self-center`,onClick:()=>void R(`append`,l.length),children:r.loadMore}):null,(0,J.jsx)(Kt,{mode:k?`create`:P?`detail`:null,item:P,initialStatus:M,events:I,busy:y,error:h,notice:_,t:r,onClose:()=>{j(!1),F(null),L([]),g(null),v(null)},onCreate:ee,onSave:(e,t)=>void V(e,t),onStartChat:ie,onCreateGoal:oe,onAddAttachments:(e,t)=>void te(e,t),onRemoveAttachment:(e,t)=>void ne(e,t),onDownloadAttachment:(e,t)=>void re(e,t),onPreviewError:e=>{v(null),g(e)}})]})}var Jt=[{id:`overview`,icon:Ue},{id:`work-items`,icon:rt},{id:`sessions`,icon:y},{id:`goals`,icon:C},{id:`workflows`,icon:k},{id:`files`,icon:st},{id:`activity`,icon:Ce},{id:`automations`,icon:ke},{id:`notes`,icon:O},{id:`settings`,icon:Ne}],Yt=Jt.map(e=>e.id),Xt=new Set(Jt.map(e=>e.id)),Zt=`xopc.projectTabs.`,Qt=`xopc.projectFiles.panelWidthPx`,$t=320,en=220,tn=560;function nn(e){return Math.min(tn,Math.max(en,Math.round(e)))}function rn(){try{let e=window.localStorage.getItem(Qt);if(e==null)return $t;let t=Number.parseInt(e,10);return Number.isFinite(t)?nn(t):$t}catch{return $t}}function an(e){try{window.localStorage.setItem(Qt,String(nn(e)))}catch{}}function on(e){return!!(e&&Xt.has(e))}function sn(e){return`${Zt}${e}`}function cn(e){let t=Array.isArray(e)?e:[],n=new Set,r=[];for(let e of t)!on(e)||n.has(e)||(n.add(e),r.push(e));for(let e of Yt)n.has(e)||r.push(e);return r}function ln(e){if(!e)return Yt;try{let t=window.localStorage.getItem(sn(e));return cn(t?JSON.parse(t):null)}catch{return Yt}}function un(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function dn(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 fn(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 pn(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 mn(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 hn(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 gn(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 _n(e){let t=e.lastActiveAt??e.updatedAt??e.createdAt,n=t?new Date(t).getTime():0;return Number.isFinite(n)?n:0}function vn(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function yn(e){let t=e?.body;return t?.code===`workspace_root_missing`&&t.workspaceRoot?t.workspaceRoot:null}function bn(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 xn(e){return e.primaryObject.title?.trim()||e.primaryObject.id}function Sn(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 Cn(e){let t=e.sourceChannel?.trim();if(t)return wn(t);let n=e.key.split(`:`).filter(Boolean),r=(n[0]?.toLowerCase()===`agent`?n.slice(2).join(`:`):e.key).split(`:`)[0]?.split(/[-_]/)[0]?.trim();return wn(r||``)}function wn(e){let t=e.trim().toLowerCase();return t?t===`tui`?`TUI`:t===`acp`?`ACP`:t===`webchat`?`Webchat`:t:``}function Tn(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 En(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 Dn(e,t,n){return e.map(e=>e.path===t?{...e,children:n}:e.isDirectory&&e.children?.length?{...e,children:Dn(e.children,t,n)}:e)}function On({currentProject:e,pm:t,projectsText:n,wd:r}){let a=u(),[o,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)([e]),[d,f]=(0,q.useState)(``),[p,h]=(0,q.useState)(!1),[_,v]=(0,q.useState)(null),[y,b]=(0,q.useState)(!1),[S,C]=(0,q.useState)(`new`),[E,D]=(0,q.useState)(``),[O,k]=(0,q.useState)(``),[A,j]=(0,q.useState)(!1),[M,N]=(0,q.useState)(null),[P,F]=(0,q.useState)(null),z=(0,q.useCallback)(async()=>{h(!0),v(null);try{let t=await Ze({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){v(e instanceof Error?e.message:String(e))}finally{h(!1)}},[e]);(0,q.useEffect)(()=>{l(t=>[e,...t.filter(t=>t.id!==e.id)])},[e]),(0,q.useEffect)(()=>{o&&z()},[z,o]);let B=(0,q.useMemo)(()=>{let t=d.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)=>_n(t)-_n(e))},[e.id,c,d]),V=e=>t.statuses[e.status]??e.status,H=e=>e.workspaceRoot||e.effectiveWorkspaceRoot||e.description||e.brief||t.common.defaultWorkspace,te=e=>{C(e),D(``),k(``),N(null),b(!0),s(!1)},ne=(0,q.useCallback)(async(e={})=>{let t=O.trim(),n=E.trim()||(S===`directory`?vn(t):``);if(n){j(!0),N(null),F(null);try{let r=await T({name:n,...t?{workspaceRoot:t}:{},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});b(!1),D(``),k(``),l(e=>[r,...e.filter(e=>e.id!==r.id)]),a(`/projects/${encodeURIComponent(r.id)}`)}catch(e){let t=yn(e);t?(F(t),b(!1)):N(e instanceof Error?e.message:String(e))}finally{j(!1)}}},[S,E,a,O]),re=(0,q.useCallback)(e=>{e.preventDefault(),ne()},[ne]),ie=(0,q.useCallback)(()=>{ne({createWorkspaceRoot:!0})},[ne]),ae=(0,q.useCallback)(()=>{F(null),b(!0)},[]),oe=e=>{k(e),S===`directory`&&!E.trim()&&D(vn(e))},se=(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)(fe,{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:H(e)})]}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,fn(e.status)),children:V(e)})]},e.id);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(qe,{open:o,onOpenChange:s,children:[(0,J.jsx)(Re,{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`,fn(e.status)),children:V(e)})]}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:H(e)})]}),(0,J.jsx)(et,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-data-[state=open]:rotate-180`,"aria-hidden":!0})]})}),(0,J.jsx)(ve,{children:(0,J.jsxs)(me,{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)(Je,{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:d,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}),se(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}),_?(0,J.jsx)(`div`,{className:`px-2 py-2 text-xs text-red-600 dark:text-red-400`,children:_}):null,p&&B.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.loading}):null,!p&&B.length===0?(0,J.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-fg-muted`,children:t.projectSwitcher.noMatches}):null,B.map(e=>se(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:()=>te(`new`),children:[(0,J.jsx)(m,{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:()=>te(`directory`),children:[(0,J.jsx)(st,{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)(Ne,{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)(x,{open:y,onOpenChange:e=>!A&&b(e),children:(0,J.jsxs)(Ye,{children:[(0,J.jsx)(w,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(R,{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)(ee,{className:`text-base font-semibold text-fg`,children:S===`directory`?t.projectSwitcher.createFromDirectoryTitle:n.createTitle}),(0,J.jsx)(g,{className:`mt-1 text-sm text-fg-muted`,children:S===`directory`?t.projectSwitcher.createFromDirectoryDescription:n.createDescription})]}),(0,J.jsxs)(`form`,{onSubmit:re,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:[M?(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:M}):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:E,onChange:e=>D(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)(bt,{value:O,onChange:oe,disabled:A,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)(L,{asChild:!0,children:(0,J.jsx)(W,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:A,children:n.cancel})}),(0,J.jsxs)(W,{type:`submit`,variant:`primary`,className:`rounded-lg`,disabled:A||!(E.trim()||S===`directory`&&vn(O)),children:[(0,J.jsx)(m,{className:`size-4`,"aria-hidden":!0}),n.create]})]})]})]})]})}),(0,J.jsx)(x,{open:!!P,onOpenChange:e=>{e||F(null)},children:(0,J.jsxs)(Ye,{children:[(0,J.jsx)(w,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(R,{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)(ee,{className:`text-base font-semibold text-fg`,children:n.workspaceMissingTitle}),(0,J.jsx)(g,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:P?un(n.workspaceMissingDescription,{workspace:P}):null})]}),P?(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)(st,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:P})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(W,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:ae,disabled:A,children:n.workspaceMissingBack}),(0,J.jsxs)(W,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:ie,disabled:A,children:[(0,J.jsx)(I,{className:`size-4`,"aria-hidden":!0}),n.workspaceMissingCreate]})]})]})]})})]})}function kn(){let{projectId:e=``,tabId:t,noteId:n}=Oe(),r=u(),o=c(e=>e.language),s=a(o),h=s.chat.workingDirectory,b=s.projectDetailPage,C=s.projectsPage,T=V(e=>e.setPageHeader),D=V(e=>e.clearPageHeader),[A,ae]=(0,q.useState)(null),[U,fe]=(0,q.useState)(null),[pe,me]=(0,q.useState)([]),[_e,ve]=(0,q.useState)(``),[Se,Ce]=(0,q.useState)([]),[we,Te]=(0,q.useState)([]),[je,Ne]=(0,q.useState)([]),[Fe,Re]=(0,q.useState)([]),[Be,Ve]=(0,q.useState)([]),[Ue,Ge]=(0,q.useState)(!1),[qe,Ze]=(0,q.useState)(null),[Qe,et]=(0,q.useState)([]),[tt,rt]=(0,q.useState)(0),[G,K]=(0,q.useState)(!1),[Tt,Et]=(0,q.useState)(!1),[Dt,Ot]=(0,q.useState)(!1),[kt,At]=(0,q.useState)([]),Y=(0,q.useRef)(new Set),[jt,Mt]=(0,q.useState)(null),[Nt,Pt]=(0,q.useState)(rn),[Ft,It]=(0,q.useState)(!1),[Lt,Rt]=(0,q.useState)(!1),[zt,Bt]=(0,q.useState)(``),[Vt,Ht]=(0,q.useState)([]),[Ut,Wt]=(0,q.useState)(!1),[Gt,Kt]=(0,q.useState)(null),[Xt,Zt]=(0,q.useState)(!1),[Qt,$t]=(0,q.useState)(null),[en,tn]=(0,q.useState)([]),[X,_n]=(0,q.useState)(``),[vn,wn]=(0,q.useState)(!0),[kn,An]=(0,q.useState)(!1),[jn,Mn]=(0,q.useState)(!1),[Nn,Pn]=(0,q.useState)(null),[Fn,In]=(0,q.useState)(!1),[Ln,Rn]=(0,q.useState)(`fixed`),[zn,Bn]=(0,q.useState)(``),[Vn,Hn]=(0,q.useState)(null),[Un,Wn]=(0,q.useState)(!1),[Gn,Kn]=(0,q.useState)(!1),[qn,Jn]=(0,q.useState)(0),[Yn,Xn]=(0,q.useState)(!1),[Zn,Qn]=(0,q.useState)(!1),[$n,er]=(0,q.useState)(null),[tr,nr]=(0,q.useState)(null),[rr,ir]=(0,q.useState)(!1),[ar,or]=(0,q.useState)(!1),[sr,cr]=(0,q.useState)(!1),[lr,Z]=(0,q.useState)(null),[ur,dr]=(0,q.useState)({defaultAgentId:``,agents:[],models:[],checklistDecomposePolicy:`empty_only`}),[fr,pr]=(0,q.useState)({title:``,reason:``}),[mr,hr]=(0,q.useState)(()=>ln(e)),[Q,gr]=(0,q.useState)({name:``,description:``,status:`active`,defaultAgentId:``,workspaceRoot:``,brief:``,instructions:``}),_r=mr[0]??Yt[0],$=n?`notes`:on(t)?t:_r,vr=(0,q.useCallback)(t=>{e&&r(`/projects/${encodeURIComponent(e)}/${t}`)},[r,e]),yr=(0,q.useCallback)(t=>e?`/projects/${encodeURIComponent(e)}/${t}`:`/projects`,[e]),br=(0,q.useCallback)(e=>{let t=yr(`goals`);return`/goals/${encodeURIComponent(e)}?returnTo=${encodeURIComponent(t)}`},[yr]),xr=(0,q.useCallback)(t=>{e&&r(yr(t),{replace:!0})},[r,e,yr]),Sr=(0,q.useCallback)((e,t)=>{xr(e),r(t)},[r,xr]),Cr=(0,q.useCallback)(e=>t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||xr(e)},[xr]),wr=(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||on(t)||r(`/projects/${encodeURIComponent(e)}/${_r}`,{replace:!0})},[_r,r,e,t]),(0,q.useEffect)(()=>{hr(ln(e))},[e]);let Tr=(0,q.useCallback)((t,n,r=`before`)=>{t!==n&&hr(i=>{let a=cn(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?cn(i):(a.splice(r===`after`?l+1:l,0,c),e&&window.localStorage.setItem(sn(e),JSON.stringify(a)),a)})},[e]);(0,q.useEffect)(()=>{if(!e)return;let t=!1;return wn(!0),Z(null),Promise.all([nt(e),ze(e),he(e),se().catch(()=>null)]).then(([e,n,r,i])=>{if(t)return;let a=e.project;ae(a),fe(e),me(n),Ce(r),tn(i?.agents??[]),_n(a.defaultAgentId??``),gr({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||wn(!1)}),()=>{t=!0}},[e]),(0,q.useEffect)(()=>{let e=!1;async function t(){let[t,n,r]=await Promise.allSettled([se(),pt(),ne()]);e||dr(e=>{let i=t.status===`fulfilled`?t.value.defaultId:e.defaultAgentId,a=A?.defaultAgentId||X||i,o=t.status===`fulfilled`?t.value.agents:e.agents,s=n.status===`fulfilled`?n.value:e.models,c=r.status===`fulfilled`?xt(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}},[A?.defaultAgentId,X]);let Er=(0,q.useCallback)(async()=>{if(A){Xn(!0),Z(null);try{let[e,t]=await Promise.all([xe(),ie(100,{ownerAgentId:X||void 0,projectId:A.id})]);Te(e),Ne(t)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Xn(!1)}}},[A,X]);(0,q.useEffect)(()=>{A&&Er()},[A,Er]);let Dr=(0,q.useCallback)(async()=>{if(A){Ge(!0),Z(null);try{let[e,t]=await Promise.all([lt.list({projectId:A.id}),lt.runs(50,void 0,{projectId:A.id})]);Re(e.automations),Ve(t.runs)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Ge(!1)}}},[A]);(0,q.useEffect)(()=>{$===`automations`&&Dr()},[Dr,$]);let Or=(0,q.useCallback)(async()=>{if(A){K(!0),Z(null);try{let e=await M(A.id,{includeRelated:Tt,limit:100});et(e.items),rt(e.total)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{K(!1)}}},[A,Tt]);(0,q.useEffect)(()=>{$===`activity`&&Or()},[Or,$]);let kr=(0,q.useCallback)(async e=>{Ze(`run:${e.id}`),Z(null);try{await lt.runNow(e.id),await Dr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Ze(null)}},[Dr]),Ar=(0,q.useCallback)(async e=>{Ze(`toggle:${e.id}`),Z(null);try{e.enabled?await lt.pause(e.id):await lt.resume(e.id),await Dr()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Ze(null)}},[Dr]),jr=(0,q.useCallback)(async()=>{if(!A?.effectiveWorkspaceRoot?.trim()){At([]),Y.current.clear(),$t(null);return}Zt(!0),$t(null),Y.current.clear();try{At(En((await l(A.id,``)).entries)),Y.current.add(``)}catch(e){At([]),Y.current.clear(),$t(e instanceof Error?e.message:String(e))}finally{Zt(!1)}},[A]),Mr=(0,q.useCallback)(async e=>{if(!(!A?.effectiveWorkspaceRoot?.trim()||Y.current.has(e))){Y.current.add(e),$t(null);try{let t=await l(A.id,e);At(n=>Dn(n,e,En(t.entries)))}catch(t){Y.current.delete(e),$t(t instanceof Error?t.message:String(t))}}},[A]);(0,q.useEffect)(()=>{$===`files`&&jr()},[jr,$]);let Nr=zt.trim();(0,q.useEffect)(()=>{if($!==`files`||!A||!Lt||!Nr){Ht([]),Wt(!1),Kt(null);return}let e=!1;Wt(!0),Kt(null),Ht([]);let t=window.setTimeout(()=>{de(A.id,Nr,50).then(t=>{e||Ht(t)}).catch(t=>{e||Kt(t instanceof Error?t.message:String(t))}).finally(()=>{e||Wt(!1)})},180);return()=>{e=!0,window.clearTimeout(t)}},[Nr,A,Lt,$]);let Pr=(0,q.useCallback)(async()=>{if(A){Kn(!0),Z(null);try{let e=await te(A.id);Sr(`sessions`,`/chat/${encodeURIComponent(e.key)}`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Kn(!1)}}},[Sr,A]),Fr=(0,q.useCallback)(()=>{vr(`work-items`),Jn(e=>e+1)},[vr]),Ir=(0,q.useCallback)(async()=>{if(!A)return;let[e,t]=await Promise.all([nt(A.id),he(A.id)]);fe(e),ae(e.project),Ce(t)},[A]),Lr=(0,q.useCallback)(async e=>{if(!A||!e.title.trim())return;let t=Number.parseInt(e.maxTurns,10),n=e.deadline?new Date(e.deadline).getTime():void 0;ir(!0),Z(null);try{await S(A.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:St(e.evidencePlan),criteria:St(e.checklist)}}),cr(!1),vr(`goals`),await Ir()}catch(e){throw Z(e instanceof Error?e.message:String(e)),e}finally{ir(!1)}},[vr,A,Ir]),Rr=(0,q.useCallback)(async e=>{if(e.preventDefault(),!(!A||!fr.title.trim())){or(!0),Z(null);try{await Xe(A.id,{title:fr.title.trim(),reason:fr.reason.trim()||void 0}),pr({title:``,reason:``}),await Ir()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{or(!1)}}},[fr.reason,fr.title,A,Ir]),zr=(0,q.useCallback)(async e=>{if(!(!A||!tr)){Qn(!0),Z(null);try{let t=X||A.defaultAgentId||void 0,n=await F({definitionId:tr.id,projectId:A.id,agentId:t,goal:e.goal,input:e.input,concurrency:e.concurrency,maxSubagents:e.maxSubagents});nr(null),await Er(),Sr(`workflows`,gt(n.runId,{ownerAgentId:t}))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Qn(!1)}}},[Sr,A,Er,X,tr]),Br=(0,q.useCallback)(async e=>{if(A){er(`retry:${e.id}`),Z(null);try{let t=await ht(e.id,{ownerAgentId:X||e.metadata?.agentId,projectId:e.metadata?.projectId||A.id});await Er(),Sr(`workflows`,gt(t.runId,{ownerAgentId:X||e.metadata?.agentId||A.defaultAgentId}))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{er(null)}}},[Sr,A,Er,X]),Vr=(0,q.useCallback)(async e=>{er(`cancel:${e.id}`),Z(null);try{await Pe(e.id,{ownerAgentId:X||e.metadata?.agentId}),await Er()}catch(e){Z(e instanceof Error?e.message:String(e))}finally{er(null)}},[Er,X]),Hr=(0,q.useMemo)(()=>(0,J.jsx)(p,{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":b.backToProjects,children:(0,J.jsx)(dt,{className:`size-4`,"aria-hidden":!0})}),[b.backToProjects]),Ur=(0,q.useMemo)(()=>A?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(W,{variant:`secondary`,className:`h-9 rounded-lg`,onClick:Fr,children:[(0,J.jsx)(m,{className:`size-4`,"aria-hidden":!0}),b.workItems.create.header]}),(0,J.jsxs)(W,{variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>void Pr(),disabled:Gn,children:[(0,J.jsx)(y,{className:`size-4`,"aria-hidden":!0}),b.common.newChat]})]}):null,[Fr,b.common.newChat,b.workItems.create.header,A,Pr,Gn]);(0,q.useLayoutEffect)(()=>(T({startExtra:Hr,main:A?(0,J.jsx)(On,{currentProject:A,pm:b,projectsText:C,wd:h}):(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:b.fallbackTitle}),(0,J.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:b.fallbackContext})]}),end:Ur}),()=>D()),[D,Ur,Hr,b,A,C,T,h]);function Wr(e){ae(t=>t?{...t,...e}:null),fe(t=>t?{...t,project:{...t.project,...e}}:null),_n(e.defaultAgentId??``),gr(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 Gr(){if(!(!A||!Q.name.trim())){An(!0),Z(null),Pn(null);try{Wr(await it(A.id,{name:Q.name.trim(),status:Q.status,description:Q.description,defaultAgentId:Q.defaultAgentId,brief:Q.brief,instructions:Q.instructions}))}catch(e){let t=yn(e);t?Pn(t):Z(e instanceof Error?e.message:String(e))}finally{An(!1)}}}function Kr(e){e.preventDefault(),Gr()}let qr=(0,q.useCallback)(()=>{if(!A)return;let e=A.workspaceRoot?.trim()??``;Rn(e?`fixed`:`follow`),Bn(e||A.effectiveWorkspaceRoot||``),In(!0)},[A]);async function Jr(e={}){if(!A)return;let t=Ln===`fixed`?zn.trim():``;if(!(Ln===`fixed`&&!t)){An(!0),Z(null),Pn(null);try{Wr(await it(A.id,{workspaceRoot:t,...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}})),In(!1),Pn(null)}catch(e){let t=yn(e);t?(Pn(t),In(!1)):Z(e instanceof Error?e.message:String(e))}finally{An(!1)}}}async function Yr(){if(!(!A||Vn)){Hn(`pin`),Z(null);try{Wr(A.pinnedAt?await Me(A.id):await oe(A.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Hn(null)}}}async function Xr(){if(!(!A||Vn)){Hn(`archive`),Z(null);try{Wr(A.status===`archived`?await He(A.id):await v(A.id))}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Hn(null)}}}async function Zr(){if(A){Wn(!0),Z(null);try{await H(A.id),Mn(!1),r(`/projects`)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Wn(!1)}}}async function Qr(){if(!(!A||Dt)){Ot(!0),Z(null);try{await $e(A.id)}catch(e){Z(e instanceof Error?e.message:String(e))}finally{Ot(!1)}}}let $r=(0,q.useCallback)(e=>{Mt(e)},[]),ei=(0,q.useCallback)((e,t)=>{t||Mt(e)},[]),ti=(0,q.useCallback)(async(e,t,n)=>{let r=A?.id;if(r)switch(e){case`preview`:t.isDirectory||Mt(t.path);break;case`download`:if(t.isDirectory)return;try{let e=Le(t.path);if(ye(Ke(e))!==`text`){let n=await ft(t.path,{projectId:r}),i=Ie(e)??`application/octet-stream`;re(e,await n.arrayBuffer(),i)}else{let{content:n}=await le(t.path,{projectId:r});at(e,n)}}catch(e){f(`warning`,e instanceof Error?e.message:String(e),void 0,{duration:4e3})}break;case`copyPath`:try{await mt(t.absolutePath??t.path)&&f(`success`,s.workspace.pathCopied,void 0,{duration:2500})}catch{f(`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,A?.id]),ni=(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),It(!0);let r=e.clientX,i=Nt,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=nn(i+(e.clientX-r)),o===0&&(o=window.requestAnimationFrame(l))},d=()=>{o!==0&&(window.cancelAnimationFrame(o),l());try{t.releasePointerCapture(a)}catch{}It(!1),Pt(c),an(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)},[Nt]);if((0,q.useEffect)(()=>{$!==`files`&&Mt(null)},[e,$]),vn)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:b.loading});if(!A)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)(p,{to:`/projects`,className:`inline-flex items-center gap-2 text-sm text-accent-fg hover:underline`,children:[(0,J.jsx)(dt,{className:`size-4`,"aria-hidden":!0}),b.backToProjects]}),(0,J.jsx)(`p`,{className:`mt-6 rounded-lg bg-surface-panel p-4 shadow-surface text-sm text-fg-muted`,children:lr||b.notFound})]});let ri=U?.recentSessions.length?U.recentSessions:A.recentSessions,ii=U?.attentionItems??[],ai=e=>b.statuses[e]??e,oi=e=>un(b.common.messages,{count:e}),si=_e.trim().toLowerCase(),ci=si?pe.filter(e=>{let t=dn(e.updatedAt),n=e.routing?.agentId||e.agentId||b.common.agent,r=e.name?.trim()||b.sessions.fallbackTitle,i=oi(e.messageCount??0),a=Cn(e);return[r,e.key,n,a,t,i].filter(Boolean).join(` `).toLowerCase().includes(si)}):pe,li=pe.length>0&&ci.length===0,ui=en.find(e=>e.id===Q.defaultAgentId)?.name||Q.defaultAgentId||b.settings.globalDefaultAgent,di=en.find(e=>e.id===Q.defaultAgentId),fi=A.workspaceRoot?.trim()||``,pi=A.status===`archived`,mi=!!A.pinnedAt,hi=!fi,gi=fi||di?.workspace||A.effectiveWorkspaceRoot||b.common.defaultWorkspace,_i=Ln===`fixed`?zn.trim()||b.settings.workspacePlaceholder:di?.workspace||A.effectiveWorkspaceRoot||b.common.defaultWorkspace,vi=(Ln===`fixed`?zn.trim():``)!==fi&&(Ln===`follow`||!!zn.trim()),yi=mr.map(e=>{let t=Jt.find(t=>t.id===e);return{...t,label:t.id===`work-items`?b.workItems.tab:b.tabs[t.id]}});async function bi(){if(!gi)return;let e=await mt(gi);f(e?`success`:`warning`,e?s.workspace.pathCopied:s.clipboard.copyFailed,void 0,{duration:e?2500:4e3})}function xi(){Pn(null),In(!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)(yt,{items:yi,activeTab:$,onChange:vr,onReorder:Tr,ariaLabel:b.navAria,tabIdPrefix:`project-tab`,panelIdPrefix:`project-panel`,className:`shrink-0`}),lr?(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:lr}):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:b.overview.directionTitle}),(0,J.jsx)(`p`,{className:`mt-1 max-w-3xl text-sm leading-6 text-fg-muted`,children:U?.digest?.summary||U?.recommendedAction||A.description||A.brief||b.overview.directionFallback}),U?.digest?.nextAction?(0,J.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm font-medium leading-6 text-fg`,children:un(b.overview.recommendedNext,{action:U.digest.nextAction})}):null]}),(0,J.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:(0,J.jsxs)(W,{type:`button`,variant:`secondary`,onClick:()=>void Qr(),disabled:Dt,children:[(0,J.jsx)(be,{className:`size-4`,"aria-hidden":!0}),Dt?b.overview.savingDigest:b.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:b.overview.nextActions}),(0,J.jsxs)(W,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,onClick:()=>cr(!0),children:[(0,J.jsx)(m,{className:`size-4`,"aria-hidden":!0}),b.overview.goal]})]}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:U?.nextActions.length?U.nextActions.map(e=>(0,J.jsxs)(p,{to:br(e.goalId),onClick:Cr(`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`,fn(e.status)),children:ai(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:b.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:b.overview.attention}),ii.length?(0,J.jsx)(`div`,{className:`mt-3 grid gap-3`,children:ii.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)(Ee,{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:[b.overview.attentionKinds[e.kind]??e.kind,e.detail?` · ${e.detail}`:e.status?` · ${ai(e.status)}`:``]})]});return e.href?(0,J.jsx)(p,{to:e.href,onClick:Cr(wr(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:b.overview.noBlockedGoals}),(0,J.jsxs)(`form`,{onSubmit:Rr,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:fr.title,onChange:e=>pr(t=>({...t,title:e.target.value})),placeholder:b.overview.blockerTitlePlaceholder}),(0,J.jsx)(W,{type:`submit`,variant:`secondary`,className:`shrink-0 rounded-lg px-3`,disabled:ar||!fr.title.trim(),"aria-label":ar?b.overview.addingBlocker:b.overview.addBlocker,title:ar?b.overview.addingBlocker:b.overview.addBlocker,children:(0,J.jsx)(m,{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)(_,{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:b.overview.recentSessions})]}),(0,J.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,onClick:()=>vr(`sessions`),children:b.common.viewAll})]}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:ri.length?ri.map(e=>(0,J.jsxs)(p,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Cr(`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:dn(e.updatedAt)})]}),(0,J.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:e.agentId||b.common.agent})]},e.key)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:b.overview.noSessions})})]})]})]}):null,$===`work-items`?(0,J.jsx)(qt,{projectId:A.id,createRequestKey:qn}):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:b.workflows.runsTitle}),(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:b.workflows.runsHint})]}),(0,J.jsxs)(W,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>void Er(),disabled:Yn,children:[(0,J.jsx)(ot,{className:`size-4`,"aria-hidden":!0}),b.common.refresh]})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 divide-y divide-edge overflow-y-auto`,children:Yn&&je.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:b.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:()=>Sr(`workflows`,gt(e.id,{ownerAgentId:X||e.metadata?.agentId||A.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`,pn(e.status)),children:ai(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:un(b.workflows.runMeta,{definitionId:e.definitionId,done:e.metrics.doneAgentCount,total:e.metrics.agentCount,time:dn(e.createdAtMs)})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(W,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,onClick:()=>Sr(`workflows`,gt(e.id,{ownerAgentId:X||e.metadata?.agentId||A.defaultAgentId})),children:b.common.open}),n?(0,J.jsxs)(W,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:$n===`retry:${e.id}`,onClick:()=>void Br(e),children:[(0,J.jsx)(ot,{className:`size-3.5`,"aria-hidden":!0}),b.common.retry]}):null,t?(0,J.jsxs)(W,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:$n===`cancel:${e.id}`,onClick:()=>void Vr(e),children:[(0,J.jsx)(ge,{className:`size-3.5`,"aria-hidden":!0}),b.common.cancel]}):null]})]})]},e.id)}):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:b.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:b.workflows.startTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:b.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:we.length?we.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:()=>nr(e),children:[(0,J.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,J.jsx)(k,{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:b.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:b.automations.title}),(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:b.automations.hint})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsxs)(W,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg`,onClick:()=>void Dr(),disabled:Ue,children:[(0,J.jsx)(ot,{className:`size-4`,"aria-hidden":!0}),b.common.refresh]}),(0,J.jsxs)(W,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>Sr(`automations`,`/automations?projectId=${encodeURIComponent(A.id)}&action=create`),children:[(0,J.jsx)(m,{className:`size-4`,"aria-hidden":!0}),b.common.new]})]})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 divide-y divide-edge overflow-y-auto`,children:Ue&&Fe.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:b.automations.loading}):Fe.length?Fe.map(e=>{let t=Be.find(t=>t.automationId===e.id),n=e.state.runningRunId?Be.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:()=>Sr(`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?b.automations.enabled:b.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:un(b.common.lastRun,{trigger:e.trigger.kind,action:e.action.kind,time:t?dn(t.createdAtMs):b.common.never})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsxs)(W,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:qe===`run:${e.id}`||!!n,onClick:()=>void kr(e),children:[(0,J.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),b.automations.run]}),(0,J.jsxs)(W,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2 py-1 text-xs`,disabled:qe===`toggle:${e.id}`,onClick:()=>void Ar(e),children:[e.enabled?(0,J.jsx)(j,{className:`size-3.5`,"aria-hidden":!0}):(0,J.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),e.enabled?b.automations.pause:b.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:b.automations.empty}),(0,J.jsx)(`div`,{children:(0,J.jsxs)(W,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>Sr(`automations`,`/automations?projectId=${encodeURIComponent(A.id)}&action=create`),children:[(0,J.jsx)(ke,{className:`size-4`,"aria-hidden":!0}),b.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:b.automations.recentRuns})}),(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Be.length?Be.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`,pn(e.status)),children:ai(e.status)})]}),(0,J.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:dn(e.createdAtMs)})]},e.id)):(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:b.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:b.automations.contextTitle}),(0,J.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:b.automations.contextHint}),(0,J.jsx)(`p`,{className:`mt-3 break-all text-xs text-fg-subtle`,children:A.workspaceRoot||A.effectiveWorkspaceRoot||b.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)(vt,{selectedNoteId:n,basePath:`/projects/${encodeURIComponent(A.id)}/notes`,showLibrary:!1,allowMediaCapture:!1,listTag:`project:${A.id}`,captureTags:[`project:${A.id}`,A.slug],listTitle:b.notes.title,listDescription:b.notes.hint,emptyText:b.notes.emptyTitle,emptyDescription:b.notes.emptyDescription,listWidthStorageKey:`xopc.projectNotes.listWidth.${A.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:A.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)]`,Ft&&`cursor-col-resize select-none`),style:{"--project-files-panel-width":`${Nt}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)(B,{workspacePath:gi}),(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`,Lt&&`bg-surface-hover text-fg`),onClick:()=>Rt(!0),"aria-label":b.files.search,title:b.files.search,"aria-pressed":Lt,children:(0,J.jsx)(Je,{className:`size-3.5`,"aria-hidden":!0})}),(0,J.jsx)(P,{className:`size-7 shrink-0 rounded-md p-0`,loading:Xt,label:s.cron.refresh,onClick:()=>void jr()})]})]}),Lt?(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)(Je,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`input`,{type:`text`,role:`searchbox`,value:zt,onChange:e=>Bt(e.target.value),placeholder:b.files.searchPlaceholder,"aria-label":b.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":b.files.clearSearch,title:b.files.clearSearch,onClick:()=>{Bt(``),Rt(!1)},children:(0,J.jsx)(E,{className:`size-3.5`,"aria-hidden":!0})})]})}):null,Qt?(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:Qt}):null,Nr?(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-2`,children:Ut?(0,J.jsxs)(`div`,{className:`space-y-2 px-3 py-1`,children:[(0,J.jsx)(ce,{className:`h-11 w-full`}),(0,J.jsx)(ce,{className:`h-11 w-full`}),(0,J.jsx)(ce,{className:`h-11 w-full`})]}):Gt?(0,J.jsxs)(`p`,{className:`px-3 py-2 text-xs text-red-600 dark:text-red-400`,children:[s.workspace.loadError,`: `,Gt]}):Vt.length===0?(0,J.jsx)(`p`,{className:`px-3 py-2 text-xs text-fg-muted`,children:b.files.noSearchResults}):Vt.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`,jt===e.path&&`bg-accent-soft text-accent-fg`),onClick:()=>Mt(e.path),title:e.path,children:[(0,J.jsx)(O,{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))}):Xt&&kt.length===0?(0,J.jsx)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`,children:b.files.loading}):(0,J.jsx)(ut,{tree:kt,selectedPath:jt,onSelectFile:$r,onSelectEntry:ei,onExpandDir:e=>void Mr(e),onAction:ti,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:b.files.emptyDirectory})]}),(0,J.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":b.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`,Ft&&`bg-surface-hover`),onPointerDown:ni,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:jt?(0,J.jsx)(ue,{filePath:jt,projectId:A.id,onClose:()=>Mt(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)(st,{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:b.files.previewEmptyTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:b.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:b.files.needWorkspace}),(0,J.jsx)(`div`,{children:(0,J.jsx)(W,{type:`button`,variant:`secondary`,className:`rounded-lg`,onClick:()=>vr(`settings`),children:b.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:[pe.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)(Je,{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:_e,onChange:e=>ve(e.currentTarget.value),placeholder:b.sessions.searchPlaceholder,"aria-label":b.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`}),_e?(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":b.sessions.clearSearch,onClick:()=>ve(``),children:(0,J.jsx)(E,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,ci.length?(0,J.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:ci.map(e=>{let t=dn(e.updatedAt),n=e.routing?.agentId||e.agentId||b.common.agent,r=Cn(e),i=e.name?.trim()||b.sessions.fallbackTitle,a=oi(e.messageCount??0);return(0,J.jsxs)(p,{to:`/chat/${encodeURIComponent(e.key)}`,onClick:Cr(`sessions`),className:`group flex min-h-[8.75rem] 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)(y,{className:`size-4`,"aria-hidden":!0})}),(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,children:i}),r?(0,J.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-base px-2 py-0.5 text-[11px] font-medium leading-5 text-fg-muted`,children:r}):null]})})]}),(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:[b.sessions.agent,`: `,n]}),(0,J.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:a})]}),t?(0,J.jsxs)(`span`,{className:`truncate rounded-md bg-surface-base px-2 py-1`,children:[b.sessions.updated,`: `,t]}):null]})]},e.key)})}):li?(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:b.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:b.sessions.emptyTitle}),(0,J.jsx)(`p`,{className:`mx-auto mt-1 max-w-md text-sm leading-6 text-fg-muted`,children:b.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:b.goals.title})}),(0,J.jsxs)(W,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3`,disabled:rr,onClick:()=>cr(!0),children:[(0,J.jsx)(m,{className:`size-4`,"aria-hidden":!0}),b.goals.new]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:Se.length?Se.map(e=>(0,J.jsxs)(p,{to:br(e.id),onClick:Cr(`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`,fn(e.status)),children:ai(e.status)})]}),(0,J.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:e.nextAction||e.description||b.goals.noNextAction})]},e.id)):(0,J.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:b.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:b.activity.title}),(0,J.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:un(b.activity.count,{count:tt})})]}),(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:Tt,onChange:e=>Et(e.currentTarget.checked),className:`size-4 rounded border-edge text-accent focus:ring-accent/30`}),b.activity.includeRelated]}),(0,J.jsxs)(W,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3`,onClick:()=>void Or(),disabled:G,children:[(0,J.jsx)(ot,{className:i(`size-4`,G&&`animate-spin`),"aria-hidden":!0}),b.common.refresh]})]})]}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:G&&Qe.length===0?(0,J.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:b.activity.loading}):Qe.length?(0,J.jsx)(`div`,{className:`divide-y divide-edge`,children:Qe.map(e=>{let t=b.activity.types[e.type]??e.type,n=b.activity.objectKinds[e.primaryObject.kind]??e.primaryObject.kind,r=Tn(e),i=e.relatedProjects.length>0&&!e.scopes.some(e=>e.scopeKind===`project`&&e.scopeId===A.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:b.activity.related}):null]}),(0,J.jsxs)(`p`,{className:`mt-1 min-w-0 truncate text-sm text-fg-muted`,children:[n,`: `,xn(e)]})]}),(0,J.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,dateTime:new Date(e.createdAt).toISOString(),children:dn(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:[b.activity.actor,`: `,bn(e)]}),(0,J.jsxs)(`span`,{className:`max-w-full truncate rounded-md bg-surface-base px-2 py-1`,children:[b.activity.source,`: `,Sn(e)]})]})]},e.id)})}):(0,J.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:b.activity.empty})})]}):null,$===`settings`?(0,J.jsxs)(`form`,{id:`project-panel-settings`,role:`tabpanel`,"aria-labelledby":`project-tab-settings`,onSubmit:Kr,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:b.settings.contextTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:b.settings.contextHint})]}),(0,J.jsx)(`span`,{className:i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,fn(Q.status)),children:b.settings.statuses[Q.status]})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-5`,children:[(0,J.jsx)(gn,{label:b.settings.workspaceRoot,value:gi,mono:!0}),(0,J.jsx)(gn,{label:b.settings.defaultAgent,value:ui}),(0,J.jsx)(gn,{label:b.settings.pinState,value:mi?b.settings.pinned:b.settings.notPinned}),(0,J.jsx)(gn,{label:b.settings.createdAt,value:dn(A.createdAt)||b.common.never}),(0,J.jsx)(gn,{label:b.settings.updatedAt,value:dn(A.updatedAt)||b.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:b.settings.detailsTitle})}),(0,J.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,J.jsx)(mn,{label:b.settings.name,children:(0,J.jsx)(`input`,{className:hn(),value:Q.name,onChange:e=>gr(t=>({...t,name:e.target.value}))})}),(0,J.jsx)(mn,{label:b.settings.defaultAgent,children:(0,J.jsxs)(De,{className:hn(),value:Q.defaultAgentId,onChange:e=>gr(t=>({...t,defaultAgentId:e.target.value})),children:[(0,J.jsx)(We,{value:``,children:b.settings.globalDefaultAgent}),en.map(e=>(0,J.jsx)(We,{value:e.id,children:N(e,s.agentsSettings)},e.id))]})}),(0,J.jsx)(mn,{label:b.settings.status,children:pi?(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:b.settings.statuses.archived}):(0,J.jsxs)(De,{className:hn(),value:Q.status===`archived`?`active`:Q.status,onChange:e=>gr(t=>({...t,status:e.target.value})),children:[(0,J.jsx)(We,{value:`active`,children:b.settings.statuses.active}),(0,J.jsx)(We,{value:`paused`,children:b.settings.statuses.paused})]})}),(0,J.jsx)(mn,{label:b.settings.description,hint:b.settings.descriptionHint,children:(0,J.jsx)(`textarea`,{className:hn(!0),value:Q.description,onChange:e=>gr(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:b.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:hi?b.settings.workspaceModeFollow:b.settings.workspaceModeFixed})}),(0,J.jsx)(`div`,{className:`mt-2 break-all font-mono text-xs leading-5 text-fg`,title:gi,children:gi})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,J.jsxs)(W,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:()=>void bi(),children:[(0,J.jsx)(_t,{className:`size-4`,"aria-hidden":!0}),b.settings.copyWorkspacePath]}),(0,J.jsx)(B,{workspacePath:gi}),(0,J.jsxs)(W,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:qr,children:[(0,J.jsx)(I,{className:`size-4`,"aria-hidden":!0}),b.settings.migrateWorkspace]})]})]}),(0,J.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:b.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:b.settings.agentContextTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:b.settings.agentContextHint})]}),(0,J.jsx)(mn,{label:b.settings.brief,hint:b.settings.briefHint,children:(0,J.jsx)(`textarea`,{className:hn(!0),value:Q.brief,onChange:e=>gr(t=>({...t,brief:e.target.value}))})}),(0,J.jsx)(mn,{label:b.settings.instructions,hint:b.settings.instructionsHint,children:(0,J.jsx)(`textarea`,{className:hn(!0),value:Q.instructions,onChange:e=>gr(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:b.settings.managementTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:b.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:mi?b.settings.pinnedTitle:b.settings.pinTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:b.settings.pinHint})]}),(0,J.jsxs)(W,{type:`button`,variant:`ghost`,className:`w-fit rounded-lg`,disabled:Vn===`pin`,onClick:()=>void Yr(),children:[mi?(0,J.jsx)(d,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(Ae,{className:`size-4`,"aria-hidden":!0}),mi?b.settings.unpinProject:b.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:pi?b.settings.restoreTitle:b.settings.archiveTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:pi?b.settings.restoreHint:b.settings.archiveHint})]}),(0,J.jsxs)(W,{type:`button`,variant:pi?`primary`:`ghost`,className:`w-fit rounded-lg`,disabled:Vn===`archive`,onClick:()=>void Xr(),children:[pi?(0,J.jsx)(ot,{className:`size-4`,"aria-hidden":!0}):(0,J.jsx)(ct,{className:`size-4`,"aria-hidden":!0}),pi?b.settings.restoreProject:b.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:b.settings.dangerTitle}),(0,J.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-red-700/80 dark:text-red-200/80`,children:b.settings.dangerHint})]}),(0,J.jsxs)(W,{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:()=>Mn(!0),children:[(0,J.jsx)(z,{className:`size-4`,"aria-hidden":!0}),b.settings.deleteConfirmAction]})]}),(0,J.jsx)(`div`,{className:`flex flex-wrap justify-end gap-2 border-t border-edge pt-4`,children:(0,J.jsxs)(W,{type:`submit`,variant:`primary`,disabled:kn||!Q.name.trim(),children:[(0,J.jsx)(be,{className:`size-4`,"aria-hidden":!0}),b.common.save]})})]}):null]}),(0,J.jsx)(x,{open:jn,onOpenChange:e=>{Un||Mn(e)},children:(0,J.jsxs)(Ye,{children:[(0,J.jsx)(w,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(R,{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)(Ee,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(ee,{className:`text-base font-semibold text-fg`,children:b.settings.deleteConfirmTitle}),(0,J.jsx)(g,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:A?un(b.settings.deleteConfirm,{name:A.name}):b.settings.deleteConfirmFallback})]})]}),(0,J.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,J.jsx)(L,{asChild:!0,children:(0,J.jsx)(W,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:Un,children:b.common.cancel})}),(0,J.jsxs)(W,{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:Un||!A,onClick:()=>void Zr(),children:[(0,J.jsx)(z,{className:`size-4`,"aria-hidden":!0}),b.settings.deleteConfirmAction]})]})]})]})}),(0,J.jsx)(x,{open:Fn,onOpenChange:e=>{kn||In(e)},children:(0,J.jsxs)(Ye,{children:[(0,J.jsx)(w,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(R,{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)(ee,{className:`text-base font-semibold text-fg`,children:b.settings.workspaceMigrationTitle}),(0,J.jsx)(g,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:b.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:b.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`,Ln===`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:Ln===`fixed`,onChange:()=>Rn(`fixed`),disabled:kn}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:b.settings.workspaceModeFixed}),(0,J.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:b.settings.workspaceMigrationFixedHint})]})]}),(0,J.jsxs)(`label`,{className:i(`flex min-h-10 items-start gap-2 rounded-md border px-3 py-2`,Ln===`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:Ln===`follow`,onChange:()=>Rn(`follow`),disabled:kn}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:b.settings.workspaceModeFollow}),(0,J.jsx)(`span`,{className:`block text-xs leading-5 text-fg-subtle`,children:b.settings.workspaceHint})]})]})]})]}),Ln===`fixed`?(0,J.jsx)(bt,{value:zn,onChange:Bn,disabled:kn,wd:h,placeholder:b.settings.workspacePlaceholder,inputClassName:hn(),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:b.settings.workspaceMigrationImpact}),(0,J.jsx)(`div`,{className:`rounded-lg bg-surface-muted px-3 py-2 text-xs leading-5 text-fg-subtle`,children:un(b.settings.workspaceCurrent,{workspace:_i})})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(L,{asChild:!0,children:(0,J.jsx)(W,{type:`button`,variant:`ghost`,className:`rounded-lg`,disabled:kn,children:b.common.cancel})}),(0,J.jsxs)(W,{type:`button`,variant:`primary`,className:`rounded-lg`,disabled:kn||!vi,onClick:()=>void Jr(),children:[(0,J.jsx)(I,{className:`size-4`,"aria-hidden":!0}),b.settings.workspaceMigrationConfirm]})]})]})]})}),(0,J.jsx)(x,{open:!!Nn,onOpenChange:e=>{e||Pn(null)},children:(0,J.jsxs)(Ye,{children:[(0,J.jsx)(w,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(R,{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)(ee,{className:`text-base font-semibold text-fg`,children:b.settings.workspaceMissingTitle}),(0,J.jsx)(g,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:Nn?un(b.settings.workspaceMissingDescription,{workspace:Nn}):null})]}),Nn?(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)(st,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:Nn})]})}):null,(0,J.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(W,{type:`button`,variant:`ghost`,className:`rounded-lg`,onClick:xi,disabled:kn,children:b.settings.workspaceMissingBack}),(0,J.jsxs)(W,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:()=>void Jr({createWorkspaceRoot:!0}),disabled:kn,children:[(0,J.jsx)(I,{className:`size-4`,"aria-hidden":!0}),b.settings.workspaceMissingCreate]})]})]})]})}),(0,J.jsx)(Ct,{open:sr,t:s.goalsPage,chat:s.chat,busy:rr,options:ur,onClose:()=>!rr&&cr(!1),onCreate:Lr}),(0,J.jsx)(wt,{open:!!tr,definition:tr,language:o,starting:Zn,onClose:()=>!Zn&&nr(null),onStart:e=>void zr(e)})]})}export{kn 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-BXNELNBa.js";import{n as o}from"./locale-store-Ba72bFmP.js";import{Al as s,Dc as c,Dl as l,Es as u,Ga as d,Ja as f,Ka as p,Ki as m,Qn as h,Tc as g,Ua as _,Wa as v,Xa as y,Ya as b,ar as x,bl as S,ia as ee,io as te,ko as C,oo as w,ps as ne,qa as T,ra as re}from"./index-DcUaXYeb.js";import{t as ie}from"./directory-picker-path-field-BrYt1gAr.js";var ae=n(),E=e(t(),1),D=r(),oe=[`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 se(e){return e.trim().replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??``}function ce(e){let t=e?.body;return t?.code===`workspace_already_bound`&&t.project?t.project:null}function le(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 ue(e){let t=(0,ae.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 u;t[4]!==s||t[5]!==c?(u=(0,D.jsxs)(`div`,{className:`min-w-0`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=u):u=t[6];let d;t[7]===n.status?d=t[8]:(d=i(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,A(n.status)),t[7]=n.status,t[8]=d);let f;t[9]!==a||t[10]!==d?(f=(0,D.jsx)(`span`,{className:d,children:a}),t[9]=a,t[10]=d,t[11]=f):f=t[11];let p;t[12]!==u||t[13]!==f?(p=(0,D.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[u,f]}),t[12]=u,t[13]=f,t[14]=p):p=t[14];let m=n.description||n.brief||r.noDescription,h;t[15]===m?h=t[16]:(h=(0,D.jsx)(`p`,{className:`mt-3 line-clamp-2 min-h-10 text-sm leading-5 text-fg-muted`,children:m}),t[15]=m,t[16]=h);let g=n.workspaceRoot||n.effectiveWorkspaceRoot||r.agentDefault,_;t[17]!==r.workspaceLabel||t[18]!==g?(_=j(r.workspaceLabel,{workspace:g}),t[17]=r.workspaceLabel,t[18]=g,t[19]=_):_=t[19];let v;t[20]===_?v=t[21]:(v=(0,D.jsx)(`div`,{className:`truncate`,children:_}),t[20]=_,t[21]=v);let y;t[22]!==n.lastActiveAt||t[23]!==n.updatedAt||t[24]!==r.lastActive||t[25]!==r.never?(y=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]=y):y=t[26];let b;t[27]===y?b=t[28]:(b=(0,D.jsx)(`div`,{children:y}),t[27]=y,t[28]=b);let x;t[29]!==v||t[30]!==b?(x=(0,D.jsxs)(`div`,{className:`mt-auto grid gap-1 pt-4 text-xs text-fg-subtle`,children:[v,b]}),t[29]=v,t[30]=b,t[31]=x):x=t[31];let S;return t[32]!==o||t[33]!==x||t[34]!==p||t[35]!==h?(S=(0,D.jsxs)(l,{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:[p,h,x]}),t[32]=o,t[33]=x,t[34]=p,t[35]=h,t[36]=S):S=t[36],S}function N(){let e=s(),t=a(o(e=>e.language)),n=t.chat.workingDirectory,r=t.projectsPage,l=y(e=>e.setPageHeader),ae=y(e=>e.clearPageHeader),[A,M]=(0,E.useState)([]),[N,de]=(0,E.useState)(`all`),[P,fe]=(0,E.useState)(``),[pe,me]=(0,E.useState)(!0),[he,F]=(0,E.useState)(null),[I,L]=(0,E.useState)(``),[ge,_e]=(0,E.useState)(!1),[R,ve]=(0,E.useState)(``),[z,B]=(0,E.useState)(`fixed`),[V,ye]=(0,E.useState)(`auto`),[H,be]=(0,E.useState)(O),[U,xe]=(0,E.useState)([]),[W,Se]=(0,E.useState)(),[G,Ce]=(0,E.useState)(),[we,Te]=(0,E.useState)(`unknown`),[K,q]=(0,E.useState)(!1),[J,Ee]=(0,E.useState)(!1),[Y,X]=(0,E.useState)(null),[Z,Q]=(0,E.useState)(null),De=(0,E.useCallback)(e=>{L(e),_e(!!e.trim())},[]),Oe=(0,E.useCallback)(e=>{ve(e),ge||L(se(e))},[ge]);(0,E.useEffect)(()=>{let e=!1;return me(!0),F(null),re({...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||me(!1)}),()=>{e=!0}},[P,N]),(0,E.useEffect)(()=>{if(!K)return;let e=!1;return x().then(t=>{e||(xe(t.agents),Se(t.defaultId))}).catch(()=>{e||(xe([]),Se(void 0))}),()=>{e=!0}},[K]),(0,E.useEffect)(()=>{if(!K)return;let e=!1,t=window.setTimeout(()=>{ee({...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)}},[K,I,V,z,R]);let ke=(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),Q(null);try{let r=await m({...t?{name:t}:{},...n?{workspaceRoot:n}:{},projectKind:V,...H===O?{}:{defaultAgentId:H===k?``:H},...e.createWorkspaceRoot?{createWorkspaceRoot:!0}:{}});M(e=>[r,...e]),L(``),_e(!1),ve(``),B(`fixed`),ye(`auto`),be(O),q(!1)}catch(e){let t=ce(e);if(t)M(e=>[t,...e.filter(e=>e.id!==t.id)]),X(t),q(!1);else{let t=le(e);t?(Q(t),q(!1)):F(e instanceof Error?e.message:String(e))}}finally{Ee(!1)}}},[H,I,V,z,R]),Ae=(0,E.useCallback)(e=>{e.preventDefault(),$()},[$]),je=(0,E.useCallback)(()=>{if(!Y)return;let t=Y.id;X(null),e(`/projects/${encodeURIComponent(t)}`)},[e,Y]),Me=(0,E.useCallback)(()=>{X(null),q(!0)},[]),Ne=(0,E.useCallback)(()=>{$({createWorkspaceRoot:!0})},[$]),Pe=(0,E.useCallback)(()=>{Q(null),q(!0)},[]),Fe=(0,E.useMemo)(()=>U.find(e=>e.id===G)?.name||G||``,[U,G]),Ie=(0,E.useMemo)(()=>H===k?W:H===O?G||W:H,[H,W,G]),Le=(0,E.useMemo)(()=>U.find(e=>e.id===Ie),[U,Ie]),Re=z===`fixed`?R.trim()||r.workspacePlaceholder:Le?.workspace||r.workspacePlaceholder,ze=(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 G?j(r.agentHintCoding,{agent:Fe}):we===`coding`?r.agentHintCoderUnavailable:V===`general`||we===`general`?r.agentHintGeneral:r.agentHintAuto},[H,U,Fe,G,we,V,r]),Be=(0,E.useMemo)(()=>(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`label`,{className:`relative block min-w-0`,children:[(0,D.jsx)(ne,{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=>fe(e.target.value),placeholder:r.searchPlaceholder,"aria-label":r.searchPlaceholder})]}),(0,D.jsxs)(C,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>q(e=>!e),children:[(0,D.jsx)(u,{className:`size-4`,"aria-hidden":!0}),r.create]})]}),[P,r.create,r.searchPlaceholder]);(0,E.useLayoutEffect)(()=>(l({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:Be}),()=>ae()),[ae,Be,A.length,l,r.summary,r.title]);let Ve=N===`all`?[[r.statuses.active,ke.active],[r.statuses.paused,ke.paused],[r.statuses.archived,ke.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)(f,{open:K,onOpenChange:q,children:(0,D.jsxs)(T,{children:[(0,D.jsx)(p,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,D.jsxs)(v,{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)(b,{className:`text-base font-semibold text-fg`,children:r.createTitle}),(0,D.jsx)(d,{className:`mt-1 text-sm text-fg-muted`,children:r.createDescription})]}),(0,D.jsxs)(`form`,{onSubmit:Ae,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:J}),(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:J}),(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)(ie,{value:R,onChange:Oe,disabled:J,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:Re})})]}),(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()&&se(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)(te,{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=>ye(e.target.value),disabled:J,children:[(0,D.jsx)(w,{value:`auto`,children:r.projectTypes.auto}),(0,D.jsx)(w,{value:`coding`,children:r.projectTypes.coding}),(0,D.jsx)(w,{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)(te,{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=>be(e.target.value),disabled:J,children:[(0,D.jsx)(w,{value:O,children:r.agentAuto}),(0,D.jsx)(w,{value:k,children:r.agentGlobalDefault}),U.map(e=>(0,D.jsx)(w,{value:e.id,children:h(e,t.agentsSettings)},e.id))]}),(0,D.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:ze})]})]}),(0,D.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,D.jsx)(_,{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:J||!I.trim()&&(z!==`fixed`||!R.trim()),children:[(0,D.jsx)(u,{className:`size-4`,"aria-hidden":!0}),r.create]})]})]})]})]})}),(0,D.jsx)(f,{open:!!Y,onOpenChange:e=>{e||X(null)},children:(0,D.jsxs)(T,{children:[(0,D.jsx)(p,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,D.jsxs)(v,{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)(b,{className:`text-base font-semibold text-fg`,children:r.workspaceConflictTitle}),(0,D.jsx)(d,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:Y?j(r.workspaceConflictDescription,{projectName:Y.name}):null})]}),Y?(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)(c,{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:Y.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:Me,children:r.workspaceConflictBack}),(0,D.jsxs)(C,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:je,children:[(0,D.jsx)(S,{className:`size-4`,"aria-hidden":!0}),r.workspaceConflictOpen]})]})]})]})}),(0,D.jsx)(f,{open:!!Z,onOpenChange:e=>{e||Q(null)},children:(0,D.jsxs)(T,{children:[(0,D.jsx)(p,{className:`fixed inset-0 z-[100] bg-scrim backdrop-blur-[2px]`}),(0,D.jsxs)(v,{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)(b,{className:`text-base font-semibold text-fg`,children:r.workspaceMissingTitle}),(0,D.jsx)(d,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:Z?j(r.workspaceMissingDescription,{workspace:Z}):null})]}),Z?(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)(c,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,D.jsx)(`span`,{className:`min-w-0 truncate`,children:Z})]})}):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:Pe,disabled:J,children:r.workspaceMissingBack}),(0,D.jsxs)(C,{type:`button`,variant:`primary`,className:`rounded-lg`,onClick:Ne,disabled:J,children:[(0,D.jsx)(g,{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:oe.map(e=>(0,D.jsx)(`button`,{type:`button`,onClick:()=>de(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)(c,{className:`size-4`,"aria-hidden":!0}),r.optionalContext]})]}),he?(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:he}):null,pe?(0,D.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.loading}):null,!pe&&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,Ve.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)(ue,{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-BXNELNBa.js";import{a as o,c as s,n as c,o as l,s as u,t as d}from"./fetch-B1WtuprY.js";import{n as f}from"./locale-store-Ba72bFmP.js";import{a as p,i as m}from"./vendor-swr-BIWyz7Rc.js";import{Ar as h,Cr as g,Dl as _,Dr as v,Dt as y,Er as b,Ga as x,Ha as S,Ja as C,Ka as w,Ml as T,Mr as E,Nc as D,Nr as O,Oo as k,Or as A,Pr as j,Sr as M,T as N,Tr as P,Ts as F,Uo as I,Wa as L,Ya as R,Yc as z,Ys as B,al as V,ba as H,bc as U,bs as ee,cc as te,cl as ne,co as W,dn as re,ds as G,ei as ie,is as ae,jr as K,ko as q,kr as J,lo as Y,os as X,qa as oe,qo as se,to as ce,va as le,vo as ue,wr as de,ya as fe,yo as pe,zc as me,zs as he}from"./index-DcUaXYeb.js";import{n as ge,r as _e,t as ve}from"./settings-page-layout-CKefvbYi.js";import{t as ye}from"./settings-collapsible-section-WzdikxPt.js";import{n as be,r as xe,t as Se}from"./settings-form-section-CvfzhBV-.js";import{t as Ce}from"./browser-BLJWD7WI.js";import{t as we}from"./page-tabs-D_8jGlqx.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`),le()])},[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 b();if(!n.ok)throw Error(`Failed to enable LAN pairing`);if(n.requiresRestart){let t=await M();if(!t.ok)throw Error(t.message??`Gateway restart failed`);if(!await g(e))throw Error(`Gateway did not come back online in time`)}let r=n.requiresRestart?await de():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`,k,`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,g=u?m.remoteAccess.lan:null,v;t[2]!==m.clipboard.copyFailed||t[3]!==h.pairCopied||t[4]!==h.pairCopyLink?(v={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]=v):v=t[5];let y=v,{tunnelActive:b,tunnelStatus:x,tunnelQr:S,pairContext:C,pairBaseUrl:w,setPairBaseUrl:T,applySuggestedPairUrl:E,applyCandidateUrl:D,resetPairBaseFromContext:O,baseOk:k,localhostWarn:A,pairingBlocked:j,deepLink:M,qrPayload:P,qrDataUrl:F,qrGenFailed:I,encoding:L}=n,R;t[6]===O?R=t[7]:(R=e=>{O(e.recommended.url)},t[6]=O,t[7]=R);let z=Te(r,R),V,H,U,te,ne;if(t[8]!==D||t[9]!==E||t[10]!==k||t[11]!==z||t[12]!==r||t[13]!==g||t[14]!==u||t[15]!==A||t[16]!==c||t[17]!==w||t[18]!==C?.candidates||t[19]!==C?.recommended||t[20]!==j||t[21]!==T||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]!==b||t[47]!==S||t[48]!==x?.publicUrl){ne=Symbol.for(`react.early_return_sentinel`);bb0:{let e=C?.candidates.filter(ke)??[],n=u?(e.find(Oe)?.url??e[0]?.url??``).trim():C?.recommended.url?.trim()??``,a=(u||!b)&&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`,w.trim()===e.url&&`border-accent bg-accent/5`,n),onClick:()=>D(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(V=l&&!u,V&&!b){let e;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ae,{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],ne=i;break bb0}let s=g?.pairTitle??h.pairTitle,d=u?g?.pairSubtitle??h.pairSubtitle:b?h.pairTunnelActive:h.pairSubtitle,f=!!(c&&(u||l&&b)),p=V?`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)(ae,{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 O;t[67]!==V||t[68]!==d||t[69]!==h.pairSubtitle?(O=V?(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]=V,t[68]=d,t[69]=h.pairSubtitle,t[70]=O):O=t[70];let M;t[71]!==y||t[72]!==O?(M=(0,$.jsxs)(`div`,{children:[y,O]}),t[71]=y,t[72]=O,t[73]=M):M=t[73];let N;t[74]!==c||t[75]!==f||t[76]!==h.refreshQr?(N=f?(0,$.jsxs)(q,{type:`button`,variant:`ghost`,className:`shrink-0`,onClick:()=>void c(),children:[(0,$.jsx)(ee,{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]!==M||t[80]!==N?(H=(0,$.jsxs)(`div`,{className:m,children:[M,N]}),t[78]=m,t[79]=M,t[80]=N,t[81]=H):H=t[81],U=j?(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)(q,{type:`button`,variant:`secondary`,className:`w-full sm:w-auto`,onClick:E,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)(q,{type:`button`,className:`w-full sm:w-auto`,disabled:z.busy||!r,onClick:()=>z.setConfirmOpen(!0),children:[z.busy?(0,$.jsx)(B,{className:`size-3.5 animate-spin`}):null,z.busy?h.pairEnableLanEnabling:h.pairEnableLanButton]})}),z.error?(0,$.jsx)(`p`,{className:`text-xs text-red-800 dark:text-red-200`,children:z.error}):null,(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-amber-900 dark:text-amber-200`,children:u?g?.pairBlockedNextSteps??h.pairBlockedNextSteps:h.pairBlockedNextSteps}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(_,{to:`/settings/gateway`,className:`inline-block text-xs font-medium text-accent hover:underline`,children:h.pairEnableLanSecurityAuditLink}),u&&g?.pairPublicTabLink?(0,$.jsx)(_,{to:`/settings/remote-access?tab=public`,className:`inline-block text-xs font-medium text-accent hover:underline`,children:g.pairPublicTabLink}):null]})]}):null,te=b&&!u?V?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:x?.publicUrl})]}),S?.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:S.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:w,onChange:e=>T(e.target.value)}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:h.pairBaseUrlHint}),!k&&w.trim()?(0,$.jsx)(`p`,{className:`text-xs text-amber-800 dark:text-amber-200`,children:h.pairInvalidBaseUrl}):null,A?(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]=D,t[9]=E,t[10]=k,t[11]=z,t[12]=r,t[13]=g,t[14]=u,t[15]=A,t[16]=c,t[17]=w,t[18]=C?.candidates,t[19]=C?.recommended,t[20]=j,t[21]=T,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]=b,t[47]=S,t[48]=x?.publicUrl,t[49]=V,t[50]=H,t[51]=U,t[52]=te,t[53]=ne}else V=t[49],H=t[50],U=t[51],te=t[52],ne=t[53];if(ne!==Symbol.for(`react.early_return_sentinel`))return ne;let W;t[82]===h.pairSecurityNote?W=t[83]:(W=(0,$.jsx)(`p`,{className:`mb-3 text-xs text-fg-subtle`,children:h.pairSecurityNote}),t[82]=h.pairSecurityNote,t[83]=W);let re;t[84]!==y||t[85]!==M||t[86]!==L||t[87]!==j||t[88]!==F||t[89]!==I||t[90]!==h.pairEncoding||t[91]!==h.pairImageError||t[92]!==h.pairQrDisabled?(re=M?(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,L?(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)(ie,{text:M,labels:y})]}):j?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:h.pairQrDisabled}):null,t[84]=y,t[85]=M,t[86]=L,t[87]=j,t[88]=F,t[89]=I,t[90]=h.pairEncoding,t[91]=h.pairImageError,t[92]=h.pairQrDisabled,t[93]=re):re=t[93];let G;t[94]!==V||t[95]!==P||t[96]!==h.deeplinkTitle?(G=P&&!V?(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]=V,t[95]=P,t[96]=h.deeplinkTitle,t[97]=G):G=t[97];let K;t[98]!==V||t[99]!==h.pairMobileProbeHint||t[100]!==h.pairSchemeHint?(K=V?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]=V,t[99]=h.pairMobileProbeHint,t[100]=h.pairSchemeHint,t[101]=K):K=t[101];let J,Y;t[102]===z?(J=t[103],Y=t[104]):(J=()=>void z.runEnableLanPairing(),Y=()=>{z.busy||z.setConfirmOpen(!1)},t[102]=z,t[103]=J,t[104]=Y);let X;t[105]!==z.confirmOpen||t[106]!==h.consentCancel||t[107]!==h.pairEnableLanButton||t[108]!==h.pairEnableLanConfirmBody||t[109]!==h.pairEnableLanConfirmTitle||t[110]!==J||t[111]!==Y?(X=(0,$.jsx)(N,{open:z.confirmOpen,title:h.pairEnableLanConfirmTitle,description:h.pairEnableLanConfirmBody,confirmLabel:h.pairEnableLanButton,cancelLabel:h.consentCancel,onConfirm:J,onCancel:Y}),t[105]=z.confirmOpen,t[106]=h.consentCancel,t[107]=h.pairEnableLanButton,t[108]=h.pairEnableLanConfirmBody,t[109]=h.pairEnableLanConfirmTitle,t[110]=J,t[111]=Y,t[112]=X):X=t[112];let oe;return t[113]!==W||t[114]!==re||t[115]!==G||t[116]!==K||t[117]!==X||t[118]!==H||t[119]!==U||t[120]!==te?(oe=(0,$.jsx)(Se,{children:(0,$.jsxs)($.Fragment,{children:[H,U,te,W,re,G,K,X]})}),t[113]=W,t[114]=re,t[115]=G,t[116]=K,t[117]=X,t[118]=H,t[119]=U,t[120]=te,t[121]=oe):oe=t[121],oe}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)(w,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,Y)}),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`,W),t[3]=g):g=t[3];let _;t[4]===r?_=t[5]:(_=(0,$.jsx)(R,{className:`text-base font-semibold text-fg`,children:r}),t[4]=r,t[5]=_);let v;t[6]===a?v=t[7]:(v=(0,$.jsx)(x,{className:`mt-2 text-sm text-fg-muted`,children:a}),t[6]=a,t[7]=v);let y;t[8]===o?y=t[9]:(y=o.map(Me),t[8]=o,t[9]=y);let b;t[10]===y?b=t[11]:(b=(0,$.jsx)(`ul`,{className:`mt-4 list-disc space-y-2 pl-5 text-sm text-fg-muted`,children:y}),t[10]=y,t[11]=b);let S;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>p(e.target.checked),t[12]=S):S=t[12];let T;t[13]===f?T=t[14]:(T=(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]=T);let E;t[15]===s?E=t[16]:(E=(0,$.jsx)(`span`,{children:s}),t[15]=s,t[16]=E);let D;t[17]!==E||t[18]!==T?(D=(0,$.jsxs)(`label`,{className:`mt-5 flex cursor-pointer items-start gap-3 text-sm text-fg`,children:[T,E]}),t[17]=E,t[18]=T,t[19]=D):D=t[19];let O;t[20]!==l||t[21]!==d?(O=(0,$.jsx)(q,{type:`button`,variant:`secondary`,onClick:d,children:l}),t[20]=l,t[21]=d,t[22]=O):O=t[22];let k=!f,A;t[23]!==c||t[24]!==u||t[25]!==k?(A=(0,$.jsx)(q,{type:`button`,disabled:k,onClick:u,children:c}),t[23]=c,t[24]=u,t[25]=k,t[26]=A):A=t[26];let j;t[27]!==O||t[28]!==A?(j=(0,$.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[O,A]}),t[27]=O,t[28]=A,t[29]=j):j=t[29];let M;t[30]!==D||t[31]!==j||t[32]!==_||t[33]!==v||t[34]!==b?(M=(0,$.jsxs)(oe,{children:[h,(0,$.jsxs)(L,{className:g,onOpenAutoFocus:Ne,children:[_,v,b,D,j]})]}),t[30]=D,t[31]=j,t[32]=_,t[33]=v,t[34]=b,t[35]=M):M=t[35];let N;return t[36]!==n||t[37]!==m||t[38]!==M?(N=(0,$.jsx)(C,{open:n,onOpenChange:m,children:M}),t[36]=n,t[37]=m,t[38]=M,t[39]=N):N=t[39],N}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)(ne,{className:`size-3.5 text-emerald-600 dark:text-emerald-400`}):t===`active`?(0,$.jsx)(B,{className:`size-3.5 animate-spin text-accent`}):(0,$.jsx)(z,{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 j;t[21]!==k||t[22]!==A||t[23]!==y?(j=(0,$.jsxs)(`span`,{className:y,children:[k,A]}),t[21]=k,t[22]=A,t[23]=y,t[24]=j):j=t[24];let M;t[25]!==r.connectedSince||t[26]!==r.state||t[27]!==n.uptime?(M=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]=M):M=t[28];let N;t[29]!==j||t[30]!==M||t[31]!==b?(N=(0,$.jsxs)(`div`,{className:b,children:[j,M]}),t[29]=j,t[30]=M,t[31]=b,t[32]=N):N=t[32];let P;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(U,{className:`size-4 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0}),t[33]=P):P=t[33];let L;t[34]!==N||t[35]!==x?(L=(0,$.jsxs)(`div`,{className:x,children:[N,P]}),t[34]=N,t[35]=x,t[36]=L):L=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 V;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?(V=_?(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)(ie,{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)(q,{type:`button`,variant:`secondary`,disabled:c,onClick:h,children:[c?(0,$.jsx)(B,{className:`size-4 animate-spin`}):null,n.stop]}):(0,$.jsxs)(q,{type:`button`,disabled:s,onClick:m,children:[s?(0,$.jsx)(B,{className:`size-4 animate-spin`}):(0,$.jsx)(F,{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)(I,{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)(q,{type:`button`,disabled:s||g,onClick:m,className:`w-full sm:w-auto`,children:[s?(0,$.jsx)(B,{className:`size-4 animate-spin`}):(0,$.jsx)(F,{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]=V):V=t[54];let H;return t[55]!==L||t[56]!==R||t[57]!==z||t[58]!==V||t[59]!==S?(H=(0,$.jsxs)(`section`,{className:S,children:[L,R,z,V]}),t[55]=L,t[56]=R,t[57]=z,t[58]=V,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=!_,[b,x]=(0,Q.useReducer)(y,Ye),{reconfiguring:S}=b,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,O;t[10]===c?O=t[11]:(O=c.trim().length>0&&!re(c.trim()),t[10]=c,t[11]=O);let k=O,A;t[12]===f?A=t[13]:(A=()=>{x({type:`patch`,patch:{reconfiguring:!1}}),f(``)},t[12]=f,t[13]=A);let j=A,M=_&&`ring-1 ring-amber-500/30`,N;t[14]===M?N=t[15]:(N=i(M),t[14]=M,t[15]=N);let P=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]===P?F=t[17]:(F=i(`flex size-9 shrink-0 items-center justify-center rounded-lg`,P),t[16]=P,t[17]=F);let I;t[18]===v?I=t[19]:(I=v?(0,$.jsx)(ne,{className:`size-4`,strokeWidth:2,"aria-hidden":!0}):(0,$.jsx)(te,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[18]=v,t[19]=I);let L;t[20]!==F||t[21]!==I?(L=(0,$.jsx)(`span`,{className:F,children:I}),t[20]=F,t[21]=I,t[22]=L):L=t[22];let R=v?n.brokerSecretReadyTitle:n.brokerSecretStepTitle,z;t[23]===R?z=t[24]:(z=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:R}),t[23]=R,t[24]=z);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 ee;t[30]!==z||t[31]!==H||t[32]!==U?(ee=(0,$.jsxs)(`div`,{children:[z,H,U]}),t[30]=z,t[31]=H,t[32]=U,t[33]=ee):ee=t[33];let W;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,$.jsx)(D,{className:`size-3`,"aria-hidden":!0}),t[34]=W):W=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,W]}),t[35]=n.brokerSecretConsoleLink,t[36]=G);let ie;t[37]!==r||t[38]!==n.brokerSecretEnvHint?(ie=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]=ie):ie=t[39];let ae;t[40]!==o||t[41]!==c||t[42]!==r||t[43]!==s||t[44]!==k||t[45]!==j||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?(ae=w?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:g,children:n.brokerSecretTitle}),(0,$.jsx)(ue,{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)(q,{type:`button`,variant:`secondary`,disabled:l,onClick:()=>{x({type:`patch`,patch:{reconfiguring:!0}})},children:n.brokerSecretReconfigure}),(0,$.jsx)(q,{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)(ue,{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)(q,{type:`button`,disabled:l||!k,onClick:p,children:[l?(0,$.jsx)(B,{className:`size-4 animate-spin`}):null,_?n.brokerSecretSaveAndContinue:n.brokerSecretSave]}),o||r?(0,$.jsx)(q,{type:`button`,variant:`ghost`,disabled:l,onClick:m,children:n.brokerSecretClear}):null,S?(0,$.jsx)(q,{type:`button`,variant:`ghost`,disabled:l,onClick:j,children:n.brokerSecretCancelReconfigure}):null]})]}),t[40]=o,t[41]=c,t[42]=r,t[43]=s,t[44]=k,t[45]=j,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]=ae):ae=t[66];let K;t[67]===u?K=t[68]:(K=u?(0,$.jsx)(`p`,{className:`text-xs text-emerald-700 dark:text-emerald-400`,children:u}):null,t[67]=u,t[68]=K);let J;t[69]!==ee||t[70]!==G||t[71]!==ie||t[72]!==ae||t[73]!==K?(J=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[ee,G,ie,ae,K]}),t[69]=ee,t[70]=G,t[71]=ie,t[72]=ae,t[73]=K,t[74]=J):J=t[74];let Y;t[75]!==L||t[76]!==J?(Y=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[L,J]}),t[75]=L,t[76]=J,t[77]=Y):Y=t[77];let X;t[78]!==Y||t[79]!==N?(X=(0,$.jsx)(Se,{className:N,children:Y}),t[78]=Y,t[79]=N,t[80]=X):X=t[80];let oe;return t[81]!==h||t[82]!==X?(oe=(0,$.jsx)(`div`,{ref:h,id:`tunnel-broker-secret-setup`,children:X}),t[81]=h,t[82]=X,t[83]=oe):oe=t[83],oe}function Ze(){return E().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=ce(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)(D,{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,J,{refreshInterval:6e4}),{data:c,mutate:l}=m(r?`tunnel-pair-context`:null,v,{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,A,{refreshInterval:4*6e4}),{data:_,mutate:y}=m(!f&&r&&c?.pairingReady?`tunnel-pair`:null,P,{refreshInterval:4*6e4}),[b,x]=(0,Q.useState)(``),[C,w]=(0,Q.useState)(``),[T,E]=(0,Q.useState)({pairContext:void 0,preferLan:n});if(!a.current&&(c!==T.pairContext||n!==T.preferLan)){E({pairContext:c,preferLan:n});let e=at(c,n);b!==e&&x(e)}let D=(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))},[]),j=(0,Q.useCallback)(e=>{a.current=!1,x(e?.trim()||at(c,n))},[c,n]),M=b.trim(),N=(0,Q.useMemo)(()=>{try{let e=new URL(M);return e.protocol===`http:`||e.protocol===`https:`}catch{return!1}},[M]),F=N&&s(M),I=!f&&!!(c&&!c.pairingReady&&c.blockReason===`GATEWAY_LOOPBACK_ONLY`),L=!f&&N&&!F&&!!_?.pairingSecret&&(c?.pairingReady===!0||!I),R=(0,Q.useMemo)(()=>{let e=rt(c);return n?e||(M&&!it(c,M)?M:``):M},[c,n,M]),z=(0,Q.useMemo)(()=>{if(!e)return``;if(C.trim())return C.trim();if(f&&h?.qrPayload?.trim())return h.qrPayload.trim();if(!L||!_?.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?R:t?.url??M;return i?u({baseUrl:i,pairingSecret:_.pairingSecret,lanUrl:n?null:t&&r?r.url:null}):``},[e,R,_?.pairingSecret,L,C,n,M,f,h?.qrPayload,c?.candidates]),B=S(()=>nt(z),[z],{enabled:!!z,initial:null,errorData:null}),V=z?B.data:null,H=!!(z&&B.error!==null&&!B.loading);return{tunnelActive:d,tunnelStatus:o,tunnelQr:h,pairContext:c,pairBaseUrl:b,setPairBaseUrl:D,applySuggestedPairUrl:O,applyCandidateUrl:k,baseOk:N,localhostWarn:F,pairingBlocked:I,deepLink:z,qrPayload:z,qrDataUrl:V,qrGenFailed:H,encoding:!!(z&&!V&&!H),refreshQr:(0,Q.useCallback)(async e=>{if(e?.trim()){w(e.trim()),g({qrPayload:e.trim(),publicUrl:o?.publicUrl??``,lanUrl:h?.lanUrl??null},!1);return}w(``),await l(),f?await g():c?.pairingReady&&await y()},[y,l,g,c?.pairingReady,h?.lanUrl,o?.publicUrl,f]),resetPairBaseFromContext:j}}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)(y,st),{actionError:u,starting:d,stopping:p,savingAutoStart:g,consentOpen:_,autoStartConfirmOpen:v,releaseConfirmOpen:b,releasing:x,brokerSecretDraft:S,savingBrokerSecret:C,brokerSecretNotice:w}=c,T=(0,Q.useRef)(null),E=ot(r??``),{data:D}=fe(s),{data:k,error:A,isLoading:M,mutate:P}=m(s?`tunnel-status`:null,J,{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 k?.config?.autoStart===!0},[D,k?.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]),L=re(I),R=k?.registrationSecret?.source===`env`,z=k?.registrationSecret?.source===`missing`,V=k?.registrationSecret?.configured===!0;(0,Q.useEffect)(()=>{let e=()=>{P()};return window.addEventListener(`tunnel-status`,e),()=>window.removeEventListener(`tunnel-status`,e)},[P]);let H=(0,Q.useMemo)(()=>[n.consentBullet1,n.consentBullet2,n.consentBullet3],[n.consentBullet1,n.consentBullet2,n.consentBullet3]),ee=(0,Q.useCallback)(async()=>{l({type:`patch`,patch:{actionError:null}}),l({type:`patch`,patch:{starting:!0}});try{let e=await O();await P(),le(),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}})}},[P,E.refreshQr]),te=(0,Q.useCallback)(()=>{if(!V){l({type:`patch`,patch:{actionError:n.brokerSecretRequiredBeforeStart}}),T.current?.scrollIntoView({behavior:`smooth`,block:`start`});return}if(k?.consentRequired){l({type:`patch`,patch:{consentOpen:!0}});return}ee()},[V,k?.consentRequired,ee,n.brokerSecretRequiredBeforeStart]),ne=(0,Q.useCallback)(async()=>{l({type:`patch`,patch:{consentOpen:!1}}),l({type:`patch`,patch:{actionError:null}});try{await K(),await Promise.all([P(),ee()])}catch(e){l({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}},[P,ee]),W=(0,Q.useCallback)(async()=>{l({type:`patch`,patch:{actionError:null}}),l({type:`patch`,patch:{stopping:!0}});try{await j(),await Promise.all([E.refreshQr(),P()]),le()}catch(e){l({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{stopping:!1}})}},[P,E.refreshQr]),G=(0,Q.useCallback)(async e=>{l({type:`patch`,patch:{savingAutoStart:!0}}),l({type:`patch`,patch:{actionError:null}});try{await h({autoStart:e}),le()}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){G(!1);return}if(k?.consentRequired){l({type:`patch`,patch:{actionError:n.consentExpiredBanner}});return}if(!k?.canAutoStart){l({type:`patch`,patch:{actionError:n.autoStartHint}});return}l({type:`patch`,patch:{autoStartConfirmOpen:!0}})},[G,k?.canAutoStart,k?.consentRequired,n,F]),ae=(0,Q.useCallback)(async()=>{let e=S.trim();if(e){l({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await h({registrationSecret:e}),l({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretSaved}}),le(),await P(),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}})}}},[S,P,n.brokerSecretSaved]),Y=(0,Q.useCallback)(async()=>{l({type:`patch`,patch:{savingBrokerSecret:!0,actionError:null,brokerSecretNotice:null}});try{await h({registrationSecret:null}),l({type:`patch`,patch:{brokerSecretDraft:``,brokerSecretNotice:n.brokerSecretCleared}}),le(),await P()}catch(e){l({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{savingBrokerSecret:!1}})}},[P,n.brokerSecretCleared]),X=(0,Q.useCallback)(async()=>{l({type:`patch`,patch:{releaseConfirmOpen:!1,actionError:null,releasing:!0}});try{await j({release:!0}),await Promise.all([E.refreshQr(),P()]),le()}catch(e){l({type:`patch`,patch:{actionError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{releasing:!1}})}},[P,E.refreshQr]),oe=(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 se=k??{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`}},ce=k?.consentRequired&&(se.enabled||F||k?.consent?.acceptedAt),ue=(0,$.jsx)(Xe,{t:n,brokerSecretFromEnv:R,brokerSecretMissing:z,brokerSecretConfiguredInConfig:L,brokerSecretMaskedValue:L?I:``,brokerSecretDraft:S,savingBrokerSecret:C,brokerSecretNotice:w,copyFailedLabel:a(t).clipboard.copyFailed,onDraftChange:e=>l({type:`patch`,patch:{brokerSecretDraft:e}}),onSave:()=>void ae(),onClear:()=>void Y(),sectionRef:T}),de=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(je,{open:_,title:n.consentTitle,intro:n.consentIntro,bullets:H,checkboxLabel:n.consentCheckbox,confirmLabel:ce?n.consentReconfirm:n.consentConfirm,cancelLabel:n.consentCancel,onConfirm:()=>void ne(),onCancel:()=>l({type:`patch`,patch:{consentOpen:!1}})},_?`consent-open`:`consent-closed`),(0,$.jsx)(N,{open:v,title:n.autoStartConfirmTitle,description:n.autoStartConfirmBody,confirmLabel:n.autoStartConfirmLabel,cancelLabel:n.consentCancel,onConfirm:()=>{l({type:`patch`,patch:{autoStartConfirmOpen:!1}}),G(!0)},onCancel:()=>l({type:`patch`,patch:{autoStartConfirmOpen:!1}})}),(0,$.jsx)(N,{open:b,title:n.releaseConfirmTitle,description:n.releaseConfirmBody,confirmLabel:n.releaseConfirmLabel,cancelLabel:n.consentCancel,destructive:!0,onConfirm:()=>void X(),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,ue,(0,$.jsx)(qe,{t:n,status:se,isLoading:M,statusErr:A,starting:d,stopping:p,showConsentExpired:!!ce,copyLabels:oe,startDisabled:!V,startDisabledReason:V?void 0:n.brokerSecretRequiredBeforeStart,stepLabel:n.flowStepStart,onStart:te,onStop:()=>void W()}),(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&&!k?.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:g||!F&&!k?.canAutoStart,onChange:ie}),n.autoStart]}),!k?.canAutoStart&&!F?(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.autoStartHint}):null,se.subdomain||se.publicUrl?(0,$.jsxs)(`div`,{className:`space-y-2 border-t border-edge-subtle pt-4`,children:[(0,$.jsxs)(q,{type:`button`,variant:`secondary`,disabled:x||p,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>l({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[x?(0,$.jsx)(B,{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)(U,{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`})]})}),de]}):(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,ue,(0,$.jsx)(qe,{t:n,status:se,isLoading:M,statusErr:A,starting:d,stopping:p,showConsentExpired:!!ce,copyLabels:oe,startDisabled:!V,startDisabledReason:V?void 0:n.brokerSecretRequiredBeforeStart,onStart:te,onStop:()=>void W()}),(0,$.jsx)(De,{pairQr:E,gatewayToken:r??``}),se.subdomain||se.publicUrl?(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,$.jsxs)(q,{type:`button`,variant:`secondary`,disabled:x||p,className:`border-danger/40 text-danger hover:bg-danger/10`,onClick:()=>l({type:`patch`,patch:{releaseConfirmOpen:!0}}),children:[x?(0,$.jsx)(B,{className:`size-4 animate-spin`}):null,n.release]})}):null,se.subdomain||se.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&&!k?.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:g||!F&&!k?.canAutoStart,onChange:ie}),n.autoStart]}),!k?.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)(U,{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`})]}),de]})}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)(H,{className:`h-20 rounded-lg`}),(0,$.jsx)(H,{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)(ie,{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)(q,{type:`button`,variant:`secondary`,disabled:s,onClick:()=>void x(),children:[s?(0,$.jsx)(B,{className:`mr-1 h-4 w-4 animate-spin`}):null,n.disableServe]}):(0,$.jsxs)(q,{type:`button`,disabled:s||!v,onClick:()=>void b(),children:[s?(0,$.jsx)(B,{className:`mr-1 h-4 w-4 animate-spin`}):(0,$.jsx)(F,{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:U,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:G,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)(D,{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)(_,{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??``,v;e[17]===c?v=e[18]:(v=()=>void c.refreshQr(),e[17]=c,e[18]=v);let y;e[19]!==c||e[20]!==g||e[21]!==v?(y=(0,$.jsx)(De,{pairQr:c,gatewayToken:g,lanOnly:!0,onRefreshQr:v}),e[19]=c,e[20]=g,e[21]=v,e[22]=y):y=e[22];let b;return e[23]!==y||e[24]!==h?(b=(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[h,y]}),e[23]=y,e[24]=h,e[25]=b):b=e[25],b}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 pe(`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)(me,{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)(q,{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:se,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:se,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,J,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,v,g);if(!l)return null;let y=d?.tailscale.active===!0,b=h?.state,x=h?.enabled&&b===`connected`,S=h?.enabled&&(b===`connecting`||b===`reconnecting`||!!h?.startProgress||!!h?.frpcDownload),C=(_?.candidates??[]).some(wt),w=y?`active`:`off`,T=y?c.statusActive:c.statusOff,E;t[5]!==c.tailscaleCardTitle||t[6]!==w||t[7]!==T?(E={tab:`tailscale`,icon:U,title:c.tailscaleCardTitle,kind:w,statusLabel:T},t[5]=c.tailscaleCardTitle,t[6]=w,t[7]=T,t[8]=E):E=t[8];let D=x?`active`:S?`connecting`:`off`,O=x?c.statusActive:S?c.statusConnecting:c.statusOff,k;t[9]!==c.publicCardTitle||t[10]!==D||t[11]!==O?(k={tab:`public`,icon:he,title:c.publicCardTitle,kind:D,statusLabel:O},t[9]=c.publicCardTitle,t[10]=D,t[11]=O,t[12]=k):k=t[12];let A=C?`active`:`off`,j=C?c.statusActive:c.statusOff,M;t[13]!==c.reverseProxyCardTitle||t[14]!==A||t[15]!==j?(M={tab:`reverse-proxy`,icon:X,title:c.reverseProxyCardTitle,kind:A,statusLabel:j},t[13]=c.reverseProxyCardTitle,t[14]=A,t[15]=j,t[16]=M):M=t[16];let N;t[17]!==c.sshCardStatus||t[18]!==c.sshCardTitle?(N={tab:`ssh`,icon:se,title:c.sshCardTitle,kind:`off`,statusLabel:c.sshCardStatus},t[17]=c.sshCardStatus,t[18]=c.sshCardTitle,t[19]=N):N=t[19];let P;t[20]!==c.lanCardStatus||t[21]!==c.lanCardTitle?(P={tab:`lan`,icon:G,title:c.lanCardTitle,kind:`off`,statusLabel:c.lanCardStatus},t[20]=c.lanCardStatus,t[21]=c.lanCardTitle,t[22]=P):P=t[22];let F;t[23]!==k||t[24]!==M||t[25]!==N||t[26]!==P||t[27]!==E?(F=[E,k,M,N,P],t[23]=k,t[24]=M,t[25]=N,t[26]=P,t[27]=E,t[28]=F):F=t[28];let I=F,L;return t[29]!==I||t[30]!==n?(L=(0,$.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5`,children:I.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]=I,t[30]=n,t[31]=L):L=t[31],L}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 h;t[11]===r?h=t[12]:(h=(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:r}),t[11]=r,t[12]=h);let g;t[13]!==m||t[14]!==h?(g=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[m,h]}),t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(V,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0}),t[16]=_):_=t[16];let v;t[17]!==d||t[18]!==g?(v=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[d,g,_]}),t[17]=d,t[18]=g,t[19]=v):v=t[19];let y;t[20]===c?y=t[21]:(y=(0,$.jsx)(`span`,{className:`mt-3 text-xs font-medium text-accent`,children:c}),t[20]=c,t[21]=y);let b;return t[22]!==s||t[23]!==y||t[24]!==v?(b=(0,$.jsxs)(`button`,{type:`button`,onClick:s,className:u,children:[v,y]}),t[22]=s,t[23]=y,t[24]=v,t[25]=b):b=t[25],b}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:U,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:he,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:X,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 E;t[39]!==c.configure||t[40]!==c.sshCardDesc||t[41]!==c.sshCardTitle||t[42]!==T?(E=(0,$.jsx)(Dt,{icon:se,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]=E):E=t[43];let D;t[44]===n?D=t[45]:(D=()=>n(`lan`),t[44]=n,t[45]=D);let O;t[46]!==c.configure||t[47]!==c.lanCardDesc||t[48]!==c.lanCardTitle||t[49]!==D?(O=(0,$.jsx)(Dt,{icon:G,title:c.lanCardTitle,description:c.lanCardDesc,openLabel:c.configure,onOpen:D}),t[46]=c.configure,t[47]=c.lanCardDesc,t[48]=c.lanCardTitle,t[49]=D,t[50]=O):O=t[50];let k;t[51]!==S||t[52]!==w||t[53]!==E||t[54]!==O||t[55]!==b?(k=(0,$.jsxs)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:[b,S,w,E,O]}),t[51]=S,t[52]=w,t[53]=E,t[54]=O,t[55]=b,t[56]=k):k=t[56];let A;t[57]!==k||t[58]!==v?(A=(0,$.jsxs)(`div`,{children:[v,k]}),t[57]=k,t[58]=v,t[59]=A):A=t[59];let j;t[60]===c.oneAtATimeHint?j=t[61]:(j=(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:c.oneAtATimeHint}),t[60]=c.oneAtATimeHint,t[61]=j);let M;t[62]===s.advanced.proxyTitle?M=t[63]:(M=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:s.advanced.proxyTitle}),t[62]=s.advanced.proxyTitle,t[63]=M);let N;t[64]===s.advanced.proxyBody?N=t[65]:(N=(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:s.advanced.proxyBody}),t[64]=s.advanced.proxyBody,t[65]=N);let P;t[66]!==r||t[67]!==s.advanced.proxyDocs?(P=(0,$.jsx)($e,{language:r,label:s.advanced.proxyDocs,section:`advanced`,className:`mt-2`}),t[66]=r,t[67]=s.advanced.proxyDocs,t[68]=P):P=t[68];let F;t[69]!==M||t[70]!==N||t[71]!==P?(F=(0,$.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-4 py-3`,children:[M,N,P]}),t[69]=M,t[70]=N,t[71]=P,t[72]=F):F=t[72];let I;t[73]!==c.docsLink||t[74]!==r?(I=(0,$.jsx)($e,{language:r,label:c.docsLink}),t[73]=c.docsLink,t[74]=r,t[75]=I):I=t[75];let L;return t[76]!==A||t[77]!==j||t[78]!==F||t[79]!==I||t[80]!==g||t[81]!==_?(L=(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[g,_,A,j,F,I]}),t[76]=A,t[77]=j,t[78]=F,t[79]=I,t[80]=g,t[81]=_,t[82]=L):L=t[82],L}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`,k,`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,v,{refreshInterval:6e4}),d=Lt(c),[h,g]=(0,Q.useState)(``),[_,y]=(0,Q.useState)({busy:!1,result:null}),[b,x]=(0,Q.useState)({busy:!1,error:null});(0,Q.useEffect)(()=>{h||(d?g(d):r&&g(r))},[d,r,h]);let C=(0,Q.useMemo)(()=>h.trim()||(d??r??``),[d,r,h]),w=!d&&!!r&&C===r,T=Rt(c),{data:E,mutate:D}=m(n&&C?[`reverse-proxy-pair`,C]:null,()=>P(),{refreshInterval:4*6e4,revalidateOnFocus:!1}),O=(0,Q.useMemo)(()=>!C||!E?.pairingSecret?``:u({baseUrl:C,pairingSecret:E.pairingSecret,lanUrl:T}),[C,T,E?.pairingSecret]),k=S(()=>nt(O),[O],{enabled:!!O,initial:null,errorData:null}),A=(0,Q.useCallback)(async()=>{let e=h.trim()||C;if(e){y({busy:!0,result:null});try{y({busy:!1,result:await Mt(e)})}catch(e){y({busy:!1,result:{ok:!1,code:`NETWORK_ERROR`,message:e instanceof Error?e.message:String(e)}})}}},[h,C]),j=(0,Q.useCallback)(async()=>{let e=C.trim();if(e){x({busy:!0,error:null});try{await Nt(e),await l(),await s(`tunnel-pair-context`),x({busy:!1,error:null})}catch(e){x({busy:!1,error:e instanceof Error?e.message:String(e)})}}},[C,s,l]),M=(0,Q.useCallback)(async()=>{x({busy:!0,error:null});try{await Nt(null),await l(),await s(`tunnel-pair-context`),g(``),y({busy:!1,result:null}),x({busy:!1,error:null})}catch(e){x({busy:!1,error:e instanceof Error?e.message:String(e)})}},[s,l]),N=(0,Q.useCallback)(async()=>{await D()},[D]);return n?(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(Se,{children:[(0,$.jsx)(be,{icon:U,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),y({busy:!1,result:null})}}),(0,$.jsxs)(q,{type:`button`,variant:`secondary`,className:`shrink-0 whitespace-nowrap`,onClick:()=>void A(),disabled:_.busy||!h.trim(),children:[_.busy?(0,$.jsx)(B,{className:`size-3.5 animate-spin`}):null,_.busy?t.probing:t.probeButton]})]}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:t.urlHint}),w&&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:[C&&d!==C?(0,$.jsxs)(q,{type:`button`,onClick:()=>void j(),disabled:b.busy,children:[b.busy?(0,$.jsx)(B,{className:`size-3.5 animate-spin`}):null,b.busy?t.saving:t.saveAsDefault]}):null,d?(0,$.jsx)(q,{type:`button`,variant:`ghost`,onClick:()=>void M(),disabled:b.busy,children:t.clear}):null]}),b.error?(0,$.jsx)(`p`,{className:`text-xs text-red-800 dark:text-red-200`,children:b.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})]}),O?(0,$.jsxs)(q,{type:`button`,variant:`ghost`,className:`shrink-0`,onClick:()=>void N(),children:[(0,$.jsx)(ee,{className:`size-4`}),t.refreshQr]}):null]}),C?E?.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:`}),` `,C,T?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`br`,{}),(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:`lanUrl:`}),` `,T]}):null]}),k.data?(0,$.jsx)(`img`,{src:k.data,alt:``,className:`size-56 rounded-lg border border-edge-subtle bg-white object-contain p-3 dark:border-edge`}):k.loading?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.encoding}):null,(0,$.jsx)(ie,{text:O,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]=T(),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-BXNELNBa.js";import{c as o,n as s}from"./locale-store-Ba72bFmP.js";import{Ys as c,ko as l}from"./index-DcUaXYeb.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-CL7YTwLV.js → schedule-field-D6vKd6-T.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{Eo as a,So as o,ro as s,to as c,wo as l}from"./index-ehajXmqL.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(l,`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`,o,`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`,o),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`,o),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`,o);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]),[l,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={...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)(c,{className:g,disabled:r,value:E,onChange:e=>{let t=e.target.value;T({mode:t})},"aria-label":n.scheduleTimeLabel,children:[(0,m.jsx)(s,{value:`no_repeat`,children:n.modeNoRepeat}),(0,m.jsx)(s,{value:`interval`,children:n.modeInterval}),(0,m.jsx)(s,{value:`hourly`,children:n.modeHourly}),(0,m.jsx)(s,{value:`daily`,children:n.modeDaily}),(0,m.jsx)(s,{value:`weekly`,children:n.modeWeekly}),(0,m.jsx)(s,{value:`monthly`,children:n.modeMonthly}),(0,m.jsx)(s,{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)(c,{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)(s,{value:`minutes`,children:n.intervalKindMinutes}),(0,m.jsx)(s,{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)(c,{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)(s,{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)(c,{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)(s,{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)(c,{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)(s,{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`,o),O=i(l,`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]),l=(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)(c,{className:O,disabled:r,value:l,onChange:e=>{let n=e.target.value;n&&(t(parseInt(n,10)),d(null))},children:[(0,m.jsx)(s,{value:``,children:n.presets.custom}),i.map(e=>(0,m.jsx)(s,{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`,o),M=()=>({start:`09:00`,end:`22:00`,timezone:``});function N(e){let t=(0,f.c)(55),{value:n,onChange:r,labels:i,disabled:o}=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]!==o||t[3]!==i.add||t[4]!==e?(n=(0,m.jsx)(a,{type:`button`,variant:`secondary`,className:`text-sm`,disabled:o,onClick:e,children:i.add}),t[2]=o,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]!==o||t[12]!==c||t[13]!==n.start?(l=(0,m.jsx)(`input`,{type:`time`,step:60,disabled:o,className:j,value:n.start,onChange:c}),t[11]=o,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]!==o||t[24]!==p||t[25]!==n.end?(h=(0,m.jsx)(`input`,{type:`time`,step:60,disabled:o,className:j,value:n.end,onChange:p}),t[23]=o,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]!==o||t[36]!==v||t[37]!==n.timezone?(y=(0,m.jsx)(`input`,{type:`text`,disabled:o,className:j,value:n.timezone,onChange:v,placeholder:`Asia/Shanghai`,autoComplete:`off`}),t[35]=o,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]!==o||t[49]!==i.clear||t[50]!==S?(C=(0,m.jsx)(a,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:o,onClick:S,children:i.clear}),t[48]=o,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{Do as a,To as o,io as s,ko as c,oo as l}from"./index-DcUaXYeb.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(a,`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`,o,`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`,o),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`,o),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`,o);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]),[c,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={...c,...e};f({type:`replace`,state:n});let r=S(n),i=S(c);Object.keys(r).some(e=>r[e]!==i[e])&&t(d(r))},[t,c]),{mode:E,intervalKind:D,onceDate:O,intervalMinutes:k,intervalHours:A,minute:j,hour:M,weekDays:N,dayOfMonth:P,rawCron:F,intervalMinutesDraft:I,intervalHoursDraft:L}=c,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)(s,{className:g,disabled:r,value:E,onChange:e=>{let t=e.target.value;T({mode:t})},"aria-label":n.scheduleTimeLabel,children:[(0,m.jsx)(l,{value:`no_repeat`,children:n.modeNoRepeat}),(0,m.jsx)(l,{value:`interval`,children:n.modeInterval}),(0,m.jsx)(l,{value:`hourly`,children:n.modeHourly}),(0,m.jsx)(l,{value:`daily`,children:n.modeDaily}),(0,m.jsx)(l,{value:`weekly`,children:n.modeWeekly}),(0,m.jsx)(l,{value:`monthly`,children:n.modeMonthly}),(0,m.jsx)(l,{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)(s,{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)(l,{value:`minutes`,children:n.intervalKindMinutes}),(0,m.jsx)(l,{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)(s,{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)(l,{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)(s,{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)(l,{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)(s,{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)(l,{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`,o),O=i(a,`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]),c=(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)(s,{className:O,disabled:r,value:c,onChange:e=>{let n=e.target.value;n&&(t(parseInt(n,10)),d(null))},children:[(0,m.jsx)(l,{value:``,children:n.presets.custom}),i.map(e=>(0,m.jsx)(l,{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`,o),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)(c,{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 l;t[11]!==a||t[12]!==s||t[13]!==n.start?(l=(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]=l):l=t[14];let u;t[15]!==o||t[16]!==l?(u=(0,m.jsxs)(`label`,{className:`block min-w-0`,children:[o,l]}),t[15]=o,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)(c,{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};
|