@codexhost/cli-linux-arm64 0.18.0-beta.3 → 0.18.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +102 -57
- package/app/console-web.js +168 -123
- package/app/desktop-controller.mjs +292 -117
- package/app/host-runtime.mjs +5875 -3270
- package/app/plugins/antigravity/plugin.mjs +796 -307
- package/app/plugins/claude-code/plugin.mjs +214 -103
- package/app/plugins/codebuddy/plugin.mjs +108 -63
- package/app/plugins/codex-usage/plugin.mjs +94 -49
- package/app/plugins/copilot/plugin.mjs +99 -54
- package/app/plugins/cursor-cli/plugin.mjs +122 -77
- package/app/plugins/deepseek-harness/plugin.mjs +125 -80
- package/app/plugins/devin/plugin.mjs +99 -54
- package/app/plugins/grok/plugin.mjs +105 -60
- package/app/plugins/hermes/plugin.mjs +86 -41
- package/app/plugins/kimi-code/plugin.mjs +103 -58
- package/app/plugins/kiro-cli/plugin.mjs +99 -54
- package/app/plugins/omp/plugin.mjs +90 -45
- package/app/plugins/opencode/plugin.mjs +87 -42
- package/app/plugins/pi/plugin.mjs +103 -58
- package/app/plugins/qoder/plugin.mjs +115 -70
- package/app/plugins/qoder-cn/plugin.mjs +115 -70
- package/app/plugins/qwen-code/plugin.mjs +110 -65
- package/app/plugins/workbuddy/plugin.mjs +108 -63
- package/app/plugins/zcode/plugin.mjs +91 -46
- package/app/renderer-extension.js +362 -299
- package/app/web/assets/index-C0aXz2jD.js +199 -0
- package/app/web/codex-agent.png +0 -0
- package/app/web/codexhost-settings.js +163 -118
- package/app/web/index.html +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-gateway/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +61 -61
- package/app/web/plugins/deepseek-ai__dsh-client-connection/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +8 -8
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +63 -63
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +12 -12
- package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-permission-presets/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-settings/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +9 -13
- package/app/web/plugins.json +4 -0
- package/app/web/sw.js +1 -6
- package/app/web-modules/server.mjs +2443 -1345
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
- package/app/web/assets/index-aKvkfNJN.js +0 -199
|
@@ -4,24 +4,20 @@ window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-client-ui-workspace`,factory:
|
|
|
4
4
|
/* v8 ignore next 2 -- scan() stops stepping once the view is invalid. */
|
|
5
5
|
case`invalid`:return;
|
|
6
6
|
/* v8 ignore next 2 -- Every scanner mode has a handler above. */
|
|
7
|
-
default:h(this.#r)}}fail(){this.#d=this.#n,this.#r=`invalid`,this.#c=null}beginKey(e){this.#r=`key`,this.#a=e+1,this.#o=!1,this.#i=!1}stepKey(e,t){if(e<` `){this.fail();return}if(this.#i){this.#i=!1;return}if(e===`\\`){this.#i=!0,this.#o=!0;return}if(e!==`"`)return;let n=this.slice(this.#a,t);if(this.#o)try{this.#s=JSON.parse(`"${n}"`)}catch{this.fail();return}else this.#s=n;this.#r=`colon`}open(e){this.#p.has(this.#s)||this.#m.push(this.#s),this.#p.set(this.#s,e),this.#c=e}beginValue(e,t){p(e)||(e===`"`?(this.open({kind:`string`,start:t+1,end:-1,needsDecoding:!1,invalidAt:void 0,length:void 0,text:void 0,prefixes:void 0}),this.#i=!1,this.#r=`string`):e===`}`||e===`,`||e===`:`||e===`]`?this.fail():(this.open({kind:`value`,start:t,end:-1,parsed:void 0,invalid:!1}),e===`{`||e===`[`?(this.#r=`nested`,this.#l=[e===`{`?`}`:`]`],this.#u=!1,this.#i=!1):this.#r=`scalar`))}stepScalar(e,t){(e===`,`||e===`}`||p(e))&&(this.closeValue(t),this.#r=e===`,`?`key-only`:e===`}`?`closed`:`comma-or-end`)}stepNested(e,t){if(this.#u)this.#u=!1;else if(e===`"`)this.#u=!0;else if(e===`{`||e===`[`)this.#l.push(e===`{`?`}`:`]`);else if(e===`}`||e===`]`){if(this.#l.pop()!==e){this.fail();return}this.#l.length===0&&(this.closeValue(t+1),this.#r=`comma-or-end`)}}closeValue(e){let t=this.#c;t.end=e,this.#c=null}});function h(e,t){let n=JSON.stringify(e)??String(e);throw Error(`unreachable variant${t?` in ${t}`:``}: ${n}`)}function g(e){return/^[A-Za-z]:[/\\]/.test(e)||e.startsWith(`\\\\`)}function _(e,t){if(t===void 0||t===``||g(e)||g(t))return e;let n=t.replace(/\/+$/,``);return n===``||n===`/`?e:e.replace(/\/+$/,``)===n?`~`:e.startsWith(`${n}/`)?`~${e.slice(n.length)}`:e}function v(e){let t=e.replace(/[/\\]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return t.slice(n+1)}function y(e){if(!
|
|
7
|
+
default:h(this.#r)}}fail(){this.#d=this.#n,this.#r=`invalid`,this.#c=null}beginKey(e){this.#r=`key`,this.#a=e+1,this.#o=!1,this.#i=!1}stepKey(e,t){if(e<` `){this.fail();return}if(this.#i){this.#i=!1;return}if(e===`\\`){this.#i=!0,this.#o=!0;return}if(e!==`"`)return;let n=this.slice(this.#a,t);if(this.#o)try{this.#s=JSON.parse(`"${n}"`)}catch{this.fail();return}else this.#s=n;this.#r=`colon`}open(e){this.#p.has(this.#s)||this.#m.push(this.#s),this.#p.set(this.#s,e),this.#c=e}beginValue(e,t){p(e)||(e===`"`?(this.open({kind:`string`,start:t+1,end:-1,needsDecoding:!1,invalidAt:void 0,length:void 0,text:void 0,prefixes:void 0}),this.#i=!1,this.#r=`string`):e===`}`||e===`,`||e===`:`||e===`]`?this.fail():(this.open({kind:`value`,start:t,end:-1,parsed:void 0,invalid:!1}),e===`{`||e===`[`?(this.#r=`nested`,this.#l=[e===`{`?`}`:`]`],this.#u=!1,this.#i=!1):this.#r=`scalar`))}stepScalar(e,t){(e===`,`||e===`}`||p(e))&&(this.closeValue(t),this.#r=e===`,`?`key-only`:e===`}`?`closed`:`comma-or-end`)}stepNested(e,t){if(this.#u)this.#u=!1;else if(e===`"`)this.#u=!0;else if(e===`{`||e===`[`)this.#l.push(e===`{`?`}`:`]`);else if(e===`}`||e===`]`){if(this.#l.pop()!==e){this.fail();return}this.#l.length===0&&(this.closeValue(t+1),this.#r=`comma-or-end`)}}closeValue(e){let t=this.#c;t.end=e,this.#c=null}});function h(e,t){let n=JSON.stringify(e)??String(e);throw Error(`unreachable variant${t?` in ${t}`:``}: ${n}`)}function g(e){return/^[A-Za-z]:[/\\]/.test(e)||e.startsWith(`\\\\`)}function _(e,t){if(t===void 0||t===``||g(e)||g(t))return e;let n=t.replace(/\/+$/,``);return n===``||n===`/`?e:e.replace(/\/+$/,``)===n?`~`:e.startsWith(`${n}/`)?`~${e.slice(n.length)}`:e}function v(e){let t=e.replace(/[/\\]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return t.slice(n+1)}function y(e){let t=e.projectionValues?.threadReference;if(!e.blank&&t?.hostId&&(t.hostId===`local`||/^remote-(?:ssh(?:-|:)|control:)/u.test(t.hostId)&&t.threadId))return{threadId:t.threadId??e.id,hostId:t.hostId,title:e.title?.replace(/[\s\u0000-\u001f\u007f]+/gu,` `).trim()||e.id.slice(0,8)}}function b(e){return`thread://${encodeURIComponent(e.threadId).replace(/[!'()*]/gu,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}?hostId=${encodeURIComponent(e.hostId)}`}function x(e){let t=`[@${e.title.replace(/[\\`*{}[\]()#+.!_<>|~-]/gu,e=>`\\${e}`)}](${b(e)})`;return{source:`codexhost-thread`,ref:t,label:e.title,appearance:`session`,clipboardText:t}}function S(e,t){return e.find(e=>e.sessionIds.includes(t))?.workspaceId??``}function C(e){return Object.values(e.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id}function w(e){if(e===void 0||e===``)return``;let t=v(e);return t===``?e:t}function T(e,t){return e.flatMap(e=>{let n=t[e];return n===void 0?[]:[{id:e,rank:n.updatedAt}]}).sort((e,t)=>e.rank===t.rank?e.id<t.id?-1:1:t.rank-e.rank).map(e=>e.id)}function E(e,t,n,r){let i=new Map(e.map(e=>[e,e])),a=/* @__PURE__ */ new Set,o=[];for(let e of t??[]){let t=i.get(e);t===void 0||a.has(e)||(o.push(t),a.add(e))}let s=new Set(r?.archivedSessionIds),c=[];for(let e of r?.pinnedSessionIds??[]){let t=i.get(e);t===void 0||a.has(t)||s.has(t)||n[t]===void 0||(c.push(t),a.add(t))}let l=[],u=[];for(let e of T([...i.values()].filter(e=>!a.has(e)),n))s.has(e)?u.push(e):l.push(e);let d=[...c,...o,...l,...u],f=new Set(l),p=e=>{if(!f.delete(e))return;let t=n[e]?.parentId;t!==void 0&&t!==e&&d.includes(t)&&(p(t),d.splice(d.indexOf(e),1),d.splice(d.indexOf(t),0,e))};for(let e of[...l].reverse())p(e);return d}function D(e,t){return t===void 0?[...e]:[t,...e.filter(e=>e!==t)]}function O(e,t,n){if(e.origin===`subagent`||e.blank)return!1;switch(n){case`default`:return!t.has(e.id);case`show`:return!0;case`only`:return t.has(e.id);
|
|
8
8
|
/* v8 ignore next 2 -- closed-union backstop; only reached if the filter is forged */
|
|
9
|
-
default:return h(n)}}function k(e,t,n){let r=[],i=[];for(let a of e)!n.has(a.id)&&t.has(a.id)?r.push(a):i.push(a);return[...r,...i]}function A(e){return e.blank?``:e.title?.trim()??``}function j(e,t,n,r,i,a){return{key:e,workspaceId:t,cwd:n,createdAt:r,label:i,sessions:[...a]}}function ee(e,t,n,r){let i=[];for(let a of t){let t=[];for(let i of a.sessionIds){let a=e.byId[i];a!==void 0&&O(a,n,r)&&t.push(a)}(r!==`only`||t.length!==0)&&i.push(j(a.workspaceId,a.workspaceId,a.path,Date.parse(a.createdAt),a.title,t))}let a=T(e.ids,e.byId).map(t=>e.byId[t]).filter(e=>e!==void 0&&O(e,n,r));return a.length>0&&i.push(j(``,void 0,void 0,void 0,``,a)),i}function M(e){switch(e){case`approval`:case`plan-review`:case`question`:return e;default:return}}function N(e,t,n){return e.projectionsBySession[t]?.values.subagentCatalog?.reduce((t,r)=>t+ +((n.get(r.id)?.running??e.byId[r.id]?.running)===!0),0)??0}function P(e,t,n,r,i){let a=n.get(e.id),o=M(a?.pendingInteraction?.kind);return{id:e.id,reference:y(e),title:A(e),blank:e.blank,running:a?.running??e.running,runningSubagentCount:N(t,e.id,n),completed:a?.completionUnread===!0,pinned:!i.has(e.id)&&r.has(e.id),archived:i.has(e.id),updatedAt:e.updatedAt,...o===void 0?{}:{pendingInteraction:o}}}function te(e,t,n,r,i){let a=new Set(n.archivedSessionIds),o=new Set(n.pinnedSessionIds),s=new Set(i.expandedGroups),c=C(e),l=[];for(let u of ee(e,t,a,n.archivedFilter)){let t=s.has(u.key),n=i.excludePinned?u.sessions.filter(e=>!o.has(e.id)||a.has(e.id)):u.sessions;l.push({key:u.key,workspaceId:u.workspaceId,cwd:u.cwd,createdAt:u.createdAt,label:u.label,sessionCount:n.length,expanded:t,containsCurrent:u.sessions.some(e=>e.id===c),sessions:t?k(n,o,a).map(t=>P(t,e,r,o,a)):[]})}return l}function ne(e,t=[]){return[...re(e,[],`show`),...t.filter(t=>e.byId[t]===void 0)]}function re(e,t,n){let r=new Set(t);return e.ids.filter(t=>{let i=e.byId[t];return i!==void 0&&O(i,r,n)})}function ie(e,t,n,r){let i=new Set(n.archivedSessionIds),a=new Set(n.pinnedSessionIds);return k(t.flatMap(t=>{let r=e.byId[t];return r!==void 0&&O(r,i,n.archivedFilter)?[r]:[]}),a,i).map(t=>P(t,e,r,a,i))}function F(e,t,n,r,i,a,o,s){let c=n.trim().toLowerCase();if(c===``)return{items:[],hasMore:!1};let l=new Set(r),u=/* @__PURE__ */ new Map;for(let e of t)for(let t of e.sessionIds)u.has(t)||u.set(t,e.title);let d=e=>u.get(e.id)??w(e.cwd),f=/* @__PURE__ */ new Map;for(let e of o.items)f.has(e.sessionId)||f.set(e.sessionId,e);let p=[];for(let t of e.ids){let n=e.byId[t];n!==void 0&&!n.blank&&O(n,l,i)&&(A(n).toLowerCase().includes(c)||d(n).toLowerCase().includes(c))&&p.push(n)}let m=new Map(p.map(e=>[e.id,e])),h=T(p.map(e=>e.id),e.byId).map(e=>m.get(e)),g=[],_=/* @__PURE__ */ new Set,v=e=>{_.has(e.id)||(_.add(e.id),g.push(e))};for(let e of h)v(e);for(let t of o.items){let n=e.byId[t.sessionId];n!==void 0&&!n.blank&&O(n,l,i)&&v(n)}return{items:g.slice(0,s).map(t=>{let n=f.get(t.id),r=a.get(t.id),i=M(r?.pendingInteraction?.kind);return{id:t.id,title:A(t),workspace:d(t),running:r?.running??t.running,runningSubagentCount:N(e,t.id,a),...i===void 0?{}:{pendingInteraction:i},completed:r?.completionUnread===!0,archived:l.has(t.id),...n===void 0?{}:{snippet:n.snippet}}}),hasMore:o.hasMore||g.length>s}}function I(e){return(/^[A-Za-z]:[/\\]/.test(e)||e.startsWith(`\\\\`)?e.replaceAll(`\\`,`/`):e).replace(/\/+$/,``)}function L(e,t){let n=I(e),r,i=-1;for(let e of t){let t=I(e);t.length>i&&n!==t&&n.startsWith(`${t}/`)&&(r=e,i=t.length)}return r}let R=`__flat_session_order__`,z=`pinned`,ae=`workspaces`;function oe(e,t){return e?.[t]??!0}function B(e,t,n){let r=new Map(Object.entries(n.summaries)),i=/* @__PURE__ */ new Map;for(let[e,t]of Object.entries(n.members))if(e!==`__flat_session_order__`)for(let n of t)i.set(n,e);return Object.fromEntries(Object.entries(e).map(([e,n])=>{let a=[...n],o=n[0]===void 0?void 0:r.get(n[0]),s=o?.blank&&(o.retainedBy.mainView??0)>0?1:0;for(let n of t[e]??[]){let t=a.indexOf(n);t===-1?!r.has(n)&&(e===`__flat_session_order__`||!i.has(n)||i.get(n)===e)&&a.splice(s++,0,n):s=t+1}return[e,a]}))}function V(){return(0,r.defineStore)({init:()=>({groupBy:`workspace`,orderBy:`updated`,groupExpansion:{},sectionExpansion:{},sessionOrderByAccount:{},archivedFilter:`default`}),persist:`dsh.workspace.view.v5`,actions:{setGroupBy:(e,t)=>{e.groupBy=t},setOrderBy:(e,t,n,r)=>{t!==e.orderBy&&(e.sessionOrderByAccount=t===`manual`?B(n,e.sessionOrderByAccount,r):{},e.orderBy=t)},setGroupExpanded:(e,t,n)=>{e.groupExpansion[t]=n},setSectionExpanded:(e,t,n)=>{e.sectionExpansion={...e.sectionExpansion,[t]:n}},retainAccountKeys:(e,t)=>{let n=new Set(t);e.groupExpansion=Object.fromEntries(Object.entries(e.groupExpansion).filter(([e])=>n.has(e))),e.sessionOrderByAccount=Object.fromEntries(Object.entries(e.sessionOrderByAccount).filter(([e])=>n.has(e))),delete e.sessionUpdatedAtByAccount},syncSessionOrders:(e,t,n)=>{e.orderBy===`manual`&&Object.assign(e.sessionOrderByAccount,B(t,e.sessionOrderByAccount,n))},setSessionOrder:(e,t,n,r,i)=>{let a=B({...r,[t]:n},e.sessionOrderByAccount,i);e.orderBy===`updated`?e.sessionOrderByAccount=a:Object.assign(e.sessionOrderByAccount,a),e.orderBy=`manual`},pinSessionOrder:(e,t,n,r)=>{let i=new Set(n),a=B(Object.fromEntries(Object.entries(r.members).map(([t,n])=>[t,E(n,e.sessionOrderByAccount[t],r.summaries,r.rowState)])),e.sessionOrderByAccount,r);for(let e of i)a[e]!==void 0&&(a[e]=[t,...a[e].filter(e=>e!==t)]);Object.assign(e.sessionOrderByAccount,a)},setArchivedFilter:(e,t)=>{e.archivedFilter=t}}})}function se(e,t,n){let r=new Set(e.flatMap(e=>e.sessionIds));return{members:Object.fromEntries([...e.map(e=>[e.workspaceId,e.sessionIds]),[``,[.../* @__PURE__ */ new Set([...t.ids,...n.archivedSessionIds])].filter(e=>!r.has(e))],[R,ne(t,n.archivedSessionIds)]]),summaries:t.byId,rowState:n}}function ce(e,t){return[S(e,t),R]}var H=class{sessions;workspaces;held=/* @__PURE__ */ new Map;recent=/* @__PURE__ */ new Map;running=/* @__PURE__ */ new Set;failed=/* @__PURE__ */ new Set;active=!1;reconciling=!1;dirty=!1;constructor(e,t){this.sessions=e,this.workspaces=t}start(){this.active=!0;let e=this.sessions.list.subscribe(()=>this.reconcile()),t=this.workspaces.list.subscribe(()=>this.reconcile());return this.reconcile(),()=>{this.active=!1,e(),t();let n=[...this.held.values()];this.held.clear(),this.recent.clear(),this.running.clear(),this.failed.clear();for(let{reference:e}of n)e.release()}}visit(e,t){this.active&&(this.failed.delete(e.sessionId),this.remember(e.sessionId,typeof t==`string`?this.sessions.subagentAddress(e.sessionId)??t:t),this.reconcile())}remember(e,t){this.recent.delete(e),this.recent.set(e,t)}reconcile(){if(this.active&&(this.dirty=!0,!this.reconciling)){this.reconciling=!0;try{for(;this.dirty&&this.active;)this.dirty=!1,this.update()}finally{this.reconciling=!1}}}update(){let e=this.sessions.list.getSnapshot(),t=new Set(e.ids),n=new Set(this.workspaces.list.getSnapshot().archivedSessionIds),r=/* @__PURE__ */ new Set;for(let t of e.ids){let i=e.byId[t];i?.running&&i.origin!==`subagent`&&!n.has(t)&&r.add(t)}if(e.phase===`pending`)for(let e of this.running)n.has(e)||r.add(e);else for(let e of this.running)!r.has(e)&&t.has(e)&&!n.has(e)&&this.remember(e,e);this.running=r;for(let[r,i]of this.recent)(n.has(r)||this.sessions.binding(r)?.session.getSnapshot().removed||e.phase===`ready`&&!t.has(r)&&typeof i==`string`)&&this.recent.delete(r);let i=[...this.recent.keys()].filter(e=>!r.has(e));for(let e of i.slice(0,Math.max(0,i.length-8)))this.recent.delete(e);let a=new Map(this.recent);for(let e of r)a.set(e,e);for(let e of this.failed)a.has(e)||this.failed.delete(e);for(let[e,t]of this.held){let n=this.sessions.binding(e)!==t.binding;(!a.has(e)||n)&&(this.held.delete(e),n&&(this.recent.delete(e),this.failed.add(e)),t.reference.release())}for(let[e,t]of a){if(this.held.has(e)||this.failed.has(e))continue;let n;try{n=this.sessions.retain(t,{source:`backgroundWarm`});let r={reference:n,binding:n.binding};this.held.set(e,r),n.ready.catch(()=>this.fail(e,r))}catch{this.failed.add(e),n?.release()}}}fail(e,t){this.active&&this.held.get(e)===t&&(this.failed.add(e),this.held.delete(e),t.reference.release())}},U=class extends Error{rpcError;name=`DirectoryBrowseError`;constructor(e){super(`directory browse failed: ${e.code}: ${e.message}`),this.rpcError=e}},le=class extends i.Service{directoryPicker;workspaces;sessions;view;notify;connecting=/* @__PURE__ */ new Map;lifetime=new AbortController;selection=(0,r.createSnapshotStore)({},{persist:{name:`dsh.sessions.current`}});mainReference;keepalive;constructor(e,t,n,r,i,a){super(e,`uiWorkspace`),this.directoryPicker=t,this.workspaces=n,this.sessions=r,this.view=i,this.notify=a,this.keepalive=new H(r,n),e.effect(()=>{let e=this.keepalive.start(),t=this.watchNavigation();return()=>{t(),this.lifetime.abort(),e();let n=this.mainReference;this.mainReference=void 0,n?.release()}},`ui-workspace: Workspace navigation policy`)}async connectWorkspace(e){let t=this.workspaces.list.getSnapshot().items.find(t=>t.workspaceId===e);if(t===void 0)throw Error(`uiWorkspace.connectWorkspace: unknown workspace ${e}`);let n=this.connecting.get(e);if(n!==void 0)return n;let r=this.reuseOrCreateBlank(t).finally(()=>{this.connecting.delete(e)});return this.connecting.set(e,r),r}reuseOrCreateBlank(e){let t=this.workspaces.list.getSnapshot().archivedSessionIds,n=this.sessions.list.getSnapshot();for(let r of n.ids){let i=n.byId[r];if(i!==void 0&&i.blank&&i.cwd===e.path&&e.sessionIds.includes(r)&&!t.includes(r))return this.reuseBlank(e.workspaceId,r)}return this.sessions.create({workspaceId:e.workspaceId})}async reuseBlank(e,t){try{return await this.sessions.create({workspaceId:e,sessionId:t})}catch(t){if(W(t)?.rpcError.code!==`session/writer-held`)throw t;return this.sessions.create({workspaceId:e})}}openSession(e){this.replaceMain(e,this.lifetime.signal,`reveal`)}async openWorkspace(e,t){let n=AbortSignal.any([this.ctx.layout.beginNavigation(),this.lifetime.signal]),r;try{if(e===null&&!this.workspaces.list.getSnapshot().canStartProjectless)throw Error(`This Host requires a Workspace.`);r=e===null?await this.sessions.create():await this.connectWorkspace(e)}catch(e){throw n.aborted||this.notify({kind:`createFailed`,message:G(e)}),e}n.aborted||this.replaceMain(r,n,`reveal`,t)}async forkSession(e,t){return this.sessions.fork({sessionId:e,increaseTitle:!0,...t===void 0?{}:{onCreated:t}})}startSession(e,t){let n=t===void 0?void 0:{...t},r=n!==void 0&&(n.prompt!==void 0||n.clearPreviousDraft===!0),i=this.workspaces.list.getSnapshot(),a=this.sessions.list.getSnapshot(),o=this.mainReference?.sessionId,s=o===void 0?void 0:i.items.find(e=>e.sessionIds.includes(o))?.workspaceId,c=i.phase===`ready`&&a.phase===`ready`?ue(i.items,a.byId):void 0,l=e??(i.canStartProjectless?null:s??c);if(l===void 0){if(r){this.notify({kind:`createFailed`,message:this.ctx.locale.bind(`workspace`)(`draft.workspaceRequired`)});return}this.clearMain()}else this.openWorkspace(l,r?e=>{let t=this.sessions.binding(e);t===void 0&&this.draftPreparationFailed(),this.prepareDraft(t,n)}:void 0).catch(e=>{console.warn(`new session failed:`,e)})}prepareDraft(e,t){let n=this.ctx.get(`conversation`);n===void 0&&this.draftPreparationFailed(),n.input.requestDraftInitialization(e,t)===`blocked`&&this.draftPreparationFailed()}draftPreparationFailed(){let e=this.ctx.locale.bind(`workspace`)(`draft.initializationFailed`);throw this.notify({kind:`createFailed`,message:e}),Error(e)}async archiveSession(e,t={}){await this.workspaces.archiveSession(e,t),this.mainReference?.sessionId===e&&this.clearMain()}async unarchiveSession(e){await this.workspaces.unarchiveSession(e)}async pinSession(e){await this.workspaces.pinSession(e);let{items:t,pinnedSessionIds:n,archivedSessionIds:r}=this.workspaces.list.getSnapshot();this.view.pinSessionOrder(e,ce(t,e),se(t,this.sessions.list.getSnapshot(),{pinnedSessionIds:n,archivedSessionIds:r}))}async unpinSession(e){await this.workspaces.unpinSession(e)}async pickDirectory(){let e=await this.directoryPicker.pick();if(!e.ok)throw Error(`directory picker failed: ${e.error.message}`);return e.value}async listDirectory(e,t){let n=await this.directoryPicker.list(e,t);if(!n.ok)throw new U(n.error);return n.value}async createDirectory(e,t){let n=await this.directoryPicker.createDirectory(e,t);if(!n.ok)throw new U(n.error);return n.value}watchNavigation(){let e=`waiting`,t=()=>{if(this.lifetime.signal.aborted||this.clearArchivedCurrent()||e!==`waiting`)return;let t=this.workspaces.list.getSnapshot(),n=this.sessions.list.getSnapshot();t.phase===`ready`&&n.phase===`ready`&&(this.mainReference===void 0?(e=`connecting`,this.restoreSelection(t,n).then(()=>{e=`done`},t=>{this.lifetime.signal.aborted||(e=`waiting`,console.warn(`initial Session restoration failed:`,t))})):e=`done`)},n=this.workspaces.list.subscribe(t),r=this.sessions.list.subscribe(t);return t(),()=>{this.lifetime.abort(),r(),n()}}async restoreSelection(e,t){let n=this.selection.getSnapshot();if(n.subagentAddress!==void 0){this.replaceMain(n.subagentAddress,this.lifetime.signal,`preserve`);return}let r=n.sessionId===void 0?void 0:t.byId[n.sessionId],i=r===void 0?void 0:e.items.find(e=>e.sessionIds.includes(r.id));if(r!==void 0&&(!r.blank||i===void 0)){this.replaceMain(r.id,this.lifetime.signal,`preserve`);return}let a=AbortSignal.any([this.ctx.layout.beginNavigation(),this.lifetime.signal]),o;if(r!==void 0&&i!==void 0&&r.cwd===i.path&&!e.archivedSessionIds.includes(r.id)&&(o=await this.reuseBlank(i.workspaceId,r.id)),o===void 0&&e.canStartProjectless&&r===void 0){o=await this.sessions.create(),a.aborted||this.replaceMain(o,a,`preserve`);return}let s=i?.workspaceId??ue(e.items,t.byId);if(s===void 0&&e.items.length===0&&t.ids.length===0){let e=await this.initializeDefaultWorkspace(a);if(a.aborted)return;s=e?.workspaceId}o===void 0&&s!==void 0&&(o=await this.connectWorkspace(s)),o!==void 0&&!a.aborted&&this.replaceMain(o,a,`preserve`)}async initializeDefaultWorkspace(e){try{return await this.workspaces.initializeDefault(e)}catch{e.aborted||this.notify({kind:`defaultWorkspaceFailed`});return}}clearArchivedCurrent(){let e=this.mainReference?.sessionId;return e===void 0||!this.workspaces.list.getSnapshot().archivedSessionIds.includes(e)?!1:(this.clearMain(),!0)}clearMain(){let e=this.mainReference;this.mainReference=void 0,this.selection.set({}),e?.release(),this.ctx.layout.selectPanel(null)}replaceMain(e,t,n,r){t.throwIfAborted();let i=this.sessions.retain(e,{source:`mainView`});try{if(t.throwIfAborted(),r?.(i.sessionId),t.aborted){i.release();return}let n=typeof e==`string`?this.sessions.subagentAddress(i.sessionId):e;this.selection.set({sessionId:i.sessionId,...n===void 0?{}:{subagentAddress:n}})}catch(e){throw i.release(),e}let a=this.mainReference;this.mainReference=i,this.keepalive.visit(i,e),a?.release(),n===`reveal`&&this.ctx.layout.selectPanel(null)}};function W(e){return e instanceof Error&&e.name===`SessionCreateError`?e:void 0}function G(e){let t=W(e);return t===void 0?e instanceof Error?e.message:String(e):`${t.rpcError.code}: ${t.rpcError.message}`}function ue(e,t){let n,r=-1/0;for(let i of e){let e=-1/0;for(let n of i.sessionIds){let r=t[n];r!==void 0&&(e=Math.max(e,r.updatedAt))}e===-1/0&&(e=Date.parse(i.createdAt)),(n===void 0||e>r)&&(n=i.workspaceId,r=e)}return n}function de(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=de(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function K(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=de(e))&&(r&&(r+=` `),r+=t);return r}function fe(e,t){return e===`default-workspace`?t:e}let pe=`@deepseek-ai/dsh-client-ui-workspace/Rows.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(pe)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=pe,e.textContent=`.rjHY3q_projectRow,.rjHY3q_sessionRow{--dsh-row-surface:var(--dsw-specific-sidebar-fill);border-radius:var(--dsw-radius-md);padding:0 8px;cursor:pointer;-webkit-tap-highlight-color:transparent;user-select:none;color:var(--dsw-alias-label-primary);align-items:center;gap:6px;padding-inline-start:calc(8px + var(--dsh-workspace-indent,0px));display:flex;position:relative}.rjHY3q_projectRow:is(:hover,:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen),.rjHY3q_sessionRow:is(:hover,:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 4%, var(--dsw-specific-sidebar-fill));background:var(--dsh-row-surface)}.rjHY3q_sessionRow.rjHY3q_selected{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, var(--dsw-specific-sidebar-fill));background:var(--dsh-row-surface)}.rjHY3q_sessionRow.rjHY3q_selected:is(:hover,:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, var(--dsw-specific-sidebar-fill))}.rjHY3q_sessionRow,.rjHY3q_searchResultRow{--ch-sidebar-text-primary:#1a1c1f;letter-spacing:normal;color:color-mix(in oklab, var(--ch-sidebar-text-primary) 85%, transparent);font-family:-apple-system,"system-ui",Segoe UI,sans-serif;font-size:14px;font-weight:430;line-height:20px}body[data-ds-dark-theme] .rjHY3q_sessionRow,body[data-ds-dark-theme] .rjHY3q_searchResultRow{--ch-sidebar-text-primary:#fff}.rjHY3q_projectRow:focus-visible,.rjHY3q_sessionRow:focus-visible,.rjHY3q_iconButton:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.rjHY3q_searchResultRow{box-sizing:border-box;border-radius:var(--dsw-radius-lg);cursor:pointer;text-align:left;background:0 0;border:none;flex-direction:column;align-items:stretch;width:100%;min-height:48px;padding:4px 8px;display:flex}.rjHY3q_searchResultRow:hover,.rjHY3q_searchResultRow.rjHY3q_selected{background:var(--dsw-alias-interactive-bg-hover)}.rjHY3q_searchResultHeading{align-items:center;min-width:0;display:flex}.rjHY3q_searchResultTitle{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;margin-left:4px;font-size:14px;line-height:20px;overflow:hidden}.rjHY3q_searchResultMeta{align-items:center;gap:6px;min-width:0;margin-left:20px;display:flex}.rjHY3q_searchResultWorkspace,.rjHY3q_searchResultSnippet{text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:17px;overflow:hidden}.rjHY3q_searchResultWorkspace{max-width:40%;color:var(--dsw-alias-label-tertiary);flex:none}.rjHY3q_searchResultWorkspace:only-child{max-width:100%}.rjHY3q_searchResultSnippet{min-width:0;color:var(--dsw-alias-label-secondary);flex:1}.rjHY3q_projectRow{box-sizing:border-box;align-items:center;height:34px}.rjHY3q_sessionRow{gap:0;height:32px}.rjHY3q_sessionRow .rjHY3q_title{margin:0 6px 0 4px}.rjHY3q_slot{width:16px;height:20px;color:var(--dsw-alias-label-tertiary);flex:none;justify-content:center;align-items:center;display:inline-flex;position:relative}.rjHY3q_slot:has([data-harness-id]){width:14px;color:inherit}.rjHY3q_sessionRow:has([data-harness-id]) .rjHY3q_title,.rjHY3q_searchResultHeading:has([data-harness-id]) .rjHY3q_searchResultTitle{margin-left:8px}.rjHY3q_statusOverlay{display:contents}.rjHY3q_slot:has([data-harness-id]) .rjHY3q_statusOverlay{transform-origin:100% 100%;display:inline-flex;position:absolute;bottom:-3px;right:-3px;transform:scale(.65)}.rjHY3q_visuallyHidden{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}.rjHY3q_projectRow>.rjHY3q_slot:not(.rjHY3q_folderExpanded){color:inherit}.rjHY3q_folderExpanded{color:var(--dsw-alias-state-business-primary)}.rjHY3q_projectText{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.rjHY3q_title{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:14px;line-height:20px;overflow:hidden}.rjHY3q_renameInput{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-button-elevated-fill);min-width:0;color:inherit;outline:none;padding:0 2px;font-size:14px;line-height:20px}.rjHY3q_sessionRow .rjHY3q_title{flex:1}.rjHY3q_meta{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:20px;overflow:hidden}.rjHY3q_trailing{flex:none;place-items:center end;display:grid}.rjHY3q_trailing:empty{display:none}.rjHY3q_trailing>*{grid-area:1/1}.rjHY3q_time{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-tertiary);flex:none;font-size:10px;line-height:16px}.rjHY3q_timeStatus{justify-content:center;align-items:center;gap:6px;min-width:16px;height:20px;display:inline-flex}.rjHY3q_timeStatus [data-state=done]{color:var(--dsw-alias-state-business-primary)}.rjHY3q_timeStatus .rjHY3q_visuallyHidden{visibility:visible}.rjHY3q_sessionRow.rjHY3q_archived .rjHY3q_title,.rjHY3q_searchResultRow.rjHY3q_archived .rjHY3q_searchResultTitle,.rjHY3q_searchResultRow.rjHY3q_archived .rjHY3q_searchResultWorkspace,.rjHY3q_searchResultRow.rjHY3q_archived .rjHY3q_searchResultSnippet{color:var(--dsw-alias-label-caption)}.rjHY3q_dot{flex:none}.rjHY3q_quickActions{align-items:center;gap:2px;display:inline-flex}.rjHY3q_rowActions{visibility:hidden;pointer-events:none;flex:none;align-items:center;gap:2px;display:inline-flex}.rjHY3q_projectRow:is(:hover,:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen) .rjHY3q_rowActions,.rjHY3q_sessionRow:is(:hover,:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen) .rjHY3q_rowActions,.rjHY3q_searchResultRow:is(:hover,:focus-visible,:has(:focus-visible)) .rjHY3q_rowActions{visibility:visible;pointer-events:auto}.rjHY3q_searchResultHeading .rjHY3q_rowActions{margin-left:auto}.rjHY3q_sessionRow:is(:hover,:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen) .rjHY3q_time{visibility:hidden}@media (hover:hover) and (pointer:fine){.rjHY3q_projectRow>.rjHY3q_rowActions,.rjHY3q_sessionRow .rjHY3q_rowActions{inset-inline-end:8px;z-index:1;background:var(--dsh-row-surface);border-radius:var(--dsw-radius-sm);position:absolute;top:50%;transform:translateY(-50%)}.rjHY3q_projectRow>.rjHY3q_rowActions:before,.rjHY3q_sessionRow .rjHY3q_rowActions:before{content:"";background:linear-gradient(to right, transparent, var(--dsh-row-surface));pointer-events:none;width:12px;position:absolute;inset-block:0;inset-inline-end:100%}}[data-phone-drawer] .rjHY3q_sessionRow{height:48px;min-height:48px}.rjHY3q_phoneDetails{padding:8px 8px 16px}.rjHY3q_phoneDetails .rjHY3q_hoverTitle{display:none}.rjHY3q_phoneDetails :is(.rjHY3q_hoverTitle,.rjHY3q_hoverTime,.rjHY3q_hoverStatus,.rjHY3q_hoverPath){color:inherit}.rjHY3q_sessionRow.rjHY3q_dropBefore,.rjHY3q_sessionRow.rjHY3q_dropAfter{position:relative}.rjHY3q_sessionRow.rjHY3q_dropBefore:before,.rjHY3q_sessionRow.rjHY3q_dropAfter:after{content:"";z-index:1;background:linear-gradient(55deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 0 / 5px 7px no-repeat, linear-gradient(125deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 5px / 5px 7px no-repeat, linear-gradient(var(--dsw-alias-state-business-primary) 0 0) 4px 5px / calc(100% - 4px) 2px no-repeat;pointer-events:none;height:12px;position:absolute;left:0;right:4px}.rjHY3q_sessionRow.rjHY3q_dropBefore:before{top:-7px}.rjHY3q_sessionRow.rjHY3q_dropAfter:after{bottom:-7px}.rjHY3q_hoverContent{flex-direction:column;gap:8px;display:flex}.rjHY3q_hoverTitle{color:#fff;overflow-wrap:break-word;font-size:14px;line-height:20px}.rjHY3q_hoverPath{color:#cfd3d6;word-break:break-all;font-size:12px;line-height:16px}.rjHY3q_hoverTime{color:#cfd3d6;font-size:12px;line-height:16px}.rjHY3q_hoverStatus{color:#adb2b8;align-items:center;gap:8px;font-size:12px;line-height:20px;display:flex}.rjHY3q_hoverArchived svg{flex-shrink:0;margin:0 -4px}.rjHY3q_iconButton{cursor:pointer;-webkit-tap-highlight-color:transparent;width:24px;height:24px;color:var(--dsw-alias-label-tertiary);background:0 0;border:none;border-radius:4px;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.rjHY3q_iconButton:hover{color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--dsw-alias-label-primary) 7%, transparent)}[data-phone-drawer] :is(.rjHY3q_projectRow,.rjHY3q_sessionRow){--dsh-row-surface:transparent;background:var(--dsh-row-surface)}[data-phone-drawer] :is(.rjHY3q_projectRow,.rjHY3q_sessionRow):is(:active,:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 3%, transparent)}[data-phone-drawer] .rjHY3q_sessionRow.rjHY3q_selected{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent)}[data-phone-drawer] .rjHY3q_rowActions,[data-phone-drawer] .rjHY3q_rowActions:before{background:0 0}[data-phone-drawer] .rjHY3q_iconButton{width:44px;height:44px;color:var(--dsw-alias-label-tertiary);background:0 0}[data-phone-drawer] .rjHY3q_iconButton:active{color:var(--dsw-alias-label-primary)}@media (hover:none),(pointer:coarse){.rjHY3q_projectRow,.rjHY3q_sessionRow{min-height:44px}.rjHY3q_rowActions{visibility:visible;pointer-events:auto}.rjHY3q_sessionRow .rjHY3q_quickActions{display:none}.rjHY3q_sessionRow .rjHY3q_trailing{align-items:center;gap:4px;display:flex}.rjHY3q_sessionRow .rjHY3q_time:not(.rjHY3q_timeStatus){display:none}.rjHY3q_sessionRow .rjHY3q_timeStatus{visibility:visible;padding-inline-end:0}.rjHY3q_iconButton{width:44px;height:44px}}`,document.head.appendChild(e)}var q={archived:`rjHY3q_archived`,dot:`rjHY3q_dot`,dropAfter:`rjHY3q_dropAfter`,dropBefore:`rjHY3q_dropBefore`,folderExpanded:`rjHY3q_folderExpanded`,hoverArchived:`rjHY3q_hoverArchived`,hoverContent:`rjHY3q_hoverContent`,hoverPath:`rjHY3q_hoverPath`,hoverStatus:`rjHY3q_hoverStatus`,hoverTime:`rjHY3q_hoverTime`,hoverTitle:`rjHY3q_hoverTitle`,iconButton:`rjHY3q_iconButton`,menuOpen:`rjHY3q_menuOpen`,meta:`rjHY3q_meta`,phoneDetails:`rjHY3q_phoneDetails`,projectRow:`rjHY3q_projectRow`,projectText:`rjHY3q_projectText`,quickActions:`rjHY3q_quickActions`,renameInput:`rjHY3q_renameInput`,rowActions:`rjHY3q_rowActions`,searchResultHeading:`rjHY3q_searchResultHeading`,searchResultMeta:`rjHY3q_searchResultMeta`,searchResultRow:`rjHY3q_searchResultRow`,searchResultSnippet:`rjHY3q_searchResultSnippet`,searchResultTitle:`rjHY3q_searchResultTitle`,searchResultWorkspace:`rjHY3q_searchResultWorkspace`,selected:`rjHY3q_selected`,sessionRow:`rjHY3q_sessionRow`,slot:`rjHY3q_slot`,statusOverlay:`rjHY3q_statusOverlay`,time:`rjHY3q_time`,timeStatus:`rjHY3q_timeStatus`,title:`rjHY3q_title`,trailing:`rjHY3q_trailing`,visuallyHidden:`rjHY3q_visuallyHidden`};function me(e,t){return e.blank?t(`session.new`):e.title||t(`session.untitled`)}function he(e,t,n){let{unit:r,n:i}=(0,o.relativeTime)(e,t);return r===`now`?n(`time.now`):n(`time.${r}`,{n:i})}function ge(e,t,n){let{unit:r,n:i}=(0,o.relativeTime)(e,t);return r===`now`?n(`time.now`):n(`time.ago`,{t:n(`time.${r}`,{n:i})})}function _e(e,t){let n=new Date(e),r=e=>String(e).padStart(2,`0`);return t(`hover.created`,{time:`${t(`date.ymd`,{y:n.getFullYear(),m:n.getMonth()+1,d:n.getDate()})} ${r(n.getHours())}:${r(n.getMinutes())}`})}function J({label:e,cwd:t,createdAt:n,t:r}){return/* @__PURE__ */ (0,s.jsxs)(`div`,{className:q.hoverContent,children:[/* @__PURE__ */ (0,s.jsx)(`div`,{className:q.hoverTitle,children:e}),/* @__PURE__ */ (0,s.jsx)(`div`,{className:q.hoverPath,children:t}),/* @__PURE__ */ (0,s.jsx)(`div`,{className:q.hoverTime,children:_e(n,r)})]})}function ve(e){let t=e.currentTarget.getBoundingClientRect();return e.clientY<t.top+t.height/2?`before`:`after`}function ye({group:e,onToggle:t,onCreate:n,actions:r,drag:i,home:c,newShortcut:l,t:u}){let d=e,f=d.workspaceId===void 0?u(`group.ungrouped`):d.label,[p,m]=(0,a.useState)(!1),[h,g]=(0,a.useState)(null),v=[{id:`rename`,label:u(`rename`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconEditOutlineRegular,{})},{id:`delete`,label:u(`delete.workspace`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconTrashOutlineRegular,{}),danger:!0}],y=/* @__PURE__ */ (0,s.jsxs)(`div`,{className:K(q.projectRow,p&&q.menuOpen),"data-row-key":`workspace:${e.key}`,role:`treeitem`,"aria-expanded":d.expanded,tabIndex:-1,onContextMenu:e=>{r&&!e.target.closest(`button`)&&(e.preventDefault(),g(new DOMRect(e.clientX,e.clientY,0,0)),m(!0))},onKeyDown:e=>{e.target===e.currentTarget&&r&&(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`)&&(e.preventDefault(),g(null),m(!0))},onClick:t,draggable:i!==void 0,onDragStart:i===void 0?void 0:e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,d.key),i.start()},onDragEnd:i?.end,children:[/* @__PURE__ */ (0,s.jsx)(`span`,{className:K(q.slot,d.expanded&&q.folderExpanded),children:d.expanded?/* @__PURE__ */ (0,s.jsx)(o.IconFolderOpenRegular,{}):/* @__PURE__ */ (0,s.jsx)(o.IconFolderCloseRegular,{})}),/* @__PURE__ */ (0,s.jsx)(`span`,{className:q.projectText,children:/* @__PURE__ */ (0,s.jsx)(`span`,{className:q.title,children:f})}),/* @__PURE__ */ (0,s.jsxs)(`span`,{className:q.rowActions,children:[r!==void 0&&/* @__PURE__ */ (0,s.jsx)(o.Menu,{open:p,onClose:()=>{m(!1)},items:v,onSelect:e=>{
|
|
9
|
+
default:return h(n)}}function k(e,t,n){let r=[],i=[];for(let a of e)!n.has(a.id)&&t.has(a.id)?r.push(a):i.push(a);return[...r,...i]}function A(e){return e.blank?``:e.title?.trim()??``}function j(e,t,n,r,i,a,o){return{key:e,workspaceId:t,cwd:n,createdAt:r,label:i,sessions:[...a],remote:o}}function ee(e,t,n,r){let i=[];for(let a of t){let t=[];for(let i of a.sessionIds){let a=e.byId[i];a!==void 0&&O(a,n,r)&&t.push(a)}(r!==`only`||t.length!==0)&&i.push(j(a.workspaceId,a.workspaceId,a.path,Date.parse(a.createdAt),a.title,t,a.remote))}let a=T(e.ids,e.byId).map(t=>e.byId[t]).filter(e=>e!==void 0&&O(e,n,r));return a.length>0&&i.push(j(``,void 0,void 0,void 0,``,a)),i}function te(e){switch(e){case`approval`:case`plan-review`:case`question`:return e;default:return}}function M(e,t,n){return e.projectionsBySession[t]?.values.subagentCatalog?.reduce((t,r)=>t+ +((n.get(r.id)?.running??e.byId[r.id]?.running)===!0),0)??0}function N(e,t,n){let r=n.get(e.id),i=te(r?.pendingInteraction?.kind);return{running:r?.running??e.running,runningSubagentCount:M(t,e.id,n),completed:r?.completionUnread===!0,...i===void 0?{}:{pendingInteraction:i}}}function P(e,t,n,r,i){return{id:e.id,reference:y(e),remote:e.projectionValues?.remoteHost??void 0,title:A(e),blank:e.blank,...N(e,t,n),pinned:!i.has(e.id)&&r.has(e.id),archived:i.has(e.id),updatedAt:e.updatedAt}}function F(e,t,n,r,i){let a=new Set(n.archivedSessionIds),o=new Set(n.pinnedSessionIds),s=new Set(i.expandedGroups),c=C(e),l=[];for(let u of ee(e,t,a,n.archivedFilter)){let t=s.has(u.key),n=i.excludePinned?u.sessions.filter(e=>!o.has(e.id)||a.has(e.id)):u.sessions;l.push({key:u.key,workspaceId:u.workspaceId,cwd:u.cwd,createdAt:u.createdAt,label:u.label,remote:u.remote,sessionCount:n.length,expanded:t,containsCurrent:u.sessions.some(e=>e.id===c),sessions:t?k(n,o,a).map(t=>P(t,e,r,o,a)):[]})}return l}function ne(e,t=[]){return[...re(e,[],`show`),...t.filter(t=>e.byId[t]===void 0)]}function re(e,t,n){let r=new Set(t);return e.ids.filter(t=>{let i=e.byId[t];return i!==void 0&&O(i,r,n)})}function ie(e,t,n,r){let i=new Set(n.archivedSessionIds),a=new Set(n.pinnedSessionIds);return k(t.flatMap(t=>{let r=e.byId[t];return r!==void 0&&O(r,i,n.archivedFilter)?[r]:[]}),a,i).map(t=>P(t,e,r,a,i))}function I(e,t,n,r,i,a,o,s){let c=n.trim().toLowerCase();if(c===``)return{items:[],hasMore:!1};let l=new Set(r),u=/* @__PURE__ */ new Map;for(let e of t)for(let t of e.sessionIds)u.has(t)||u.set(t,e.title);let d=e=>u.get(e.id)??w(e.cwd),f=/* @__PURE__ */ new Map;for(let e of o.items)f.has(e.sessionId)||f.set(e.sessionId,e);let p=[];for(let t of e.ids){let n=e.byId[t];n!==void 0&&!n.blank&&O(n,l,i)&&(A(n).toLowerCase().includes(c)||d(n).toLowerCase().includes(c))&&p.push(n)}let m=new Map(p.map(e=>[e.id,e])),h=T(p.map(e=>e.id),e.byId).map(e=>m.get(e)),g=[],_=/* @__PURE__ */ new Set,v=e=>{_.has(e.id)||(_.add(e.id),g.push(e))};for(let e of h)v(e);for(let t of o.items){let n=e.byId[t.sessionId];n!==void 0&&!n.blank&&O(n,l,i)&&v(n)}return{items:g.slice(0,s).map(t=>{let n=f.get(t.id),r=a.get(t.id),i=te(r?.pendingInteraction?.kind);return{id:t.id,title:A(t),workspace:d(t),remote:t.projectionValues?.remoteHost??void 0,running:r?.running??t.running,runningSubagentCount:M(e,t.id,a),...i===void 0?{}:{pendingInteraction:i},completed:r?.completionUnread===!0,archived:l.has(t.id),...n===void 0?{}:{snippet:n.snippet}}}),hasMore:o.hasMore||g.length>s}}function ae(e){return(/^[A-Za-z]:[/\\]/.test(e)||e.startsWith(`\\\\`)?e.replaceAll(`\\`,`/`):e).replace(/\/+$/,``)}function oe(e,t){let n=ae(e),r,i=-1;for(let e of t){let t=ae(e);t.length>i&&n!==t&&n.startsWith(`${t}/`)&&(r=e,i=t.length)}return r}let se=`__flat_session_order__`,L=`pinned`,ce=`workspaces`;function le(e,t){return e?.[t]??!0}function R(e,t,n){let r=new Map(Object.entries(n.summaries)),i=/* @__PURE__ */ new Map;for(let[e,t]of Object.entries(n.members))if(e!==`__flat_session_order__`)for(let n of t)i.set(n,e);return Object.fromEntries(Object.entries(e).map(([e,n])=>{let a=[...n],o=n[0]===void 0?void 0:r.get(n[0]),s=o?.blank&&(o.retainedBy.mainView??0)>0?1:0;for(let n of t[e]??[]){let t=a.indexOf(n);t===-1?!r.has(n)&&(e===`__flat_session_order__`||!i.has(n)||i.get(n)===e)&&a.splice(s++,0,n):s=t+1}return[e,a]}))}function z(){return(0,r.defineStore)({init:()=>({groupBy:`workspace`,orderBy:`updated`,groupExpansion:{},sectionExpansion:{},sessionOrderByAccount:{},archivedFilter:`default`}),persist:`dsh.workspace.view.v5`,actions:{setGroupBy:(e,t)=>{e.groupBy=t},setOrderBy:(e,t,n,r)=>{t!==e.orderBy&&(e.sessionOrderByAccount=t===`manual`?R(n,e.sessionOrderByAccount,r):{},e.orderBy=t)},setGroupExpanded:(e,t,n)=>{e.groupExpansion[t]=n},setSectionExpanded:(e,t,n)=>{e.sectionExpansion={...e.sectionExpansion,[t]:n}},retainAccountKeys:(e,t)=>{let n=new Set(t);e.groupExpansion=Object.fromEntries(Object.entries(e.groupExpansion).filter(([e])=>n.has(e))),e.sessionOrderByAccount=Object.fromEntries(Object.entries(e.sessionOrderByAccount).filter(([e])=>n.has(e))),delete e.sessionUpdatedAtByAccount},syncSessionOrders:(e,t,n)=>{e.orderBy===`manual`&&Object.assign(e.sessionOrderByAccount,R(t,e.sessionOrderByAccount,n))},setSessionOrder:(e,t,n,r,i)=>{let a=R({...r,[t]:n},e.sessionOrderByAccount,i);e.orderBy===`updated`?e.sessionOrderByAccount=a:Object.assign(e.sessionOrderByAccount,a),e.orderBy=`manual`},pinSessionOrder:(e,t,n,r)=>{let i=new Set(n),a=R(Object.fromEntries(Object.entries(r.members).map(([t,n])=>[t,E(n,e.sessionOrderByAccount[t],r.summaries,r.rowState)])),e.sessionOrderByAccount,r);for(let e of i)a[e]!==void 0&&(a[e]=[t,...a[e].filter(e=>e!==t)]);Object.assign(e.sessionOrderByAccount,a)},setArchivedFilter:(e,t)=>{e.archivedFilter=t}}})}function ue(e,t,n){let r=new Set(e.flatMap(e=>e.sessionIds));return{members:Object.fromEntries([...e.map(e=>[e.workspaceId,e.sessionIds]),[``,[.../* @__PURE__ */ new Set([...t.ids,...n.archivedSessionIds])].filter(e=>!r.has(e))],[se,ne(t,n.archivedSessionIds)]]),summaries:t.byId,rowState:n}}function de(e,t){return[S(e,t),se]}var fe=class{sessions;workspaces;held=/* @__PURE__ */ new Map;recent=/* @__PURE__ */ new Map;running=/* @__PURE__ */ new Set;failed=/* @__PURE__ */ new Set;active=!1;reconciling=!1;dirty=!1;constructor(e,t){this.sessions=e,this.workspaces=t}start(){this.active=!0;let e=this.sessions.list.subscribe(()=>this.reconcile()),t=this.workspaces.list.subscribe(()=>this.reconcile());return this.reconcile(),()=>{this.active=!1,e(),t();let n=[...this.held.values()];this.held.clear(),this.recent.clear(),this.running.clear(),this.failed.clear();for(let{reference:e}of n)e.release()}}visit(e,t){this.active&&(this.failed.delete(e.sessionId),this.remember(e.sessionId,typeof t==`string`?this.sessions.subagentAddress(e.sessionId)??t:t),this.reconcile())}remember(e,t){this.recent.delete(e),this.recent.set(e,t)}reconcile(){if(this.active&&(this.dirty=!0,!this.reconciling)){this.reconciling=!0;try{for(;this.dirty&&this.active;)this.dirty=!1,this.update()}finally{this.reconciling=!1}}}update(){let e=this.sessions.list.getSnapshot(),t=new Set(e.ids),n=new Set(e.summaryOnlyIds??[]),r=new Set(this.workspaces.list.getSnapshot().archivedSessionIds),i=/* @__PURE__ */ new Set;for(let t of e.ids){let a=e.byId[t];a?.running&&a.origin!==`subagent`&&!r.has(t)&&(!n.has(t)||this.recent.has(t))&&i.add(t)}if(e.phase===`pending`)for(let e of this.running)r.has(e)||i.add(e);else for(let e of this.running)!i.has(e)&&t.has(e)&&!r.has(e)&&this.remember(e,e);this.running=i;for(let[n,i]of this.recent)(r.has(n)||this.sessions.binding(n)?.session.getSnapshot().removed||e.phase===`ready`&&!t.has(n)&&typeof i==`string`)&&this.recent.delete(n);let a=[...this.recent.keys()].filter(e=>!i.has(e));for(let e of a.slice(0,Math.max(0,a.length-8)))this.recent.delete(e);let o=new Map(this.recent);for(let e of i)o.set(e,e);for(let e of this.failed)o.has(e)||this.failed.delete(e);for(let[e,t]of this.held){let n=this.sessions.binding(e)!==t.binding;(!o.has(e)||n)&&(this.held.delete(e),n&&(this.recent.delete(e),this.failed.add(e)),t.reference.release())}for(let[e,t]of o){if(this.held.has(e)||this.failed.has(e))continue;let n;try{n=this.sessions.retain(t,{source:`backgroundWarm`});let r={reference:n,binding:n.binding};this.held.set(e,r),n.ready.catch(()=>this.fail(e,r))}catch{this.failed.add(e),n?.release()}}}fail(e,t){this.active&&this.held.get(e)===t&&(this.failed.add(e),this.held.delete(e),t.reference.release())}};function B(e){return e}function pe(e){return B(e)}let me=`codexhost.web.session-tabs.v2:local`,he=`codexhost.web.session-tabs.v1:local`,V=`codexhost.web.recent-visits.v1:local`,ge=1048576;function _e(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ve(e){return typeof e==`string`&&e.length>0&&e.length<=1024&&e.trim()===e&&!/[\u0000-\u001f\u007f]/u.test(e)?pe(e):void 0}function ye(e,t){if(typeof e==`string`)return e===t?t:void 0;if(!_e(e)||Object.keys(e).length!==3)return;let n=ve(e.parentSessionId),r=ve(e.childSessionId),i=e.mode;if(!(n===void 0||r!==t||n===r||i!==`one-shot`&&i!==`continuable`&&i!==`unknown`))return{parentSessionId:n,childSessionId:r,mode:i}}function be(e,t){if(e===null||e.length>ge)return[];try{let n=JSON.parse(e);if(!_e(n)||Object.keys(n).length!==2||n.version!==t||!Array.isArray(n.entries))return[];let r=[],i=/* @__PURE__ */ new Set,a=Date.now();for(let e of n.entries){if(!_e(e))continue;let n=Object.keys(e);if(t===2&&n.length!==3||n.length!==2&&(n.length!==3||!Object.hasOwn(e,`lastVisitedAt`)))continue;let o=ve(e.sessionId);if(o===void 0||i.has(o))continue;let s=Object.hasOwn(e,`lastVisitedAt`)?e.lastVisitedAt:a;if(typeof s!=`number`||!Number.isSafeInteger(s)||s<0||s>a)continue;let c=ye(e.target,o);c!==void 0&&(i.add(o),r.push({sessionId:o,target:c,lastVisitedAt:s}))}return r}catch{return[]}}var xe=class{onFailure;enabled=typeof window<`u`&&/^https?:$/u.test(window.location.protocol);reported=!1;constructor(e){this.onFailure=e}read(){if(!this.enabled)return[];try{return this.latest()}catch{return this.failed(),[]}}update(e,t){if(this.enabled)try{let n=this.latest().filter(e=>t?.(e)!==!0),r=new Map(n.map((e,t)=>[e.sessionId,t]));for(let i of e){if(t?.(i)===!0)continue;let e=r.get(i.sessionId);e===void 0?(r.set(i.sessionId,n.length),n.push(i)):n[e]=i}let i=JSON.stringify({version:2,entries:n.map(e=>({sessionId:e.sessionId,lastVisitedAt:e.lastVisitedAt,target:typeof e.target==`string`?e.target:{parentSessionId:e.target.parentSessionId,childSessionId:e.target.childSessionId,mode:e.target.mode}}))});if(i.length>ge){this.failed();return}localStorage.getItem(me)!==i&&localStorage.setItem(me,i),localStorage.removeItem(he),localStorage.removeItem(V)}catch{this.failed()}}latest(){let e=localStorage.getItem(me);return e===null?be(localStorage.getItem(he)??localStorage.getItem(V),1):be(e,2)}failed(){if(!this.reported){this.reported=!0;try{this.onFailure()}catch{}}}},Se=class{sessions;workspaces;subscribeRemoved;entries=(0,r.createSnapshotStore)([]);records=[];current;awaitingFormalSession=!1;active=!1;headRevision=0;restoring=!1;cache;constructor(e,t,n,r=()=>{}){this.sessions=e,this.workspaces=t,this.subscribeRemoved=n,this.cache=new xe(r)}start(e){this.active=!0,this.headRevision=this.sessions.list.getSnapshot().headRefreshRevision??0,this.records=this.cache.read(),this.cache.update([]);let t=this.sessions.list.subscribe(()=>{let t=this.sessions.list.getSnapshot().headRefreshRevision??0;t!==this.headRevision&&(this.headRevision=t,this.restoreSummaries(this.current?.sessionId??e)),this.reconcile()}),n=this.workspaces.list.subscribe(()=>this.reconcile()),r=this.subscribeRemoved?.(e=>{this.sessions.subagentAddress(e)!==void 0||this.sessions.list.getSnapshot().byId[e]?.origin===`subagent`||this.records.some(t=>t.sessionId===e&&typeof t.target!=`string`)||(this.records=this.records.filter(t=>!this.includesIdentity(t,e)),this.cache.update([],t=>this.includesIdentity(t,e)),this.publish())});return this.reconcile(),this.restoreSummaries(e),()=>{this.active=!1,t(),n(),r?.(),this.current=void 0,this.awaitingFormalSession=!1,this.records=[],this.entries.set([])}}visit(e,t){let n=Date.now(),r=this.depart(n);r!==void 0&&this.remember(r),this.current={sessionId:e,target:typeof t==`string`?this.sessions.subagentAddress(e)??t:t,lastVisitedAt:n},this.awaitingFormalSession=!0,this.reconcile(r===void 0?[]:[r])}clearCurrent(){let e=this.depart(Date.now());e!==void 0&&this.remember(e),this.current=void 0,this.awaitingFormalSession=!1,this.reconcile(e===void 0?[]:[e])}depart(e){let t=this.current;return t!==void 0&&this.records.some(e=>e.sessionId===t.sessionId)&&this.formal(t)?{...t,lastVisitedAt:e}:void 0}close(e){this.records=this.records.filter(t=>t.sessionId!==e),this.cache.update([],t=>t.sessionId===e),this.current?.sessionId===e&&(this.awaitingFormalSession=!1),this.publish()}expireInactive(e,t,n=Date.now()){let r=this.sessions.list.getSnapshot();if(!this.active||!Number.isFinite(e)||e<=0||r.phase!==`ready`||r.loading===!0||r.listError!=null||this.workspaces.list.getSnapshot().phase!==`ready`)return!1;let i=new Set(this.entries.getSnapshot().map(e=>e.sessionId)),a=a=>{let o=r.byId[a.sessionId];if(a.sessionId===this.current?.sessionId||!i.has(a.sessionId)||o===void 0||o.blank||(o.retainedBy.mainView??0)>0||o.running||t.get(a.sessionId)?.pendingInteraction!==void 0||typeof a.target!=`string`&&t.get(a.sessionId)?.running===void 0||!Number.isFinite(o.updatedAt))return!1;let s=N(o,r,t);return s.running||s.runningSubagentCount>0?!1:n-Math.max(a.lastVisitedAt,o.updatedAt)>=e},o=new Set(this.records.filter(a).map(e=>e.sessionId));return o.size!==0&&(this.records=this.records.filter(e=>!o.has(e.sessionId)),this.cache.update([],e=>o.has(e.sessionId)&&a(e)),this.publish(),!0)}remember(e){let t=this.records.findIndex(t=>t.sessionId===e.sessionId);this.records=t===-1?[...this.records,e]:this.records.map((n,r)=>r===t?e:n)}formal(e){let t=this.sessions.list.getSnapshot();return t.byId[e.sessionId]?.blank===!1&&!this.invalid(e,t)}reconcile(e=[]){if(!this.active)return;let t=this.sessions.list.getSnapshot(),n=new Set(this.records.filter(e=>this.invalid(e,t)).map(e=>e.sessionId));this.records=this.records.filter(e=>!n.has(e.sessionId));let r=[...e],i=this.current;this.awaitingFormalSession&&i!==void 0&&this.formal(i)&&(this.awaitingFormalSession=!1,this.remember(i),r.push(i)),this.publish(),(r.length>0||n.size>0)&&this.cache.update(r,e=>n.has(e.sessionId))}publish(){let e=this.sessions.list.getSnapshot(),t=this.workspaces.list.getSnapshot().phase===`ready`,n=this.records.flatMap(n=>{if(!t||e.byId[n.sessionId]?.blank!==!1||this.invalid(n,e))return[];if(typeof n.target==`string`)return[n];let r=this.sessions.subagentAddress(n.sessionId);if(r===void 0||r.parentSessionId!==n.target.parentSessionId||r.childSessionId!==n.sessionId)return[];if(r.mode===n.target.mode)return[n];let i={...n,target:r};return this.records=this.records.map(e=>e===n?i:e),[i]}),r=this.entries.getSnapshot();(n.length!==r.length||n.some((e,t)=>e!==r[t]))&&this.entries.set(n)}restoreSummaries(e=this.current?.sessionId){if(this.restoring)return;let t=this.records.filter(t=>t.sessionId!==e&&this.sessions.list.getSnapshot().byId[t.sessionId]===void 0);if(t.length===0)return;this.restoring=!0;let n=0;Promise.all(Array.from({length:Math.min(4,t.length)},async()=>{for(;this.active;){let e=t[n++];if(e===void 0)return;let r=e.sessionId;if(this.records.some(e=>e.sessionId===r)&&this.sessions.list.getSnapshot().byId[r]===void 0){try{await this.sessions.loadSummary(r)}catch{}this.active&&this.reconcile()}}})).finally(()=>{this.restoring=!1})}includesIdentity(e,t){if(e.sessionId===t)return!0;if(typeof e.target==`string`)return!1;let n=/* @__PURE__ */ new Set,r=e.target.parentSessionId;for(;r!==void 0&&!n.has(r);){if(r===t)return!0;n.add(r),r=this.sessions.subagentAddress(r)?.parentSessionId}return!1}invalid(e,t){let n=this.workspaces.list.getSnapshot().archivedSessionIds,r=e=>n.includes(e)||this.sessions.binding(e)?.session.getSnapshot().removed===!0;if(r(e.sessionId))return!0;if(typeof e.target==`string`)return!1;let i=/* @__PURE__ */ new Set([e.sessionId]),a=e.target;for(;!i.has(a.parentSessionId);){if(r(a.parentSessionId)||Ce(t,a.parentSessionId,a.childSessionId))return!0;i.add(a.parentSessionId);let e=this.sessions.subagentAddress(a.parentSessionId);if(e===void 0)break;a=e}return!1}};function Ce(e,t,n){let r=e.projectionsBySession[t];return e.phase===`ready`&&r?.state!==`loading`&&r?.state!==`error`&&r?.values.subagentCatalog!==void 0&&!r.values.subagentCatalog.some(e=>e.id===n)}var H=class extends Error{rpcError;name=`DirectoryBrowseError`;constructor(e){super(`directory browse failed: ${e.code}: ${e.message}`),this.rpcError=e}},we=class extends i.Service{directoryPicker;workspaces;sessions;view;notify;connecting=/* @__PURE__ */ new Map;lifetime=new AbortController;selection=(0,r.createSnapshotStore)({},{persist:{name:`dsh.sessions.current`}});mainReference;opening=(0,r.createSnapshotStore)({state:`idle`});retryOpen;openingLoad;keepalive;recentVisits;constructor(e,t,n,r,i,a){super(e,`uiWorkspace`),this.directoryPicker=t,this.workspaces=n,this.sessions=r,this.view=i,this.notify=a,this.keepalive=new fe(r,n);let o=e.get(`remote`);this.recentVisits=new Se(r,n,o===void 0?void 0:e=>o.$on(`api-session/removed`,e),()=>a({kind:`recentVisitsStorageFailed`})),e.effect(()=>{let e=this.selection.getSnapshot(),t=this.recentVisits.start(e.subagentAddress?.childSessionId??e.sessionId),n=this.keepalive.start(),r=this.watchNavigation();return()=>{r(),this.lifetime.abort(),n(),t();let e=this.mainReference;this.mainReference=void 0,e?.release()}},`ui-workspace: Workspace navigation policy`)}async connectWorkspace(e){let t=this.workspaces.list.getSnapshot().items.find(t=>t.workspaceId===e);if(t===void 0)throw Error(`uiWorkspace.connectWorkspace: unknown workspace ${e}`);let n=this.connecting.get(e);if(n!==void 0)return n;let r=this.reuseOrCreateBlank(t).finally(()=>{this.connecting.delete(e)});return this.connecting.set(e,r),r}reuseOrCreateBlank(e){let t=this.workspaces.list.getSnapshot().archivedSessionIds,n=this.sessions.list.getSnapshot();for(let r of n.ids){let i=n.byId[r];if(i!==void 0&&i.blank&&i.cwd===e.path&&e.sessionIds.includes(r)&&!t.includes(r))return this.reuseBlank(e.workspaceId,r)}return this.sessions.create({workspaceId:e.workspaceId})}async reuseBlank(e,t){try{return await this.sessions.create({workspaceId:e,sessionId:t})}catch(t){if(Te(t)?.rpcError.code!==`session/writer-held`)throw t;return this.sessions.create({workspaceId:e})}}openSession(e){let t=AbortSignal.any([this.ctx.layout.beginNavigation(),this.lifetime.signal]);this.opening.set({state:`idle`}),this.retryOpen=void 0,typeof e!=`string`||this.sessions.list.getSnapshot().byId[e]!==void 0?this.replaceMain(e,t,`reveal`):this.resolveSession(e,t,()=>{this.replaceMain(e,t,`reveal`)},()=>this.openSession(e))}closeSessionTab(e){let t=this.recentVisits.entries.getSnapshot(),n=t.findIndex(t=>t.sessionId===e);if(n!==-1){if(this.mainReference?.sessionId===e){let r=t[n+1]??t[n-1];if(r===void 0){this.recentVisits.close(e),this.clearMain();return}if(this.openSession(r.target),this.mainReference?.sessionId!==r.sessionId)return}this.recentVisits.close(e)}}retryOpening(){this.retryOpen?.()}async resolveSession(e,t,n,r){if(t.aborted)return;this.openingLoad?.stop(),this.retryOpen=void 0;let i={stop:()=>t.removeEventListener(`abort`,a)},a=()=>{i.stop(),this.openingLoad===i&&(this.openingLoad=void 0,this.opening.set({state:`idle`}),this.retryOpen=void 0)};t.addEventListener(`abort`,a,{once:!0}),this.openingLoad=i,this.opening.set({state:`loading`,sessionId:e});try{if(t.aborted||this.openingLoad!==i||(await this.sessions.loadSummary(e),t.aborted||this.openingLoad!==i))return;if(this.sessions.list.getSnapshot().byId[e]===void 0)throw Error(`Session not found: ${e}`);n(),a()}catch(n){if(t.aborted||this.openingLoad!==i)return;this.retryOpen=r,this.opening.set({state:`error`,sessionId:e,message:Ee(n)})}}async openWorkspace(e,t){let n=AbortSignal.any([this.ctx.layout.beginNavigation(),this.lifetime.signal]),r;try{if(e===null&&!this.workspaces.list.getSnapshot().canStartProjectless)throw Error(`This Host requires a Workspace.`);r=e===null?await this.sessions.create():await this.connectWorkspace(e)}catch(e){throw n.aborted||this.notify({kind:`createFailed`,message:Ee(e)}),e}n.aborted||this.replaceMain(r,n,`reveal`,t)}async forkSession(e,t){return this.sessions.fork({sessionId:e,increaseTitle:!0,...t===void 0?{}:{onCreated:t}})}startSession(e,t){let n=t===void 0?void 0:{...t},r=n!==void 0&&(n.prompt!==void 0||n.clearPreviousDraft===!0),i=this.workspaces.list.getSnapshot(),a=this.sessions.list.getSnapshot(),o=this.mainReference?.sessionId,s=o===void 0?void 0:i.items.find(e=>e.sessionIds.includes(o))?.workspaceId,c=i.phase===`ready`&&a.phase===`ready`?De(i.items,a.byId):void 0,l=e??(i.canStartProjectless?null:s??c);if(l===void 0){if(this.ctx.layout.beginNavigation(),r){this.notify({kind:`createFailed`,message:this.ctx.locale.bind(`workspace`)(`draft.workspaceRequired`)});return}this.clearMain()}else this.openWorkspace(l,r?e=>{let t=this.sessions.binding(e);t===void 0&&this.draftPreparationFailed(),this.prepareDraft(t,n)}:void 0).catch(e=>{console.warn(`new session failed:`,e)})}prepareDraft(e,t){let n=this.ctx.get(`conversation`);n===void 0&&this.draftPreparationFailed(),n.input.requestDraftInitialization(e,t)===`blocked`&&this.draftPreparationFailed()}draftPreparationFailed(){let e=this.ctx.locale.bind(`workspace`)(`draft.initializationFailed`);throw this.notify({kind:`createFailed`,message:e}),Error(e)}async archiveSession(e,t={}){await this.workspaces.archiveSession(e,t),this.mainReference?.sessionId===e&&this.clearMain()}async unarchiveSession(e){await this.workspaces.unarchiveSession(e)}async pinSession(e){await this.workspaces.pinSession(e);let{items:t,pinnedSessionIds:n,archivedSessionIds:r}=this.workspaces.list.getSnapshot();this.view.pinSessionOrder(e,de(t,e),ue(t,this.sessions.list.getSnapshot(),{pinnedSessionIds:n,archivedSessionIds:r}))}async unpinSession(e){await this.workspaces.unpinSession(e)}async pickDirectory(){let e=await this.directoryPicker.pick();if(!e.ok)throw Error(`directory picker failed: ${e.error.message}`);return e.value}async listDirectory(e,t){let n=await this.directoryPicker.list(e,t);if(!n.ok)throw new H(n.error);return n.value}async createDirectory(e,t){let n=await this.directoryPicker.createDirectory(e,t);if(!n.ok)throw new H(n.error);return n.value}watchNavigation(){let e=`waiting`,t=AbortSignal.any([this.ctx.layout.beginNavigation(),this.lifetime.signal]);t.addEventListener(`abort`,()=>{e=`done`},{once:!0});let n=()=>{if(this.lifetime.signal.aborted||this.clearArchivedCurrent()||e!==`waiting`)return;let n=this.workspaces.list.getSnapshot(),r=this.sessions.list.getSnapshot();this.mainReference===void 0?n.phase===`ready`&&r.phase===`ready`&&(e=`connecting`,this.restoreSelection(n,r,t).then(()=>{e=`done`},n=>{t.aborted||(e=`waiting`,console.warn(`initial Session restoration failed:`,n))})):e=`done`},r=this.workspaces.list.subscribe(n),i=this.sessions.list.subscribe(n),a=this.selection.getSnapshot();if(a.sessionId!==void 0||a.subagentAddress!==void 0){if(e=`connecting`,a.subagentAddress!==void 0)this.replaceMain(a.subagentAddress,t,`preserve`),e=`done`;else if(a.sessionId!==void 0){let r=a.sessionId,i=()=>{this.resolveSession(r,t,()=>{this.sessions.list.getSnapshot().byId[r]?.blank===!0?(e=`waiting`,n()):(this.replaceMain(r,t,`preserve`),e=`done`)},i)};i()}}return n(),()=>{this.lifetime.abort(),i(),r()}}async restoreSelection(e,t,n){let r=this.selection.getSnapshot();if(r.subagentAddress!==void 0){this.replaceMain(r.subagentAddress,n,`preserve`);return}let i=r.sessionId===void 0?void 0:t.byId[r.sessionId],a=i===void 0?void 0:e.items.find(e=>e.sessionIds.includes(i.id));if(i!==void 0&&(!i.blank||a===void 0)){this.replaceMain(i.id,n,`preserve`);return}let o;if(i!==void 0&&a!==void 0&&i.cwd===a.path&&!e.archivedSessionIds.includes(i.id)&&(o=await this.reuseBlank(a.workspaceId,i.id)),o===void 0&&e.canStartProjectless&&i===void 0){o=await this.sessions.create(),n.aborted||this.replaceMain(o,n,`preserve`);return}let s=a?.workspaceId??De(e.items,t.byId);if(s===void 0&&e.items.length===0&&t.ids.length===0){let e=await this.initializeDefaultWorkspace(n);if(n.aborted)return;s=e?.workspaceId}o===void 0&&s!==void 0&&(o=await this.connectWorkspace(s)),o!==void 0&&!n.aborted&&this.replaceMain(o,n,`preserve`)}async initializeDefaultWorkspace(e){try{return await this.workspaces.initializeDefault(e)}catch{e.aborted||this.notify({kind:`defaultWorkspaceFailed`});return}}clearArchivedCurrent(){let e=this.mainReference?.sessionId;return e===void 0||!this.workspaces.list.getSnapshot().archivedSessionIds.includes(e)?!1:(this.clearMain(),!0)}clearMain(){let e=this.mainReference;this.mainReference=void 0,this.recentVisits.clearCurrent(),this.selection.set({}),e?.release(),this.ctx.layout.selectPanel(null)}replaceMain(e,t,n,r){t.throwIfAborted();let i=this.sessions.retain(e,{source:`mainView`});try{if(t.throwIfAborted(),r?.(i.sessionId),t.aborted){i.release();return}let n=typeof e==`string`?this.sessions.subagentAddress(i.sessionId):e;this.selection.set({sessionId:i.sessionId,...n===void 0?{}:{subagentAddress:n}})}catch(e){throw i.release(),e}let a=this.mainReference;this.mainReference=i,this.keepalive.visit(i,e),this.recentVisits.visit(i.sessionId,e),a?.release(),n===`reveal`&&this.ctx.layout.selectPanel(null)}};function Te(e){return e instanceof Error&&e.name===`SessionCreateError`?e:void 0}function Ee(e){let t=Te(e);return t===void 0?e instanceof Error?e.message:String(e):`${t.rpcError.code}: ${t.rpcError.message}`}function De(e,t){let n,r=-1/0;for(let i of e){let e=-1/0;for(let n of i.sessionIds){let r=t[n];r!==void 0&&(e=Math.max(e,r.updatedAt))}e===-1/0&&(e=Date.parse(i.createdAt)),(n===void 0||e>r)&&(n=i.workspaceId,r=e)}return n}let Oe=`@deepseek-ai/dsh-client-ui-workspace/RecentShortcut.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Oe)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Oe,e.textContent=`._6puhIG_shortcut{isolation:isolate;box-sizing:border-box;width:max-content;min-width:0;max-width:min(164px,100% - 24px);min-height:44px;color:var(--dsw-alias-label-primary);background:0 0;border:0;border-radius:8px;flex:none;align-items:center;padding:0;font-size:13px;font-weight:500;line-height:20px;display:inline-flex;position:relative}._6puhIG_select,._6puhIG_close{border-radius:inherit;min-height:44px;color:inherit;font:inherit;cursor:pointer;background:0 0;border:0;align-items:center;padding:0;display:inline-flex}._6puhIG_select{box-sizing:border-box;text-align:start;flex:1;align-self:stretch;gap:6px;min-width:44px;padding-inline-start:8px}._6puhIG_close{width:44px;color:var(--dsw-alias-label-secondary);flex:0 0 44px;justify-content:center}._6puhIG_close:active{color:var(--dsw-alias-label-primary)}._6puhIG_shortcut:before{content:"";z-index:-1;box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l2);border-radius:inherit;background:var(--dsw-alias-bg-module-platform);box-shadow:inset 0 .5px 0 color-mix(in srgb, var(--dsw-alias-bg-layer-1) 65%, transparent), 0 1px 3px color-mix(in srgb, var(--dsw-alias-label-primary) 5%, transparent);pointer-events:none;position:absolute;inset:6px 0}._6puhIG_shortcut[data-active]:before{border-width:1px;border-color:color-mix(in srgb, var(--dsw-alias-label-primary) 34%, var(--dsw-alias-border-l2));background:color-mix(in srgb, var(--dsw-alias-bg-module-platform) 90%, var(--dsw-alias-label-primary))}._6puhIG_shortcut:active:before{background:var(--dsw-alias-button-ghost-active-fill)}@supports (backdrop-filter:blur(8px)){._6puhIG_shortcut:before{background:color-mix(in srgb, var(--dsw-alias-bg-module-platform) 64%, transparent);backdrop-filter:blur(8px)saturate(115%)}._6puhIG_shortcut[data-active]:before{background:color-mix(in srgb, color-mix(in srgb, var(--dsw-alias-bg-module-platform) 90%, var(--dsw-alias-label-primary)) 82%, transparent)}._6puhIG_shortcut:active:before{background:color-mix(in srgb, var(--dsw-alias-button-ghost-active-fill) 82%, transparent)}}._6puhIG_select:focus-visible,._6puhIG_close:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:-2px}._6puhIG_identity{flex:0 0 14px;justify-content:center;align-items:center;width:14px;height:14px;display:inline-flex}._6puhIG_title{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}._6puhIG_activity{flex:none;justify-content:center;align-items:center;display:inline-flex}@media (prefers-reduced-transparency:reduce),(prefers-contrast:more){._6puhIG_shortcut:before,._6puhIG_shortcut[data-active]:before{border-color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-module-platform);backdrop-filter:none;box-shadow:none}._6puhIG_shortcut[data-active]:before{border-width:1px;border-color:var(--dsw-alias-label-primary)}._6puhIG_shortcut:active:before{background:var(--dsw-alias-button-ghost-active-fill)}}@media (forced-colors:active){._6puhIG_shortcut{color:buttontext}._6puhIG_shortcut:before{backdrop-filter:none;box-shadow:none;background:buttonface;border:1px solid buttontext}._6puhIG_shortcut[data-active],._6puhIG_shortcut:active{color:highlighttext}._6puhIG_shortcut[data-active]:before,._6puhIG_shortcut:active:before{background:highlight;border-color:highlight}._6puhIG_close,._6puhIG_close:active{color:inherit}._6puhIG_select:focus-visible,._6puhIG_close:focus-visible{outline-color:highlight}._6puhIG_shortcut[data-active] ._6puhIG_select:focus-visible,._6puhIG_shortcut[data-active] ._6puhIG_close:focus-visible{outline-color:highlighttext}}`,document.head.appendChild(e)}var U={activity:`_6puhIG_activity`,close:`_6puhIG_close`,identity:`_6puhIG_identity`,select:`_6puhIG_select`,shortcut:`_6puhIG_shortcut`,title:`_6puhIG_title`};function ke({visit:e,summary:t,identity:n,activityLabel:r,activity:i,active:c,closeLabel:l,closeHint:u,open:d,close:f,restoreNavigationFocus:p}){let m=(0,a.useRef)(null),h=(0,a.useCallback)(e=>{e===null&&m.current?.contains(document.activeElement)&&p(),m.current=e},[p]);return/* @__PURE__ */ (0,s.jsxs)(`div`,{ref:h,className:U.shortcut,"data-active":c||void 0,children:[/* @__PURE__ */ (0,s.jsxs)(`button`,{type:`button`,className:U.select,onMouseDown:e=>e.preventDefault(),title:t.displayTitle,"aria-current":c?`page`:void 0,"aria-label":[t.displayTitle,t.id,r].filter(Boolean).join(` · `),onClick:()=>{c||(p(),d(e.target))},children:[/* @__PURE__ */ (0,s.jsx)(`span`,{className:U.identity,children:n}),/* @__PURE__ */ (0,s.jsx)(`span`,{className:U.title,children:t.displayTitle}),i!=null&&/* @__PURE__ */ (0,s.jsx)(`span`,{className:U.activity,title:r,children:i})]}),/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:U.close,onMouseDown:e=>e.preventDefault(),"aria-label":l,title:u,onClick:()=>{p(),f(e.sessionId)},children:/* @__PURE__ */ (0,s.jsx)(o.IconCloseOutlineRegular,{size:12})})]})}let Ae=`@deepseek-ai/dsh-client-ui-workspace/Rows.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Ae)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Ae,e.textContent=`.rjHY3q_hostBadge{max-width:96px;color:var(--dsw-alias-label-secondary);flex-shrink:0;align-items:center;gap:6px;font-size:11px;display:inline-flex}.rjHY3q_hostBadge>span:first-child{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.rjHY3q_hostDot{background:#92949a;border-radius:50%;flex-shrink:0;width:7px;height:7px}.rjHY3q_hostBadge[data-state=connected] .rjHY3q_hostDot{background:#16a34a}.rjHY3q_hostBadge[data-state=connecting] .rjHY3q_hostDot{background:#d97706}.rjHY3q_projectRow,.rjHY3q_sessionRow{--dsh-row-surface:var(--dsw-specific-sidebar-fill);border-radius:var(--dsw-radius-md);padding:0 8px;cursor:pointer;-webkit-tap-highlight-color:transparent;user-select:none;color:var(--dsw-alias-label-primary);align-items:center;gap:6px;padding-inline-start:calc(8px + var(--dsh-workspace-indent,0px));display:flex;position:relative}.rjHY3q_projectRow:is(:hover,:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen),.rjHY3q_sessionRow:is(:hover,:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 4%, var(--dsw-specific-sidebar-fill));background:var(--dsh-row-surface)}.rjHY3q_sessionRow.rjHY3q_selected{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, var(--dsw-specific-sidebar-fill));background:var(--dsh-row-surface)}.rjHY3q_sessionRow.rjHY3q_selected:is(:hover,:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, var(--dsw-specific-sidebar-fill))}.rjHY3q_sessionRow,.rjHY3q_searchResultRow{--ch-sidebar-text-primary:#1a1c1f;letter-spacing:normal;color:color-mix(in oklab, var(--ch-sidebar-text-primary) 85%, transparent);font-family:-apple-system,"system-ui",Segoe UI,sans-serif;font-size:14px;font-weight:430;line-height:20px}body[data-ds-dark-theme] .rjHY3q_sessionRow,body[data-ds-dark-theme] .rjHY3q_searchResultRow{--ch-sidebar-text-primary:#fff}.rjHY3q_projectRow:focus-visible,.rjHY3q_sessionRow:focus-visible,.rjHY3q_iconButton:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.rjHY3q_searchResultRow{box-sizing:border-box;border-radius:var(--dsw-radius-lg);cursor:pointer;text-align:left;background:0 0;border:none;flex-direction:column;align-items:stretch;width:100%;min-height:48px;padding:4px 8px;display:flex}.rjHY3q_searchResultRow:hover,.rjHY3q_searchResultRow.rjHY3q_selected{background:var(--dsw-alias-interactive-bg-hover)}.rjHY3q_searchResultHeading{align-items:center;min-width:0;display:flex}.rjHY3q_searchResultTitle{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;margin-left:4px;font-size:14px;line-height:20px;overflow:hidden}.rjHY3q_searchResultMeta{align-items:center;gap:6px;min-width:0;margin-left:20px;display:flex}.rjHY3q_searchResultWorkspace,.rjHY3q_searchResultSnippet{text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:17px;overflow:hidden}.rjHY3q_searchResultWorkspace{max-width:40%;color:var(--dsw-alias-label-tertiary);flex:none}.rjHY3q_searchResultWorkspace:only-child{max-width:100%}.rjHY3q_searchResultSnippet{min-width:0;color:var(--dsw-alias-label-secondary);flex:1}.rjHY3q_projectRow{box-sizing:border-box;align-items:center;height:34px}.rjHY3q_sessionRow{gap:0;height:32px}.rjHY3q_sessionRow .rjHY3q_title{margin:0 6px 0 4px}.rjHY3q_slot{width:16px;height:20px;color:var(--dsw-alias-label-tertiary);flex:none;justify-content:center;align-items:center;display:inline-flex;position:relative}.rjHY3q_slot:has([data-harness-id]){width:14px;color:inherit}.rjHY3q_sessionRow:has([data-harness-id]) .rjHY3q_title,.rjHY3q_searchResultHeading:has([data-harness-id]) .rjHY3q_searchResultTitle{margin-left:8px}.rjHY3q_statusOverlay{display:contents}.rjHY3q_slot:has([data-harness-id]) .rjHY3q_statusOverlay{transform-origin:100% 100%;display:inline-flex;position:absolute;bottom:-3px;right:-3px;transform:scale(.65)}.rjHY3q_visuallyHidden{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}.rjHY3q_projectRow>.rjHY3q_slot:not(.rjHY3q_folderExpanded){color:inherit}.rjHY3q_folderExpanded{color:var(--dsw-alias-state-business-primary)}.rjHY3q_projectText{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.rjHY3q_title{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:14px;line-height:20px;overflow:hidden}.rjHY3q_renameInput{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-button-elevated-fill);min-width:0;color:inherit;outline:none;padding:0 2px;font-size:14px;line-height:20px}.rjHY3q_sessionRow .rjHY3q_title{flex:1}.rjHY3q_meta{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:20px;overflow:hidden}.rjHY3q_trailing{flex:none;place-items:center end;display:grid}.rjHY3q_trailing:empty{display:none}.rjHY3q_trailing>*{grid-area:1/1}.rjHY3q_time{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-tertiary);flex:none;font-size:10px;line-height:16px}.rjHY3q_timeStatus{justify-content:center;align-items:center;gap:6px;min-width:16px;height:20px;display:inline-flex}.rjHY3q_timeStatus [data-state=done]{color:var(--dsw-alias-state-business-primary)}.rjHY3q_timeStatus .rjHY3q_visuallyHidden{visibility:visible}.rjHY3q_sessionRow.rjHY3q_archived .rjHY3q_title,.rjHY3q_searchResultRow.rjHY3q_archived .rjHY3q_searchResultTitle,.rjHY3q_searchResultRow.rjHY3q_archived .rjHY3q_searchResultWorkspace,.rjHY3q_searchResultRow.rjHY3q_archived .rjHY3q_searchResultSnippet{color:var(--dsw-alias-label-caption)}.rjHY3q_dot{flex:none}.rjHY3q_quickActions{align-items:center;gap:2px;display:inline-flex}.rjHY3q_rowActions{visibility:hidden;pointer-events:none;flex:none;align-items:center;gap:2px;display:inline-flex}.rjHY3q_projectRow:is(:hover,:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen) .rjHY3q_rowActions,.rjHY3q_sessionRow:is(:hover,:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen) .rjHY3q_rowActions,.rjHY3q_searchResultRow:is(:hover,:focus-visible,:has(:focus-visible)) .rjHY3q_rowActions{visibility:visible;pointer-events:auto}.rjHY3q_searchResultHeading .rjHY3q_rowActions{margin-left:auto}.rjHY3q_sessionRow:is(:hover,:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen) .rjHY3q_time{visibility:hidden}@media (hover:hover) and (pointer:fine){.rjHY3q_projectRow>.rjHY3q_rowActions,.rjHY3q_sessionRow .rjHY3q_rowActions{inset-inline-end:8px;z-index:1;background:var(--dsh-row-surface);border-radius:var(--dsw-radius-sm);position:absolute;top:50%;transform:translateY(-50%)}.rjHY3q_projectRow>.rjHY3q_rowActions:before,.rjHY3q_sessionRow .rjHY3q_rowActions:before{content:"";background:linear-gradient(to right, transparent, var(--dsh-row-surface));pointer-events:none;width:12px;position:absolute;inset-block:0;inset-inline-end:100%}}[data-phone-drawer] .rjHY3q_sessionRow{height:48px;min-height:48px}.rjHY3q_phoneDetails{padding:8px 8px 16px}.rjHY3q_phoneDetails .rjHY3q_hoverTitle{display:none}.rjHY3q_phoneDetails :is(.rjHY3q_hoverTitle,.rjHY3q_hoverTime,.rjHY3q_hoverStatus,.rjHY3q_hoverPath){color:inherit}.rjHY3q_sessionRow.rjHY3q_dropBefore,.rjHY3q_sessionRow.rjHY3q_dropAfter{position:relative}.rjHY3q_sessionRow.rjHY3q_dropBefore:before,.rjHY3q_sessionRow.rjHY3q_dropAfter:after{content:"";z-index:1;background:linear-gradient(55deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 0 / 5px 7px no-repeat, linear-gradient(125deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 5px / 5px 7px no-repeat, linear-gradient(var(--dsw-alias-state-business-primary) 0 0) 4px 5px / calc(100% - 4px) 2px no-repeat;pointer-events:none;height:12px;position:absolute;left:0;right:4px}.rjHY3q_sessionRow.rjHY3q_dropBefore:before{top:-7px}.rjHY3q_sessionRow.rjHY3q_dropAfter:after{bottom:-7px}.rjHY3q_hoverContent{flex-direction:column;gap:8px;display:flex}.rjHY3q_hoverTitle{color:#fff;overflow-wrap:break-word;font-size:14px;line-height:20px}.rjHY3q_hoverPath{color:#cfd3d6;word-break:break-all;font-size:12px;line-height:16px}.rjHY3q_hoverTime{color:#cfd3d6;font-size:12px;line-height:16px}.rjHY3q_hoverStatus{color:#adb2b8;align-items:center;gap:8px;font-size:12px;line-height:20px;display:flex}.rjHY3q_hoverArchived svg{flex-shrink:0;margin:0 -4px}.rjHY3q_iconButton{cursor:pointer;-webkit-tap-highlight-color:transparent;width:24px;height:24px;color:var(--dsw-alias-label-tertiary);background:0 0;border:none;border-radius:4px;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.rjHY3q_iconButton:hover{color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--dsw-alias-label-primary) 7%, transparent)}[data-phone-drawer] :is(.rjHY3q_projectRow,.rjHY3q_sessionRow){--dsh-row-surface:transparent;background:var(--dsh-row-surface)}[data-phone-drawer] :is(.rjHY3q_projectRow,.rjHY3q_sessionRow):is(:active,:focus-visible,:has(:focus-visible),.rjHY3q_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 3%, transparent)}[data-phone-drawer] .rjHY3q_sessionRow.rjHY3q_selected{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent)}[data-phone-drawer] .rjHY3q_rowActions,[data-phone-drawer] .rjHY3q_rowActions:before{background:0 0}[data-phone-drawer] .rjHY3q_iconButton{width:44px;height:44px;color:var(--dsw-alias-label-tertiary);background:0 0}[data-phone-drawer] .rjHY3q_iconButton:active{color:var(--dsw-alias-label-primary)}@media (hover:none),(pointer:coarse){.rjHY3q_projectRow,.rjHY3q_sessionRow{min-height:44px}.rjHY3q_rowActions{visibility:visible;pointer-events:auto}.rjHY3q_sessionRow .rjHY3q_quickActions{display:none}.rjHY3q_sessionRow .rjHY3q_trailing{align-items:center;gap:4px;display:flex}.rjHY3q_sessionRow .rjHY3q_time:not(.rjHY3q_timeStatus){display:none}.rjHY3q_sessionRow .rjHY3q_timeStatus{visibility:visible;padding-inline-end:0}.rjHY3q_iconButton{width:44px;height:44px}}`,document.head.appendChild(e)}var W={archived:`rjHY3q_archived`,dot:`rjHY3q_dot`,dropAfter:`rjHY3q_dropAfter`,dropBefore:`rjHY3q_dropBefore`,folderExpanded:`rjHY3q_folderExpanded`,hostBadge:`rjHY3q_hostBadge`,hostDot:`rjHY3q_hostDot`,hoverArchived:`rjHY3q_hoverArchived`,hoverContent:`rjHY3q_hoverContent`,hoverPath:`rjHY3q_hoverPath`,hoverStatus:`rjHY3q_hoverStatus`,hoverTime:`rjHY3q_hoverTime`,hoverTitle:`rjHY3q_hoverTitle`,iconButton:`rjHY3q_iconButton`,menuOpen:`rjHY3q_menuOpen`,meta:`rjHY3q_meta`,phoneDetails:`rjHY3q_phoneDetails`,projectRow:`rjHY3q_projectRow`,projectText:`rjHY3q_projectText`,quickActions:`rjHY3q_quickActions`,renameInput:`rjHY3q_renameInput`,rowActions:`rjHY3q_rowActions`,searchResultHeading:`rjHY3q_searchResultHeading`,searchResultMeta:`rjHY3q_searchResultMeta`,searchResultRow:`rjHY3q_searchResultRow`,searchResultSnippet:`rjHY3q_searchResultSnippet`,searchResultTitle:`rjHY3q_searchResultTitle`,searchResultWorkspace:`rjHY3q_searchResultWorkspace`,selected:`rjHY3q_selected`,sessionRow:`rjHY3q_sessionRow`,slot:`rjHY3q_slot`,statusOverlay:`rjHY3q_statusOverlay`,time:`rjHY3q_time`,timeStatus:`rjHY3q_timeStatus`,title:`rjHY3q_title`,trailing:`rjHY3q_trailing`,visuallyHidden:`rjHY3q_visuallyHidden`};function je(e,t){let n=e.runningSubagentCount===0?void 0:{state:`ongoing`,label:t(e.runningSubagentCount===1?`status.subagentsRunning.one`:`status.subagentsRunning.other`,{n:e.runningSubagentCount})},r;switch(e.pendingInteraction){case`approval`:r={state:`warning`,label:t(`status.waitingApproval`),trailingLabel:t(`status.compact.approval`)};break;case`plan-review`:r={state:`warning`,label:t(`status.planReview`),trailingLabel:t(`status.compact.planReview`)};break;case`question`:r={state:`warning`,label:t(`status.waitingAnswer`),trailingLabel:t(`status.compact.answer`)};break;case void 0:break;default:return Me(e.pendingInteraction)}if(r!==void 0)return n===void 0?[r]:[r,n];if(e.running){let e={state:`ongoing`,label:t(`status.running`)};return n===void 0?[e]:[e,n]}return n===void 0?e.completed?[{state:`done`,label:t(`status.completed`)}]:[{state:`idle`,label:t(`status.idle`)}]:[n]}function Me(e){throw Error(`unknown pending interaction: ${String(e)}`)}function Ne({statuses:e}){return/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(o.StateDot,{state:e[0].state,size:e[0].state===`ongoing`?16:void 0}),e.map(e=>/* @__PURE__ */ (0,s.jsx)(`span`,{className:W.visuallyHidden,children:e.label},e.label))]})}let G=`@deepseek-ai/dsh-client-ui-workspace/RecentNavigation.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(G)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=G,e.textContent=`.F2-n5a_trigger,.F2-n5a_shortcuts{display:none}[data-phone] .F2-n5a_trigger{width:44px;height:44px;color:var(--dsw-alias-label-primary);cursor:pointer;-webkit-app-region:no-drag;background:0 0;border:0;border-radius:8px;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.F2-n5a_trigger[aria-disabled=true]{cursor:wait}.F2-n5a_trigger:active{background:color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent)}.F2-n5a_trigger:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:-2px}.F2-n5a_expanded{transform:rotate(180deg)}[data-phone] .F2-n5a_shortcuts{overflow-anchor:none;scroll-behavior:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;scrollbar-width:none;-webkit-app-region:no-drag;grid-column:1/-1;gap:6px;min-width:0;min-height:44px;margin-inline:-12px -20px;padding-inline-end:16px;scroll-padding-inline:8px 20px;display:flex;overflow-x:auto}.F2-n5a_shortcuts::-webkit-scrollbar{width:0;height:0;display:none}`,document.head.appendChild(e)}var Pe={expanded:`F2-n5a_expanded`,shortcuts:`F2-n5a_shortcuts`,trigger:`F2-n5a_trigger`};function Fe({useVisits:e,useSessions:t,useWorkspaces:n,useSessionStatus:r,t:i}){let a=e(e=>e),o=t(e=>e),s=n(e=>e.archivedSessionIds),c=r(e=>e);return a.flatMap(e=>{let t=o.byId[e.sessionId];return t===void 0||t.blank||s.includes(e.sessionId)?[]:[{visit:e,summary:t,statuses:je({...N(t,o,c),completed:!1},i)}]})}function Ie(e){let{useRecentNavigationSettings:t,open:n,close:r,viewport:i,restoreNavigationFocus:c,renderSlot:l,t:u}=e,d=t(e=>e.value?.showRecentVisits??!0),f=Fe(e),p=d&&f.length>0,m=(0,a.useRef)(null),[h,g]=(0,a.useState)(!1),_=(0,a.useCallback)((e=m.current)=>{e?.isConnected&&e.clientWidth>0&&(i.scrollLeft=Math.max(0,Math.min(e.scrollLeft,e.scrollWidth-e.clientWidth)))},[i]);return(0,a.useLayoutEffect)(()=>{let e=m.current;if(e===null)return;e.scrollLeft=i.scrollLeft;let t=e.clientWidth,n=new ResizeObserver(()=>{e.clientWidth!==t&&(t=e.clientWidth,e.scrollLeft=i.scrollLeft)});return n.observe(e),()=>{_(e),n.disconnect()}},[p,i,_]),p?/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(`nav`,{ref:m,className:Pe.shortcuts,"aria-label":u(`recent.navigation`),onScroll:e=>_(e.currentTarget),children:f.map(({visit:t,summary:i,statuses:a})=>/* @__PURE__ */ (0,s.jsx)(ke,{visit:t,summary:i,identity:l(`workspace.recent.shortcut.identity`,{sessionId:t.sessionId}),activityLabel:a[0].state===`idle`?void 0:a.map(e=>e.label).join(` · `),activity:a[0].state===`idle`?null:/* @__PURE__ */ (0,s.jsx)(Ne,{statuses:a}),active:e.sessionId===t.sessionId,closeLabel:u(`recent.close`,{name:i.displayTitle}),closeHint:u(`recent.closeHint`),open:e=>{_(),n(e)},close:e=>{_();try{r(e)}catch{g(!0)}},restoreNavigationFocus:c},t.sessionId))}),h&&/* @__PURE__ */ (0,s.jsx)(o.Toast,{text:u(`recent.closeFailed`),onDone:()=>g(!1)})]}):null}function Le(e){let{useRecentNavigationSettings:t,setEnabled:n,t:r}=e,i=t(e=>e.value?.showRecentVisits??!0),c=Fe(e),[l,u]=(0,a.useState)(!1),[d,f]=(0,a.useState)(!1),p=(0,a.useRef)(!1);return/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[c.length>0&&/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,"data-navigation-focus-return":!0,className:Pe.trigger,"aria-label":r(i?`recent.collapse`:`recent.expand`),"aria-expanded":i,"aria-disabled":l||void 0,"aria-busy":l||void 0,onClick:()=>{p.current||(p.current=!0,u(!0),f(!1),n(!i).then(e=>f(!e)).catch(()=>f(!0)).finally(()=>{p.current=!1,u(!1)}))},children:/* @__PURE__ */ (0,s.jsx)(o.IconChevronDownOutlineRegular,{size:14,className:i?Pe.expanded:void 0})}),d&&/* @__PURE__ */ (0,s.jsx)(o.Toast,{text:r(`recent.settings.error`),onDone:()=>f(!1)})]})}function K(e){return e==null}function Re(e){return e&&typeof e==`object`&&!Array.isArray(e)}function ze(e,t){return Object.fromEntries(Object.entries(e).filter(([e,n])=>t(e,n)))}function q(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n,e)]))}function Be(e,t,n){if(!t)return{...e};let r={};for(let i of t)(n||e[i]!==void 0)&&(r[i]=e[i]);return r}let Ve=Symbol.for(`cosmokit.volatile.write`);function He(e,t=/* @__PURE__ */ new Set){if(typeof e==`function`)throw TypeError(`volatile config cannot contain functions`);if(typeof e!=`object`||!e)return e;if(t.has(e))throw TypeError(`volatile config cannot contain cycles`);t.add(e);try{if(Array.isArray(e))return Object.freeze(e.map(e=>He(e,t)));if(Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)throw TypeError(`volatile config objects must be plain objects or arrays`);return Object.freeze(Object.fromEntries(Object.entries(e).map(([e,n])=>[e,He(n,t)])))}finally{t.delete(e)}}function Ue(e){let t=He(e);return Object.freeze({get:()=>t,[Ve]:e=>{t=e}})}function We(e){return typeof e==`object`&&!!e&&Ve in e}function J(e,t){return arguments.length===1?t=>J(e,t):e in globalThis&&t instanceof globalThis[e]||Object.prototype.toString.call(t).slice(8,-1)===e}function Ge(e){return J(`ArrayBuffer`,e)||J(`SharedArrayBuffer`,e)}function Ke(e){return Ge(e)||ArrayBuffer.isView(e)}let qe;(function(e){e.is=Ge,e.isSource=Ke;function t(e){return ArrayBuffer.isView(e)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e}e.fromSource=t;function n(e){if(e=t(e),typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let n=``,r=new Uint8Array(e);for(let e=0;e<r.byteLength;e++)n+=String.fromCharCode(r[e]);return btoa(n)}e.toBase64=n;function r(e){return typeof Buffer<`u`?t(Buffer.from(e,`base64`)):Uint8Array.from(atob(e),e=>e.charCodeAt(0))}e.fromBase64=r;function i(e){return e=t(e),typeof Buffer<`u`?Buffer.from(e).toString(`hex`):Array.from(new Uint8Array(e),e=>e.toString(16).padStart(2,`0`)).join(``)}e.toHex=i;function a(e){if(typeof Buffer<`u`)return t(Buffer.from(e,`hex`));let n=e.length%2==0?e:e.slice(0,e.length-1),r=[];for(let e=0;e<n.length;e+=2)r.push(parseInt(`${n[e]}${n[e+1]}`,16));return Uint8Array.from(r).buffer}e.fromHex=a})(qe||={}),qe.fromBase64,qe.toBase64,qe.fromHex,qe.toHex;function Je(e,t=/* @__PURE__ */ new Map){if(!e||typeof e!=`object`)return e;if(J(`Date`,e))return new Date(e.valueOf());if(J(`RegExp`,e))return new RegExp(e.source,e.flags);if(Ge(e))return e.slice(0);if(ArrayBuffer.isView(e))return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);let n=t.get(e);if(n)return n;if(Array.isArray(e)){let n=[];return t.set(e,n),e.forEach((e,r)=>{n[r]=Reflect.apply(Je,null,[e,t])}),n}let r=Object.create(Object.getPrototypeOf(e));t.set(e,r);for(let n of Reflect.ownKeys(e)){let i={...Reflect.getOwnPropertyDescriptor(e,n)};`value`in i&&(i.value=Reflect.apply(Je,null,[i.value,t])),Reflect.defineProperty(r,n,i)}return r}function Ye(e,t,n){let r=/* @__PURE__ */ new Set;function i(e,t){if(e===t)return!0;if(We(e)||We(t))return We(e)&&We(t);if(!n&&K(e)&&K(t))return!0;if(typeof e!=typeof t||typeof e!=`object`||!e||!t||r.has(e))return!1;function a(n,r){return n(e)?n(t)?r(e,t):!1:!n(t)&&void 0}r.add(e);try{return a(Array.isArray,(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!i(e[n],t[n]))return!1;return!0})??a(J(`Date`),(e,t)=>e.valueOf()===t.valueOf())??a(J(`URL`),(e,t)=>e.href===t.href)??a(J(`RegExp`),(e,t)=>e.source===t.source&&e.flags===t.flags)??a(Ge,(e,t)=>{if(e.byteLength!==t.byteLength)return!1;let n=new Uint8Array(e),r=new Uint8Array(t);for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1;return!0})??((!n||[e,t].every(e=>Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null))&&Object.keys({...e,...t}).every(n=>i(e[n],t[n])))}finally{r.delete(e)}}return i(e,t)}let Xe;(function(e){e.millisecond=1;let t=e.second=1e3,n=e.minute=t*60,r=e.hour=n*60,i=e.day=r*24,a=e.week=i*7,o=(/* @__PURE__ */ new Date()).getTimezoneOffset();function s(e){o=e}e.setTimezoneOffset=s;function c(){return o}e.getTimezoneOffset=c;function l(e=/* @__PURE__ */ new Date,t){return typeof e==`number`&&(e=new Date(e)),t===void 0&&(t=o),Math.floor((e.valueOf()/n-t)/1440)}e.getDateNumber=l;function u(e,t){let r=new Date(e*i);return t===void 0&&(t=o),new Date(+r+t*n)}e.fromDateNumber=u;let d=RegExp(`^${[`w(?:eek(?:s)?)?`,`d(?:ay(?:s)?)?`,`h(?:our(?:s)?)?`,`m(?:in(?:ute)?(?:s)?)?`,`s(?:ec(?:ond)?(?:s)?)?`].map(e=>`(\\d+(?:\\.\\d+)?${e})?`).join(``)}$`);function f(e){let o=d.exec(e);return o?(parseFloat(o[1])*a||0)+(parseFloat(o[2])*i||0)+(parseFloat(o[3])*r||0)+(parseFloat(o[4])*n||0)+(parseFloat(o[5])*t||0):0}e.parseTime=f;function p(e){let t=f(e);return t?e=Date.now()+t:/^\d{1,2}(:\d{1,2}){1,2}$/.test(e)?e=`${(/* @__PURE__ */ new Date()).toLocaleDateString()}-${e}`:/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(e)&&(e=`${(/* @__PURE__ */ new Date()).getFullYear()}-${e}`),e?new Date(e):/* @__PURE__ */ new Date}e.parseDate=p;function m(e){let a=Math.abs(e);return a>=i-r/2?Math.round(e/i)+`d`:a>=r-n/2?Math.round(e/r)+`h`:a>=n-t/2?Math.round(e/n)+`m`:a>=t?Math.round(e/t)+`s`:e+`ms`}e.format=m;function h(e,t=2){return e.toString().padStart(t,`0`)}e.toDigits=h;function g(e,t=/* @__PURE__ */ new Date){return e.replace(`yyyy`,t.getFullYear().toString()).replace(`yy`,t.getFullYear().toString().slice(2)).replace(`MM`,h(t.getMonth()+1)).replace(`dd`,h(t.getDate())).replace(`hh`,h(t.getHours())).replace(`mm`,h(t.getMinutes())).replace(`ss`,h(t.getSeconds())).replace(`SSS`,h(t.getMilliseconds(),3))}e.template=g})(Xe||={});let Ze=Symbol.for(`schemastery`),Qe=Symbol.for(`ValidationError`);globalThis.__schemastery_index__??=0,globalThis.__schemastery_refs__=void 0;var Y=class extends TypeError{options;name=`ValidationError`;constructor(e,t){let n=`$`;for(let e of t.path||[])typeof e==`string`?n+=`.`+e:typeof e==`number`?n+=`[`+e+`]`:typeof e==`symbol`&&(n+=`[Symbol(${e.toString()})]`);n.startsWith(`.`)&&(n=n.slice(1)),super((n===`$`?``:`${n} `)+e),this.options=t}static is(e){return!!e?.[Qe]}};Object.defineProperty(Y.prototype,Qe,{value:!0});let X=function(e){let t=function(e,n={}){return X.resolve(e,t,n)[0]};if(e.refs){let t=q(e.refs,e=>new X(e)),n=e=>t[e];for(let e in t){let r=t[e];r.sKey=n(r.sKey),r.inner=n(r.inner),r.list=r.list&&r.list.map(n),r.dict=r.dict&&q(r.dict,n)}return t[e.uid]}if(Object.assign(t,e),typeof t.callback==`string`)try{t.callback=Function(`return `+t.callback)()}catch{}return Object.defineProperty(t,"uid",{value:globalThis.__schemastery_index__++}),Object.setPrototypeOf(t,X.prototype),t.meta||={},t.toString=t.toString.bind(t),t};X.prototype=Object.create(Function.prototype),X.prototype[Ze]=!0,Object.defineProperty(X.prototype,"~standard",{get(){return{version:1,vendor:`schemastery`,validate:e=>{try{return{value:X.resolve(e,this,{})[0]}}catch(e){if(Y.is(e))return{issues:[{message:e.message,path:e.options.path}]};throw e}}}}}),X.ValidationError=Y,X.prototype.toJSON=function(){if(globalThis.__schemastery_refs__)return globalThis.__schemastery_refs__[this.uid]??=JSON.parse(JSON.stringify({...this})),this.uid;globalThis.__schemastery_refs__={[this.uid]:{...this}},globalThis.__schemastery_refs__[this.uid]=JSON.parse(JSON.stringify({...this}));let e={uid:this.uid,refs:globalThis.__schemastery_refs__};return globalThis.__schemastery_refs__=void 0,e},X.prototype.set=function(e,t){return this.dict[e]=t,this},X.prototype.push=function(e){return this.list.push(e),this};function $e(e,t){let n=typeof e==`string`?{"":e}:{...e};for(let e in t){let r=t[e];r?.$description||r?.$desc?n[e]=r.$description||r.$desc:typeof r==`string`&&(n[e]=r)}return n}function et(e){return e?.$value??e?.$inner}function tt(e){return ze(e??{},e=>!e.startsWith(`$`))}X.prototype.i18n=function(e){let t=X(this),n=$e(t.meta.description,e);return Object.keys(n).length&&(t.meta.description=n),t.dict&&=q(t.dict,(t,n)=>t.i18n(q(e,e=>et(e)?.[n]??e?.[n]))),t.list&&=t.list.map((t,n)=>t.i18n(q(e,(e={})=>Array.isArray(et(e))?et(e)[n]:Array.isArray(e)?e[n]:tt(e)))),t.inner&&=t.inner.i18n(q(e,e=>et(e)?et(e):tt(e))),t.sKey&&=t.sKey.i18n(q(e,e=>e?.$key)),t},X.prototype.extra=function(e,t){let n=X(this);return n.meta={...n.meta,[e]:t},n};for(let e of[`required`,`disabled`,`collapse`,`hidden`,`loose`])Object.assign(X.prototype,{[e](t=!0){let n=X(this);return n.meta={...n.meta,[e]:t},n}});X.prototype.deprecated=function(){let e=X(this);return e.meta.badges||=[],e.meta.badges.push({text:`deprecated`,type:`danger`}),e},X.prototype.experimental=function(){let e=X(this);return e.meta.badges||=[],e.meta.badges.push({text:`experimental`,type:`warning`}),e},X.prototype.pattern=function(e){let t=X(this),n=Be(e,[`source`,`flags`]);return t.meta={...t.meta,pattern:n},t},X.prototype.simplify=function(e){if(We(e)&&(e=e.get()),Ye(e,this.meta.default,this.type===`dict`))return null;if(K(e))return e;if(this.type===`object`||this.type===`dict`){let t={};for(let n in e){let r=(this.type===`object`?this.dict[n]:this.inner)?.simplify(e[n]);(this.type===`dict`||!K(r))&&(t[n]=r)}return Ye(t,this.meta.default,this.type===`dict`)?null:t}if(this.type===`array`||this.type===`tuple`){let t=[];return e.forEach((e,n)=>{let r=this.type===`array`?this.inner:this.list[n],i=r?r.simplify(e):e;t.push(i)}),t}if(this.type===`intersect`){let t={};for(let n of this.list)Object.assign(t,n.simplify(e));return t}if(this.type===`union`)for(let t of this.list)try{return X.resolve(e,t,{}),t.simplify(e)}catch{}return e},X.prototype.toString=function(e){return ut[this.type]?.(this,e)??`Schema<${this.type}>`},X.prototype.role=function(e,t){let n=X(this);return n.meta={...n.meta,role:e,extra:t},n};for(let e of[`default`,`link`,`comment`,`description`,`max`,`min`,`step`])Object.assign(X.prototype,{[e](t){let n=X(this);return n.meta={...n.meta,[e]:t},n}});X.prototype.volatile=function(){if(this.meta.volatile)throw TypeError(`volatile schema is already wrapped`);return this.extra(`volatile`,!0)};let nt={},rt=Symbol(`checked-volatile-schema`);function it(e,t=[],n=!1,r=/* @__PURE__ */ new Map){let i=r.get(e)??/* @__PURE__ */ new Set;if(i.has(n))return;if(i.add(n),r.set(e,i),e.meta?.volatile&&n)throw new Y(`volatile fields require a fixed object path without an enclosing volatile field`,{path:t});let a=n||!!e.meta?.volatile;if(e.dict)for(let[n,i]of Object.entries(e.dict))it(i,[...t,n],a,r);if(e.sKey&&it(e.sKey,[...t,`<key>`],!0,r),e.inner&&(e.type!==`lazy`||e.inner[Ze])&&it(e.inner,[...t,`*`],!0,r),e.list)for(let n=0;n<e.list.length;n++)it(e.list[n],[...t,String(n)],!0,r)}X.extend=function(e,t){nt[e]=t},X.resolve=function(e,t,n={},r=!1){if(!t)return[e];if(n[rt]||(it(t,n.path),n={...n,[rt]:!0}),t.meta?.volatile){let i=X(t);i.meta={...t.meta,volatile:!1};let[a,o]=X.resolve(e,i,n,r);try{return[Ue(a),o]}catch(e){throw new Y(e instanceof Error?e.message:String(e),n)}}if(n.ignore?.(e,t))return[e];if(K(e)&&t.type!==`lazy`){if(t.meta.required)throw new Y(`missing required value`,n);let r=t,i=t.meta.default;for(;r?.type===`intersect`&&K(i);)r=r.list[0],i=r?.meta.default;if(K(i))return[e];e=Je(i)}let i=nt[t.type];if(!i)throw new Y(`unsupported type "${t.type}"`,n);try{return i(e,t,n,r)}catch(e){if(!t.meta.loose)throw e;return[t.meta.default]}},X.from=function(e){if(K(e))return X.any();if([`string`,`number`,`boolean`].includes(typeof e))return X.const(e).required();if(e[Ze])return e;if(typeof e==`function`)switch(e){case String:return X.string().required();case Number:return X.number().required();case Boolean:return X.boolean().required();case Function:return X.function().required();default:return X.is(e).required()}else throw TypeError(`cannot infer schema from ${e}`)},X.lazy=function(e){let t=new X({type:`lazy`,builder:e,inner:{toJSON:()=>(t.inner[Ze]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta}),t.inner.toJSON())}});return t},X.natural=function(){return X.number().step(1).min(0)},X.percent=function(){return X.number().step(.01).min(0).max(1).role(`slider`)},X.date=function(){return X.union([X.is(Date),X.transform(X.string().role(`datetime`),(e,t)=>{let n=new Date(e);if(isNaN(+n))throw new Y(`invalid date "${e}"`,t);return n},!0)])},X.regExp=function(e=``){return X.union([X.is(RegExp),X.transform(X.string().role(`regexp`,{flag:e}),(t,n)=>{try{return new RegExp(t,e)}catch(e){throw new Y(e.message,n)}},!0)])},X.arrayBuffer=function(e){return X.union([X.is(ArrayBuffer),X.is(SharedArrayBuffer),X.transform(X.any(),(e,t)=>{if(qe.isSource(e))return qe.fromSource(e);throw new Y(`expected ArrayBufferSource but got ${e}`,t)},!0),...e?[X.transform(X.string(),(t,n)=>{try{return e===`base64`?qe.fromBase64(t):qe.fromHex(t)}catch(e){throw new Y(e.message,n)}},!0)]:[]])},X.extend(`lazy`,(e,t,n,r)=>(t.inner[Ze]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta},it(t.inner,n.path,!0)),X.resolve(e,t.inner,n,r))),X.extend(`any`,e=>[e]),X.extend(`never`,(e,t,n)=>{throw new Y(`expected nullable but got ${e}`,n)}),X.extend(`const`,(e,{value:t},n)=>{if(Ye(e,t))return[t];throw new Y(`expected ${t} but got ${e}`,n)});function at(e,t,n,r,i=!1){let{max:a=1/0,min:o=-1/0}=t;if(e>a)throw new Y(`expected ${n} <= ${a} but got ${e}`,r);if(e<o&&!i)throw new Y(`expected ${n} >= ${o} but got ${e}`,r)}X.extend(`string`,(e,{meta:t},n)=>{if(typeof e!=`string`)throw new Y(`expected string but got ${e}`,n);if(t.pattern){let r=new RegExp(t.pattern.source,t.pattern.flags);if(!r.test(e))throw new Y(`expect string to match regexp ${r}`,n)}return at(e.length,t,`string length`,n),[e]});function ot(e,t){let n=e.toString();if(n.includes(`e`))return e*10**t;let r=n.indexOf(`.`);if(r===-1)return e*10**t;let i=n.slice(r+1),a=n.slice(0,r);return i.length<=t?+(a+i.padEnd(t,`0`)):+(a+i.slice(0,t)+`.`+i.slice(t))}function st(e,t,n){if(n=Math.abs(n),!/^\d+\.\d+$/.test(n.toString()))return(e-t)%n===0;let r=n.toString().indexOf(`.`),i=n.toString().slice(r+1).length;return Math.abs(ot(e,i)-ot(t,i))%ot(n,i)===0}X.extend(`number`,(e,{meta:t},n)=>{if(typeof e!=`number`)throw new Y(`expected number but got ${e}`,n);at(e,t,`number`,n);let{step:r}=t;if(r&&!st(e,t.min??0,r))throw new Y(`expected number multiple of ${r} but got ${e}`,n);return[e]}),X.extend(`boolean`,(e,t,n)=>{if(typeof e==`boolean`)return[e];throw new Y(`expected boolean but got ${e}`,n)}),X.extend(`bitset`,(e,{bits:t,meta:n},r)=>{let i=0,a=[];if(typeof e==`number`){i=e;for(let n in t)e&t[n]&&a.push(n)}else if(Array.isArray(e)){a=e;for(let e of a){if(typeof e!=`string`)throw new Y(`expected string but got ${e}`,r);e in t&&(i|=t[e])}}else throw new Y(`expected number or array but got ${e}`,r);return i===n.default?[i]:[i,a]}),X.extend(`function`,(e,t,n)=>{if(typeof e==`function`)return[e];throw new Y(`expected function but got ${e}`,n)}),X.extend(`is`,(e,{constructor:t},n)=>{if(typeof t==`function`){if(e instanceof t)return[e];throw new Y(`expected ${t.name} but got ${e}`,n)}{if(K(e))throw new Y(`expected ${t} but got ${e}`,n);let r=Object.getPrototypeOf(e);for(;r;){if(r.constructor?.name===t)return[e];r=Object.getPrototypeOf(r)}throw new Y(`expected ${t} but got ${e}`,n)}});function ct(e,t,n,r){try{let[i,a]=X.resolve(e[t],n,{...r,path:[...r.path||[],t]});return a!==void 0&&(e[t]=a),i}catch(i){if(!r?.autofix)throw i;return delete e[t],n.meta.volatile?Ue(n.meta.default):n.meta.default}}X.extend(`array`,(e,{inner:t,meta:n},r)=>{if(!Array.isArray(e))throw new Y(`expected array but got ${e}`,r);return at(e.length,n,`array length`,r,!K(t.meta.default)),[e.map((n,i)=>ct(e,i,t,r))]}),X.extend(`dict`,(e,{inner:t,sKey:n},r,i)=>{if(!Re(e))throw new Y(`expected object but got ${e}`,r);let a={};for(let o in e){let s;try{s=X.resolve(o,n,r)[0]}catch(e){if(i)continue;throw e}a[s]=ct(e,o,t,r),e[s]=e[o],o!==s&&delete e[o]}return[a]}),X.extend(`tuple`,(e,{list:t},n,r)=>{if(!Array.isArray(e))throw new Y(`expected array but got ${e}`,n);let i=t.map((t,r)=>ct(e,r,t,n));return r||i.push(...e.slice(t.length)),[i]});function lt(e,t){for(let n in t)n in e||(e[n]=t[n])}X.extend(`object`,(e,{dict:t},n,r)=>{if(!Re(e))throw new Y(`expected object but got ${e}`,n);let i={};for(let r in t){let a=ct(e,r,t[r],n);(!K(a)||r in e)&&(i[r]=a)}return r||lt(i,e),[i]}),X.extend(`union`,(e,{list:t,toString:n},r,i)=>{let a=[];for(let n of t)try{return X.resolve(e,n,r,i)}catch(e){a.push(e)}throw new Y(`expected ${n()} but got ${JSON.stringify(e)}`,r)}),X.extend(`intersect`,(e,{list:t,toString:n},r,i)=>{if(!t.length)return[e];let a;for(let i of t){let t=X.resolve(e,i,r,!0)[0];if(!K(t)){if(K(a))a=t;else if(typeof a!=typeof t)throw new Y(`expected ${n()} but got ${JSON.stringify(e)}`,r);else if(typeof t==`object`)lt(a??={},t);else if(a!==t)throw new Y(`expected ${n()} but got ${JSON.stringify(e)}`,r)}}return!i&&Re(e)&<(a,e),[a]}),X.extend(`transform`,(e,{inner:t,callback:n,preserve:r},i)=>{let[a,o=e]=X.resolve(e,t,i,!0);return r?[n(a)]:[n(a),n(o)]});let ut={};function Z(e,t,n){ut[e]=n,Object.assign(X,{[e](...n){let r=new X({type:e});return t.forEach((e,t)=>{switch(e){case`sKey`:r.sKey=n[t]??X.string();break;case`inner`:r.inner=X.from(n[t]);break;case`list`:r.list=n[t].map(X.from);break;case`dict`:r.dict=q(n[t],X.from);break;case`bits`:r.bits={};for(let e in n[t])typeof n[t][e]==`number`&&(r.bits[e]=n[t][e]);break;case`callback`:{let e=r.callback=n[t];e.toJSON||=()=>e.toString();break}case`constructor`:{let e=r.constructor=n[t];typeof e==`function`&&(e.toJSON||=()=>e.name);break}default:r[e]=n[t]}}),e===`object`||e===`dict`?r.meta.default={}:e===`array`||e===`tuple`?r.meta.default=[]:e===`bitset`&&(r.meta.default=0),r}})}Z(`is`,[`constructor`],({constructor:e})=>typeof e==`function`?e.name:e),Z(`any`,[],()=>`any`),Z(`never`,[],()=>`never`),Z(`const`,[`value`],({value:e})=>typeof e==`string`?JSON.stringify(e):e),Z(`string`,[],()=>`string`),Z(`number`,[],()=>`number`),Z(`boolean`,[],()=>`boolean`),Z(`bitset`,[`bits`],()=>`bitset`),Z(`function`,[],()=>`function`),Z(`array`,[`inner`],({inner:e})=>`${e.toString(!0)}[]`),Z(`dict`,[`inner`,`sKey`],({inner:e,sKey:t})=>`{ [key: ${t.toString()}]: ${e.toString()} }`),Z(`tuple`,[`list`],({list:e})=>`[${e.map(e=>e.toString()).join(`, `)}]`),Z(`object`,[`dict`],({dict:e})=>Object.keys(e).length===0?`{}`:`{ ${Object.entries(e).map(([e,t])=>`${e}${t.meta.required?``:`?`}: ${t.toString()}`).join(`, `)} }`),Z(`union`,[`list`],({list:e},t)=>{let n=e.map(({toString:e})=>e()).join(` | `);return t?`(${n})`:n}),Z(`intersect`,[`list`],({list:e})=>`${e.map(e=>e.toString(!0)).join(` & `)}`),Z(`transform`,[`inner`,`callback`,`preserve`],({inner:e},t)=>e.toString(t));let dt=[0,15,30,60,120,240,1440],ft={showRecentVisits:!0,tabIdleTimeoutMinutes:60},pt=X.object({showRecentVisits:X.boolean().default(!0),tabIdleTimeoutMinutes:X.natural().max(1440).default(60)}),mt=`@deepseek-ai/dsh-client-ui-workspace/RecentNavigationRow.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(mt)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=mt,e.textContent=`.s99QdG_row{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px 16px;padding:16px 0;display:flex}.s99QdG_text{flex:160px;min-width:0}.s99QdG_timeoutRow{border-top:.5px solid var(--dsw-alias-border-l2)}.s99QdG_menu{flex:none;margin-inline-start:auto}.s99QdG_selector{background:var(--dsw-alias-bg-module-platform);min-width:96px;min-height:44px;color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;border:0;border-radius:8px;justify-content:space-between;align-items:center;gap:8px;padding:0 12px;font-size:14px;line-height:20px;display:inline-flex}.s99QdG_selector:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:2px}.s99QdG_selector:disabled{opacity:.5;cursor:not-allowed}@media (hover:hover){.s99QdG_selector:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}}.s99QdG_error{padding-bottom:12px;font-size:12px;line-height:18px}.s99QdG_titleLine{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.s99QdG_title{font-size:14px;line-height:20px}.s99QdG_description{color:var(--dsw-alias-label-secondary);margin-top:4px;font-size:12px;line-height:18px}`,document.head.appendChild(e)}var ht={description:`s99QdG_description`,error:`s99QdG_error`,menu:`s99QdG_menu`,row:`s99QdG_row`,selector:`s99QdG_selector`,text:`s99QdG_text`,timeoutRow:`s99QdG_timeoutRow`,title:`s99QdG_title`,titleLine:`s99QdG_titleLine`};function gt({usePreference:e,setEnabled:t,setIdleTimeout:n,t:r}){let i=e(e=>e.value),c=i?.showRecentVisits??!0,l=i?.tabIdleTimeoutMinutes??60,[u,d]=(0,a.useState)(!1),[f,p]=(0,a.useState)(!1),[m,h]=(0,a.useState)(!1),g=(0,a.useRef)(!1),_=(0,a.useId)();(0,a.useEffect)(()=>{c||d(!1)},[c]);let v=e=>e===0?r(`recent.timeout.off`):e>=120&&e%60==0?r(`recent.timeout.hours`,{n:e/60}):r(`recent.timeout.minutes`,{n:e}),y=e=>{g.current||(g.current=!0,d(!1),p(!0),h(!1),Promise.resolve().then(e).then(e=>h(!e)).catch(()=>h(!0)).finally(()=>{g.current=!1,p(!1)}))};return/* @__PURE__ */ (0,s.jsxs)(`div`,{children:[/* @__PURE__ */ (0,s.jsxs)(`div`,{className:ht.row,children:[/* @__PURE__ */ (0,s.jsxs)(`div`,{className:ht.text,children:[/* @__PURE__ */ (0,s.jsxs)(`div`,{className:ht.titleLine,children:[/* @__PURE__ */ (0,s.jsx)(`span`,{className:ht.title,children:r(`recent.settings.title`)}),/* @__PURE__ */ (0,s.jsx)(o.Tag,{tone:`neutral`,children:r(`recent.settings.mobile`)})]}),/* @__PURE__ */ (0,s.jsx)(`div`,{className:ht.description,children:r(`recent.settings.description`)})]}),/* @__PURE__ */ (0,s.jsx)(o.Switch,{checked:c,disabled:f,label:`${r(`recent.settings.title`)} · ${r(`recent.settings.mobile`)}`,onChange:e=>y(()=>t(e))})]}),c&&/* @__PURE__ */ (0,s.jsxs)(`div`,{className:`${ht.row} ${ht.timeoutRow}`,children:[/* @__PURE__ */ (0,s.jsx)(`div`,{className:ht.text,children:/* @__PURE__ */ (0,s.jsx)(`div`,{className:ht.title,id:`${_}-label`,children:r(`recent.timeout.title`)})}),/* @__PURE__ */ (0,s.jsx)(o.Menu,{className:ht.menu,open:u&&c&&!f,onClose:()=>d(!1),items:dt.map(e=>({id:String(e),label:e===60?r(`recent.timeout.default`,{value:v(e)}):v(e)})),selectedId:String(l),onSelect:e=>{let t=dt.find(t=>String(t)===e);t!==void 0&&y(()=>n(t))},align:`end`,portal:!0,anchor:/* @__PURE__ */ (0,s.jsxs)(`button`,{type:`button`,className:ht.selector,disabled:!c||f,"aria-labelledby":`${_}-label ${_}-value`,"aria-haspopup":`menu`,"aria-expanded":u&&c&&!f,onClick:()=>d(e=>!e),children:[/* @__PURE__ */ (0,s.jsx)(`span`,{id:`${_}-value`,children:v(l)}),/* @__PURE__ */ (0,s.jsx)(o.IconChevronDownOutlineRegular,{size:14})]})})]}),m&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:ht.error,role:`alert`,children:r(`recent.settings.error`)})]})}function _t(e,t){let n=e.configForms.registerBrowser(`ui-workspace`,pt.toJSON(),ft),r=e=>n.set(`showRecentVisits`,e),i=e=>n.set(`tabIdleTimeoutMinutes`,e),a={scrollLeft:0};e.inject([`uiSession`,`connection`],e=>{e.effect(()=>{let r,i=()=>{let r=n.getSnapshot().value;r!==void 0&&document.visibilityState===`visible`&&e.connection.state.getSnapshot()===`connected`&&r.showRecentVisits&&r.tabIdleTimeoutMinutes!==0&&t.opening.getSnapshot().state!==`loading`&&t.recentVisits.expireInactive(r.tabIdleTimeoutMinutes*6e4,e.uiSession.sessionStatus.getSnapshot())&&t.recentVisits.entries.getSnapshot().length===0&&(a.scrollLeft=0)},o=()=>{r!==void 0&&clearInterval(r),r=void 0;let e=n.getSnapshot().value;document.visibilityState===`visible`&&e?.showRecentVisits&&e.tabIdleTimeoutMinutes>0&&(r=setInterval(i,6e4))},s=n.subscribe(o);return document.addEventListener(`visibilitychange`,o),o(),()=>{s(),r!==void 0&&clearInterval(r),document.removeEventListener(`visibilitychange`,o)}},`ui-workspace: idle session tabs`)});let o=()=>({hooks:{visits:t.recentVisits.entries,recentNavigationSettings:n},open:e=>t.openSession(e),close:e=>{t.closeSessionTab(e),t.recentVisits.entries.getSnapshot().length===0&&(a.scrollLeft=0)},viewport:a,setEnabled:r});e.slots.inject(`conversation.header.navigation`,()=>e.slots.register({name:`conversation.header.navigation`,locale:`workspace`,inject:o},Le)),e.slots.inject(`conversation.header.shortcuts`,()=>e.slots.register({name:`conversation.header.shortcuts`,locale:`workspace`,inject:o,children:{"workspace.recent.shortcut.identity":{kind:`list`,scope:`root`}}},Ie)),e.slots.inject(`settings.general.item`,()=>e.slots.register({name:`settings.general.item`,id:`workspace.recent-navigation`,order:12,locale:`workspace`,inject:()=>({hooks:{preference:n},setEnabled:r,setIdleTimeout:i})},gt))}function vt(e,t,n){let r=e.find(e=>e.workspaceId===t),i=e.find(e=>e.workspaceId===n);return r!==void 0&&i!==void 0&&!r.remote&&!i.remote}function yt(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=yt(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function Q(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=yt(e))&&(r&&(r+=` `),r+=t);return r}function bt(e,t){return e===`default-workspace`?t:e}function xt({identity:e,ambient:t,title:n,onTitleDoubleClick:r,children:i}){return/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsxs)(`span`,{className:W.slot,children:[e,/* @__PURE__ */ (0,s.jsx)(`span`,{className:W.statusOverlay,children:t})]}),/* @__PURE__ */ (0,s.jsx)(`span`,{"data-session-title":!0,className:W.title,onDoubleClick:r,children:n}),i]})}function St({host:e,t}){let n=e?.displayName??t(`host.local`),r=e?.state===`connected`?t(`host.connected`):e?.state===`connecting`?t(`host.connecting`):t(`host.disconnected`),i=e?`${n} · ${r}`:n;return/* @__PURE__ */ (0,s.jsxs)(`span`,{className:W.hostBadge,"data-host-id":e?.hostId??`local`,"data-state":e?.state??`local`,role:`img`,"aria-label":i,title:i,children:[/* @__PURE__ */ (0,s.jsx)(`span`,{children:n}),e&&/* @__PURE__ */ (0,s.jsx)(`span`,{className:W.hostDot,"aria-hidden":`true`})]})}function Ct(e,t){return e.blank?t(`session.new`):e.title||t(`session.untitled`)}function wt(e,t,n){let{unit:r,n:i}=(0,o.relativeTime)(e,t);return r===`now`?n(`time.now`):n(`time.${r}`,{n:i})}function Tt(e,t,n){let{unit:r,n:i}=(0,o.relativeTime)(e,t);return r===`now`?n(`time.now`):n(`time.ago`,{t:n(`time.${r}`,{n:i})})}function Et(e,t){let n=new Date(e),r=e=>String(e).padStart(2,`0`);return t(`hover.created`,{time:`${t(`date.ymd`,{y:n.getFullYear(),m:n.getMonth()+1,d:n.getDate()})} ${r(n.getHours())}:${r(n.getMinutes())}`})}function Dt({label:e,cwd:t,createdAt:n,t:r}){return/* @__PURE__ */ (0,s.jsxs)(`div`,{className:W.hoverContent,children:[/* @__PURE__ */ (0,s.jsx)(`div`,{className:W.hoverTitle,children:e}),/* @__PURE__ */ (0,s.jsx)(`div`,{className:W.hoverPath,children:t}),/* @__PURE__ */ (0,s.jsx)(`div`,{className:W.hoverTime,children:Et(n,r)})]})}function Ot(e){let t=e.currentTarget.getBoundingClientRect();return e.clientY<t.top+t.height/2?`before`:`after`}function kt({group:e,onToggle:t,onCreate:n,actions:r,drag:i,home:c,newShortcut:l,t:u}){let d=e,f=e.remote?void 0:r,p=e.remote?void 0:i,m=d.workspaceId===void 0?u(`group.ungrouped`):d.label,[h,g]=(0,a.useState)(!1),[v,y]=(0,a.useState)(null),b=[{id:`rename`,label:u(`rename`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconEditOutlineRegular,{})},{id:`delete`,label:u(`delete.workspace`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconTrashOutlineRegular,{}),danger:!0}],x=/* @__PURE__ */ (0,s.jsxs)(`div`,{className:Q(W.projectRow,h&&W.menuOpen),"data-row-key":`workspace:${e.key}`,role:`treeitem`,"aria-expanded":d.expanded,tabIndex:-1,onContextMenu:e=>{f&&!e.target.closest(`button`)&&(e.preventDefault(),y(new DOMRect(e.clientX,e.clientY,0,0)),g(!0))},onKeyDown:e=>{e.target===e.currentTarget&&f&&(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`)&&(e.preventDefault(),y(null),g(!0))},onClick:t,draggable:p!==void 0,onDragStart:p===void 0?void 0:e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,d.key),p.start()},onDragEnd:p?.end,children:[/* @__PURE__ */ (0,s.jsx)(`span`,{className:Q(W.slot,d.expanded&&W.folderExpanded),children:d.expanded?/* @__PURE__ */ (0,s.jsx)(o.IconFolderOpenRegular,{}):/* @__PURE__ */ (0,s.jsx)(o.IconFolderCloseRegular,{})}),/* @__PURE__ */ (0,s.jsx)(`span`,{className:W.projectText,children:/* @__PURE__ */ (0,s.jsx)(`span`,{className:W.title,children:m})}),d.workspaceId!==void 0&&/* @__PURE__ */ (0,s.jsx)(St,{host:d.remote,t:u}),/* @__PURE__ */ (0,s.jsxs)(`span`,{className:W.rowActions,children:[f!==void 0&&/* @__PURE__ */ (0,s.jsx)(o.Menu,{open:h,onClose:()=>{g(!1)},items:b,onSelect:e=>{
|
|
10
10
|
/* v8 ignore next -- Menu can emit only the rename and delete rows supplied above. */
|
|
11
|
-
m(!1),(e===`rename`||e===`delete`)&&(e===`rename`?r.rename():r.delete())},portal:!0,autoFocus:!0,getAnchorRect:h===null?void 0:()=>h,anchor:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:q.iconButton,"aria-label":u(`actions.workspace.aria`,{name:f}),"aria-haspopup":`menu`,"aria-expanded":p,onClick:e=>{e.stopPropagation(),g(null),m(e=>!e)},children:/* @__PURE__ */ (0,s.jsx)(o.IconEllipsisOutlineRegular,{})})}),/* @__PURE__ */ (0,s.jsx)(o.Tooltip,{label:u(`actions.newSession`),shortcutKeys:l?.keys,side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:q.iconButton,"aria-keyshortcuts":l?.aria,"aria-label":u(`actions.newSession.aria`,{name:f}),onClick:e=>{e.stopPropagation(),n()},children:/* @__PURE__ */ (0,s.jsx)(o.IconNewChatOutlineRegular,{})})})]})]});return d.createdAt===void 0?y:/* @__PURE__ */ (0,s.jsx)(o.HoverCard,{anchor:y,content:/* @__PURE__ */ (0,s.jsx)(J,{label:d.label,cwd:d.cwd===void 0?void 0:_(d.cwd,c),createdAt:d.createdAt,t:u}),openDelayMs:800,disabled:p,copyText:d.cwd,copyLabel:u(`copy`),copiedLabel:u(`hover.copied`)})}
|
|
12
|
-
/* v8 ignore next 3 -- closed-union backstop; only reached if the status is forged */
|
|
13
|
-
function be(e){throw Error(`unknown pending interaction: ${String(e)}`)}function xe(e,t){let n=e.runningSubagentCount===0?void 0:{state:`ongoing`,label:t(e.runningSubagentCount===1?`status.subagentsRunning.one`:`status.subagentsRunning.other`,{n:e.runningSubagentCount})},r;switch(e.pendingInteraction){case`approval`:r={state:`warning`,label:t(`status.waitingApproval`),trailingLabel:t(`status.compact.approval`)};break;case`plan-review`:r={state:`warning`,label:t(`status.planReview`),trailingLabel:t(`status.compact.planReview`)};break;case`question`:r={state:`warning`,label:t(`status.waitingAnswer`),trailingLabel:t(`status.compact.answer`)};break;case void 0:break;
|
|
14
|
-
/* v8 ignore next -- closed PendingInteractionStatus union */
|
|
15
|
-
default:return be(e.pendingInteraction)}if(r!==void 0)return n===void 0?[r]:[r,n];if(e.running){let e={state:`ongoing`,label:t(`status.running`)};return n===void 0?[e]:[e,n]}return n===void 0?e.completed?[{state:`done`,label:t(`status.completed`)}]:[{state:`idle`,label:t(`status.idle`)}]:[n]}function Se({statuses:e}){return/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(o.StateDot,{state:e[0].state,size:e[0].state===`ongoing`?16:void 0}),e.map(e=>/* @__PURE__ */ (0,s.jsx)(`span`,{className:q.visuallyHidden,children:e.label},e.label))]})}function Ce({node:e,now:t,renderSlot:n,t:r}){let i=xe(e,r).filter(t=>!e.archived||t.state!==`done`&&t.state!==`idle`);return/* @__PURE__ */ (0,s.jsxs)(`div`,{className:q.hoverContent,children:[/* @__PURE__ */ (0,s.jsx)(`div`,{className:q.hoverTitle,children:me(e,r)}),!e.blank&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:q.hoverTime,children:ge(e.updatedAt,t,r)}),n(`sidebar.session.row.hover`,{sessionId:e.id}),i.map(e=>/* @__PURE__ */ (0,s.jsxs)(`div`,{className:q.hoverStatus,children:[/* @__PURE__ */ (0,s.jsx)(o.StateDot,{state:e.state}),/* @__PURE__ */ (0,s.jsx)(`span`,{children:e.label})]},e.label)),e.archived&&/* @__PURE__ */ (0,s.jsxs)(`div`,{className:K(q.hoverStatus,q.hoverArchived),children:[/* @__PURE__ */ (0,s.jsx)(o.IconArchiveOutlineRegular,{size:16}),/* @__PURE__ */ (0,s.jsx)(`span`,{children:r(`row.archived`)})]})]})}function we({result:e,currentId:t,onOpen:n,onUnarchive:r,t:i}){let a=e.id===t,c=xe(e,i),l=c[0];return/* @__PURE__ */ (0,s.jsxs)(`div`,{className:K(q.searchResultRow,a&&q.selected,e.archived&&q.archived),role:`treeitem`,"aria-selected":a,"aria-description":e.archived?i(`toast.archivedNotOpenable`):void 0,onClick:()=>{n(e.id)},children:[/* @__PURE__ */ (0,s.jsxs)(`span`,{className:q.searchResultHeading,children:[/* @__PURE__ */ (0,s.jsx)(`span`,{className:q.slot}),/* @__PURE__ */ (0,s.jsx)(`span`,{className:q.searchResultTitle,children:e.title||i(`session.untitled`)}),!e.archived&&l.state!==`idle`&&/* @__PURE__ */ (0,s.jsx)(`span`,{className:q.timeStatus,"data-session-status":l.state,children:/* @__PURE__ */ (0,s.jsx)(Se,{statuses:c})}),e.archived&&/* @__PURE__ */ (0,s.jsx)(`span`,{className:q.rowActions,children:/* @__PURE__ */ (0,s.jsx)(o.Tooltip,{label:i(`actions.unarchive`),side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:q.iconButton,"aria-label":i(`menu.unarchiveSession`),onClick:t=>{t.stopPropagation(),r(e.id)},children:/* @__PURE__ */ (0,s.jsx)(o.IconUnarchiveOutlineRegular,{size:16})})})})]}),/* @__PURE__ */ (0,s.jsxs)(`span`,{className:q.searchResultMeta,children:[/* @__PURE__ */ (0,s.jsx)(`span`,{className:q.searchResultWorkspace,children:e.workspace||i(`group.ungrouped`)}),e.snippet!==void 0&&/* @__PURE__ */ (0,s.jsx)(`span`,{className:q.searchResultSnippet,children:e.snippet})]})]})}function Te({node:e,rowKey:t=`session:${e.id}`,currentId:n,now:r,onOpen:i,onRenameRequest:c,renderSlot:l,onReveal:u,drag:d,t:f}){let p=e,m=me(e,f),h=e.id===n,g=xe(e,f),_=g[0],v=!p.archived&&_.state!==`idle`,y=d!==void 0&&!p.blank&&!p.archived,b=p.blank?void 0:p.reference,S=y||b!==void 0,C=(0,a.useRef)(!1),[w,T]=(0,a.useState)(!1),[E,D]=(0,a.useState)(null),O=(0,a.useMemo)(()=>[w,T],[w]),k=(0,a.useRef)(null);(0,a.useEffect)(()=>{u!==void 0&&(k.current?.scrollIntoView({block:`nearest`}),u())},[u]);let A=/* @__PURE__ */ (0,s.jsxs)(`div`,{ref:k,"data-row-key":t,className:K(q.sessionRow,h&&q.selected,w&&q.menuOpen,p.archived&&q.archived,d?.marker===`before`&&q.dropBefore,d?.marker===`after`&&q.dropAfter),role:`treeitem`,"aria-selected":h,"aria-current":h?`page`:void 0,tabIndex:-1,onContextMenu:e=>{p.blank||e.target.closest(`button`)||(e.preventDefault(),D(new DOMRect(e.clientX,e.clientY,0,0)),T(!0))},onKeyDown:t=>{t.target!==t.currentTarget||p.blank||(C.current=!1,t.key===`ContextMenu`||t.shiftKey&&t.key===`F10`?(t.preventDefault(),D(null),T(!0)):t.key===`F2`&&!p.archived&&(t.preventDefault(),c(e.id,p.title)))},"aria-description":p.archived?f(`toast.archivedNotOpenable`):void 0,onPointerDown:()=>{C.current=!1},onClick:()=>{C.current||i(e.id)},draggable:S,onDragStart:S?t=>{C.current=!0,t.dataTransfer.effectAllowed=b===void 0?`move`:y?`copyMove`:`copy`,t.dataTransfer.setData(`text/plain`,b===void 0?e.id:x(b).clipboardText),b!==void 0&&t.dataTransfer.setData(`application/x-codexhost-thread-reference`,JSON.stringify(b)),y&&d?.start()}:void 0,onDragEnd:S?e=>d?.end(e.dataTransfer.dropEffect===`copy`):void 0,onDragOver:d===void 0?void 0:e=>{d.active&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,d.hover(ve(e)))},onDrop:d===void 0?void 0:e=>{d.active&&(e.preventDefault(),d.drop(ve(e)))},children:[/* @__PURE__ */ (0,s.jsxs)(`span`,{className:q.slot,children:[l(`sidebar.session.row.identity`,{sessionId:e.id}),/* @__PURE__ */ (0,s.jsx)(`span`,{className:q.statusOverlay,children:!p.archived&&!p.blank&&!v&&l(`sidebar.session.row.leading`,{sessionId:e.id})})]}),/* @__PURE__ */ (0,s.jsx)(`span`,{"data-session-title":!0,className:q.title,onDoubleClick:p.blank?void 0:t=>{t.stopPropagation(),c(e.id,p.title)},children:m}),/* @__PURE__ */ (0,s.jsxs)(`span`,{className:q.trailing,children:[!p.blank&&/* @__PURE__ */ (0,s.jsx)(`span`,{className:K(q.time,v&&q.timeStatus),"data-session-status":v?_.state:void 0,children:v?/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(Se,{statuses:g}),_.trailingLabel!==void 0&&/* @__PURE__ */ (0,s.jsx)(`span`,{"aria-hidden":`true`,children:_.trailingLabel})]}):he(p.updatedAt,r,f)}),!p.blank&&/* @__PURE__ */ (0,s.jsxs)(`span`,{className:q.rowActions,onClick:e=>{e.stopPropagation()},children:[/* @__PURE__ */ (0,s.jsx)(o.Menu,{open:w,onClose:()=>{T(!1)},portal:!0,autoFocus:!0,phoneSidebarTitle:m,phoneSidebarFooterBackLabel:f(`session.backToList`),phoneSidebarDetails:/* @__PURE__ */ (0,s.jsx)(`div`,{className:q.phoneDetails,children:/* @__PURE__ */ (0,s.jsx)(Ce,{node:e,now:r,renderSlot:l,t:f})}),getAnchorRect:E===null?void 0:()=>E,anchor:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:q.iconButton,"aria-label":f(`actions.session.aria`,{name:m}),"aria-haspopup":`menu`,"aria-expanded":w,onClick:()=>{D(null),T(e=>!e)},children:/* @__PURE__ */ (0,s.jsx)(o.IconEllipsisOutlineRegular,{})}),children:l(`sidebar.workspaces.session.menu.item`,{sessionId:e.id,displayTitle:p.title},{hookContext:O})}),/* @__PURE__ */ (0,s.jsx)(`span`,{className:q.quickActions,children:l(`sidebar.workspaces.session.row.action`,{sessionId:e.id,displayTitle:p.title})})]})]})]});return/* @__PURE__ */ (0,s.jsx)(o.HoverCard,{anchor:A,content:/* @__PURE__ */ (0,s.jsx)(Ce,{node:e,now:r,renderSlot:l,t:f}),openDelayMs:800,disabled:w||d?.active===!0,copyText:p.blank||p.title===``?void 0:p.title,copyLabel:f(`copy`),copiedLabel:f(`hover.copied`)})}let Y=`@deepseek-ai/dsh-client-ui-workspace/AnimatedRows.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Y)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Y,e.textContent=`.ZhksEq_exits{contain:strict;pointer-events:none;position:absolute;inset:0;overflow:clip}`,document.head.appendChild(e)}var Ee={exits:`ZhksEq_exits`};function De(e){return[...e.querySelectorAll(`[data-row-key]`)].filter(e=>e.offsetHeight>0&&!e.closest(`[inert]`))}function Oe(e){if(!e)return;let t=De(e),n=document.activeElement?.closest(`[data-row-key]`),r=t.find(e=>e===n)??t.find(e=>e.getAttribute(`aria-selected`)===`true`)??t[0];for(let e of t)e.tabIndex=e===r?0:-1}function X(e){if(e.defaultPrevented||e.nativeEvent.isComposing||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let t=e.currentTarget,n=e.target;if(!(n instanceof HTMLElement)||!n.matches(`[data-row-key]`)||!t.contains(n))return;let r=De(t),i=r.indexOf(n);if(i<0)return;let a=n.matches(`[role="treeitem"][aria-expanded]`),o;switch(e.key){case`ArrowDown`:o=r[i+1];break;case`ArrowUp`:o=r[i-1];break;case`Home`:o=r[0];break;case`End`:o=r.at(-1);break;case`ArrowRight`:a&&n.getAttribute(`aria-expanded`)===`false`?n.click():a&&(o=r[i+1]);break;case`ArrowLeft`:if(a&&n.getAttribute(`aria-expanded`)===`true`)n.click();else{let e=n.closest(`[data-sidebar-group]`),t=e?.querySelector(`[data-row-key^="workspace:"]`);t===n&&(e=e?.parentElement?.closest(`[data-sidebar-group]`)??null,t=e?.querySelector(`[data-row-key^="workspace:"]`)),o=t??void 0}break;case`Enter`:case` `:n.click();break;default:return}e.preventDefault(),o&&(o.focus({preventScroll:!0}),o.scrollIntoView({block:`nearest`}),Oe(t))}function ke(e,t){return e.rowKeys.length===t.rowKeys.length&&e.rowKeys.every((e,n)=>e===t.rowKeys[n])}function Ae(e,t){return e.bottom>t.top&&e.top<t.bottom&&e.right>t.left&&e.left<t.right}var je=class extends a.Component{armed=!1;list=(0,a.createRef)();overlay=(0,a.createRef)();movements=/* @__PURE__ */ new Map;exits=/* @__PURE__ */ new Map;componentDidMount(){Oe(this.list.current)}getSnapshotBeforeUpdate(e){let t=this.list.current;if(!this.armed||ke(e,this.props)||e.resetKey!==this.props.resetKey||!e.ready||!this.props.ready||t===null||typeof t.animate!=`function`||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return null;let n=t.getBoundingClientRect(),r=this.readPositions(),i=new Set(this.props.rowKeys),a=/* @__PURE__ */ new Map;for(let[e,t]of r){if(i.has(e)||!Ae(t.rect,n))continue;let r=t.element.cloneNode(!0);r.removeAttribute(`data-row-key`),r.inert=!0,r.style.setProperty(`--dsh-workspace-indent`,getComputedStyle(t.element).getPropertyValue(`--dsh-workspace-indent`)),a.set(e,{...t,element:r})}return{positions:r,removed:a}}componentDidUpdate(e,t,n){if(Oe(this.list.current),n===null){(!ke(e,this.props)||e.resetKey!==this.props.resetKey||e.ready!==this.props.ready)&&this.clear();return}this.cancelMovements();let r=this.list.current,i=this.overlay.current,a=r.getBoundingClientRect(),o=i.getBoundingClientRect(),s=this.readPositions();for(let[e,t]of s){this.removeExit(e);let r=n.positions.get(e);if(!Ae(t.rect,a)&&(r===void 0||!Ae(r.rect,a)))continue;if(r===void 0){this.move(t.element,[{opacity:0},{opacity:1}],100);continue}let i=r.rect.left-t.rect.left,o=r.rect.top-t.rect.top;(i!==0||o!==0||r.opacity!==1)&&this.move(t.element,[{transform:`translate(${String(i)}px, ${String(o)}px)`,opacity:r.opacity},{transform:`translate(0, 0)`,opacity:1}],200)}for(let[e,t]of n.removed){let{element:n}=t;this.removeExit(e),Object.assign(n.style,{position:`absolute`,margin:`0`,transform:`none`,boxSizing:`border-box`,left:`${String(t.rect.left-o.left)}px`,top:`${String(t.rect.top-o.top)}px`,width:`${String(t.rect.width)}px`,height:`${String(t.rect.height)}px`}),i.append(n);let r=n.animate([{opacity:t.opacity},{opacity:0}],{duration:100,easing:`ease-out`,fill:`forwards`});this.exits.set(e,{element:n,animation:r}),r.onfinish=()=>{this.removeExit(e)}}}componentWillUnmount(){this.clear()}readPositions(){let e=this.list.current.querySelectorAll(`[data-row-key]`);return new Map(Array.from(e,e=>[e.dataset.rowKey,{element:e,rect:e.getBoundingClientRect(),opacity:this.movements.has(e)?Number(getComputedStyle(e).opacity):1}]))}move(e,t,n){let r=e.animate(t,{duration:n,easing:`ease-out`});this.movements.set(e,r),r.onfinish=()=>{this.movements.delete(e),r.cancel()}}cancelMovements(){for(let e of this.movements.values())e.onfinish=null,e.cancel();this.movements.clear()}removeExit(e){let t=this.exits.get(e);t!==void 0&&(t.animation.onfinish=null,t.animation.cancel(),t.element.remove(),this.exits.delete(e))}clear(){this.cancelMovements();for(let e of this.exits.keys())this.removeExit(e)}render(){return/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(`div`,{ref:this.list,className:this.props.className,role:`tree`,"aria-label":this.props.label,onKeyDown:X,onFocusCapture:()=>Oe(this.list.current),onPointerDownCapture:()=>{this.armed=!0},onKeyDownCapture:()=>{this.armed=!0},children:this.props.children}),/* @__PURE__ */ (0,s.jsx)(`div`,{ref:this.overlay,className:Ee.exits,"aria-hidden":`true`})]})}};let Z=`@deepseek-ai/dsh-client-ui-workspace/SectionHeading.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Z)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Z,e.textContent=`.LgoPOW_heading{border-radius:var(--dsw-radius-sm);min-height:30px;color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;padding:0 8px;font-size:14px;font-weight:500;line-height:21px;display:flex}.LgoPOW_heading[data-row-key]{cursor:pointer}.LgoPOW_heading[data-row-key]:hover{background:var(--dsw-alias-interactive-bg-hover)}.LgoPOW_heading[data-row-key]:focus-visible,.LgoPOW_action:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.LgoPOW_title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.LgoPOW_chevron,.LgoPOW_collapsed{flex-shrink:0}.LgoPOW_collapsed{transform:rotate(-90deg)}.LgoPOW_action{border-radius:var(--dsw-radius-sm);width:24px;height:24px;color:inherit;cursor:pointer;background:0 0;border:none;place-items:center;margin-inline-start:auto;padding:0;display:grid}.LgoPOW_action:hover{background:var(--dsw-alias-interactive-bg-hover)}@media (pointer:coarse){.LgoPOW_heading{min-height:44px}.LgoPOW_action{width:44px;height:44px}}`,document.head.appendChild(e)}var Me={action:`LgoPOW_action`,chevron:`LgoPOW_chevron`,collapsed:`LgoPOW_collapsed`,heading:`LgoPOW_heading`,title:`LgoPOW_title`};function Ne({label:e,icon:t,expanded:n,onToggle:r,rowKey:i,action:a}){let c=n!==void 0&&r!==void 0&&i!==void 0,l=/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[t,/* @__PURE__ */ (0,s.jsx)(`span`,{className:Me.title,children:e}),c&&/* @__PURE__ */ (0,s.jsx)(o.IconChevronDownOutlineRegular,{className:n?Me.chevron:Me.collapsed,size:12}),a!==void 0&&/* @__PURE__ */ (0,s.jsx)(o.Tooltip,{label:a.label,portal:!0,children:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:Me.action,"aria-label":a.label,onClick:e=>{e.stopPropagation(),a.onActivate()},children:a.icon})})]});return c?/* @__PURE__ */ (0,s.jsx)(`div`,{className:Me.heading,role:`treeitem`,tabIndex:-1,"data-row-key":i,"aria-label":e,"aria-expanded":n,onClick:r,children:l}):/* @__PURE__ */ (0,s.jsx)(`div`,{className:Me.heading,children:l})}let Pe=`@deepseek-ai/dsh-client-ui-workspace/PinnedSection.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Pe)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Pe,e.textContent=`.ss2Ctq_section{margin-bottom:8px}.ss2Ctq_section>[data-row-key]+[data-row-key]{margin-top:2px}`,document.head.appendChild(e)}var Fe={section:`ss2Ctq_section`};function Ie({rows:e,currentId:t,onOpen:n,onRenameRequest:r,renderSlot:i,t:a,revealSessionId:c,onSessionRevealed:l,expanded:u,onToggle:d}){return e.length===0?null:/* @__PURE__ */ (0,s.jsxs)(`div`,{role:`group`,"aria-label":a(`section.pinned`),className:Fe.section,"data-sidebar-pinned":!0,children:[/* @__PURE__ */ (0,s.jsx)(Ne,{label:a(`section.pinned`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconPinOutlineRegular,{size:14}),expanded:u,onToggle:d,rowKey:`section:${z}`}),u&&e.map(e=>/* @__PURE__ */ (0,s.jsx)(Te,{node:e,currentId:t,now:Date.now(),onOpen:n,onRenameRequest:r,renderSlot:i,onReveal:e.id===c?()=>l(e.id):void 0,t:a},e.id))]})}function Le(e,t,n,r){let i=0,a=e.filter(e=>e.blank||e.pinned||e.running||e.runningSubagentCount>0?!0:i++<t||e.id===n||e.id===r);return{rows:a,hiddenCount:e.length-a.length}}function Re(e,t,n){let r=e.filter((e,r)=>r<t||n.has(e.key));return{rows:r,hiddenCount:e.length-r.length}}let ze=`@deepseek-ai/dsh-client-ui-workspace/WorkspacePicker.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(ze)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=ze,e.textContent=`.f8t-HG_modalAction{min-width:72px}.f8t-HG_modalError,.f8t-HG_menuStatus{margin-top:8px;font-size:12px;line-height:18px}.f8t-HG_modalError{color:var(--dsw-alias-state-error-primary)}.f8t-HG_menuStatus{color:var(--dsw-alias-label-secondary)}`,document.head.appendChild(e)}var Be={menuStatus:`f8t-HG_menuStatus`,modalAction:`f8t-HG_modalAction`,modalError:`f8t-HG_modalError`};let Ve=`::add-workspace`,He=`::no-workspace`;function Ue({t:e,open:t,anchorRef:n,useWorkspaces:r,createWorkspace:i,useDirectoryFlow:c,renderDirectoryFlow:l,onPick:u,onPickNone:d,onClose:f,addOnly:p=!1,onBusyChange:m,side:h=`bottom`,selectedId:g}){let _=r(e=>e),v=_.items,y=(0,a.useCallback)(()=>n?.current?.getBoundingClientRect()??null,[n]),[b,x]=(0,a.useState)(!1),[S,C]=(0,a.useState)(null),[w,T]=(0,a.useState)(!1),E=(0,o.usePhoneSidebar)(),D=(0,a.useRef)(!1),[O,k]=(0,a.useState)(!1),A=w||O;(0,a.useEffect)(()=>{m?.(A)},[A,m]);let j=c(e=>e);(0,a.useEffect)(()=>{w&&!j&&T(!1)},[w,j]);let ee=j?[{id:Ve,label:e(`menu.addWorkspace`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconPlusOutlineRegular,{size:16}),disabled:A}]:[],M=!p&&v.length>0,N=d!==void 0&&!p,P=N?[{id:He,label:e(`menu.noWorkspace`),disabled:A}]:[],te=M?[...P,...v.map(t=>({id:t.workspaceId,label:fe(t.title,e(`workspace.defaultName`)),icon:/* @__PURE__ */ (0,s.jsx)(o.IconFolderCloseRegular,{size:16}),disabled:A}))]:[...P,...ee],ne=te.length===0,re=()=>{x(!1),C(null)},ie=e=>i({path:e}).then(e=>{T(!1),u(e.workspaceId)}).catch(e=>{C(e instanceof Error?e.message:String(e)),T(!1),x(!0)}),F=(0,a.useCallback)(()=>{D.current=E?.open===!0,f(),x(!1),C(null),T(!0)},[f,E?.open]),I=p||_.phase===`ready`,L=!N&&!M&&I&&ee.length===1;(0,a.useEffect)(()=>{t&&L&&!A&&F()},[t,L,A,F]);let R={open:w,busy:O,onPicked:e=>{k(!0),ie(e).finally(()=>{k(!1)})},onCancel:()=>{T(!1)},onError:e=>{T(!1),C(e),x(!0)}},z=e=>{e===He?d?.():e===Ve?F():u(e)};return/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(o.Menu,{open:t&&!L&&!ne,anchor:null,items:te,...M?{footer:ee}:{},selectedId:g??(N?He:void 0),onSelect:z,onClose:f,side:h,portal:!0,getAnchorRect:y}),t&&!L&&!ne&&_.phase===`pending`&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:Be.menuStatus,role:`status`,children:e(`picker.loading`)}),l(R),/* @__PURE__ */ (0,s.jsx)(o.Modal,{phoneSidebar:!0,phoneSidebarOrigin:D.current,open:b,onClose:re,closeLabel:e(`close`),title:e(`folderError.title`),footer:/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`outline`,className:Be.modalAction,onClick:re,children:e(`cancel`)}),/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`primary`,className:Be.modalAction,disabled:!j,onClick:F,children:e(`folderError.retry`)})]}),children:/* @__PURE__ */ (0,s.jsx)(`div`,{className:Be.modalError,role:`alert`,children:S})})]})}function We({open:e,anchorRef:t,useWorkspaces:n,selectedId:r,onPick:i,onClose:a,createWorkspace:o,useDirectoryFlow:c,renderSlot:l,t:u}){let d=n(e=>e.canStartProjectless);return/* @__PURE__ */ (0,s.jsx)(Ue,{t:u,open:e,anchorRef:t,useWorkspaces:n,createWorkspace:o,useDirectoryFlow:c,renderDirectoryFlow:e=>l(`conversation.hero.workspace.directoryFlow`,e),selectedId:r,onPick:i,...d?{onPickNone:()=>i(null)}:{},onClose:a})}let Ge=`@deepseek-ai/dsh-client-ui-workspace/WorkspaceBrowser.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Ge)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Ge,e.textContent=`.VJNMIq_root{--dsh-session-list-edge-inset:var(--dsh-sidebar-inline-padding);--dsh-session-list-scrollbar-width:5px;--dsh-session-list-scrollbar-offset:2px;box-sizing:border-box;min-height:0;padding-right:var(--dsh-session-list-edge-inset);flex-direction:column;flex:1;display:flex}[data-phone-drawer] .VJNMIq_root{--dsh-session-list-scrollbar-width:0px}[data-phone-drawer] .VJNMIq_list{scrollbar-gutter:auto}.VJNMIq_root.VJNMIq_rail{padding-right:0}.VJNMIq_iconButton{border-radius:var(--dsw-radius-sm);cursor:pointer;width:28px;height:28px;color:var(--dsw-alias-label-secondary);background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.VJNMIq_iconButton:focus-visible,.VJNMIq_searchButton:focus-visible,.VJNMIq_clearButton:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.VJNMIq_iconButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.VJNMIq_viewOptionsMenu{min-width:200px}.VJNMIq_sectionHeader{box-sizing:border-box;height:36px;color:var(--dsw-alias-label-tertiary);border-radius:6px;flex:none;justify-content:flex-end;align-items:center;gap:4px;margin-bottom:6px;padding-left:4px;display:flex;overflow:hidden}.VJNMIq_root:not(.VJNMIq_rail) .VJNMIq_sectionHeader{margin-top:2px;margin-right:-4px}.VJNMIq_sectionLabel{white-space:nowrap;opacity:1;visibility:visible;min-width:0;max-width:45%;transition:max-width .18s var(--ds-ease-in-out), margin-right .18s var(--ds-ease-in-out), opacity .12s var(--ds-ease-in-out), transform .18s var(--ds-ease-in-out), visibility 0s linear;flex:none;font-size:14px;font-weight:500;line-height:21px;overflow:hidden}.VJNMIq_sectionLabelHidden{opacity:0;visibility:hidden;max-width:0;margin-right:-4px;transition-delay:0s,0s,0s,0s,.18s;transform:translate(-4px)}.VJNMIq_searchSlot{box-sizing:border-box;min-width:0;max-width:28px;transition:max-width .18s var(--ds-ease-in-out), padding-left .18s var(--ds-ease-in-out);flex:1;align-items:center;margin-left:auto;padding-left:0;display:flex}.VJNMIq_searchSlotExpanded{max-width:100%;padding-left:0}.VJNMIq_headerActions{opacity:1;visibility:visible;max-width:60px;transition:max-width .18s var(--ds-ease-in-out), opacity .12s var(--ds-ease-in-out), transform .18s var(--ds-ease-in-out), visibility 0s linear;flex:none;align-items:center;gap:4px;display:flex;overflow:hidden}.VJNMIq_headerActionsHidden{opacity:0;visibility:hidden;pointer-events:none;max-width:0;transition-delay:0s,0s,0s,.18s;transform:translate(4px)}.VJNMIq_search{box-sizing:border-box;border-radius:var(--dsw-radius-sm);cursor:text;width:100%;height:28px;color:var(--dsw-alias-label-secondary);transition:width .18s var(--ds-ease-in-out), padding .18s var(--ds-ease-in-out), border-color .18s var(--ds-ease-in-out), background-color .18s var(--ds-ease-in-out);background:0 0;border:none;flex:none;align-items:center;gap:0;margin:0;padding:0;display:flex;overflow:hidden}.VJNMIq_searchExpanded{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);width:calc(100% + 4px);height:30px;color:var(--dsw-alias-label-caption);background:0 0;margin-inline:-2px;padding:0 4px 0 0}.VJNMIq_searchButton{border-radius:var(--dsw-radius-sm);cursor:pointer;width:28px;height:28px;color:inherit;background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.VJNMIq_searchExpanded .VJNMIq_searchButton{width:28px;height:30px}.VJNMIq_searchButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.VJNMIq_searchExpanded .VJNMIq_searchButton:hover{background:0 0}.VJNMIq_searchInput{opacity:0;pointer-events:none;width:0;min-width:0;color:var(--dsw-alias-label-primary);transition:opacity .12s var(--ds-ease-in-out);background:0 0;border:none;outline:none;flex:1;font-size:13px;line-height:18px}.VJNMIq_searchExpanded .VJNMIq_searchInput{opacity:1;pointer-events:auto;margin-left:-2px}.VJNMIq_searchInput::placeholder{color:var(--dsw-alias-label-tertiary)}.VJNMIq_clearButton{border-radius:var(--dsw-radius-sm);cursor:pointer;width:24px;height:24px;color:var(--dsw-alias-label-secondary);background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.VJNMIq_clearButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.VJNMIq_rail .VJNMIq_sectionHeader{justify-content:flex-start;gap:0;margin-bottom:12px;padding-left:0}.VJNMIq_rail .VJNMIq_headerActions{max-width:none}.VJNMIq_rail .VJNMIq_iconButton{border-radius:var(--dsw-radius-md);width:36px;height:36px;color:var(--dsw-alias-label-primary)}.VJNMIq_rail .VJNMIq_search{border-radius:var(--dsw-radius-md);background:0 0;border-color:#0000;gap:0;width:36px;height:36px;margin:0 0 12px;padding:0}.VJNMIq_rail .VJNMIq_searchButton{border-radius:var(--dsw-radius-md);width:36px;height:36px;color:var(--dsw-alias-label-primary)}.VJNMIq_rail .VJNMIq_searchButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.VJNMIq_listArea{min-height:0;margin-left:-4px;margin-right:calc(-1 * var(--dsh-session-list-edge-inset));flex-direction:column;flex:1;padding-left:4px;display:flex;overflow:visible}.VJNMIq_rail .VJNMIq_listArea{margin-left:0;margin-right:0;padding-left:0}.VJNMIq_treeBody{flex-direction:column;flex:1;min-height:0;display:flex;position:relative}.VJNMIq_fade{left:0;right:var(--dsh-session-list-edge-inset);background:linear-gradient(to bottom, transparent, var(--dsw-specific-sidebar-fill));pointer-events:none;height:24px;position:absolute;bottom:0}[data-platform=darwin] .VJNMIq_fade,[data-phone-drawer] .VJNMIq_fade{display:none}.VJNMIq_wide{animation:VJNMIq_wide-in .2s var(--ds-ease-in-out)}@keyframes VJNMIq_wide-in{0%{opacity:0}}.VJNMIq_list{overscroll-behavior-y:contain;min-height:0;margin-left:-4px;margin-right:var(--dsh-session-list-scrollbar-offset);padding-left:4px;padding-right:calc(var(--dsh-session-list-edge-inset) - var(--dsh-session-list-scrollbar-width) - var(--dsh-session-list-scrollbar-offset));scrollbar-gutter:stable;flex:1;padding-bottom:16px;scroll-padding-block:8px;overflow-y:auto}.VJNMIq_flatList>*+*,.VJNMIq_searchTree>[role=treeitem]+[role=treeitem],.VJNMIq_groupSection>*+*,.VJNMIq_groupSessions>*+*{margin-top:2px}.VJNMIq_searchStatus{color:var(--dsw-alias-label-tertiary);padding:10px 12px;font-size:12px;line-height:18px}.VJNMIq_skeletonRow{box-sizing:border-box;align-items:flex-start;gap:8px;min-height:48px;padding:6px 8px 7px;display:flex}.VJNMIq_skeletonDot{corner-shape:round;border-radius:50%;flex:none;width:16px;height:16px}.VJNMIq_skeletonBars{flex-direction:column;flex:1;gap:6px;min-width:0;display:flex}.VJNMIq_skeletonDot,.VJNMIq_skeletonBar{background:var(--dsw-alias-bg-skeleton);animation:2s cubic-bezier(.36,0,.64,1) infinite VJNMIq_search-skeleton}.VJNMIq_skeletonBar{border-radius:var(--dsw-radius-xs);width:65%;height:16px}.VJNMIq_skeletonBarWide{width:90%;height:13px}@keyframes VJNMIq_search-skeleton{0%{opacity:1}40%{opacity:.6}80%,to{opacity:1}}.VJNMIq_groupSection{position:relative}.VJNMIq_groupSection+.VJNMIq_groupSection{margin-top:4px}.VJNMIq_listTopDropIndicator,.VJNMIq_workspaceDropBefore:before,.VJNMIq_workspaceDropAfter:after{content:"";z-index:1;background:linear-gradient(55deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 0 / 5px 7px no-repeat, linear-gradient(125deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 5px / 5px 7px no-repeat, linear-gradient(var(--dsw-alias-state-business-primary) 0 0) 4px 5px / calc(100% - 4px) 2px no-repeat;pointer-events:none;height:12px;position:absolute;left:0;right:0}.VJNMIq_listTopDropIndicator{top:-8px;left:0;right:var(--dsh-session-list-edge-inset)}.VJNMIq_listTopDropActive>.VJNMIq_workspaceDropBefore:first-child:before{display:none}.VJNMIq_workspaceDropBefore:before{top:-8px}.VJNMIq_workspaceDropAfter:after{bottom:-8px}.VJNMIq_sessionOverflowButton{width:100%;height:32px;padding:0 12px 0 calc(32px + var(--dsh-workspace-indent,0px));cursor:pointer;text-align:left;color:var(--dsw-alias-label-tertiary);background:0 0;border:none;border-radius:6px;font-size:12px}.VJNMIq_sessionOverflowButton[data-row-key=overflow\\:workspaces]{padding-inline-start:8px}.VJNMIq_groupSessions>.VJNMIq_sessionOverflowButton{margin-top:0;padding-inline-start:calc(8px + var(--dsh-workspace-indent,0px))}.VJNMIq_sessionOverflowButton:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}.VJNMIq_sessionOverflowButton:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}@media (hover:none),(pointer:coarse){.VJNMIq_sessionOverflowButton,.VJNMIq_root:not(.VJNMIq_rail) .VJNMIq_iconButton{min-height:44px}.VJNMIq_root:not(.VJNMIq_rail) .VJNMIq_sectionHeader{height:44px}}.VJNMIq_empty{color:var(--dsw-alias-label-tertiary);padding:16px 12px;font-size:13px}.VJNMIq_emptyState{color:var(--dsw-alias-label-tertiary);flex-direction:column;align-items:center;gap:8px;margin-top:80px;padding:0 12px;font-size:13px;line-height:20px;display:flex}.VJNMIq_emptyState>svg{color:var(--dsw-alias-label-caption);margin-bottom:4px}.VJNMIq_emptyAction{cursor:pointer;color:var(--dsw-alias-link);background:0 0;border:none;padding:0;font-size:13px;line-height:20px}.VJNMIq_renameInput{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-lg);width:100%;height:44px;color:var(--dsw-alias-label-primary);background:0 0;outline:none;padding:7px 14px;font-size:14px;font-weight:400;line-height:22px}.VJNMIq_renameInput:disabled{color:var(--dsw-alias-label-dimmed)}.VJNMIq_renameError{color:var(--dsw-alias-state-error-primary);margin-top:8px;font-size:12px;line-height:18px}.VJNMIq_deleteAction:not(:disabled){color:var(--dsw-alias-state-error-primary)}.VJNMIq_deleteStatus{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}.VJNMIq_archiveActivity{color:var(--dsw-alias-label-primary);margin:0 0 8px;padding-left:18px;font-size:13px;line-height:20px}.VJNMIq_archiveActivity li{overflow-wrap:anywhere}@media (prefers-reduced-motion:reduce){.VJNMIq_wide,.VJNMIq_skeletonDot,.VJNMIq_skeletonBar{animation:none}.VJNMIq_search,.VJNMIq_sectionLabel,.VJNMIq_searchSlot,.VJNMIq_searchInput,.VJNMIq_headerActions{transition:none}}`,document.head.appendChild(e)}var Q={archiveActivity:`VJNMIq_archiveActivity`,clearButton:`VJNMIq_clearButton`,deleteAction:`VJNMIq_deleteAction`,deleteStatus:`VJNMIq_deleteStatus`,empty:`VJNMIq_empty`,emptyAction:`VJNMIq_emptyAction`,emptyState:`VJNMIq_emptyState`,fade:`VJNMIq_fade`,flatList:`VJNMIq_flatList`,groupSection:`VJNMIq_groupSection`,groupSessions:`VJNMIq_groupSessions`,headerActions:`VJNMIq_headerActions`,headerActionsHidden:`VJNMIq_headerActionsHidden`,iconButton:`VJNMIq_iconButton`,list:`VJNMIq_list`,listArea:`VJNMIq_listArea`,listTopDropActive:`VJNMIq_listTopDropActive`,listTopDropIndicator:`VJNMIq_listTopDropIndicator`,rail:`VJNMIq_rail`,renameError:`VJNMIq_renameError`,renameInput:`VJNMIq_renameInput`,root:`VJNMIq_root`,search:`VJNMIq_search`,"search-skeleton":`VJNMIq_search-skeleton`,searchButton:`VJNMIq_searchButton`,searchExpanded:`VJNMIq_searchExpanded`,searchInput:`VJNMIq_searchInput`,searchSlot:`VJNMIq_searchSlot`,searchSlotExpanded:`VJNMIq_searchSlotExpanded`,searchStatus:`VJNMIq_searchStatus`,searchTree:`VJNMIq_searchTree`,sectionHeader:`VJNMIq_sectionHeader`,sectionLabel:`VJNMIq_sectionLabel`,sectionLabelHidden:`VJNMIq_sectionLabelHidden`,sessionOverflowButton:`VJNMIq_sessionOverflowButton`,skeletonBar:`VJNMIq_skeletonBar`,skeletonBarWide:`VJNMIq_skeletonBarWide`,skeletonBars:`VJNMIq_skeletonBars`,skeletonDot:`VJNMIq_skeletonDot`,skeletonRow:`VJNMIq_skeletonRow`,treeBody:`VJNMIq_treeBody`,viewOptionsMenu:`VJNMIq_viewOptionsMenu`,wide:`VJNMIq_wide`,"wide-in":`VJNMIq_wide-in`,workspaceDropAfter:`VJNMIq_workspaceDropAfter`,workspaceDropBefore:`VJNMIq_workspaceDropBefore`};function Ke(e){let t=e.replaceAll(`\0`,``);if(t.length<=500)return t;let n=500,r=t.charCodeAt(n-1),i=t.charCodeAt(n);return r>=55296&&r<=56319&&i>=56320&&i<=57343&&n--,t.slice(0,n)}function qe(e){(0,a.useEffect)(()=>{if(!e)return;let t=e=>{e.defaultPrevented||(e.preventDefault(),e.dataTransfer!==null&&(e.dataTransfer.dropEffect=`move`))},n=e=>{e.preventDefault()};return document.addEventListener(`dragover`,t),document.addEventListener(`drop`,n),()=>{document.removeEventListener(`dragover`,t),document.removeEventListener(`drop`,n)}},[e])}function Je({groupBy:e,orderBy:t,archivedFilter:n,onGroupPick:r,onOrderPick:i,onArchivedFilterPick:c,t:l}){let[u,d]=(0,a.useState)(!1),f=(0,o.usePhoneSidebar)();return/* @__PURE__ */ (0,s.jsx)(o.Menu,{phoneSidebarTitle:l(`viewOptions.label`),open:u,onClose:()=>{d(!1)},items:[{type:`label`,id:`group-by`,text:l(`groupBy.label`)},{id:`workspace`,label:l(`groupBy.workspace`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconFolderCloseRegular,{})},{id:`workspace-tree`,label:l(`groupBy.workspaceTree`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconWorkspaceTreeOutlineRegular,{})},{id:`flat`,label:l(`groupBy.flat`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconFlatListOutlineRegular,{})},{type:`separator`,id:`order-by-separator`},{type:`label`,id:`order-by`,text:l(`orderBy.label`)},{id:`manual`,label:l(`orderBy.manual`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconChevronsUpDownOutlineRegular,{})},{id:`updated`,label:l(`orderBy.updated`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconClockOutlineRegular,{})},{type:`separator`,id:`archived-filter-separator`},{type:`label`,id:`filter-by`,text:l(`filterBy.label`)},{id:`hide-archived`,label:l(`viewOptions.hideArchived`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconArchiveOffOutlineRegular,{})},{id:`show-archived`,label:l(`viewOptions.showArchived`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconQueueOutlineRegular,{})},{id:`only-archived`,label:l(`viewOptions.onlyArchived`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconArchiveCheckOutlineRegular,{})}],selectedIds:[e,t,{default:`hide-archived`,show:`show-archived`,only:`only-archived`}[n]],onSelect:e=>{e===`workspace`||e===`workspace-tree`||e===`flat`?r(e):e===`manual`||e===`updated`?i(e):e===`hide-archived`?c(`default`):e===`show-archived`?c(`show`):e===`only-archived`&&c(`only`),d(!1)},align:`end`,dense:!0,listClassName:Q.viewOptionsMenu,portal:!0,anchor:/* @__PURE__ */ (0,s.jsx)(o.Tooltip,{label:l(`viewOptions.label`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:K(Q.iconButton,Q.wide),"aria-label":l(`viewOptions.label`),"data-phone-sidebar-return":f!==null||void 0,onClick:()=>{d(e=>!e)},children:/* @__PURE__ */ (0,s.jsx)(o.IconSlidersTwoOutlineRegular,{})})})})}function Ye(e,t,n,r){let i=t.find(e=>e.id===n.sessionId),a=t.find(e=>e.id===r.id);if(i===void 0||a===void 0||i.blank||i.pinned!==n.pinned||a.pinned!==n.pinned||i.id===a.id||!e.includes(i.id))return;let o=t.filter(e=>e.pinned===n.pinned),s=o.findIndex(e=>e.id===i.id);if(o.filter(e=>e.id!==i.id).findIndex(e=>e.id===a.id)+ +(r.half===`after`)===s)return;let c=e.filter(e=>e!==i.id),l=c.indexOf(a.id);if(l!==-1)return c.splice(l+ +(r.half===`after`),0,i.id),D(c,t.find(e=>e.blank)?.id)}function Xe(e){let t=e.currentTarget.getBoundingClientRect();return e.clientY<t.top+t.height/2?`before`:`after`}function Ze({rowState:e,onLeaveArchivedOnly:t,t:n}){let r=e.archivedFilter===`only`;return/* @__PURE__ */ (0,s.jsxs)(`div`,{className:Q.emptyState,"data-row-key":`empty`,children:[r?/* @__PURE__ */ (0,s.jsx)(o.IconArchiveOutlineRegular,{size:24}):/* @__PURE__ */ (0,s.jsx)(o.IconQueueOutlineRegular,{size:24}),/* @__PURE__ */ (0,s.jsx)(`div`,{children:n(r?`empty.noneArchived`:`empty.none`)}),r&&/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:Q.emptyAction,onClick:t,children:n(`empty.viewOthers`)})]})}function Qe({list:e,useSessionStatus:t,startSession:n,open:r,workspaces:i,ungroupedSessionIds:c,rowState:l,onLeaveArchivedOnly:u,workspaceReady:d,canStartProjectless:f,animationResetKey:p,usePanelInfo:m,onRenameRequest:h,onDeleteRequest:g,onSessionRenameRequest:_,renderSlot:v,insertWorkspaceBefore:y,nestWorkspaces:b,groupExpansion:x,setGroupExpanded:C,sectionExpansion:w,setSectionExpanded:T,setSessionOrder:E,home:D,t:O,revealSessionId:k,onSessionRevealed:A,shortcuts:j}){let ee=m(e=>e.activePanelId!==null),M=t(e=>e),N=ee?void 0:Object.values(e.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,P=k===void 0||!d?void 0:S(i,k),[ne,re]=(0,a.useState)({}),[F,I]=(0,a.useState)(null),R=(0,a.useRef)(!1),[B,V]=(0,a.useState)(null),se=(0,a.useRef)(!1),ce=F!==null||B!==null;qe(ce);let H=N===void 0||!d?void 0:S(i,N);(0,a.useEffect)(()=>{N===void 0||H===void 0||Object.hasOwn(x,H)||C(H,!0)},[N,H,C,x]);let U=(0,a.useMemo)(()=>{if(!b)return/* @__PURE__ */ new Map;let e=new Map(i.map(e=>[e.path,e.workspaceId])),t=[...e.keys()];return new Map(i.map(n=>{let r=L(n.path,t);return[n.workspaceId,r===void 0?void 0:e.get(r)]}))},[b,i]),le=(0,a.useMemo)(()=>{let e=new Set(U.values());return[...i.map(e=>e.workspaceId),``].filter(t=>x[t]??(t===``||e.has(t)))},[x,U,i]),W=(0,a.useMemo)(()=>{let t=te(e,i,l,M,{expandedGroups:le,excludePinned:!0});return f&&!t.some(e=>e.key===``)&&t.push({key:``,workspaceId:void 0,cwd:void 0,createdAt:void 0,label:``,sessionCount:0,expanded:le.includes(``),containsCurrent:!1,sessions:[]}),t},[e,i,l,M,le,f]);(0,a.useEffect)(()=>{for(let e=P;e!==void 0;e=U.get(e))(x[e]===!1||e===P&&x[e]!==!0)&&C(e,!0)},[x,U,P,C]);let G=Date.now(),ue=(e,t)=>{if(R.current)return;R.current=!0,I(null);let n=W.find(t=>t.key===e.accountKey);if(n===void 0||t.id===e.sessionId)return;let r=e.accountKey===``?c:i.find(t=>t.workspaceId===e.accountKey)?.sessionIds;if(r===void 0)return;let a=Le(n.sessions,ne[n.key]??5,N,k).rows,o=Ye(r,a,e,t);o!==void 0&&E(e.accountKey,o)},de=(e,t)=>{if(se.current)return;se.current=!0,V(null);let n=U.get(e.workspaceId),r=i.filter(e=>U.get(e.workspaceId)===n),a=r.findIndex(e=>e.workspaceId===t.id);if(a===-1)return;let o=t.half===`before`?t.id:r[a+1]?.workspaceId;if(o===e.workspaceId)return;let s=r.findIndex(t=>t.workspaceId===e.workspaceId),c=o===void 0?r.length:r.findIndex(e=>e.workspaceId===o);(s===-1||c!==s&&c!==s+1)&&y(e.workspaceId,o).catch(e=>{console.warn(`workspace reorder rejected:`,e)})},fe=(0,a.useMemo)(()=>{let e=new Set(W.map(e=>e.key)),t=/* @__PURE__ */ new Map;for(let n of W){let r=U.get(n.key);for(;r!==void 0&&!e.has(r);)r=U.get(r);let i=t.get(r);i===void 0?t.set(r,[n]):i.push(n)}return t},[W,U]),pe=fe.get(void 0)??[],q=pe[0]?.workspaceId!==void 0&&B?.over?.id===pe[0].workspaceId&&B.over.half===`before`,me=(0,a.useMemo)(()=>{let e=/* @__PURE__ */ new Map,t=(n,r)=>{e.set(n.key,r);for(let e of fe.get(n.key)??[])t(e,r)};for(let e of pe)t(e,e.key);return e},[fe,pe]),he=(0,a.useMemo)(()=>{let e=/* @__PURE__ */ new Set;for(let t of[H,P]){let n=t===void 0?void 0:me.get(t);n!==void 0&&n!==``&&e.add(n)}return e},[H,P,me]),[ge,_e]=(0,a.useState)(!1),J=pe.filter(e=>e.key!==``),ve=Re(J,5,he),be=ge?J:ve.rows,xe=oe(w,z),Se=oe(w,ae),Ce=e=>{e.expanded&&re(t=>({...t,[e.key]:5})),C(e.key,!e.expanded)},we=ie(e,l.pinnedSessionIds,l,M).filter(e=>e.pinned),Y=[];if(we.length>0&&(Y.push(`section:${z}`),xe))for(let e of we)Y.push(`session:${e.id}`);W.length===0&&we.length===0&&Y.push(`empty`);let Ee=(e,t)=>{let i=e.workspaceId,a=fe.get(e.key)??[],c=B!==null&&U.get(B.workspaceId)===U.get(e.key),l=Le(e.sessions,ne[e.key]??5,N,k);Y.push(`workspace:${e.key}`);let u=e.expanded?a.map(e=>Ee(e,t+1)):[],d=l.rows;for(let e of d)Y.push(`${i===void 0?`recent`:`session`}:${e.id}`);l.hiddenCount>0&&Y.push(`overflow:${e.key}`);let p=i!==void 0&&B?.over?.id===i?B.over.half:null,m=i===void 0?void 0:{start:()=>{se.current=!1,V({workspaceId:i,over:null})},end:()=>{B?.over!==null&&B?.over!==void 0?de(B,B.over):V(null),se.current=!1}},y=i===void 0||!c?void 0:e=>{V(t=>t===null?t:{...t,over:{id:i,half:e}})},b=i===void 0||!c?void 0:e=>{de(B,{id:i,half:e})};return/* @__PURE__ */ (0,s.jsxs)(`div`,{"data-sidebar-group":e.key,style:{"--dsh-workspace-indent":`${t*12}px`},className:K(Q.groupSection,p===`before`&&Q.workspaceDropBefore,p===`after`&&Q.workspaceDropAfter),onDragOver:B===null?void 0:t=>{t.preventDefault(),(y!==void 0||U.get(e.key)===void 0)&&(t.stopPropagation(),y===void 0?(t.dataTransfer.dropEffect=`none`,B.over!==null&&V({...B,over:null})):(t.dataTransfer.dropEffect=`move`,y(Xe(t))))},onDrop:B===null?void 0:t=>{t.preventDefault(),(b!==void 0||U.get(e.key)===void 0)&&(t.stopPropagation(),b===void 0?(se.current=!0,V(null)):b(Xe(t)))},children:[i===void 0?/* @__PURE__ */ (0,s.jsx)(Ne,{label:O(`group.ungrouped`),expanded:e.expanded,onToggle:()=>{Ce(e)},rowKey:`workspace:${e.key}`,action:f?{label:O(`actions.newSession`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconNewChatOutlineRegular,{size:16}),onActivate:()=>{C(e.key,!0),n()}}:void 0}):/* @__PURE__ */ (0,s.jsx)(ye,{newShortcut:j.find(e=>e.id===`session.new`),group:e,home:D,t:O,onToggle:()=>{Ce(e)},onCreate:()=>{e.workspaceId!==void 0&&(C(e.key,e.expanded),n(e.workspaceId))},drag:m,actions:e.workspaceId===void 0?void 0:{rename:()=>{
|
|
11
|
+
g(!1),(e===`rename`||e===`delete`)&&(e===`rename`?f.rename():f.delete())},portal:!0,autoFocus:!0,getAnchorRect:v===null?void 0:()=>v,anchor:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:W.iconButton,"aria-label":u(`actions.workspace.aria`,{name:m}),"aria-haspopup":`menu`,"aria-expanded":h,onClick:e=>{e.stopPropagation(),y(null),g(e=>!e)},children:/* @__PURE__ */ (0,s.jsx)(o.IconEllipsisOutlineRegular,{})})}),!d.remote&&/* @__PURE__ */ (0,s.jsx)(o.Tooltip,{label:u(`actions.newSession`),shortcutKeys:l?.keys,side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:W.iconButton,"aria-keyshortcuts":l?.aria,"aria-label":u(`actions.newSession.aria`,{name:m}),onClick:e=>{e.stopPropagation(),n()},children:/* @__PURE__ */ (0,s.jsx)(o.IconNewChatOutlineRegular,{})})})]})]});return d.createdAt===void 0?x:/* @__PURE__ */ (0,s.jsx)(o.HoverCard,{anchor:x,content:/* @__PURE__ */ (0,s.jsx)(Dt,{label:d.label,cwd:d.cwd===void 0?void 0:_(d.cwd,c),createdAt:d.createdAt,t:u}),openDelayMs:800,disabled:h,copyText:d.cwd,copyLabel:u(`copy`),copiedLabel:u(`hover.copied`)})}function At({node:e,now:t,renderSlot:n,t:r}){let i=je(e,r).filter(t=>!e.archived||t.state!==`done`&&t.state!==`idle`);return/* @__PURE__ */ (0,s.jsxs)(`div`,{className:W.hoverContent,children:[/* @__PURE__ */ (0,s.jsx)(`div`,{className:W.hoverTitle,children:Ct(e,r)}),!e.blank&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:W.hoverTime,children:Tt(e.updatedAt,t,r)}),n(`sidebar.session.row.hover`,{sessionId:e.id}),i.map(e=>/* @__PURE__ */ (0,s.jsxs)(`div`,{className:W.hoverStatus,children:[/* @__PURE__ */ (0,s.jsx)(o.StateDot,{state:e.state}),/* @__PURE__ */ (0,s.jsx)(`span`,{children:e.label})]},e.label)),e.archived&&/* @__PURE__ */ (0,s.jsxs)(`div`,{className:Q(W.hoverStatus,W.hoverArchived),children:[/* @__PURE__ */ (0,s.jsx)(o.IconArchiveOutlineRegular,{size:16}),/* @__PURE__ */ (0,s.jsx)(`span`,{children:r(`row.archived`)})]})]})}function jt({result:e,currentId:t,onOpen:n,onUnarchive:r,t:i}){let a=e.id===t,c=je(e,i),l=c[0];return/* @__PURE__ */ (0,s.jsxs)(`div`,{className:Q(W.searchResultRow,a&&W.selected,e.archived&&W.archived),role:`treeitem`,"aria-selected":a,"aria-description":e.archived?i(`toast.archivedNotOpenable`):void 0,onClick:()=>{n(e.id)},children:[/* @__PURE__ */ (0,s.jsxs)(`span`,{className:W.searchResultHeading,children:[/* @__PURE__ */ (0,s.jsx)(`span`,{className:W.slot}),/* @__PURE__ */ (0,s.jsx)(`span`,{className:W.searchResultTitle,children:e.title||i(`session.untitled`)}),e.remote&&/* @__PURE__ */ (0,s.jsx)(St,{host:e.remote,t:i}),!e.archived&&l.state!==`idle`&&/* @__PURE__ */ (0,s.jsx)(`span`,{className:W.timeStatus,"data-session-status":l.state,children:/* @__PURE__ */ (0,s.jsx)(Ne,{statuses:c})}),e.archived&&/* @__PURE__ */ (0,s.jsx)(`span`,{className:W.rowActions,children:/* @__PURE__ */ (0,s.jsx)(o.Tooltip,{label:i(`actions.unarchive`),side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:W.iconButton,"aria-label":i(`menu.unarchiveSession`),onClick:t=>{t.stopPropagation(),r(e.id)},children:/* @__PURE__ */ (0,s.jsx)(o.IconUnarchiveOutlineRegular,{size:16})})})})]}),/* @__PURE__ */ (0,s.jsxs)(`span`,{className:W.searchResultMeta,children:[/* @__PURE__ */ (0,s.jsx)(`span`,{className:W.searchResultWorkspace,children:e.workspace||i(`group.ungrouped`)}),e.snippet!==void 0&&/* @__PURE__ */ (0,s.jsx)(`span`,{className:W.searchResultSnippet,children:e.snippet})]})]})}function Mt({node:e,rowKey:t=`session:${e.id}`,currentId:n,now:r,onOpen:i,onRenameRequest:c,renderSlot:l,onReveal:u,drag:d,showHost:f=!0,t:p}){let m=e,h=Ct(e,p),g=e.id===n,_=je(e,p),v=_[0],y=!m.archived&&v.state!==`idle`,b=d!==void 0&&!m.blank&&!m.archived,S=m.blank?void 0:m.reference,C=b||S!==void 0,w=(0,a.useRef)(!1),[T,E]=(0,a.useState)(!1),[D,O]=(0,a.useState)(null),k=(0,a.useMemo)(()=>[T,E],[T]),A=(0,a.useRef)(null);(0,a.useEffect)(()=>{u!==void 0&&(A.current?.scrollIntoView({block:`nearest`}),u())},[u]);let j=/* @__PURE__ */ (0,s.jsx)(`div`,{ref:A,"data-row-key":t,className:Q(W.sessionRow,g&&W.selected,T&&W.menuOpen,m.archived&&W.archived,d?.marker===`before`&&W.dropBefore,d?.marker===`after`&&W.dropAfter),role:`treeitem`,"aria-selected":g,"aria-current":g?`page`:void 0,tabIndex:-1,onContextMenu:e=>{m.blank||e.target.closest(`button`)||(e.preventDefault(),O(new DOMRect(e.clientX,e.clientY,0,0)),E(!0))},onKeyDown:t=>{t.target!==t.currentTarget||m.blank||(w.current=!1,t.key===`ContextMenu`||t.shiftKey&&t.key===`F10`?(t.preventDefault(),O(null),E(!0)):t.key===`F2`&&!m.archived&&(t.preventDefault(),c(e.id,m.title)))},"aria-description":m.archived?p(`toast.archivedNotOpenable`):void 0,onPointerDown:()=>{w.current=!1},onClick:()=>{w.current||i(e.id)},draggable:C,onDragStart:C?t=>{w.current=!0,t.dataTransfer.effectAllowed=S===void 0?`move`:b?`copyMove`:`copy`,t.dataTransfer.setData(`text/plain`,S===void 0?e.id:x(S).clipboardText),S!==void 0&&t.dataTransfer.setData(`application/x-codexhost-thread-reference`,JSON.stringify(S)),b&&d?.start()}:void 0,onDragEnd:C?e=>d?.end(e.dataTransfer.dropEffect===`copy`):void 0,onDragOver:d===void 0?void 0:e=>{d.active&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,d.hover(Ot(e)))},onDrop:d===void 0?void 0:e=>{d.active&&(e.preventDefault(),d.drop(Ot(e)))},children:/* @__PURE__ */ (0,s.jsxs)(xt,{identity:l(`sidebar.session.row.identity`,{sessionId:e.id}),ambient:!m.archived&&!m.blank&&!y&&l(`sidebar.session.row.leading`,{sessionId:e.id}),title:h,onTitleDoubleClick:m.blank?void 0:t=>{t.stopPropagation(),c(e.id,m.title)},children:[f&&m.remote&&/* @__PURE__ */ (0,s.jsx)(St,{host:m.remote,t:p}),/* @__PURE__ */ (0,s.jsxs)(`span`,{className:W.trailing,children:[!m.blank&&/* @__PURE__ */ (0,s.jsx)(`span`,{className:Q(W.time,y&&W.timeStatus),"data-session-status":y?v.state:void 0,children:y?/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(Ne,{statuses:_}),v.trailingLabel!==void 0&&/* @__PURE__ */ (0,s.jsx)(`span`,{"aria-hidden":`true`,children:v.trailingLabel})]}):wt(m.updatedAt,r,p)}),!m.blank&&/* @__PURE__ */ (0,s.jsxs)(`span`,{className:W.rowActions,onClick:e=>{e.stopPropagation()},children:[/* @__PURE__ */ (0,s.jsx)(o.Menu,{open:T,onClose:()=>{E(!1)},portal:!0,autoFocus:!0,phoneSidebarTitle:h,phoneSidebarFooterBackLabel:p(`session.backToList`),phoneSidebarDetails:/* @__PURE__ */ (0,s.jsx)(`div`,{className:W.phoneDetails,children:/* @__PURE__ */ (0,s.jsx)(At,{node:e,now:r,renderSlot:l,t:p})}),getAnchorRect:D===null?void 0:()=>D,anchor:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:W.iconButton,"aria-label":p(`actions.session.aria`,{name:h}),"aria-haspopup":`menu`,"aria-expanded":T,onClick:()=>{O(null),E(e=>!e)},children:/* @__PURE__ */ (0,s.jsx)(o.IconEllipsisOutlineRegular,{})}),children:l(`sidebar.workspaces.session.menu.item`,{sessionId:e.id,displayTitle:m.title},{hookContext:k})}),/* @__PURE__ */ (0,s.jsx)(`span`,{className:W.quickActions,children:l(`sidebar.workspaces.session.row.action`,{sessionId:e.id,displayTitle:m.title})})]})]})]})});return/* @__PURE__ */ (0,s.jsx)(o.HoverCard,{anchor:j,content:/* @__PURE__ */ (0,s.jsx)(At,{node:e,now:r,renderSlot:l,t:p}),openDelayMs:800,disabled:T||d?.active===!0,copyText:m.blank||m.title===``?void 0:m.title,copyLabel:p(`copy`),copiedLabel:p(`hover.copied`)})}let Nt=`@deepseek-ai/dsh-client-ui-workspace/AnimatedRows.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Nt)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Nt,e.textContent=`.ZhksEq_exits{contain:strict;pointer-events:none;position:absolute;inset:0;overflow:clip}`,document.head.appendChild(e)}var Pt={exits:`ZhksEq_exits`};function Ft(e){return[...e.querySelectorAll(`[data-row-key]`)].filter(e=>e.offsetHeight>0&&!e.closest(`[inert]`))}function It(e){if(!e)return;let t=Ft(e),n=document.activeElement?.closest(`[data-row-key]`),r=t.find(e=>e===n)??t.find(e=>e.getAttribute(`aria-selected`)===`true`)??t[0];for(let e of t)e.tabIndex=e===r?0:-1}function Lt(e){if(e.defaultPrevented||e.nativeEvent.isComposing||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let t=e.currentTarget,n=e.target;if(!(n instanceof HTMLElement)||!n.matches(`[data-row-key]`)||!t.contains(n))return;let r=Ft(t),i=r.indexOf(n);if(i<0)return;let a=n.matches(`[role="treeitem"][aria-expanded]`),o;switch(e.key){case`ArrowDown`:o=r[i+1];break;case`ArrowUp`:o=r[i-1];break;case`Home`:o=r[0];break;case`End`:o=r.at(-1);break;case`ArrowRight`:a&&n.getAttribute(`aria-expanded`)===`false`?n.click():a&&(o=r[i+1]);break;case`ArrowLeft`:if(a&&n.getAttribute(`aria-expanded`)===`true`)n.click();else{let e=n.closest(`[data-sidebar-group]`),t=e?.querySelector(`[data-row-key^="workspace:"]`);t===n&&(e=e?.parentElement?.closest(`[data-sidebar-group]`)??null,t=e?.querySelector(`[data-row-key^="workspace:"]`)),o=t??void 0}break;case`Enter`:case` `:n.click();break;default:return}e.preventDefault(),o&&(o.focus({preventScroll:!0}),o.scrollIntoView({block:`nearest`}),It(t))}function Rt(e,t){return e.rowKeys.length===t.rowKeys.length&&e.rowKeys.every((e,n)=>e===t.rowKeys[n])}function zt(e,t){return e.bottom>t.top&&e.top<t.bottom&&e.right>t.left&&e.left<t.right}var Bt=class extends a.Component{armed=!1;list=(0,a.createRef)();overlay=(0,a.createRef)();movements=/* @__PURE__ */ new Map;exits=/* @__PURE__ */ new Map;componentDidMount(){It(this.list.current)}getSnapshotBeforeUpdate(e){let t=this.list.current;if(!this.armed||Rt(e,this.props)||e.resetKey!==this.props.resetKey||!e.ready||!this.props.ready||t===null||typeof t.animate!=`function`||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return null;let n=t.getBoundingClientRect(),r=this.readPositions(),i=new Set(this.props.rowKeys),a=/* @__PURE__ */ new Map;for(let[e,t]of r){if(i.has(e)||!zt(t.rect,n))continue;let r=t.element.cloneNode(!0);r.removeAttribute(`data-row-key`),r.inert=!0,r.style.setProperty(`--dsh-workspace-indent`,getComputedStyle(t.element).getPropertyValue(`--dsh-workspace-indent`)),a.set(e,{...t,element:r})}return{positions:r,removed:a}}componentDidUpdate(e,t,n){if(It(this.list.current),n===null){(!Rt(e,this.props)||e.resetKey!==this.props.resetKey||e.ready!==this.props.ready)&&this.clear();return}this.cancelMovements();let r=this.list.current,i=this.overlay.current,a=r.getBoundingClientRect(),o=i.getBoundingClientRect(),s=this.readPositions();for(let[e,t]of s){this.removeExit(e);let r=n.positions.get(e);if(!zt(t.rect,a)&&(r===void 0||!zt(r.rect,a)))continue;if(r===void 0){this.move(t.element,[{opacity:0},{opacity:1}],100);continue}let i=r.rect.left-t.rect.left,o=r.rect.top-t.rect.top;(i!==0||o!==0||r.opacity!==1)&&this.move(t.element,[{transform:`translate(${String(i)}px, ${String(o)}px)`,opacity:r.opacity},{transform:`translate(0, 0)`,opacity:1}],200)}for(let[e,t]of n.removed){let{element:n}=t;this.removeExit(e),Object.assign(n.style,{position:`absolute`,margin:`0`,transform:`none`,boxSizing:`border-box`,left:`${String(t.rect.left-o.left)}px`,top:`${String(t.rect.top-o.top)}px`,width:`${String(t.rect.width)}px`,height:`${String(t.rect.height)}px`}),i.append(n);let r=n.animate([{opacity:t.opacity},{opacity:0}],{duration:100,easing:`ease-out`,fill:`forwards`});this.exits.set(e,{element:n,animation:r}),r.onfinish=()=>{this.removeExit(e)}}}componentWillUnmount(){this.clear()}readPositions(){let e=this.list.current.querySelectorAll(`[data-row-key]`);return new Map(Array.from(e,e=>[e.dataset.rowKey,{element:e,rect:e.getBoundingClientRect(),opacity:this.movements.has(e)?Number(getComputedStyle(e).opacity):1}]))}move(e,t,n){let r=e.animate(t,{duration:n,easing:`ease-out`});this.movements.set(e,r),r.onfinish=()=>{this.movements.delete(e),r.cancel()}}cancelMovements(){for(let e of this.movements.values())e.onfinish=null,e.cancel();this.movements.clear()}removeExit(e){let t=this.exits.get(e);t!==void 0&&(t.animation.onfinish=null,t.animation.cancel(),t.element.remove(),this.exits.delete(e))}clear(){this.cancelMovements();for(let e of this.exits.keys())this.removeExit(e)}render(){return/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(`div`,{ref:this.list,className:this.props.className,role:`tree`,"aria-label":this.props.label,onKeyDown:Lt,onFocusCapture:()=>It(this.list.current),onPointerDownCapture:()=>{this.armed=!0},onKeyDownCapture:()=>{this.armed=!0},children:this.props.children}),/* @__PURE__ */ (0,s.jsx)(`div`,{ref:this.overlay,className:Pt.exits,"aria-hidden":`true`})]})}};let Vt=`@deepseek-ai/dsh-client-ui-workspace/SectionHeading.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Vt)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Vt,e.textContent=`.LgoPOW_heading{border-radius:var(--dsw-radius-sm);min-height:30px;color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;padding:0 8px;font-size:14px;font-weight:500;line-height:21px;display:flex}.LgoPOW_heading[data-row-key]{cursor:pointer}.LgoPOW_heading[data-row-key]:hover{background:var(--dsw-alias-interactive-bg-hover)}.LgoPOW_heading[data-row-key]:focus-visible,.LgoPOW_action:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.LgoPOW_title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.LgoPOW_chevron,.LgoPOW_collapsed{flex-shrink:0}.LgoPOW_collapsed{transform:rotate(-90deg)}.LgoPOW_action{border-radius:var(--dsw-radius-sm);width:24px;height:24px;color:inherit;cursor:pointer;background:0 0;border:none;place-items:center;margin-inline-start:auto;padding:0;display:grid}.LgoPOW_action:hover{background:var(--dsw-alias-interactive-bg-hover)}@media (pointer:coarse){.LgoPOW_heading{min-height:44px}.LgoPOW_action{width:44px;height:44px}}`,document.head.appendChild(e)}var Ht={action:`LgoPOW_action`,chevron:`LgoPOW_chevron`,collapsed:`LgoPOW_collapsed`,heading:`LgoPOW_heading`,title:`LgoPOW_title`};function Ut({label:e,icon:t,expanded:n,onToggle:r,rowKey:i,action:a}){let c=n!==void 0&&r!==void 0&&i!==void 0,l=/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[t,/* @__PURE__ */ (0,s.jsx)(`span`,{className:Ht.title,children:e}),c&&/* @__PURE__ */ (0,s.jsx)(o.IconChevronDownOutlineRegular,{className:n?Ht.chevron:Ht.collapsed,size:12}),a!==void 0&&/* @__PURE__ */ (0,s.jsx)(o.Tooltip,{label:a.label,portal:!0,children:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:Ht.action,"aria-label":a.label,onClick:e=>{e.stopPropagation(),a.onActivate()},children:a.icon})})]});return c?/* @__PURE__ */ (0,s.jsx)(`div`,{className:Ht.heading,role:`treeitem`,tabIndex:-1,"data-row-key":i,"aria-label":e,"aria-expanded":n,onClick:r,children:l}):/* @__PURE__ */ (0,s.jsx)(`div`,{className:Ht.heading,children:l})}let Wt=`@deepseek-ai/dsh-client-ui-workspace/PinnedSection.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Wt)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Wt,e.textContent=`.ss2Ctq_section{margin-bottom:8px}.ss2Ctq_section>[data-row-key]+[data-row-key]{margin-top:2px}`,document.head.appendChild(e)}var Gt={section:`ss2Ctq_section`};function Kt({rows:e,currentId:t,onOpen:n,onRenameRequest:r,renderSlot:i,t:a,revealSessionId:c,onSessionRevealed:l,expanded:u,onToggle:d}){return e.length===0?null:/* @__PURE__ */ (0,s.jsxs)(`div`,{role:`group`,"aria-label":a(`section.pinned`),className:Gt.section,"data-sidebar-pinned":!0,children:[/* @__PURE__ */ (0,s.jsx)(Ut,{label:a(`section.pinned`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconPinOutlineRegular,{size:14}),expanded:u,onToggle:d,rowKey:`section:${L}`}),u&&e.map(e=>/* @__PURE__ */ (0,s.jsx)(Mt,{node:e,currentId:t,now:Date.now(),onOpen:n,onRenameRequest:r,renderSlot:i,onReveal:e.id===c?()=>l(e.id):void 0,t:a},e.id))]})}let qt=`@deepseek-ai/dsh-client-ui-workspace/WorkspaceBrowser.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(qt)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=qt,e.textContent=`.VJNMIq_root{--dsh-session-list-edge-inset:var(--dsh-sidebar-inline-padding);--dsh-session-list-scrollbar-width:5px;--dsh-session-list-scrollbar-offset:2px;box-sizing:border-box;min-height:0;padding-right:var(--dsh-session-list-edge-inset);flex-direction:column;flex:1;display:flex}[data-phone-drawer] .VJNMIq_root{--dsh-session-list-scrollbar-width:0px}[data-phone-drawer] .VJNMIq_list{scrollbar-gutter:auto}.VJNMIq_root.VJNMIq_rail{padding-right:0}.VJNMIq_iconButton{border-radius:var(--dsw-radius-sm);cursor:pointer;width:28px;height:28px;color:var(--dsw-alias-label-secondary);background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.VJNMIq_iconButton:focus-visible,.VJNMIq_searchButton:focus-visible,.VJNMIq_clearButton:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.VJNMIq_iconButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.VJNMIq_viewOptionsMenu{min-width:200px}.VJNMIq_sectionHeader{box-sizing:border-box;height:36px;color:var(--dsw-alias-label-tertiary);border-radius:6px;flex:none;justify-content:flex-end;align-items:center;gap:4px;margin-bottom:6px;padding-left:4px;display:flex;overflow:hidden}.VJNMIq_root:not(.VJNMIq_rail) .VJNMIq_sectionHeader{margin-top:2px;margin-right:-4px}.VJNMIq_sectionLabel{white-space:nowrap;opacity:1;visibility:visible;min-width:0;max-width:45%;transition:max-width .18s var(--ds-ease-in-out), margin-right .18s var(--ds-ease-in-out), opacity .12s var(--ds-ease-in-out), transform .18s var(--ds-ease-in-out), visibility 0s linear;flex:none;font-size:14px;font-weight:500;line-height:21px;overflow:hidden}.VJNMIq_sectionLabelHidden{opacity:0;visibility:hidden;max-width:0;margin-right:-4px;transition-delay:0s,0s,0s,0s,.18s;transform:translate(-4px)}.VJNMIq_searchSlot{box-sizing:border-box;min-width:0;max-width:28px;transition:max-width .18s var(--ds-ease-in-out), padding-left .18s var(--ds-ease-in-out);flex:1;align-items:center;margin-left:auto;padding-left:0;display:flex}.VJNMIq_searchSlotExpanded{max-width:100%;padding-left:0}.VJNMIq_headerActions{opacity:1;visibility:visible;max-width:60px;transition:max-width .18s var(--ds-ease-in-out), opacity .12s var(--ds-ease-in-out), transform .18s var(--ds-ease-in-out), visibility 0s linear;flex:none;align-items:center;gap:4px;display:flex;overflow:hidden}.VJNMIq_headerActionsHidden{opacity:0;visibility:hidden;pointer-events:none;max-width:0;transition-delay:0s,0s,0s,.18s;transform:translate(4px)}.VJNMIq_search{box-sizing:border-box;border-radius:var(--dsw-radius-sm);cursor:text;width:100%;height:28px;color:var(--dsw-alias-label-secondary);transition:width .18s var(--ds-ease-in-out), padding .18s var(--ds-ease-in-out), border-color .18s var(--ds-ease-in-out), background-color .18s var(--ds-ease-in-out);background:0 0;border:none;flex:none;align-items:center;gap:0;margin:0;padding:0;display:flex;overflow:hidden}.VJNMIq_searchExpanded{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);width:calc(100% + 4px);height:30px;color:var(--dsw-alias-label-caption);background:0 0;margin-inline:-2px;padding:0 4px 0 0}.VJNMIq_searchButton{border-radius:var(--dsw-radius-sm);cursor:pointer;width:28px;height:28px;color:inherit;background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.VJNMIq_searchExpanded .VJNMIq_searchButton{width:28px;height:30px}.VJNMIq_searchButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.VJNMIq_searchExpanded .VJNMIq_searchButton:hover{background:0 0}.VJNMIq_searchInput{opacity:0;pointer-events:none;width:0;min-width:0;color:var(--dsw-alias-label-primary);transition:opacity .12s var(--ds-ease-in-out);background:0 0;border:none;outline:none;flex:1;font-size:13px;line-height:18px}.VJNMIq_searchExpanded .VJNMIq_searchInput{opacity:1;pointer-events:auto;margin-left:-2px}.VJNMIq_searchInput::placeholder{color:var(--dsw-alias-label-tertiary)}.VJNMIq_clearButton{border-radius:var(--dsw-radius-sm);cursor:pointer;width:24px;height:24px;color:var(--dsw-alias-label-secondary);background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.VJNMIq_clearButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.VJNMIq_rail .VJNMIq_sectionHeader{justify-content:flex-start;gap:0;margin-bottom:12px;padding-left:0}.VJNMIq_rail .VJNMIq_headerActions{max-width:none}.VJNMIq_rail .VJNMIq_iconButton{border-radius:var(--dsw-radius-md);width:36px;height:36px;color:var(--dsw-alias-label-primary)}.VJNMIq_rail .VJNMIq_search{border-radius:var(--dsw-radius-md);background:0 0;border-color:#0000;gap:0;width:36px;height:36px;margin:0 0 12px;padding:0}.VJNMIq_rail .VJNMIq_searchButton{border-radius:var(--dsw-radius-md);width:36px;height:36px;color:var(--dsw-alias-label-primary)}.VJNMIq_rail .VJNMIq_searchButton:hover{background:var(--dsw-alias-interactive-bg-hover)}.VJNMIq_listArea{min-height:0;margin-left:-4px;margin-right:calc(-1 * var(--dsh-session-list-edge-inset));flex-direction:column;flex:1;padding-left:4px;display:flex;overflow:visible}.VJNMIq_rail .VJNMIq_listArea{margin-left:0;margin-right:0;padding-left:0}.VJNMIq_treeBody{flex-direction:column;flex:1;min-height:0;display:flex;position:relative}.VJNMIq_fade{left:0;right:var(--dsh-session-list-edge-inset);background:linear-gradient(to bottom, transparent, var(--dsw-specific-sidebar-fill));pointer-events:none;height:24px;position:absolute;bottom:0}[data-platform=darwin] .VJNMIq_fade,[data-phone-drawer] .VJNMIq_fade{display:none}.VJNMIq_wide{animation:VJNMIq_wide-in .2s var(--ds-ease-in-out)}@keyframes VJNMIq_wide-in{0%{opacity:0}}.VJNMIq_list{overscroll-behavior-y:contain;min-height:0;margin-left:-4px;margin-right:var(--dsh-session-list-scrollbar-offset);padding-left:4px;padding-right:calc(var(--dsh-session-list-edge-inset) - var(--dsh-session-list-scrollbar-width) - var(--dsh-session-list-scrollbar-offset));scrollbar-gutter:stable;flex:1;padding-bottom:16px;scroll-padding-block:8px;overflow-y:auto}.VJNMIq_flatList>*+*,.VJNMIq_searchTree>[role=treeitem]+[role=treeitem],.VJNMIq_groupSection>*+*,.VJNMIq_groupSessions>*+*{margin-top:2px}.VJNMIq_searchStatus{color:var(--dsw-alias-label-tertiary);padding:10px 12px;font-size:12px;line-height:18px}.VJNMIq_skeletonRow{box-sizing:border-box;align-items:flex-start;gap:8px;min-height:48px;padding:6px 8px 7px;display:flex}.VJNMIq_skeletonDot{corner-shape:round;border-radius:50%;flex:none;width:16px;height:16px}.VJNMIq_skeletonBars{flex-direction:column;flex:1;gap:6px;min-width:0;display:flex}.VJNMIq_skeletonDot,.VJNMIq_skeletonBar{background:var(--dsw-alias-bg-skeleton);animation:2s cubic-bezier(.36,0,.64,1) infinite VJNMIq_search-skeleton}.VJNMIq_skeletonBar{border-radius:var(--dsw-radius-xs);width:65%;height:16px}.VJNMIq_skeletonBarWide{width:90%;height:13px}@keyframes VJNMIq_search-skeleton{0%{opacity:1}40%{opacity:.6}80%,to{opacity:1}}.VJNMIq_groupSection{position:relative}.VJNMIq_groupSection+.VJNMIq_groupSection{margin-top:4px}.VJNMIq_listTopDropIndicator,.VJNMIq_workspaceDropBefore:before,.VJNMIq_workspaceDropAfter:after{content:"";z-index:1;background:linear-gradient(55deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 0 / 5px 7px no-repeat, linear-gradient(125deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 5px / 5px 7px no-repeat, linear-gradient(var(--dsw-alias-state-business-primary) 0 0) 4px 5px / calc(100% - 4px) 2px no-repeat;pointer-events:none;height:12px;position:absolute;left:0;right:0}.VJNMIq_listTopDropIndicator{top:-8px;left:0;right:var(--dsh-session-list-edge-inset)}.VJNMIq_listTopDropActive>.VJNMIq_workspaceDropBefore:first-child:before{display:none}.VJNMIq_workspaceDropBefore:before{top:-8px}.VJNMIq_workspaceDropAfter:after{bottom:-8px}.VJNMIq_sessionOverflowButton{width:100%;height:32px;padding:0 12px 0 calc(32px + var(--dsh-workspace-indent,0px));cursor:pointer;text-align:left;color:var(--dsw-alias-label-tertiary);background:0 0;border:none;border-radius:6px;font-size:12px}.VJNMIq_sessionOverflowButton[data-row-key=overflow\\:workspaces]{padding-inline-start:8px}.VJNMIq_groupSessions>.VJNMIq_sessionOverflowButton{margin-top:0;padding-inline-start:calc(8px + var(--dsh-workspace-indent,0px))}.VJNMIq_sessionOverflowButton:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}.VJNMIq_sessionOverflowButton:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}@media (hover:none),(pointer:coarse){.VJNMIq_sessionOverflowButton,.VJNMIq_root:not(.VJNMIq_rail) .VJNMIq_iconButton{min-height:44px}.VJNMIq_root:not(.VJNMIq_rail) .VJNMIq_sectionHeader{height:44px}}.VJNMIq_empty{color:var(--dsw-alias-label-tertiary);padding:16px 12px;font-size:13px}.VJNMIq_emptyState{color:var(--dsw-alias-label-tertiary);flex-direction:column;align-items:center;gap:8px;margin-top:80px;padding:0 12px;font-size:13px;line-height:20px;display:flex}.VJNMIq_emptyState>svg{color:var(--dsw-alias-label-caption);margin-bottom:4px}.VJNMIq_emptyAction{cursor:pointer;color:var(--dsw-alias-link);background:0 0;border:none;padding:0;font-size:13px;line-height:20px}.VJNMIq_renameInput{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-lg);width:100%;height:44px;color:var(--dsw-alias-label-primary);background:0 0;outline:none;padding:7px 14px;font-size:14px;font-weight:400;line-height:22px}.VJNMIq_renameInput:disabled{color:var(--dsw-alias-label-dimmed)}.VJNMIq_renameError{color:var(--dsw-alias-state-error-primary);margin-top:8px;font-size:12px;line-height:18px}.VJNMIq_deleteAction:not(:disabled){color:var(--dsw-alias-state-error-primary)}.VJNMIq_deleteStatus{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}.VJNMIq_archiveActivity{color:var(--dsw-alias-label-primary);margin:0 0 8px;padding-left:18px;font-size:13px;line-height:20px}.VJNMIq_archiveActivity li{overflow-wrap:anywhere}@media (prefers-reduced-motion:reduce){.VJNMIq_wide,.VJNMIq_skeletonDot,.VJNMIq_skeletonBar{animation:none}.VJNMIq_search,.VJNMIq_sectionLabel,.VJNMIq_searchSlot,.VJNMIq_searchInput,.VJNMIq_headerActions{transition:none}}`,document.head.appendChild(e)}var $={archiveActivity:`VJNMIq_archiveActivity`,clearButton:`VJNMIq_clearButton`,deleteAction:`VJNMIq_deleteAction`,deleteStatus:`VJNMIq_deleteStatus`,empty:`VJNMIq_empty`,emptyAction:`VJNMIq_emptyAction`,emptyState:`VJNMIq_emptyState`,fade:`VJNMIq_fade`,flatList:`VJNMIq_flatList`,groupSection:`VJNMIq_groupSection`,groupSessions:`VJNMIq_groupSessions`,headerActions:`VJNMIq_headerActions`,headerActionsHidden:`VJNMIq_headerActionsHidden`,iconButton:`VJNMIq_iconButton`,list:`VJNMIq_list`,listArea:`VJNMIq_listArea`,listTopDropActive:`VJNMIq_listTopDropActive`,listTopDropIndicator:`VJNMIq_listTopDropIndicator`,rail:`VJNMIq_rail`,renameError:`VJNMIq_renameError`,renameInput:`VJNMIq_renameInput`,root:`VJNMIq_root`,search:`VJNMIq_search`,"search-skeleton":`VJNMIq_search-skeleton`,searchButton:`VJNMIq_searchButton`,searchExpanded:`VJNMIq_searchExpanded`,searchInput:`VJNMIq_searchInput`,searchSlot:`VJNMIq_searchSlot`,searchSlotExpanded:`VJNMIq_searchSlotExpanded`,searchStatus:`VJNMIq_searchStatus`,searchTree:`VJNMIq_searchTree`,sectionHeader:`VJNMIq_sectionHeader`,sectionLabel:`VJNMIq_sectionLabel`,sectionLabelHidden:`VJNMIq_sectionLabelHidden`,sessionOverflowButton:`VJNMIq_sessionOverflowButton`,skeletonBar:`VJNMIq_skeletonBar`,skeletonBarWide:`VJNMIq_skeletonBarWide`,skeletonBars:`VJNMIq_skeletonBars`,skeletonDot:`VJNMIq_skeletonDot`,skeletonRow:`VJNMIq_skeletonRow`,treeBody:`VJNMIq_treeBody`,viewOptionsMenu:`VJNMIq_viewOptionsMenu`,wide:`VJNMIq_wide`,"wide-in":`VJNMIq_wide-in`,workspaceDropAfter:`VJNMIq_workspaceDropAfter`,workspaceDropBefore:`VJNMIq_workspaceDropBefore`};function Jt({list:e,refreshSessions:t,loadMoreSessions:n,t:r}){return e.listError?/* @__PURE__ */ (0,s.jsxs)(`div`,{role:`alert`,children:[/* @__PURE__ */ (0,s.jsx)(`span`,{children:e.listError}),/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:$.sessionOverflowButton,disabled:e.loading,onClick:e.listErrorPage===`more`?n:t,children:r(`sessions.retry`)})]}):null}function Yt(e,t,n,r){let i=0,a=e.filter(e=>e.blank||e.pinned||e.running||e.runningSubagentCount>0?!0:i++<t||e.id===n||e.id===r);return{rows:a,hiddenCount:e.length-a.length}}function Xt(e,t,n){let r=e.filter((e,r)=>r<t||n.has(e.key));return{rows:r,hiddenCount:e.length-r.length}}function Zt({rowKey:e,hiddenCount:t,hasMore:n,loading:r,expanded:i,expand:a,collapse:o,loadMoreSessions:c,t:l}){if(t===0&&!n&&!o)return null;let u=t===0&&n&&r;return/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,"data-row-key":e,className:$.sessionOverflowButton,"aria-expanded":i,disabled:u,onClick:()=>{t>0?a():n?(a(),c()):o?.()},children:u?l(`sessions.loading`):t>0?l(`sessions.expand`,{n:Math.min(10,t)}):l(n?`sessions.expandMore`:`sessions.collapse`)})}let Qt=`@deepseek-ai/dsh-client-ui-workspace/WorkspacePicker.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Qt)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Qt,e.textContent=`.f8t-HG_modalAction{min-width:72px}.f8t-HG_modalError,.f8t-HG_menuStatus{margin-top:8px;font-size:12px;line-height:18px}.f8t-HG_modalError{color:var(--dsw-alias-state-error-primary)}.f8t-HG_menuStatus{color:var(--dsw-alias-label-secondary)}`,document.head.appendChild(e)}var $t={menuStatus:`f8t-HG_menuStatus`,modalAction:`f8t-HG_modalAction`,modalError:`f8t-HG_modalError`};let en=`::add-workspace`,tn=`::no-workspace`;function nn({t:e,open:t,anchorRef:n,useWorkspaces:r,createWorkspace:i,useDirectoryFlow:c,renderDirectoryFlow:l,onPick:u,onPickNone:d,onClose:f,addOnly:p=!1,onBusyChange:m,side:h=`bottom`,selectedId:g}){let _=r(e=>e),v=_.items,y=(0,a.useCallback)(()=>n?.current?.getBoundingClientRect()??null,[n]),[b,x]=(0,a.useState)(!1),[S,C]=(0,a.useState)(null),[w,T]=(0,a.useState)(!1),E=(0,o.usePhoneSidebar)(),D=(0,a.useRef)(!1),[O,k]=(0,a.useState)(!1),A=w||O;(0,a.useEffect)(()=>{m?.(A)},[A,m]);let j=c(e=>e);(0,a.useEffect)(()=>{w&&!j&&T(!1)},[w,j]);let ee=j?[{id:en,label:e(`menu.addWorkspace`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconPlusOutlineRegular,{size:16}),disabled:A}]:[],te=!p&&v.length>0,M=d!==void 0&&!p,N=M?[{id:tn,label:e(`menu.noWorkspace`),disabled:A}]:[],P=te?[...N,...v.map(t=>({id:t.workspaceId,label:bt(t.title,e(`workspace.defaultName`)),icon:/* @__PURE__ */ (0,s.jsx)(o.IconFolderCloseRegular,{size:16}),disabled:A}))]:[...N,...ee],F=P.length===0,ne=()=>{x(!1),C(null)},re=e=>i({path:e}).then(e=>{T(!1),u(e.workspaceId)}).catch(e=>{C(e instanceof Error?e.message:String(e)),T(!1),x(!0)}),ie=(0,a.useCallback)(()=>{D.current=E?.open===!0,f(),x(!1),C(null),T(!0)},[f,E?.open]),I=p||_.phase===`ready`,ae=!M&&!te&&I&&ee.length===1;(0,a.useEffect)(()=>{t&&ae&&!A&&ie()},[t,ae,A,ie]);let oe={open:w,busy:O,onPicked:e=>{k(!0),re(e).finally(()=>{k(!1)})},onCancel:()=>{T(!1)},onError:e=>{T(!1),C(e),x(!0)}},se=e=>{e===tn?d?.():e===en?ie():u(e)};return/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(o.Menu,{open:t&&!ae&&!F,anchor:null,items:P,...te?{footer:ee}:{},selectedId:g??(M?tn:void 0),onSelect:se,onClose:f,side:h,portal:!0,getAnchorRect:y}),t&&!ae&&!F&&_.phase===`pending`&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:$t.menuStatus,role:`status`,children:e(`picker.loading`)}),l(oe),/* @__PURE__ */ (0,s.jsx)(o.Modal,{phoneSidebar:!0,phoneSidebarOrigin:D.current,open:b,onClose:ne,closeLabel:e(`close`),title:e(`folderError.title`),footer:/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`outline`,className:$t.modalAction,onClick:ne,children:e(`cancel`)}),/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`primary`,className:$t.modalAction,disabled:!j,onClick:ie,children:e(`folderError.retry`)})]}),children:/* @__PURE__ */ (0,s.jsx)(`div`,{className:$t.modalError,role:`alert`,children:S})})]})}function rn({open:e,anchorRef:t,useWorkspaces:n,selectedId:r,onPick:i,onClose:a,createWorkspace:o,useDirectoryFlow:c,renderSlot:l,t:u}){let d=n(e=>e.canStartProjectless);return/* @__PURE__ */ (0,s.jsx)(nn,{t:u,open:e,anchorRef:t,useWorkspaces:n,createWorkspace:o,useDirectoryFlow:c,renderDirectoryFlow:e=>l(`conversation.hero.workspace.directoryFlow`,e),selectedId:r,onPick:i,...d?{onPickNone:()=>i(null)}:{},onClose:a})}function an(e){let t=e.replaceAll(`\0`,``);if(t.length<=500)return t;let n=500,r=t.charCodeAt(n-1),i=t.charCodeAt(n);return r>=55296&&r<=56319&&i>=56320&&i<=57343&&n--,t.slice(0,n)}function on(e){(0,a.useEffect)(()=>{if(!e)return;let t=e=>{e.defaultPrevented||(e.preventDefault(),e.dataTransfer!==null&&(e.dataTransfer.dropEffect=`move`))},n=e=>{e.preventDefault()};return document.addEventListener(`dragover`,t),document.addEventListener(`drop`,n),()=>{document.removeEventListener(`dragover`,t),document.removeEventListener(`drop`,n)}},[e])}function sn({groupBy:e,orderBy:t,archivedFilter:n,onGroupPick:r,onOrderPick:i,onArchivedFilterPick:c,t:l}){let[u,d]=(0,a.useState)(!1),f=(0,o.usePhoneSidebar)();return/* @__PURE__ */ (0,s.jsx)(o.Menu,{phoneSidebarTitle:l(`viewOptions.label`),open:u,onClose:()=>{d(!1)},items:[{type:`label`,id:`group-by`,text:l(`groupBy.label`)},{id:`workspace`,label:l(`groupBy.workspace`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconFolderCloseRegular,{})},{id:`workspace-tree`,label:l(`groupBy.workspaceTree`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconWorkspaceTreeOutlineRegular,{})},{id:`flat`,label:l(`groupBy.flat`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconFlatListOutlineRegular,{})},{type:`separator`,id:`order-by-separator`},{type:`label`,id:`order-by`,text:l(`orderBy.label`)},{id:`manual`,label:l(`orderBy.manual`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconChevronsUpDownOutlineRegular,{})},{id:`updated`,label:l(`orderBy.updated`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconClockOutlineRegular,{})},{type:`separator`,id:`archived-filter-separator`},{type:`label`,id:`filter-by`,text:l(`filterBy.label`)},{id:`hide-archived`,label:l(`viewOptions.hideArchived`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconArchiveOffOutlineRegular,{})},{id:`show-archived`,label:l(`viewOptions.showArchived`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconQueueOutlineRegular,{})},{id:`only-archived`,label:l(`viewOptions.onlyArchived`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconArchiveCheckOutlineRegular,{})}],selectedIds:[e,t,{default:`hide-archived`,show:`show-archived`,only:`only-archived`}[n]],onSelect:e=>{e===`workspace`||e===`workspace-tree`||e===`flat`?r(e):e===`manual`||e===`updated`?i(e):e===`hide-archived`?c(`default`):e===`show-archived`?c(`show`):e===`only-archived`&&c(`only`),d(!1)},align:`end`,dense:!0,listClassName:$.viewOptionsMenu,portal:!0,anchor:/* @__PURE__ */ (0,s.jsx)(o.Tooltip,{label:l(`viewOptions.label`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:Q($.iconButton,$.wide),"aria-label":l(`viewOptions.label`),"data-phone-sidebar-return":f!==null||void 0,onClick:()=>{d(e=>!e)},children:/* @__PURE__ */ (0,s.jsx)(o.IconSlidersTwoOutlineRegular,{})})})})}function cn(e,t,n,r){let i=t.find(e=>e.id===n.sessionId),a=t.find(e=>e.id===r.id);if(i===void 0||a===void 0||i.blank||i.pinned!==n.pinned||a.pinned!==n.pinned||i.id===a.id||!e.includes(i.id))return;let o=t.filter(e=>e.pinned===n.pinned),s=o.findIndex(e=>e.id===i.id);if(o.filter(e=>e.id!==i.id).findIndex(e=>e.id===a.id)+ +(r.half===`after`)===s)return;let c=e.filter(e=>e!==i.id),l=c.indexOf(a.id);if(l!==-1)return c.splice(l+ +(r.half===`after`),0,i.id),D(c,t.find(e=>e.blank)?.id)}function ln(e){let t=e.currentTarget.getBoundingClientRect();return e.clientY<t.top+t.height/2?`before`:`after`}function un({rowState:e,onLeaveArchivedOnly:t,partial:n,t:r}){let i=e.archivedFilter===`only`;return/* @__PURE__ */ (0,s.jsxs)(`div`,{className:$.emptyState,"data-row-key":`empty`,children:[i?/* @__PURE__ */ (0,s.jsx)(o.IconArchiveOutlineRegular,{size:24}):/* @__PURE__ */ (0,s.jsx)(o.IconQueueOutlineRegular,{size:24}),/* @__PURE__ */ (0,s.jsx)(`div`,{children:r(n?`sessions.notLoaded`:i?`empty.noneArchived`:`empty.none`)}),i&&/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:$.emptyAction,onClick:t,children:r(`empty.viewOthers`)})]})}function dn({list:e,useSessionStatus:t,startSession:n,open:r,workspaces:i,ungroupedSessionIds:c,rowState:l,onLeaveArchivedOnly:u,workspaceReady:d,canStartProjectless:f,animationResetKey:p,usePanelInfo:m,onRenameRequest:h,onDeleteRequest:g,onSessionRenameRequest:_,renderSlot:v,insertWorkspaceBefore:y,nestWorkspaces:b,groupExpansion:x,setGroupExpanded:C,sectionExpansion:w,setSectionExpanded:T,setSessionOrder:E,home:D,t:O,revealSessionId:k,onSessionRevealed:A,shortcuts:j,loadMoreSessions:ee}){let te=m(e=>e.activePanelId!==null),M=t(e=>e),N=te?void 0:Object.values(e.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,P=k===void 0||!d?void 0:S(i,k),[ne,re]=(0,a.useState)({}),[I,ae]=(0,a.useState)(null),se=(0,a.useRef)(!1),[R,z]=(0,a.useState)(null),ue=(0,a.useRef)(!1),de=I!==null||R!==null;on(de);let fe=N===void 0||!d?void 0:S(i,N);(0,a.useEffect)(()=>{N===void 0||fe===void 0||Object.hasOwn(x,fe)||C(fe,!0)},[N,fe,C,x]);let B=(0,a.useMemo)(()=>{if(!b)return/* @__PURE__ */ new Map;let e=/* @__PURE__ */ new Map;for(let t of i){let n=t.remote?.hostId??`local`,r=e.get(n)??/* @__PURE__ */ new Map;t.path&&r.set(t.path,t.workspaceId),e.set(n,r)}return new Map(i.map(t=>{let n=e.get(t.remote?.hostId??`local`),r=oe(t.path,[...n?.keys()??[]]);return[t.workspaceId,r===void 0?void 0:n?.get(r)]}))},[b,i]),pe=(0,a.useMemo)(()=>{let e=new Set(B.values());return[...i.map(e=>e.workspaceId),``].filter(t=>x[t]??(t===``||e.has(t)))},[x,B,i]),me=(0,a.useMemo)(()=>{let t=F(e,i,l,M,{expandedGroups:pe,excludePinned:!0});return(f||e.hasMore&&t.length===0)&&!t.some(e=>e.key===``)&&t.push({key:``,workspaceId:void 0,cwd:void 0,createdAt:void 0,label:``,sessionCount:0,expanded:pe.includes(``),containsCurrent:!1,sessions:[]}),t},[e,i,l,M,pe,f]);(0,a.useEffect)(()=>{for(let e=P;e!==void 0;e=B.get(e))(x[e]===!1||e===P&&x[e]!==!0)&&C(e,!0)},[x,B,P,C]);let he=Date.now(),V=(e,t)=>{if(se.current)return;se.current=!0,ae(null);let n=me.find(t=>t.key===e.accountKey);if(n===void 0||t.id===e.sessionId)return;let r=e.accountKey===``?c:i.find(t=>t.workspaceId===e.accountKey)?.sessionIds;if(r===void 0)return;let a=Yt(n.sessions,ne[n.key]??5,N,k).rows,o=cn(r,a,e,t);o!==void 0&&E(e.accountKey,o)},ge=(e,t)=>{if(ue.current||(ue.current=!0,z(null),!vt(i,e.workspaceId,t.id)))return;let n=B.get(e.workspaceId),r=i.filter(e=>!e.remote&&B.get(e.workspaceId)===n),a=r.findIndex(e=>e.workspaceId===t.id);if(a===-1)return;let o=t.half===`before`?t.id:r[a+1]?.workspaceId;if(o===e.workspaceId)return;let s=r.findIndex(t=>t.workspaceId===e.workspaceId),c=o===void 0?r.length:r.findIndex(e=>e.workspaceId===o);(s===-1||c!==s&&c!==s+1)&&y(e.workspaceId,o).catch(e=>{console.warn(`workspace reorder rejected:`,e)})},_e=(0,a.useMemo)(()=>{let e=new Set(me.map(e=>e.key)),t=/* @__PURE__ */ new Map;for(let n of me){let r=B.get(n.key);for(;r!==void 0&&!e.has(r);)r=B.get(r);let i=t.get(r);i===void 0?t.set(r,[n]):i.push(n)}return t},[me,B]),ve=_e.get(void 0)??[],ye=ve[0]?.workspaceId!==void 0&&R?.over?.id===ve[0].workspaceId&&R.over.half===`before`,be=(0,a.useMemo)(()=>{let e=/* @__PURE__ */ new Map,t=(n,r)=>{e.set(n.key,r);for(let e of _e.get(n.key)??[])t(e,r)};for(let e of ve)t(e,e.key);return e},[_e,ve]),xe=(0,a.useMemo)(()=>{let e=/* @__PURE__ */ new Set;for(let t of[fe,P]){let n=t===void 0?void 0:be.get(t);n!==void 0&&n!==``&&e.add(n)}return e},[fe,P,be]),[Se,Ce]=(0,a.useState)(!1),H=ve.filter(e=>e.key!==``),we=Xt(H,5,xe),Te=Se?H:we.rows,Ee=le(w,L),De=le(w,ce),Oe=e=>{e.expanded&&re(t=>({...t,[e.key]:5})),C(e.key,!e.expanded)},U=ie(e,l.pinnedSessionIds,l,M).filter(e=>e.pinned),ke=[];if(U.length>0&&(ke.push(`section:${L}`),Ee))for(let e of U)ke.push(`session:${e.id}`);me.length===0&&U.length===0&&ke.push(`empty`);let Ae=(t,a)=>{let c=t.workspaceId,l=_e.get(t.key)??[],u=R!==null&&vt(i,R.workspaceId,c)&&B.get(R.workspaceId)===B.get(t.key),d=Yt(t.sessions,ne[t.key]??5,N,k);ke.push(`workspace:${t.key}`);let p=t.expanded?l.map(e=>Ae(e,a+1)):[],m=d.rows;for(let e of m)ke.push(`${c===void 0?`recent`:`session`}:${e.id}`);let y=t.expanded&&(d.hiddenCount>0||e.hasMore);y&&ke.push(`overflow:${t.key}`);let b=c!==void 0&&R?.over?.id===c?R.over.half:null,x=c===void 0||t.remote?void 0:{start:()=>{ue.current=!1,z({workspaceId:c,over:null})},end:()=>{R?.over!==null&&R?.over!==void 0?ge(R,R.over):z(null),ue.current=!1}},S=c===void 0||!u?void 0:e=>{z(t=>t===null?t:{...t,over:{id:c,half:e}})},w=c===void 0||!u?void 0:e=>{ge(R,{id:c,half:e})};return/* @__PURE__ */ (0,s.jsxs)(`div`,{"data-sidebar-group":t.key,style:{"--dsh-workspace-indent":`${a*12}px`},className:Q($.groupSection,b===`before`&&$.workspaceDropBefore,b===`after`&&$.workspaceDropAfter),onDragOver:R===null?void 0:e=>{e.preventDefault(),(S!==void 0||B.get(t.key)===void 0)&&(e.stopPropagation(),S===void 0?(e.dataTransfer.dropEffect=`none`,R.over!==null&&z({...R,over:null})):(e.dataTransfer.dropEffect=`move`,S(ln(e))))},onDrop:R===null?void 0:e=>{e.preventDefault(),(w!==void 0||B.get(t.key)===void 0)&&(e.stopPropagation(),w===void 0?(ue.current=!0,z(null)):w(ln(e)))},children:[c===void 0?/* @__PURE__ */ (0,s.jsx)(Ut,{label:O(`group.ungrouped`),expanded:t.expanded,onToggle:()=>{Oe(t)},rowKey:`workspace:${t.key}`,action:f?{label:O(`actions.newSession`),icon:/* @__PURE__ */ (0,s.jsx)(o.IconNewChatOutlineRegular,{size:16}),onActivate:()=>{C(t.key,!0),n()}}:void 0}):/* @__PURE__ */ (0,s.jsx)(kt,{newShortcut:j.find(e=>e.id===`session.new`),group:t,home:D,t:O,onToggle:()=>{Oe(t)},onCreate:()=>{t.workspaceId!==void 0&&(C(t.key,t.expanded),n(t.workspaceId))},drag:x,actions:t.workspaceId===void 0?void 0:{rename:()=>{
|
|
16
12
|
/* v8 ignore next -- narrowing guard: the actions object exists only for real-workspace groups. */
|
|
17
|
-
|
|
13
|
+
t.workspaceId!==void 0&&h(t.workspaceId,t.label)},delete:()=>{
|
|
18
14
|
/* v8 ignore next -- narrowing guard: the actions object exists only for real-workspace groups. */
|
|
19
|
-
|
|
15
|
+
t.workspaceId!==void 0&&g(t.workspaceId,t.label)}}}),p.length>0&&/* @__PURE__ */ (0,s.jsx)(`div`,{role:`group`,children:p}),(m.length>0||y)&&/* @__PURE__ */ (0,s.jsxs)(`div`,{role:`group`,className:$.groupSessions,style:{"--dsh-workspace-indent":`${c===void 0?0:a*12+22}px`},children:[m.map(e=>{let n=I!==null&&I.accountKey===t.key,i=n&&I.pinned===e.pinned,a=t=>e.blank?`after`:t,o={start:()=>{se.current=!1,ae({accountKey:t.key,sessionId:e.id,pinned:e.pinned,over:null})},active:i,marker:n&&I.over?.id===e.id?I.over.half:null,hover:t=>{
|
|
20
16
|
/* v8 ignore next -- narrowing guard: Rows gates hover on `active`, which is false while the drag state is null. */
|
|
21
|
-
|
|
17
|
+
ae(n=>n===null?n:{...n,over:{id:e.id,half:a(t)}})},drop:t=>{
|
|
22
18
|
/* v8 ignore next -- narrowing guard: Rows gates drop on `active`, which is false while the drag state is null. */
|
|
23
|
-
F!==null&&ue(F,{id:t.id,half:o(e)})},end:e=>{!e&&F?.over!==null&&F?.over!==void 0?ue(F,F.over):I(null),R.current=!1}};return/* @__PURE__ */ (0,s.jsx)(Te,{rowKey:i===void 0?`recent:${t.id}`:void 0,node:t,currentId:N,now:G,onOpen:r,onRenameRequest:_,renderSlot:v,onReveal:t.id===k&&e.key===P?()=>{A(t.id)}:void 0,drag:i===void 0?void 0:c,t:O},t.id)}),l.hiddenCount>0&&/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:Q.sessionOverflowButton,"data-row-key":`overflow:${e.key}`,onClick:()=>{re(t=>({...t,[e.key]:(t[e.key]??5)+10}))},children:O(`sessions.expand`,{n:Math.min(10,l.hiddenCount)})})]})]},e.key)},De=[];if(J.length>0&&Y.push(`section:${ae}`),Se){for(let e of be)De.push(Ee(e,0));!ge&&ve.hiddenCount>0&&(Y.push(`overflow:workspaces`),De.push(/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:Q.sessionOverflowButton,"data-row-key":`overflow:workspaces`,onClick:()=>{_e(!0)},children:O(`workspaces.expand`)},`overflow:workspaces`)))}let Oe=pe.find(e=>e.key===``);return Oe!==void 0&&De.push(Ee(Oe,0)),/* @__PURE__ */ (0,s.jsxs)(`div`,{className:K(Q.treeBody,Q.wide),children:[q&&/* @__PURE__ */ (0,s.jsx)(`span`,{className:Q.listTopDropIndicator,"aria-hidden":`true`}),/* @__PURE__ */ (0,s.jsxs)(je,{className:K(Q.list,q&&Q.listTopDropActive),label:O(`section.sessions`),rowKeys:Y,ready:e.phase===`ready`&&d&&!ce,resetKey:JSON.stringify([p,ne,ge,xe,Se]),children:[/* @__PURE__ */ (0,s.jsx)(Ie,{rows:we,currentId:N,onOpen:r,onRenameRequest:_,renderSlot:v,revealSessionId:k,onSessionRevealed:A,expanded:xe,onToggle:()=>{T(z,!xe)},t:O}),W.length===0&&we.length===0&&/* @__PURE__ */ (0,s.jsx)(Ze,{rowState:l,onLeaveArchivedOnly:u,t:O}),J.length>0&&/* @__PURE__ */ (0,s.jsx)(Ne,{label:O(`section.workspaces`),expanded:Se,onToggle:()=>{Se&&_e(!1),T(`workspaces`,!Se)},rowKey:`section:workspaces`}),De]}),/* @__PURE__ */ (0,s.jsx)(`span`,{className:Q.fade})]})}function $e({list:e,sessionIds:t,rowState:n,onLeaveArchivedOnly:r,useSessionStatus:i,open:o,onSessionRenameRequest:c,usePanelInfo:l,setSessionOrder:u,sectionExpansion:d,setSectionExpanded:f,workspaceReady:p,animationResetKey:m,revealSessionId:h,onSessionRevealed:g,renderSlot:_,t:v}){let y=l(e=>e.activePanelId!==null),b=i(e=>e),x=(0,a.useMemo)(()=>ie(e,t,n,b).filter(e=>!e.pinned),[e,t,n,b]),S=ie(e,n.pinnedSessionIds,n,b).filter(e=>e.pinned),[C,w]=(0,a.useState)(null),T=(0,a.useRef)(!1),[E,D]=(0,a.useState)(10);qe(C!==null);let O=y?void 0:Object.values(e.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,k=Le(x,E,O,h),A=Le(x,10,O,h).hiddenCount>0,j=(e,n)=>{if(T.current)return;T.current=!0,w(null);let r=Ye(t,x,e,n);r!==void 0&&u(R,r)},ee=Date.now(),M=oe(d,z);return/* @__PURE__ */ (0,s.jsxs)(`div`,{className:K(Q.treeBody,Q.wide),children:[/* @__PURE__ */ (0,s.jsxs)(je,{className:K(Q.list,Q.flatList),label:v(`section.sessions`),rowKeys:[...S.length===0?[]:[`section:${z}`],...M?S.map(e=>`session:${e.id}`):[],...x.length===0&&S.length===0?[`empty`]:[],...k.rows.map(e=>`session:${e.id}`),...A?[`overflow:flat`]:[]],ready:e.phase===`ready`&&p&&C===null,resetKey:`${m}/${E}/${String(M)}`,children:[/* @__PURE__ */ (0,s.jsx)(Ie,{rows:S,currentId:O,onOpen:o,onRenameRequest:c,renderSlot:_,revealSessionId:h,onSessionRevealed:g,expanded:M,onToggle:()=>{f(z,!M)},t:v}),S.length>0&&/* @__PURE__ */ (0,s.jsx)(Ne,{label:v(`section.sessions`)}),x.length===0&&S.length===0&&/* @__PURE__ */ (0,s.jsx)(Ze,{rowState:n,onLeaveArchivedOnly:r,t:v}),k.rows.map(e=>{let t=C!==null&&C.pinned===e.pinned,n=t=>e.blank?`after`:t;return/* @__PURE__ */ (0,s.jsx)(Te,{node:e,currentId:O,now:ee,onOpen:o,onRenameRequest:c,renderSlot:_,onReveal:e.id===h?()=>{g(e.id)}:void 0,drag:{start:()=>{T.current=!1,w({accountKey:R,sessionId:e.id,pinned:e.pinned,over:null})},active:t,marker:t&&C.over?.id===e.id?C.over.half:null,hover:t=>{w(r=>r===null?r:{...r,over:{id:e.id,half:n(t)}})},drop:t=>{C!==null&&j(C,{id:e.id,half:n(t)})},end:e=>{!e&&C?.over!==null&&C?.over!==void 0?j(C,C.over):w(null),T.current=!1}},t:v},e.id)}),A&&/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,"data-row-key":`overflow:flat`,className:Q.sessionOverflowButton,"aria-expanded":E>10,onClick:()=>D(k.hiddenCount>0?E+10:10),children:k.hiddenCount>0?v(`sessions.expand`,{n:Math.min(10,k.hiddenCount)}):v(`sessions.collapse`)})]}),/* @__PURE__ */ (0,s.jsx)(`span`,{className:Q.fade})]})}function et({useSessions:e,useSessionStatus:t,open:n,onUnarchive:r,workspaces:i,archivedSessionIds:o,archivedFilter:c,query:l,remote:u,resultLimit:d,usePanelInfo:f,t:p}){let m=f(e=>e.activePanelId!==null),h=e(e=>e),g=t(e=>e),_=u.query===l?u:{query:l,status:`loading`,items:[],hasMore:!1},v=(0,a.useMemo)(()=>F(h,i,l,o,c,g,_,d),[h,i,l,o,c,g,_,d]),y=_.status===`loading`,b=m?void 0:Object.values(h.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id;return/* @__PURE__ */ (0,s.jsxs)(`div`,{className:K(Q.treeBody,Q.wide),children:[/* @__PURE__ */ (0,s.jsxs)(`div`,{className:Q.list,children:[/* @__PURE__ */ (0,s.jsx)(`div`,{className:Q.searchTree,role:`tree`,"aria-label":p(`search.results.aria`),children:v.items.map(e=>/* @__PURE__ */ (0,s.jsx)(we,{result:e,currentId:b,onOpen:n,onUnarchive:r,t:p},e.id))}),y&&/* @__PURE__ */ (0,s.jsx)(`div`,{role:`status`,"aria-label":p(`search.pending`),children:(v.items.length===0?[0,1]:[0]).map(e=>/* @__PURE__ */ (0,s.jsxs)(`div`,{className:Q.skeletonRow,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,s.jsx)(`span`,{className:Q.skeletonDot}),/* @__PURE__ */ (0,s.jsxs)(`span`,{className:Q.skeletonBars,children:[/* @__PURE__ */ (0,s.jsx)(`span`,{className:Q.skeletonBar}),/* @__PURE__ */ (0,s.jsx)(`span`,{className:K(Q.skeletonBar,Q.skeletonBarWide)})]})]},e))}),!y&&v.items.length===0&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:Q.empty,children:p(`search.noMatches`)}),v.hasMore&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:Q.searchStatus,children:p(`search.hasMore`,{n:d})})]}),/* @__PURE__ */ (0,s.jsx)(`span`,{className:Q.fade})]})}function tt({wide:e,usePanelInfo:t,expandSidebar:n,useSessions:r,useSessionStatus:i,useWorkspaces:c,useStore:l,actions:u,startSession:d,open:f,requestSessionRename:p,notifyArchivedNotOpenable:m,renameWorkspace:h,deleteWorkspace:g,insertWorkspaceBefore:_,unarchiveSession:v,createWorkspace:y,searchSessions:b,searchResultLimit:x,useDirectoryFlow:S,useHostInfo:C,useShortcuts:w,useWorkspaceShortcuts:O,requestSearch:k,requestAddWorkspace:A,closeAddWorkspace:j,setDirectoryBusy:ee,dismissForkError:M,renderSlot:N,t:P}){let te=C(e=>e.home),re=w(e=>e),ie=re.find(e=>e.id===`session.search`),F=re.find(e=>e.id===`workspace.add`),I=O(e=>e),L=r(e=>e),z=c(e=>e.items),ae=c(e=>e.canStartProjectless===!0),oe=P(`workspace.defaultName`),B=(0,a.useMemo)(()=>z.map(e=>({...e,title:fe(e.title,oe)})),[z,oe]),V=c(e=>e.phase),ce=c(e=>e.state),H=c(e=>e.archivedSessionIds),U=c(e=>e.pinnedSessionIds),le=S(e=>e),W=l(e=>e.groupBy),G=l(e=>e.orderBy),ue=l(e=>e.archivedFilter??`default`),de=l(e=>e.groupExpansion),pe=l(e=>e.sectionExpansion),q=l(e=>e.sessionOrderByAccount),me=e=>{H.includes(e)?m():f(e)},he=()=>{u.setArchivedFilter(`default`)},ge=V===`ready`&&ce!==`loading`,_e=Object.values(L.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,J=_e!==void 0&&L.byId[_e]?.blank===!0?_e:void 0,ve=(0,a.useMemo)(()=>{let e=new Set(B.flatMap(e=>e.sessionIds));return[.../* @__PURE__ */ new Set([...L.ids,...H])].filter(t=>!e.has(t))},[H,L.ids,B]),ye=(0,a.useMemo)(()=>({pinnedSessionIds:U,archivedSessionIds:H}),[H,U]),be=(0,a.useMemo)(()=>({...ye,archivedFilter:ue}),[ye,ue]),xe=(0,a.useMemo)(()=>ne(L,H),[H,L]),Se=(0,a.useMemo)(()=>B.map(e=>{let t=e.sessionIds,n=G===`updated`?T(t,L.byId):E(t,q[e.workspaceId],L.byId,ye);return{...e,sessionIds:D(n,J!==void 0&&t.includes(J)?J:void 0)}}),[J,L.byId,G,ye,q,B]),Ce=(0,a.useMemo)(()=>T(ve,L.byId),[L.byId,ve]),we=(0,a.useMemo)(()=>D(G===`updated`?T(xe,L.byId):E(xe,q[R],L.byId,ye),J!==void 0&&xe.includes(J)?J:void 0),[J,xe,L.byId,G,ye,q]),Te=(0,a.useMemo)(()=>se(B,L,ye),[L,ye,B]),Y=(0,a.useMemo)(()=>Object.fromEntries([...Se.map(e=>[e.workspaceId,e.sessionIds]),[``,Ce],[R,we]]),[we,Ce,Se]);(0,a.useEffect)(()=>{V===`ready`&&u.retainAccountKeys([``,R,...B.map(e=>e.workspaceId)])},[u.retainAccountKeys,V,B]),(0,a.useEffect)(()=>{if(L.phase!==`ready`||ge||G!==`manual`||J===void 0)return;let e={};for(let[t,n]of Object.entries(Y)){if(t!==`__flat_session_order__`&&V!==`ready`)continue;let r=q[t]??[];n[0]===J&&r[0]!==J&&(e[t]=[J,...r.filter(e=>e!==J)])}Object.keys(e).length>0&&u.syncSessionOrders(e,Te)},[u.syncSessionOrders,Y,J,L.phase,G,q,Te,V,ge]),(0,a.useEffect)(()=>{L.phase===`ready`&&ge&&G===`manual`&&J!==void 0&&Object.entries(Y).some(([e,t])=>t[0]===J&&q[e]?.[0]!==J)&&u.syncSessionOrders(Y,Te)},[u.syncSessionOrders,Y,J,L.phase,G,q,Te,ge]);let Ee=(e,t)=>{u.setSessionOrder(e,t,Y,Te)},[De,Oe]=(0,a.useState)(``),[X,ke]=(0,a.useState)(!1),[Ae,je]=(0,a.useState)(void 0),Z=Ke(De).trim(),[Me,Ne]=(0,a.useState)({query:``,status:`idle`,items:[],hasMore:!1}),Pe=(0,a.useRef)(null),Fe=(0,a.useRef)(null),Ie=I.addRequested,Le=(0,a.useRef)(null),Re=(0,a.useRef)(!1),ze=e=>{H.includes(e)?m():(je(e),Oe(``),ke(!1),f(e))},Be=e=>{je(t=>t===e?void 0:t)};(0,a.useEffect)(()=>{Z!==``&&je(void 0)},[Z]);let[Ve,He]=(0,a.useState)(!1);(0,a.useEffect)(()=>{if(e&&Ve){let e=window.setTimeout(()=>{Fe.current?.focus({preventScroll:!0}),He(!1)},300);return()=>{window.clearTimeout(e)}}},[e,Ve]),(0,a.useEffect)(()=>{I.searchRequest!==0&&(j(),ke(!0),e?Fe.current?.focus({preventScroll:!0}):(He(!0),n()))},[I.searchRequest]),(0,a.useEffect)(()=>{e&&X&&!Ve&&Fe.current?.focus({preventScroll:!0})},[e,X,Ve]),(0,a.useEffect)(()=>{if(!e||!X||Ve)return;let t=e=>{e.target instanceof Node&&Pe.current?.contains(e.target)!==!0&&(Fe.current?.blur(),Z===``&&ke(!1))};return document.addEventListener(`click`,t),()=>{document.removeEventListener(`click`,t)}},[Z,e,X,Ve]),(0,a.useEffect)(()=>{if(Z===``){Ne({query:``,status:`idle`,items:[],hasMore:!1});return}let e=new AbortController;Ne({query:Z,status:`loading`,items:[],hasMore:!1});let t=window.setTimeout(()=>{b(Z,e.signal).then(t=>{e.signal.aborted||Ne({query:Z,status:`ready`,items:t.items,hasMore:t.hasMore})}).catch(()=>{e.signal.aborted||Ne({query:Z,status:`error`,items:[],hasMore:!1})})},250);return()=>{window.clearTimeout(t),e.abort()}},[Z,b]);let[We,Ge]=(0,a.useState)(null),[qe,Ye]=(0,a.useState)(``),[Xe,Ze]=(0,a.useState)(!1),[tt,nt]=(0,a.useState)(null),rt=qe.trim(),it=We!==null&&rt!==``&&B.some(e=>e.workspaceId!==We.workspaceId&&e.title===rt),at=Xe||rt===``||We===null||rt===We.storedTitle||it,ot=()=>{Xe||(Ge(null),nt(null))},st=()=>{at||(Ze(!0),nt(null),h(We.workspaceId,rt).then(()=>{Ze(!1),Ge(null)}).catch(e=>{Ze(!1),nt(e instanceof Error?e.message:String(e))}))},ct=e=>{v(e).catch(e=>{console.warn(`session unarchive rejected:`,e)})},[lt,ut]=(0,a.useState)(null),[dt,ft]=(0,a.useState)(!1),[pt,mt]=(0,a.useState)(null),[ht,gt]=(0,a.useState)(null);(0,a.useEffect)(()=>{pt===null||B.some(e=>e.workspaceId===pt)||(ft(!1),mt(null),ut(null))},[pt,B]);let _t=()=>{dt||(ut(null),gt(null))},vt=()=>{
|
|
19
|
+
I!==null&&V(I,{id:e.id,half:a(t)})},end:e=>{!e&&I?.over!==null&&I?.over!==void 0?V(I,I.over):ae(null),se.current=!1}};return/* @__PURE__ */ (0,s.jsx)(Mt,{rowKey:c===void 0?`recent:${e.id}`:void 0,showHost:!t.remote,node:e,currentId:N,now:he,onOpen:r,onRenameRequest:_,renderSlot:v,onReveal:e.id===k&&t.key===P?()=>{A(e.id)}:void 0,drag:c===void 0||t.remote?void 0:o,t:O},e.id)}),y&&/* @__PURE__ */ (0,s.jsx)(Zt,{rowKey:`overflow:${t.key}`,hiddenCount:d.hiddenCount,hasMore:e.hasMore,loading:e.loading,expand:()=>{re(e=>({...e,[t.key]:(e[t.key]??5)+10}))},loadMoreSessions:ee,t:O})]})]},t.key)},W=[];if(H.length>0&&ke.push(`section:${ce}`),De){for(let e of Te)W.push(Ae(e,0));!Se&&we.hiddenCount>0&&(ke.push(`overflow:workspaces`),W.push(/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:$.sessionOverflowButton,"data-row-key":`overflow:workspaces`,onClick:()=>{Ce(!0)},children:O(`workspaces.expand`)},`overflow:workspaces`)))}let je=ve.find(e=>e.key===``);return je!==void 0&&W.push(Ae(je,0)),/* @__PURE__ */ (0,s.jsxs)(`div`,{className:Q($.treeBody,$.wide),children:[ye&&/* @__PURE__ */ (0,s.jsx)(`span`,{className:$.listTopDropIndicator,"aria-hidden":`true`}),/* @__PURE__ */ (0,s.jsxs)(Bt,{className:Q($.list,ye&&$.listTopDropActive),label:O(`section.sessions`),rowKeys:ke,ready:e.phase===`ready`&&d&&!de,resetKey:JSON.stringify([p,ne,Se,Ee,De]),children:[/* @__PURE__ */ (0,s.jsx)(Kt,{rows:U,currentId:N,onOpen:r,onRenameRequest:_,renderSlot:v,revealSessionId:k,onSessionRevealed:A,expanded:Ee,onToggle:()=>{T(L,!Ee)},t:O}),me.length===0&&U.length===0&&/* @__PURE__ */ (0,s.jsx)(un,{rowState:l,onLeaveArchivedOnly:u,partial:e.hasMore,t:O}),H.length>0&&/* @__PURE__ */ (0,s.jsx)(Ut,{label:O(`section.workspaces`),expanded:De,onToggle:()=>{De&&Ce(!1),T(`workspaces`,!De)},rowKey:`section:workspaces`}),W]}),/* @__PURE__ */ (0,s.jsx)(`span`,{className:$.fade})]})}function fn({list:e,sessionIds:t,rowState:n,onLeaveArchivedOnly:r,useSessionStatus:i,open:o,onSessionRenameRequest:c,usePanelInfo:l,setSessionOrder:u,sectionExpansion:d,setSectionExpanded:f,workspaceReady:p,animationResetKey:m,revealSessionId:h,onSessionRevealed:g,renderSlot:_,loadMoreSessions:v,t:y}){let b=l(e=>e.activePanelId!==null),x=i(e=>e),S=(0,a.useMemo)(()=>ie(e,t,n,x).filter(e=>!e.pinned),[e,t,n,x]),C=ie(e,n.pinnedSessionIds,n,x).filter(e=>e.pinned),[w,T]=(0,a.useState)(null),E=(0,a.useRef)(!1),[D,O]=(0,a.useState)(10);on(w!==null);let k=b?void 0:Object.values(e.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,A=Yt(S,D,k,h),j=Yt(S,10,k,h).hiddenCount>0,ee=(e,n)=>{if(E.current)return;E.current=!0,T(null);let r=cn(t,S,e,n);r!==void 0&&u(se,r)},te=Date.now(),M=le(d,L);return/* @__PURE__ */ (0,s.jsxs)(`div`,{className:Q($.treeBody,$.wide),children:[/* @__PURE__ */ (0,s.jsxs)(Bt,{className:Q($.list,$.flatList),label:y(`section.sessions`),rowKeys:[...C.length===0?[]:[`section:${L}`],...M?C.map(e=>`session:${e.id}`):[],...S.length===0&&C.length===0?[`empty`]:[],...A.rows.map(e=>`session:${e.id}`),...j||e.hasMore?[`overflow:flat`]:[]],ready:e.phase===`ready`&&p&&w===null,resetKey:`${m}/${D}/${String(M)}`,children:[/* @__PURE__ */ (0,s.jsx)(Kt,{rows:C,currentId:k,onOpen:o,onRenameRequest:c,renderSlot:_,revealSessionId:h,onSessionRevealed:g,expanded:M,onToggle:()=>{f(L,!M)},t:y}),C.length>0&&/* @__PURE__ */ (0,s.jsx)(Ut,{label:y(`section.sessions`)}),S.length===0&&C.length===0&&/* @__PURE__ */ (0,s.jsx)(un,{rowState:n,onLeaveArchivedOnly:r,partial:e.hasMore,t:y}),A.rows.map(e=>{let t=w!==null&&w.pinned===e.pinned,n=t=>e.blank?`after`:t;return/* @__PURE__ */ (0,s.jsx)(Mt,{node:e,currentId:k,now:te,onOpen:o,onRenameRequest:c,renderSlot:_,onReveal:e.id===h?()=>{g(e.id)}:void 0,drag:{start:()=>{E.current=!1,T({accountKey:se,sessionId:e.id,pinned:e.pinned,over:null})},active:t,marker:t&&w.over?.id===e.id?w.over.half:null,hover:t=>{T(r=>r===null?r:{...r,over:{id:e.id,half:n(t)}})},drop:t=>{w!==null&&ee(w,{id:e.id,half:n(t)})},end:e=>{!e&&w?.over!==null&&w?.over!==void 0?ee(w,w.over):T(null),E.current=!1}},t:y},e.id)}),/* @__PURE__ */ (0,s.jsx)(Zt,{rowKey:`overflow:flat`,hiddenCount:A.hiddenCount,hasMore:e.hasMore,loading:e.loading,expanded:D>10,expand:()=>O(D+10),collapse:j?()=>O(10):void 0,loadMoreSessions:v,t:y})]}),/* @__PURE__ */ (0,s.jsx)(`span`,{className:$.fade})]})}function pn({useSessions:e,useSessionStatus:t,open:n,onUnarchive:r,workspaces:i,archivedSessionIds:o,archivedFilter:c,query:l,remote:u,resultLimit:d,usePanelInfo:f,t:p}){let m=f(e=>e.activePanelId!==null),h=e(e=>e),g=t(e=>e),_=u.query===l?u:{query:l,status:`loading`,items:[],hasMore:!1},v=(0,a.useMemo)(()=>I(h,i,l,o,c,g,_,d),[h,i,l,o,c,g,_,d]),y=_.status===`loading`,b=m?void 0:Object.values(h.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id;return/* @__PURE__ */ (0,s.jsxs)(`div`,{className:Q($.treeBody,$.wide),children:[/* @__PURE__ */ (0,s.jsxs)(`div`,{className:$.list,children:[/* @__PURE__ */ (0,s.jsx)(`div`,{className:$.searchTree,role:`tree`,"aria-label":p(`search.results.aria`),children:v.items.map(e=>/* @__PURE__ */ (0,s.jsx)(jt,{result:e,currentId:b,onOpen:n,onUnarchive:r,t:p},e.id))}),y&&/* @__PURE__ */ (0,s.jsx)(`div`,{role:`status`,"aria-label":p(`search.pending`),children:(v.items.length===0?[0,1]:[0]).map(e=>/* @__PURE__ */ (0,s.jsxs)(`div`,{className:$.skeletonRow,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,s.jsx)(`span`,{className:$.skeletonDot}),/* @__PURE__ */ (0,s.jsxs)(`span`,{className:$.skeletonBars,children:[/* @__PURE__ */ (0,s.jsx)(`span`,{className:$.skeletonBar}),/* @__PURE__ */ (0,s.jsx)(`span`,{className:Q($.skeletonBar,$.skeletonBarWide)})]})]},e))}),!y&&v.items.length===0&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:$.empty,children:p(`search.noMatches`)}),v.hasMore&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:$.searchStatus,children:p(`search.hasMore`,{n:d})})]}),/* @__PURE__ */ (0,s.jsx)(`span`,{className:$.fade})]})}function mn({wide:e,usePanelInfo:t,expandSidebar:n,useSessions:r,useSessionStatus:i,useWorkspaces:c,useStore:l,actions:u,startSession:d,open:f,requestSessionRename:p,notifyArchivedNotOpenable:m,renameWorkspace:h,deleteWorkspace:g,insertWorkspaceBefore:_,unarchiveSession:v,createWorkspace:y,searchSessions:b,searchResultLimit:x,useDirectoryFlow:S,useHostInfo:C,useShortcuts:w,useWorkspaceShortcuts:O,requestSearch:k,requestAddWorkspace:A,closeAddWorkspace:j,setDirectoryBusy:ee,dismissForkError:te,refreshSessions:M,loadMoreSessions:N,renderSlot:P,t:F}){let re=C(e=>e.home),ie=w(e=>e),I=ie.find(e=>e.id===`session.search`),ae=ie.find(e=>e.id===`workspace.add`),oe=O(e=>e),L=r(e=>e),ce=c(e=>e.items),le=c(e=>e.canStartProjectless===!0),R=F(`workspace.defaultName`),z=(0,a.useMemo)(()=>ce.map(e=>({...e,title:bt(e.title,R)})),[ce,R]),de=c(e=>e.phase),fe=c(e=>e.state),B=c(e=>e.archivedSessionIds),pe=c(e=>e.pinnedSessionIds),me=S(e=>e),he=l(e=>e.groupBy),V=l(e=>e.orderBy),ge=l(e=>e.archivedFilter??`default`),_e=l(e=>e.groupExpansion),ve=l(e=>e.sectionExpansion),ye=l(e=>e.sessionOrderByAccount),be=e=>{B.includes(e)?m():f(e)},xe=()=>{u.setArchivedFilter(`default`)},Se=de===`ready`&&fe!==`loading`,Ce=Object.values(L.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,H=Ce!==void 0&&L.byId[Ce]?.blank===!0?Ce:void 0,we=(0,a.useMemo)(()=>{let e=new Set(z.flatMap(e=>e.sessionIds));return[.../* @__PURE__ */ new Set([...L.ids,...B])].filter(t=>!e.has(t))},[B,L.ids,z]),Te=(0,a.useMemo)(()=>({pinnedSessionIds:pe,archivedSessionIds:B}),[B,pe]),Ee=(0,a.useMemo)(()=>({...Te,archivedFilter:ge}),[Te,ge]),De=(0,a.useMemo)(()=>ne(L,B),[B,L]),Oe=(0,a.useMemo)(()=>z.map(e=>{let t=e.sessionIds,n=V===`updated`?T(t,L.byId):E(t,ye[e.workspaceId],L.byId,Te);return{...e,sessionIds:D(n,H!==void 0&&t.includes(H)?H:void 0)}}),[H,L.byId,V,Te,ye,z]),U=(0,a.useMemo)(()=>T(we,L.byId),[L.byId,we]),ke=(0,a.useMemo)(()=>D(V===`updated`?T(De,L.byId):E(De,ye[se],L.byId,Te),H!==void 0&&De.includes(H)?H:void 0),[H,De,L.byId,V,Te,ye]),Ae=(0,a.useMemo)(()=>ue(z,L,Te),[L,Te,z]),W=(0,a.useMemo)(()=>Object.fromEntries([...Oe.map(e=>[e.workspaceId,e.sessionIds]),[``,U],[se,ke]]),[ke,U,Oe]);(0,a.useEffect)(()=>{de===`ready`&&u.retainAccountKeys([``,se,...z.map(e=>e.workspaceId)])},[u.retainAccountKeys,de,z]),(0,a.useEffect)(()=>{if(L.phase!==`ready`||Se||V!==`manual`||H===void 0)return;let e={};for(let[t,n]of Object.entries(W)){if(t!==`__flat_session_order__`&&de!==`ready`)continue;let r=ye[t]??[];n[0]===H&&r[0]!==H&&(e[t]=[H,...r.filter(e=>e!==H)])}Object.keys(e).length>0&&u.syncSessionOrders(e,Ae)},[u.syncSessionOrders,W,H,L.phase,V,ye,Ae,de,Se]),(0,a.useEffect)(()=>{L.phase===`ready`&&Se&&V===`manual`&&H!==void 0&&Object.entries(W).some(([e,t])=>t[0]===H&&ye[e]?.[0]!==H)&&u.syncSessionOrders(W,Ae)},[u.syncSessionOrders,W,H,L.phase,V,ye,Ae,Se]);let je=(e,t)=>{u.setSessionOrder(e,t,W,Ae)},[Me,Ne]=(0,a.useState)(``),[G,Pe]=(0,a.useState)(!1),[Fe,Ie]=(0,a.useState)(void 0),Le=an(Me).trim(),[K,Re]=(0,a.useState)({query:``,status:`idle`,items:[],hasMore:!1}),ze=(0,a.useRef)(null),q=(0,a.useRef)(null),Be=oe.addRequested,Ve=(0,a.useRef)(null),He=(0,a.useRef)(!1),Ue=e=>{B.includes(e)?m():(Ie(e),Ne(``),Pe(!1),f(e))},We=e=>{Ie(t=>t===e?void 0:t)};(0,a.useEffect)(()=>{Le!==``&&Ie(void 0)},[Le]);let[J,Ge]=(0,a.useState)(!1);(0,a.useEffect)(()=>{if(e&&J){let e=window.setTimeout(()=>{q.current?.focus({preventScroll:!0}),Ge(!1)},300);return()=>{window.clearTimeout(e)}}},[e,J]),(0,a.useEffect)(()=>{oe.searchRequest!==0&&(j(),Pe(!0),e?q.current?.focus({preventScroll:!0}):(Ge(!0),n()))},[oe.searchRequest]),(0,a.useEffect)(()=>{e&&G&&!J&&q.current?.focus({preventScroll:!0})},[e,G,J]),(0,a.useEffect)(()=>{if(!e||!G||J)return;let t=e=>{e.target instanceof Node&&ze.current?.contains(e.target)!==!0&&(q.current?.blur(),Le===``&&Pe(!1))};return document.addEventListener(`click`,t),()=>{document.removeEventListener(`click`,t)}},[Le,e,G,J]),(0,a.useEffect)(()=>{if(Le===``){Re({query:``,status:`idle`,items:[],hasMore:!1});return}let e=new AbortController;Re({query:Le,status:`loading`,items:[],hasMore:!1});let t=window.setTimeout(()=>{b(Le,e.signal).then(t=>{e.signal.aborted||Re({query:Le,status:`ready`,items:t.items,hasMore:t.hasMore})}).catch(()=>{e.signal.aborted||Re({query:Le,status:`error`,items:[],hasMore:!1})})},250);return()=>{window.clearTimeout(t),e.abort()}},[Le,b]);let[Ke,qe]=(0,a.useState)(null),[Je,Ye]=(0,a.useState)(``),[Xe,Ze]=(0,a.useState)(!1),[Qe,Y]=(0,a.useState)(null),X=Je.trim(),$e=Ke!==null&&X!==``&&z.some(e=>e.workspaceId!==Ke.workspaceId&&e.title===X),et=Xe||X===``||Ke===null||X===Ke.storedTitle||$e,tt=()=>{Xe||(qe(null),Y(null))},nt=()=>{et||(Ze(!0),Y(null),h(Ke.workspaceId,X).then(()=>{Ze(!1),qe(null)}).catch(e=>{Ze(!1),Y(e instanceof Error?e.message:String(e))}))},rt=e=>{v(e).catch(e=>{console.warn(`session unarchive rejected:`,e)})},[it,at]=(0,a.useState)(null),[ot,st]=(0,a.useState)(!1),[ct,lt]=(0,a.useState)(null),[ut,Z]=(0,a.useState)(null);(0,a.useEffect)(()=>{ct===null||z.some(e=>e.workspaceId===ct)||(st(!1),lt(null),at(null))},[ct,z]);let dt=()=>{ot||(at(null),Z(null))},ft=()=>{
|
|
24
20
|
/* v8 ignore next -- the Modal is absent without a target and its button is disabled while deleting. */
|
|
25
|
-
dt||lt===null||(ft(!0),mt(null),gt(null),g(lt.workspaceId).then(()=>{mt(lt.workspaceId)}).catch(e=>{ft(!1),gt(e instanceof Error?e.message:String(e))}))};return/* @__PURE__ */ (0,s.jsxs)(`div`,{className:K(Q.root,!e&&Q.rail),children:[/* @__PURE__ */ (0,s.jsxs)(`div`,{className:Q.sectionHeader,children:[e&&/* @__PURE__ */ (0,s.jsx)(`span`,{className:K(Q.sectionLabel,Q.wide,X&&Q.sectionLabelHidden),children:P(`section.sessions`)}),e&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:K(Q.searchSlot,X&&Q.searchSlotExpanded),children:/* @__PURE__ */ (0,s.jsxs)(`div`,{ref:Pe,className:K(Q.search,X&&Q.searchExpanded),onClick:()=>{j(),ke(!0),Fe.current?.focus()},children:[/* @__PURE__ */ (0,s.jsx)(o.Tooltip,{label:P(`search`),shortcutKeys:ie?.keys,side:`bottom`,delayMs:500,disabled:X,children:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:Q.searchButton,"aria-label":P(`search.sessions.aria`),"aria-keyshortcuts":ie?.aria,"aria-expanded":X,onClick:()=>{k()},children:/* @__PURE__ */ (0,s.jsx)(o.IconSearchOutlineRegular,{size:16})})}),/* @__PURE__ */ (0,s.jsx)(`input`,{ref:Fe,className:Q.searchInput,type:`text`,placeholder:P(`search.placeholder`),maxLength:500,value:De,tabIndex:X?0:-1,onChange:e=>{Oe(Ke(e.target.value))},onKeyDown:e=>{e.key===`Escape`&&(e.currentTarget.closest(`[data-phone-drawer]`)&&(e.preventDefault(),e.stopPropagation()),Oe(``),ke(!1))}}),X&&/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:Q.clearButton,"aria-label":P(`search.clear`),onClick:e=>{e.stopPropagation(),Oe(``),ke(!1)},children:/* @__PURE__ */ (0,s.jsx)(o.IconCloseFillRegular,{})})]})}),/* @__PURE__ */ (0,s.jsxs)(`div`,{className:K(Q.headerActions,e&&X&&Q.headerActionsHidden),children:[e&&/* @__PURE__ */ (0,s.jsx)(Je,{groupBy:W,orderBy:G,archivedFilter:ue,onGroupPick:u.setGroupBy,onOrderPick:e=>{u.setOrderBy(e,Y,Te)},onArchivedFilterPick:u.setArchivedFilter,t:P}),le&&/* @__PURE__ */ (0,s.jsx)(o.Tooltip,{label:P(`workspace.add`),shortcutKeys:F?.keys,side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,s.jsx)(`button`,{ref:Le,type:`button`,className:Q.iconButton,"aria-label":P(`workspace.add`),"aria-keyshortcuts":F?.aria,onClick:()=>{A()},children:/* @__PURE__ */ (0,s.jsx)(o.IconProjectAddOutlineRegular,{size:e?16:18})})})]}),/* @__PURE__ */ (0,s.jsx)(Ue,{t:P,open:Ie,anchorRef:Le,useWorkspaces:c,createWorkspace:y,useDirectoryFlow:S,renderDirectoryFlow:e=>N(`sidebar.workspaces.directoryFlow`,e),addOnly:!0,onBusyChange:ee,side:`right`,onPick:e=>{j(),d(e)},onClose:()=>{j()}})]}),!e&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:Q.search,children:/* @__PURE__ */ (0,s.jsx)(o.Tooltip,{label:P(`search`),shortcutKeys:ie?.keys,children:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:Q.searchButton,"aria-label":P(`search.sessions.aria`),"aria-keyshortcuts":ie?.aria,onClick:()=>{k()},children:/* @__PURE__ */ (0,s.jsx)(o.IconSearchOutlineRegular,{size:18})})})}),/* @__PURE__ */ (0,s.jsxs)(`div`,{className:Q.listArea,children:[e&&L.phase===`pending`&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:Q.empty,role:`status`,children:P(`sessions.loading`)}),e&&(Z===``?W===`flat`?/* @__PURE__ */ (0,s.jsx)($e,{usePanelInfo:t,list:L,sessionIds:we,rowState:be,onLeaveArchivedOnly:he,workspaceReady:ge,animationResetKey:`${W}/${G}/${ue}`,useSessionStatus:i,open:me,onSessionRenameRequest:p,renderSlot:N,setSessionOrder:Ee,sectionExpansion:pe,setSectionExpanded:u.setSectionExpanded,revealSessionId:Ae,onSessionRevealed:Be,t:P}):/* @__PURE__ */ (0,s.jsx)(Qe,{usePanelInfo:t,list:L,shortcuts:re,useSessionStatus:i,onSessionRenameRequest:p,renderSlot:N,workspaces:Se,ungroupedSessionIds:Ce,canStartProjectless:ae,workspaceReady:ge,nestWorkspaces:W===`workspace-tree`,animationResetKey:`${W}/${G}/${ue}`,groupExpansion:de,setGroupExpanded:u.setGroupExpanded,sectionExpansion:pe,setSectionExpanded:u.setSectionExpanded,setSessionOrder:Ee,rowState:be,onLeaveArchivedOnly:he,startSession:d,open:me,insertWorkspaceBefore:_,revealSessionId:Ae,onSessionRevealed:Be,home:te,t:P,onRenameRequest:(e,t)=>{Ge({workspaceId:e,storedTitle:z.find(t=>t.workspaceId===e)?.title??t}),Ye(t),nt(null)},onDeleteRequest:(e,t)=>{ut({workspaceId:e,title:t}),gt(null)}}):/* @__PURE__ */ (0,s.jsx)(et,{usePanelInfo:t,useSessions:r,useSessionStatus:i,open:ze,onUnarchive:ct,workspaces:B,archivedSessionIds:H,archivedFilter:ue,query:Z,remote:Me,resultLimit:x,t:P}))]}),/* @__PURE__ */ (0,s.jsxs)(o.Modal,{open:We!==null,onClose:ot,closeLabel:P(`close`),title:P(`rename.workspace.title`),footer:/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`outline`,disabled:Xe,onClick:ot,children:P(`cancel`)}),/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`primary`,disabled:at,onClick:st,children:P(`rename`)})]}),children:[/* @__PURE__ */ (0,s.jsx)(`input`,{className:Q.renameInput,value:qe,"aria-label":P(`field.workspaceName`),"data-modal-autofocus":!0,disabled:Xe,onFocus:e=>{e.target.select()},onChange:e=>{Ye(e.target.value),nt(null)},onCompositionStart:()=>{Re.current=!0},onCompositionEnd:()=>{Re.current=!1},onKeyDown:e=>{e.key===`Enter`&&!Re.current&&(e.preventDefault(),st())}}),it&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:Q.renameError,role:`alert`,children:P(`conflict.named`,{name:rt})}),tt!==null&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:Q.renameError,role:`alert`,children:tt})]}),/* @__PURE__ */ (0,s.jsxs)(o.Modal,{open:lt!==null,onClose:_t,closeLabel:P(`close`),title:P(`delete.workspace`),...lt===null?{}:{description:P(`delete.desc`,{name:lt.title})},footer:/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`outline`,disabled:dt,onClick:_t,children:P(`cancel`)}),/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`outline`,className:Q.deleteAction,disabled:dt,onClick:vt,children:P(`delete.workspace`)})]}),children:[dt&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:Q.deleteStatus,role:`status`,children:P(`delete.pending`)}),ht!==null&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:Q.renameError,role:`alert`,children:ht})]}),I.forkError!==null&&/* @__PURE__ */ (0,s.jsx)(o.Toast,{text:P(I.forkError.reason===`unavailable`?`shortcut.noCompletedTurn`:`shortcut.forkFailed`),onDone:M},I.forkError.seq)]})}function nt({sessionId:e,useArchived:t,useMenuOpenState:n,useShortcuts:r,archiveSession:i,unarchiveSession:a,t:c}){let[,l]=n(),u=r(e=>e.find(e=>e.id===`session.archive`)),d=t(t=>t.has(e));return/* @__PURE__ */ (0,s.jsx)(o.MenuItemButton,{shortcut:d?void 0:u,icon:d?/* @__PURE__ */ (0,s.jsx)(o.IconUnarchiveOutlineRegular,{size:16}):/* @__PURE__ */ (0,s.jsx)(o.IconArchiveOutlineRegular,{size:16}),onSelect:()=>{l(!1),(d?a:i)(e)},children:c(d?`menu.unarchiveSession`:`menu.archiveSession`)})}function rt({sessionId:e,useArchived:t,archiveSession:n,unarchiveSession:r,t:i}){let a=t(t=>t.has(e));return/* @__PURE__ */ (0,s.jsx)(o.Tooltip,{label:i(a?`actions.unarchive`:`actions.archive`),side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:q.iconButton,"aria-label":i(a?`menu.unarchiveSession`:`menu.archiveSession`),onClick:()=>{(a?r:n)(e)},children:a?/* @__PURE__ */ (0,s.jsx)(o.IconUnarchiveOutlineRegular,{size:16}):/* @__PURE__ */ (0,s.jsx)(o.IconArchiveOutlineRegular,{size:16})})})}function it({useArchiveRequest:e,settleSessionArchive:t,stopAndArchiveSession:n,t:r}){let i=e(e=>e);return i===null?null:/* @__PURE__ */ (0,s.jsx)(at,{request:i,stopAndArchiveSession:n,onSettle:t,t:r},i.sessionId)}function at({request:e,stopAndArchiveSession:t,onSettle:n,t:r}){let[i,c]=(0,a.useState)(!1),[l,u]=(0,a.useState)(null),d=()=>{i||n()};return/* @__PURE__ */ (0,s.jsxs)(o.Modal,{phoneSidebar:!0,open:!0,onClose:d,closeLabel:r(`close`),title:r(`archive.confirm.title`),description:r(`archive.confirm.desc`,{title:e.displayTitle}),footer:/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`outline`,disabled:i,onClick:d,children:r(`cancel`)}),/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`outline`,className:Q.deleteAction,disabled:i,onClick:()=>{c(!0),u(null),t(e.sessionId).then(()=>{c(!1),n()}).catch(e=>{c(!1),u(e instanceof Error?e.message:String(e))})},children:r(`archive.confirm.action`)})]}),children:[/* @__PURE__ */ (0,s.jsx)(`ul`,{className:Q.archiveActivity,"aria-label":r(`archive.confirm.activity`),children:e.activity.map((e,t)=>/* @__PURE__ */ (0,s.jsx)(`li`,{children:ot(e,r)},`${e.kind}-${String(t)}`))}),i&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:Q.deleteStatus,role:`status`,children:r(`archive.confirm.pending`)}),l!==null&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:Q.renameError,role:`alert`,children:l})]})}function ot(e,t){let n=e.items??[],r=n.length,i=n.map(e=>e.label??e.id).join(t(`archive.confirm.listSeparator`)),a=r===1?`one`:`other`;switch(e.kind){case`turn`:return t(`archive.confirm.turn`);case`subagent`:return t(`archive.confirm.subagents.${a}`,{n:r,names:i});case`job`:return t(`archive.confirm.jobs.${a}`,{n:r,names:i});case`schedule`:return t(`archive.confirm.schedules.${a}`,{n:r,names:i});default:return t(`archive.confirm.other.${a}`,{kind:e.kind,n:r})}}function st(e,t){let n,r;return{getSnapshot:()=>{let i=e.getSnapshot();return(r===void 0||i!==n)&&(n=i,r=t(i)),r},subscribe:t=>e.subscribe(t)}}function ct({sessionId:e,useMenuOpenState:t,useShortcuts:n,forkSession:r,t:i}){let[,a]=t(),c=n(e=>e.find(e=>e.id===`session.fork`));return/* @__PURE__ */ (0,s.jsx)(o.MenuItemButton,{shortcut:c,icon:/* @__PURE__ */ (0,s.jsx)(o.IconBranchOutlineRegular,{}),onSelect:()=>{a(!1),r(e)},children:i(`menu.fork`)})}function lt({sessionId:e,useSessions:t,useMenuOpenState:n,copySessionLink:r,t:i}){let a=t(t=>{let n=t.byId[e];return n!==void 0&&y(n)!==void 0}),[,c]=n();return a?/* @__PURE__ */ (0,s.jsx)(o.MenuItemButton,{icon:/* @__PURE__ */ (0,s.jsx)(o.IconCopyOutlineRegular,{}),onSelect:()=>{c(!1),r(e)},children:i(`menu.copySessionLink`)}):null}function ut({sessionId:e,usePinned:t,useArchived:n}){return{pinned:t(t=>t.has(e)),archived:n(t=>t.has(e))}}function dt(e){let{sessionId:t,useMenuOpenState:n,pinSession:r,unpinSession:i,t:a}=e,[,c]=n(),{pinned:l,archived:u}=ut(e);return u?null:/* @__PURE__ */ (0,s.jsx)(o.MenuItemButton,{icon:l?/* @__PURE__ */ (0,s.jsx)(o.IconPinFillRegular,{}):/* @__PURE__ */ (0,s.jsx)(o.IconPinOutlineRegular,{}),onSelect:()=>{c(!1),(l?i:r)(t)},children:a(l?`menu.unpinSession`:`menu.pinSession`)})}function ft(e){let{sessionId:t,pinSession:n,unpinSession:r,t:i}=e,{pinned:a,archived:c}=ut(e);return c?null:/* @__PURE__ */ (0,s.jsx)(o.Tooltip,{label:i(a?`actions.unpin`:`actions.pin`),side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:q.iconButton,"aria-label":i(a?`menu.unpinSession`:`menu.pinSession`),onClick:()=>{(a?r:n)(t)},children:a?/* @__PURE__ */ (0,s.jsx)(o.IconPinFillRegular,{size:16}):/* @__PURE__ */ (0,s.jsx)(o.IconPinOutlineRegular,{size:16})})})}function pt({sessionId:e,displayTitle:t,useMenuOpenState:n,useShortcuts:r,requestSessionRename:i,t:a}){let[,c]=n(),l=r(e=>e.find(e=>e.id===`session.rename`));return/* @__PURE__ */ (0,s.jsx)(o.MenuItemButton,{shortcut:l,icon:/* @__PURE__ */ (0,s.jsx)(o.IconEditOutlineRegular,{}),onSelect:()=>{c(!1),i(e,t)},children:a(`rename`)})}function mt({useRenameRequest:e,settleSessionRename:t,renameSession:n,t:r}){let i=e(e=>e);return i===null?null:/* @__PURE__ */ (0,s.jsx)(ht,{request:i,renameSession:n,onSettle:t,t:r},i.sessionId)}function ht({request:e,renameSession:t,onSettle:n,t:r}){let[i,c]=(0,a.useState)(e.currentTitle),[l,u]=(0,a.useState)(!1),[d,f]=(0,a.useState)(null),p=(0,a.useRef)(!1),m=i.trim(),h=l||m===``,g=()=>{l||n()},_=()=>{h||(u(!0),f(null),t(e.sessionId,m).then(()=>{u(!1),n()}).catch(e=>{u(!1),f(e instanceof Error?e.message:String(e))}))};return/* @__PURE__ */ (0,s.jsxs)(o.Modal,{phoneSidebar:!0,open:!0,onClose:g,closeLabel:r(`close`),title:r(`rename.session.title`),footer:/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`outline`,disabled:l,onClick:g,children:r(`cancel`)}),/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`primary`,disabled:h,onClick:_,children:r(`rename`)})]}),children:[/* @__PURE__ */ (0,s.jsx)(`input`,{className:Q.renameInput,value:i,"aria-label":r(`field.sessionName`),"data-modal-autofocus":!0,disabled:l,onFocus:e=>{e.target.select()},onChange:e=>{c(e.target.value),f(null)},onCompositionStart:()=>{p.current=!0},onCompositionEnd:()=>{p.current=!1},onKeyDown:e=>{e.key===`Enter`&&!p.current&&(e.preventDefault(),_())}}),d!==null&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:Q.renameError,role:`alert`,children:d})]})}let gt=6e3;function _t({useToast:e,useStore:t,dismissToast:n,undoArchive:r,showArchived:i,t:a}){let c=e(e=>e),l=t(e=>(e.archivedFilter??`default`)!=="default");if(c===null)return null;if(c.kind===`archived`||c.kind===`stoppedAndArchived`){let{sessionId:e}=c;return/* @__PURE__ */ (0,s.jsx)(o.Toast,{text:a(c.kind===`archived`?`toast.archived`:`toast.stoppedAndArchived`),tone:`success`,holdMs:gt,actions:[{label:a(`toast.archivedUndo`),onClick:()=>{n(),r(e)}},...l?[]:[{prefix:a(`toast.archivedOr`),label:a(`toast.archivedFilter`),onClick:()=>{n(),i()}}]],onDone:n},`toast-${String(c.seq)}`)}return c.kind===`createFailed`||c.kind===`forkFailed`?/* @__PURE__ */ (0,s.jsx)(o.Toast,{text:a(c.kind===`forkFailed`?`toast.forkFailed`:`toast.createFailed`,{message:c.message}),icon:/* @__PURE__ */ (0,s.jsx)(o.IconWarningOutlineRegular,{}),holdMs:gt,onDone:n},`toast-${String(c.seq)}`):/* @__PURE__ */ (0,s.jsx)(o.Toast,{text:vt(c,a),icon:/* @__PURE__ */ (0,s.jsx)(o.IconWarningOutlineRegular,{}),onDone:n},`toast-${String(c.seq)}`)}function vt(e,t){switch(e.kind){case`archiveFailed`:return t(`toast.archiveFailed`,{message:e.message});case`unarchiveFailed`:return t(`toast.unarchiveFailed`,{message:e.message});case`pinFailed`:return t(`toast.pinFailed`,{message:e.message});case`unpinFailed`:return t(`toast.unpinFailed`,{message:e.message});case`defaultWorkspaceFailed`:return t(`defaultWorkspace.failed`);case`archivedNotOpenable`:return t(`toast.archivedNotOpenable`);case`sessionLinkCopied`:return t(`toast.sessionLinkCopied`);case`sessionLinkCopyFailed`:return t(`toast.sessionLinkCopyFailed`);
|
|
21
|
+
ot||it===null||(st(!0),lt(null),Z(null),g(it.workspaceId).then(()=>{lt(it.workspaceId)}).catch(e=>{st(!1),Z(e instanceof Error?e.message:String(e))}))};return/* @__PURE__ */ (0,s.jsxs)(`div`,{className:Q($.root,!e&&$.rail),children:[/* @__PURE__ */ (0,s.jsxs)(`div`,{className:$.sectionHeader,children:[e&&/* @__PURE__ */ (0,s.jsx)(`span`,{className:Q($.sectionLabel,$.wide,G&&$.sectionLabelHidden),children:F(`section.sessions`)}),e&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:Q($.searchSlot,G&&$.searchSlotExpanded),children:/* @__PURE__ */ (0,s.jsxs)(`div`,{ref:ze,className:Q($.search,G&&$.searchExpanded),onClick:()=>{j(),Pe(!0),q.current?.focus()},children:[/* @__PURE__ */ (0,s.jsx)(o.Tooltip,{label:F(`search`),shortcutKeys:I?.keys,side:`bottom`,delayMs:500,disabled:G,children:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:$.searchButton,"aria-label":F(`search.sessions.aria`),"aria-keyshortcuts":I?.aria,"aria-expanded":G,onClick:()=>{k()},children:/* @__PURE__ */ (0,s.jsx)(o.IconSearchOutlineRegular,{size:16})})}),/* @__PURE__ */ (0,s.jsx)(`input`,{ref:q,className:$.searchInput,type:`text`,placeholder:F(`search.placeholder`),maxLength:500,value:Me,tabIndex:G?0:-1,onChange:e=>{Ne(an(e.target.value))},onKeyDown:e=>{e.key===`Escape`&&(e.currentTarget.closest(`[data-phone-drawer]`)&&(e.preventDefault(),e.stopPropagation()),Ne(``),Pe(!1))}}),G&&/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:$.clearButton,"aria-label":F(`search.clear`),onClick:e=>{e.stopPropagation(),Ne(``),Pe(!1)},children:/* @__PURE__ */ (0,s.jsx)(o.IconCloseFillRegular,{})})]})}),/* @__PURE__ */ (0,s.jsxs)(`div`,{className:Q($.headerActions,e&&G&&$.headerActionsHidden),children:[e&&/* @__PURE__ */ (0,s.jsx)(sn,{groupBy:he,orderBy:V,archivedFilter:ge,onGroupPick:u.setGroupBy,onOrderPick:e=>{u.setOrderBy(e,W,Ae)},onArchivedFilterPick:u.setArchivedFilter,t:F}),me&&/* @__PURE__ */ (0,s.jsx)(o.Tooltip,{label:F(`workspace.add`),shortcutKeys:ae?.keys,side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,s.jsx)(`button`,{ref:Ve,type:`button`,className:$.iconButton,"aria-label":F(`workspace.add`),"aria-keyshortcuts":ae?.aria,onClick:()=>{A()},children:/* @__PURE__ */ (0,s.jsx)(o.IconProjectAddOutlineRegular,{size:e?16:18})})})]}),/* @__PURE__ */ (0,s.jsx)(nn,{t:F,open:Be,anchorRef:Ve,useWorkspaces:c,createWorkspace:y,useDirectoryFlow:S,renderDirectoryFlow:e=>P(`sidebar.workspaces.directoryFlow`,e),addOnly:!0,onBusyChange:ee,side:`right`,onPick:e=>{j(),d(e)},onClose:()=>{j()}})]}),!e&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:$.search,children:/* @__PURE__ */ (0,s.jsx)(o.Tooltip,{label:F(`search`),shortcutKeys:I?.keys,children:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:$.searchButton,"aria-label":F(`search.sessions.aria`),"aria-keyshortcuts":I?.aria,onClick:()=>{k()},children:/* @__PURE__ */ (0,s.jsx)(o.IconSearchOutlineRegular,{size:18})})})}),/* @__PURE__ */ (0,s.jsxs)(`div`,{className:$.listArea,children:[e&&L.phase===`pending`&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:$.empty,role:`status`,children:F(`sessions.loading`)}),e&&(Le===``?he===`flat`?/* @__PURE__ */ (0,s.jsx)(fn,{loadMoreSessions:N,usePanelInfo:t,list:L,sessionIds:ke,rowState:Ee,onLeaveArchivedOnly:xe,workspaceReady:Se,animationResetKey:`${he}/${V}/${ge}`,useSessionStatus:i,open:be,onSessionRenameRequest:p,renderSlot:P,setSessionOrder:je,sectionExpansion:ve,setSectionExpanded:u.setSectionExpanded,revealSessionId:Fe,onSessionRevealed:We,t:F}):/* @__PURE__ */ (0,s.jsx)(dn,{loadMoreSessions:N,usePanelInfo:t,list:L,shortcuts:ie,useSessionStatus:i,onSessionRenameRequest:p,renderSlot:P,workspaces:Oe,ungroupedSessionIds:U,canStartProjectless:le,workspaceReady:Se,nestWorkspaces:he===`workspace-tree`,animationResetKey:`${he}/${V}/${ge}`,groupExpansion:_e,setGroupExpanded:u.setGroupExpanded,sectionExpansion:ve,setSectionExpanded:u.setSectionExpanded,setSessionOrder:je,rowState:Ee,onLeaveArchivedOnly:xe,startSession:d,open:be,insertWorkspaceBefore:_,revealSessionId:Fe,onSessionRevealed:We,home:re,t:F,onRenameRequest:(e,t)=>{qe({workspaceId:e,storedTitle:ce.find(t=>t.workspaceId===e)?.title??t}),Ye(t),Y(null)},onDeleteRequest:(e,t)=>{at({workspaceId:e,title:t}),Z(null)}}):/* @__PURE__ */ (0,s.jsx)(pn,{usePanelInfo:t,useSessions:r,useSessionStatus:i,open:Ue,onUnarchive:rt,workspaces:z,archivedSessionIds:B,archivedFilter:ge,query:Le,remote:K,resultLimit:x,t:F}))]}),e&&/* @__PURE__ */ (0,s.jsx)(Jt,{list:L,refreshSessions:M,loadMoreSessions:N,t:F}),/* @__PURE__ */ (0,s.jsxs)(o.Modal,{open:Ke!==null,onClose:tt,closeLabel:F(`close`),title:F(`rename.workspace.title`),footer:/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`outline`,disabled:Xe,onClick:tt,children:F(`cancel`)}),/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`primary`,disabled:et,onClick:nt,children:F(`rename`)})]}),children:[/* @__PURE__ */ (0,s.jsx)(`input`,{className:$.renameInput,value:Je,"aria-label":F(`field.workspaceName`),"data-modal-autofocus":!0,disabled:Xe,onFocus:e=>{e.target.select()},onChange:e=>{Ye(e.target.value),Y(null)},onCompositionStart:()=>{He.current=!0},onCompositionEnd:()=>{He.current=!1},onKeyDown:e=>{e.key===`Enter`&&!He.current&&(e.preventDefault(),nt())}}),$e&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:$.renameError,role:`alert`,children:F(`conflict.named`,{name:X})}),Qe!==null&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:$.renameError,role:`alert`,children:Qe})]}),/* @__PURE__ */ (0,s.jsxs)(o.Modal,{open:it!==null,onClose:dt,closeLabel:F(`close`),title:F(`delete.workspace`),...it===null?{}:{description:F(`delete.desc`,{name:it.title})},footer:/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`outline`,disabled:ot,onClick:dt,children:F(`cancel`)}),/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`outline`,className:$.deleteAction,disabled:ot,onClick:ft,children:F(`delete.workspace`)})]}),children:[ot&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:$.deleteStatus,role:`status`,children:F(`delete.pending`)}),ut!==null&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:$.renameError,role:`alert`,children:ut})]}),oe.forkError!==null&&/* @__PURE__ */ (0,s.jsx)(o.Toast,{text:F(oe.forkError.reason===`unavailable`?`shortcut.noCompletedTurn`:`shortcut.forkFailed`),onDone:te},oe.forkError.seq)]})}function hn({sessionId:e,useArchived:t,useMenuOpenState:n,useShortcuts:r,archiveSession:i,unarchiveSession:a,t:c}){let[,l]=n(),u=r(e=>e.find(e=>e.id===`session.archive`)),d=t(t=>t.has(e));return/* @__PURE__ */ (0,s.jsx)(o.MenuItemButton,{shortcut:d?void 0:u,icon:d?/* @__PURE__ */ (0,s.jsx)(o.IconUnarchiveOutlineRegular,{size:16}):/* @__PURE__ */ (0,s.jsx)(o.IconArchiveOutlineRegular,{size:16}),onSelect:()=>{l(!1),(d?a:i)(e)},children:c(d?`menu.unarchiveSession`:`menu.archiveSession`)})}function gn({sessionId:e,useArchived:t,archiveSession:n,unarchiveSession:r,t:i}){let a=t(t=>t.has(e));return/* @__PURE__ */ (0,s.jsx)(o.Tooltip,{label:i(a?`actions.unarchive`:`actions.archive`),side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:W.iconButton,"aria-label":i(a?`menu.unarchiveSession`:`menu.archiveSession`),onClick:()=>{(a?r:n)(e)},children:a?/* @__PURE__ */ (0,s.jsx)(o.IconUnarchiveOutlineRegular,{size:16}):/* @__PURE__ */ (0,s.jsx)(o.IconArchiveOutlineRegular,{size:16})})})}function _n({useArchiveRequest:e,settleSessionArchive:t,stopAndArchiveSession:n,t:r}){let i=e(e=>e);return i===null?null:/* @__PURE__ */ (0,s.jsx)(vn,{request:i,stopAndArchiveSession:n,onSettle:t,t:r},i.sessionId)}function vn({request:e,stopAndArchiveSession:t,onSettle:n,t:r}){let[i,c]=(0,a.useState)(!1),[l,u]=(0,a.useState)(null),d=()=>{i||n()};return/* @__PURE__ */ (0,s.jsxs)(o.Modal,{phoneSidebar:!0,open:!0,onClose:d,closeLabel:r(`close`),title:r(`archive.confirm.title`),description:r(`archive.confirm.desc`,{title:e.displayTitle}),footer:/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`outline`,disabled:i,onClick:d,children:r(`cancel`)}),/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`outline`,className:$.deleteAction,disabled:i,onClick:()=>{c(!0),u(null),t(e.sessionId).then(()=>{c(!1),n()}).catch(e=>{c(!1),u(e instanceof Error?e.message:String(e))})},children:r(`archive.confirm.action`)})]}),children:[/* @__PURE__ */ (0,s.jsx)(`ul`,{className:$.archiveActivity,"aria-label":r(`archive.confirm.activity`),children:e.activity.map((e,t)=>/* @__PURE__ */ (0,s.jsx)(`li`,{children:yn(e,r)},`${e.kind}-${String(t)}`))}),i&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:$.deleteStatus,role:`status`,children:r(`archive.confirm.pending`)}),l!==null&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:$.renameError,role:`alert`,children:l})]})}function yn(e,t){let n=e.items??[],r=n.length,i=n.map(e=>e.label??e.id).join(t(`archive.confirm.listSeparator`)),a=r===1?`one`:`other`;switch(e.kind){case`turn`:return t(`archive.confirm.turn`);case`subagent`:return t(`archive.confirm.subagents.${a}`,{n:r,names:i});case`job`:return t(`archive.confirm.jobs.${a}`,{n:r,names:i});case`schedule`:return t(`archive.confirm.schedules.${a}`,{n:r,names:i});default:return t(`archive.confirm.other.${a}`,{kind:e.kind,n:r})}}function bn(e,t){let n,r;return{getSnapshot:()=>{let i=e.getSnapshot();return(r===void 0||i!==n)&&(n=i,r=t(i)),r},subscribe:t=>e.subscribe(t)}}function xn({sessionId:e,useMenuOpenState:t,useShortcuts:n,forkSession:r,t:i}){let[,a]=t(),c=n(e=>e.find(e=>e.id===`session.fork`));return/* @__PURE__ */ (0,s.jsx)(o.MenuItemButton,{shortcut:c,icon:/* @__PURE__ */ (0,s.jsx)(o.IconBranchOutlineRegular,{}),onSelect:()=>{a(!1),r(e)},children:i(`menu.fork`)})}function Sn({sessionId:e,useSessions:t,useMenuOpenState:n,copySessionLink:r,t:i}){let a=t(t=>{let n=t.byId[e];return n!==void 0&&y(n)!==void 0}),[,c]=n();return a?/* @__PURE__ */ (0,s.jsx)(o.MenuItemButton,{icon:/* @__PURE__ */ (0,s.jsx)(o.IconCopyOutlineRegular,{}),onSelect:()=>{c(!1),r(e)},children:i(`menu.copySessionLink`)}):null}function Cn({sessionId:e,usePinned:t,useArchived:n}){return{pinned:t(t=>t.has(e)),archived:n(t=>t.has(e))}}function wn(e){let{sessionId:t,useMenuOpenState:n,pinSession:r,unpinSession:i,t:a}=e,[,c]=n(),{pinned:l,archived:u}=Cn(e);return u?null:/* @__PURE__ */ (0,s.jsx)(o.MenuItemButton,{icon:l?/* @__PURE__ */ (0,s.jsx)(o.IconPinFillRegular,{}):/* @__PURE__ */ (0,s.jsx)(o.IconPinOutlineRegular,{}),onSelect:()=>{c(!1),(l?i:r)(t)},children:a(l?`menu.unpinSession`:`menu.pinSession`)})}function Tn(e){let{sessionId:t,pinSession:n,unpinSession:r,t:i}=e,{pinned:a,archived:c}=Cn(e);return c?null:/* @__PURE__ */ (0,s.jsx)(o.Tooltip,{label:i(a?`actions.unpin`:`actions.pin`),side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,s.jsx)(`button`,{type:`button`,className:W.iconButton,"aria-label":i(a?`menu.unpinSession`:`menu.pinSession`),onClick:()=>{(a?r:n)(t)},children:a?/* @__PURE__ */ (0,s.jsx)(o.IconPinFillRegular,{size:16}):/* @__PURE__ */ (0,s.jsx)(o.IconPinOutlineRegular,{size:16})})})}function En({sessionId:e,displayTitle:t,useMenuOpenState:n,useShortcuts:r,requestSessionRename:i,t:a}){let[,c]=n(),l=r(e=>e.find(e=>e.id===`session.rename`));return/* @__PURE__ */ (0,s.jsx)(o.MenuItemButton,{shortcut:l,icon:/* @__PURE__ */ (0,s.jsx)(o.IconEditOutlineRegular,{}),onSelect:()=>{c(!1),i(e,t)},children:a(`rename`)})}function Dn({useRenameRequest:e,settleSessionRename:t,renameSession:n,t:r}){let i=e(e=>e);return i===null?null:/* @__PURE__ */ (0,s.jsx)(On,{request:i,renameSession:n,onSettle:t,t:r},i.sessionId)}function On({request:e,renameSession:t,onSettle:n,t:r}){let[i,c]=(0,a.useState)(e.currentTitle),[l,u]=(0,a.useState)(!1),[d,f]=(0,a.useState)(null),p=(0,a.useRef)(!1),m=i.trim(),h=l||m===``,g=()=>{l||n()},_=()=>{h||(u(!0),f(null),t(e.sessionId,m).then(()=>{u(!1),n()}).catch(e=>{u(!1),f(e instanceof Error?e.message:String(e))}))};return/* @__PURE__ */ (0,s.jsxs)(o.Modal,{phoneSidebar:!0,open:!0,onClose:g,closeLabel:r(`close`),title:r(`rename.session.title`),footer:/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`outline`,disabled:l,onClick:g,children:r(`cancel`)}),/* @__PURE__ */ (0,s.jsx)(o.Button,{variant:`primary`,disabled:h,onClick:_,children:r(`rename`)})]}),children:[/* @__PURE__ */ (0,s.jsx)(`input`,{className:$.renameInput,value:i,"aria-label":r(`field.sessionName`),"data-modal-autofocus":!0,disabled:l,onFocus:e=>{e.target.select()},onChange:e=>{c(e.target.value),f(null)},onCompositionStart:()=>{p.current=!0},onCompositionEnd:()=>{p.current=!1},onKeyDown:e=>{e.key===`Enter`&&!p.current&&(e.preventDefault(),_())}}),d!==null&&/* @__PURE__ */ (0,s.jsx)(`div`,{className:$.renameError,role:`alert`,children:d})]})}let kn=6e3;function An({useToast:e,useStore:t,dismissToast:n,undoArchive:r,showArchived:i,t:a}){let c=e(e=>e),l=t(e=>(e.archivedFilter??`default`)!=="default");if(c===null)return null;if(c.kind===`archived`||c.kind===`stoppedAndArchived`){let{sessionId:e}=c;return/* @__PURE__ */ (0,s.jsx)(o.Toast,{text:a(c.kind===`archived`?`toast.archived`:`toast.stoppedAndArchived`),tone:`success`,holdMs:kn,actions:[{label:a(`toast.archivedUndo`),onClick:()=>{n(),r(e)}},...l?[]:[{prefix:a(`toast.archivedOr`),label:a(`toast.archivedFilter`),onClick:()=>{n(),i()}}]],onDone:n},`toast-${String(c.seq)}`)}return c.kind===`createFailed`||c.kind===`forkFailed`?/* @__PURE__ */ (0,s.jsx)(o.Toast,{text:a(c.kind===`forkFailed`?`toast.forkFailed`:`toast.createFailed`,{message:c.message}),icon:/* @__PURE__ */ (0,s.jsx)(o.IconWarningOutlineRegular,{}),holdMs:kn,onDone:n},`toast-${String(c.seq)}`):/* @__PURE__ */ (0,s.jsx)(o.Toast,{text:jn(c,a),icon:/* @__PURE__ */ (0,s.jsx)(o.IconWarningOutlineRegular,{}),onDone:n},`toast-${String(c.seq)}`)}function jn(e,t){switch(e.kind){case`archiveFailed`:return t(`toast.archiveFailed`,{message:e.message});case`unarchiveFailed`:return t(`toast.unarchiveFailed`,{message:e.message});case`pinFailed`:return t(`toast.pinFailed`,{message:e.message});case`unpinFailed`:return t(`toast.unpinFailed`,{message:e.message});case`defaultWorkspaceFailed`:return t(`defaultWorkspace.failed`);case`archivedNotOpenable`:return t(`toast.archivedNotOpenable`);case`sessionLinkCopied`:return t(`toast.sessionLinkCopied`);case`sessionLinkCopyFailed`:return t(`toast.sessionLinkCopyFailed`);case`recentVisitsStorageFailed`:return t(`recent.cache.error`);
|
|
26
22
|
/* v8 ignore next 2 -- closed-union backstop; only reached if a notice kind is forged */
|
|
27
|
-
default:return h(e)}}let yt={"defaultWorkspace.failed":`无法创建默认工作区,请通过“选择工作区”选择文件夹`,"draft.workspaceRequired":`请先选择工作区`,"draft.initializationFailed":`暂时无法填入草稿,请稍后重试`,"group.ungrouped":`最近`,"session.new":`新会话`,"session.untitled":`未命名`,"session.backToList":`返回会话列表`,"shortcut.noSession":`请先选择一个会话`,"shortcut.noPicker":`目录选择器不可用`,"shortcut.directoryBusy":`正在选择或添加工作区`,"shortcut.noCompletedTurn":`当前会话没有已结束的轮次`,"shortcut.forkFailed":`无法分叉会话,请重试`,"section.workspaces":`工作区`,"section.sessions":`会话`,"section.pinned":`置顶`,"viewOptions.label":`视图选项`,"groupBy.label":`分组方式`,"groupBy.workspace":`按工作区`,"groupBy.workspaceTree":`按工作区树`,"groupBy.flat":`单列表`,"orderBy.label":`排序方式`,"orderBy.manual":`手动排序`,"orderBy.updated":`最近更新`,"filterBy.label":`筛选会话`,"viewOptions.hideArchived":`隐藏已归档`,"viewOptions.showArchived":`全部对话(显示已归档)`,"viewOptions.onlyArchived":`仅显示已归档`,"sessions.expand":`展开显示`,"sessions.collapse":`收起`,"sessions.loading":`正在加载历史会话…`,"workspaces.expand":`展开显示`,"empty.none":`暂无会话`,"empty.noneArchived":`暂无已归档会话`,"empty.viewOthers":`查看其他会话`,"empty.noMatches":`无匹配结果`,"workspace.add":`添加工作区`,"search.sessions.aria":`搜索会话`,"search.placeholder":`搜索会话名称`,"search.clear":`清除搜索`,"search.results.aria":`搜索结果`,"search.pending":`正在搜索会话历史…`,"search.noMatches":`无匹配会话`,"search.hasMore":`仅显示前 {n} 条结果,请缩小搜索范围。`,"menu.addWorkspace":`添加工作区…`,"menu.noWorkspace":`不选择工作区`,"picker.loading":`正在加载工作区…`,"conflict.named":`已存在名为“{name}”的工作区。`,"folderError.title":`无法打开文件夹`,"folderError.retry":`重新选择`,rename:`重命名`,"rename.workspace.title":`重命名工作区`,"rename.session.title":`重命名会话`,"field.workspaceName":`工作区名称`,"field.sessionName":`会话名称`,"delete.workspace":`删除工作区`,"delete.desc":`将把“{name}”从工作区列表中移除。文件夹与会话记录会保留,其会话将显示在“未分组”下。`,"delete.pending":`正在删除工作区…`,"menu.copySessionLink":`复制会话链接`,"toast.sessionLinkCopied":`已复制`,"toast.sessionLinkCopyFailed":`复制会话链接失败`,"menu.fork":`分叉会话`,"menu.archiveSession":`归档会话`,"menu.unarchiveSession":`取消归档`,"menu.pinSession":`置顶会话`,"menu.unpinSession":`取消置顶`,"row.archived":`已归档`,"row.pinned":`已置顶`,"toast.archivedNotOpenable":`已归档对话暂时无法查看,请取消归档后查看`,"toast.archived":`会话已归档,可`,"toast.stoppedAndArchived":`已停止并归档,可`,"archive.confirm.title":`停止并归档此会话?`,"archive.confirm.desc":`“{title}”仍有正在进行的工作。归档会先停止这些工作;之后可在侧栏筛选“全部对话(显示已归档)”中恢复会话,被停止的工作不会自动继续。`,"archive.confirm.activity":`将被停止的工作`,"archive.confirm.turn":`进行中的回合`,"archive.confirm.subagents.one":`{n} 个运行中的子智能体:{names}`,"archive.confirm.subagents.other":`{n} 个运行中的子智能体:{names}`,"archive.confirm.jobs.one":`{n} 个后台任务:{names}`,"archive.confirm.jobs.other":`{n} 个后台任务:{names}`,"archive.confirm.schedules.one":`{n} 条定时提醒:{names}`,"archive.confirm.schedules.other":`{n} 条定时提醒:{names}`,"archive.confirm.other.one":`{n} 项其他工作({kind})`,"archive.confirm.other.other":`{n} 项其他工作({kind})`,"archive.confirm.listSeparator":`、`,"archive.confirm.action":`停止并归档`,"archive.confirm.pending":`正在停止并归档…`,"toast.archivedUndo":`撤销`,"toast.archivedOr":`或`,"toast.archivedFilter":`筛选已归档会话`,"toast.archiveFailed":`归档未确认,请检查会话状态:{message}`,"toast.unarchiveFailed":`取消归档未确认,请刷新后检查:{message}`,"toast.pinFailed":`置顶未确认,请刷新后检查:{message}`,"toast.unpinFailed":`取消置顶未确认,请刷新后检查:{message}`,"toast.createFailed":`新建会话失败:{message}`,"toast.forkFailed":`分叉未完成:{message}`,"sessions.count.one":`{n} 个会话`,"sessions.count.other":`{n} 个会话`,"actions.workspace.aria":`工作区“{name}”的操作`,"actions.session.aria":`会话“{name}”的操作`,"actions.archive":`归档会话`,"actions.unarchive":`取消归档`,"actions.pin":`置顶会话`,"actions.unpin":`取消置顶`,"actions.newSession":`新会话`,"actions.newSession.aria":`在“{name}”中新建会话`,"status.running":`进行中`,"status.subagentsRunning.one":`{n} 个子智能体运行中`,"status.subagentsRunning.other":`{n} 个子智能体运行中`,"status.idle":`空闲`,"status.waitingApproval":`等待审批`,"status.planReview":`计划待审`,"status.waitingAnswer":`等待回答`,"status.compact.approval":`待审批`,"status.compact.planReview":`计划待审`,"status.compact.answer":`待回答`,"status.completed":`已完成`,"hover.created":`创建于 {time}`,"hover.copied":`已复制`,"date.ymd":`{y}年{m}月{d}日`,"time.now":`刚刚`,"time.minutes":`{n}分钟`,"time.hours":`{n}小时`,"time.days":`{n}天`,"time.months":`{n}个月`,"time.years":`{n}年`,"time.ago":`{t}前`},bt={"defaultWorkspace.failed":`Unable to create default workspace. Use Choose workspace to select a folder.`,"draft.workspaceRequired":`Choose a workspace first.`,"draft.initializationFailed":`Could not fill the draft. Please try again shortly.`,"group.ungrouped":`Recents`,"session.new":`New Session`,"session.untitled":`Untitled`,"session.backToList":`Back to session list`,"shortcut.noSession":`Select a session first`,"shortcut.noPicker":`Directory picker unavailable`,"shortcut.directoryBusy":`Selecting or adding a workspace`,"shortcut.noCompletedTurn":`This session has no completed turn`,"shortcut.forkFailed":`Could not fork the session. Try again.`,"section.workspaces":`Workspaces`,"section.sessions":`Sessions`,"section.pinned":`Pinned`,"viewOptions.label":`View options`,"groupBy.label":`Group by`,"groupBy.workspace":`WorkSpace`,"groupBy.workspaceTree":`Workspace Tree`,"groupBy.flat":`In one list`,"orderBy.label":`Order by`,"orderBy.manual":`Manual`,"orderBy.updated":`Last updated`,"filterBy.label":`Filter sessions`,"viewOptions.hideArchived":`Hide archived`,"viewOptions.showArchived":`All conversations (show archived)`,"viewOptions.onlyArchived":`Archived only`,"sessions.expand":`Show {n} more`,"sessions.collapse":`Show less`,"sessions.loading":`Loading conversation history…`,"workspaces.expand":`Show all workspaces`,"empty.none":`No sessions yet`,"empty.noneArchived":`No archived sessions yet`,"empty.viewOthers":`View other sessions`,"empty.noMatches":`No matches`,"workspace.add":`Add workspace`,"search.sessions.aria":`Search sessions`,"search.placeholder":`Search session names`,"search.clear":`Clear search`,"search.results.aria":`Search results`,"search.pending":`Searching session history…`,"search.noMatches":`No matching sessions`,"search.hasMore":`Showing the first {n} results. Narrow your search.`,"menu.addWorkspace":`Add workspace…`,"menu.noWorkspace":`No workspace`,"picker.loading":`Loading workspaces…`,"conflict.named":`A workspace named “{name}” already exists.`,"folderError.title":`Couldn’t open folder`,"folderError.retry":`Choose again`,rename:`Rename`,"rename.workspace.title":`Rename workspace`,"rename.session.title":`Rename session`,"field.workspaceName":`Workspace name`,"field.sessionName":`Session name`,"delete.workspace":`Delete workspace`,"delete.desc":`This removes “{name}” from the workspace list. The folder and session logs will be kept. Its sessions will appear under Ungrouped.`,"delete.pending":`Deleting workspace…`,"menu.copySessionLink":`Copy session link`,"toast.sessionLinkCopied":`Copied`,"toast.sessionLinkCopyFailed":`Could not copy session link`,"menu.fork":`Fork session`,"menu.archiveSession":`Archive session`,"menu.unarchiveSession":`Unarchive session`,"menu.pinSession":`Pin session`,"menu.unpinSession":`Unpin session`,"row.archived":`Archived`,"row.pinned":`Pinned`,"toast.archivedNotOpenable":`Archived sessions cannot be opened. Unarchive it to view.`,"toast.archived":`Session archived. You can `,"toast.stoppedAndArchived":`Session stopped and archived. You can `,"archive.confirm.title":`Stop and archive this session?`,"archive.confirm.desc":`“{title}” still has work in progress. Archiving stops it first; you can restore the session later from the “All conversations (show archived)” filter in the sidebar, and the stopped work will not resume on its own.`,"archive.confirm.activity":`Work that will be stopped`,"archive.confirm.turn":`The turn in progress`,"archive.confirm.subagents.one":`{n} running subagent: {names}`,"archive.confirm.subagents.other":`{n} running subagents: {names}`,"archive.confirm.jobs.one":`{n} background job: {names}`,"archive.confirm.jobs.other":`{n} background jobs: {names}`,"archive.confirm.schedules.one":`{n} scheduled reminder: {names}`,"archive.confirm.schedules.other":`{n} scheduled reminders: {names}`,"archive.confirm.other.one":`{n} other item of work ({kind})`,"archive.confirm.other.other":`{n} other items of work ({kind})`,"archive.confirm.listSeparator":`, `,"archive.confirm.action":`Stop and archive`,"archive.confirm.pending":`Stopping and archiving…`,"toast.archivedUndo":`undo`,"toast.archivedOr":` or `,"toast.archivedFilter":`filter archived sessions`,"toast.archiveFailed":`Archive not confirmed. Check session status: {message}`,"toast.unarchiveFailed":`Unarchive not confirmed. Refresh to check: {message}`,"toast.pinFailed":`Pin not confirmed. Refresh to check: {message}`,"toast.unpinFailed":`Unpin not confirmed. Refresh to check: {message}`,"toast.createFailed":`New session failed: {message}`,"toast.forkFailed":`Fork did not complete: {message}`,"sessions.count.one":`{n} session`,"sessions.count.other":`{n} sessions`,"actions.workspace.aria":`Workspace actions for {name}`,"actions.session.aria":`Session actions for {name}`,"actions.archive":`Archive`,"actions.unarchive":`Unarchive`,"actions.pin":`Pin`,"actions.unpin":`Unpin`,"actions.newSession":`New session`,"actions.newSession.aria":`New session in {name}`,"status.running":`Running`,"status.subagentsRunning.one":`{n} subagent running`,"status.subagentsRunning.other":`{n} subagents running`,"status.idle":`Idle`,"status.waitingApproval":`Waiting for approval`,"status.planReview":`Plan awaiting review`,"status.waitingAnswer":`Waiting for answer`,"status.compact.approval":`Approval`,"status.compact.planReview":`Plan review`,"status.compact.answer":`Answer`,"status.completed":`Completed`,"hover.created":`Created {time}`,"hover.copied":`Copied`,"date.ymd":`{y}-{m}-{d}`,"time.now":`now`,"time.minutes":`{n}min`,"time.hours":`{n}h`,"time.days":`{n}d`,"time.months":`{n}mo`,"time.years":`{n}y`,"time.ago":`{t} ago`},$=`workspace`,xt=[`slots`,`sessions`,`workspaces`,`locale`,`remote`,`remote.directoryPicker`,`layout`,`shortcuts`];function St(e){let t=e.get(`sessions`),n=e.get(`workspaces`),i=V(),a=i.create();a.actions.setArchivedFilter(`default`),e.effect(()=>{let e=()=>{t.setIncludeArchived((a.getSnapshot().archivedFilter??`default`)!=="default")},n=a.subscribe(e);return e(),n},`ui-workspace: browser-local archive query scope`);let o={...i,create:()=>a},s=(0,r.createSnapshotStore)(null),d=0,f=e=>{s.set({...e,seq:++d})},p=new le(e,e.remote.directoryPicker,n,t,a.actions,f);e.slots.provideRoot({hooks:{workspaces:n.list}}),e.effect(()=>e.locale.register($,{zh:yt,en:bt}),`ui-workspace: dictionaries`);let m=l(),h=async(e,n)=>{let r=await t.search(e,n);if(!r.ok)throw Error(r.error.message);return r.value},g=t=>({getSnapshot:()=>e.slots.entries(t).length>0,subscribe:n=>e.slots.subscribe(t,n)}),_=g(`sidebar.workspaces.directoryFlow`),v={getSnapshot:()=>e.remote.$host,subscribe:t=>e.on(`connection/reset`,t)},x=g(`conversation.hero.workspace.directoryFlow`),S=e=>{p.openSession(e)},C=st(n.list,e=>new Set(e.pinnedSessionIds)),w=st(n.list,e=>new Set(e.archivedSessionIds)),T=st(m.state,e=>e.renameTarget),E=(0,r.createSnapshotStore)(null),D=m.rename,O=e=>{p.unarchiveSession(e).catch(e=>{f({kind:`unarchiveFailed`,message:e instanceof Error?e.message:String(e)})})},k=async(e,n)=>{let r=await t.using(e,{source:`workspaceOperation`},e=>e.binding.session.rename(n));if(!r.ok)throw Error(r.error.message)},A=()=>({hooks:{pinned:C,archived:w},pinSession:e=>{p.pinSession(e).catch(e=>{f({kind:`pinFailed`,message:e instanceof Error?e.message:String(e)})})},unpinSession:e=>{p.unpinSession(e).catch(e=>{f({kind:`unpinFailed`,message:e instanceof Error?e.message:String(e)})})}}),j=()=>({hooks:{archived:w},archiveSession:e=>{p.archiveSession(e).then(()=>{f({kind:`archived`,sessionId:e})}).catch(n=>{let r=Ct(n);if(r===void 0){f({kind:`archiveFailed`,message:n instanceof Error?n.message:String(n)});return}let i=t.list.getSnapshot().byId[e]?.displayTitle??e;E.set({sessionId:e,displayTitle:i,activity:r})})},unarchiveSession:O});u(e,p,m,j().archiveSession);let ee=()=>({hooks:{archiveRequest:E},settleSessionArchive:()=>{E.set(null)},stopAndArchiveSession:async e=>{await p.archiveSession(e,{stopActivity:!0}),f({kind:`stoppedAndArchived`,sessionId:e})}}),M=()=>({forkSession:t=>{p.forkSession(t,n=>{e.get(`productAnalytics`)?.track(`branch_session_click`,{session_id:n,parent_session_id:t,click_position:`sidebar`})}).then(e=>p.openSession(e)).catch(e=>{f({kind:`forkFailed`,message:e instanceof Error?e.message:String(e)})})}}),N=()=>({copySessionLink:e=>{let n=t.list.getSnapshot().byId[e],r=n===void 0?void 0:y(n);r!==void 0&&(async()=>{try{await navigator.clipboard.writeText(b(r)),f({kind:`sessionLinkCopied`})}catch{f({kind:`sessionLinkCopyFailed`})}})()}}),P=()=>({requestSessionRename:D}),te=()=>({hooks:{renameRequest:T},settleSessionRename:m.closeRename,renameSession:k}),ne=()=>({hooks:{toast:s},dismissToast:()=>{s.set(null)},undoArchive:O,showArchived:()=>{a.actions.setArchivedFilter(`show`)}}),re=()=>({startSession:e=>{p.startSession(e)},open:S,searchSessions:h,searchResultLimit:t.searchResultLimit,requestSessionRename:D,notifyArchivedNotOpenable:()=>{f({kind:`archivedNotOpenable`})},renameWorkspace:async(e,t)=>{await n.rename(e,t)},deleteWorkspace:async e=>{await n.delete(e)},insertWorkspaceBefore:async(e,t)=>{await n.insertBefore(e,t)},unarchiveSession:async e=>{await p.unarchiveSession(e)},createWorkspace:e=>n.create(e),requestSearch:m.search,requestAddWorkspace:m.add,closeAddWorkspace:m.closeAdd,setDirectoryBusy:m.directoryBusy,dismissForkError:m.dismissForkError,hooks:{directoryFlow:_,hostInfo:v,workspaceShortcuts:m.state,shortcuts:e.shortcuts.catalog}}),ie=()=>({createWorkspace:e=>n.create(e),hooks:{directoryFlow:x}});e.slots.inject(`sidebar.workspaces`,()=>e.slots.register({name:`sidebar.workspaces`,children:{"sidebar.workspaces.directoryFlow":{kind:`single`,scope:`root`},"sidebar.workspaces.session.menu.item":{kind:`list`,scope:`root`,inject:{hooks:{menuOpenState:c,shortcuts:e.shortcuts.catalog}}},"sidebar.workspaces.session.row.action":{kind:`list`,scope:`root`},"sidebar.session.row.identity":{kind:`list`,scope:`root`},"sidebar.session.row.leading":{kind:`list`,scope:`root`},"sidebar.session.row.hover":{kind:`list`,scope:`root`}},store:o,inject:re,locale:$},tt)),e.slots.inject(`sidebar.workspaces.session.menu.item`,function*(){yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`pin`,order:100,locale:$,inject:A},dt),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`rename`,order:200,locale:$,inject:P},pt),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`fork`,order:300,locale:$,inject:M},ct),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`copy-session-link`,order:350,locale:$,inject:N},lt),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`archive`,order:400,locale:$,inject:j},nt)}),e.slots.inject(`sidebar.workspaces.session.row.action`,function*(){yield e.slots.register({name:`sidebar.workspaces.session.row.action`,id:`archive`,order:100,locale:$,inject:j},rt),yield e.slots.register({name:`sidebar.workspaces.session.row.action`,id:`pin`,order:200,locale:$,inject:A},ft)}),e.slots.inject(`shell.overlay`,function*(){yield e.slots.register({name:`shell.overlay`,id:`workspace.session-rename`,locale:$,inject:te},mt),yield e.slots.register({name:`shell.overlay`,id:`workspace.session-archive`,locale:$,inject:ee},it),yield e.slots.register({name:`shell.overlay`,id:`workspace.row-toast`,locale:$,store:o,inject:ne},_t)}),e.slots.inject(`conversation.hero.workspace`,()=>e.slots.register({name:`conversation.hero.workspace`,children:{"conversation.hero.workspace.directoryFlow":{kind:`single`,scope:`root`}},inject:ie,locale:$},We))}function Ct(e){if(!(e instanceof Error)||e.name!==`WorkspaceArchiveError`)return;let{rpcError:t}=e;return t.code===`workspace/session-active`?t.details.activity:void 0}return n.apply=St,n.inject=xt,t.exports}});
|
|
23
|
+
default:return h(e)}}let Mn={"host.local":`本机`,"host.connected":`已连接`,"host.connecting":`连接中`,"host.disconnected":`未连接`,"defaultWorkspace.failed":`无法创建默认工作区,请通过“选择工作区”选择文件夹`,"draft.workspaceRequired":`请先选择工作区`,"draft.initializationFailed":`暂时无法填入草稿,请稍后重试`,"recent.navigation":`会话标签`,"recent.expand":`展开会话标签栏`,"recent.collapse":`收起会话标签栏`,"recent.settings.title":`显示会话标签`,"recent.settings.mobile":`移动端`,"recent.settings.description":`在手机会话顶部显示可关闭的标签栏。`,"recent.settings.error":`无法在此浏览器中保存设置,已保留原设置。`,"recent.timeout.title":`自动关闭闲置标签`,"recent.timeout.off":`不自动关闭`,"recent.timeout.minutes":`{n} 分钟`,"recent.timeout.hours":`{n} 小时`,"recent.timeout.default":`{value}(默认)`,"recent.close":`关闭标签“{name}”`,"recent.closeHint":`仅关闭标签,不删除会话或停止任务`,"recent.closeFailed":`未能关闭标签,请重试。`,"recent.cache.error":`无法读取或保存会话标签。仍可在本页切换会话,刷新后标签可能丢失。`,"group.ungrouped":`最近`,"session.new":`新会话`,"session.untitled":`未命名`,"session.backToList":`返回会话列表`,"shortcut.noSession":`请先选择一个会话`,"shortcut.noPicker":`目录选择器不可用`,"shortcut.directoryBusy":`正在选择或添加工作区`,"shortcut.noCompletedTurn":`当前会话没有已结束的轮次`,"shortcut.forkFailed":`无法分叉会话,请重试`,"section.workspaces":`工作区`,"section.sessions":`会话`,"section.pinned":`置顶`,"viewOptions.label":`视图选项`,"groupBy.label":`分组方式`,"groupBy.workspace":`按工作区`,"groupBy.workspaceTree":`按工作区树`,"groupBy.flat":`单列表`,"orderBy.label":`排序方式`,"orderBy.manual":`手动排序`,"orderBy.updated":`最近更新`,"filterBy.label":`筛选会话`,"viewOptions.hideArchived":`隐藏已归档`,"viewOptions.showArchived":`全部对话(显示已归档)`,"viewOptions.onlyArchived":`仅显示已归档`,"sessions.expand":`展开显示`,"sessions.collapse":`收起`,"sessions.loading":`正在加载历史会话…`,"sessions.expandMore":`展开显示`,"sessions.retry":`重试`,"sessions.notLoaded":`已加载的会话中暂无匹配项,可按需加载更早会话`,"workspaces.expand":`展开显示`,"empty.none":`暂无会话`,"empty.noneArchived":`暂无已归档会话`,"empty.viewOthers":`查看其他会话`,"empty.noMatches":`无匹配结果`,"workspace.add":`添加工作区`,"search.sessions.aria":`搜索会话`,"search.placeholder":`搜索会话名称`,"search.clear":`清除搜索`,"search.results.aria":`搜索结果`,"search.pending":`正在搜索会话历史…`,"search.noMatches":`无匹配会话`,"search.hasMore":`仅显示前 {n} 条结果,请缩小搜索范围。`,"menu.addWorkspace":`添加工作区…`,"menu.noWorkspace":`不选择工作区`,"picker.loading":`正在加载工作区…`,"conflict.named":`已存在名为“{name}”的工作区。`,"folderError.title":`无法打开文件夹`,"folderError.retry":`重新选择`,rename:`重命名`,"rename.workspace.title":`重命名工作区`,"rename.session.title":`重命名会话`,"field.workspaceName":`工作区名称`,"field.sessionName":`会话名称`,"delete.workspace":`删除工作区`,"delete.desc":`将把“{name}”从工作区列表中移除。文件夹与会话记录会保留,其会话将显示在“未分组”下。`,"delete.pending":`正在删除工作区…`,"menu.copySessionLink":`复制会话链接`,"menu.referenceSession":`引用到当前草稿`,"menu.referenceSessionFailed":`未加入草稿:编辑位置或会话已失效`,"toast.sessionLinkCopied":`已复制`,"toast.sessionLinkCopyFailed":`复制会话链接失败`,"menu.fork":`分叉会话`,"menu.archiveSession":`归档会话`,"menu.unarchiveSession":`取消归档`,"menu.pinSession":`置顶会话`,"menu.unpinSession":`取消置顶`,"row.archived":`已归档`,"row.pinned":`已置顶`,"toast.archivedNotOpenable":`已归档对话暂时无法查看,请取消归档后查看`,"toast.archived":`会话已归档,可`,"toast.stoppedAndArchived":`已停止并归档,可`,"archive.confirm.title":`停止并归档此会话?`,"archive.confirm.desc":`“{title}”仍有正在进行的工作。归档会先停止这些工作;之后可在侧栏筛选“全部对话(显示已归档)”中恢复会话,被停止的工作不会自动继续。`,"archive.confirm.activity":`将被停止的工作`,"archive.confirm.turn":`进行中的回合`,"archive.confirm.subagents.one":`{n} 个运行中的子智能体:{names}`,"archive.confirm.subagents.other":`{n} 个运行中的子智能体:{names}`,"archive.confirm.jobs.one":`{n} 个后台任务:{names}`,"archive.confirm.jobs.other":`{n} 个后台任务:{names}`,"archive.confirm.schedules.one":`{n} 条定时提醒:{names}`,"archive.confirm.schedules.other":`{n} 条定时提醒:{names}`,"archive.confirm.other.one":`{n} 项其他工作({kind})`,"archive.confirm.other.other":`{n} 项其他工作({kind})`,"archive.confirm.listSeparator":`、`,"archive.confirm.action":`停止并归档`,"archive.confirm.pending":`正在停止并归档…`,"toast.archivedUndo":`撤销`,"toast.archivedOr":`或`,"toast.archivedFilter":`筛选已归档会话`,"toast.archiveFailed":`归档未确认,请检查会话状态:{message}`,"toast.unarchiveFailed":`取消归档未确认,请刷新后检查:{message}`,"toast.pinFailed":`置顶未确认,请刷新后检查:{message}`,"toast.unpinFailed":`取消置顶未确认,请刷新后检查:{message}`,"toast.createFailed":`新建会话失败:{message}`,"toast.forkFailed":`分叉未完成:{message}`,"sessions.count.one":`{n} 个会话`,"sessions.count.other":`{n} 个会话`,"actions.workspace.aria":`工作区“{name}”的操作`,"actions.session.aria":`会话“{name}”的操作`,"actions.archive":`归档会话`,"actions.unarchive":`取消归档`,"actions.pin":`置顶会话`,"actions.unpin":`取消置顶`,"actions.newSession":`新会话`,"actions.newSession.aria":`在“{name}”中新建会话`,"status.running":`进行中`,"status.subagentsRunning.one":`{n} 个子智能体运行中`,"status.subagentsRunning.other":`{n} 个子智能体运行中`,"status.idle":`空闲`,"status.waitingApproval":`等待审批`,"status.planReview":`计划待审`,"status.waitingAnswer":`等待回答`,"status.compact.approval":`待审批`,"status.compact.planReview":`计划待审`,"status.compact.answer":`待回答`,"status.completed":`已完成`,"hover.created":`创建于 {time}`,"hover.copied":`已复制`,"date.ymd":`{y}年{m}月{d}日`,"time.now":`刚刚`,"time.minutes":`{n}分钟`,"time.hours":`{n}小时`,"time.days":`{n}天`,"time.months":`{n}个月`,"time.years":`{n}年`,"time.ago":`{t}前`},Nn={"host.local":`Local`,"host.connected":`Connected`,"host.connecting":`Connecting`,"host.disconnected":`Disconnected`,"defaultWorkspace.failed":`Unable to create default workspace. Use Choose workspace to select a folder.`,"draft.workspaceRequired":`Choose a workspace first.`,"draft.initializationFailed":`Could not fill the draft. Please try again shortly.`,"recent.navigation":`Session tabs`,"recent.expand":`Expand session tabs`,"recent.collapse":`Collapse session tabs`,"recent.settings.title":`Show session tabs`,"recent.settings.mobile":`Mobile`,"recent.settings.description":`Show closable tabs above phone conversations.`,"recent.settings.error":`Could not save in this browser. The previous setting is unchanged.`,"recent.timeout.title":`Automatically close idle tabs`,"recent.timeout.off":`Never`,"recent.timeout.minutes":`{n} minutes`,"recent.timeout.hours":`{n} hours`,"recent.timeout.default":`{value} (default)`,"recent.close":`Close tab “{name}”`,"recent.closeHint":`Close only this tab, without deleting the session or stopping tasks`,"recent.closeFailed":`Could not close the tab. Please try again.`,"recent.cache.error":`Could not read or save session tabs. Switching still works in this page; tabs may be lost on reload.`,"group.ungrouped":`Recents`,"session.new":`New Session`,"session.untitled":`Untitled`,"session.backToList":`Back to session list`,"shortcut.noSession":`Select a session first`,"shortcut.noPicker":`Directory picker unavailable`,"shortcut.directoryBusy":`Selecting or adding a workspace`,"shortcut.noCompletedTurn":`This session has no completed turn`,"shortcut.forkFailed":`Could not fork the session. Try again.`,"section.workspaces":`Workspaces`,"section.sessions":`Sessions`,"section.pinned":`Pinned`,"viewOptions.label":`View options`,"groupBy.label":`Group by`,"groupBy.workspace":`WorkSpace`,"groupBy.workspaceTree":`Workspace Tree`,"groupBy.flat":`In one list`,"orderBy.label":`Order by`,"orderBy.manual":`Manual`,"orderBy.updated":`Last updated`,"filterBy.label":`Filter sessions`,"viewOptions.hideArchived":`Hide archived`,"viewOptions.showArchived":`All conversations (show archived)`,"viewOptions.onlyArchived":`Archived only`,"sessions.expand":`Show {n} more`,"sessions.collapse":`Show less`,"sessions.loading":`Loading conversation history…`,"sessions.expandMore":`Show more`,"sessions.retry":`Retry`,"sessions.notLoaded":`No matching loaded conversations. Older conversations can be loaded on demand.`,"workspaces.expand":`Show all workspaces`,"empty.none":`No sessions yet`,"empty.noneArchived":`No archived sessions yet`,"empty.viewOthers":`View other sessions`,"empty.noMatches":`No matches`,"workspace.add":`Add workspace`,"search.sessions.aria":`Search sessions`,"search.placeholder":`Search session names`,"search.clear":`Clear search`,"search.results.aria":`Search results`,"search.pending":`Searching session history…`,"search.noMatches":`No matching sessions`,"search.hasMore":`Showing the first {n} results. Narrow your search.`,"menu.addWorkspace":`Add workspace…`,"menu.noWorkspace":`No workspace`,"picker.loading":`Loading workspaces…`,"conflict.named":`A workspace named “{name}” already exists.`,"folderError.title":`Couldn’t open folder`,"folderError.retry":`Choose again`,rename:`Rename`,"rename.workspace.title":`Rename workspace`,"rename.session.title":`Rename session`,"field.workspaceName":`Workspace name`,"field.sessionName":`Session name`,"delete.workspace":`Delete workspace`,"delete.desc":`This removes “{name}” from the workspace list. The folder and session logs will be kept. Its sessions will appear under Ungrouped.`,"delete.pending":`Deleting workspace…`,"menu.copySessionLink":`Copy session link`,"menu.referenceSession":`Reference in the current draft`,"menu.referenceSessionFailed":`Not added: the editing position or session is no longer available`,"toast.sessionLinkCopied":`Copied`,"toast.sessionLinkCopyFailed":`Could not copy session link`,"menu.fork":`Fork session`,"menu.archiveSession":`Archive session`,"menu.unarchiveSession":`Unarchive session`,"menu.pinSession":`Pin session`,"menu.unpinSession":`Unpin session`,"row.archived":`Archived`,"row.pinned":`Pinned`,"toast.archivedNotOpenable":`Archived sessions cannot be opened. Unarchive it to view.`,"toast.archived":`Session archived. You can `,"toast.stoppedAndArchived":`Session stopped and archived. You can `,"archive.confirm.title":`Stop and archive this session?`,"archive.confirm.desc":`“{title}” still has work in progress. Archiving stops it first; you can restore the session later from the “All conversations (show archived)” filter in the sidebar, and the stopped work will not resume on its own.`,"archive.confirm.activity":`Work that will be stopped`,"archive.confirm.turn":`The turn in progress`,"archive.confirm.subagents.one":`{n} running subagent: {names}`,"archive.confirm.subagents.other":`{n} running subagents: {names}`,"archive.confirm.jobs.one":`{n} background job: {names}`,"archive.confirm.jobs.other":`{n} background jobs: {names}`,"archive.confirm.schedules.one":`{n} scheduled reminder: {names}`,"archive.confirm.schedules.other":`{n} scheduled reminders: {names}`,"archive.confirm.other.one":`{n} other item of work ({kind})`,"archive.confirm.other.other":`{n} other items of work ({kind})`,"archive.confirm.listSeparator":`, `,"archive.confirm.action":`Stop and archive`,"archive.confirm.pending":`Stopping and archiving…`,"toast.archivedUndo":`undo`,"toast.archivedOr":` or `,"toast.archivedFilter":`filter archived sessions`,"toast.archiveFailed":`Archive not confirmed. Check session status: {message}`,"toast.unarchiveFailed":`Unarchive not confirmed. Refresh to check: {message}`,"toast.pinFailed":`Pin not confirmed. Refresh to check: {message}`,"toast.unpinFailed":`Unpin not confirmed. Refresh to check: {message}`,"toast.createFailed":`New session failed: {message}`,"toast.forkFailed":`Fork did not complete: {message}`,"sessions.count.one":`{n} session`,"sessions.count.other":`{n} sessions`,"actions.workspace.aria":`Workspace actions for {name}`,"actions.session.aria":`Session actions for {name}`,"actions.archive":`Archive`,"actions.unarchive":`Unarchive`,"actions.pin":`Pin`,"actions.unpin":`Unpin`,"actions.newSession":`New session`,"actions.newSession.aria":`New session in {name}`,"status.running":`Running`,"status.subagentsRunning.one":`{n} subagent running`,"status.subagentsRunning.other":`{n} subagents running`,"status.idle":`Idle`,"status.waitingApproval":`Waiting for approval`,"status.planReview":`Plan awaiting review`,"status.waitingAnswer":`Waiting for answer`,"status.compact.approval":`Approval`,"status.compact.planReview":`Plan review`,"status.compact.answer":`Answer`,"status.completed":`Completed`,"hover.created":`Created {time}`,"hover.copied":`Copied`,"date.ymd":`{y}-{m}-{d}`,"time.now":`now`,"time.minutes":`{n}min`,"time.hours":`{n}h`,"time.days":`{n}d`,"time.months":`{n}mo`,"time.years":`{n}y`,"time.ago":`{t} ago`},Pn=()=>!1,Fn=()=>()=>{};function In(e){let t=(0,o.usePhoneSidebar)();return t===null||!t.open?null:/* @__PURE__ */ (0,s.jsx)(Ln,{...e,closeDrawer:t.close},e.sessionId)}function Ln({sessionId:e,prepareDraftReference:t,closeDrawer:n,useMenuOpenState:r,t:i}){let[c]=(0,a.useState)(()=>t(e)),l=(0,a.useSyncExternalStore)(c?.subscribe??Fn,c?.getSnapshot??Pn),u=(0,a.useRef)(!1),[d,f]=(0,a.useState)(!1),[,p]=r();return c===void 0?null:/* @__PURE__ */ (0,s.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,s.jsx)(o.MenuItemButton,{icon:/* @__PURE__ */ (0,s.jsx)(o.IconLinkOutlineRegular,{}),disabled:d||!l,onSelect:()=>{if(!u.current){u.current=!0;try{if(c?.insert()===!0){p(!1),n();return}}catch{}f(!0)}},children:i(`menu.referenceSession`)}),d&&/* @__PURE__ */ (0,s.jsx)(`div`,{role:`status`,children:i(`menu.referenceSessionFailed`)})]})}let Rn=`workspace`,zn=[`slots`,`sessions`,`workspaces`,`locale`,`remote`,`remote.directoryPicker`,`layout`,`shortcuts`,`configForms`];function Bn(e){let t=e.get(`sessions`),n=e.get(`workspaces`),i=z(),a=i.create();a.actions.setArchivedFilter(`default`),e.effect(()=>{let e=()=>{t.setIncludeArchived((a.getSnapshot().archivedFilter??`default`)!=="default")},n=a.subscribe(e);return e(),n},`ui-workspace: browser-local archive query scope`);let o={...i,create:()=>a},s=(0,r.createSnapshotStore)(null),d=0,f=e=>{s.set({...e,seq:++d})},p=new we(e,e.remote.directoryPicker,n,t,a.actions,f);_t(e,p),e.slots.provideRoot({hooks:{workspaces:n.list}}),e.effect(()=>e.locale.register(Rn,{zh:Mn,en:Nn}),`ui-workspace: dictionaries`);let m=l(),h=async(e,n)=>{let r=await t.search(e,n);if(!r.ok)throw Error(r.error.message);return r.value},g=t=>({getSnapshot:()=>e.slots.entries(t).length>0,subscribe:n=>e.slots.subscribe(t,n)}),_=g(`sidebar.workspaces.directoryFlow`),v={getSnapshot:()=>e.remote.$host,subscribe:t=>e.on(`connection/reset`,t)},x=g(`conversation.hero.workspace.directoryFlow`),S=e=>{p.openSession(e)},C=bn(n.list,e=>new Set(e.pinnedSessionIds)),w=bn(n.list,e=>new Set(e.archivedSessionIds)),T=bn(m.state,e=>e.renameTarget),E=(0,r.createSnapshotStore)(null),D=m.rename,O=e=>{p.unarchiveSession(e).catch(e=>{f({kind:`unarchiveFailed`,message:e instanceof Error?e.message:String(e)})})},k=async(e,n)=>{let r=await t.using(e,{source:`workspaceOperation`},e=>e.binding.session.rename(n));if(!r.ok)throw Error(r.error.message)},A=()=>({hooks:{pinned:C,archived:w},pinSession:e=>{p.pinSession(e).catch(e=>{f({kind:`pinFailed`,message:e instanceof Error?e.message:String(e)})})},unpinSession:e=>{p.unpinSession(e).catch(e=>{f({kind:`unpinFailed`,message:e instanceof Error?e.message:String(e)})})}}),j=()=>({hooks:{archived:w},archiveSession:e=>{p.archiveSession(e).then(()=>{f({kind:`archived`,sessionId:e})}).catch(n=>{let r=Vn(n);if(r===void 0){f({kind:`archiveFailed`,message:n instanceof Error?n.message:String(n)});return}let i=t.list.getSnapshot().byId[e]?.displayTitle??e;E.set({sessionId:e,displayTitle:i,activity:r})})},unarchiveSession:O});u(e,p,m,j().archiveSession);let ee=()=>({hooks:{archiveRequest:E},settleSessionArchive:()=>{E.set(null)},stopAndArchiveSession:async e=>{await p.archiveSession(e,{stopActivity:!0}),f({kind:`stoppedAndArchived`,sessionId:e})}}),te=()=>({forkSession:t=>{p.forkSession(t,n=>{e.get(`productAnalytics`)?.track(`branch_session_click`,{session_id:n,parent_session_id:t,click_position:`sidebar`})}).then(e=>p.openSession(e)).catch(e=>{f({kind:`forkFailed`,message:e instanceof Error?e.message:String(e)})})}}),M=()=>({copySessionLink:e=>{let n=t.list.getSnapshot().byId[e],r=n===void 0?void 0:y(n);r!==void 0&&(async()=>{try{await navigator.clipboard.writeText(b(r)),f({kind:`sessionLinkCopied`})}catch{f({kind:`sessionLinkCopyFailed`})}})()}}),N=()=>({requestSessionRename:D}),P=()=>({hooks:{renameRequest:T},settleSessionRename:m.closeRename,renameSession:k}),F=()=>({hooks:{toast:s},dismissToast:()=>{s.set(null)},undoArchive:O,showArchived:()=>{a.actions.setArchivedFilter(`show`)}}),ne=()=>({startSession:e=>{p.startSession(e)},open:S,searchSessions:h,refreshSessions:()=>{t.refresh()},loadMoreSessions:()=>{t.loadMore()},searchResultLimit:t.searchResultLimit,requestSessionRename:D,notifyArchivedNotOpenable:()=>{f({kind:`archivedNotOpenable`})},renameWorkspace:async(e,t)=>{await n.rename(e,t)},deleteWorkspace:async e=>{await n.delete(e)},insertWorkspaceBefore:async(e,t)=>{await n.insertBefore(e,t)},unarchiveSession:async e=>{await p.unarchiveSession(e)},createWorkspace:e=>n.create(e),requestSearch:m.search,requestAddWorkspace:m.add,closeAddWorkspace:m.closeAdd,setDirectoryBusy:m.directoryBusy,dismissForkError:m.dismissForkError,hooks:{directoryFlow:_,hostInfo:v,workspaceShortcuts:m.state,shortcuts:e.shortcuts.catalog}}),re=()=>({createWorkspace:e=>n.create(e),hooks:{directoryFlow:x}});e.slots.inject(`sidebar.workspaces`,()=>e.slots.register({name:`sidebar.workspaces`,children:{"sidebar.workspaces.directoryFlow":{kind:`single`,scope:`root`},"sidebar.workspaces.session.menu.item":{kind:`list`,scope:`root`,inject:{hooks:{menuOpenState:c,shortcuts:e.shortcuts.catalog}}},"sidebar.workspaces.session.row.action":{kind:`list`,scope:`root`},"sidebar.session.row.identity":{kind:`list`,scope:`root`},"sidebar.session.row.leading":{kind:`list`,scope:`root`},"sidebar.session.row.hover":{kind:`list`,scope:`root`}},store:o,inject:ne,locale:Rn},mn)),e.slots.inject(`sidebar.workspaces.session.menu.item`,function*(){yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`pin`,order:100,locale:Rn,inject:A},wn),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`rename`,order:200,locale:Rn,inject:N},En),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`fork`,order:300,locale:Rn,inject:te},xn),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`copy-session-link`,order:350,locale:Rn,inject:M},Sn),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`archive`,order:400,locale:Rn,inject:j},hn)}),e.slots.inject(`sidebar.workspaces.session.row.action`,function*(){yield e.slots.register({name:`sidebar.workspaces.session.row.action`,id:`archive`,order:100,locale:Rn,inject:j},gn),yield e.slots.register({name:`sidebar.workspaces.session.row.action`,id:`pin`,order:200,locale:Rn,inject:A},Tn)}),e.slots.inject(`shell.overlay`,function*(){yield e.slots.register({name:`shell.overlay`,id:`workspace.session-rename`,locale:Rn,inject:P},Dn),yield e.slots.register({name:`shell.overlay`,id:`workspace.session-archive`,locale:Rn,inject:ee},_n),yield e.slots.register({name:`shell.overlay`,id:`workspace.row-toast`,locale:Rn,store:o,inject:F},An)}),e.slots.inject(`conversation.hero.workspace`,()=>e.slots.register({name:`conversation.hero.workspace`,children:{"conversation.hero.workspace.directoryFlow":{kind:`single`,scope:`root`}},inject:re,locale:Rn},rn))}function Vn(e){if(!(e instanceof Error)||e.name!==`WorkspaceArchiveError`)return;let{rpcError:t}=e;return t.code===`workspace/session-active`?t.details.activity:void 0}return n.ReferenceSessionMenuItem=In,n.apply=Bn,n.inject=zn,t.exports}});
|