@codexhost/cli-win32-x64 0.28.2 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +1894 -575
  4. package/app/console-web.js +2814 -729
  5. package/app/desktop-controller.mjs +251 -36
  6. package/app/host-runtime.mjs +36528 -32793
  7. package/app/plugins/antigravity/assets/icon.svg +34 -1
  8. package/app/plugins/antigravity/plugin.mjs +1628 -657
  9. package/app/plugins/claude-code/assets/icon.svg +1 -1
  10. package/app/plugins/claude-code/manifest.json +1 -1
  11. package/app/plugins/claude-code/plugin.mjs +256 -31
  12. package/app/plugins/codebuddy/assets/icon.svg +1 -1
  13. package/app/plugins/codebuddy/plugin.mjs +230 -28
  14. package/app/plugins/codex-usage/plugin.mjs +230 -28
  15. package/app/plugins/copilot/assets/icon.svg +3 -0
  16. package/app/plugins/copilot/manifest.json +13 -1
  17. package/app/plugins/copilot/plugin.mjs +230 -28
  18. package/app/plugins/cursor-cli/assets/icon.svg +1 -1
  19. package/app/plugins/cursor-cli/plugin.mjs +304 -44
  20. package/app/plugins/deepseek-harness/assets/icon.svg +1 -1
  21. package/app/plugins/deepseek-harness/manifest.json +1 -1
  22. package/app/plugins/deepseek-harness/plugin.mjs +230 -28
  23. package/app/plugins/devin/assets/icon.svg +1 -1
  24. package/app/plugins/devin/manifest.json +20 -0
  25. package/app/plugins/devin/plugin.mjs +354 -67
  26. package/app/plugins/grok/assets/icon.svg +4 -0
  27. package/app/plugins/grok/manifest.json +16 -2
  28. package/app/plugins/grok/plugin.mjs +230 -28
  29. package/app/plugins/hermes/assets/icon.png +0 -0
  30. package/app/plugins/hermes/manifest.json +0 -5
  31. package/app/plugins/hermes/plugin.mjs +230 -28
  32. package/app/plugins/kimi-code/assets/icon.svg +1 -1
  33. package/app/plugins/kimi-code/manifest.json +20 -0
  34. package/app/plugins/kimi-code/plugin.mjs +230 -28
  35. package/app/plugins/kiro-cli/assets/kiro-agent.svg +1 -6
  36. package/app/plugins/kiro-cli/manifest.json +24 -0
  37. package/app/plugins/kiro-cli/plugin.mjs +230 -28
  38. package/app/plugins/omp/assets/icon.svg +1 -1
  39. package/app/plugins/omp/manifest.json +0 -3
  40. package/app/plugins/omp/plugin.mjs +231 -29
  41. package/app/plugins/opencode/assets/icon.svg +5 -0
  42. package/app/plugins/opencode/manifest.json +22 -1
  43. package/app/plugins/opencode/plugin.mjs +246 -40
  44. package/app/plugins/pi/assets/icon.svg +3 -3
  45. package/app/plugins/pi/plugin.mjs +272 -30
  46. package/app/plugins/qoder/assets/icon.svg +1 -1
  47. package/app/plugins/qoder/plugin.mjs +230 -28
  48. package/app/plugins/qoder-cn/assets/icon.svg +1 -1
  49. package/app/plugins/qoder-cn/plugin.mjs +230 -28
  50. package/app/plugins/qwen-code/assets/icon.svg +1 -1
  51. package/app/plugins/qwen-code/plugin.mjs +230 -28
  52. package/app/plugins/workbuddy/assets/icon.svg +7 -9
  53. package/app/plugins/workbuddy/plugin.mjs +230 -28
  54. package/app/plugins/zcode/assets/icon.svg +1 -1
  55. package/app/plugins/zcode/plugin.mjs +230 -28
  56. package/app/renderer-extension.js +4230 -783
  57. package/app/web/apple-touch-icon.png +0 -0
  58. package/app/web/assets/index-0TnaYwHS.js +205 -0
  59. package/app/web/assets/index-aSHN2MIG.css +1 -0
  60. package/app/web/codex-agent.png +0 -0
  61. package/app/web/codex.png +0 -0
  62. package/app/web/codexhost-settings.js +1225 -305
  63. package/app/web/favicon-dark.svg +37 -4
  64. package/app/web/favicon.svg +37 -3
  65. package/app/web/icon-192.png +0 -0
  66. package/app/web/icon-512.png +0 -0
  67. package/app/web/index.html +2 -2
  68. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +65 -65
  69. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -8
  70. package/app/web/plugins/deepseek-ai__dsh-api-workspace-controller/client.js +1 -1
  71. package/app/web/plugins/deepseek-ai__dsh-client-file-upload/client.js +1 -1
  72. package/app/web/plugins/deepseek-ai__dsh-client-ui-attachment/client.js +1 -1
  73. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +69 -69
  74. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +73 -73
  75. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +102 -98
  76. package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
  77. package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +2 -2
  78. package/app/web/plugins/deepseek-ai__dsh-client-ui-session/client.js +1 -1
  79. package/app/web/plugins/deepseek-ai__dsh-client-ui-shortcuts/client.js +2 -2
  80. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +2 -2
  81. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-files/client.js +1 -1
  82. package/app/web/plugins/deepseek-ai__dsh-client-ui-subagent/client.js +1 -1
  83. package/app/web/plugins/deepseek-ai__dsh-client-ui-theme/client.js +1 -1
  84. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
  85. package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +1 -1
  86. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +75 -81
  87. package/app/web/plugins.json +1 -0
  88. package/app/web-modules/server.mjs +1718 -573
  89. package/bin/codexhost.exe +0 -0
  90. package/libexec/codexhost-node-repl.exe +0 -0
  91. package/libexec/codexhost-screenshot.exe +0 -0
  92. package/libexec/codexhost-shell.exe +0 -0
  93. package/libexec/codexhost-shim.exe +0 -0
  94. package/libexec/codexhost-updater.exe +0 -0
  95. package/package.json +1 -1
  96. package/app/plugins/copilot/assets/icon.png +0 -0
  97. package/app/plugins/grok/assets/icon.png +0 -0
  98. package/app/plugins/opencode/assets/icon.png +0 -0
  99. package/app/web/assets/index-BJq8mT6r.js +0 -204
  100. package/app/web/assets/index-CMDliP5b.css +0 -1
@@ -1,4 +1,4 @@
1
- window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-api-workspace-controller`,factory:e=>{var t={exports:{}},n=t.exports;Object.defineProperty(n,Symbol.toStringTag,{value:`Module`});let r=e("@deepseek-ai/dsh-api-gateway/client"),i=e("@deepseek-ai/dsh-client-store"),a=e("@deepseek-ai/cordis");var o=class{remote;canStartProjectless=!1;items=[];archivedSessionIds=[];pinnedSessionIds=[];threadSections=[];state=`loading`;phase=`pending`;error=null;orderRequestGeneration=0;orderFrameGeneration=0;committedOrder=[];archiveRequestSeq=0;pendingArchives=/* @__PURE__ */ new Map;pinRequestSeq=0;removedIds=/* @__PURE__ */ new Set;listeners=/* @__PURE__ */ new Set;snapshotCache;snapshotDirty=!1;notificationPending=!1;notificationScheduled=!1;notificationGeneration=0;constructor(e){this.remote=e,this.snapshotCache=this.buildSnapshot()}async create(e){let t=await this.remote.create(e);return t.ok&&this.upsert(t.value.workspace),t}async initializeDefault(e){let t=await this.remote.initializeDefault(e);return t.ok&&t.value!==void 0&&this.upsert(t.value.workspace),t}async rename(e,t){let n=await this.remote.rename({workspaceId:e,title:t});return n.ok&&this.upsert(n.value.workspace),n}async delete(e){let t=await this.remote.delete({workspaceId:e});return t.ok&&this.remove(e,{immediate:!0,recordRemoved:!0}),t}async insertBefore(e,t){let n=++this.orderRequestGeneration,r=this.orderFrameGeneration,i=this.items.map(e=>e.workspaceId);this.installOrder(c(i,e,t));let a=await this.remote.insertBefore({workspaceId:e,...t===void 0?{}:{beforeWorkspaceId:t}});return n===this.orderRequestGeneration&&r===this.orderFrameGeneration&&this.installOrder(a.ok?a.value.workspaceIds:this.committedOrder,a.ok),a}async insertSessionBefore(e,t,n){let r=await this.remote.insertSessionBefore({workspaceId:e,sessionId:t,...n===void 0?{}:{beforeSessionId:n}});return r.ok&&this.upsert(r.value.workspace),r}archiveSession(e,t={}){let n=this.pendingArchives.get(e);if(n!==void 0)return n.promise;this.archiveRequestSeq++;let r={observed:!1,promise:Promise.resolve().then(async()=>{try{let n=await this.remote.archiveSession({sessionId:e,scope:`single`,...t.stopActivity===!0?{stopActivity:!0}:{}});return n.ok&&this.pendingArchives.get(e)===r&&!r.observed&&(this.installArchived([.../* @__PURE__ */ new Set([...this.archivedSessionIds,e])]),this.installPinned(this.pinnedSessionIds.filter(t=>t!==e))),n}finally{this.pendingArchives.get(e)===r&&(this.pendingArchives.delete(e),this.invalidate())}})};return this.pendingArchives.set(e,r),this.invalidate(),r.promise}async unarchiveSession(e){let t=++this.archiveRequestSeq;this.pendingArchives.delete(e),this.invalidate();let n=await this.remote.unarchiveSession({sessionId:e,scope:`single`});return n.ok&&t===this.archiveRequestSeq&&this.installArchived(n.value.archivedSessionIds),n}async pinSession(e){let t=++this.pinRequestSeq,n=await this.remote.pinSession({sessionId:e});return n.ok&&t===this.pinRequestSeq&&this.installPinned(n.value.pinnedSessionIds),n}async unpinSession(e){let t=++this.pinRequestSeq,n=await this.remote.unpinSession({sessionId:e});return n.ok&&t===this.pinRequestSeq&&this.installPinned(n.value.pinnedSessionIds),n}replaceBaseline(e){this.orderFrameGeneration++,this.archiveRequestSeq++,this.pinRequestSeq++,this.canStartProjectless=e.canStartProjectless===!0,this.installViews(e.items),this.installArchived(e.archivedSessionIds),this.installPinned(e.pinnedSessionIds),this.threadSections=e.threadSections??[],this.state=`idle`,this.phase=`ready`,this.error=null,this.invalidate()}moveSessionToSection(e){return this.remote.moveSessionToSection(e)}upsertView(e){this.upsert(e)}removeView(e){this.remove(e)}replaceOrder(e){this.orderFrameGeneration++,this.installOrder(e,!0)}replaceArchived(e){this.archiveRequestSeq++,this.installArchived(e)}replacePinned(e){this.pinRequestSeq++,this.installPinned(e)}replaceThreadSections(e){this.threadSections=e,this.invalidate()}handleCarrierFailure(){this.state=`loading`,this.error=null,this.invalidate()}handleStreamFailure(e){if(!(0,r.isRemoteFailure)(e))throw e;this.state=`error`,this.error=e,this.invalidate()}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}getSnapshot(){return this.refreshSnapshot(),this.snapshotCache}buildSnapshot(){let e=new Set([...this.pendingArchives].filter(([,e])=>!e.observed).map(([e])=>e));return{items:this.items,canStartProjectless:this.canStartProjectless,archivedSessionIds:e.size===0?this.archivedSessionIds:[.../* @__PURE__ */ new Set([...this.archivedSessionIds,...e])],pinnedSessionIds:e.size===0?this.pinnedSessionIds:this.pinnedSessionIds.filter(t=>!e.has(t)),threadSections:this.threadSections,state:this.state,phase:this.phase,error:this.error}}installArchived(e){for(let t of e){let e=this.pendingArchives.get(t);e!==void 0&&(e.observed=!0)}e.length===this.archivedSessionIds.length&&e.every((e,t)=>e===this.archivedSessionIds[t])||(this.archivedSessionIds=[...e],this.invalidate())}installPinned(e){e.length===this.pinnedSessionIds.length&&e.every((e,t)=>e===this.pinnedSessionIds[t])||(this.pinnedSessionIds=[...e],this.invalidate())}installOrder(e,t=!1){t&&(this.committedOrder=[...e]);let n=new Map(e.map((e,t)=>[e,t])),r=[...this.items].sort((e,t)=>(n.get(e.workspaceId)??2**53-1)-(n.get(t.workspaceId)??2**53-1));r.every((e,t)=>e===this.items[t])||(this.items=r,this.invalidate())}upsert(e){if(this.removedIds.has(e.workspaceId))return;let t=this.items.findIndex(t=>t.workspaceId===e.workspaceId),n=this.items[t];n!==void 0&&Date.parse(e.updatedAt)<Date.parse(n.updatedAt)||(this.committedOrder.includes(e.workspaceId)||(this.committedOrder=[e.workspaceId,...this.committedOrder]),this.items=t===-1?[e,...this.items]:this.items.map((n,r)=>r===t?e:n),this.invalidate())}remove(e,t={}){let{immediate:n=!1,recordRemoved:r=!1}=t;r&&!s(e)&&this.removedIds.add(e),this.committedOrder=this.committedOrder.filter(t=>t!==e);let i=this.items.filter(t=>t.workspaceId!==e);i.length===this.items.length?n&&this.invalidate(!0):(this.items=i,this.invalidate(n))}installViews(e){let t=/* @__PURE__ */ new Map;for(let n of e)this.removedIds.has(n.workspaceId)||t.set(n.workspaceId,n);this.items=[...t.values()],this.committedOrder=e.map(e=>e.workspaceId)}invalidate(e=!1){if(this.snapshotDirty=!0,this.notificationPending=!0,e){this.notificationGeneration++,this.notificationScheduled=!1,this.flush();return}if(this.notificationScheduled)return;this.notificationScheduled=!0;let t=++this.notificationGeneration;queueMicrotask(()=>{t===this.notificationGeneration&&(this.notificationScheduled=!1,this.flush())})}flush(){this.notificationPending&&this.listeners.size!==0&&(this.notificationPending=!1,this.refreshSnapshot(),(0,i.notifySubscribers)(this.listeners,`[workspace-controller]`))}refreshSnapshot(){this.snapshotDirty&&(this.snapshotDirty=!1,this.snapshotCache=this.buildSnapshot())}};function s(e){return e.startsWith(`remote-workspace:`)}function c(e,t,n){if(!e.includes(t)||n!==void 0&&!e.includes(n)||n===t)return[...e];let r=e.filter(e=>e!==t),i=n===void 0?r.length:r.indexOf(n);return[...r.slice(0,i),t,...r.slice(i)]}var l=class extends Error{rpcError;name=`WorkspaceCreateError`;constructor(e){super(`workspace create failed: ${e.code}: ${e.message}`),this.rpcError=e}},u=class extends Error{rpcError;name=`WorkspaceArchiveError`;constructor(e){super(`workspace session archive failed: ${e.code}: ${e.message}`),this.rpcError=e}},d=class extends a.Service{model;list;constructor(e,t){super(e,`workspaces`),this.model=t,this.list=t}async create(e){let t=await this.model.create(e);if(!t.ok)throw new l(t.error);return t.value.workspace}async initializeDefault(e){let t=await this.model.initializeDefault(e);if(!t.ok)throw new l(t.error);return t.value?.workspace}async rename(e,t){let n=await this.model.rename(e,t);if(!n.ok)throw f(`rename`,n.error);return n.value.workspace}async delete(e){let t=await this.model.delete(e);if(!t.ok)throw f(`delete`,t.error)}async insertBefore(e,t){let n=await this.model.insertBefore(e,t);if(!n.ok)throw f(`reorder`,n.error)}async archiveSession(e,t={}){let n=await this.model.archiveSession(e,t);if(!n.ok)throw new u(n.error)}async unarchiveSession(e){let t=await this.model.unarchiveSession(e);if(!t.ok)throw f(`session unarchive`,t.error)}async pinSession(e){let t=await this.model.pinSession(e);if(!t.ok)throw f(`session pin`,t.error)}async moveSessionToSection(e,t){let n=await this.model.moveSessionToSection({sessionId:e,sectionId:t});if(!n.ok)throw f(`move to section`,n.error);if(n.value.sectionId!==t)throw Error(`The requested section change was not confirmed.`)}async unpinSession(e){let t=await this.model.unpinSession(e);if(!t.ok)throw f(`session unpin`,t.error)}async insertSessionBefore(e,t,n){let r=await this.model.insertSessionBefore(e,t,n);if(!r.ok)throw f(`move`,r.error);return r.value.workspace}};function f(e,t){return/* @__PURE__ */ Error(`workspace ${e} failed: ${t.code}: ${t.message}`)}let p=[`remote`,`remote.workspace`];function m(e){let t=new o(e.remote.workspace);new d(e,t);let n=h(e.remote,{accept:t,carrierFailed:()=>{t.handleCarrierFailure()},failed:e=>{t.handleStreamFailure(e)}});n.start(),e.effect(()=>async()=>{await n.dispose()},`workspace-controller.client.control`)}function h(e,t){let n=e.$stream({name:`Workspace state stream`,open:t=>e.workspace.follow(t),ended:e=>e?new r.RemoteStreamCarrierError(`Workspace state stream ended without a terminal result`):/* @__PURE__ */ Error(`Workspace state stream ended before its opening snapshot`),...t.carrierFailed===void 0?{}:{carrierFailed:t.carrierFailed}});return new r.RemoteSnapshotStream(n,{name:`Workspace state stream`,isSnapshot:e=>e.type===`baseline`,replace:e=>{t.accept.replaceBaseline(e.value)},update:e=>{g(t.accept,e)},failed:t.failed})}function g(e,t){switch(t.type){case`upsert`:e.upsertView(t.workspace);return;case`remove`:e.removeView(t.workspaceId);return;case`order`:e.replaceOrder(t.workspaceIds);return;case`archived`:e.replaceArchived(t.archivedSessionIds);return;case`pinned`:e.replacePinned(t.pinnedSessionIds);return;case`threadSections`:e.replaceThreadSections(t.threadSections);return;
1
+ window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-api-workspace-controller`,factory:e=>{var t={exports:{}},n=t.exports;Object.defineProperty(n,Symbol.toStringTag,{value:`Module`});let r=e("@deepseek-ai/dsh-api-gateway/client"),i=e("@deepseek-ai/dsh-client-store"),a=e("@deepseek-ai/cordis");var o=class{remote;canStartProjectless=!1;items=[];archivedSessionIds=[];pinnedSessionIds=[];pinnedWorkspaceIds=[];threadSections=[];state=`loading`;phase=`pending`;error=null;orderRequestGeneration=0;orderFrameGeneration=0;committedOrder=[];archiveRequestSeq=0;pendingArchives=/* @__PURE__ */ new Map;pinRequestSeq=0;pinnedWorkspaceRequestSeq=0;removedIds=/* @__PURE__ */ new Set;listeners=/* @__PURE__ */ new Set;snapshotCache;snapshotDirty=!1;notificationPending=!1;notificationScheduled=!1;notificationGeneration=0;constructor(e){this.remote=e,this.snapshotCache=this.buildSnapshot()}async create(e){let t=await this.remote.create(e);return t.ok&&this.upsert(t.value.workspace),t}async initializeDefault(e){let t=await this.remote.initializeDefault(e);return t.ok&&t.value!==void 0&&this.upsert(t.value.workspace),t}async rename(e,t){let n=await this.remote.rename({workspaceId:e,title:t});return n.ok&&this.upsert(n.value.workspace),n}async delete(e){let t=await this.remote.delete({workspaceId:e});return t.ok&&this.remove(e,{immediate:!0,recordRemoved:!0}),t}async insertBefore(e,t){let n=++this.orderRequestGeneration,r=this.orderFrameGeneration,i=this.items.map(e=>e.workspaceId);this.installOrder(c(i,e,t));let a=await this.remote.insertBefore({workspaceId:e,...t===void 0?{}:{beforeWorkspaceId:t}});return n===this.orderRequestGeneration&&r===this.orderFrameGeneration&&this.installOrder(a.ok?a.value.workspaceIds:this.committedOrder,a.ok),a}async insertSessionBefore(e,t,n){let r=await this.remote.insertSessionBefore({workspaceId:e,sessionId:t,...n===void 0?{}:{beforeSessionId:n}});return r.ok&&this.upsert(r.value.workspace),r}archiveSession(e,t={}){let n=this.pendingArchives.get(e);if(n!==void 0)return n.promise;this.archiveRequestSeq++;let r={observed:!1,promise:Promise.resolve().then(async()=>{try{let n=await this.remote.archiveSession({sessionId:e,scope:`single`,...t.stopActivity===!0?{stopActivity:!0}:{}});return n.ok&&this.pendingArchives.get(e)===r&&!r.observed&&(this.installArchived([.../* @__PURE__ */ new Set([...this.archivedSessionIds,e])]),this.installPinned(this.pinnedSessionIds.filter(t=>t!==e))),n}finally{this.pendingArchives.get(e)===r&&(this.pendingArchives.delete(e),this.invalidate())}})};return this.pendingArchives.set(e,r),this.invalidate(),r.promise}async unarchiveSession(e){let t=++this.archiveRequestSeq;this.pendingArchives.delete(e),this.invalidate();let n=await this.remote.unarchiveSession({sessionId:e,scope:`single`});return n.ok&&t===this.archiveRequestSeq&&this.installArchived(n.value.archivedSessionIds),n}async deleteSession(e){let t=await this.remote.deleteSession({sessionId:e});return t.ok&&(this.pendingArchives.delete(e),this.archivedSessionIds.includes(e)&&this.installArchived(this.archivedSessionIds.filter(t=>t!==e)),this.pinnedSessionIds.includes(e)&&this.installPinned(this.pinnedSessionIds.filter(t=>t!==e))),t}async pinSession(e){let t=++this.pinRequestSeq,n=await this.remote.pinSession({sessionId:e});return n.ok&&t===this.pinRequestSeq&&this.installPinned(n.value.pinnedSessionIds),n}async unpinSession(e){let t=++this.pinRequestSeq,n=await this.remote.unpinSession({sessionId:e});return n.ok&&t===this.pinRequestSeq&&this.installPinned(n.value.pinnedSessionIds),n}replaceBaseline(e){this.orderFrameGeneration++,this.archiveRequestSeq++,this.pinRequestSeq++,this.pinnedWorkspaceRequestSeq++,this.canStartProjectless=e.canStartProjectless===!0,this.installViews(e.items),this.installArchived(e.archivedSessionIds),this.installPinned(e.pinnedSessionIds),this.installPinnedWorkspaces(e.pinnedWorkspaceIds??[]),this.threadSections=e.threadSections??[],this.state=`idle`,this.phase=`ready`,this.error=null,this.invalidate()}async setWorkspacePinned(e){let t=++this.pinnedWorkspaceRequestSeq,n=await this.remote.setWorkspacePinned(e);return n.ok&&t===this.pinnedWorkspaceRequestSeq&&this.installPinnedWorkspaces(n.value.pinnedWorkspaceIds),n}moveSessionToSection(e){return this.remote.moveSessionToSection(e)}moveWorkspaceToSection(e){return this.remote.moveWorkspaceToSection(e)}upsertView(e){this.upsert(e)}removeView(e){this.remove(e)}replaceOrder(e){this.orderFrameGeneration++,this.installOrder(e,!0)}replaceArchived(e){this.archiveRequestSeq++,this.installArchived(e)}replacePinned(e){this.pinRequestSeq++,this.installPinned(e)}replacePinnedWorkspaces(e){this.pinnedWorkspaceRequestSeq++,this.installPinnedWorkspaces(e)}replaceThreadSections(e){this.threadSections=e,this.invalidate()}handleCarrierFailure(){this.state=`loading`,this.error=null,this.invalidate()}handleStreamFailure(e){if(!(0,r.isRemoteFailure)(e))throw e;this.state=`error`,this.error=e,this.invalidate()}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}getSnapshot(){return this.refreshSnapshot(),this.snapshotCache}buildSnapshot(){let e=new Set([...this.pendingArchives].filter(([,e])=>!e.observed).map(([e])=>e));return{items:this.items,canStartProjectless:this.canStartProjectless,archivedSessionIds:e.size===0?this.archivedSessionIds:[.../* @__PURE__ */ new Set([...this.archivedSessionIds,...e])],pinnedSessionIds:e.size===0?this.pinnedSessionIds:this.pinnedSessionIds.filter(t=>!e.has(t)),pinnedWorkspaceIds:this.pinnedWorkspaceIds,threadSections:this.threadSections,state:this.state,phase:this.phase,error:this.error}}installArchived(e){for(let t of e){let e=this.pendingArchives.get(t);e!==void 0&&(e.observed=!0)}e.length===this.archivedSessionIds.length&&e.every((e,t)=>e===this.archivedSessionIds[t])||(this.archivedSessionIds=[...e],this.invalidate())}installPinned(e){e.length===this.pinnedSessionIds.length&&e.every((e,t)=>e===this.pinnedSessionIds[t])||(this.pinnedSessionIds=[...e],this.invalidate())}installPinnedWorkspaces(e){e.length===this.pinnedWorkspaceIds.length&&e.every((e,t)=>e===this.pinnedWorkspaceIds[t])||(this.pinnedWorkspaceIds=[...e],this.invalidate())}installOrder(e,t=!1){t&&(this.committedOrder=[...e]);let n=new Map(e.map((e,t)=>[e,t])),r=[...this.items].sort((e,t)=>(n.get(e.workspaceId)??2**53-1)-(n.get(t.workspaceId)??2**53-1));r.every((e,t)=>e===this.items[t])||(this.items=r,this.invalidate())}upsert(e){if(this.removedIds.has(e.workspaceId))return;let t=this.items.findIndex(t=>t.workspaceId===e.workspaceId),n=this.items[t];n!==void 0&&Date.parse(e.updatedAt)<Date.parse(n.updatedAt)||(this.committedOrder.includes(e.workspaceId)||(this.committedOrder=[e.workspaceId,...this.committedOrder]),this.items=t===-1?[e,...this.items]:this.items.map((n,r)=>r===t?e:n),this.invalidate())}remove(e,t={}){let{immediate:n=!1,recordRemoved:r=!1}=t;r&&!s(e)&&this.removedIds.add(e),this.committedOrder=this.committedOrder.filter(t=>t!==e);let i=this.pinnedWorkspaceIds.filter(t=>t!==e);i.length!==this.pinnedWorkspaceIds.length&&(this.pinnedWorkspaceIds=i);let a=this.items.filter(t=>t.workspaceId!==e);a.length===this.items.length?n&&this.invalidate(!0):(this.items=a,this.invalidate(n))}installViews(e){let t=/* @__PURE__ */ new Map;for(let n of e)this.removedIds.has(n.workspaceId)||t.set(n.workspaceId,n);this.items=[...t.values()],this.committedOrder=e.map(e=>e.workspaceId)}invalidate(e=!1){if(this.snapshotDirty=!0,this.notificationPending=!0,e){this.notificationGeneration++,this.notificationScheduled=!1,this.flush();return}if(this.notificationScheduled)return;this.notificationScheduled=!0;let t=++this.notificationGeneration;queueMicrotask(()=>{t===this.notificationGeneration&&(this.notificationScheduled=!1,this.flush())})}flush(){this.notificationPending&&this.listeners.size!==0&&(this.notificationPending=!1,this.refreshSnapshot(),(0,i.notifySubscribers)(this.listeners,`[workspace-controller]`))}refreshSnapshot(){this.snapshotDirty&&(this.snapshotDirty=!1,this.snapshotCache=this.buildSnapshot())}};function s(e){return e.startsWith(`remote-workspace:`)}function c(e,t,n){if(!e.includes(t)||n!==void 0&&!e.includes(n)||n===t)return[...e];let r=e.filter(e=>e!==t),i=n===void 0?r.length:r.indexOf(n);return[...r.slice(0,i),t,...r.slice(i)]}var l=class extends Error{rpcError;name=`WorkspaceCreateError`;constructor(e){super(`workspace create failed: ${e.code}: ${e.message}`),this.rpcError=e}},u=class extends Error{rpcError;name=`WorkspaceArchiveError`;constructor(e){super(`workspace session archive failed: ${e.code}: ${e.message}`),this.rpcError=e}},d=class extends a.Service{model;list;constructor(e,t){super(e,`workspaces`),this.model=t,this.list=t}async create(e){let t=await this.model.create(e);if(!t.ok)throw new l(t.error);return t.value.workspace}async initializeDefault(e){let t=await this.model.initializeDefault(e);if(!t.ok)throw new l(t.error);return t.value?.workspace}async rename(e,t){let n=await this.model.rename(e,t);if(!n.ok)throw f(`rename`,n.error);return n.value.workspace}async delete(e){let t=await this.model.delete(e);if(!t.ok)throw f(`delete`,t.error)}async insertBefore(e,t){let n=await this.model.insertBefore(e,t);if(!n.ok)throw f(`reorder`,n.error)}async archiveSession(e,t={}){let n=await this.model.archiveSession(e,t);if(!n.ok)throw new u(n.error)}async unarchiveSession(e){let t=await this.model.unarchiveSession(e);if(!t.ok)throw f(`session unarchive`,t.error)}async deleteSession(e){let t=await this.model.deleteSession(e);if(!t.ok)throw f(`session delete`,t.error)}async pinSession(e){let t=await this.model.pinSession(e);if(!t.ok)throw f(`session pin`,t.error)}async moveSessionToSection(e,t){let n=await this.model.moveSessionToSection({sessionId:e,sectionId:t});if(!n.ok)throw f(`move to section`,n.error);if(n.value.sectionId!==t)throw Error(`The requested section change was not confirmed.`)}async moveWorkspaceToSection(e,t){let n=await this.model.moveWorkspaceToSection({workspaceId:e,sectionId:t});if(!n.ok)throw f(`move project to section`,n.error);if(n.value.sectionId!==t)throw Error(`The requested section change was not confirmed.`)}async unpinSession(e){let t=await this.model.unpinSession(e);if(!t.ok)throw f(`session unpin`,t.error)}async setWorkspacePinned(e,t){let n=await this.model.setWorkspacePinned({workspaceId:e,pinned:t});if(!n.ok)throw f(t?`pin`:`unpin`,n.error)}async insertSessionBefore(e,t,n){let r=await this.model.insertSessionBefore(e,t,n);if(!r.ok)throw f(`move`,r.error);return r.value.workspace}};function f(e,t){return/* @__PURE__ */ Error(`workspace ${e} failed: ${t.code}: ${t.message}`)}let p=[`remote`,`remote.workspace`];function m(e){let t=new o(e.remote.workspace);new d(e,t);let n=h(e.remote,{accept:t,carrierFailed:()=>{t.handleCarrierFailure()},failed:e=>{t.handleStreamFailure(e)}});n.start(),e.effect(()=>async()=>{await n.dispose()},`workspace-controller.client.control`)}function h(e,t){let n=e.$stream({name:`Workspace state stream`,open:t=>e.workspace.follow(t),ended:e=>e?new r.RemoteStreamCarrierError(`Workspace state stream ended without a terminal result`):/* @__PURE__ */ Error(`Workspace state stream ended before its opening snapshot`),...t.carrierFailed===void 0?{}:{carrierFailed:t.carrierFailed}});return new r.RemoteSnapshotStream(n,{name:`Workspace state stream`,isSnapshot:e=>e.type===`baseline`,replace:e=>{t.accept.replaceBaseline(e.value)},update:e=>{g(t.accept,e)},failed:t.failed})}function g(e,t){switch(t.type){case`upsert`:e.upsertView(t.workspace);return;case`remove`:e.removeView(t.workspaceId);return;case`order`:e.replaceOrder(t.workspaceIds);return;case`archived`:e.replaceArchived(t.archivedSessionIds);return;case`pinned`:e.replacePinned(t.pinnedSessionIds);return;case`pinnedWorkspaces`:e.replacePinnedWorkspaces(t.pinnedWorkspaceIds);return;case`threadSections`:e.replaceThreadSections(t.threadSections);return;
2
2
  /* v8 ignore next -- the generated Remote codec validates this closed union */
3
3
  default:return _(t)}}
4
4
  /* v8 ignore next 3 -- closed-union backstop after generated Remote validation */
@@ -1 +1 @@
1
- window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-client-file-upload`,factory:e=>{var t={exports:{}},n=t.exports;Object.defineProperty(n,Symbol.toStringTag,{value:`Module`});let r=e("@deepseek-ai/cordis");var i=class extends Error{code;details;isDSHRemoteError=!0;constructor(e,t,n,r){super(t,r),this.code=e,this.details=n,this.name=`RemoteError`}};function a(e=self,t=()=>new XMLHttpRequest,n=(e,t)=>fetch(e,t)){e.onmessage=r=>{let i=r.data,a=!1,o=0,s=()=>{},c=(t,n=!1)=>{a||(a=!0,clearTimeout(u),n&&s(),e.postMessage(t))},l=()=>{c({kind:`error`,message:`Upload made no progress for 60 seconds.`},!0)},u=setTimeout(l,6e4),d=(t,n)=>{a||(t>o&&(o=t,clearTimeout(u),u=setTimeout(l,6e4)),e.postMessage({kind:`progress`,loaded:t,...n===void 0?{}:{total:n}}))};if(i.body instanceof Blob){let e=t();e.open(`POST`,i.url),e.withCredentials=!0;for(let[t,n]of Object.entries(i.headers))e.setRequestHeader(t,n);s=()=>e.abort(),e.upload.onprogress=e=>{d(e.loaded,e.lengthComputable?e.total:void 0)},e.onload=()=>{c({kind:`complete`,status:e.status,body:e.responseText})},e.onerror=()=>{c({kind:`error`,message:`background upload transport failed`})},e.send(i.body);return}if(!(i.body instanceof ReadableStream)){c({kind:`error`,message:`background upload worker received an invalid body`});return}let f=i.body;(async()=>{let e=f.getReader(),t=new AbortController;s=()=>{t.abort(),e.cancel().catch(()=>{})};let r=0,a=new ReadableStream({async pull(t){let n=await e.read();if(n.done)t.close();else{if(!(n.value instanceof Uint8Array))throw TypeError(`background upload stream produced a non-Uint8Array chunk`);r+=n.value.byteLength,d(r),t.enqueue(n.value)}},async cancel(t){await e.cancel(t)}}),o=await n(i.url,{method:`POST`,headers:i.headers,credentials:`include`,body:a,duplex:`half`,signal:t.signal});c({kind:`complete`,status:o.status,body:await o.text()})})().catch(e=>{c({kind:`error`,message:e instanceof Error?e.message:String(e)})})}}var o=class extends r.Service{transport;constructor(e){super(e,`fileUpload`);let t=globalThis.__DSH_FILE_UPLOAD__;this.transport=t===void 0?c():s(t.fetch)}post(e){return this.transport.post(e)}async upload(e,t,n,r,i,a){let o=new URLSearchParams({sessionId:e});n!==void 0&&o.set(`name`,n),a!==void 0&&o.set(`imageMediaType`,a);let s=t instanceof Uint8Array?new Blob([Uint8Array.from(t).buffer]):t,c=await this.post({path:`api/session/uploadFileBinary?${o.toString()}`,body:s,headers:{"content-type":`application/octet-stream`},...r===void 0?{}:{signal:r},...i===void 0?{}:{onProgress:i}});if(c.status!==200)throw Error(`file upload transport failed with HTTP ${String(c.status)}`);return l(c.body)}};function s(e){return{async post(t){let n={method:`POST`,...t.headers===void 0?{}:{headers:t.headers},body:t.body,...t.body instanceof ReadableStream?{duplex:`half`}:{},...t.signal===void 0?{}:{signal:t.signal}},r=await e(t.path,n);return{status:r.status,body:await r.text()}}}}function c(){return{post(e){if(typeof Worker!=`function`)return Promise.reject(/* @__PURE__ */ Error(`background upload requires Web Worker support`));let t=URL.createObjectURL(new Blob([`(${a.toString()})()`],{type:`text/javascript`})),n=new Worker(t,{name:`dsh-file-upload`});return URL.revokeObjectURL(t),new Promise((t,r)=>{let i=!1,a=()=>{i=!0,n.terminate(),e.signal?.removeEventListener(`abort`,a),r(new DOMException(`The operation was aborted.`,`AbortError`))},o=t=>{i||(i=!0,e.signal?.removeEventListener(`abort`,a),n.terminate(),t())};if(n.onmessage=n=>{let i=n.data;i.kind===`progress`?e.onProgress?.({loaded:i.loaded,...i.total===void 0?{}:{total:i.total}}):i.kind===`complete`?o(()=>{t({status:i.status,body:i.body})}):o(()=>{r(Error(i.message))})},n.onerror=e=>{o(()=>{r(Error(e.message||`background upload worker failed`))})},e.signal?.aborted===!0){a();return}e.signal?.addEventListener(`abort`,a,{once:!0});let s={url:new URL(e.path,document.baseURI).href,body:e.body,headers:e.headers??{}};e.body instanceof ReadableStream?n.postMessage(s,[e.body]):n.postMessage(s)})}}}function l(e){let t=JSON.parse(e);if(!u(t)||typeof t.ok!=`boolean`)throw TypeError(`file upload transport returned an invalid result`);if(!t.ok){let e=t.error;if(!u(e)||typeof e.code!=`string`||typeof e.message!=`string`||!u(e.details))throw TypeError(`file upload transport returned an invalid failure`);return{ok:!1,error:new i(e.code,e.message,e.details)}}let n=t.value,r=u(n)?n.file:void 0;if(!u(n)||typeof n.receiptId!=`string`||!u(r)||typeof r.attachmentId!=`string`||typeof r.name!=`string`||typeof r.bytes!=`number`||!Number.isSafeInteger(r.bytes)||r.bytes<0)throw TypeError(`file upload transport returned an invalid receipt`);return{ok:!0,value:{receiptId:n.receiptId,file:{attachmentId:r.attachmentId,name:r.name,bytes:r.bytes}}}}function u(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let d=[`remote`];function f(e){e.plugin(o)}return n.apply=f,n.inject=d,t.exports}});
1
+ window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-client-file-upload`,factory:e=>{var t={exports:{}},n=t.exports;Object.defineProperty(n,Symbol.toStringTag,{value:`Module`});let r=e("@deepseek-ai/cordis");var i=class extends Error{code;details;isDSHRemoteError=!0;constructor(e,t,n,r){super(t,r),this.code=e,this.details=n,this.name=`RemoteError`}};async function a(e,t){t?.throwIfAborted();let n=new AbortController,r=t?AbortSignal.any([t,n.signal]):n.signal,i=()=>setTimeout(()=>n.abort(/* @__PURE__ */ Error(`Upload made no progress for 60 seconds.`)),6e4),a=i();try{let t=new TransformStream({transform(e,t){e.byteLength>0&&(clearTimeout(a),a=i()),t.enqueue(e)}}),n=e.stream().pipeThrough(t,{signal:r});return await new Response(n,{headers:{"content-type":e.type}}).blob()}finally{clearTimeout(a)}}function o(e=self,t=()=>new XMLHttpRequest,n=(e,t)=>fetch(e,t)){e.onmessage=r=>{let i=r.data,a=!1,o=0,s=()=>{},c=(t,n=!1)=>{a||(a=!0,clearTimeout(u),n&&s(),e.postMessage(t))},l=()=>{c({kind:`error`,message:`Upload made no progress for 60 seconds.`},!0)},u=setTimeout(l,6e4),d=(t,n)=>{a||(t>o&&(o=t,clearTimeout(u),u=setTimeout(l,6e4)),e.postMessage({kind:`progress`,loaded:t,...n===void 0?{}:{total:n}}))};if(i.body instanceof Blob){let e=t();e.open(`POST`,i.url),e.withCredentials=!0;for(let[t,n]of Object.entries(i.headers))e.setRequestHeader(t,n);s=()=>e.abort(),e.upload.onprogress=e=>{d(e.loaded,e.lengthComputable?e.total:void 0)},e.onload=()=>{c({kind:`complete`,status:e.status,body:e.responseText})},e.onerror=()=>{c({kind:`error`,message:`background upload transport failed`})},e.send(i.body);return}if(!(i.body instanceof ReadableStream)){c({kind:`error`,message:`background upload worker received an invalid body`});return}let f=i.body;(async()=>{let e=f.getReader(),t=new AbortController;s=()=>{t.abort(),e.cancel().catch(()=>{})};let r=0,a=new ReadableStream({async pull(t){let n=await e.read();if(n.done)t.close();else{if(!(n.value instanceof Uint8Array))throw TypeError(`background upload stream produced a non-Uint8Array chunk`);r+=n.value.byteLength,d(r),t.enqueue(n.value)}},async cancel(t){await e.cancel(t)}}),o=await n(i.url,{method:`POST`,headers:i.headers,credentials:`include`,body:a,duplex:`half`,signal:t.signal});c({kind:`complete`,status:o.status,body:await o.text()})})().catch(e=>{c({kind:`error`,message:e instanceof Error?e.message:String(e)})})}}var s=class extends r.Service{transport;constructor(e){super(e,`fileUpload`);let t=globalThis.__DSH_FILE_UPLOAD__;this.transport=t===void 0?l():c(t.fetch)}post(e){return this.transport.post(e)}async upload(e,t,n,r,i,o){let s=new URLSearchParams({sessionId:e});n!==void 0&&s.set(`name`,n),o!==void 0&&s.set(`imageMediaType`,o);let c=t instanceof Uint8Array?new Blob([Uint8Array.from(t).buffer]):t,l=c instanceof Blob?c.size:void 0;o!==void 0&&t instanceof File&&t.size<=52428800&&(c=await a(t,r));let d=await this.post({path:`api/session/uploadFileBinary?${s.toString()}`,body:c,headers:{"content-type":`application/octet-stream`},...r===void 0?{}:{signal:r},...i===void 0?{}:{onProgress:i}});if(d.status!==200)throw Error(`file upload transport failed with HTTP ${String(d.status)}`);let f=u(d.body);if(f.ok&&l!==void 0&&f.value.file.bytes!==l)throw Error(`File upload expected ${l} bytes but received ${f.value.file.bytes}.`);return f}};function c(e){return{async post(t){let n={method:`POST`,...t.headers===void 0?{}:{headers:t.headers},body:t.body,...t.body instanceof ReadableStream?{duplex:`half`}:{},...t.signal===void 0?{}:{signal:t.signal}},r=await e(t.path,n);return{status:r.status,body:await r.text()}}}}function l(){return{post(e){if(typeof Worker!=`function`)return Promise.reject(/* @__PURE__ */ Error(`background upload requires Web Worker support`));let t=URL.createObjectURL(new Blob([`(${o.toString()})()`],{type:`text/javascript`})),n=new Worker(t,{name:`dsh-file-upload`});return URL.revokeObjectURL(t),new Promise((t,r)=>{let i=!1,a=()=>{i=!0,n.terminate(),e.signal?.removeEventListener(`abort`,a),r(new DOMException(`The operation was aborted.`,`AbortError`))},o=t=>{i||(i=!0,e.signal?.removeEventListener(`abort`,a),n.terminate(),t())};if(n.onmessage=n=>{let i=n.data;i.kind===`progress`?e.onProgress?.({loaded:i.loaded,...i.total===void 0?{}:{total:i.total}}):i.kind===`complete`?o(()=>{t({status:i.status,body:i.body})}):o(()=>{r(Error(i.message))})},n.onerror=e=>{o(()=>{r(Error(e.message||`background upload worker failed`))})},e.signal?.aborted===!0){a();return}e.signal?.addEventListener(`abort`,a,{once:!0});let s={url:new URL(e.path,document.baseURI).href,body:e.body,headers:e.headers??{}};e.body instanceof ReadableStream?n.postMessage(s,[e.body]):n.postMessage(s)})}}}function u(e){let t=JSON.parse(e);if(!d(t)||typeof t.ok!=`boolean`)throw TypeError(`file upload transport returned an invalid result`);if(!t.ok){let e=t.error;if(!d(e)||typeof e.code!=`string`||typeof e.message!=`string`||!d(e.details))throw TypeError(`file upload transport returned an invalid failure`);return{ok:!1,error:new i(e.code,e.message,e.details)}}let n=t.value,r=d(n)?n.file:void 0;if(!d(n)||typeof n.receiptId!=`string`||!d(r)||typeof r.attachmentId!=`string`||typeof r.name!=`string`||typeof r.bytes!=`number`||!Number.isSafeInteger(r.bytes)||r.bytes<0)throw TypeError(`file upload transport returned an invalid receipt`);return{ok:!0,value:{receiptId:n.receiptId,file:{attachmentId:r.attachmentId,name:r.name,bytes:r.bytes}}}}function d(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let f=[`remote`];function p(e){e.plugin(s)}return n.apply=p,n.inject=f,t.exports}});
@@ -6,4 +6,4 @@ n!==null&&(t&&(n.scrollLeft=n.scrollWidth-n.clientWidth),p())},[e.length,p]),(0,
6
6
  /* v8 ignore next -- defensive: the rail div renders unconditionally, so the mount effect always finds it. */
7
7
  if(e===null)return;let t=()=>{};if(typeof ResizeObserver<`u`){let n=new ResizeObserver(p);n.observe(e),t=()=>{n.disconnect()}}let n=t=>{if(t.deltaY===0)return;let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?16:t.deltaMode===WheelEvent.DOM_DELTA_PAGE?e.clientWidth:1;t.preventDefault(),e.scrollBy({left:t.deltaX===0?Math.sign(t.deltaY)*Math.min(Math.abs(t.deltaY)*n,60):t.deltaX*n,behavior:`auto`})};return e.addEventListener(`wheel`,n,{passive:!1}),()=>{t(),e.removeEventListener(`wheel`,n)}},[p]);let m=e=>{let t=o.current;
8
8
  /* v8 ignore next -- defensive: the arrows render only while the rail is mounted, so a click cannot find a null ref. */
9
- t!==null&&t.scrollBy({left:e*Math.max(t.clientWidth-64,200),behavior:d()})};return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:u.root,children:[l.left&&/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:c(u.arrow,u.arrowLeft),"aria-label":t.scrollLeft,onMouseDown:e=>{e.preventDefault()},onClick:()=>{m(-1)},children:/* @__PURE__ */ (0,a.jsx)(i.IconChevronLeftOutlineRegular,{})}),/* @__PURE__ */ (0,a.jsx)(`div`,{ref:o,className:u.rail,role:`group`,"aria-label":t.group,onScroll:p,children:e.map(e=>/* @__PURE__ */ (0,a.jsx)(`div`,{className:u.item,children:n(e)},e.id))}),l.right&&/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:c(u.arrow,u.arrowRight),"aria-label":t.scrollRight,onMouseDown:e=>{e.preventDefault()},onClick:()=>{m(1)},children:/* @__PURE__ */ (0,a.jsx)(i.IconChevronRightOutlineRegular,{})})]})}let p=`@deepseek-ai/dsh-client-ui-attachment/DropOverlay.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(p)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-attachment`,e.dataset.pluginCss=p,e.textContent=`.cpj-8a_mask{z-index:1000;pointer-events:none;background-color:var(--dsw-alias-bg-mask-drop);backdrop-filter:blur(10px);justify-content:center;align-items:center;animation:.16s ease-out cpj-8a_fade-in;display:flex;position:fixed;inset:0}@keyframes cpj-8a_fade-in{0%{opacity:0}to{opacity:1}}@media (prefers-reduced-motion:reduce){.cpj-8a_mask{animation:none}}.cpj-8a_wrap{color:var(--dsw-alias-label-primary);text-align:center;flex-direction:column;align-items:center;margin-top:-3%;padding:0 40px;display:flex}.cpj-8a_illustration{width:115px;height:84px}.cpj-8a_title{font:var(--dsw-font-l-20);margin-top:16px}.cpj-8a_desc{font:var(--dsw-font-s-14);color:var(--dsw-alias-label-tertiary);white-space:pre-wrap;margin-top:16px}`,document.head.appendChild(e)}var m={desc:`cpj-8a_desc`,"fade-in":`cpj-8a_fade-in`,illustration:`cpj-8a_illustration`,mask:`cpj-8a_mask`,title:`cpj-8a_title`,wrap:`cpj-8a_wrap`};function h({disabled:e,labels:t}){return(0,o.createPortal)(/* @__PURE__ */ (0,a.jsx)(`div`,{className:m.mask,role:`status`,children:/* @__PURE__ */ (0,a.jsxs)(`div`,{className:m.wrap,children:[/* @__PURE__ */ (0,a.jsx)(`div`,{className:m.illustration,"aria-hidden":`true`,children:e?/* @__PURE__ */ (0,a.jsx)(_,{}):/* @__PURE__ */ (0,a.jsx)(g,{})}),/* @__PURE__ */ (0,a.jsx)(`div`,{className:m.title,children:t.title}),!e&&t.desc!==void 0&&/* @__PURE__ */ (0,a.jsx)(`div`,{className:m.desc,children:t.desc})]})}),document.body)}let g=()=>/* @__PURE__ */ (0,a.jsxs)(`svg`,{width:`115`,height:`84`,viewBox:`0 0 115 84`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[/* @__PURE__ */ (0,a.jsxs)(`g`,{clipPath:`url(#dshDropOverlayClip)`,children:[/* @__PURE__ */ (0,a.jsx)(`rect`,{y:`17.0742`,width:`44.1832`,height:`43.6431`,rx:`12`,transform:`rotate(-22.7338 0 17.0742)`,fill:`#9CE5ED`}),/* @__PURE__ */ (0,a.jsx)(`rect`,{x:`73.4043`,y:`8.54297`,width:`43.7267`,height:`50.5284`,rx:`8`,transform:`rotate(17.403 73.4043 8.54297)`,fill:`#679EFE`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M30.4917 28.1369L40.8865 33.4564L37.2232 34.9524L29.5302 31.0159L26.7919 39.2122L23.1285 40.7082L26.8287 29.6338L16.8967 24.5516L20.5601 23.0556L27.7902 26.7549L30.3639 19.052L34.0273 17.556L30.4917 28.1369Z`,fill:`white`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M77.5088 26.3047L101.057 33.7966`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M72.2646 42.7871L86.3938 47.2823`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M74.8867 34.5469L98.4353 42.0388`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`rect`,{x:`31.583`,y:`38.6641`,width:`44.9157`,height:`44.3666`,rx:`12`,transform:`rotate(-0.134233 31.583 38.6641)`,fill:`#3964FE`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M38.9521 73.0337C39.6129 71.7086 41.7113 66.0937 43.5113 61.1663C44.1607 59.3885 46.7484 59.3923 47.4591 61.1465C48.9728 64.8828 50.7969 68.6922 51.9988 69.1925C54.2946 70.1482 57.9854 59.3573 68.0064 70.1801`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`circle`,{cx:`60.6157`,cy:`52.247`,r:`4.38794`,transform:`rotate(22.5996 60.6157 52.247)`,fill:`white`})]}),/* @__PURE__ */ (0,a.jsx)(`defs`,{children:/* @__PURE__ */ (0,a.jsx)(`clipPath`,{id:`dshDropOverlayClip`,children:/* @__PURE__ */ (0,a.jsx)(`rect`,{width:`115`,height:`84`,fill:`white`})})})]}),_=()=>/* @__PURE__ */ (0,a.jsxs)(`svg`,{width:`115`,height:`84`,viewBox:`0 0 115 84`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M29.6829 4.63701L11.0677 12.4368C4.95519 14.998 2.07624 22.0294 4.6374 28.1419L12.2285 46.259C14.7896 52.3715 21.8211 55.2505 27.9336 52.6893L46.5488 44.8895C52.6613 42.3283 55.5403 35.2969 52.9791 29.1844L45.388 11.0673C42.8269 4.9548 35.7954 2.07585 29.6829 4.63701Z`,fill:`#979DA6`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M30.4915 28.1375L40.8863 33.4569L37.223 34.9529L29.53 31.0165L26.7917 39.2128L23.1283 40.7088L26.8285 29.6344L16.8965 24.5522L20.5599 23.0562L27.79 26.7555L30.3637 19.0526L34.0271 17.5566L30.4915 28.1375Z`,fill:`white`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M107.496 19.2285L81.0381 10.9357C76.8221 9.61423 72.333 11.9607 71.0116 16.1768L60.6844 49.1246C59.363 53.3406 61.7095 57.8297 65.9255 59.1511L92.383 67.4439C96.599 68.7654 101.088 66.4189 102.41 62.2029L112.737 29.255C114.058 25.039 111.712 20.55 107.496 19.2285Z`,fill:`#979DA6`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M77.5088 26.3047L101.057 33.7967`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M72.2646 42.7871L86.3938 47.2823`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M74.8867 34.5469L98.4353 42.0388`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M66.5798 30.1418L41.481 30.2006C33.5281 30.2193 27.0962 36.6815 27.1148 44.6343L27.172 69.0742C27.1907 77.0271 33.6529 83.459 41.6057 83.4404L66.7045 83.3816C74.6574 83.363 81.0894 76.9008 81.0707 68.9479L81.0135 44.5081C80.9949 36.5552 74.5327 30.1232 66.5798 30.1418Z`,fill:`#F59E0B`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M54 70.7969C61.732 70.7969 68 64.5289 68 56.7969C68 49.0649 61.732 42.7969 54 42.7969C46.268 42.7969 40 49.0649 40 56.7969C40 64.5289 46.268 70.7969 54 70.7969Z`,stroke:`white`,strokeWidth:`3.5`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M44 46.7969L64 66.7969`,stroke:`white`,strokeWidth:`3.5`,strokeLinecap:`round`})]}),v=`@deepseek-ai/dsh-client-ui-attachment/FileCard.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(v)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-attachment`,e.dataset.pluginCss=v,e.textContent=`.Mdc2uq_card{border:.5px solid var(--dsw-alias-border-l2,#0000001f);border-radius:var(--dsw-radius-lg);background:var(--dsw-specific-input-major,transparent);box-sizing:border-box;text-align:left;align-items:center;gap:10px;width:240px;height:64px;padding:0 12px;display:inline-flex;position:relative}.Mdc2uq_failed{border-color:var(--dsw-alias-state-error-primary,#d54941)}.Mdc2uq_icon{flex:none;justify-content:center;align-items:center;width:28px;height:28px;display:inline-flex}.Mdc2uq_spinner{corner-shape:round;border:2px solid;border-top-color:#0000;border-radius:50%;width:20px;height:20px;animation:.8s linear infinite Mdc2uq_file-card-spin}@keyframes Mdc2uq_file-card-spin{to{transform:rotate(360deg)}}.Mdc2uq_body{flex-direction:column;flex:1;min-width:0;padding:8px 0;display:flex}.Mdc2uq_retry{color:inherit;font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;padding:0}.Mdc2uq_name{white-space:nowrap;text-overflow:ellipsis;color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500;line-height:22px;overflow:hidden}.Mdc2uq_meta{white-space:nowrap;text-overflow:ellipsis;color:var(--dsw-alias-label-tertiary,#00000073);font-size:12px;line-height:15px;overflow:hidden}.Mdc2uq_metaFailed{color:var(--dsw-alias-state-error-primary,#d54941)}.Mdc2uq_remove{corner-shape:round;background:var(--dsw-alias-button-contrast-fill,#000000b8);width:18px;height:18px;color:var(--dsw-alias-label-primary-inverted,#fff);opacity:0;cursor:pointer;border:none;border-radius:50%;justify-content:center;align-items:center;padding:0;transition:opacity .2s ease-in-out;display:inline-flex;position:absolute;top:6px;right:6px}.Mdc2uq_card:hover .Mdc2uq_remove,.Mdc2uq_remove:focus-visible{opacity:1}@media (pointer:coarse){.Mdc2uq_remove{opacity:1}}@media (prefers-reduced-motion:reduce){.Mdc2uq_remove{transition:none}}.Mdc2uq_card:hover .Mdc2uq_name,.Mdc2uq_card:focus-within .Mdc2uq_name{padding-right:18px}.Mdc2uq_removeFailed{background:var(--dsw-alias-state-error-primary,#d54941);color:#fff;opacity:1}.Mdc2uq_progressTrack{background:var(--dsw-alias-fill-tertiary,#00000014);border-radius:1px;height:2px;position:absolute;bottom:5px;left:12px;right:12px;overflow:hidden}.Mdc2uq_progressBar{border-radius:inherit;background:var(--dsw-alias-brand-primary,#4d6bfe);width:35%;height:100%;animation:1.2s ease-in-out infinite alternate Mdc2uq_file-card-progress;display:block}.Mdc2uq_progressBar[style]{animation:none}@keyframes Mdc2uq_file-card-progress{0%{transform:translate(-70%)}to{transform:translate(220%)}}@media (pointer:coarse){.Mdc2uq_remove{opacity:1}}`,document.head.appendChild(e)}var y={body:`Mdc2uq_body`,card:`Mdc2uq_card`,failed:`Mdc2uq_failed`,"file-card-progress":`Mdc2uq_file-card-progress`,"file-card-spin":`Mdc2uq_file-card-spin`,icon:`Mdc2uq_icon`,meta:`Mdc2uq_meta`,metaFailed:`Mdc2uq_metaFailed`,name:`Mdc2uq_name`,progressBar:`Mdc2uq_progressBar`,progressTrack:`Mdc2uq_progressTrack`,remove:`Mdc2uq_remove`,removeFailed:`Mdc2uq_removeFailed`,retry:`Mdc2uq_retry`,spinner:`Mdc2uq_spinner`};function b({name:e,bytes:t,state:n,progress:r,labels:o,onRemove:s,onRetry:c}){let l=(0,i.fileExtension)(e).toUpperCase().slice(0,8),u=n===`uploading`?r===void 0?o.uploading:o.uploadingPercent(Math.round(Math.min(1,Math.max(0,r))*100)):n===`error`?o.failed:[l,(0,i.fileSizeText)(t)].filter(e=>e!==``).join(` `),d=n===`error`;return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:`${y.card}${d?` ${y.failed}`:``}`,title:e,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.icon,"aria-hidden":!0,children:n===`uploading`?/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.spinner}):/* @__PURE__ */ (0,a.jsx)(i.FileTypeIcon,{path:e})}),d?/* @__PURE__ */ (0,a.jsxs)(`button`,{type:`button`,className:`${y.body} ${y.retry}`,"aria-label":o.retry,onMouseDown:e=>{e.preventDefault()},onClick:c,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.name,children:e}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:`${y.meta} ${y.metaFailed}`,children:u})]}):/* @__PURE__ */ (0,a.jsxs)(`span`,{className:y.body,"aria-label":o.label,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.name,children:e}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.meta,children:u})]}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:d?`${y.remove} ${y.removeFailed}`:y.remove,"aria-label":o.remove,onMouseDown:e=>{e.preventDefault()},onClick:s,children:/* @__PURE__ */ (0,a.jsx)(i.IconCloseFillRegular,{size:12})}),n===`uploading`&&/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.progressTrack,"aria-hidden":!0,children:/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.progressBar,style:r===void 0?void 0:{width:`${String(Math.min(1,Math.max(0,r))*100)}%`}})})]})}function x(e){return{dialog:e(`image.preview`),close:e(`image.closePreview`)}}function S(e){return{image:e(`image.label`),open:e(`image.openOriginal`),openNamed:t=>e(`image.openOriginalLabel`,{label:t}),loading:e(`image.loading`),loadFailed:e(`image.loadFailed`),tooLarge:e(`image.previewTooLarge`),lightbox:x(e)}}function C(e,t,n){return t?{title:e(`attachment.dropTitle`),desc:n===void 0?void 0:e(`attachment.dropDesc`,n)}:{title:e(`attachment.dropBlocked`)}}function w(e,t){return{label:e(`file.pending`),remove:e(`file.remove`,{name:t}),uploading:e(`file.uploading`),uploadingPercent:t=>e(`file.uploadingPercent`,{percent:t}),failed:e(`file.uploadFailed`),retry:e(`file.retry`,{name:t})}}function T(e){return{group:e(`attachment.pending`),scrollLeft:e(`attachment.scrollLeft`),scrollRight:e(`attachment.scrollRight`)}}function E(e,t){let n=/* @__PURE__ */ new Set,r=0;for(let i of e.items){if(i.kind!==`file`)continue;let e=t[r++];typeof i.webkitGetAsEntry==`function`&&i.webkitGetAsEntry()?.isDirectory===!0&&e!==void 0&&n.add(e)}return n}function D(e,t,n,r){let i=e=>{let t=e.dataTransfer;return t===null||!t.types.includes(`Files`)?null:t},a=()=>{n.current=0,r(!1)},o=e=>{i(e)!==null&&(e.preventDefault(),n.current+=1,r(!0))},s=t=>{let n=i(t);n!==null&&(t.preventDefault(),n.dropEffect=e?`copy`:`none`)},c=e=>{if(i(e)===null)return;n.current=Math.max(0,n.current-1),n.current===0&&r(!1);let t=e.clientX<=0||e.clientY<=0||e.clientX>=window.innerWidth||e.clientY>=window.innerHeight;(e.target===document.documentElement||e.target===document.body)&&t&&a()},l=n=>{let r=i(n);if(r!==null&&(n.preventDefault(),a(),e)){let e=[...r.files];t(e,E(r,e))}};return document.addEventListener(`dragenter`,o),document.addEventListener(`dragover`,s),document.addEventListener(`dragleave`,c),document.addEventListener(`drop`,l),window.addEventListener(`dragend`,a),()=>{document.removeEventListener(`dragenter`,o),document.removeEventListener(`dragover`,s),document.removeEventListener(`dragleave`,c),document.removeEventListener(`drop`,l),window.removeEventListener(`dragend`,a)}}let O=`@deepseek-ai/dsh-client-ui-attachment/ComposerAttachments.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(O)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-attachment`,e.dataset.pluginCss=O,e.textContent=`.O5Qubq_rail{min-width:0;margin-bottom:-6px;padding:2px 10px 0}.O5Qubq_imageItem{width:64px;height:64px;position:relative}.O5Qubq_thumbnail{border:.5px solid var(--dsw-alias-border-l2-darkmode-thin);border-radius:var(--dsw-radius-xl);background:var(--dsw-alias-interactive-bg-hover);cursor:zoom-in;width:64px;height:64px;padding:0;overflow:hidden}.O5Qubq_thumbnail img{object-fit:cover;width:100%;height:100%;display:block}.O5Qubq_overlay{border-radius:var(--dsw-radius-xl);color:#fff;font-variant-numeric:tabular-nums;background:#00000073;border:none;place-items:center;padding:0;font-size:13px;font-weight:500;display:grid;position:absolute;inset:0}.O5Qubq_failed{cursor:pointer;background:#dc2626b3}.O5Qubq_remove{z-index:1;corner-shape:round;background:var(--dsw-alias-button-contrast-fill);width:18px;height:18px;color:var(--dsw-alias-label-primary-inverted);cursor:pointer;opacity:0;border:none;border-radius:50%;place-items:center;padding:0;transition:opacity .2s ease-in-out;display:grid;position:absolute;top:4px;right:4px}.O5Qubq_imageItem:hover .O5Qubq_remove,.O5Qubq_remove:focus-visible{opacity:1}@media (pointer:coarse){.O5Qubq_remove{opacity:1}}@media (prefers-reduced-motion:reduce){.O5Qubq_remove{transition:none}}`,document.head.appendChild(e)}var k={failed:`O5Qubq_failed`,imageItem:`O5Qubq_imageItem`,overlay:`O5Qubq_overlay`,rail:`O5Qubq_rail`,remove:`O5Qubq_remove`,thumbnail:`O5Qubq_thumbnail`};function A({attachments:e,canAcceptDrop:t,onAddFiles:n,onRemoveAttachment:o,uploads:s,onRetryFile:c,dropLimits:l,t:u}){let[d,p]=(0,r.useState)(null),[m,g]=(0,r.useState)(!1),_=(0,r.useRef)(0),v=(0,r.useCallback)(()=>{p(null)},[]);(0,r.useEffect)(()=>{d!==null&&!e.some(e=>e.id===d.id)&&p(null)},[e,d]),(0,r.useEffect)(()=>D(t,n,_,g),[t,n]);let y=(0,r.useMemo)(()=>e.map(e=>({id:e.id,attachment:e})),[e]);return/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[m&&/* @__PURE__ */ (0,a.jsx)(h,{disabled:!t,labels:C(u,t,l)}),y.length>0&&/* @__PURE__ */ (0,a.jsx)(`div`,{className:k.rail,children:/* @__PURE__ */ (0,a.jsx)(f,{items:y,labels:T(u),renderItem:e=>{let t=e.attachment,n=s[t.id];if(t.kind===`image`){let e=t.file.name;return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:k.imageItem,children:[/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:k.thumbnail,title:u(`image.openOriginal`),onClick:()=>{p(t)},children:/* @__PURE__ */ (0,a.jsx)(`img`,{src:t.previewUrl,alt:e||u(`image.pending`)})}),(n===void 0||n.status===`uploading`)&&/* @__PURE__ */ (0,a.jsx)(`span`,{className:k.overlay,role:`status`,children:n?.total?`${String(Math.round(Math.min(1,n.loaded/n.total)*100))}%`:`…`}),n?.status===`error`&&/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:`${k.overlay} ${k.failed}`,"aria-label":u(`file.retry`,{name:e}),onMouseDown:e=>{e.preventDefault()},onClick:()=>{c(t.id)},children:u(`image.retry`)}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:k.remove,"aria-label":u(`image.remove`,{name:e}),onMouseDown:e=>{e.preventDefault()},onClick:()=>{o(t.id)},children:/* @__PURE__ */ (0,a.jsx)(i.IconCloseFillRegular,{size:12})})]})}let r=`file`in t?t.file.name:t.stored.name,l=`file`in t?t.file.size:t.stored.bytes;return/* @__PURE__ */ (0,a.jsx)(b,{name:r||u(`file.label`),bytes:l,state:n===void 0||n.status===`uploading`?`uploading`:n.status===`ready`?`ready`:`error`,...n?.status===`uploading`&&n.total!==void 0&&n.total>0?{progress:n.loaded/n.total}:{},labels:w(u,r),onRemove:()=>{o(t.id)},onRetry:()=>{c(t.id)}})}})}),d!==null&&/* @__PURE__ */ (0,a.jsx)(i.ImageLightbox,{src:d.previewUrl,alt:d.file.name||u(`image.original`),labels:x(u),onClose:v})]})}let j=`@deepseek-ai/dsh-client-ui-attachment/MessageImage.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(j)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-attachment`,e.dataset.pluginCss=j,e.textContent=`.zeivWW_gallery{flex-wrap:wrap;gap:10px;max-width:100%;display:flex}.zeivWW_gallery[data-align=end]{justify-content:flex-end;align-self:flex-end}.zeivWW_gallery[data-align=start]{justify-content:flex-start;align-self:flex-start}.zeivWW_frame{border:.5px solid var(--dsw-alias-border-l2-darkmode-thin);border-radius:var(--dsw-radius-xl);background:var(--dsw-alias-interactive-bg-hover);cursor:zoom-in;flex:none;place-items:center;min-width:44px;min-height:44px;padding:0;display:grid;overflow:hidden}.zeivWW_frame[data-variant=tile]{width:64px;min-width:64px;height:64px;min-height:64px}.zeivWW_frame img{object-fit:cover;width:100%;height:100%;display:block}.zeivWW_loading,.zeivWW_error{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}.zeivWW_error{border:.5px solid var(--dsw-alias-border-l2-darkmode-thin);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-interactive-bg-hover-danger);cursor:pointer;max-width:240px;padding:10px 12px}.zeivWW_error[data-variant=tile]{border-radius:var(--dsw-radius-xl);width:64px;height:64px;padding:4px;overflow:hidden}.zeivWW_frame[data-variant=thumbnail],.zeivWW_error[data-variant=thumbnail]{box-sizing:border-box;border-radius:var(--dsw-radius-lg);place-items:center;width:48px;min-width:48px;height:48px;min-height:48px;padding:2px;display:grid;overflow:hidden}.zeivWW_frame[data-variant=thumbnail] img{object-fit:contain}.zeivWW_spinner{animation:.9s linear infinite zeivWW_spinner-rotate}@keyframes zeivWW_spinner-rotate{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.zeivWW_spinner{animation:none}}.zeivWW_frame:focus-visible,.zeivWW_error:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}`,document.head.appendChild(e)}var M={error:`zeivWW_error`,frame:`zeivWW_frame`,gallery:`zeivWW_gallery`,loading:`zeivWW_loading`,spinner:`zeivWW_spinner`,"spinner-rotate":`zeivWW_spinner-rotate`};function N(e){let t=e.width/e.height,n=Math.min(4,Math.max(.25,t)),r=n>=1?{width:240,height:240/n}:{width:240*n,height:240},i=Math.min(1,e.width/r.width,e.height/r.height);return{width:Math.max(1,Math.round(r.width*i)),height:Math.max(1,Math.round(r.height*i)),objectPosition:t<.25?`center top`:t>4?`left center`:`center`}}function P(e){return`attachment`in e?e.attachment:e.preview.width!==void 0&&e.preview.height!==void 0?{width:e.preview.width,height:e.preview.height}:void 0}function F({image:e,load:t,variant:n,labels:o}){let s=`preview`in e?e.preview:void 0,c=`attachment`in e?e.attachment:void 0,[l,u]=(0,r.useState)(()=>c===void 0?null:t.peek?.(c)??null),[d,f]=(0,r.useState)(null),[p,m]=(0,r.useState)(),[h,g]=(0,r.useState)(!1),[_,v]=(0,r.useState)(0),y=(0,r.useCallback)(()=>{v(e=>e+1)},[]),b=(0,r.useCallback)(()=>{g(!1)},[]),x=(0,r.useMemo)(()=>P(e),[e]),S=(0,r.useMemo)(()=>{if(n!==`single`)return;let e=p??x;return e===void 0?{width:240,height:240,objectPosition:`center`}:N(e)},[x,p,n]);(0,r.useEffect)(()=>{if(c===void 0)return;let e=!0;return f(null),m(void 0),u(t.peek?.(c)??null),t(c).then(t=>{e&&u(t)}).catch(t=>{if(!e)return;let n=typeof t==`object`&&t&&`details`in t?t.details?.reason:void 0;f(n===`IMAGE_TOO_LARGE`||n===`IMAGE_TOO_MANY_PIXELS`?`too-large`:`unavailable`)}),()=>{e=!1}},[c,t,_]);let C=s?.url??l,w=(`attachment`in e?e.label:void 0)??s?.name??c?.name??o.image,T=n===`thumbnail`&&C===null;return d===`too-large`?/* @__PURE__ */ (0,a.jsx)(`div`,{className:M.error,"data-variant":n,role:`status`,title:o.tooLarge,children:o.tooLarge}):d?/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:M.error,"data-variant":n,title:n===`thumbnail`?o.loadFailed:void 0,"aria-label":n===`thumbnail`?o.loadFailed:void 0,onClick:y,children:n===`thumbnail`?/* @__PURE__ */ (0,a.jsx)(`span`,{"aria-hidden":`true`,children:/* @__PURE__ */ (0,a.jsx)(i.IconRefreshOutlineRegular,{})}):o.loadFailed}):/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:M.frame,"data-variant":n,style:S===void 0?void 0:{width:S.width,height:S.height},title:T?o.loading:o.open,"aria-label":T?o.loading:o.openNamed(w),"aria-busy":T||void 0,onClick:()=>{C!==null&&g(!0)},children:C===null?/* @__PURE__ */ (0,a.jsx)(`span`,{className:M.loading,"aria-hidden":T||void 0,children:T?/* @__PURE__ */ (0,a.jsx)(i.IconLoadingOutlineRegular,{className:M.spinner}):o.loading}):/* @__PURE__ */ (0,a.jsx)(`img`,{src:C,alt:w,onLoad:e=>{let{naturalWidth:t,naturalHeight:n}=e.currentTarget;t>0&&n>0&&m(e=>e?.width===t&&e.height===n?e:{width:t,height:n})},onError:()=>f(`unavailable`),style:S===void 0?void 0:{objectPosition:S.objectPosition}})}),h&&C!==null&&/* @__PURE__ */ (0,a.jsx)(i.ImageLightbox,{src:C,alt:w,labels:o.lightbox,onClose:b})]})}function I({images:e,load:t,align:n,compact:r=!1,thumbnail:i=!1,labels:o}){if(e.length===0)return null;let s=i?`thumbnail`:r||e.length>1?`tile`:`single`;return/* @__PURE__ */ (0,a.jsx)(`div`,{className:M.gallery,"data-align":n,children:e.map((e,n)=>/* @__PURE__ */ (0,a.jsx)(F,{image:e,load:t,variant:s,labels:o},`${`attachment`in e?e.attachment.attachmentId:e.preview.url}:${n}`))})}function L({images:e,loadImage:t,align:n,compact:r=!1,thumbnail:i=!1,t:o}){return/* @__PURE__ */ (0,a.jsx)(I,{images:e,load:t,align:n,compact:r,thumbnail:i,labels:S(o)})}let R=[`slots`];function z(e){e.slots.inject(`conversation.input.attachments`,()=>e.slots.register({name:`conversation.input.attachments`,locale:`conversation`},A)),e.slots.inject(`conversation.message.images`,()=>e.slots.register({name:`conversation.message.images`,locale:`conversation`},L)),e.slots.inject(`conversation.trajectory.images`,()=>e.slots.register({name:`conversation.trajectory.images`,locale:`conversation`},L)),e.slots.inject(`tool.call.images`,()=>e.slots.register({name:`tool.call.images`,locale:`conversation`},L))}return n.apply=z,n.inject=R,t.exports}});
9
+ t!==null&&t.scrollBy({left:e*Math.max(t.clientWidth-64,200),behavior:d()})};return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:u.root,children:[l.left&&/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:c(u.arrow,u.arrowLeft),"aria-label":t.scrollLeft,onMouseDown:e=>{e.preventDefault()},onClick:()=>{m(-1)},children:/* @__PURE__ */ (0,a.jsx)(i.IconChevronLeftOutlineRegular,{})}),/* @__PURE__ */ (0,a.jsx)(`div`,{ref:o,className:u.rail,role:`group`,"aria-label":t.group,onScroll:p,children:e.map(e=>/* @__PURE__ */ (0,a.jsx)(`div`,{className:u.item,children:n(e)},e.id))}),l.right&&/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:c(u.arrow,u.arrowRight),"aria-label":t.scrollRight,onMouseDown:e=>{e.preventDefault()},onClick:()=>{m(1)},children:/* @__PURE__ */ (0,a.jsx)(i.IconChevronRightOutlineRegular,{})})]})}let p=`@deepseek-ai/dsh-client-ui-attachment/DropOverlay.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(p)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-attachment`,e.dataset.pluginCss=p,e.textContent=`.cpj-8a_mask{z-index:1000;pointer-events:none;background-color:var(--dsw-alias-bg-mask-drop);backdrop-filter:blur(10px);justify-content:center;align-items:center;animation:.16s ease-out cpj-8a_fade-in;display:flex;position:fixed;inset:0}@keyframes cpj-8a_fade-in{0%{opacity:0}to{opacity:1}}@media (prefers-reduced-motion:reduce){.cpj-8a_mask{animation:none}}.cpj-8a_wrap{color:var(--dsw-alias-label-primary);text-align:center;flex-direction:column;align-items:center;margin-top:-3%;padding:0 40px;display:flex}.cpj-8a_illustration{width:115px;height:84px}.cpj-8a_title{font:var(--dsw-font-l-20);margin-top:16px}.cpj-8a_desc{font:var(--dsw-font-s-14);color:var(--dsw-alias-label-tertiary);white-space:pre-wrap;margin-top:16px}`,document.head.appendChild(e)}var m={desc:`cpj-8a_desc`,"fade-in":`cpj-8a_fade-in`,illustration:`cpj-8a_illustration`,mask:`cpj-8a_mask`,title:`cpj-8a_title`,wrap:`cpj-8a_wrap`};function h({disabled:e,labels:t}){return(0,o.createPortal)(/* @__PURE__ */ (0,a.jsx)(`div`,{className:m.mask,role:`status`,children:/* @__PURE__ */ (0,a.jsxs)(`div`,{className:m.wrap,children:[/* @__PURE__ */ (0,a.jsx)(`div`,{className:m.illustration,"aria-hidden":`true`,children:e?/* @__PURE__ */ (0,a.jsx)(_,{}):/* @__PURE__ */ (0,a.jsx)(g,{})}),/* @__PURE__ */ (0,a.jsx)(`div`,{className:m.title,children:t.title}),!e&&t.desc!==void 0&&/* @__PURE__ */ (0,a.jsx)(`div`,{className:m.desc,children:t.desc})]})}),document.body)}let g=()=>/* @__PURE__ */ (0,a.jsxs)(`svg`,{width:`115`,height:`84`,viewBox:`0 0 115 84`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[/* @__PURE__ */ (0,a.jsxs)(`g`,{clipPath:`url(#dshDropOverlayClip)`,children:[/* @__PURE__ */ (0,a.jsx)(`rect`,{y:`17.0742`,width:`44.1832`,height:`43.6431`,rx:`12`,transform:`rotate(-22.7338 0 17.0742)`,fill:`#9CE5ED`}),/* @__PURE__ */ (0,a.jsx)(`rect`,{x:`73.4043`,y:`8.54297`,width:`43.7267`,height:`50.5284`,rx:`8`,transform:`rotate(17.403 73.4043 8.54297)`,fill:`#679EFE`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M30.4917 28.1369L40.8865 33.4564L37.2232 34.9524L29.5302 31.0159L26.7919 39.2122L23.1285 40.7082L26.8287 29.6338L16.8967 24.5516L20.5601 23.0556L27.7902 26.7549L30.3639 19.052L34.0273 17.556L30.4917 28.1369Z`,fill:`white`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M77.5088 26.3047L101.057 33.7966`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M72.2646 42.7871L86.3938 47.2823`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M74.8867 34.5469L98.4353 42.0388`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`rect`,{x:`31.583`,y:`38.6641`,width:`44.9157`,height:`44.3666`,rx:`12`,transform:`rotate(-0.134233 31.583 38.6641)`,fill:`#3964FE`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M38.9521 73.0337C39.6129 71.7086 41.7113 66.0937 43.5113 61.1663C44.1607 59.3885 46.7484 59.3923 47.4591 61.1465C48.9728 64.8828 50.7969 68.6922 51.9988 69.1925C54.2946 70.1482 57.9854 59.3573 68.0064 70.1801`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`circle`,{cx:`60.6157`,cy:`52.247`,r:`4.38794`,transform:`rotate(22.5996 60.6157 52.247)`,fill:`white`})]}),/* @__PURE__ */ (0,a.jsx)(`defs`,{children:/* @__PURE__ */ (0,a.jsx)(`clipPath`,{id:`dshDropOverlayClip`,children:/* @__PURE__ */ (0,a.jsx)(`rect`,{width:`115`,height:`84`,fill:`white`})})})]}),_=()=>/* @__PURE__ */ (0,a.jsxs)(`svg`,{width:`115`,height:`84`,viewBox:`0 0 115 84`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M29.6829 4.63701L11.0677 12.4368C4.95519 14.998 2.07624 22.0294 4.6374 28.1419L12.2285 46.259C14.7896 52.3715 21.8211 55.2505 27.9336 52.6893L46.5488 44.8895C52.6613 42.3283 55.5403 35.2969 52.9791 29.1844L45.388 11.0673C42.8269 4.9548 35.7954 2.07585 29.6829 4.63701Z`,fill:`#979DA6`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M30.4915 28.1375L40.8863 33.4569L37.223 34.9529L29.53 31.0165L26.7917 39.2128L23.1283 40.7088L26.8285 29.6344L16.8965 24.5522L20.5599 23.0562L27.79 26.7555L30.3637 19.0526L34.0271 17.5566L30.4915 28.1375Z`,fill:`white`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M107.496 19.2285L81.0381 10.9357C76.8221 9.61423 72.333 11.9607 71.0116 16.1768L60.6844 49.1246C59.363 53.3406 61.7095 57.8297 65.9255 59.1511L92.383 67.4439C96.599 68.7654 101.088 66.4189 102.41 62.2029L112.737 29.255C114.058 25.039 111.712 20.55 107.496 19.2285Z`,fill:`#979DA6`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M77.5088 26.3047L101.057 33.7967`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M72.2646 42.7871L86.3938 47.2823`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M74.8867 34.5469L98.4353 42.0388`,stroke:`white`,strokeWidth:`3`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M66.5798 30.1418L41.481 30.2006C33.5281 30.2193 27.0962 36.6815 27.1148 44.6343L27.172 69.0742C27.1907 77.0271 33.6529 83.459 41.6057 83.4404L66.7045 83.3816C74.6574 83.363 81.0894 76.9008 81.0707 68.9479L81.0135 44.5081C80.9949 36.5552 74.5327 30.1232 66.5798 30.1418Z`,fill:`#F59E0B`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M54 70.7969C61.732 70.7969 68 64.5289 68 56.7969C68 49.0649 61.732 42.7969 54 42.7969C46.268 42.7969 40 49.0649 40 56.7969C40 64.5289 46.268 70.7969 54 70.7969Z`,stroke:`white`,strokeWidth:`3.5`}),/* @__PURE__ */ (0,a.jsx)(`path`,{d:`M44 46.7969L64 66.7969`,stroke:`white`,strokeWidth:`3.5`,strokeLinecap:`round`})]}),v=`@deepseek-ai/dsh-client-ui-attachment/FileCard.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(v)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-attachment`,e.dataset.pluginCss=v,e.textContent=`.Mdc2uq_card{border:.5px solid var(--dsw-alias-border-l2,#0000001f);border-radius:var(--dsw-radius-lg);background:var(--dsw-specific-input-major,transparent);box-sizing:border-box;text-align:left;align-items:center;gap:10px;width:240px;height:64px;padding:0 12px;display:inline-flex;position:relative}.Mdc2uq_failed{border-color:var(--dsw-alias-state-error-primary,#d54941)}.Mdc2uq_icon{flex:none;justify-content:center;align-items:center;width:28px;height:28px;display:inline-flex}.Mdc2uq_spinner{corner-shape:round;border:2px solid;border-top-color:#0000;border-radius:50%;width:20px;height:20px;animation:.8s linear infinite Mdc2uq_file-card-spin}@keyframes Mdc2uq_file-card-spin{to{transform:rotate(360deg)}}.Mdc2uq_body{flex-direction:column;flex:1;min-width:0;padding:8px 0;display:flex}.Mdc2uq_retry{color:inherit;font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;padding:0}.Mdc2uq_name{white-space:nowrap;text-overflow:ellipsis;color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500;line-height:22px;overflow:hidden}.Mdc2uq_meta{white-space:nowrap;text-overflow:ellipsis;color:var(--dsw-alias-label-tertiary,#00000073);font-size:12px;line-height:15px;overflow:hidden}.Mdc2uq_metaFailed{color:var(--dsw-alias-state-error-primary,#d54941)}.Mdc2uq_remove{corner-shape:round;background:var(--dsw-alias-button-contrast-fill,#000000b8);width:18px;height:18px;color:var(--dsw-alias-label-primary-inverted,#fff);opacity:0;cursor:pointer;border:none;border-radius:50%;justify-content:center;align-items:center;padding:0;transition:opacity .2s ease-in-out;display:inline-flex;position:absolute;top:6px;right:6px}.Mdc2uq_card:hover .Mdc2uq_remove,.Mdc2uq_remove:focus-visible{opacity:1}@media (pointer:coarse){.Mdc2uq_remove{opacity:1}}@media (prefers-reduced-motion:reduce){.Mdc2uq_remove{transition:none}}.Mdc2uq_card:hover .Mdc2uq_name,.Mdc2uq_card:focus-within .Mdc2uq_name{padding-right:18px}.Mdc2uq_removeFailed{background:var(--dsw-alias-state-error-primary,#d54941);color:#fff;opacity:1}.Mdc2uq_progressTrack{background:var(--dsw-alias-fill-tertiary,#00000014);border-radius:1px;height:2px;position:absolute;bottom:5px;left:12px;right:12px;overflow:hidden}.Mdc2uq_progressBar{border-radius:inherit;background:var(--dsw-alias-brand-primary,#4d6bfe);width:35%;height:100%;animation:1.2s ease-in-out infinite alternate Mdc2uq_file-card-progress;display:block}.Mdc2uq_progressBar[style]{animation:none}@keyframes Mdc2uq_file-card-progress{0%{transform:translate(-70%)}to{transform:translate(220%)}}@media (pointer:coarse){.Mdc2uq_remove{opacity:1}}`,document.head.appendChild(e)}var y={body:`Mdc2uq_body`,card:`Mdc2uq_card`,failed:`Mdc2uq_failed`,"file-card-progress":`Mdc2uq_file-card-progress`,"file-card-spin":`Mdc2uq_file-card-spin`,icon:`Mdc2uq_icon`,meta:`Mdc2uq_meta`,metaFailed:`Mdc2uq_metaFailed`,name:`Mdc2uq_name`,progressBar:`Mdc2uq_progressBar`,progressTrack:`Mdc2uq_progressTrack`,remove:`Mdc2uq_remove`,removeFailed:`Mdc2uq_removeFailed`,retry:`Mdc2uq_retry`,spinner:`Mdc2uq_spinner`};function b({name:e,bytes:t,state:n,progress:r,labels:o,onRemove:s,onRetry:c}){let l=(0,i.fileExtension)(e).toUpperCase().slice(0,8),u=n===`uploading`?r===void 0?o.uploading:o.uploadingPercent(Math.round(Math.min(1,Math.max(0,r))*100)):n===`error`?o.failed:[l,(0,i.fileSizeText)(t)].filter(e=>e!==``).join(` `),d=n===`error`;return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:`${y.card}${d?` ${y.failed}`:``}`,title:e,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.icon,"aria-hidden":!0,children:n===`uploading`?/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.spinner}):/* @__PURE__ */ (0,a.jsx)(i.FileTypeIcon,{path:e})}),d?/* @__PURE__ */ (0,a.jsxs)(`button`,{type:`button`,className:`${y.body} ${y.retry}`,"aria-label":o.retry,onMouseDown:e=>{e.preventDefault()},onClick:c,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.name,children:e}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:`${y.meta} ${y.metaFailed}`,children:u})]}):/* @__PURE__ */ (0,a.jsxs)(`span`,{className:y.body,"aria-label":o.label,children:[/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.name,children:e}),/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.meta,children:u})]}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:d?`${y.remove} ${y.removeFailed}`:y.remove,"aria-label":o.remove,onMouseDown:e=>{e.preventDefault()},onClick:s,children:/* @__PURE__ */ (0,a.jsx)(i.IconCloseFillRegular,{size:12})}),n===`uploading`&&/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.progressTrack,"aria-hidden":!0,children:/* @__PURE__ */ (0,a.jsx)(`span`,{className:y.progressBar,style:r===void 0?void 0:{width:`${String(Math.min(1,Math.max(0,r))*100)}%`}})})]})}function x(e){return{dialog:e(`image.preview`),close:e(`image.closePreview`)}}function S(e){return{image:e(`image.label`),open:e(`image.openOriginal`),openNamed:t=>e(`image.openOriginalLabel`,{label:t}),loading:e(`image.loading`),loadFailed:e(`image.loadFailed`),tooLarge:e(`image.previewTooLarge`),lightbox:x(e)}}function C(e,t,n){return t?{title:e(`attachment.dropTitle`),desc:n===void 0?void 0:e(`attachment.dropDesc`,n)}:{title:e(`attachment.dropBlocked`)}}function w(e,t){return{label:e(`file.pending`),remove:e(`file.remove`,{name:t}),uploading:e(`file.uploading`),uploadingPercent:t=>e(`file.uploadingPercent`,{percent:t}),failed:e(`file.uploadFailed`),retry:e(`file.retry`,{name:t})}}function T(e){return{group:e(`attachment.pending`),scrollLeft:e(`attachment.scrollLeft`),scrollRight:e(`attachment.scrollRight`)}}function E(e,t){let n=/* @__PURE__ */ new Set,r=0;for(let i of e.items){if(i.kind!==`file`)continue;let e=t[r++];typeof i.webkitGetAsEntry==`function`&&i.webkitGetAsEntry()?.isDirectory===!0&&e!==void 0&&n.add(e)}return n}function D(e,t,n,r){let i=e=>{let t=e.dataTransfer;return t===null||!t.types.includes(`Files`)?null:t},a=()=>{n.current=0,r(!1)},o=e=>{i(e)!==null&&(e.preventDefault(),n.current+=1,r(!0))},s=t=>{let n=i(t);n!==null&&(t.preventDefault(),n.dropEffect=e?`copy`:`none`)},c=e=>{if(i(e)===null)return;n.current=Math.max(0,n.current-1),n.current===0&&r(!1);let t=e.clientX<=0||e.clientY<=0||e.clientX>=window.innerWidth||e.clientY>=window.innerHeight;(e.target===document.documentElement||e.target===document.body)&&t&&a()},l=n=>{let r=i(n);if(r!==null&&(n.preventDefault(),a(),e)){let e=[...r.files];t(e,E(r,e))}};return document.addEventListener(`dragenter`,o),document.addEventListener(`dragover`,s),document.addEventListener(`dragleave`,c),document.addEventListener(`drop`,l),window.addEventListener(`dragend`,a),()=>{document.removeEventListener(`dragenter`,o),document.removeEventListener(`dragover`,s),document.removeEventListener(`dragleave`,c),document.removeEventListener(`drop`,l),window.removeEventListener(`dragend`,a)}}let O=`@deepseek-ai/dsh-client-ui-attachment/ComposerAttachments.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(O)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-attachment`,e.dataset.pluginCss=O,e.textContent=`.O5Qubq_rail{min-width:0;margin-bottom:-6px;padding:2px 10px 0}.O5Qubq_imageItem{width:64px;height:64px;position:relative}.O5Qubq_thumbnail{border:.5px solid var(--dsw-alias-border-l2-darkmode-thin);border-radius:var(--dsw-radius-xl);background:var(--dsw-alias-interactive-bg-hover);cursor:zoom-in;width:64px;height:64px;padding:0;overflow:hidden}.O5Qubq_thumbnail img{object-fit:cover;width:100%;height:100%;display:block}.O5Qubq_overlay{border-radius:var(--dsw-radius-xl);color:#fff;font-variant-numeric:tabular-nums;background:#00000073;border:none;place-items:center;padding:0;font-size:13px;font-weight:500;display:grid;position:absolute;inset:0}.O5Qubq_failed{cursor:pointer;background:#dc2626b3}.O5Qubq_remove{z-index:1;corner-shape:round;background:var(--dsw-alias-button-contrast-fill);width:18px;height:18px;color:var(--dsw-alias-label-primary-inverted);cursor:pointer;opacity:0;border:none;border-radius:50%;place-items:center;padding:0;transition:opacity .2s ease-in-out;display:grid;position:absolute;top:4px;right:4px}.O5Qubq_imageItem:hover .O5Qubq_remove,.O5Qubq_remove:focus-visible{opacity:1}@media (pointer:coarse){.O5Qubq_remove{opacity:1}}@media (prefers-reduced-motion:reduce){.O5Qubq_remove{transition:none}}`,document.head.appendChild(e)}var k={failed:`O5Qubq_failed`,imageItem:`O5Qubq_imageItem`,overlay:`O5Qubq_overlay`,rail:`O5Qubq_rail`,remove:`O5Qubq_remove`,thumbnail:`O5Qubq_thumbnail`};function A({attachments:e,canAcceptDrop:t,onAddFiles:n,onRemoveAttachment:o,uploads:s,onRetryFile:c,dropLimits:l,t:u}){let[d,p]=(0,r.useState)(null),[m,g]=(0,r.useState)(!1),_=(0,r.useRef)(0),v=(0,r.useCallback)(()=>{p(null)},[]);(0,r.useEffect)(()=>{d!==null&&!e.some(e=>e.id===d.id)&&p(null)},[e,d]),(0,r.useEffect)(()=>D(t,n,_,g),[t,n]);let y=(0,r.useMemo)(()=>e.map(e=>({id:e.id,attachment:e})),[e]);return/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[m&&/* @__PURE__ */ (0,a.jsx)(h,{disabled:!t,labels:C(u,t,l)}),y.length>0&&/* @__PURE__ */ (0,a.jsx)(`div`,{className:k.rail,children:/* @__PURE__ */ (0,a.jsx)(f,{items:y,labels:T(u),renderItem:e=>{let t=e.attachment,n=s[t.id];if(t.kind===`image`){let e=t.file.name;return/* @__PURE__ */ (0,a.jsxs)(`div`,{className:k.imageItem,children:[/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:k.thumbnail,title:u(`image.openOriginal`),onClick:()=>{p(t)},children:/* @__PURE__ */ (0,a.jsx)(`img`,{src:t.previewUrl,alt:e||u(`image.pending`)})}),(n===void 0||n.status===`uploading`)&&/* @__PURE__ */ (0,a.jsx)(`span`,{className:k.overlay,role:`status`,children:n?.total?`${String(Math.round(Math.min(1,n.loaded/n.total)*100))}%`:`…`}),n?.status===`error`&&/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:`${k.overlay} ${k.failed}`,"aria-label":u(`file.retry`,{name:e}),onMouseDown:e=>{e.preventDefault()},onClick:()=>{c(t.id)},children:u(`image.retry`)}),/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:k.remove,"aria-label":u(`image.remove`,{name:e}),onMouseDown:e=>{e.preventDefault()},onClick:()=>{o(t.id)},children:/* @__PURE__ */ (0,a.jsx)(i.IconCloseFillRegular,{size:12})})]})}let r=`file`in t?t.file.name:t.stored.name,l=`file`in t?t.file.size:t.stored.bytes;return/* @__PURE__ */ (0,a.jsx)(b,{name:r||u(`file.label`),bytes:l,state:n===void 0||n.status===`uploading`?`uploading`:n.status===`ready`?`ready`:`error`,...n?.status===`uploading`&&n.total!==void 0&&n.total>0?{progress:n.loaded/n.total}:{},labels:w(u,r),onRemove:()=>{o(t.id)},onRetry:()=>{c(t.id)}})}})}),d!==null&&/* @__PURE__ */ (0,a.jsx)(i.ImageLightbox,{src:d.previewUrl,alt:d.file.name||u(`image.original`),labels:x(u),onClose:v})]})}let j=`@deepseek-ai/dsh-client-ui-attachment/MessageImage.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(j)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-attachment`,e.dataset.pluginCss=j,e.textContent=`.zeivWW_gallery{flex-wrap:wrap;gap:10px;max-width:100%;display:flex}.zeivWW_gallery[data-align=end]{justify-content:flex-end;align-self:flex-end}.zeivWW_gallery[data-align=start]{justify-content:flex-start;align-self:flex-start}.zeivWW_frame{border:.5px solid var(--dsw-alias-border-l2-darkmode-thin);border-radius:var(--dsw-radius-xl);background:var(--dsw-alias-interactive-bg-hover);cursor:zoom-in;flex:none;place-items:center;min-width:44px;min-height:44px;padding:0;display:grid;overflow:hidden}.zeivWW_frame[data-variant=tile]{width:64px;min-width:64px;height:64px;min-height:64px}.zeivWW_frame img{object-fit:cover;width:100%;height:100%;display:block}.zeivWW_loading,.zeivWW_error{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}.zeivWW_error{border:.5px solid var(--dsw-alias-border-l2-darkmode-thin);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-interactive-bg-hover-danger);cursor:pointer;max-width:240px;padding:10px 12px}.zeivWW_error[data-variant=tile]{border-radius:var(--dsw-radius-xl);width:64px;height:64px;padding:4px;overflow:hidden}.zeivWW_frame[data-variant=thumbnail],.zeivWW_error[data-variant=thumbnail]{box-sizing:border-box;border-radius:var(--dsw-radius-lg);place-items:center;width:48px;min-width:48px;height:48px;min-height:48px;padding:2px;display:grid;overflow:hidden}.zeivWW_frame[data-variant=thumbnail] img{object-fit:contain}.zeivWW_spinner{animation:.9s linear infinite zeivWW_spinner-rotate}@keyframes zeivWW_spinner-rotate{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.zeivWW_spinner{animation:none}}.zeivWW_frame:focus-visible,.zeivWW_error:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}`,document.head.appendChild(e)}var M={error:`zeivWW_error`,frame:`zeivWW_frame`,gallery:`zeivWW_gallery`,loading:`zeivWW_loading`,spinner:`zeivWW_spinner`,"spinner-rotate":`zeivWW_spinner-rotate`};function N(e){let t=e.width/e.height,n=Math.min(4,Math.max(.25,t)),r=n>=1?{width:240,height:240/n}:{width:240*n,height:240},i=Math.min(1,e.width/r.width,e.height/r.height);return{width:Math.max(1,Math.round(r.width*i)),height:Math.max(1,Math.round(r.height*i)),objectPosition:t<.25?`center top`:t>4?`left center`:`center`}}function P(e){return`attachment`in e?e.attachment:e.preview.width!==void 0&&e.preview.height!==void 0?{width:e.preview.width,height:e.preview.height}:void 0}function F({image:e,load:t,variant:n,labels:o}){let s=`preview`in e?e.preview:void 0,c=`attachment`in e?e.attachment:void 0,[l,u]=(0,r.useState)(()=>c===void 0?null:t.peek?.(c)??null),[d,f]=(0,r.useState)(null),[p,m]=(0,r.useState)(),[h,g]=(0,r.useState)(!1),[_,v]=(0,r.useState)(0),y=(0,r.useCallback)(()=>{v(e=>e+1)},[]),b=(0,r.useCallback)(()=>{g(!1)},[]),x=(0,r.useMemo)(()=>P(e),[e]),S=(0,r.useMemo)(()=>{if(n!==`single`)return;let e=p??x;return e===void 0?{width:240,height:240,objectPosition:`center`}:N(e)},[x,p,n]);(0,r.useEffect)(()=>{if(c===void 0)return;let e=!0;return f(null),m(void 0),u(t.peek?.(c)??null),t(c).then(t=>{e&&u(t)}).catch(t=>{if(!e)return;let n=typeof t==`object`&&t&&`details`in t?t.details?.reason:void 0;f(n===`IMAGE_TOO_LARGE`||n===`IMAGE_TOO_MANY_PIXELS`?`too-large`:`unavailable`)}),()=>{e=!1}},[c,t,_]);let C=s?.url??l,w=(0,r.useRef)(null),T=(0,r.useRef)(C);T.current=C;let E=(0,r.useCallback)(e=>{let t=w.current;w.current=e,t!==null&&t!==e&&t.removeAttribute(`src`),e!==null&&!e.hasAttribute(`src`)&&T.current!==null&&(e.src=T.current)},[]),D=(`attachment`in e?e.label:void 0)??s?.name??c?.name??o.image,O=n===`thumbnail`&&C===null;return d===`too-large`?/* @__PURE__ */ (0,a.jsx)(`div`,{className:M.error,"data-variant":n,role:`status`,title:o.tooLarge,children:o.tooLarge}):d?/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:M.error,"data-variant":n,title:n===`thumbnail`?o.loadFailed:void 0,"aria-label":n===`thumbnail`?o.loadFailed:void 0,onClick:y,children:n===`thumbnail`?/* @__PURE__ */ (0,a.jsx)(`span`,{"aria-hidden":`true`,children:/* @__PURE__ */ (0,a.jsx)(i.IconRefreshOutlineRegular,{})}):o.loadFailed}):/* @__PURE__ */ (0,a.jsxs)(a.Fragment,{children:[/* @__PURE__ */ (0,a.jsx)(`button`,{type:`button`,className:M.frame,"data-variant":n,style:S===void 0?void 0:{width:S.width,height:S.height},title:O?o.loading:o.open,"aria-label":O?o.loading:o.openNamed(D),"aria-busy":O||void 0,onClick:()=>{C!==null&&g(!0)},children:C===null?/* @__PURE__ */ (0,a.jsx)(`span`,{className:M.loading,"aria-hidden":O||void 0,children:O?/* @__PURE__ */ (0,a.jsx)(i.IconLoadingOutlineRegular,{className:M.spinner}):o.loading}):/* @__PURE__ */ (0,a.jsx)(`img`,{ref:E,src:C,alt:D,loading:`lazy`,decoding:`async`,onLoad:e=>{if(w.current!==e.currentTarget)return;let{naturalWidth:t,naturalHeight:n}=e.currentTarget;t>0&&n>0&&m(e=>e?.width===t&&e.height===n?e:{width:t,height:n})},onError:e=>{w.current===e.currentTarget&&f(`unavailable`)},style:S===void 0?void 0:{objectPosition:S.objectPosition}})}),h&&C!==null&&/* @__PURE__ */ (0,a.jsx)(i.ImageLightbox,{src:C,alt:D,labels:o.lightbox,onClose:b})]})}function I({images:e,load:t,align:n,compact:r=!1,thumbnail:i=!1,labels:o}){if(e.length===0)return null;let s=i?`thumbnail`:r||e.length>1?`tile`:`single`;return/* @__PURE__ */ (0,a.jsx)(`div`,{className:M.gallery,"data-align":n,children:e.map((e,n)=>/* @__PURE__ */ (0,a.jsx)(F,{image:e,load:t,variant:s,labels:o},`${`attachment`in e?e.attachment.attachmentId:e.preview.url}:${n}`))})}function L({images:e,loadImage:t,align:n,compact:r=!1,thumbnail:i=!1,t:o}){return/* @__PURE__ */ (0,a.jsx)(I,{images:e,load:t,align:n,compact:r,thumbnail:i,labels:S(o)})}let R=[`slots`];function z(e){e.slots.inject(`conversation.input.attachments`,()=>e.slots.register({name:`conversation.input.attachments`,locale:`conversation`},A)),e.slots.inject(`conversation.message.images`,()=>e.slots.register({name:`conversation.message.images`,locale:`conversation`},L)),e.slots.inject(`conversation.trajectory.images`,()=>e.slots.register({name:`conversation.trajectory.images`,locale:`conversation`},L)),e.slots.inject(`tool.call.images`,()=>e.slots.register({name:`tool.call.images`,locale:`conversation`},L))}return n.apply=z,n.inject=R,t.exports}});