@xopcai/xopc 0.0.230 → 0.0.231

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Bp_wmuGW.js → agent-avatar-dicebear-CBqUnlvL.js} +1 -1
  4. package/dist/gateway/static/root/assets/agents-7YO6znTT.js +68 -0
  5. package/dist/gateway/static/root/assets/{app-management-settings-panel-CwAPK4Jm.js → app-management-settings-panel-DP7YVRPn.js} +1 -1
  6. package/dist/gateway/static/root/assets/{appearance-settings-DsGLvqTb.js → appearance-settings-CVQ5n7y6.js} +1 -1
  7. package/dist/gateway/static/root/assets/{apps-page-Ee9qOQEx.js → apps-page-DSCia0DT.js} +1 -1
  8. package/dist/gateway/static/root/assets/{attachment-load-B4qqigAQ.js → attachment-load-mmr_mHRr.js} +1 -1
  9. package/dist/gateway/static/root/assets/{automations-page-B8ImehSW.js → automations-page-DfY-T6Ga.js} +1 -1
  10. package/dist/gateway/static/root/assets/automations-workspace-BpvD54D6.js +6 -0
  11. package/dist/gateway/static/root/assets/{binary-plugins-DaJbyYc2.js → binary-plugins-CO9QMEh2.js} +1 -1
  12. package/dist/gateway/static/root/assets/{block-editor-Kl25XWJc.js → block-editor-CE14CVOy.js} +3 -3
  13. package/dist/gateway/static/root/assets/browser-settings-page-CeESA4Oj.js +8 -0
  14. package/dist/gateway/static/root/assets/{browser-workflows-page-DjMxs33B.js → browser-workflows-page-1wgXyoSO.js} +2 -2
  15. package/dist/gateway/static/root/assets/capabilities-settings-panel-B_OXTojB.js +7 -0
  16. package/dist/gateway/static/root/assets/capability-presets-settings-panel-D5nZecxV.js +3 -0
  17. package/dist/gateway/static/root/assets/channels-settings-BzmnWx6X.js +1 -0
  18. package/dist/gateway/static/root/assets/{chat-terminal-dock-BiU_4Rq6.js → chat-terminal-dock-CdRW6Euc.js} +2 -2
  19. package/dist/gateway/static/root/assets/cloud-C4-yfnnk.js +1 -0
  20. package/dist/gateway/static/root/assets/connectors-page-DX6OkwFQ.js +2 -0
  21. package/dist/gateway/static/root/assets/{cron-expression-Cs_5pUPT.js → cron-expression-DYSMZsms.js} +1 -1
  22. package/dist/gateway/static/root/assets/{date-picker-y1kWrFVU.js → date-picker-DGCfX4tK.js} +1 -1
  23. package/dist/gateway/static/root/assets/{dependency-picker-skc62zrn.js → dependency-picker-DHDa4ht1.js} +1 -1
  24. package/dist/gateway/static/root/assets/{desktop-pet-ux9DxchT.js → desktop-pet-CMO-J3cG.js} +1 -1
  25. package/dist/gateway/static/root/assets/{desktop-pet-settings-BVVCBgYK.js → desktop-pet-settings-MmOR4A3u.js} +1 -1
  26. package/dist/gateway/static/root/assets/{directory-picker-path-field-V8vZP0Dy.js → directory-picker-path-field-B9qoxDcn.js} +1 -1
  27. package/dist/gateway/static/root/assets/{extension-debug-page-Dh6DDuvQ.js → extension-debug-page-DdH0dG2_.js} +1 -1
  28. package/dist/gateway/static/root/assets/{extension-page-8OKQDEat.js → extension-page-Clg-KktN.js} +1 -1
  29. package/dist/gateway/static/root/assets/{extension-settings-page-BgSV0Nny.js → extension-settings-page-eP3fJ2M6.js} +1 -1
  30. package/dist/gateway/static/root/assets/files-Dp8_uGTO.js +1 -0
  31. package/dist/gateway/static/root/assets/{gateway-config-api-Dlc6eaTG.js → gateway-config-api-DEHnF4Wm.js} +1 -1
  32. package/dist/gateway/static/root/assets/{gateway-settings-DqQgiAUv.js → gateway-settings-DKkEXXj9.js} +1 -1
  33. package/dist/gateway/static/root/assets/{heartbeat-settings-Pxqk5GFH.js → heartbeat-settings-DlBPNubY.js} +1 -1
  34. package/dist/gateway/static/root/assets/home-page-BnOrLRfs.js +1 -0
  35. package/dist/gateway/static/root/assets/index-0xQO5B_Q.js +70 -0
  36. package/dist/gateway/static/root/assets/index-CCyIdGuQ.css +2 -0
  37. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BSFNqxzY.js → keyboard-shortcuts-settings-BvpEeHnm.js} +1 -1
  38. package/dist/gateway/static/root/assets/local-app-workbench-page-Ch1rdUo8.js +2 -0
  39. package/dist/gateway/static/root/assets/{local-apps-page-DzU6yZ9-.js → local-apps-page-Bzvn99eH.js} +1 -1
  40. package/dist/gateway/static/root/assets/logs-page-zxx2ExlY.js +2 -0
  41. package/dist/gateway/static/root/assets/{management-settings-B8hM56HS.js → management-settings-BQaeyOYm.js} +1 -1
  42. package/dist/gateway/static/root/assets/{markdown-split-DRbZjxMK.js → markdown-split-D9tmIiEm.js} +1 -1
  43. package/dist/gateway/static/root/assets/markdown-view-B1bGSQqt.css +1 -0
  44. package/dist/gateway/static/root/assets/{media-plugins-B8vMe5VX.js → media-plugins-D8I7OGnT.js} +1 -1
  45. package/dist/gateway/static/root/assets/models-hub-cache-0RjEwafI.js +1 -0
  46. package/dist/gateway/static/root/assets/{notes-api-BFsOGYkd.js → notes-api-EpgG-OQc.js} +1 -1
  47. package/dist/gateway/static/root/assets/{notes-page-B-YZ7iuK.js → notes-page-CCvjGMhN.js} +1 -1
  48. package/dist/gateway/static/root/assets/notes-workbench-9cgh77VH.js +4 -0
  49. package/dist/gateway/static/root/assets/oauth-api-BwNLwbI8.js +1 -0
  50. package/dist/gateway/static/root/assets/{product-open-page-DkWcyki5.js → product-open-page-MmMswmOU.js} +1 -1
  51. package/dist/gateway/static/root/assets/project-detail-page-hf6pmH4p.js +1 -0
  52. package/dist/gateway/static/root/assets/projects-page-By2U-Wdh.js +1 -0
  53. package/dist/gateway/static/root/assets/remote-access-hub-CUcpp7CQ.js +1 -0
  54. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Bq_ETeal.js → runtime-tools-settings-panel-Dx6o7sLu.js} +1 -1
  55. package/dist/gateway/static/root/assets/{schema-form-BogTlrsP.js → schema-form-Cdd9c4vt.js} +1 -1
  56. package/dist/gateway/static/root/assets/sessions-page-ByI82xS1.js +1 -0
  57. package/dist/gateway/static/root/assets/settings-advanced-gate-BCoI5IJ8.js +1 -0
  58. package/dist/gateway/static/root/assets/{settings-form-section-Coy1Cbp6.js → settings-form-section-D0YxMnhm.js} +1 -1
  59. package/dist/gateway/static/root/assets/{settings-loading-skeleton-B5GU7iCG.js → settings-loading-skeleton-y53gEKsF.js} +1 -1
  60. package/dist/gateway/static/root/assets/{settings-page-Dd-BRu12.js → settings-page-BoE_tToG.js} +1 -1
  61. package/dist/gateway/static/root/assets/{setup-status-panel-CwEFAVWx.js → setup-status-panel-BQmyb5KC.js} +1 -1
  62. package/dist/gateway/static/root/assets/share-preview-page-DiqBn-oE.js +2 -0
  63. package/dist/gateway/static/root/assets/shares-settings-Bf3VpZ-R.js +1 -0
  64. package/dist/gateway/static/root/assets/skill-reload-api-CXHlbuGS.js +1 -0
  65. package/dist/gateway/static/root/assets/{skills-page-Brxb6QnW.js → skills-page-CZwhWiRl.js} +1 -1
  66. package/dist/gateway/static/root/assets/{skills-page.utils-FB5LtEGm.js → skills-page.utils-kBGr8opZ.js} +1 -1
  67. package/dist/gateway/static/root/assets/{system-settings-panel-ChosWt8n.js → system-settings-panel-CPBs6lWi.js} +1 -1
  68. package/dist/gateway/static/root/assets/task-detail-page-Bo0KSZ2v.js +1 -0
  69. package/dist/gateway/static/root/assets/theme-store-Qgvo0Ga7.js +1 -0
  70. package/dist/gateway/static/root/assets/{use-autosave-2SqnmSKD.js → use-autosave-C4YcEiP9.js} +1 -1
  71. package/dist/gateway/static/root/assets/user-context-page-Cnj7gMX2.js +1 -0
  72. package/dist/gateway/static/root/assets/{voice-api-key-field-DtTIF6M8.js → voice-api-key-field-BML8zCwZ.js} +1 -1
  73. package/dist/gateway/static/root/assets/{work-discovery-overlay-CK3aZDdE.js → work-discovery-overlay-CKIdPEen.js} +1 -1
  74. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BjOuddkX.js → workflow-run-setup-panel-BK44Vm5W.js} +2 -2
  75. package/dist/gateway/static/root/assets/workflows-page-CB98MTwG.js +5 -0
  76. package/dist/gateway/static/root/index.html +10 -6
  77. package/dist/package.js +1 -1
  78. package/dist/src/agent/service.d.ts +1 -0
  79. package/dist/src/agent/service.js +5 -2
  80. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  81. package/dist/src/agent/tools/write.js +9 -12
  82. package/dist/src/agent/tools/xopc-use-tool.js +2 -2
  83. package/dist/src/auth/oauth/index.js +2 -2
  84. package/dist/src/auth/oauth/registry.d.ts +1 -1
  85. package/dist/src/auth/oauth/registry.js +5 -1
  86. package/dist/src/auth/oauth/xopc-cloud.d.ts +1 -0
  87. package/dist/src/auth/oauth/xopc-cloud.js +8 -2
  88. package/dist/src/files/file-service.d.ts +36 -0
  89. package/dist/src/files/file-service.js +282 -0
  90. package/dist/src/gateway/heartbeat/service.js +1 -1
  91. package/dist/src/gateway/hono/app.js +2 -2
  92. package/dist/src/gateway/hono/routes/files.d.ts +3 -0
  93. package/dist/src/gateway/hono/routes/files.js +172 -0
  94. package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
  95. package/dist/src/gateway/hono/routes/projects.js +0 -508
  96. package/dist/src/gateway/hono/routes/shares.js +410 -21
  97. package/dist/src/gateway/hono/routes/voice.js +1 -1
  98. package/dist/src/gateway/hono/routes/workspace.js +15 -974
  99. package/dist/src/gateway/service.js +9 -9
  100. package/dist/src/heartbeat/index.js +1 -1
  101. package/dist/src/share/hosted-session-share.d.ts +104 -0
  102. package/dist/src/share/hosted-session-share.js +276 -0
  103. package/dist/src/share/note-share-service.js +4 -24
  104. package/dist/src/share/session-share-projector.d.ts +31 -0
  105. package/dist/src/share/session-share-projector.js +79 -0
  106. package/dist/src/share/session-share-service.d.ts +89 -0
  107. package/dist/src/share/session-share-service.js +325 -0
  108. package/dist/src/share/share-asset-ticket.d.ts +7 -0
  109. package/dist/src/share/share-asset-ticket.js +30 -0
  110. package/dist/src/share/share-landing.d.ts +4 -3
  111. package/dist/src/share/share-landing.js +5 -5
  112. package/dist/src/share/share-store.d.ts +27 -2
  113. package/dist/src/share/share-store.js +71 -8
  114. package/dist/src/share/share-types.d.ts +17 -2
  115. package/dist/src/tui/backends/embedded-backend.js +1 -1
  116. package/dist/src/tui/backends/gateway-realtime-backend.js +11 -3
  117. package/package.json +1 -1
  118. package/dist/gateway/static/root/assets/agents-CKG93dlc.js +0 -68
  119. package/dist/gateway/static/root/assets/automations-workspace-BNFAfNwC.js +0 -6
  120. package/dist/gateway/static/root/assets/browser-settings-page-Cg6NgwE_.js +0 -8
  121. package/dist/gateway/static/root/assets/capabilities-settings-panel-NvJKgF1u.js +0 -7
  122. package/dist/gateway/static/root/assets/capability-presets-settings-panel-C2uBdALe.js +0 -3
  123. package/dist/gateway/static/root/assets/channels-settings-CIcYKMEs.js +0 -1
  124. package/dist/gateway/static/root/assets/connectors-page-CEEcmUiP.js +0 -2
  125. package/dist/gateway/static/root/assets/home-page-1xjo6wE4.js +0 -1
  126. package/dist/gateway/static/root/assets/index-Bbd_dXui.js +0 -70
  127. package/dist/gateway/static/root/assets/index-D_hrEKXM.css +0 -2
  128. package/dist/gateway/static/root/assets/local-app-workbench-page-heQ4-PJ7.js +0 -2
  129. package/dist/gateway/static/root/assets/logs-page-BblnS6Jy.js +0 -2
  130. package/dist/gateway/static/root/assets/markdown-view-CLzTdVLW.css +0 -1
  131. package/dist/gateway/static/root/assets/notes-workbench-CAM09C8b.js +0 -4
  132. package/dist/gateway/static/root/assets/project-detail-page-BIPIwgU2.js +0 -1
  133. package/dist/gateway/static/root/assets/projects-page-B_kzTn1K.js +0 -1
  134. package/dist/gateway/static/root/assets/remote-access-hub-CtD8DsD-.js +0 -1
  135. package/dist/gateway/static/root/assets/sessions-page-B8n9HI1y.js +0 -1
  136. package/dist/gateway/static/root/assets/settings-advanced-gate-xlhdRTME.js +0 -1
  137. package/dist/gateway/static/root/assets/share-preview-page-DzXw9UQJ.js +0 -2
  138. package/dist/gateway/static/root/assets/shares-settings-Bk6UQOwS.js +0 -1
  139. package/dist/gateway/static/root/assets/skill-reload-api-DrmQZ3Au.js +0 -1
  140. package/dist/gateway/static/root/assets/task-detail-page-CW2sJbdc.js +0 -1
  141. package/dist/gateway/static/root/assets/theme-store-DOdCjyuw.js +0 -1
  142. package/dist/gateway/static/root/assets/user-context-page-Bq9KB-Oj.js +0 -1
  143. package/dist/gateway/static/root/assets/workflows-page-CcbGEQol.js +0 -5
  144. package/dist/src/gateway/file-path-classifier.d.ts +0 -30
  145. package/dist/src/gateway/file-path-classifier.js +0 -105
  146. package/dist/src/gateway/file-reference-errors.d.ts +0 -6
  147. package/dist/src/gateway/file-reference-errors.js +0 -21
  148. package/dist/src/gateway/file-reference-registry.d.ts +0 -34
  149. package/dist/src/gateway/file-reference-registry.js +0 -45
  150. /package/dist/gateway/static/root/assets/{markdown-view-DvM5PWEH.js → markdown-view-RxNHwlNo.js} +0 -0
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{p as i}from"./chunk-KS7C4IRE-BaASWQor.js";import{n as a,r as o}from"./popover-select-CccGri5Y.js";import{t as s}from"./download-Dk-ZjtO6.js";import{t as c}from"./plus-Q2yW6OE7.js";import{t as l}from"./search-DA7gz22f.js";import{t as u}from"./x-B_N4OPjy.js";import{t as d}from"./cn-JdwAhgNB.js";import{t as f}from"./button-CSEbl4zT.js";import{s as p}from"./form-field-width-DJw_jULe.js";import{n as m,t as h}from"./interaction-BmQogeqz.js";import{t as g}from"./messages-BMdD0LWk.js";import{l as _,n as ee,r as v,s as y}from"./locale-store-CXhjfe4q.js";import{i as b,o as x}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{a as S,n as C,o as w,r as T,s as E,t as D}from"./dist-BPoKqzeH.js";import{i as O}from"./vendor-swr-BIWyz7Rc.js";import{n as k,r as A}from"./gateway-config-swr-BWGjnmDl.js";import{n as j,t as M}from"./registry-api-BFZrVYfy.js";import{Ca as N,Ea as P,Ec as F,Ja as I,Kc as L,Ml as R,Os as z,Rn as B,Sa as V,Ta as H,Uc as U,Wc as W,Xs as G,Ya as te,_a as ne,at as re,ba as ie,fc as K,fs as ae,fu as oe,ht as se,no as q,pc as ce,pu as le,qa as J,to as ue,ul as de,va as fe,wc as pe,xa as me,xl as he,ya as ge,zn as _e}from"./index-Bbd_dXui.js";import{n as ve,t as ye}from"./use-autosave-2SqnmSKD.js";import{t as be}from"./settings-advanced-gate-xlhdRTME.js";import{n as xe,t as Y}from"./settings-form-section-Coy1Cbp6.js";import{t as Se}from"./page-tabs-BaEQMYm_.js";var X=e(t(),1),Ce=n(),Z=r();function we(e){let t=new Date(e),n=Math.floor((new Date().getTime()-t.getTime())/(1e3*60*60*24));return n===0?t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):n===1?`Yesterday`:n<7?t.toLocaleDateString([],{weekday:`short`}):t.toLocaleDateString([],{month:`short`,day:`numeric`})}function Te(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Ee(e){let t=(0,Ce.c)(105),{session:n,variant:r,labels:i,sessionAgentId:a,sessionAgentAvatar:o,onOpen:c,onAction:l}=e,u;t[0]!==i.unnamedSession||t[1]!==n.name?(u=n.name?.trim()||i.unnamedSession,t[0]=i.unnamedSession,t[1]=n.name,t[2]=u):u=t[2];let f=u,p;t[3]===n.name?p=t[4]:(p=n.name?.trim(),t[3]=n.name,t[4]=p);let m=!!p,g=n.status===`archived`,_=n.status===`pinned`,ee=r===`list`&&`sm:flex-row sm:items-center sm:gap-4`,v;t[5]===ee?v=t[6]:(v=d(`group flex min-w-0 w-full max-w-full cursor-pointer flex-col rounded-xl bg-surface-base text-left transition-colors duration-150 ease-out`,`hover:bg-surface-hover active:scale-[0.99]`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,ee),t[5]=ee,t[6]=v);let y;t[7]===c?y=t[8]:(y=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())},t[7]=c,t[8]=y);let b=r===`list`&&`sm:py-3`,x;t[9]===b?x=t[10]:(x=d(`flex min-w-0 items-start justify-between gap-2 bg-surface-hover/35 px-3 py-2 dark:bg-surface-hover/25`,b),t[9]=b,t[10]=x);let S;t[11]===n.sourceChannel?S=t[12]:(S=(0,Z.jsx)(`div`,{className:`flex min-w-0 items-center gap-2`,children:(0,Z.jsx)(`span`,{className:`truncate text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:n.sourceChannel})}),t[11]=n.sourceChannel,t[12]=S);let C;t[13]===_?C=t[14]:(C=_?(0,Z.jsx)(ce,{className:`size-3.5 text-accent-fg`,strokeWidth:1.75,"aria-hidden":!0}):null,t[13]=_,t[14]=C);let w;t[15]===n.updatedAt?w=t[16]:(w=we(n.updatedAt),t[15]=n.updatedAt,t[16]=w);let T;t[17]===w?T=t[18]:(T=(0,Z.jsx)(`span`,{children:w}),t[17]=w,t[18]=T);let E;t[19]!==T||t[20]!==C?(E=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-fg-muted`,children:[C,T]}),t[19]=T,t[20]=C,t[21]=E):E=t[21];let D;t[22]!==E||t[23]!==x||t[24]!==S?(D=(0,Z.jsxs)(`div`,{className:x,children:[S,E]}),t[22]=E,t[23]=x,t[24]=S,t[25]=D):D=t[25];let O=r===`list`&&`sm:py-3`,k;t[26]===O?k=t[27]:(k=d(`min-w-0 flex-1 px-3 py-2`,O),t[26]=O,t[27]=k);let A=r===`list`&&`sm:items-start`,j;t[28]===A?j=t[29]:(j=d(`flex gap-3`,A),t[28]=A,t[29]=j);let M;t[30]!==o||t[31]!==a?(M=(0,Z.jsx)(re,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}),t[30]=o,t[31]=a,t[32]=M):M=t[32];let N;t[33]===f?N=t[34]:(N=(0,Z.jsx)(`div`,{className:`min-w-0 max-w-full truncate text-sm font-semibold text-fg`,title:f,children:f}),t[33]=f,t[34]=N);let P;t[35]!==n.key||t[36]!==m?(P=m?(0,Z.jsx)(`div`,{className:`mt-0.5 min-w-0 max-w-full truncate font-mono text-[11px] text-fg-subtle`,title:n.key,children:n.key}):null,t[35]=n.key,t[36]=m,t[37]=P):P=t[37];let I;t[38]!==N||t[39]!==P?(I=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[N,P]}),t[38]=N,t[39]=P,t[40]=I):I=t[40];let L;t[41]!==j||t[42]!==M||t[43]!==I?(L=(0,Z.jsxs)(`div`,{className:j,children:[M,I]}),t[41]=j,t[42]=M,t[43]=I,t[44]=L):L=t[44];let R;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(F,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[45]=R):R=t[45];let B;t[46]===n.messageCount?B=t[47]:(B=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[R,n.messageCount]}),t[46]=n.messageCount,t[47]=B);let V;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(ae,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[48]=V):V=t[48];let H;t[49]===n.estimatedTokens?H=t[50]:(H=Te(n.estimatedTokens),t[49]=n.estimatedTokens,t[50]=H);let U;t[51]===H?U=t[52]:(U=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[V,H]}),t[51]=H,t[52]=U);let W;t[53]!==B||t[54]!==U?(W=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3 text-xs text-fg-muted`,children:[B,U]}),t[53]=B,t[54]=U,t[55]=W):W=t[55];let G;t[56]===n.tags?G=t[57]:(G=n.tags.length>0?(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[n.tags.slice(0,3).map(ke),n.tags.length>3?(0,Z.jsxs)(`span`,{className:`text-[11px] text-fg-disabled`,children:[`+`,n.tags.length-3]}):null]}):null,t[56]=n.tags,t[57]=G);let te;t[58]!==k||t[59]!==L||t[60]!==W||t[61]!==G?(te=(0,Z.jsxs)(`div`,{className:k,children:[L,W,G]}),t[58]=k,t[59]=L,t[60]=W,t[61]=G,t[62]=te):te=t[62];let ne;t[63]===l?ne=t[64]:(ne=()=>l(`continue`),t[63]=l,t[64]=ne);let ie;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Z.jsx)(F,{className:`size-4`,strokeWidth:1.75}),t[65]=ie):ie=t[65];let se;t[66]!==i.continueChat||t[67]!==ne?(se=(0,Z.jsx)(`button`,{type:`button`,className:h,title:i.continueChat,"aria-label":i.continueChat,onClick:ne,children:ie}),t[66]=i.continueChat,t[67]=ne,t[68]=se):se=t[68];let q;t[69]!==g||t[70]!==i.archive||t[71]!==i.unarchive||t[72]!==l?(q=g?(0,Z.jsx)(`button`,{type:`button`,className:h,title:i.unarchive,"aria-label":i.unarchive,onClick:()=>l(`unarchive`),children:(0,Z.jsx)(le,{className:`size-4`,strokeWidth:1.75})}):(0,Z.jsx)(`button`,{type:`button`,className:h,title:i.archive,"aria-label":i.archive,onClick:()=>l(`archive`),children:(0,Z.jsx)(oe,{className:`size-4`,strokeWidth:1.75})}),t[69]=g,t[70]=i.archive,t[71]=i.unarchive,t[72]=l,t[73]=q):q=t[73];let J;t[74]!==_||t[75]!==i.pin||t[76]!==i.unpin||t[77]!==l?(J=_?(0,Z.jsx)(`button`,{type:`button`,className:h,title:i.unpin,"aria-label":i.unpin,onClick:()=>l(`unpin`),children:(0,Z.jsx)(K,{className:`size-4`,strokeWidth:1.75})}):(0,Z.jsx)(`button`,{type:`button`,className:h,title:i.pin,"aria-label":i.pin,onClick:()=>l(`pin`),children:(0,Z.jsx)(ce,{className:`size-4`,strokeWidth:1.75})}),t[74]=_,t[75]=i.pin,t[76]=i.unpin,t[77]=l,t[78]=J):J=t[78];let ue;t[79]===l?ue=t[80]:(ue=()=>l(`export`),t[79]=l,t[80]=ue);let de;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(s,{className:`size-4`,strokeWidth:1.75}),t[81]=de):de=t[81];let fe;t[82]!==i.export||t[83]!==ue?(fe=(0,Z.jsx)(`button`,{type:`button`,className:h,title:i.export,"aria-label":i.export,onClick:ue,children:de}),t[82]=i.export,t[83]=ue,t[84]=fe):fe=t[84];let pe;t[85]===Symbol.for(`react.memo_cache_sentinel`)?(pe=d(h,`text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`),t[85]=pe):pe=t[85];let me;t[86]===l?me=t[87]:(me=()=>l(`delete`),t[86]=l,t[87]=me);let he;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,Z.jsx)(z,{className:`size-4`,strokeWidth:1.75}),t[88]=he):he=t[88];let ge;t[89]!==i.delete||t[90]!==me?(ge=(0,Z.jsx)(`button`,{type:`button`,className:pe,title:i.delete,"aria-label":i.delete,onClick:me,children:he}),t[89]=i.delete,t[90]=me,t[91]=ge):ge=t[91];let _e;t[92]!==se||t[93]!==q||t[94]!==J||t[95]!==fe||t[96]!==ge?(_e=(0,Z.jsxs)(`div`,{role:`group`,className:`flex flex-wrap items-center gap-0.5 border-t border-edge-subtle/80 bg-surface-hover/25 p-2 dark:border-edge-subtle`,onClick:Oe,onKeyDown:De,children:[se,q,J,fe,ge]}),t[92]=se,t[93]=q,t[94]=J,t[95]=fe,t[96]=ge,t[97]=_e):_e=t[97];let ve;return t[98]!==c||t[99]!==D||t[100]!==te||t[101]!==v||t[102]!==_e||t[103]!==y?(ve=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,className:v,onClick:c,onKeyDown:y,children:[D,te,_e]}),t[98]=c,t[99]=D,t[100]=te,t[101]=v,t[102]=_e,t[103]=y,t[104]=ve):ve=t[104],ve}function De(e){return e.stopPropagation()}function Oe(e){return e.stopPropagation()}function ke(e){return(0,Z.jsx)(`span`,{className:`max-w-full break-words rounded-md bg-surface-hover px-1.5 py-0.5 text-[11px] text-fg-muted`,children:e},e)}function Ae(e,t){return e.routing?.agentId?.trim().toLowerCase()||t.trim().toLowerCase()||`main`}function je(e,t){return t.find(t=>t.id===e)?.avatar}var Me={enabled:!0,triggerThreshold:.8,reserveTokens:8192,minMessagesBeforeCompact:10,keepRecentTokens:2e4,recentTurnsPreserve:3,summaryMaxTokens:2e3,summaryChunkTokens:24e3,summaryTimeoutMs:18e4,summaryRetries:2,qualityGuard:!0,gapAudit:!0,minToolResultKeepChars:1e3,maxActiveTranscriptBytes:2e6,postCompactionSections:[`Session Startup`,`Red Lines`]};function Ne(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Pe(e,t,n,r=1/0){return typeof e==`number`&&Number.isFinite(e)&&e>=n&&e<=r?e:t}function Q(e,t,n,r=1/0){return Number.isInteger(e)&&e>=n&&e<=r?e:t}function Fe(e){let t=Ne(e)?e:{},n=Ne(t.userContext)?t.userContext:{},r=Ne(n.memory)?n.memory:{},i=Ne(r.retention)?r.retention:{},a=Ne(i.compaction)?i.compaction:{},o=Me,s=typeof a.model==`string`&&a.model.trim()?a.model.trim():void 0,c=Array.isArray(a.postCompactionSections)&&a.postCompactionSections.length<=12&&a.postCompactionSections.every(e=>typeof e==`string`&&e.trim())?[...new Set(a.postCompactionSections.map(e=>e.trim()))]:[...o.postCompactionSections];return{enabled:typeof a.enabled==`boolean`?a.enabled:o.enabled,triggerThreshold:Pe(a.triggerThreshold,o.triggerThreshold,.1,.98),reserveTokens:Q(a.reserveTokens,o.reserveTokens,1024),minMessagesBeforeCompact:Q(a.minMessagesBeforeCompact,o.minMessagesBeforeCompact,2),keepRecentTokens:Q(a.keepRecentTokens,o.keepRecentTokens,1e3),recentTurnsPreserve:Q(a.recentTurnsPreserve,o.recentTurnsPreserve,1,12),summaryMaxTokens:Q(a.summaryMaxTokens,o.summaryMaxTokens,256),summaryChunkTokens:Q(a.summaryChunkTokens,o.summaryChunkTokens,1e3),summaryTimeoutMs:Q(a.summaryTimeoutMs,o.summaryTimeoutMs,1e3,6e5),summaryRetries:Q(a.summaryRetries,o.summaryRetries,0,5),qualityGuard:typeof a.qualityGuard==`boolean`?a.qualityGuard:o.qualityGuard,gapAudit:typeof a.gapAudit==`boolean`?a.gapAudit:o.gapAudit,...s?{model:s}:{},minToolResultKeepChars:Q(a.minToolResultKeepChars,o.minToolResultKeepChars,200),maxActiveTranscriptBytes:Q(a.maxActiveTranscriptBytes,o.maxActiveTranscriptBytes,64e3),postCompactionSections:c}}function Ie(e){return e.triggerThreshold<.1||e.triggerThreshold>.98?`triggerThreshold`:!Number.isInteger(e.reserveTokens)||e.reserveTokens<1024?`reserveTokens`:!Number.isInteger(e.minMessagesBeforeCompact)||e.minMessagesBeforeCompact<2?`minMessagesBeforeCompact`:!Number.isInteger(e.keepRecentTokens)||e.keepRecentTokens<1e3?`keepRecentTokens`:!Number.isInteger(e.recentTurnsPreserve)||e.recentTurnsPreserve<1||e.recentTurnsPreserve>12?`recentTurnsPreserve`:!Number.isInteger(e.summaryMaxTokens)||e.summaryMaxTokens<256?`summaryMaxTokens`:!Number.isInteger(e.summaryChunkTokens)||e.summaryChunkTokens<1e3?`summaryChunkTokens`:!Number.isInteger(e.summaryTimeoutMs)||e.summaryTimeoutMs<1e3||e.summaryTimeoutMs>6e5?`summaryTimeoutMs`:!Number.isInteger(e.summaryRetries)||e.summaryRetries<0||e.summaryRetries>5?`summaryRetries`:e.model!==void 0&&!e.model.trim()?`model`:!Number.isInteger(e.minToolResultKeepChars)||e.minToolResultKeepChars<200?`minToolResultKeepChars`:!Number.isInteger(e.maxActiveTranscriptBytes)||e.maxActiveTranscriptBytes<64e3?`maxActiveTranscriptBytes`:e.postCompactionSections.length>12||e.postCompactionSections.some(e=>!e.trim())?`postCompactionSections`:null}function Le(e){let t={...e,...e.model?.trim()?{model:e.model.trim()}:{}};return e.model?.trim()||delete t.model,{userContext:{memory:{retention:{compaction:t}}}}}async function Re(e){await y(v(`/api/config`),{method:`PATCH`,body:JSON.stringify(Le(e))}),await k()}var ze=128e3,Be={balanced:Me,preserve:{...Me,triggerThreshold:.88,keepRecentTokens:32e3,recentTurnsPreserve:5,maxActiveTranscriptBytes:4e6},early:{...Me,triggerThreshold:.65,reserveTokens:12e3,minMessagesBeforeCompact:6,keepRecentTokens:12e3,recentTurnsPreserve:2}},Ve=J();function He(){return d(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg disabled:cursor-not-allowed disabled:opacity-55`,p,`dark:border-edge`)}function Ue(e){let{enabled:t,model:n,postCompactionSections:r,...i}=e;return JSON.stringify(i)}function We(e){let t=Ue(e);for(let[e,n]of Object.entries(Be))if(t===Ue(n))return e;return`custom`}function Ge(e){return e>=1e6?`${(e/1e6).toFixed(e%1e6==0?0:1)}m`:e>=1e3?`${(e/1e3).toFixed(e%1e3==0?0:1)}k`:String(e)}function $(e){let t=(0,Ce.c)(20),{id:n,label:r,hint:i,value:a,min:o,max:s,step:c,disabled:l,onChange:u}=e,d=c===void 0?1:c,f;t[0]!==n||t[1]!==r?(f=(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=He(),t[3]=p):p=t[3];let m;t[4]===u?m=t[5]:(m=e=>{if(!e.target.value.trim())return;let t=Number(e.target.value);Number.isFinite(t)&&u(t)},t[4]=u,t[5]=m);let h;t[6]!==l||t[7]!==n||t[8]!==s||t[9]!==o||t[10]!==d||t[11]!==m||t[12]!==a?(h=(0,Z.jsx)(`input`,{id:n,type:`number`,min:o,max:s,step:d,disabled:l,className:p,value:a,onChange:m}),t[6]=l,t[7]=n,t[8]=s,t[9]=o,t[10]=d,t[11]=m,t[12]=a,t[13]=h):h=t[13];let g;t[14]===i?g=t[15]:(g=i?(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}):null,t[14]=i,t[15]=g);let _;return t[16]!==f||t[17]!==h||t[18]!==g?(_=(0,Z.jsxs)(`div`,{children:[f,h,g]}),t[16]=f,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function Ke(e){let t=(0,Ce.c)(19),{label:n,hint:r,checked:i,disabled:a,onChange:o}=e,s=a?`cursor-not-allowed opacity-55`:`cursor-pointer`,c;t[0]===s?c=t[1]:(c=d(`flex items-start gap-2 text-sm text-fg`,s),t[0]=s,t[1]=c);let l;t[2]===o?l=t[3]:(l=e=>o(e.target.checked),t[2]=o,t[3]=l);let u;t[4]!==i||t[5]!==a||t[6]!==l?(u=(0,Z.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:i,disabled:a,onChange:l}),t[4]=i,t[5]=a,t[6]=l,t[7]=u):u=t[7];let f;t[8]===n?f=t[9]:(f=(0,Z.jsx)(`span`,{className:`font-medium`,children:n}),t[8]=n,t[9]=f);let p;t[10]===r?p=t[11]:(p=(0,Z.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:r}),t[10]=r,t[11]=p);let m;t[12]!==f||t[13]!==p?(m=(0,Z.jsxs)(`span`,{children:[f,p]}),t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;return t[15]!==c||t[16]!==u||t[17]!==m?(h=(0,Z.jsxs)(`label`,{className:c,children:[u,m]}),t[15]=c,t[16]=u,t[17]=m,t[18]=h):h=t[18],h}function qe({hasToken:e}){let t=g(ee(e=>e.language)).sessions.compaction,{data:n,isLoading:r}=A(e),{data:i=[],isLoading:a}=O(e?M:null,j,{revalidateOnFocus:!1}),o=(0,X.useMemo)(()=>n?.payload?.config===void 0?null:Fe(n.payload.config),[n]),[s,l]=(0,X.useReducer)(Ve,{form:null,baseline:null}),[p,h]=(0,X.useState)(``),_=(0,X.useRef)(!1),v=(0,X.useRef)(s.form);v.current=s.form;let y=(0,X.useRef)(null);I({enabled:e,parsed:o,dirty:_.current,trackedParsedRef:y,dispatch:l,onResetDirty:()=>{_.current=!1}});let b=s.form,x=s.baseline,S=!!(b&&x&&JSON.stringify(b)!==JSON.stringify(x)),C=(0,X.useCallback)(e=>{_.current=!0,l({type:`patch`,patch:e})},[]),w=(0,X.useCallback)(e=>({enabled:t.enabled,triggerThreshold:t.triggerThreshold,reserveTokens:t.reserveTokens,minMessagesBeforeCompact:t.minMessagesBeforeCompact,keepRecentTokens:t.keepRecentTokens,recentTurnsPreserve:t.recentTurnsPreserve,summaryMaxTokens:t.summaryMaxTokens,summaryChunkTokens:t.summaryChunkTokens,summaryTimeoutMs:t.summaryTimeoutSeconds,summaryRetries:t.summaryRetries,qualityGuard:t.qualityGuard,gapAudit:t.gapAudit,model:t.summaryModel,minToolResultKeepChars:t.minToolResultKeepChars,maxActiveTranscriptBytes:t.maxActiveTranscriptMb,postCompactionSections:t.postCompactionSections})[e],[t]),T=ye({value:b,dirty:S,onSave:(0,X.useCallback)(async e=>{try{await Re(e),l({type:`saved`,value:e}),_.current=!!(v.current&&JSON.stringify(v.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError]),validate:e=>{let n=Ie(e);return n?t.invalidValue.replace(`{{field}}`,w(n)):null}});if(!e||!b)return r?(0,Z.jsx)(Y,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Z.jsx)(q,{className:`h-5 w-48`}),(0,Z.jsx)(q,{className:`h-20 w-full rounded-xl`}),(0,Z.jsx)(q,{className:`h-36 w-full rounded-xl`})]})}):null;let E=We(b),D=Math.max(0,ze-b.reserveTokens),k=Math.min(Math.floor(ze*b.triggerThreshold),D),N=Math.min(100,k/ze*100),P=Math.min(100,D/ze*100),F=b.model?i.find(e=>e.id===b.model):void 0,L=F?.contextWindow&&b.summaryChunkTokens+b.summaryMaxTokens+4096>F.contextWindow,R=b.keepRecentTokens+b.reserveTokens>k,z=Math.round(b.summaryTimeoutMs*(b.summaryRetries+1)/1e3),B=e=>{let t=Be[e];C({...t,...b.model?{model:b.model}:{model:void 0},postCompactionSections:b.postCompactionSections})},V={balanced:{title:t.presetBalanced,hint:t.presetBalancedHint},preserve:{title:t.presetPreserve,hint:t.presetPreserveHint},early:{title:t.presetEarly,hint:t.presetEarlyHint}},H=()=>{let e=p.trim();!e||b.postCompactionSections.includes(e)||b.postCompactionSections.length>=12||(C({postCompactionSections:[...b.postCompactionSections,e]}),h(``))};return(0,Z.jsxs)(Y,{onBlurCapture:T.onBlurCapture,children:[(0,Z.jsx)(xe,{icon:pe,title:t.title,subtitle:t.hint,trailing:(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(ve,{status:T.status,error:T.error}),(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm font-medium text-fg`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:b.enabled,onChange:e=>C({enabled:e.target.checked})}),b.enabled?t.enabled:t.disabled]})]})}),T.error?(0,Z.jsx)(`p`,{className:`mb-4 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-900 dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:T.error}):null,b.enabled?null:(0,Z.jsx)(`p`,{className:`mb-4 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:t.disabledWarning}),(0,Z.jsxs)(`fieldset`,{disabled:!b.enabled,className:`space-y-5 disabled:opacity-60`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.presetTitle}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.presetHint})]}),E===`custom`?(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.presetCustom}):null]}),(0,Z.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[`balanced`,`preserve`,`early`].map(e=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":E===e,className:d(`rounded-xl border px-3 py-3 text-left`,m.transition,m.focusRingPanel,E===e?`border-accent/50 bg-accent-soft text-accent-fg`:`border-edge bg-surface-panel text-fg hover:bg-surface-hover`),onClick:()=>B(e),children:[(0,Z.jsx)(`span`,{className:`block text-sm font-medium`,children:V[e].title}),(0,Z.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:V[e].hint})]},e))})]}),(0,Z.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-hover/35 p-4 dark:border-edge`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.budgetPreview}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.budgetPreviewHint})]}),(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2.5 py-1 font-mono text-xs text-fg-muted`,children:t.previewModel128k})]}),(0,Z.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Z.jsx)(`span`,{children:t.compactionTrigger}),(0,Z.jsx)(`span`,{className:`font-mono text-fg`,children:Ge(k)})]}),(0,Z.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Z.jsx)(`div`,{className:`h-full rounded-full bg-accent`,style:{width:`${N}%`}})})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-1 flex justify-between gap-3 text-xs text-fg-muted`,children:[(0,Z.jsx)(`span`,{children:t.hardInputLimit}),(0,Z.jsx)(`span`,{className:`font-mono text-fg`,children:Ge(D)})]}),(0,Z.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-surface-active`,children:(0,Z.jsx)(`div`,{className:`h-full rounded-full bg-fg-subtle`,style:{width:`${P}%`}})})]})]}),(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:t.budgetFormula})]}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)($,{id:`compaction-trigger-threshold`,label:t.triggerThreshold,hint:t.triggerThresholdHint,value:Number((b.triggerThreshold*100).toFixed(2)),min:10,max:98,step:.1,onChange:e=>C({triggerThreshold:e/100})}),(0,Z.jsx)($,{id:`compaction-reserve-tokens`,label:t.reserveTokens,hint:t.reserveTokensHint.replace(`{{tokens}}`,Ge(b.reserveTokens)),value:b.reserveTokens,min:1024,step:1024,onChange:e=>C({reserveTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-recent-turns`,label:t.recentTurnsPreserve,hint:t.recentTurnsPreserveHint,value:b.recentTurnsPreserve,min:1,max:12,onChange:e=>C({recentTurnsPreserve:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-keep-recent-tokens`,label:t.keepRecentTokens,hint:t.keepRecentTokensHint.replace(`{{tokens}}`,Ge(b.keepRecentTokens)),value:b.keepRecentTokens,min:1e3,step:1e3,onChange:e=>C({keepRecentTokens:Math.floor(e)})})]}),R?(0,Z.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:t.retentionWarning}):null,(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.summaryModel}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,Z.jsx)(se,{value:b.model??``,disabled:!b.enabled,placeholder:t.summaryModelInherited,searchPlaceholder:t.summaryModelSearch,noMatches:t.summaryModelNoMatches,models:i,modelsLoading:a,className:`min-w-0 flex-1 justify-between`,contentAlign:`start`,showProviderSettingsFooter:!0,onChange:e=>C({model:e})}),b.model?(0,Z.jsx)(f,{type:`button`,variant:`secondary`,onClick:()=>C({model:void 0}),children:t.summaryModelUseSession}):null]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.summaryModelHint})]}),(0,Z.jsx)(Ke,{label:t.qualityGuard,hint:t.qualityGuardHint,checked:b.qualityGuard,onChange:e=>C({qualityGuard:e})}),(0,Z.jsx)(Ke,{label:t.gapAudit,hint:t.gapAuditHint,checked:b.gapAudit,onChange:e=>C({gapAudit:e})})]}),b.qualityGuard?null:(0,Z.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:t.qualityGuardWarning}),(0,Z.jsx)(be,{children:(0,Z.jsxs)(`div`,{className:`space-y-5 border-t border-edge pt-5`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:t.advancedTitle}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.advancedHint})]}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)($,{id:`compaction-min-messages`,label:t.minMessagesBeforeCompact,hint:t.minMessagesBeforeCompactHint,value:b.minMessagesBeforeCompact,min:2,onChange:e=>C({minMessagesBeforeCompact:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-max-transcript-mb`,label:t.maxActiveTranscriptMb,hint:t.maxActiveTranscriptMbHint,value:Number((b.maxActiveTranscriptBytes/1e6).toFixed(3)),min:.064,step:.1,onChange:e=>C({maxActiveTranscriptBytes:Math.max(64e3,Math.round(e*1e6))})}),(0,Z.jsx)($,{id:`compaction-summary-max-tokens`,label:t.summaryMaxTokens,hint:t.summaryMaxTokensHint,value:b.summaryMaxTokens,min:256,step:256,onChange:e=>C({summaryMaxTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-summary-chunk-tokens`,label:t.summaryChunkTokens,hint:t.summaryChunkTokensHint,value:b.summaryChunkTokens,min:1e3,step:1e3,onChange:e=>C({summaryChunkTokens:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-summary-timeout`,label:t.summaryTimeoutSeconds,hint:t.summaryTimeoutSecondsHint.replace(`{{seconds}}`,String(z)),value:b.summaryTimeoutMs/1e3,min:1,max:600,onChange:e=>C({summaryTimeoutMs:Math.round(e*1e3)})}),(0,Z.jsx)($,{id:`compaction-summary-retries`,label:t.summaryRetries,hint:t.summaryRetriesHint,value:b.summaryRetries,min:0,max:5,onChange:e=>C({summaryRetries:Math.floor(e)})}),(0,Z.jsx)($,{id:`compaction-min-tool-result-chars`,label:t.minToolResultKeepChars,hint:t.minToolResultKeepCharsHint,value:b.minToolResultKeepChars,min:200,step:100,onChange:e=>C({minToolResultKeepChars:Math.floor(e)})})]}),L?(0,Z.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:t.summaryBudgetWarning}):null,(0,Z.jsxs)(`div`,{className:`border-t border-edge pt-5`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.postCompactionSections}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.postCompactionSectionsHint}),b.postCompactionSections.length>0?(0,Z.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:b.postCompactionSections.map(e=>(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 py-1.5 text-xs text-fg`,children:[e,(0,Z.jsx)(`button`,{type:`button`,className:d(`text-fg-muted hover:text-fg`,m.press),"aria-label":t.removeSection.replace(`{{section}}`,e),onClick:()=>C({postCompactionSections:b.postCompactionSections.filter(t=>t!==e)}),children:(0,Z.jsx)(u,{className:`size-3.5`,"aria-hidden":!0})})]},e))}):(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.postCompactionSectionsEmpty}),(0,Z.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,Z.jsx)(`input`,{className:He(),value:p,maxLength:120,disabled:b.postCompactionSections.length>=12,placeholder:t.postCompactionSectionsPlaceholder,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),H())}}),(0,Z.jsxs)(f,{type:`button`,variant:`secondary`,disabled:!p.trim()||b.postCompactionSections.length>=12,onClick:H,children:[(0,Z.jsx)(c,{className:`size-4`,"aria-hidden":!0}),t.addSection]})]})]})]})})]})]})}function Je(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ye(e){return e===`main`||e===`per-peer`||e===`per-channel-peer`||e===`per-account-channel-peer`?e:`main`}function Xe(e){let t=Je(e)?e:{},n=Je(t.session)?t.session:{},r=Je(n.storage)?n.storage:{},i=typeof r.pruneAfterDays==`number`&&Number.isFinite(r.pruneAfterDays)?Math.max(0,Math.floor(r.pruneAfterDays)):typeof r.pruneAfterMs==`number`&&Number.isFinite(r.pruneAfterMs)?Math.max(0,Math.round(r.pruneAfterMs/864e5)):null,a=typeof r.maxEntries==`number`&&Number.isFinite(r.maxEntries)?Math.max(1,Math.floor(r.maxEntries)):null;return{dmScope:Ye(n.dmScope),pruneAfterDays:i,maxEntries:a}}async function Ze(e){await y(v(`/api/config`),{method:`PATCH`,body:JSON.stringify({session:{dmScope:e.dmScope,storage:{pruneAfterMs:e.pruneAfterDays===null?null:e.pruneAfterDays*864e5,maxEntries:e.maxEntries}}})}),k()}function Qe(){return d(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,p,`dark:border-edge`)}var $e=J();function et({hasToken:e}){let t=g(ee(e=>e.language)).sessions.config,{data:n,isLoading:r}=A(e),i=(0,X.useMemo)(()=>n?.payload?.config===void 0?null:Xe(n.payload.config),[n]),[s,c]=(0,X.useReducer)($e,{form:null,baseline:null}),l=s.form,u=s.baseline,d=(0,X.useRef)(!1),f=(0,X.useRef)(l);f.current=l;let p=(0,X.useRef)(null);I({enabled:e,parsed:i,dirty:d.current,trackedParsedRef:p,dispatch:c,onResetDirty:()=>{d.current=!1}});let m=!!(l&&u&&JSON.stringify(l)!==JSON.stringify(u)),h=(0,X.useCallback)(e=>{d.current=!0,c({type:`patch`,patch:e})},[]),_=ye({value:l,dirty:m,onSave:(0,X.useCallback)(async e=>{try{await Ze(e),c({type:`saved`,value:e}),d.current=!!(f.current&&JSON.stringify(f.current)!==JSON.stringify(e))}catch(e){throw Error(e instanceof Error?e.message:t.saveError)}},[t.saveError])});return!e||!l?r?(0,Z.jsx)(Y,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,Z.jsx)(q,{className:`h-5 w-40`}),(0,Z.jsx)(q,{className:`h-24 w-full rounded-xl`})]})}):null:(0,Z.jsxs)(Y,{onBlurCapture:_.onBlurCapture,children:[(0,Z.jsx)(xe,{icon:he,title:t.title,subtitle:t.hint,trailing:(0,Z.jsx)(ve,{status:_.status,error:_.error})}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.dmScope}),(0,Z.jsxs)(a,{className:Qe(),value:l.dmScope,onChange:e=>h({dmScope:e.target.value}),children:[(0,Z.jsx)(o,{value:`main`,children:t.dmScopeMain}),(0,Z.jsx)(o,{value:`per-peer`,children:t.dmScopePerPeer}),(0,Z.jsx)(o,{value:`per-channel-peer`,children:t.dmScopePerChannelPeer}),(0,Z.jsx)(o,{value:`per-account-channel-peer`,children:t.dmScopePerAccountChannelPeer})]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.dmScopeHint})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.pruneAfterDays}),(0,Z.jsx)(`input`,{type:`number`,min:0,className:Qe(),value:l.pruneAfterDays??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();h({pruneAfterDays:t===``?null:Math.max(0,Math.floor(Number(t)||0))})}})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,children:t.maxEntries}),(0,Z.jsx)(`input`,{type:`number`,min:1,className:Qe(),value:l.maxEntries??``,placeholder:t.unsetPlaceholder,onChange:e=>{let t=e.target.value.trim();h({maxEntries:t===``?null:Math.max(1,Math.floor(Number(t)||1))})}})]})]})]})}function tt(e){if(typeof e==`string`)return e.length>2e3?`${e.slice(0,2e3)}…`:e;try{let t=JSON.stringify(e,null,2);return t.length>2e3?`${t.slice(0,2e3)}…`:t}catch{return String(e)}}function nt(e){let t=(0,Ce.c)(60),{open:n,loading:r,session:i,sessionAgentId:a,sessionAgentAvatar:o,labels:s,onClose:c,onArchive:l,onUnarchive:p,onPin:m,onUnpin:h,onExport:g,onDelete:_}=e,ee=i?.status===`archived`,v=i?.status===`pinned`,y;t[0]===c?y=t[1]:(y=e=>!e&&c(),t[0]=c,t[1]=y);let O;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(S,{className:d(`xopc-dialog-overlay fixed inset-0 bg-scrim`,x)}),t[2]=O):O=t[2];let k;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(k=d(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-panel shadow-popover outline-none`,b,`dark:border-edge`),t[3]=k):k=t[3];let A;t[4]!==i||t[5]!==o||t[6]!==a?(A=i&&a?(0,Z.jsx)(re,{agentId:a,avatar:o,size:40,className:`size-10 shrink-0 ring-1 ring-edge/60 dark:ring-edge`}):null,t[4]=i,t[5]=o,t[6]=a,t[7]=A):A=t[7];let j;t[8]!==s.unnamedSession||t[9]!==i?.name?(j=i?.name?.trim()||s.unnamedSession,t[8]=s.unnamedSession,t[9]=i?.name,t[10]=j):j=t[10];let M;t[11]===j?M=t[12]:(M=(0,Z.jsx)(E,{className:`min-w-0 flex-1 truncate text-base font-semibold tracking-tight text-fg`,children:j}),t[11]=j,t[12]=M);let N;t[13]!==A||t[14]!==M?(N=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[A,M]}),t[13]=A,t[14]=M,t[15]=N):N=t[15];let P;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(u,{className:`size-5`,strokeWidth:1.75}),t[16]=P):P=t[16];let F;t[17]===s.close?F=t[18]:(F=(0,Z.jsx)(C,{asChild:!0,children:(0,Z.jsx)(f,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":s.close,children:P})}),t[17]=s.close,t[18]=F);let I;t[19]!==N||t[20]!==F?(I=(0,Z.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3 dark:border-edge`,children:[N,F]}),t[19]=N,t[20]=F,t[21]=I):I=t[21];let L;t[22]!==s.detailLoading||t[23]!==s.detailMessages||t[24]!==r||t[25]!==i?(L=r?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:s.detailLoading}):i?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`dl`,{className:`mb-4 grid gap-2 text-xs text-fg-muted`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-fg-disabled`,children:`Key`}),(0,Z.jsx)(`dd`,{className:`mt-0.5 break-all font-mono text-fg`,children:i.key})]}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-4`,children:(0,Z.jsxs)(`span`,{children:[i.messageCount,` msgs · `,i.estimatedTokens,` tok`]})})]}),(0,Z.jsx)(`h3`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:s.detailMessages}),(0,Z.jsx)(`ul`,{className:`space-y-3`,children:i.messages.map(rt)})]}):null,t[22]=s.detailLoading,t[23]=s.detailMessages,t[24]=r,t[25]=i,t[26]=L):L=t[26];let R;t[27]===L?R=t[28]:(R=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:L}),t[27]=L,t[28]=R);let z;t[29]!==s.detailExport||t[30]!==g?(z=(0,Z.jsx)(f,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:g,children:s.detailExport}),t[29]=s.detailExport,t[30]=g,t[31]=z):z=t[31];let B;t[32]!==ee||t[33]!==s.archive||t[34]!==s.unarchive||t[35]!==l||t[36]!==p?(B=ee?(0,Z.jsx)(f,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:p,children:s.unarchive}):(0,Z.jsx)(f,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:l,children:s.archive}),t[32]=ee,t[33]=s.archive,t[34]=s.unarchive,t[35]=l,t[36]=p,t[37]=B):B=t[37];let V;t[38]!==v||t[39]!==s.pin||t[40]!==s.unpin||t[41]!==m||t[42]!==h?(V=v?(0,Z.jsx)(f,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:h,children:s.unpin}):(0,Z.jsx)(f,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:m,children:s.pin}),t[38]=v,t[39]=s.pin,t[40]=s.unpin,t[41]=m,t[42]=h,t[43]=V):V=t[43];let H;t[44]!==s.delete||t[45]!==_?(H=(0,Z.jsx)(f,{type:`button`,variant:`secondary`,className:`text-sm text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40`,onClick:_,children:s.delete}),t[44]=s.delete,t[45]=_,t[46]=H):H=t[46];let U;t[47]!==z||t[48]!==B||t[49]!==V||t[50]!==H?(U=(0,Z.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3 dark:border-edge`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[z,B,V,H]})}),t[47]=z,t[48]=B,t[49]=V,t[50]=H,t[51]=U):U=t[51];let W;t[52]!==I||t[53]!==R||t[54]!==U?(W=(0,Z.jsxs)(w,{children:[O,(0,Z.jsxs)(T,{className:k,"aria-describedby":void 0,children:[I,R,U]})]}),t[52]=I,t[53]=R,t[54]=U,t[55]=W):W=t[55];let G;return t[56]!==n||t[57]!==y||t[58]!==W?(G=(0,Z.jsx)(D,{open:n,onOpenChange:y,children:W}),t[56]=n,t[57]=y,t[58]=W,t[59]=G):G=t[59],G}function rt(e){return(0,Z.jsxs)(`li`,{className:`rounded-lg border border-edge-subtle bg-surface-hover/50 p-2 dark:border-edge`,children:[(0,Z.jsx)(`div`,{className:`mb-1 text-[10px] font-medium uppercase text-fg-subtle`,children:e.role}),(0,Z.jsx)(`pre`,{className:`max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-relaxed text-fg-muted`,children:tt(e.content)})]},`${e.timestamp??``}-${e.role}-${tt(e.content).slice(0,24)}`)}var it=20;function at(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}var ot=new Set([`all`,`active`,`pinned`,`archived`]),st=new Set([`grid`,`list`]),ct=[`sessions`,`settings`];function lt(e){return e&&ct.includes(e)?e:`sessions`}function ut(e,t){return t===`sessions`?e.tabsSessions:e.tabsSettings}function dt(e,t){return t===`sessions`?e.tabsSessionsHint:e.tabsSettingsHint}function ft(e){let t=(0,Ce.c)(7),{s:n,activeTab:r,onChange:i}=e,a;t[0]===n?a=t[1]:(a=ct.map(e=>({id:e,label:ut(n,e),icon:e===`sessions`?L:G})),t[0]=n,t[1]=a);let o=a,s;return t[2]!==r||t[3]!==o||t[4]!==i||t[5]!==n.tabsAriaLabel?(s=(0,Z.jsx)(Se,{items:o,activeTab:r,onChange:i,ariaLabel:n.tabsAriaLabel,tabIdPrefix:`sessions-tab`,panelIdPrefix:`sessions-panel`}),t[2]=r,t[3]=o,t[4]=i,t[5]=n.tabsAriaLabel,t[6]=s):s=t[6],s}function pt(e){let t=(0,Ce.c)(10),{s:n,id:r,activeTab:i,plain:a,children:o}=e,s=a===void 0?!1:a;if(i!==r)return null;let c=`sessions-panel-${r}`,l=`sessions-tab-${r}`,u=s?`contents`:`rounded-2xl bg-surface-base px-4 py-5 sm:px-5`,d;t[0]!==o||t[1]!==r||t[2]!==s||t[3]!==n?(d=s?o:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`mb-5`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:ut(n,r)}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:dt(n,r)})]}),(0,Z.jsx)(`div`,{className:`space-y-4`,children:o})]}),t[0]=o,t[1]=r,t[2]=s,t[3]=n,t[4]=d):d=t[4];let f;return t[5]!==c||t[6]!==l||t[7]!==u||t[8]!==d?(f=(0,Z.jsx)(`section`,{id:c,role:`tabpanel`,"aria-labelledby":l,className:u,children:d}),t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f):f=t[9],f}function mt(e){let t=e.get(`status`),n=e.get(`view`);return{searchInput:e.get(`q`)??``,debouncedSearch:(e.get(`q`)??``).trim(),statusFilter:ot.has(t)?t:`all`,viewMode:st.has(n)?n:`grid`,channelFilter:(e.get(`channel`)??``).trim(),sessions:[],loading:!1,error:null,hasMore:!1,stats:null,detailOpen:!1,detailLoading:!1,detailSession:null,confirmOpen:!1,confirmKey:null}}function ht(){let e=g(ee(e=>e.language)),t=e.sessions,n=_(e=>e.token),r=!!n,{data:a,mutate:o}=O(r?[`gateway-chat-agents`,n]:null,ue,{revalidateOnFocus:!1}),s=a?.defaultId??`main`,c=a?.items??[],[u,p]=i(),h=lt(u.get(`tab`)),v=(0,X.useCallback)(e=>{let t=new URLSearchParams(u);e===`sessions`?t.delete(`tab`):t.set(`tab`,e),p(t,{replace:!0})},[u,p]),[y,C]=(0,X.useReducer)(te,u,mt),{searchInput:k,debouncedSearch:A,statusFilter:j,viewMode:M,channelFilter:F,sessions:I,loading:z,error:G,hasMore:re,stats:K,detailOpen:ae,detailLoading:se,detailSession:q,confirmOpen:le,confirmKey:J}=y;(0,X.useEffect)(()=>{let e=setTimeout(()=>{let e=k.trim();A!==e&&C({type:`patch`,patch:{debouncedSearch:e}})},300);return()=>clearTimeout(e)},[k,A]);let pe=u.toString(),he=(0,X.useRef)(pe);if(he.current!==pe){he.current=pe;let e=u.get(`q`)??``,t=u.get(`status`),n=u.get(`view`),r=(u.get(`channel`)??``).trim(),i=ot.has(t)?t:`all`,a=st.has(n)?n:`grid`,o=e.trim();C({type:`patch`,patch:{...k===e?{}:{searchInput:e},...A===o?{}:{debouncedSearch:o},...j===i?{}:{statusFilter:i},...M===a?{}:{viewMode:a},...F===r?{}:{channelFilter:r}}})}(0,X.useEffect)(()=>{let e=new URLSearchParams(u),t=A.trim();t?e.set(`q`,t):e.delete(`q`),j===`all`?e.delete(`status`):e.set(`status`,j),M===`grid`?e.delete(`view`):e.set(`view`,M),F?e.set(`channel`,F):e.delete(`channel`),e.toString()!==u.toString()&&p(e,{replace:!0})},[A,u,p,j,M,F]),(0,X.useEffect)(()=>{if(!r||h!==`sessions`)return;let e=!1;return(async()=>{C({type:`patch`,patch:{loading:!0,error:null}});try{let t=await V({limit:it,offset:0,...A?{search:A}:{},...j===`all`?{}:{status:j},...F?{channel:F}:{}});if(e)return;C({type:`patch`,patch:{sessions:t.items,hasMore:t.hasMore}})}catch(n){e||C({type:`patch`,patch:{error:n instanceof Error?n.message:t.loadError}})}finally{e||C({type:`patch`,patch:{loading:!1}})}})(),()=>{e=!0}},[r,h,A,j,F,t.loadError]),(0,X.useEffect)(()=>{!r||h!==`sessions`||me().then(e=>C({type:`patch`,patch:{stats:e}})).catch(()=>{})},[r,h]),(0,X.useEffect)(()=>{if(!r||h!==`sessions`)return;let e=()=>void o();return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[r,h,o]),(0,X.useEffect)(()=>{if(!r||h!==`sessions`)return;let e=e=>{let t=e.detail;!t?.key||t.name===void 0||C({type:`patch`,patch:{sessions:I.map(e=>e.key===t.key?{...e,name:t.name}:e),detailSession:q&&q.key===t.key?{...q,name:t.name}:q}})};return window.addEventListener(`session-updated`,e),()=>{window.removeEventListener(`session-updated`,e)}},[r,h,I,q]);let ve=(0,X.useCallback)(async()=>{if(!(!r||z||!re)){C({type:`patch`,patch:{loading:!0,error:null}});try{let e=await V({limit:it,offset:I.length,...A?{search:A}:{},...j===`all`?{}:{status:j},...F?{channel:F}:{}});C({type:`patch`,patch:{sessions:[...I,...e.items],hasMore:e.hasMore}})}catch(e){C({type:`patch`,patch:{error:e instanceof Error?e.message:t.loadError}})}finally{C({type:`patch`,patch:{loading:!1}})}}},[r,z,re,I.length,A,j,F,t.loadError]),ye=(0,X.useCallback)((e,t)=>{C({type:`patch`,patch:{sessions:I.map(n=>n.key===e?{...n,status:t}:n),detailSession:q&&q.key===e?{...q,status:t}:q}})},[I,q]),be=(0,X.useCallback)(async e=>{C({type:`patch`,patch:{detailOpen:!0,detailLoading:!0,detailSession:null}});try{C({type:`patch`,patch:{detailSession:await ie(e)}})}catch{C({type:`patch`,patch:{detailOpen:!1}})}finally{C({type:`patch`,patch:{detailLoading:!1}})}},[]),xe=e=>{be(e)},Y=async(e,t)=>{if(t===`continue`){window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:e},bubbles:!0}));return}if(t===`delete`){C({type:`patch`,patch:{confirmKey:e,confirmOpen:!0}});return}try{switch(t){case`archive`:await ne(e),ye(e,`archived`);break;case`unarchive`:await H(e),ye(e,`active`);break;case`pin`:await N(e),ye(e,`pinned`);break;case`unpin`:await P(e),ye(e,`active`);break;case`export`:{let t=await ge(e),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`session-${e.replace(/[^a-z0-9]/gi,`_`)}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r);break}default:break}me().then(e=>C({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},Se=async e=>{try{await fe(e),C({type:`patch`,patch:{sessions:I.filter(t=>t.key!==e),detailSession:q?.key===e?null:q,...q?.key===e?{detailOpen:!1}:{}}}),me().then(e=>C({type:`patch`,patch:{stats:e}})).catch(()=>{})}catch{}},Ce={continueChat:t.continueChat,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,export:t.export,delete:t.delete,unnamedSession:e.chat.newSession},we={close:t.close,detailLoading:t.detailLoading,detailMessages:t.detailMessages,detailExport:t.detailExport,archive:t.archive,unarchive:t.unarchive,pin:t.pin,unpin:t.unpin,delete:t.delete,unnamedSession:e.chat.newSession},Te=[{key:`all`,label:t.filterAll,icon:L},{key:`active`,label:t.filterActive,icon:R},{key:`pinned`,label:t.filterPinned,icon:ce},{key:`archived`,label:t.filterArchived,icon:oe}],De=(()=>{let e=Object.entries(K?.byChannel??{}).sort((e,t)=>t[1]-e[1]).slice(0,6).map(([e])=>e),t=new Set(e);for(let n of[`telegram`,`weixin`,`feishu`])t.has(n)||(e.push(n),t.add(n));return e.slice(0,8)})();return r?(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-surface-panel`,children:[(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-6 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,Z.jsx)(`header`,{className:`flex flex-col gap-2`,children:(0,Z.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight text-fg`,children:t.title})}),(0,Z.jsx)(ft,{s:t,activeTab:h,onChange:v}),(0,Z.jsx)(pt,{s:t,id:`settings`,activeTab:h,plain:!0,children:(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(qe,{hasToken:r}),(0,Z.jsx)(et,{hasToken:r})]})}),(0,Z.jsxs)(pt,{s:t,id:`sessions`,activeTab:h,plain:!0,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Te.map(({key:e,label:t,icon:n})=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":j===e,onClick:()=>C({type:`patch`,patch:{statusFilter:e}}),className:d(`inline-flex items-center gap-1.5 rounded-xl px-3 py-2 text-sm font-medium`,m.transition,m.focusRingPanel,j===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[(0,Z.jsx)(n,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t]},e))}),(0,Z.jsxs)(`div`,{className:`flex w-full min-w-0 items-center gap-2 rounded-xl bg-surface-base px-3 py-2 transition-colors lg:max-w-md dark:bg-surface-hover/40`,children:[(0,Z.jsx)(l,{className:`size-4 shrink-0 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`input`,{type:`search`,value:k,onChange:e=>C({type:`patch`,patch:{searchInput:e.target.value}}),placeholder:t.searchPlaceholder,"data-debounced-query":A||void 0,className:`min-w-0 flex-1 border-0 bg-transparent text-sm text-fg placeholder:text-fg-disabled focus:outline-none focus:ring-0`})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg-subtle`,children:t.filterChannelLabel}),(0,Z.jsx)(`button`,{type:`button`,"aria-pressed":!F,onClick:()=>C({type:`patch`,patch:{channelFilter:``}}),className:d(`inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,m.transition,m.focusRingPanel,F?`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`:`bg-accent-soft text-accent-fg`),children:t.filterChannelAll}),De.map(e=>(0,Z.jsxs)(`button`,{type:`button`,"aria-pressed":F===e,onClick:()=>C({type:`patch`,patch:{channelFilter:e}}),className:d(`inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium`,m.transition,m.focusRingPanel,F===e?`bg-accent-soft text-accent-fg`:`bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg dark:bg-surface-hover/35`),children:[e,K?.byChannel?.[e]==null?null:(0,Z.jsx)(`span`,{className:`ml-2 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] text-fg-subtle`,children:K.byChannel[e]})]},e))]}),K?(0,Z.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[[K.totalSessions,t.totalSessions],[K.activeSessions,t.activeSessions],[K.pinnedSessions,t.pinnedSessions],[K.archivedSessions,t.archivedSessions]].map(([e,t])=>(0,Z.jsxs)(`div`,{className:`rounded-xl bg-surface-base p-3 dark:bg-surface-hover/30`,children:[(0,Z.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-fg`,children:e}),(0,Z.jsx)(`div`,{className:`text-xs text-fg-muted`,children:t})]},t))}):null,G?(0,Z.jsx)(`div`,{className:`rounded-lg border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,children:G}):null,(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:at(t.sessionCount,{count:I.length})}),(0,Z.jsxs)(`div`,{className:_e,role:`group`,"aria-label":t.layoutToggleGroup,children:[(0,Z.jsx)(f,{type:`button`,variant:`segmented`,title:t.gridView,"aria-pressed":M===`grid`,onClick:()=>C({type:`patch`,patch:{viewMode:`grid`}}),className:d(B,`size-7 p-0`,M===`grid`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,M===`grid`&&`text-accent-fg`),children:(0,Z.jsx)(W,{className:`size-3.5`,strokeWidth:1.5})}),(0,Z.jsx)(f,{type:`button`,variant:`segmented`,title:t.listView,"aria-pressed":M===`list`,onClick:()=>C({type:`patch`,patch:{viewMode:`list`}}),className:d(B,`size-9 p-0`,M===`list`&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,M===`list`&&`text-accent-fg`),children:(0,Z.jsx)(U,{className:`size-3.5`,strokeWidth:1.5})})]})]}),z&&I.length===0?(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:Array.from({length:6}).map((e,t)=>(0,Z.jsx)(`div`,{className:`h-40 animate-pulse rounded-xl bg-surface-hover/60 dark:bg-surface-hover/40`},t))}):I.length===0?(0,Z.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-2xl bg-surface-base py-16 text-center dark:bg-surface-hover/25`,children:[(0,Z.jsx)(de,{className:`mb-3 size-12 text-fg-disabled`,strokeWidth:1.25,"aria-hidden":!0}),(0,Z.jsx)(`p`,{className:`text-base font-semibold text-fg`,children:t.noSessions}),(0,Z.jsx)(`p`,{className:`mt-1 max-w-sm text-sm text-fg-muted`,children:t.noSessionsDescription}),(0,Z.jsx)(f,{variant:`primary`,className:`mt-6`,onClick:()=>{window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:``},bubbles:!0}))},children:t.startNewChat})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:d(`grid min-w-0 gap-3`,M===`grid`?`sm:grid-cols-2 lg:grid-cols-3`:`grid-cols-1`),"data-debounced-query":A||void 0,children:I.map(e=>{let t=Ae(e,s);return(0,Z.jsx)(Ee,{session:e,variant:M,labels:Ce,sessionAgentId:t,sessionAgentAvatar:je(t,c),onOpen:()=>xe(e.key),onAction:t=>void Y(e.key,t)},e.key)})}),re?(0,Z.jsx)(`div`,{className:`flex justify-center pt-2`,children:(0,Z.jsx)(f,{type:`button`,variant:`secondary`,disabled:z,onClick:()=>void ve(),children:t.loadMore})}):null]})]})]}),(0,Z.jsx)(nt,{open:ae,loading:se,session:q,sessionAgentId:q?Ae(q,s):void 0,sessionAgentAvatar:q?je(Ae(q,s),c):void 0,labels:we,onClose:()=>{C({type:`patch`,patch:{detailOpen:!1,detailSession:null}})},onArchive:()=>q&&void Y(q.key,`archive`),onUnarchive:()=>q&&void Y(q.key,`unarchive`),onPin:()=>q&&void Y(q.key,`pin`),onUnpin:()=>q&&void Y(q.key,`unpin`),onExport:()=>q&&void Y(q.key,`export`),onDelete:()=>q&&C({type:`patch`,patch:{confirmKey:q.key,confirmOpen:!0}})}),(0,Z.jsx)(D,{open:le,onOpenChange:e=>C({type:`patch`,patch:{confirmOpen:e}}),children:(0,Z.jsxs)(w,{children:[(0,Z.jsx)(S,{className:d(`xopc-dialog-overlay fixed inset-0 bg-scrim`,x)}),(0,Z.jsxs)(T,{className:d(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,b),children:[(0,Z.jsx)(E,{className:`text-base font-semibold text-fg`,children:t.deleteSessionTitle}),(0,Z.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:J?at(t.deleteSessionMessage,{name:I.find(e=>e.key===J)?.name?.trim()||e.chat.newSession}):``}),(0,Z.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Z.jsx)(f,{type:`button`,variant:`secondary`,onClick:()=>C({type:`patch`,patch:{confirmOpen:!1}}),children:t.cancel}),(0,Z.jsx)(f,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:()=>{J&&Se(J),C({type:`patch`,patch:{confirmOpen:!1,confirmKey:null}})},children:t.delete})]})]})]})})]}):(0,Z.jsx)(`div`,{className:`w-full px-3 py-16 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:t.needToken})}export{ht as SessionsPage};
@@ -1 +0,0 @@
1
- import{Or as e}from"./index-Bbd_dXui.js";function t(t){let{children:n,fallback:r}=t,i=r===void 0?null:r;return e()?n:i}export{t};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-process-heavy-B2_kr5EA.js","assets/rolldown-runtime-aKtaBQYM.js","assets/preload-helper-zJ_50EbN.js","assets/excel-worksheet-utils-EyvwNT4X.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./preload-helper-zJ_50EbN.js";import{d as i}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as a}from"./download-Dk-ZjtO6.js";import{t as o}from"./external-link-DjqjBmc3.js";import{t as s}from"./markdown-view-DvM5PWEH.js";import{n as c,r as l}from"./locale-store-CXhjfe4q.js";import{Qa as u,ca as d,la as f,no as p,oa as m,ra as h}from"./index-Bbd_dXui.js";var g=e(t(),1),_=n();function v(){return{textContent:null,binaryBuffer:null,extractedText:null,extractedTextTruncated:!1}}function y(){let{token:e}=i(),t=c(e=>e.language),n=t===`zh`?S:C,[y,w]=(0,g.useState)(null),[T,E]=(0,g.useState)(v),[D,O]=(0,g.useState)(!0),[k,A]=(0,g.useState)(null),[j,M]=(0,g.useState)(null),N=(0,g.useMemo)(()=>{if(!y||!e||y.kind!==`file`)return null;let t=d(y.fileName,y.mimeType);return{id:`share:${e}:${y.fileName}`,context:`share`,fileName:y.fileName,mimeType:t,size:y.fileSize,type:m(y.fileName,t),source:{kind:`share`,token:e}}},[y,e]);(0,g.useEffect)(()=>{if(!e){A(n.invalidLink),O(!1);return}let t=!1;return(async()=>{try{O(!0),A(null),E(v());let i=await fetch(l(`/s/${encodeURIComponent(e)}/meta`));if(!i.ok){t||A(i.status===404?n.notFound:n.expired);return}let a=await i.json();if(t)return;if(w(a),!a.valid){A(n.expired);return}if(a.kind===`note`){let r=await fetch(l(`/s/${encodeURIComponent(e)}/view`),{method:`POST`});if(!r.ok){A(r.status===404?n.notFound:n.expired);return}let i=await r.json();!t&&i.payload&&M(i.payload);return}if(a.kind!==`file`)return;let o=d(a.fileName,a.mimeType),s=m(a.fileName,o),c=f(s),p=l(`/s/${encodeURIComponent(e)}?inline=1`);if(c===`text`){if(a.fileSize>5242880){A(n.tooLarge);return}let e=await fetch(p);if(!e.ok){A(n.expired);return}let r=await e.text();t||E({...v(),textContent:r});return}if(c===`binary`){if(a.fileSize>33554432){A(n.tooLarge);return}let e=await fetch(p);if(!e.ok){A(n.expired);return}let i=await e.arrayBuffer();if(t)return;if(s===`pptx`){let{processPptx:e}=await r(async()=>{let{processPptx:e}=await import(`./attachment-process-heavy-B2_kr5EA.js`);return{processPptx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:t}=await e(i,a.fileName),n=t.length>u;E({textContent:null,binaryBuffer:i,extractedText:n?t.slice(0,u):t,extractedTextTruncated:n});return}E({...v(),binaryBuffer:i})}}catch(e){t||A(e instanceof Error?e.message:String(e))}finally{t||O(!1)}})(),()=>{t=!0}},[e,n.expired,n.invalidLink,n.notFound,n.tooLarge]);let P=e?l(`/s/${encodeURIComponent(e)}?dl=1`):`#`,F=e?l(`/s/${encodeURIComponent(e)}?inline=1`):`#`;return(0,_.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden bg-surface-base`,children:[(0,_.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center gap-3 border-b border-edge px-4`,children:[(0,_.jsx)(`span`,{className:`text-lg`,"aria-hidden":!0,children:`#`}),(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[y?(0,_.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,title:y.fileName,children:y.fileName}):D?(0,_.jsx)(p,{className:`h-4 w-48 max-w-full`}):(0,_.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:n.error}),y?(0,_.jsxs)(`div`,{className:`truncate text-xs text-fg-muted`,children:[x(y.fileSize),` · `,n.expiresAt,` `,new Date(y.expiresAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`)]}):null]}),y&&y.kind!==`note`?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`a`,{href:F,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg`,children:[(0,_.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),n.openInline]}),(0,_.jsxs)(`a`,{href:P,className:`inline-flex items-center gap-1 rounded-md bg-accent px-3 py-1.5 text-xs font-medium text-white hover:opacity-90`,download:y.fileName,children:[(0,_.jsx)(a,{className:`size-3.5`,"aria-hidden":!0}),n.download]})]}):null]}),(0,_.jsx)(`main`,{className:`flex min-h-0 w-full flex-1 flex-col overflow-y-auto overscroll-contain px-3 py-6 sm:px-5 xl:px-6`,children:D?(0,_.jsxs)(`div`,{className:`flex min-h-[70vh] flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel p-4 shadow-surface`,"aria-busy":`true`,children:[(0,_.jsx)(p,{className:`h-5 w-56 max-w-full`}),(0,_.jsxs)(`div`,{className:`mt-5 grid gap-3`,children:[(0,_.jsx)(p,{className:`h-4 w-full`}),(0,_.jsx)(p,{className:`h-4 w-11/12`}),(0,_.jsx)(p,{className:`h-4 w-10/12`}),(0,_.jsx)(p,{className:`h-4 w-3/4`})]}),(0,_.jsx)(p,{className:`mt-6 min-h-0 flex-1 rounded-lg`})]}):k?(0,_.jsxs)(`div`,{className:`rounded-lg bg-surface-panel p-6 shadow-surface text-sm text-fg`,children:[(0,_.jsx)(`p`,{className:`font-medium`,children:n.error}),(0,_.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:k})]}):y?.kind===`directory`?(0,_.jsx)(`div`,{className:`rounded-lg bg-surface-panel p-6 shadow-surface text-sm text-fg-muted`,children:n.directoryHint}):y?.kind===`note`&&j?(0,_.jsxs)(`article`,{className:`mx-auto w-full max-w-3xl rounded-xl border border-edge-subtle bg-surface-panel px-6 py-8 shadow-surface sm:px-10 sm:py-10`,children:[(0,_.jsx)(`h1`,{className:`text-3xl font-bold tracking-tight text-fg`,children:j.title}),(0,_.jsxs)(`div`,{className:`mt-2 text-xs text-fg-muted`,children:[n.sharedAt,` `,new Date(j.snapshotAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`),` · `,n.expiresAt,` `,new Date(j.expiresAt).toLocaleString(t===`zh`?`zh-CN`:`en-US`)]}),j.description?(0,_.jsx)(`p`,{className:`mt-5 rounded-lg bg-surface-subtle px-4 py-3 text-sm leading-6 text-fg-muted`,children:j.description}):null,(0,_.jsx)(s,{content:b(j.markdown,n.remoteImageBlocked),className:`mt-8`}),(0,_.jsx)(`footer`,{className:`mt-10 border-t border-edge-subtle pt-4 text-center text-xs text-fg-subtle`,children:n.sharedVia})]}):N?(0,_.jsx)(`div`,{className:`flex min-h-[70vh] flex-1 flex-col overflow-hidden rounded-lg bg-surface-panel shadow-surface`,children:(0,_.jsx)(h,{language:t,descriptor:N,loading:!1,loadError:null,textContent:T.textContent,binaryBuffer:T.binaryBuffer,extractedText:T.extractedText,extractedTextTruncated:T.extractedTextTruncated,actions:{onDownload:()=>{window.location.href=P},canDownload:!0}})}):null})]})}function b(e,t){return e.replace(/!\[([^\]]*)\]\((https?:\/\/[^)]+)\)/gi,(e,n,r)=>`[${n.trim()||t}](${r})`)}function x(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:e<1073741824?`${(e/1048576).toFixed(1)} MB`:`${(e/1073741824).toFixed(1)} GB`}var S={error:`加载失败`,expired:`链接已失效`,notFound:`链接不存在`,invalidLink:`链接无效`,expiresAt:`有效期至`,download:`下载`,openInline:`在新窗口打开`,directoryHint:`目录分享请使用主页面浏览。`,tooLarge:`文件过大,无法在线预览,请下载查看。`,sharedAt:`分享于`,sharedVia:`通过 xopc 分享`,remoteImageBlocked:`远程图片(点击打开)`},C={error:`Failed to load`,expired:`Link no longer valid`,notFound:`Link not found`,invalidLink:`Invalid link`,expiresAt:`Expires`,download:`Download`,openInline:`Open raw`,directoryHint:`Directory shares are browsed from the main page.`,tooLarge:`This file is too large to preview here. Please download it instead.`,sharedAt:`Shared`,sharedVia:`Shared via xopc`,remoteImageBlocked:`Remote image (open manually)`};export{y as SharePreviewPage};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{p as i}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as a}from"./check-DUBLcKHA.js";import{n as o,r as s}from"./popover-select-CccGri5Y.js";import{t as c}from"./copy-Dv6d4Dvw.js";import{t as l}from"./loader-circle-CifKLtgG.js";import{t as u}from"./plus-Q2yW6OE7.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./cn-JdwAhgNB.js";import{t as p}from"./button-CSEbl4zT.js";import{s as m}from"./form-field-width-DJw_jULe.js";import{t as h}from"./copy-to-clipboard-HOJ79TWv.js";import{t as g}from"./messages-BMdD0LWk.js";import{l as _,n as v,r as y,s as b}from"./locale-store-CXhjfe4q.js";import{a as x,n as S,o as ee,r as C,s as w,t as te}from"./dist-BPoKqzeH.js";import{i as ne}from"./vendor-swr-BIWyz7Rc.js";import{n as T,r as E}from"./gateway-config-swr-BWGjnmDl.js";import{$i as D,Bi as O,Fs as k,Gi as A,Gl as j,Ji as M,Ki as N,Ol as P,Os as F,Qi as I,Ui as re,Xi as L,Ya as R,Yi as ie,Zi as z,gl as B,gr as ae,lr as oe,ma as se,nc as ce,no as V,qi as H,ul as le}from"./index-Bbd_dXui.js";import{n as ue,r as de,t as fe}from"./settings-page-layout-BRQNel6r.js";import{t as pe}from"./settings-loading-skeleton-B5GU7iCG.js";import{t as me}from"./settings-form-section-Coy1Cbp6.js";import{t as U}from"./page-tabs-BaEQMYm_.js";var W=e(t(),1),he=n(),G={enabled:!0,defaultTtlHours:24,maxTtlDays:30,maxActiveShares:500,maxFileSizeMb:500,directoryMaxFolderSizeMb:2048,directoryMaxFileCount:1e4,inlinePreviewMimes:[`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`image/svg+xml`,`application/pdf`,`text/html`,`text/markdown`,`text/plain`,`application/json`],noteEnabled:!0,noteMaxTotalSizeMb:250,noteMaxAttachmentCount:50,siteEnabled:!0,siteDefaultTtlHours:24,siteMaxTtlDays:30,maxActiveSites:50,siteMaxRootDirSizeMb:1024,siteMaxFileCount:2e4};function ge(){return structuredClone(G)}var K=36e5,q=864e5,J=1048576;function Y(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function _e(e,t=32){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.trim().length>0).map(e=>e.trim()).slice(0,t):[]}function ve(e){let t=Y(e)?e:{},n=Y(t.gateway)?t.gateway:{},r=Y(n.share)?n.share:{},i=Y(r.directory)?r.directory:{},a=Y(r.note)?r.note:{},o=Y(n.siteShare)?n.siteShare:{},s=Y(o.static)?o.static:{},c=typeof r.defaultTtlMs==`number`&&Number.isFinite(r.defaultTtlMs)?Math.floor(r.defaultTtlMs):G.defaultTtlHours*K,l=typeof r.maxTtlMs==`number`&&Number.isFinite(r.maxTtlMs)?Math.floor(r.maxTtlMs):G.maxTtlDays*q,u=typeof r.maxFileSize==`number`&&Number.isFinite(r.maxFileSize)?Math.floor(r.maxFileSize):G.maxFileSizeMb*J,d=typeof i.maxFolderSize==`number`&&Number.isFinite(i.maxFolderSize)?Math.floor(i.maxFolderSize):G.directoryMaxFolderSizeMb*J,f=typeof o.defaultTtlMs==`number`&&Number.isFinite(o.defaultTtlMs)?Math.floor(o.defaultTtlMs):G.siteDefaultTtlHours*K,p=typeof o.maxTtlMs==`number`&&Number.isFinite(o.maxTtlMs)?Math.floor(o.maxTtlMs):G.siteMaxTtlDays*q,m=typeof s.maxRootDirSize==`number`&&Number.isFinite(s.maxRootDirSize)?Math.floor(s.maxRootDirSize):G.siteMaxRootDirSizeMb*J,h=typeof a.maxTotalSize==`number`&&Number.isFinite(a.maxTotalSize)?Math.floor(a.maxTotalSize):G.noteMaxTotalSizeMb*J;return{enabled:r.enabled!==!1,defaultTtlHours:Math.max(1,Math.round(c/K)),maxTtlDays:Math.max(1,Math.round(l/q)),maxActiveShares:typeof r.maxActiveShares==`number`&&Number.isFinite(r.maxActiveShares)?Math.max(1,Math.min(1e4,Math.floor(r.maxActiveShares))):G.maxActiveShares,maxFileSizeMb:Math.max(1,Math.round(u/J)),directoryMaxFolderSizeMb:Math.max(1,Math.round(d/J)),directoryMaxFileCount:typeof i.maxFileCount==`number`&&Number.isFinite(i.maxFileCount)?Math.max(1,Math.min(1e5,Math.floor(i.maxFileCount))):G.directoryMaxFileCount,inlinePreviewMimes:_e(r.inlinePreviewMimes,32).length?_e(r.inlinePreviewMimes,32):[...G.inlinePreviewMimes],noteEnabled:a.enabled!==!1,noteMaxTotalSizeMb:Math.max(1,Math.round(h/J)),noteMaxAttachmentCount:typeof a.maxAttachmentCount==`number`&&Number.isFinite(a.maxAttachmentCount)?Math.max(0,Math.min(500,Math.floor(a.maxAttachmentCount))):G.noteMaxAttachmentCount,siteEnabled:o.enabled!==!1,siteDefaultTtlHours:Math.max(1,Math.round(f/K)),siteMaxTtlDays:Math.max(1,Math.round(p/q)),maxActiveSites:typeof o.maxActiveSites==`number`&&Number.isFinite(o.maxActiveSites)?Math.max(1,Math.min(1e3,Math.floor(o.maxActiveSites))):G.maxActiveSites,siteMaxRootDirSizeMb:Math.max(1,Math.round(m/J)),siteMaxFileCount:typeof s.maxFileCount==`number`&&Number.isFinite(s.maxFileCount)?Math.max(1,Math.min(1e5,Math.floor(s.maxFileCount))):G.siteMaxFileCount}}function ye(e){let t=e.defaultTtlHours*K,n=e.maxTtlDays*q,r=e.siteDefaultTtlHours*K,i=e.siteMaxTtlDays*q;return t<6e4||t>6048e5?`Default share TTL must be between 1 minute and 7 days.`:n<6e4||n>2592e6?`Maximum share TTL must be between 1 minute and 30 days.`:t>n?`Default TTL cannot exceed maximum TTL.`:e.maxActiveShares<1||e.maxActiveShares>1e4?`Maximum active shares must be between 1 and 10,000.`:e.maxActiveSites<1||e.maxActiveSites>1e3?`Maximum active site shares must be between 1 and 1,000.`:e.maxFileSizeMb<1||e.maxFileSizeMb>10240?`Maximum file size must be between 1 MB and 10 GB.`:e.directoryMaxFolderSizeMb<1||e.directoryMaxFolderSizeMb>10240?`Maximum folder size must be between 1 MB and 10 GB.`:e.directoryMaxFileCount<1||e.directoryMaxFileCount>1e5?`Maximum directory file count must be between 1 and 100,000.`:e.noteMaxTotalSizeMb<1||e.noteMaxTotalSizeMb>2048?`Maximum Note snapshot size must be between 1 MB and 2 GB.`:e.noteMaxAttachmentCount<0||e.noteMaxAttachmentCount>500?`Maximum Note attachment count must be between 0 and 500.`:r<6e4||r>6048e5?`Default site share TTL must be between 1 minute and 7 days.`:i<6e4||i>2592e6?`Maximum site share TTL must be between 1 minute and 30 days.`:r>i?`Default site TTL cannot exceed maximum site TTL.`:e.siteMaxRootDirSizeMb<1||e.siteMaxRootDirSizeMb>10240?`Maximum static site size must be between 1 MB and 10 GB.`:e.siteMaxFileCount<1||e.siteMaxFileCount>1e5?`Maximum static site file count must be between 1 and 100,000.`:null}async function X(e){let t=ye(e);if(t)throw Error(t);await b(y(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{share:{enabled:e.enabled,defaultTtlMs:e.defaultTtlHours*K,maxTtlMs:e.maxTtlDays*q,maxActiveShares:e.maxActiveShares,maxFileSize:e.maxFileSizeMb*J,inlinePreviewMimes:e.inlinePreviewMimes,directory:{maxFolderSize:e.directoryMaxFolderSizeMb*J,maxFileCount:e.directoryMaxFileCount},note:{enabled:e.noteEnabled,maxTotalSize:e.noteMaxTotalSizeMb*J,maxAttachmentCount:e.noteMaxAttachmentCount}},siteShare:{enabled:e.siteEnabled,defaultTtlMs:e.siteDefaultTtlHours*K,maxTtlMs:e.siteMaxTtlDays*q,maxActiveSites:e.maxActiveSites,static:{maxRootDirSize:e.siteMaxRootDirSizeMb*J,maxFileCount:e.siteMaxFileCount}}}})}),T()}var Z=r();function Q(){return f(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,m,`dark:border-edge`)}function be({hasToken:e}){let t=g(v(e=>e.language)).sharesSettings,{data:n,isLoading:r}=E(e),i=(0,W.useMemo)(()=>n?.payload?.config===void 0?null:structuredClone(ve(n.payload.config)),[n]),a=(0,W.useRef)(!1),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(null),[f,m]=(0,W.useState)(!1),h=o??i,_=i,y=(0,W.useMemo)(()=>!h||!_?!1:JSON.stringify(h)!==JSON.stringify(_),[h,_]),b=(0,W.useCallback)(e=>{a.current=!0,s(t=>{let n=t??_;return n?{...n,...e}:null})},[_]),x=(0,W.useCallback)(async()=>{if(!(!h||c)){l(!0),d(null),m(!1);try{await X(h),a.current=!1,s(null),m(!0),window.setTimeout(()=>m(!1),2500)}catch(e){d(e instanceof Error?e.message:t.policySaveError)}finally{l(!1)}}},[h,c,t.policySaveError]),S=(0,W.useCallback)(()=>{a.current=!1,s(null),d(null),m(!1)},[]);return!e||!h?r?(0,Z.jsx)(me,{children:(0,Z.jsx)(pe,{rows:2})}):null:(0,Z.jsxs)(me,{children:[(0,Z.jsxs)(`div`,{className:`mb-4 flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.policyTitle}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.policyHint})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[f?(0,Z.jsx)(`span`,{className:`text-sm text-fg-muted`,children:t.policySaved}):null,(0,Z.jsx)(p,{type:`button`,variant:`secondary`,disabled:c,onClick:()=>b(ge()),children:t.policyUseRecommended}),(0,Z.jsx)(p,{type:`button`,variant:`secondary`,disabled:!y||c,onClick:S,children:t.policyDiscard}),(0,Z.jsx)(p,{type:`button`,variant:`primary`,disabled:!y||c,onClick:()=>void x(),children:c?t.policySaving:t.policySave})]})]}),y?(0,Z.jsx)(`p`,{className:`mb-3 text-xs text-amber-800 dark:text-amber-200`,children:t.policyUnsaved}):null,u?(0,Z.jsx)(`p`,{className:`mb-3 text-sm text-red-600 dark:text-red-400`,children:u}):null,(0,Z.jsx)(`p`,{className:`mb-4 text-xs text-fg-subtle`,children:t.policyRestartHint}),(0,Z.jsx)(xe,{t,form:h,onChange:b})]})}function xe(e){let t=(0,he.c)(189),{t:n,form:r,onChange:i}=e,a;t[0]===n.policyFileSection?a=t[1]:(a=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policyFileSection}),t[0]=n.policyFileSection,t[1]=a);let o;t[2]===n.policyFileSectionHint?o=t[3]:(o=(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policyFileSectionHint}),t[2]=n.policyFileSectionHint,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,Z.jsxs)(`div`,{className:`mb-4`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=e=>i({enabled:e.target.checked}),t[7]=i,t[8]=c);let l;t[9]!==r.enabled||t[10]!==c?(l=(0,Z.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.enabled,onChange:c}),t[9]=r.enabled,t[10]=c,t[11]=l):l=t[11];let u;t[12]!==n.policyEnabled||t[13]!==l?(u=(0,Z.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[l,n.policyEnabled]}),t[12]=n.policyEnabled,t[13]=l,t[14]=u):u=t[14];let d=!r.enabled,f;t[15]===i?f=t[16]:(f=e=>i({defaultTtlHours:e}),t[15]=i,t[16]=f);let p;t[17]!==r.defaultTtlHours||t[18]!==n.policyDefaultTtlHint||t[19]!==n.policyDefaultTtlHours||t[20]!==d||t[21]!==f?(p=(0,Z.jsx)($,{id:`share-default-ttl-hours`,label:n.policyDefaultTtlHours,hint:n.policyDefaultTtlHint,value:r.defaultTtlHours,min:1,max:168,disabled:d,onChange:f}),t[17]=r.defaultTtlHours,t[18]=n.policyDefaultTtlHint,t[19]=n.policyDefaultTtlHours,t[20]=d,t[21]=f,t[22]=p):p=t[22];let m=!r.enabled,h;t[23]===i?h=t[24]:(h=e=>i({maxTtlDays:e}),t[23]=i,t[24]=h);let g;t[25]!==r.maxTtlDays||t[26]!==n.policyMaxTtlDays||t[27]!==n.policyMaxTtlHint||t[28]!==m||t[29]!==h?(g=(0,Z.jsx)($,{id:`share-max-ttl-days`,label:n.policyMaxTtlDays,hint:n.policyMaxTtlHint,value:r.maxTtlDays,min:1,max:30,disabled:m,onChange:h}),t[25]=r.maxTtlDays,t[26]=n.policyMaxTtlDays,t[27]=n.policyMaxTtlHint,t[28]=m,t[29]=h,t[30]=g):g=t[30];let _=!r.enabled,v;t[31]===i?v=t[32]:(v=e=>i({maxActiveShares:e}),t[31]=i,t[32]=v);let y;t[33]!==r.maxActiveShares||t[34]!==n.policyMaxActiveShares||t[35]!==n.policyMaxActiveSharesHint||t[36]!==_||t[37]!==v?(y=(0,Z.jsx)($,{id:`share-max-active`,label:n.policyMaxActiveShares,hint:n.policyMaxActiveSharesHint,value:r.maxActiveShares,min:1,max:1e4,disabled:_,onChange:v}),t[33]=r.maxActiveShares,t[34]=n.policyMaxActiveShares,t[35]=n.policyMaxActiveSharesHint,t[36]=_,t[37]=v,t[38]=y):y=t[38];let b=!r.enabled,x;t[39]===i?x=t[40]:(x=e=>i({maxFileSizeMb:e}),t[39]=i,t[40]=x);let S;t[41]!==r.maxFileSizeMb||t[42]!==n.policyMaxFileSizeHint||t[43]!==n.policyMaxFileSizeMb||t[44]!==b||t[45]!==x?(S=(0,Z.jsx)($,{id:`share-max-file-mb`,label:n.policyMaxFileSizeMb,hint:n.policyMaxFileSizeHint,value:r.maxFileSizeMb,min:1,max:10240,disabled:b,onChange:x}),t[41]=r.maxFileSizeMb,t[42]=n.policyMaxFileSizeHint,t[43]=n.policyMaxFileSizeMb,t[44]=b,t[45]=x,t[46]=S):S=t[46];let ee=!r.enabled,C;t[47]===i?C=t[48]:(C=e=>i({directoryMaxFolderSizeMb:e}),t[47]=i,t[48]=C);let w;t[49]!==r.directoryMaxFolderSizeMb||t[50]!==n.policyDirectoryMaxFolderSizeHint||t[51]!==n.policyDirectoryMaxFolderSizeMb||t[52]!==ee||t[53]!==C?(w=(0,Z.jsx)($,{id:`share-directory-max-size-mb`,label:n.policyDirectoryMaxFolderSizeMb,hint:n.policyDirectoryMaxFolderSizeHint,value:r.directoryMaxFolderSizeMb,min:1,max:10240,disabled:ee,onChange:C}),t[49]=r.directoryMaxFolderSizeMb,t[50]=n.policyDirectoryMaxFolderSizeHint,t[51]=n.policyDirectoryMaxFolderSizeMb,t[52]=ee,t[53]=C,t[54]=w):w=t[54];let te=!r.enabled,ne;t[55]===i?ne=t[56]:(ne=e=>i({directoryMaxFileCount:e}),t[55]=i,t[56]=ne);let T;t[57]!==r.directoryMaxFileCount||t[58]!==n.policyDirectoryMaxFileCount||t[59]!==n.policyDirectoryMaxFileCountHint||t[60]!==te||t[61]!==ne?(T=(0,Z.jsx)($,{id:`share-directory-max-files`,label:n.policyDirectoryMaxFileCount,hint:n.policyDirectoryMaxFileCountHint,value:r.directoryMaxFileCount,min:1,max:1e5,disabled:te,onChange:ne}),t[57]=r.directoryMaxFileCount,t[58]=n.policyDirectoryMaxFileCount,t[59]=n.policyDirectoryMaxFileCountHint,t[60]=te,t[61]=ne,t[62]=T):T=t[62];let E;t[63]!==g||t[64]!==y||t[65]!==S||t[66]!==w||t[67]!==T||t[68]!==p?(E=(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[p,g,y,S,w,T]}),t[63]=g,t[64]=y,t[65]=S,t[66]=w,t[67]=T,t[68]=p,t[69]=E):E=t[69];let D=!r.enabled,O;t[70]===i?O=t[71]:(O=e=>i({inlinePreviewMimes:e}),t[70]=i,t[71]=O);let k;t[72]!==r.inlinePreviewMimes||t[73]!==n||t[74]!==D||t[75]!==O?(k=(0,Z.jsx)(Se,{t:n,values:r.inlinePreviewMimes,disabled:D,onChange:O}),t[72]=r.inlinePreviewMimes,t[73]=n,t[74]=D,t[75]=O,t[76]=k):k=t[76];let A;t[77]!==E||t[78]!==k||t[79]!==s||t[80]!==u?(A=(0,Z.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-muted/25 p-4`,children:[s,u,E,k]}),t[77]=E,t[78]=k,t[79]=s,t[80]=u,t[81]=A):A=t[81];let j;t[82]===n.policyNoteSection?j=t[83]:(j=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policyNoteSection}),t[82]=n.policyNoteSection,t[83]=j);let M;t[84]===n.policyNoteSectionHint?M=t[85]:(M=(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policyNoteSectionHint}),t[84]=n.policyNoteSectionHint,t[85]=M);let N;t[86]!==j||t[87]!==M?(N=(0,Z.jsxs)(`div`,{className:`mb-4`,children:[j,M]}),t[86]=j,t[87]=M,t[88]=N):N=t[88];let P;t[89]===i?P=t[90]:(P=e=>i({noteEnabled:e.target.checked}),t[89]=i,t[90]=P);let F;t[91]!==r.noteEnabled||t[92]!==P?(F=(0,Z.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.noteEnabled,onChange:P}),t[91]=r.noteEnabled,t[92]=P,t[93]=F):F=t[93];let I;t[94]!==n.policyNoteEnabled||t[95]!==F?(I=(0,Z.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[F,n.policyNoteEnabled]}),t[94]=n.policyNoteEnabled,t[95]=F,t[96]=I):I=t[96];let re=!r.enabled||!r.noteEnabled,L;t[97]===i?L=t[98]:(L=e=>i({noteMaxTotalSizeMb:e}),t[97]=i,t[98]=L);let R;t[99]!==r.noteMaxTotalSizeMb||t[100]!==n.policyNoteMaxTotalSizeHint||t[101]!==n.policyNoteMaxTotalSizeMb||t[102]!==re||t[103]!==L?(R=(0,Z.jsx)($,{id:`share-note-max-size-mb`,label:n.policyNoteMaxTotalSizeMb,hint:n.policyNoteMaxTotalSizeHint,value:r.noteMaxTotalSizeMb,min:1,max:2048,disabled:re,onChange:L}),t[99]=r.noteMaxTotalSizeMb,t[100]=n.policyNoteMaxTotalSizeHint,t[101]=n.policyNoteMaxTotalSizeMb,t[102]=re,t[103]=L,t[104]=R):R=t[104];let ie=!r.enabled||!r.noteEnabled,z;t[105]===i?z=t[106]:(z=e=>i({noteMaxAttachmentCount:e}),t[105]=i,t[106]=z);let B;t[107]!==r.noteMaxAttachmentCount||t[108]!==n.policyNoteMaxAttachmentCount||t[109]!==n.policyNoteMaxAttachmentCountHint||t[110]!==ie||t[111]!==z?(B=(0,Z.jsx)($,{id:`share-note-max-attachments`,label:n.policyNoteMaxAttachmentCount,hint:n.policyNoteMaxAttachmentCountHint,value:r.noteMaxAttachmentCount,min:0,max:500,disabled:ie,onChange:z}),t[107]=r.noteMaxAttachmentCount,t[108]=n.policyNoteMaxAttachmentCount,t[109]=n.policyNoteMaxAttachmentCountHint,t[110]=ie,t[111]=z,t[112]=B):B=t[112];let ae;t[113]!==R||t[114]!==B?(ae=(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[R,B]}),t[113]=R,t[114]=B,t[115]=ae):ae=t[115];let oe;t[116]!==N||t[117]!==I||t[118]!==ae?(oe=(0,Z.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-muted/25 p-4`,children:[N,I,ae]}),t[116]=N,t[117]=I,t[118]=ae,t[119]=oe):oe=t[119];let se;t[120]===n.policySiteSection?se=t[121]:(se=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policySiteSection}),t[120]=n.policySiteSection,t[121]=se);let ce;t[122]===n.policySiteSectionHint?ce=t[123]:(ce=(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policySiteSectionHint}),t[122]=n.policySiteSectionHint,t[123]=ce);let V;t[124]!==se||t[125]!==ce?(V=(0,Z.jsxs)(`div`,{className:`mb-4`,children:[se,ce]}),t[124]=se,t[125]=ce,t[126]=V):V=t[126];let H;t[127]===i?H=t[128]:(H=e=>i({siteEnabled:e.target.checked}),t[127]=i,t[128]=H);let le;t[129]!==r.siteEnabled||t[130]!==H?(le=(0,Z.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.siteEnabled,onChange:H}),t[129]=r.siteEnabled,t[130]=H,t[131]=le):le=t[131];let ue;t[132]!==n.policySiteEnabled||t[133]!==le?(ue=(0,Z.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[le,n.policySiteEnabled]}),t[132]=n.policySiteEnabled,t[133]=le,t[134]=ue):ue=t[134];let de=!r.siteEnabled,fe;t[135]===i?fe=t[136]:(fe=e=>i({siteDefaultTtlHours:e}),t[135]=i,t[136]=fe);let pe;t[137]!==r.siteDefaultTtlHours||t[138]!==n.policySiteDefaultTtlHint||t[139]!==n.policySiteDefaultTtlHours||t[140]!==de||t[141]!==fe?(pe=(0,Z.jsx)($,{id:`site-share-default-ttl-hours`,label:n.policySiteDefaultTtlHours,hint:n.policySiteDefaultTtlHint,value:r.siteDefaultTtlHours,min:1,max:168,disabled:de,onChange:fe}),t[137]=r.siteDefaultTtlHours,t[138]=n.policySiteDefaultTtlHint,t[139]=n.policySiteDefaultTtlHours,t[140]=de,t[141]=fe,t[142]=pe):pe=t[142];let me=!r.siteEnabled,U;t[143]===i?U=t[144]:(U=e=>i({siteMaxTtlDays:e}),t[143]=i,t[144]=U);let W;t[145]!==r.siteMaxTtlDays||t[146]!==n.policySiteMaxTtlDays||t[147]!==n.policySiteMaxTtlHint||t[148]!==me||t[149]!==U?(W=(0,Z.jsx)($,{id:`site-share-max-ttl-days`,label:n.policySiteMaxTtlDays,hint:n.policySiteMaxTtlHint,value:r.siteMaxTtlDays,min:1,max:30,disabled:me,onChange:U}),t[145]=r.siteMaxTtlDays,t[146]=n.policySiteMaxTtlDays,t[147]=n.policySiteMaxTtlHint,t[148]=me,t[149]=U,t[150]=W):W=t[150];let G=!r.siteEnabled,ge;t[151]===i?ge=t[152]:(ge=e=>i({maxActiveSites:e}),t[151]=i,t[152]=ge);let K;t[153]!==r.maxActiveSites||t[154]!==n.policyMaxActiveSites||t[155]!==n.policyMaxActiveSitesHint||t[156]!==G||t[157]!==ge?(K=(0,Z.jsx)($,{id:`site-share-max-active`,label:n.policyMaxActiveSites,hint:n.policyMaxActiveSitesHint,value:r.maxActiveSites,min:1,max:1e3,disabled:G,onChange:ge}),t[153]=r.maxActiveSites,t[154]=n.policyMaxActiveSites,t[155]=n.policyMaxActiveSitesHint,t[156]=G,t[157]=ge,t[158]=K):K=t[158];let q=!r.siteEnabled,J;t[159]===i?J=t[160]:(J=e=>i({siteMaxRootDirSizeMb:e}),t[159]=i,t[160]=J);let Y;t[161]!==r.siteMaxRootDirSizeMb||t[162]!==n.policySiteMaxRootDirSizeHint||t[163]!==n.policySiteMaxRootDirSizeMb||t[164]!==q||t[165]!==J?(Y=(0,Z.jsx)($,{id:`site-share-max-root-size-mb`,label:n.policySiteMaxRootDirSizeMb,hint:n.policySiteMaxRootDirSizeHint,value:r.siteMaxRootDirSizeMb,min:1,max:10240,disabled:q,onChange:J}),t[161]=r.siteMaxRootDirSizeMb,t[162]=n.policySiteMaxRootDirSizeHint,t[163]=n.policySiteMaxRootDirSizeMb,t[164]=q,t[165]=J,t[166]=Y):Y=t[166];let _e=!r.siteEnabled,ve;t[167]===i?ve=t[168]:(ve=e=>i({siteMaxFileCount:e}),t[167]=i,t[168]=ve);let ye;t[169]!==r.siteMaxFileCount||t[170]!==n.policySiteMaxFileCount||t[171]!==n.policySiteMaxFileCountHint||t[172]!==_e||t[173]!==ve?(ye=(0,Z.jsx)($,{id:`site-share-max-files`,label:n.policySiteMaxFileCount,hint:n.policySiteMaxFileCountHint,value:r.siteMaxFileCount,min:1,max:1e5,disabled:_e,onChange:ve}),t[169]=r.siteMaxFileCount,t[170]=n.policySiteMaxFileCount,t[171]=n.policySiteMaxFileCountHint,t[172]=_e,t[173]=ve,t[174]=ye):ye=t[174];let X;t[175]!==pe||t[176]!==W||t[177]!==K||t[178]!==Y||t[179]!==ye?(X=(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[pe,W,K,Y,ye]}),t[175]=pe,t[176]=W,t[177]=K,t[178]=Y,t[179]=ye,t[180]=X):X=t[180];let Q;t[181]!==V||t[182]!==ue||t[183]!==X?(Q=(0,Z.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-muted/25 p-4`,children:[V,ue,X]}),t[181]=V,t[182]=ue,t[183]=X,t[184]=Q):Q=t[184];let be;return t[185]!==A||t[186]!==oe||t[187]!==Q?(be=(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[A,oe,Q]}),t[185]=A,t[186]=oe,t[187]=Q,t[188]=be):be=t[188],be}function $(e){let t=(0,he.c)(21),{id:n,label:r,hint:i,value:a,min:o,max:s,disabled:c,onChange:l}=e,u;t[0]!==n||t[1]!==r?(u=(0,Z.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=u):u=t[2];let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=f(Q(),`max-w-xs font-mono text-xs`),t[3]=d):d=t[3];let p;t[4]!==s||t[5]!==o||t[6]!==l?(p=e=>{let t=Number(e.target.value);Number.isFinite(t)&&l(Math.max(o,Math.min(s,Math.floor(t))))},t[4]=s,t[5]=o,t[6]=l,t[7]=p):p=t[7];let m;t[8]!==c||t[9]!==n||t[10]!==s||t[11]!==o||t[12]!==p||t[13]!==a?(m=(0,Z.jsx)(`input`,{id:n,type:`number`,min:o,max:s,disabled:c,className:d,value:a,onChange:p}),t[8]=c,t[9]=n,t[10]=s,t[11]=o,t[12]=p,t[13]=a,t[14]=m):m=t[14];let h;t[15]===i?h=t[16]:(h=(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}),t[15]=i,t[16]=h);let g;return t[17]!==u||t[18]!==m||t[19]!==h?(g=(0,Z.jsxs)(`div`,{children:[u,m,h]}),t[17]=u,t[18]=m,t[19]=h,t[20]=g):g=t[20],g}function Se(e){let t=(0,he.c)(25),{t:n,values:r,disabled:i,onChange:a}=e,o;t[0]!==a||t[1]!==r?(o=e=>{let t=e.trim();!t||r.includes(t)||r.length>=32||a([...r,t])},t[0]=a,t[1]=r,t[2]=o):o=t[2];let s=o,c;t[3]===n.policyInlinePreviewMimes?c=t[4]:(c=(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.policyInlinePreviewMimes}),t[3]=n.policyInlinePreviewMimes,t[4]=c);let l;t[5]===n.policyInlinePreviewMimesHint?l=t[6]:(l=(0,Z.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.policyInlinePreviewMimesHint}),t[5]=n.policyInlinePreviewMimesHint,t[6]=l);let u;t[7]!==i||t[8]!==a||t[9]!==r?(u=r.map(e=>(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 font-mono text-xs text-fg`,children:[e,i?null:(0,Z.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,"aria-label":`Remove ${e}`,onClick:()=>a(r.filter(t=>t!==e)),children:`×`})]},e)),t[7]=i,t[8]=a,t[9]=r,t[10]=u):u=t[10];let d;t[11]===u?d=t[12]:(d=(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:u}),t[11]=u,t[12]=d);let p;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=f(Q(),`font-mono text-xs`),t[13]=p):p=t[13];let m=i||r.length>=32,h;t[14]===s?h=t[15]:(h=e=>{e.key===`Enter`&&(e.preventDefault(),s(e.target.value),e.target.value=``)},t[14]=s,t[15]=h);let g;t[16]!==n.policyMimePlaceholder||t[17]!==m||t[18]!==h?(g=(0,Z.jsx)(`input`,{className:p,placeholder:n.policyMimePlaceholder,disabled:m,onKeyDown:h}),t[16]=n.policyMimePlaceholder,t[17]=m,t[18]=h,t[19]=g):g=t[19];let _;return t[20]!==c||t[21]!==l||t[22]!==d||t[23]!==g?(_=(0,Z.jsxs)(`div`,{className:`space-y-2 border-t border-edge pt-4`,children:[c,l,d,g]}),t[20]=c,t[21]=l,t[22]=d,t[23]=g,t[24]=_):_=t[24],_}function Ce(e){let t=(0,he.c)(70),{open:n,onOpenChange:r,onConfirm:i,initialPath:a,selectKind:c,sessionKey:u,agentId:m}=e,h=c===void 0?`any`:c,y=g(v(Ee)),b=y.workspace,T=y.sharesSettings,E=re(Te),{data:D}=ne(_(we)?`picker-agents-list`:null,ae),O;bb0:{let e;t[0]===m?e=t[1]:(e=m?.trim(),t[0]=m,t[1]=e);let n=e;if(n){O=n;break bb0}let r;t[2]===E?r=t[3]:(r=E.trim(),t[2]=E,t[3]=r);let i=r;if(i){O=i;break bb0}if(D?.defaultId){O=D.defaultId;break bb0}if(D?.agents?.[0]?.id){O=D.agents[0].id;break bb0}O=``}let k=O,[j,M]=(0,W.useState)(k),N,P;t[4]===k?(N=t[5],P=t[6]):(N=()=>{M(k)},P=[k],t[4]=k,t[5]=N,t[6]=P),(0,W.useEffect)(N,P);let{tree:F,loading:I,error:L,loadRoot:R,loadChildren:ie,reset:z}=A(j,u??null),B;t[7]===a?B=t[8]:(B=a?{path:a,isDirectory:!1}:null,t[7]=a,t[8]=B);let[V,H]=(0,W.useState)(B),ue;t[9]!==a||t[10]!==R||t[11]!==n||t[12]!==z||t[13]!==H?(ue=()=>{if(!n){z(),H(a?{path:a,isDirectory:!1}:null);return}R()},t[9]=a,t[10]=R,t[11]=n,t[12]=z,t[13]=H,t[14]=ue):ue=t[14];let de;t[15]!==a||t[16]!==R||t[17]!==n||t[18]!==j||t[19]!==z||t[20]!==u?(de=[n,j,u,R,z,a],t[15]=a,t[16]=R,t[17]=n,t[18]=j,t[19]=z,t[20]=u,t[21]=de):de=t[21],(0,W.useEffect)(ue,de);let fe;t[22]===ie?fe=t[23]:(fe=e=>{ie(e)},t[22]=ie,t[23]=fe);let pe=fe,me=V!==null&&(h===`any`||h===`file`&&!V.isDirectory||h===`directory`&&V.isDirectory),U;bb1:{if(!V){U=T.pickerHintNone;break bb1}if(h===`file`&&V.isDirectory){U=T.pickerHintNeedsFile;break bb1}if(h===`directory`&&!V.isDirectory){U=T.pickerHintNeedsDirectory;break bb1}U=`${V.isDirectory?`📁`:`📄`} ${V.path}`}let G=U,ge=D?.agents??[],K;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(x,{className:`fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),t[24]=K):K=t[24];let q;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(q=f(`fixed left-1/2 top-1/2 z-[71] w-[min(34rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2`,`flex h-[min(28rem,calc(100vh-3rem))] flex-col overflow-hidden rounded-lg border border-edge bg-surface-panel shadow-popover outline-none`),t[25]=q):q=t[25];let J;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(le,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[26]=J):J=t[26];let Y=y.cron.refresh,_e=y.cron.refresh,ve;t[27]===R?ve=t[28]:(ve=()=>void R(),t[27]=R,t[28]=ve);let ye=I&&`animate-spin`,X;t[29]===ye?X=t[30]:(X=f(`size-4`,ye),t[29]=ye,t[30]=X);let Q;t[31]===X?Q=t[32]:(Q=(0,Z.jsx)(ce,{className:X,"aria-hidden":!0}),t[31]=X,t[32]=Q);let be;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(d,{className:`size-4`}),t[33]=be):be=t[33];let xe;t[34]!==L||t[35]!==b.loadError?(xe=L?(0,Z.jsxs)(`p`,{className:`shrink-0 px-4 py-2 text-xs text-red-600 dark:text-red-400`,children:[b.loadError,`: `,L]}):null,t[34]=L,t[35]=b.loadError,t[36]=xe):xe=t[36];let $;t[37]!==pe||t[38]!==I||t[39]!==V?.path||t[40]!==H||t[41]!==b.emptyDir||t[42]!==b.title||t[43]!==F?($=I&&F.length===0?(0,Z.jsxs)(`p`,{className:`flex shrink-0 items-center gap-2 px-4 py-3 text-sm text-fg-muted`,children:[(0,Z.jsx)(l,{className:`size-4 animate-spin`}),b.title,`…`]}):(0,Z.jsx)(se,{tree:F,selectedPath:V?.path??null,onSelectFile:e=>H({path:e,isDirectory:!1}),onSelectEntry:(e,t)=>H({path:e,isDirectory:t}),onExpandDir:pe,onAction:void 0,emptyHint:b.emptyDir}),t[37]=pe,t[38]=I,t[39]=V?.path,t[40]=H,t[41]=b.emptyDir,t[42]=b.title,t[43]=F,t[44]=$):$=t[44];let Se;t[45]!==xe||t[46]!==$?(Se=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[xe,$]}),t[45]=xe,t[46]=$,t[47]=Se):Se=t[47];let Ce;t[48]===G?Ce=t[49]:(Ce=(0,Z.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-xs text-fg-muted`,children:G}),t[48]=G,t[49]=Ce);let De;t[50]===r?De=t[51]:(De=()=>r(!1),t[50]=r,t[51]=De);let Oe;t[52]!==T.cancel||t[53]!==De?(Oe=(0,Z.jsx)(p,{type:`button`,variant:`ghost`,onClick:De,children:T.cancel}),t[52]=T.cancel,t[53]=De,t[54]=Oe):Oe=t[54];let ke=!me,Ae;t[55]!==i||t[56]!==r||t[57]!==j||t[58]!==V?(Ae=()=>{V&&(i({...V,agentId:j}),r(!1))},t[55]=i,t[56]=r,t[57]=j,t[58]=V,t[59]=Ae):Ae=t[59];let je;t[60]!==T.pickerConfirm||t[61]!==ke||t[62]!==Ae?(je=(0,Z.jsx)(p,{type:`button`,disabled:ke,onClick:Ae,children:T.pickerConfirm}),t[60]=T.pickerConfirm,t[61]=ke,t[62]=Ae,t[63]=je):je=t[63];let Me;t[64]!==Oe||t[65]!==je?(Me=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[Oe,je]}),t[64]=Oe,t[65]=je,t[66]=Me):Me=t[66];let Ne;return t[67]!==Ce||t[68]!==Me?(Ne=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge px-4 py-3`,children:[Ce,Me]}),t[67]=Ce,t[68]=Me,t[69]=Ne):Ne=t[69],(0,Z.jsx)(te,{open:n,onOpenChange:r,children:(0,Z.jsxs)(ee,{children:[K,(0,Z.jsxs)(C,{className:q,children:[(0,Z.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center gap-2 border-b border-edge px-4`,children:[J,(0,Z.jsx)(w,{className:`min-w-0 flex-1 truncate text-base font-semibold text-fg`,children:T.pickerTitle}),(0,Z.jsx)(`button`,{type:`button`,className:`inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50`,title:Y,"aria-label":_e,disabled:I,onClick:ve,children:Q}),(0,Z.jsx)(S,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,className:`inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":b.close,children:be})})]}),ge.length>0?(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-edge px-4 py-2`,children:[(0,Z.jsx)(`label`,{className:`text-xs text-fg-muted`,htmlFor:`picker-agent-select`,children:T.pickerAgentLabel}),(0,Z.jsx)(o,{id:`picker-agent-select`,className:`min-w-0 flex-1 rounded-md border border-edge bg-surface-panel px-2 py-1 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:j,onChange:e=>{M(e.target.value),H(null)},children:ge.map(e=>(0,Z.jsxs)(s,{value:e.id,children:[oe(e,y.agentsSettings),e.id===D?.defaultId?` ★`:``]},e.id))})]}):null,Se,Ne]})]})})}function we(e){return e.token}function Te(e){return e.agentId}function Ee(e){return e.language}var De=[`shares`,`policy`];function Oe(e){let t=(e??``).trim();return De.includes(t)?t:`shares`}function ke(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function Ae(e,t){let n=new Date(e).getTime()-Date.now(),r=Math.abs(n),i=n<0;if(r<6e4)return t===`zh`?`刚刚`:`just now`;let a=Math.floor(r/6e4);if(a<60){let e=t===`zh`?`${a} 分钟`:`${a}m`;return i?t===`zh`?`${e}前`:`${e} ago`:e}let o=Math.floor(a/60);if(o<24){let e=t===`zh`?`${o} 小时`:`${o}h`;return i?t===`zh`?`${e}前`:`${e} ago`:e}let s=Math.floor(o/24),c=t===`zh`?`${s} 天`:`${s}d`;return i?t===`zh`?`${c}前`:`${c} ago`:c}var je=[{value:36e5,key:`1h`},{value:216e5,key:`6h`},{value:864e5,key:`24h`},{value:2592e5,key:`3d`},{value:6048e5,key:`7d`},{value:2592e6,key:`30d`}];function Me(){let e=(0,he.c)(24),t=v(Pe),n=g(t).sharesSettings,r=!!_(Ne),[a,o]=i(),s;e[0]===a?s=e[1]:(s=Oe(a.get(`tab`)),e[0]=a,e[1]=s);let c=s,l;e[2]===o?l=e[3]:(l=e=>{o(t=>{let n=new URLSearchParams(t);return e===`shares`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[2]=o,e[3]=l);let u=l;if(!r)return(0,Z.jsx)(de,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})});let d={shares:n.tabShares,policy:n.tabPolicy},f=De.map(e=>({id:e,label:d[e]})),p;e[4]!==n.subtitle||e[5]!==n.title?(p=(0,Z.jsx)(ue,{title:n.title,subtitle:n.subtitle}),e[4]=n.subtitle,e[5]=n.title,e[6]=p):p=e[6];let m;e[7]!==c||e[8]!==u||e[9]!==n.tabsAria||e[10]!==f?(m=(0,Z.jsx)(U,{items:f,activeTab:c,onChange:u,ariaLabel:n.tabsAria,tabIdPrefix:`shares-tab`,panelIdPrefix:`shares-panel`}),e[7]=c,e[8]=u,e[9]=n.tabsAria,e[10]=f,e[11]=m):m=e[11];let h;e[12]!==c||e[13]!==r||e[14]!==t||e[15]!==n?(h=c===`shares`?(0,Z.jsx)(Fe,{t:n,language:t}):(0,Z.jsx)(be,{hasToken:r}),e[12]=c,e[13]=r,e[14]=t,e[15]=n,e[16]=h):h=e[16];let y;e[17]!==c||e[18]!==h?(y=(0,Z.jsx)(fe,{id:c,activeTab:c,tabIdPrefix:`shares-tab`,panelIdPrefix:`shares-panel`,showHeading:!1,children:h}),e[17]=c,e[18]=h,e[19]=y):y=e[19];let b;return e[20]!==p||e[21]!==m||e[22]!==y?(b=(0,Z.jsxs)(de,{children:[p,m,y]}),e[20]=p,e[21]=m,e[22]=y,e[23]=b):b=e[23],b}function Ne(e){return e.token}function Pe(e){return e.language}function Fe(e){let t=(0,he.c)(60),{t:n,language:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={refreshInterval:3e4},t[0]=i):i=t[0];let{data:a,error:o,isLoading:s,mutate:c}=ne(`shares-list`,ie,i),l;t[1]===a?.payload?.shares?l=t[2]:(l=a?.payload?.shares??[],t[1]=a?.payload?.shares,t[2]=l);let u=l,[d,m]=(0,W.useState)(!1),h;bb0:{if(d){h=u;break bb0}let e;t[3]===u?e=t[4]:(e=u.filter(Be),t[3]=u,t[4]=e),h=e}let g=h,_;t[5]===u?_=t[6]:(_=u.filter(ze),t[5]=u,t[6]=_);let v=_.length,y;t[7]===u?y=t[8]:(y=u.filter(Re),t[7]=u,t[8]=y);let b=y.length,x;t[9]===c?x=t[10]:(x=()=>void c(),t[9]=c,t[10]=x);let S;t[11]!==n||t[12]!==x?(S=(0,Z.jsx)(He,{t:n,onCreated:x}),t[11]=n,t[12]=x,t[13]=S):S=t[13];let ee=d?n.allSharesTitle:n.listTitle,C;t[14]===v?C=t[15]:(C=v>0&&(0,Z.jsxs)(`span`,{className:`ml-2 text-xs font-normal text-fg-muted`,children:[`(`,v,`)`]}),t[14]=v,t[15]=C);let w;t[16]!==ee||t[17]!==C?(w=(0,Z.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[ee,C]}),t[16]=ee,t[17]=C,t[18]=w):w=t[18];let te;t[19]===c?te=t[20]:(te=()=>void c(),t[19]=c,t[20]=te);let T=s&&`animate-spin`,E;t[21]===T?E=t[22]:(E=f(`size-3.5`,T),t[21]=T,t[22]=E);let D;t[23]===E?D=t[24]:(D=(0,Z.jsx)(ce,{className:E}),t[23]=E,t[24]=D);let O;t[25]!==s||t[26]!==te||t[27]!==D?(O=(0,Z.jsx)(p,{type:`button`,variant:`ghost`,className:`px-2 py-1`,onClick:te,disabled:s,children:D}),t[25]=s,t[26]=te,t[27]=D,t[28]=O):O=t[28];let k;t[29]!==b||t[30]!==d||t[31]!==n.hideExpired||t[32]!==n.showExpired?(k=b>0&&(0,Z.jsx)(`button`,{type:`button`,className:`text-xs text-accent hover:underline`,onClick:()=>m(Le),children:d?n.hideExpired:n.showExpired}),t[29]=b,t[30]=d,t[31]=n.hideExpired,t[32]=n.showExpired,t[33]=k):k=t[33];let A;t[34]!==O||t[35]!==k?(A=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[O,k]}),t[34]=O,t[35]=k,t[36]=A):A=t[36];let j;t[37]!==w||t[38]!==A?(j=(0,Z.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[w,A]}),t[37]=w,t[38]=A,t[39]=j):j=t[39];let M;t[40]!==a||t[41]!==o||t[42]!==g||t[43]!==s||t[44]!==r||t[45]!==c||t[46]!==n?(M=s&&!a?(0,Z.jsx)(`div`,{className:`grid gap-2`,"aria-busy":`true`,children:Array.from({length:4}).map(Ie)}):o?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-red-600 dark:text-red-400`,children:[(0,Z.jsx)(`span`,{children:n.error}),(0,Z.jsx)(p,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>void c(),children:n.retry})]}):g.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.emptyState}):(0,Z.jsx)(`div`,{className:`flex flex-col gap-2`,children:g.map(e=>(0,Z.jsx)(We,{share:e,t:n,language:r,onRevoked:()=>void c(),onExtended:()=>void c()},e.id))}),t[40]=a,t[41]=o,t[42]=g,t[43]=s,t[44]=r,t[45]=c,t[46]=n,t[47]=M):M=t[47];let N;t[48]!==b||t[49]!==c||t[50]!==d||t[51]!==n?(N=b>0&&d&&(0,Z.jsx)(Ge,{t:n,onCleaned:()=>void c()}),t[48]=b,t[49]=c,t[50]=d,t[51]=n,t[52]=N):N=t[52];let P;t[53]!==j||t[54]!==M||t[55]!==N?(P=(0,Z.jsxs)(me,{children:[j,M,N]}),t[53]=j,t[54]=M,t[55]=N,t[56]=P):P=t[56];let F;return t[57]!==P||t[58]!==S?(F=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[S,P]}),t[57]=P,t[58]=S,t[59]=F):F=t[59],F}function Ie(e,t){return(0,Z.jsx)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(V,{className:`h-4 w-2/3`}),(0,Z.jsx)(V,{className:`mt-2 h-3 w-1/2`})]}),(0,Z.jsx)(V,{className:`h-7 w-20 rounded-md`})]})},t)}function Le(e){return!e}function Re(e){return e.expired||e.revoked}function ze(e){return!e.expired&&!e.revoked}function Be(e){return!e.expired&&!e.revoked}var Ve={expanded:!0,path:``,isDirectory:!1,agentId:``,ttlMs:864e5,maxViews:null,description:``,directoryMode:`browse`,creating:!1,result:null,errorMsg:null,resultDialogOpen:!1,pickerOpen:!1};function He({t:e,onCreated:t}){let[n,r]=(0,W.useReducer)(R,Ve),{expanded:i,path:a,isDirectory:c,agentId:d,ttlMs:m,maxViews:h,description:g,directoryMode:_,creating:v,result:y,errorMsg:b,resultDialogOpen:x,pickerOpen:S}=n,ee=(0,W.useCallback)(async()=>{if(a.trim()){r({type:`patch`,patch:{creating:!0,errorMsg:null,result:null}});try{r({type:`patch`,patch:{result:(await H({path:a.trim(),ttlMs:m,maxViews:h,description:g.trim()||void 0,...d?{agentId:d}:{},...c?{kind:`directory`,directoryMode:_}:{}})).payload,resultDialogOpen:!0}}),t()}catch(e){r({type:`patch`,patch:{errorMsg:e instanceof Error?e.message:String(e)}})}finally{r({type:`patch`,patch:{creating:!1}})}}},[a,c,d,m,h,g,_,t]),C=(0,W.useCallback)(()=>{r({type:`patch`,patch:{path:``,isDirectory:!1,agentId:``,description:``,maxViews:null,ttlMs:864e5,directoryMode:`browse`,result:null,errorMsg:null}})},[]);return i?(0,Z.jsxs)(me,{children:[(0,Z.jsx)(`h2`,{className:`mb-1 text-sm font-semibold text-fg`,children:e.createTitle}),(0,Z.jsx)(`p`,{className:`mb-4 text-xs text-fg-muted`,children:e.createHint}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.pathLabel}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`div`,{className:f(`flex min-w-0 flex-1 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm`,a?`text-fg`:`text-fg-subtle`),children:a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,children:c?`📁`:`📄`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:a,children:a})]}):(0,Z.jsx)(`span`,{className:`truncate`,children:e.pathPlaceholder})}),(0,Z.jsxs)(p,{type:`button`,variant:`ghost`,onClick:()=>r({type:`patch`,patch:{pickerOpen:!0}}),children:[(0,Z.jsx)(B,{className:`size-4`}),a?e.pathBrowseChange:e.pathBrowse]})]})]}),c?(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.directoryModeLabel}),(0,Z.jsxs)(o,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:_,onChange:e=>r({type:`patch`,patch:{directoryMode:e.target.value===`zip-only`?`zip-only`:`browse`}}),children:[(0,Z.jsx)(s,{value:`browse`,children:e.directoryModeBrowse}),(0,Z.jsx)(s,{value:`zip-only`,children:e.directoryModeZipOnly})]})]}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.ttlLabel}),(0,Z.jsx)(o,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:m,onChange:e=>r({type:`patch`,patch:{ttlMs:Number(e.target.value)}}),children:je.map(t=>(0,Z.jsx)(s,{value:t.value,children:e.ttlOptions[t.key]},t.key))})]}),(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.maxViewsLabel}),(0,Z.jsxs)(o,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:h??`unlimited`,onChange:e=>r({type:`patch`,patch:{maxViews:e.target.value===`unlimited`?null:Number(e.target.value)}}),children:[(0,Z.jsx)(s,{value:`unlimited`,children:e.maxViewsUnlimited}),(0,Z.jsx)(s,{value:`1`,children:`1`}),(0,Z.jsx)(s,{value:`5`,children:`5`}),(0,Z.jsx)(s,{value:`10`,children:`10`}),(0,Z.jsx)(s,{value:`50`,children:`50`}),(0,Z.jsx)(s,{value:`100`,children:`100`})]})]})]}),(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.descriptionLabel}),(0,Z.jsx)(`input`,{type:`text`,className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:outline-none focus:ring-2 focus:ring-accent`,placeholder:e.descriptionPlaceholder,value:g,onChange:e=>r({type:`patch`,patch:{description:e.target.value}})})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,Z.jsxs)(p,{type:`button`,disabled:v||!a.trim(),onClick:()=>void ee(),children:[v?(0,Z.jsx)(l,{className:`size-4 animate-spin`}):(0,Z.jsx)(u,{className:`size-4`}),v?e.creating:e.createButton]}),(0,Z.jsx)(p,{type:`button`,variant:`ghost`,onClick:()=>{C(),r({type:`patch`,patch:{expanded:!1}})},children:e.cancel})]}),b&&(0,Z.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:b})]}),(0,Z.jsx)(I,{open:x,onOpenChange:e=>{r({type:`patch`,patch:{resultDialogOpen:e,...e?{}:{result:null}}})},result:y}),(0,Z.jsx)(Ce,{open:S,onOpenChange:e=>r({type:`patch`,patch:{pickerOpen:e}}),initialPath:a||void 0,selectKind:`any`,onConfirm:e=>r({type:`patch`,patch:{path:e.path,isDirectory:e.isDirectory,agentId:e.agentId,directoryMode:`browse`}})})]}):(0,Z.jsxs)(p,{type:`button`,onClick:()=>r({type:`patch`,patch:{expanded:!0}}),className:`self-start`,children:[(0,Z.jsx)(u,{className:`size-4`}),e.createTitle]})}var Ue={revokeOpen:!1,revoking:!1,linksOpen:!1,urlCopied:!1,copyFailed:!1,extending:!1};function We({share:e,t,language:n,onRevoked:r,onExtended:i}){let[o,s]=(0,W.useReducer)(R,Ue),{revokeOpen:u,revoking:d,linksOpen:m,urlCopied:g,copyFailed:_,extending:v}=o,y=!e.expired&&!e.revoked,b=e.revoked?t.statusRevoked:e.expired?t.statusExpired:t.statusActive,x=e.revoked?`text-red-600 dark:text-red-400`:e.expired?`text-fg-subtle`:`text-emerald-600 dark:text-emerald-400`,S=(0,W.useCallback)(async()=>{s({type:`patch`,patch:{revokeOpen:!1,revoking:!0}});try{await L(e.id),r()}catch{}finally{s({type:`patch`,patch:{revoking:!1}})}},[e.id,r]),ee=(0,W.useCallback)(async()=>{if(s({type:`patch`,patch:{linksOpen:!0,copyFailed:!1}}),!await h(e.shareUrl)){s({type:`patch`,patch:{copyFailed:!0}}),window.setTimeout(()=>s({type:`patch`,patch:{copyFailed:!1}}),2500);return}s({type:`patch`,patch:{urlCopied:!0}}),window.setTimeout(()=>s({type:`patch`,patch:{urlCopied:!1}}),2e3)},[e.shareUrl]),C=(0,W.useCallback)(async()=>{s({type:`patch`,patch:{extending:!0}});try{await M(e.id,864e5),i()}catch{}finally{s({type:`patch`,patch:{extending:!1}})}},[e.id,i]),w=`share-links-${e.id}`;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:f(`flex min-w-0 flex-1 items-start gap-3 rounded-md text-left`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),"aria-expanded":m,"aria-controls":w,onClick:()=>s({type:`patch`,patch:{linksOpen:!m}}),children:[(0,Z.jsx)(j,{className:f(`mt-0.5 size-4 shrink-0 text-fg-muted transition-transform`,m?`rotate-0`:`-rotate-90`),"aria-hidden":!0}),e.kind===`note`?(0,Z.jsx)(k,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}):(0,Z.jsx)(B,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.fileName}),(0,Z.jsx)(`span`,{className:f(`text-xs font-medium`,x),children:b})]}),(0,Z.jsx)(`p`,{className:`truncate text-xs text-fg-subtle`,children:e.kind===`note`?n===`zh`?`笔记快照 · 版本 ${e.snapshotRevision??1}`:`Note snapshot · revision ${e.snapshotRevision??1}`:e.workspaceRelativePath}),(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,Z.jsx)(`span`,{children:ke(e.fileSize)}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(P,{className:`size-3`}),e.expired?n===`zh`?`已过期`:`expired`:Ae(e.expiresAt,n)]}),(0,Z.jsxs)(`span`,{children:[t.views,`: `,e.downloadCount,e.maxViews!==null&&` ${t.viewsOf} ${e.maxViews}`]}),e.description&&(0,Z.jsx)(`span`,{className:`italic text-fg-subtle`,children:e.description})]})]})]}),(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:y&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(p,{type:`button`,variant:`ghost`,className:`px-2 py-1`,title:t.copyUrl,onClick:()=>void ee(),children:g?(0,Z.jsx)(a,{className:`size-3.5 text-emerald-500`}):(0,Z.jsx)(c,{className:`size-3.5`})}),(0,Z.jsx)(p,{type:`button`,variant:`ghost`,className:`px-2 py-1`,onClick:()=>void C(),disabled:v,title:t.extend,children:v?(0,Z.jsx)(l,{className:`size-3.5 animate-spin`}):(0,Z.jsx)(P,{className:`size-3.5`})}),(0,Z.jsx)(p,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-red-600 hover:text-red-700 dark:text-red-400`,onClick:()=>s({type:`patch`,patch:{revokeOpen:!0}}),disabled:d,children:d?(0,Z.jsx)(l,{className:`size-3.5 animate-spin`}):(0,Z.jsx)(F,{className:`size-3.5`})})]})})]}),y&&m?(0,Z.jsxs)(`div`,{id:w,className:`mt-3 bg-surface-base/45 py-3 pl-7 pr-3`,children:[(0,Z.jsx)(D,{shareUrl:e.shareUrl,lanUrl:e.lanUrl,reachability:e.reachability,compact:!0}),_?(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-red-600 dark:text-red-400`,children:t.copyFailed}):null,(0,Z.jsx)(`div`,{className:`mt-2`,children:(0,Z.jsx)(z,{reachability:e.reachability})})]}):null]}),(0,Z.jsx)(O,{open:u,title:t.revokeConfirmTitle,description:t.revokeConfirmBody,confirmLabel:t.revokeConfirmLabel,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void S(),onCancel:()=>s({type:`patch`,patch:{revokeOpen:!1}})})]})}function Ge({t:e,onCleaned:t}){let[n,r]=(0,W.useState)(!1),[i,a]=(0,W.useState)(!1),o=(0,W.useCallback)(async()=>{r(!1),a(!0);try{await N(),t()}catch{}finally{a(!1)}},[t]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Z.jsxs)(p,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>r(!0),className:`border-danger/40 px-2 py-1 text-xs text-danger hover:bg-danger/10`,children:[i?(0,Z.jsx)(l,{className:`size-3.5 animate-spin`}):(0,Z.jsx)(F,{className:`size-3.5`}),e.cleanExpired]})}),(0,Z.jsx)(O,{open:n,title:e.cleanExpiredConfirmTitle,description:e.cleanExpiredConfirmBody,confirmLabel:e.cleanExpiredConfirmLabel,cancelLabel:e.cancel,destructive:!0,onConfirm:()=>void o(),onCancel:()=>r(!1)})]})}export{Me as SharesSettingsPanel};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,r as n}from"./locale-store-CXhjfe4q.js";import{Er as r}from"./index-Bbd_dXui.js";var i=e({reloadSkills:()=>a});async function a(){let e=await t(n(`/api/skills/reload`),{method:`POST`});if(!e.ok)throw Error(await r(e))}export{i as n,a as t};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,l as a,p as o,t as s}from"./chunk-KS7C4IRE-BaASWQor.js";import{n as c,r as l}from"./popover-select-CccGri5Y.js";import{t as u}from"./circle-check-C23XjkUj.js";import{t as d}from"./ellipsis-0k4rZLoy.js";import{t as f}from"./external-link-DjqjBmc3.js";import{d as p,p as m,t as h}from"./markdown-view-DvM5PWEH.js";import{t as g}from"./x-B_N4OPjy.js";import{t as _}from"./cn-JdwAhgNB.js";import{t as v}from"./button-CSEbl4zT.js";import{l as ee,n as te}from"./locale-store-CXhjfe4q.js";import{i as y,n as ne,o as re,r as ie,s as ae,t as oe}from"./dist-BPoKqzeH.js";import{$ as b,Ai as se,B as x,Bi as S,Bn as ce,Ec as le,Fa as ue,Hi as C,Hn as de,I as fe,J as pe,Jr as me,Kr as he,L as w,Ml as T,Nl as E,P as ge,Q as D,Qr as _e,Vi as O,Vn as ve,W as ye,X as k,Xr as A,Yr as j,Zr as M,_o as N,at as P,dl as F,gc as I,lu as be,n as xe,no as Se,qr as Ce,to as we,uc as Te,ul as Ee}from"./index-Bbd_dXui.js";import{t as De}from"./date-picker-y1kWrFVU.js";import{t as Oe}from"./dependency-picker-skc62zrn.js";var L=e(t(),1),R=n();function ke(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function Ae(e,t){let n={...e.task};t.title!==void 0&&(n.title=t.title),t.priority!==void 0&&(n.priority=t.priority);for(let e of[`body`,`projectId`,`milestoneId`,`parentTaskId`,`dueAt`,`ownerId`]){let r=t[e];r!==void 0&&(r===null?delete n[e]:Object.assign(n,{[e]:r}))}return n.version+=1,n.updatedAt=Date.now(),{...e,task:n}}var z=r();function B(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已完成`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Completed`})[e]}function je(){let e=(0,R.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,z.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,z.jsx)(Se,{className:`h-32 rounded-2xl`}),(0,z.jsx)(Se,{className:`h-52 rounded-2xl`}),(0,z.jsx)(Se,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function Me(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function Ne(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var V=[`backlog`,`ready`,`active`,`review`,`closed`],Pe=[`low`,`normal`,`high`,`critical`],Fe=(0,L.memo)(function(e){let t=(0,R.c)(20),{value:n,disabled:r,canMove:i,canApprove:a,canReopen:o,language:s,label:u,onChange:d}=e,f;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==n?(f=e=>e!==n&&(e===`closed`?!a:n===`closed`?!o:!i),t[0]=a,t[1]=i,t[2]=o,t[3]=n,t[4]=f):f=t[4];let p=f,m;t[5]===u?m=t[6]:(m=(0,z.jsx)(`span`,{children:u}),t[5]=u,t[6]=m);let h;t[7]===d?h=t[8]:(h=e=>d(e.target.value),t[7]=d,t[8]=h);let g;t[9]!==s||t[10]!==p?(g=V.map(e=>(0,z.jsx)(l,{value:e,disabled:p(e),children:B(e,s)},e)),t[9]=s,t[10]=p,t[11]=g):g=t[11];let _;t[12]!==r||t[13]!==h||t[14]!==g||t[15]!==n?(_=(0,z.jsx)(c,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:h,children:g}),t[12]=r,t[13]=h,t[14]=g,t[15]=n,t[16]=_):_=t[16];let v;return t[17]!==m||t[18]!==_?(v=(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[m,_]}),t[17]=m,t[18]=_,t[19]=v):v=t[19],v}),Ie=(0,L.memo)(function(e){let t=(0,R.c)(14),{value:n,disabled:r,label:i,labels:a,onChange:o}=e,s;t[0]===i?s=t[1]:(s=(0,z.jsx)(`span`,{children:i}),t[0]=i,t[1]=s);let u;t[2]===o?u=t[3]:(u=e=>o(e.target.value),t[2]=o,t[3]=u);let d;t[4]===a?d=t[5]:(d=Pe.map(e=>(0,z.jsx)(l,{value:e,children:a[e]},e)),t[4]=a,t[5]=d);let f;t[6]!==r||t[7]!==u||t[8]!==d||t[9]!==n?(f=(0,z.jsx)(c,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:u,children:d}),t[6]=r,t[7]=u,t[8]=d,t[9]=n,t[10]=f):f=t[10];let p;return t[11]!==s||t[12]!==f?(p=(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[s,f]}),t[11]=s,t[12]=f,t[13]=p):p=t[13],p}),Le=(0,L.memo)(function(e){let t=(0,R.c)(10),{value:n,disabled:r,label:i,onChange:a}=e,o;t[0]===i?o=t[1]:(o=(0,z.jsx)(`span`,{children:i}),t[0]=i,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==a||t[5]!==n?(s=(0,z.jsx)(De,{disabled:r,value:n,onChange:a,ariaLabel:i}),t[2]=r,t[3]=i,t[4]=a,t[5]=n,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}),Re=(0,L.memo)(function(e){let t=(0,R.c)(17),{value:n,disabled:r,label:i,unassignedLabel:a,agents:o,onChange:s}=e,u;t[0]===i?u=t[1]:(u=(0,z.jsx)(`span`,{children:i}),t[0]=i,t[1]=u);let d;t[2]===s?d=t[3]:(d=e=>s(e.target.value),t[2]=s,t[3]=d);let f;t[4]===a?f=t[5]:(f=(0,z.jsx)(l,{value:``,disabled:!0,children:a}),t[4]=a,t[5]=f);let p;t[6]===o?p=t[7]:(p=o.map(tt),t[6]=o,t[7]=p);let m;t[8]!==r||t[9]!==d||t[10]!==f||t[11]!==p||t[12]!==n?(m=(0,z.jsxs)(c,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:d,children:[f,p]}),t[8]=r,t[9]=d,t[10]=f,t[11]=p,t[12]=n,t[13]=m):m=t[13];let h;return t[14]!==u||t[15]!==m?(h=(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[u,m]}),t[14]=u,t[15]=m,t[16]=h):h=t[16],h}),ze=(0,L.memo)(function(e){let t=(0,R.c)(8),{candidates:n,selected:r,disabled:i,labels:a,onChange:o}=e,s;t[0]===r?s=t[1]:(s=r.map(K),t[0]=r,t[1]=s);let c;return t[2]!==n||t[3]!==i||t[4]!==a||t[5]!==o||t[6]!==s?(c=(0,z.jsx)(Oe,{borderless:!0,candidates:n,selectedIds:s,disabled:i,onChange:o,labels:a}),t[2]=n,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c):c=t[7],c},(e,t)=>e.disabled===t.disabled&&e.labels===t.labels&&e.onChange===t.onChange&&e.candidates.length===t.candidates.length&&e.candidates.every((e,n)=>e.id===t.candidates[n]?.id&&e.title===t.candidates[n]?.title)&&e.selected.length===t.selected.length&&e.selected.every((e,n)=>e.id===t.selected[n]?.id&&e.title===t.selected[n]?.title)),Be=`xopc.taskDetail.chatPanelPercent`,Ve=42;function He(e,t){let n=Math.max(30,352/Math.max(t,1)*100),r=Math.min(60,(t-480)/Math.max(t,1)*100);return r<n?Ve:Math.min(r,Math.max(n,e))}function Ue(){try{let e=Number(window.localStorage.getItem(Be));return Number.isFinite(e)&&e>=30&&e<=60?e:Ve}catch{return Ve}}function We(e){return e.task.phase===`closed`?e.task.resolution===`done`?`completed`:`ended`:e.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`)?`needsUser`:e.operationalState===`idle`?e.task.phase===`backlog`?`captured`:e.task.phase===`ready`?`ready`:e.task.phase===`review`?`review`:`paused`:e.operationalState}function H(e){let t=(0,R.c)(9),{items:n,empty:r,verificationByCriterion:i}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,z.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let a;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>{let t=i?.get(e)??`unverified`;return(0,z.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,z.jsx)(t===`passed`?u:t===`failed`?E:T,{className:t===`passed`?`mt-1 size-4 shrink-0 text-success`:t===`failed`?`mt-1 size-4 shrink-0 text-danger`:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,z.jsx)(`span`,{children:e})]},e)},t[5]=i,t[6]=e),a=n.map(e),t[2]=n,t[3]=i,t[4]=a}else a=t[4];let o;return t[7]===a?o=t[8]:(o=(0,z.jsx)(`ul`,{className:`space-y-2`,children:a}),t[7]=a,t[8]=o),o}function Ge({taskId:e,presentation:t,backgroundPath:n,onDeleted:r}){let[i]=o(),c=a(),l=te(e=>e.language),g=ee(e=>e.token),y=(0,L.useMemo)(()=>b(l),[l]),ne=N(e=>e.setPageHeader),re=N(e=>e.clearPageHeader),ie=C(e=>e.open),ae=C(e=>e.sessionKeyOverride),oe=C(e=>e.openForSession),de=_e(e=>e.setOpen),{data:T,error:E,mutate:O,lastChange:Se,conversationLoading:De,conversationError:Oe}=ge(e),[R,B]=(0,L.useState)(null),[V,Pe]=(0,L.useState)(()=>new Set),[Ge,Ke]=(0,L.useState)([]),[U,qe]=(0,L.useState)(null),[Je,Ye]=(0,L.useState)([]),[Xe,W]=(0,L.useState)(!1),[Ze,Qe]=(0,L.useState)(``),[$e,G]=(0,L.useState)(!1),[et,tt]=(0,L.useState)(``),[K,nt]=(0,L.useState)(Ue),[rt,it]=(0,L.useState)(!1),at=(0,L.useRef)(null),ot=(0,L.useRef)(!1),st=(0,L.useRef)(!1),ct=(0,L.useRef)(``),lt=(0,L.useRef)(null),ut=(0,L.useRef)(null),dt=(0,L.useRef)(null),ft=(0,L.useRef)(T),[pt,q]=(0,L.useState)(null),[mt,ht]=(0,L.useState)(null),[gt,_t]=(0,L.useState)(!1),vt=(0,L.useMemo)(()=>({link:y.linkDependencies,linked:y.linkedDependencies,searchPlaceholder:y.dependencySearchPlaceholder,noMatches:y.noDependencyMatches,noCandidates:y.noDependencyCandidates,remove:y.removeDependency}),[y.dependencySearchPlaceholder,y.linkDependencies,y.linkedDependencies,y.noDependencyCandidates,y.noDependencyMatches,y.removeDependency]),yt=T?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,bt=(0,L.useMemo)(()=>p(i.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[i]);ft.current=T;let J=(0,L.useCallback)((e,t)=>{Pe(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,L.useEffect)(()=>{B(null),q(null),W(!1),G(!1),ht(null),_t(!1)},[e]),(0,L.useEffect)(()=>{let e=!0;return we().then(t=>{e&&Ye(t.items)}).catch(()=>void 0),()=>{e=!1}},[g]),(0,L.useEffect)(()=>{if(!Se||Se.source===`user`)return;ht(Se);let e=window.setTimeout(()=>ht(null),3500);return()=>window.clearTimeout(e)},[Se]),(0,L.useEffect)(()=>{let t=T?.task.projectId,n=T?.dependencies??[];if(!t){dt.current=null,qe(null),Ke(n);return}dt.current!==t&&(dt.current=t,qe(null));let r=!0;return ue(t).then(t=>{if(!r)return;qe(t.project.name);let i=new Map;for(let r of[...t.tasks,...n])r.id!==e&&i.set(r.id,{id:r.id,title:r.title});Ke([...i.values()])}).catch(()=>{r&&Ke(n)}),()=>{r=!1}},[yt,T?.task.projectId,e]);let Y=(0,L.useCallback)(async(t,n=`command`)=>{let r=ft.current;if(r){J(n,!0),B(null);try{await O(await w(e,t,r.task.version),{revalidate:!1})}catch{B(y.actionFailed)}finally{J(n,!1)}}},[y.actionFailed,O,J,e]),X=(0,L.useCallback)(async(t,n)=>{let r=ft.current;if(!r)return!1;n&&J(n,!0),B(null);try{return await O(k(e,t,r.task.version),{optimisticData:Ae(r,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return B(y.actionFailed),!1}finally{n&&J(n,!1)}},[y.actionFailed,O,J,e]),xt=async()=>{if(!T)return;if(ot.current){ot.current=!1;return}let e=Ze.trim(),t=lt.current;if(ke(t,T.task.version,T.task.title,e)){q(`title`);return}if(!e||e===T.task.title){Qe(T.task.title),W(!1);return}await X({title:e})&&(q(null),W(!1))},St=async()=>{if(!T)return;if(st.current){st.current=!1;return}let e=et.trim(),t=ut.current;if(ke(t,T.task.version,T.task.body??``,e)){q(`description`);return}if(et===ct.current||e===(T.task.body??``).trim()){G(!1);return}await X({body:e||null})&&(q(null),G(!1))},Ct=(0,L.useCallback)(async e=>{let t=ft.current;if(!(!t||e===t.task.phase)){if(t.task.phase===`closed`){await Y({type:`reopen`,phase:e===`closed`?`ready`:e},`phase`);return}if(e===`closed`){await Y({type:`close`,resolution:`done`},`phase`);return}await Y({type:`move`,phase:e},`phase`)}},[Y]),wt=(0,L.useCallback)(e=>{X({priority:e},`priority`)},[X]),Tt=(0,L.useCallback)(e=>{X({dueAt:Ne(e)},`dueAt`)},[X]),Et=(0,L.useCallback)(e=>{nt(e);try{window.localStorage.setItem(Be,String(e))}catch{}},[]),Dt=(0,L.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=at.current?.clientWidth??0;Et(He(e.key===`Home`?Ve:K+(e.key===`ArrowLeft`?2:-2),t))},[K,Et]),Ot=(0,L.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=at.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),it(!0);let i=K,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=He((n.right-e.clientX)/n.width*100,n.width),a===0&&(a=window.requestAnimationFrame(o))},c=()=>{a!==0&&(window.cancelAnimationFrame(a),o());try{n.releasePointerCapture(r)}catch{}it(!1),Et(i),window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c)};window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c)},[K,Et]),kt=(0,L.useCallback)(async t=>{let n=ft.current;if(n){J(`dependencies`,!0),B(null);try{await O(await D(e,t,n.task.version),{revalidate:!1})}catch{B(y.dependencyUpdateFailed)}finally{J(`dependencies`,!1)}}},[y.dependencyUpdateFailed,O,J,e]),At=(0,L.useCallback)(async t=>{let n=ft.current;if(!(!n||!t||t===n.conversation.currentExecutorAgentId)){J(`delegateAgentId`,!0),B(null);try{await O(await ye(e,t,n.task.version),{revalidate:!1})}catch{B(y.actionFailed)}finally{J(`delegateAgentId`,!1)}}},[y.actionFailed,O,J,e]),jt=(0,L.useCallback)(async()=>{J(`delete`,!0),B(null);try{await x(e),r?r():c(bt,{replace:!0})}catch(e){B(e instanceof Error?e.message:y.actionFailed)}finally{J(`delete`,!1)}},[y.actionFailed,c,r,bt,J,e]);if((0,L.useLayoutEffect)(()=>{if(t!==`modal`)return ne({startExtra:(0,z.jsx)(s,{to:bt,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":y.backToWork,children:(0,z.jsx)(be,{className:`size-4`})}),main:T?(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:U?`${U} / ${y.taskLabel}`:y.taskLabel}),(0,z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:y.detailStatuses[We(T)]})]}):null,end:null}),re},[re,y.backToWork,y.detailStatuses,y.taskLabel,T,t,U,bt,ne]),E&&!T)return(0,z.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:y.taskNotFound});if(!T)return(0,z.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,z.jsx)(je,{})});let Mt=T.waits[0],Nt=Mt?.kind===`paused`?Mt:void 0,Z=T.receipts[0],Pt=y.detailStatuses[We(T)],Ft=y.detailStatusDescriptions[We(T)],It=T.task.body?.trim()||T.task.contract?.objective.trim(),Lt=new Map(Z?.verification.checks.map(e=>[e.criterion,e.status])),Rt=T.allowedCommands.includes(`mark_ready`),zt=T.allowedCommands.includes(`start`),Bt=T.allowedCommands.includes(`add_wait`),Vt=T.task.phase===`review`&&T.allowedCommands.includes(`close`),Ht=T.allowedCommands.includes(`reopen`),Ut=T.conversation.activeSessionKey,Wt=T.conversation.currentExecutorAgentId??T.task.delegateAgentId??T.task.ownerId,Gt=Je.find(e=>e.id===Wt),Kt=!!(Ut&&ie&&ae===Ut),qt=T.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`),Jt=T.task.contract?.acceptanceCriteria??[],Yt=Jt.filter(e=>Lt.get(e)===`passed`).length,Xt=T.task.contract?.expectedOutputs??[],Zt=T.task.contract?.constraints??[],Qt=T.task.contract?.approvalRequired??[],$t=T.task.contract?.assumptions??[],en=T.task.contract?.risks??[],Q=(...e)=>!!mt?.changedFields.some(t=>e.includes(t)),tn=e=>t===`modal`&&n?ve(n,e):m(`/tasks/${e}`,bt),nn=T.allowedCommands.includes(`move`),$=V.has(`command`),rn=V.has(`delete`),an=T.runs.find(e=>[`queued`,`running`,`waiting`,`verifying`].includes(e.status)),on=an!==void 0,sn=(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[Rt?(0,z.jsxs)(v,{variant:`primary`,disabled:$,onClick:()=>void Y({type:`mark_ready`}),children:[(0,z.jsx)(Te,{className:`size-4`}),y.scheduleTask]}):null,Nt?(0,z.jsxs)(v,{variant:`primary`,disabled:$,onClick:()=>void Y({type:`resolve_wait`,waitId:Nt.id}),children:[(0,z.jsx)(Te,{className:`size-4`}),y.resumeTask]}):null,!Mt&&zt&&Wt?(0,z.jsxs)(v,{variant:`primary`,disabled:$,onClick:()=>void Y({type:`start`,executor:{kind:`agent`,agentId:Wt}}),children:[(0,z.jsx)(Te,{className:`size-4`}),y.runTask]}):null,Vt?(0,z.jsxs)(v,{variant:`primary`,disabled:$,onClick:()=>void Y({type:`close`,resolution:`done`}),children:[(0,z.jsx)(u,{className:`size-4`}),y.approveTask]}):null,Ht?(0,z.jsxs)(v,{variant:`primary`,disabled:$,onClick:()=>void Y({type:`reopen`,phase:`ready`}),children:[(0,z.jsx)(Te,{className:`size-4`}),y.reopenTask]}):null,!Mt&&Bt?(0,z.jsxs)(v,{variant:`secondary`,className:`border-0 bg-surface-hover shadow-none`,disabled:$,onClick:()=>void Y({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,z.jsx)(I,{className:`size-4`}),y.pauseTask]}):null,(0,z.jsxs)(j,{children:[(0,z.jsx)(M,{asChild:!0,children:(0,z.jsx)(v,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:$||rn,"aria-label":y.moreActions,children:(0,z.jsx)(d,{className:`size-4`,"aria-hidden":!0})})}),(0,z.jsx)(me,{children:(0,z.jsxs)(he,{align:`end`,sideOffset:6,className:`z-[100] min-w-44 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[an?(0,z.jsx)(Ce,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{J(`command`,!0),B(null),O(fe(e,an.id,an.version),{revalidate:!1}).catch(()=>B(y.actionFailed)).finally(()=>J(`command`,!1))},children:y.cancelActiveRun}):null,an?(0,z.jsx)(A,{className:`my-1 h-px bg-edge`}):null,T.task.phase===`closed`?null:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Ce,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>void Y({type:`close`,resolution:`cancelled`}),children:y.cancelTask}),(0,z.jsx)(A,{className:`my-1 h-px bg-edge`})]}),(0,z.jsx)(Ce,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{if(on){B(y.deleteActiveTaskBlocked);return}_t(!0)},children:y.deleteTask})]})})]})]});return(0,z.jsxs)(`div`,{ref:at,className:`${t===`modal`?`flex h-full min-h-0 flex-col lg:flex-row`:`flex min-h-[calc(100dvh-8rem)] flex-col overflow-hidden lg:flex-row`} ${rt?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${K}%`},children:[(0,z.jsxs)(`section`,{className:`task-detail-scroll min-w-0 flex-1 overflow-y-auto overscroll-contain p-5 sm:p-6`,children:[(0,z.jsxs)(`header`,{className:_(`px-4 pb-5`,Q(`title`)&&`task-detail-live-update`),children:[(0,z.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[U?(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,z.jsx)(F,{className:`size-3.5`,"aria-hidden":!0}),U]}):null,(0,z.jsx)(`span`,{children:`/`}),(0,z.jsx)(`span`,{children:y.taskLabel}),mt?(0,z.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:mt.source===`agent`?l===`zh`?`Agent 刚刚更新`:`Updated by Agent`:l===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),Xe?(0,z.jsx)(`input`,{autoFocus:!0,"data-task-inline-editor":!0,value:Ze,onChange:e=>Qe(e.target.value),onBlur:()=>void xt(),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),ot.current=!0,Qe(T.task.title),W(!1),queueMicrotask(()=>{ot.current=!1}))},className:`mt-3 w-full max-w-3xl rounded-lg bg-surface-hover px-3 py-2 text-2xl font-semibold leading-8 text-fg outline-none ring-2 ring-accent/30 focus:ring-accent/60`}):(0,z.jsx)(`button`,{type:`button`,className:`mt-3 block max-w-3xl rounded-lg text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{lt.current={value:T.task.title,version:T.task.version},q(null),Qe(T.task.title),W(!0)},children:(0,z.jsx)(`h1`,{className:`text-2xl font-semibold leading-8 text-fg`,children:T.task.title})}),pt===`title`?(0,z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,z.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,z.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{Qe(T.task.title),q(null),W(!1)},children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,z.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void X({title:Ze.trim()}).then(e=>{e&&(q(null),W(!1))}),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]})}),R?(0,z.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:R}):null]}),(0,z.jsxs)(`div`,{className:`mt-5 flex flex-col gap-5`,children:[(0,z.jsxs)(`main`,{className:`order-2 min-w-0 space-y-5`,children:[(0,z.jsxs)(`section`,{className:_(`rounded-xl bg-surface-panel p-4`,Q(`body`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:y.taskDescription}),$e?(0,z.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:et,onChange:e=>tt(e.target.value),onBlur:()=>void St(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),st.current=!0,tt(T.task.body??T.task.contract?.objective??``),G(!1),queueMicrotask(()=>{st.current=!1}))},className:`mt-3 w-full resize-y rounded-lg bg-surface-hover px-3 py-2 text-sm leading-6 text-fg outline-none ring-2 ring-accent/20 focus:ring-accent/50`}):(0,z.jsx)(`button`,{type:`button`,className:`-mx-1 mt-2 block w-[calc(100%+0.5rem)] rounded-lg px-1 py-1 text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{let e=T.task.body??T.task.contract?.objective??``;ct.current=e,ut.current={value:T.task.body??``,version:T.task.version},q(null),tt(e),G(!0)},children:(0,z.jsx)(`span`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:It&&It!==T.task.title?It:y.noTaskDescription})}),pt===`description`?(0,z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,z.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,z.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{tt(T.task.body??``),q(null),G(!1)},children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,z.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void X({body:et.trim()||null}).then(e=>{e&&(q(null),G(!1))}),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),T.attention.length>0?(0,z.jsxs)(`section`,{className:_(`rounded-xl bg-warning/10 p-4`,Q(`attention`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h3`,{className:`font-medium text-fg`,children:qt?y.needsAttention:y.waitingStatus}),(0,z.jsx)(`ul`,{className:`mt-3 space-y-2 text-sm text-fg-muted`,children:T.attention.map((e,t)=>(0,z.jsx)(`li`,{children:e.summary},`${e.kind}-${t}`))})]}):null,(0,z.jsxs)(`section`,{className:_(`rounded-xl bg-surface-panel p-4`,Q(`contract`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:y.taskDefinition}),(0,z.jsxs)(`div`,{className:`mt-5`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:y.successDefinition}),Jt.length>0?(0,z.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:y.criteriaProgress.replace(`{{verified}}`,String(Yt)).replace(`{{total}}`,String(Jt.length))}):null]}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:Jt,empty:y.noDefinition,verificationByCriterion:Lt})})]}),Xt.length>0?(0,z.jsxs)(`div`,{className:`mt-5 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:y.expectedOutputs}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:Xt,empty:y.noDefinition})})]}):null,Zt.length>0?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:y.constraints}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:Zt,empty:y.noDefinition})})]}):null,Qt.length>0?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:y.approvalRequired}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:Qt,empty:y.noDefinition})})]}):null,$t.length>0?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:y.contextAssumptions}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:$t,empty:y.noDefinition})})]}):null,en.length>0?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:y.contextRisks}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:en,empty:y.noDefinition})})]}):null]}),Z?(0,z.jsxs)(`section`,{className:_(`rounded-xl bg-surface-panel p-4`,Q(`runs`,`receipts`)&&`task-detail-live-update`),children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:y.latestResult}),(0,z.jsx)(h,{content:Z.summary,compact:!0,className:`mt-2 text-sm leading-6 text-fg`})]}),(0,z.jsxs)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs text-fg-muted`,children:[y.receiptStatuses[Z.status],` · `,y.verificationStatuses[Z.verification.status]]})]}),Z.remainingWork.length>0?(0,z.jsxs)(`div`,{className:`mt-4`,children:[(0,z.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:y.remainingWork}),(0,z.jsx)(`div`,{className:`mt-2`,children:(0,z.jsx)(H,{items:Z.remainingWork,empty:y.noRemainingWork})})]}):null,Z.nextAction?(0,z.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3`,children:[(0,z.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:y.nextAction}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:Z.nextAction})]}):null,(0,z.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(v,{className:`border-0 bg-surface-hover px-2 py-1 text-xs shadow-none`,variant:`secondary`,onClick:()=>void pe(Z.runId,`helpful`),children:y.doneWell}),(0,z.jsx)(v,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void pe(Z.runId,`not_helpful`),children:y.needsFix}),Z.evidence.filter(e=>e.uri).map(e=>(0,z.jsxs)(`a`,{className:`ml-auto inline-flex items-center gap-1 text-xs text-accent hover:underline`,href:e.uri,children:[(0,z.jsx)(f,{className:`size-3`}),e.title]},`${e.title}-${e.uri}`))]}),T.receipts.length>1?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:y.executionHistory.replace(`{{count}}`,String(T.receipts.length-1))}),(0,z.jsx)(`div`,{className:`mt-3 space-y-3`,children:T.receipts.slice(1).map(e=>(0,z.jsx)(`article`,{className:`rounded-lg bg-surface-active p-3`,children:(0,z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,z.jsx)(`p`,{className:`text-sm text-fg`,children:e.summary}),(0,z.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:y.receiptStatuses[e.status]})]})},e.runId))})]}):null]}):null,T.context.length>0?(0,z.jsxs)(`section`,{className:_(`rounded-xl bg-surface-panel p-4`,Q(`context`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:y.contextUsed}),(0,z.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:T.context.map(e=>(0,z.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,z.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[y.contextRoleLabels[e.role],` · `,y.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,z.jsx)(`a`,{className:`mt-1 block break-all text-sm text-accent hover:underline`,href:e.targetId,target:`_blank`,rel:`noreferrer`,children:e.title??e.targetId}):(0,z.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,z.jsxs)(`aside`,{className:`order-1 min-w-0 space-y-4`,children:[(0,z.jsxs)(`section`,{className:_(`rounded-xl bg-surface-subtle p-4`,Q(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:y.taskProperties}),(0,z.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,z.jsx)(Fe,{value:T.task.phase,disabled:V.has(`phase`),canMove:nn,canApprove:Vt,canReopen:Ht,language:l,label:y.taskPhase,onChange:Ct}),(0,z.jsx)(Ie,{value:T.task.priority,disabled:V.has(`priority`),label:y.priority,labels:y.priorityLabels,onChange:wt}),(0,z.jsx)(Le,{value:Me(T.task.dueAt),disabled:V.has(`dueAt`),label:y.dueDate,onChange:Tt}),(0,z.jsx)(Re,{value:T.conversation.currentExecutorAgentId??``,disabled:V.has(`delegateAgentId`),label:y.executorLabel,unassignedLabel:y.unassigned,agents:Je,onChange:At}),U?(0,z.jsxs)(`div`,{className:`grid gap-1 text-xs text-fg-muted`,children:[(0,z.jsx)(`span`,{children:y.projectLabel}),(0,z.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-lg bg-surface-hover px-3 py-2 text-sm text-fg`,children:[(0,z.jsx)(F,{className:`size-3.5`}),U]})]}):null]}),(0,z.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3 text-xs leading-5 text-fg-subtle`,children:[(0,z.jsx)(`p`,{children:Pt}),(0,z.jsx)(`p`,{children:Ft}),(0,z.jsx)(`p`,{className:`mt-2`,children:y.updatedAt.replace(`{{date}}`,se(T.task.updatedAt,l))})]})]}),(0,z.jsxs)(`section`,{className:_(`rounded-xl bg-surface-panel p-4`,Q(`dependencies`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:y.taskRelations}),(0,z.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:y.dependencies}),(0,z.jsx)(ze,{candidates:Ge,selected:T.dependencies,disabled:V.has(`dependencies`),labels:vt,onChange:kt})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:y.dependents}),T.dependents.length>0?(0,z.jsx)(`div`,{className:`space-y-1.5`,children:T.dependents.map(e=>(0,z.jsx)(s,{to:tn(e.id),className:`block rounded-lg bg-surface-hover p-2.5 text-sm text-accent hover:underline`,children:e.title},e.id))}):(0,z.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:y.noDependents})]})]})]})]})]})]}),(0,z.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":l===`zh`?`调整任务信息和 Agent 对话的宽度`:`Resize task details and Agent chat`,"aria-valuemin":30,"aria-valuemax":60,"aria-valuenow":Math.round(K),tabIndex:0,onPointerDown:Ot,onKeyDown:Dt,onDoubleClick:()=>Et(Ve),className:`group hidden w-2 shrink-0 cursor-col-resize touch-none items-stretch justify-center bg-surface-panel outline-none transition-colors hover:bg-surface-hover focus-visible:bg-surface-hover lg:flex ${rt?`bg-surface-hover`:``}`,children:(0,z.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70 transition-colors group-hover:bg-accent group-focus-visible:bg-accent`})}),(0,z.jsxs)(`aside`,{className:`flex min-h-[34rem] min-w-0 flex-col bg-surface-panel lg:min-h-0 lg:w-[var(--task-chat-panel-width)] lg:shrink-0`,children:[(0,z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 bg-surface-subtle px-4 py-3.5`,children:[(0,z.jsx)(`div`,{className:`min-w-0`,children:(0,z.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[Wt?(0,z.jsx)(P,{agentId:Wt,avatar:Gt?.avatar,size:28,className:`shrink-0`}):null,(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:l===`zh`?`Agent 执行与对话`:`Agent execution and chat`}),(0,z.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:[Gt?.name??Wt??y.unassigned,` · `,Pt]})]})]})}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[sn,Ut&&t!==`modal`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(v,{type:`button`,variant:`ghost`,className:_(`h-8 shrink-0 px-2 text-xs`,Kt&&`bg-surface-hover text-fg`),"aria-label":l===`zh`?`项目文件`:`Project files`,"aria-pressed":Kt,onClick:()=>{de(Ut,!1),oe(Ut)},children:[(0,z.jsx)(Ee,{className:`size-3.5`,"aria-hidden":!0}),l===`zh`?`文件`:`Files`]}),(0,z.jsx)(v,{asChild:!0,variant:`ghost`,className:`h-8 shrink-0 px-2 text-xs`,children:(0,z.jsxs)(s,{to:ce(e),children:[(0,z.jsx)(f,{className:`size-3.5`}),l===`zh`?`全屏`:`Full screen`]})})]}):null]})]}),Ut?(0,z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,z.jsx)(xe,{embedded:!0,sessionKey:Ut,taskId:e})}):De?(0,z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,z.jsxs)(`div`,{className:`max-w-xs`,children:[(0,z.jsx)(le,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,z.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):Oe?(0,z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,z.jsxs)(`div`,{className:`max-w-xs`,children:[(0,z.jsx)(le,{className:`mx-auto size-8 text-danger`}),(0,z.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,z.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:Oe instanceof Error?Oe.message:String(Oe)})]})}):(0,z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,z.jsxs)(`div`,{className:`max-w-xs`,children:[(0,z.jsx)(le,{className:`mx-auto size-8 text-fg-subtle`}),(0,z.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,z.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:l===`zh`?`安排或开始任务后,Agent 的执行过程和持续对话会显示在这里。`:`Schedule or start the task to see the agent run and continue the conversation here.`})]})})]}),(0,z.jsx)(S,{open:gt,title:y.deleteTaskTitle,description:y.deleteTaskDescription.replace(`{{title}}`,T.task.title),confirmLabel:y.confirmDeleteTask,cancelLabel:y.keepTask,destructive:!0,onConfirm:()=>{_t(!1),jt()},onCancel:()=>_t(!1)})]})}function Ke(){let e=(0,R.c)(2),{taskId:t}=i(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,z.jsx)(Ge,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function U(e){let t=(0,R.c)(58),{taskId:n,backgroundPath:r,onClose:i}=e,a=te(et),{data:o}=ge(n),c=o?.conversation.activeSessionKey??null,l=C(G),u=C($e),d=C(Qe),p=C(Ze),m=_e(W),h=O(Xe),v=O(Ye),ee=l?u:0,b;t[0]!==i||t[1]!==v?(b=e=>{e||(v(null),i())},t[0]=i,t[1]=v,t[2]=b):b=t[2];let se=a===`zh`?`关闭任务详情`:`Close task details`,x;t[3]!==i||t[4]!==v?(x=()=>{v(null),i()},t[3]=i,t[4]=v,t[5]=x):x=t[5];let S;t[6]!==se||t[7]!==x?(S=(0,z.jsx)(`button`,{type:`button`,tabIndex:-1,"data-task-modal-backdrop":!0,className:`fixed inset-0 z-[80] bg-black/45 backdrop-blur-[1px]`,"aria-label":se,onClick:x}),t[6]=se,t[7]=x,t[8]=S):S=t[8];let le=l?`true`:`false`,ue=`${ee/2}px`,fe=`${ee}px`,pe;t[9]!==ue||t[10]!==fe?(pe={"--task-detail-workspace-offset":ue,"--task-detail-workspace-width":fe},t[9]=ue,t[10]=fe,t[11]=pe):pe=t[11];let me=pe,he=a===`zh`?`任务详情`:`Task details`,w;t[12]===he?w=t[13]:(w=(0,z.jsx)(ae,{className:`font-medium text-fg`,children:he}),t[12]=he,t[13]=w);let T=a===`zh`?`查看并操作任务详情`:`View and manage task details`,E;t[14]===T?E=t[15]:(E=(0,z.jsx)(y,{className:`sr-only`,children:T}),t[14]=T,t[15]=E);let D;t[16]!==c||t[17]!==a||t[18]!==p||t[19]!==m||t[20]!==n||t[21]!==l||t[22]!==d?(D=c?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{type:`button`,className:_(`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,l&&d===c&&`bg-surface-hover text-fg`),"aria-label":a===`zh`?`项目文件`:`Project files`,title:a===`zh`?`项目文件`:`Project files`,"aria-pressed":l&&d===c,onClick:()=>{m(c,!1),p(c)},children:(0,z.jsx)(Ee,{className:`size-4`,"aria-hidden":!0})}),(0,z.jsx)(s,{to:ce(n),className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":a===`zh`?`全屏打开对话`:`Open chat full screen`,title:a===`zh`?`全屏打开对话`:`Open chat full screen`,children:(0,z.jsx)(f,{className:`size-4`,"aria-hidden":!0})})]}):null,t[16]=c,t[17]=a,t[18]=p,t[19]=m,t[20]=n,t[21]=l,t[22]=d,t[23]=D):D=t[23];let ve=a===`zh`?`关闭任务详情`:`Close task details`,ye;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,z.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t[24]=ye):ye=t[24];let k;t[25]===ve?k=t[26]:(k=(0,z.jsx)(ne,{className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":ve,children:ye}),t[25]=ve,t[26]=k);let A;t[27]!==D||t[28]!==k?(A=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[D,k]}),t[27]=D,t[28]=k,t[29]=A):A=t[29];let j;t[30]!==w||t[31]!==E||t[32]!==A?(j=(0,z.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 bg-surface-panel px-5 py-3.5`,children:[w,E,A]}),t[30]=w,t[31]=E,t[32]=A,t[33]=j):j=t[33];let M;t[34]!==i||t[35]!==v?(M=()=>{v(null),i()},t[34]=i,t[35]=v,t[36]=M):M=t[36];let N;t[37]!==r||t[38]!==M||t[39]!==n?(N=(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,z.jsx)(Ge,{taskId:n,presentation:`modal`,backgroundPath:r,onDeleted:M})}),t[37]=r,t[38]=M,t[39]=n,t[40]=N):N=t[40];let P;t[41]!==j||t[42]!==N||t[43]!==le||t[44]!==me?(P=(0,z.jsxs)(ie,{className:`task-detail-modal-content fixed top-1/2 z-[90] flex h-[min(54rem,calc(100dvh-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl bg-surface-base shadow-float focus:outline-none`,"data-workspace-panel-open":le,style:me,onEscapeKeyDown:Je,onInteractOutside:qe,children:[j,N]}),t[41]=j,t[42]=N,t[43]=le,t[44]=me,t[45]=P):P=t[45];let F;t[46]!==h||t[47]!==l||t[48]!==u||t[49]!==d?(F=h?(0,z.jsx)(`div`,{className:`fixed inset-y-0 left-0 z-[100] flex min-h-0 min-w-0 overflow-hidden bg-surface-panel transition-[right] duration-200 ease-out motion-reduce:transition-none`,style:{right:l?u:0},children:(0,z.jsx)(de,{allowOutsideChat:!0,sessionKey:d??void 0})}):null,t[46]=h,t[47]=l,t[48]=u,t[49]=d,t[50]=F):F=t[50];let I;t[51]!==P||t[52]!==F||t[53]!==S?(I=(0,z.jsxs)(re,{children:[S,P,F]}),t[51]=P,t[52]=F,t[53]=S,t[54]=I):I=t[54];let be;return t[55]!==b||t[56]!==I?(be=(0,z.jsx)(oe,{modal:!1,open:!0,onOpenChange:b,children:I}),t[55]=b,t[56]=I,t[57]=be):be=t[57],be}function qe(e){let t=e.detail.originalEvent.target;t instanceof Element&&t.closest(`#app-workspace-panel, [data-task-modal-backdrop]`)&&e.preventDefault()}function Je(e){let t=e.target;t instanceof HTMLElement&&t.closest(`[data-task-inline-editor]`)&&e.preventDefault()}function Ye(e){return e.setPath}function Xe(e){return e.path}function W(e){return e.setOpen}function Ze(e){return e.openForSession}function Qe(e){return e.sessionKeyOverride}function $e(e){return e.widthPx}function G(e){return e.open}function et(e){return e.language}function tt(e){return(0,z.jsx)(l,{value:e.id,children:e.name||e.id},e.id)}function K(e){return e.id}export{U as TaskDetailModal,Ke as TaskDetailPage};
@@ -1 +0,0 @@
1
- import{p as e}from"./locale-store-CXhjfe4q.js";import{t}from"./middleware-Pd0e8Igk.js";var n=`default`,r={light:{default:`#ffffff`,emerald:`#f0fdf4`,mono:`#ffffff`,clay:`#fffaf0`},dark:{default:`#0a0a0a`,emerald:`#000000`,mono:`#101010`,clay:`#0a1a1a`}};function i(e,t){let n=document.head;if(!n)return;let i=n.querySelector(`meta[name="theme-color"][data-xopc-theme-color="true"]`);i||(i=document.createElement(`meta`),i.setAttribute(`name`,`theme-color`),i.setAttribute(`data-xopc-theme-color`,`true`),n.appendChild(i)),i.setAttribute(`content`,r[e][t])}function a(){return globalThis.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}function o(e){return e===`system`?a()?`dark`:`light`:e}function s(){return globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1}function c(e){return e===`cal`?`mono`:e==="default"||e===`emerald`||e===`mono`||e===`clay`?e:n}function l(e,t,n){let r=document.documentElement,a=()=>{r.classList.toggle(`dark`,e===`dark`),r.dataset.theme=e,r.dataset.colorScheme=t,i(e,t)},o=document;n&&!s()&&typeof o.startViewTransition==`function`?o.startViewTransition(a):a()}function u(){try{let e=localStorage.getItem(`xopc-web-theme`),t=`system`,r=n;if(e){let n=JSON.parse(e);n.state?.preference&&(t=n.state.preference),n.state&&`colorScheme`in n.state&&(r=c(n.state.colorScheme))}l(o(t),r,!1)}catch{l(o(`system`),`default`,!1)}}var d=e(t((e,t)=>({preference:`system`,colorScheme:n,resolved:o(`system`),setPreference:n=>{let r=o(n),{resolved:i,colorScheme:a}=t();l(r,a,r!==i),e({preference:n,resolved:r})},setColorScheme:n=>{let{resolved:r}=t();l(r,n,!0),e({colorScheme:n})}}),{name:`xopc-web-theme`,merge:(e,t)=>{let n=e??{};return{...t,...n,colorScheme:c(n.colorScheme)}}}));function f(){let{preference:e,colorScheme:t}=d.getState(),n=o(e);l(n,t,!1),d.setState({resolved:n})}function p(){let e=globalThis.matchMedia?.(`(prefers-color-scheme: dark)`);if(!e)return()=>{};let t=()=>{let{preference:e,colorScheme:t}=d.getState();if(e!==`system`)return;let n=o(`system`),r=d.getState().resolved;l(n,t,n!==r),d.setState({resolved:n})};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}export{d as i,p as n,f as r,u as t};